ScannerVision Web Server

<back to all web services

JsonMetadataUploadRequest

Requires Authentication
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class JsonDto implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class JsonRequestDto extends JsonDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ClientCode=null,
        /** @var string|null */
        public ?string $ClientRegistrationCode=null,
        /** @var string|null */
        public ?string $Token=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['ClientCode'])) $this->ClientCode = $o['ClientCode'];
        if (isset($o['ClientRegistrationCode'])) $this->ClientRegistrationCode = $o['ClientRegistrationCode'];
        if (isset($o['Token'])) $this->Token = $o['Token'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->ClientCode)) $o['ClientCode'] = $this->ClientCode;
        if (isset($this->ClientRegistrationCode)) $o['ClientRegistrationCode'] = $this->ClientRegistrationCode;
        if (isset($this->Token)) $o['Token'] = $this->Token;
        return empty($o) ? new class(){} : $o;
    }
}

class JsonMetadataUploadRequest extends JsonRequestDto implements JsonSerializable
{
    /**
     * @param string|null $ClientCode
     * @param string|null $ClientRegistrationCode
     * @param string|null $Token
     */
    public function __construct(
        ?string $ClientCode=null,
        ?string $ClientRegistrationCode=null,
        ?string $Token=null,
        /** @var string|null */
        public ?string $UploadFileName=null,
        /** @var string|null */
        public ?string $OriginalFileName=null,
        /** @var string|null */
        public ?string $TemplateGuid=null,
        /** @var string|null */
        public ?string $ClientIpAddress=null,
        /** @var string|null */
        public ?string $ClientGuid=null,
        /** @var string|null */
        public ?string $ClientName=null,
        /** @var string|null */
        public ?string $ClientId=null,
        /** @var string|null */
        public ?string $ClientSerialNumber=null,
        /** @var string|null */
        public ?string $UserName=null,
        /** @var string|null */
        public ?string $UserEmail=null,
        /** @var string|null */
        public ?string $UserHomeFolder=null,
        /** @var array<string,string>|null */
        public ?array $TemplateQuestions=null,
        /** @var array<string,string>|null */
        public ?array $GlobalQuestions=null
    ) {
        parent::__construct($ClientCode,$ClientRegistrationCode,$Token);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['UploadFileName'])) $this->UploadFileName = $o['UploadFileName'];
        if (isset($o['OriginalFileName'])) $this->OriginalFileName = $o['OriginalFileName'];
        if (isset($o['TemplateGuid'])) $this->TemplateGuid = $o['TemplateGuid'];
        if (isset($o['ClientIpAddress'])) $this->ClientIpAddress = $o['ClientIpAddress'];
        if (isset($o['ClientGuid'])) $this->ClientGuid = $o['ClientGuid'];
        if (isset($o['ClientName'])) $this->ClientName = $o['ClientName'];
        if (isset($o['ClientId'])) $this->ClientId = $o['ClientId'];
        if (isset($o['ClientSerialNumber'])) $this->ClientSerialNumber = $o['ClientSerialNumber'];
        if (isset($o['UserName'])) $this->UserName = $o['UserName'];
        if (isset($o['UserEmail'])) $this->UserEmail = $o['UserEmail'];
        if (isset($o['UserHomeFolder'])) $this->UserHomeFolder = $o['UserHomeFolder'];
        if (isset($o['TemplateQuestions'])) $this->TemplateQuestions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['TemplateQuestions']);
        if (isset($o['GlobalQuestions'])) $this->GlobalQuestions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['GlobalQuestions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->UploadFileName)) $o['UploadFileName'] = $this->UploadFileName;
        if (isset($this->OriginalFileName)) $o['OriginalFileName'] = $this->OriginalFileName;
        if (isset($this->TemplateGuid)) $o['TemplateGuid'] = $this->TemplateGuid;
        if (isset($this->ClientIpAddress)) $o['ClientIpAddress'] = $this->ClientIpAddress;
        if (isset($this->ClientGuid)) $o['ClientGuid'] = $this->ClientGuid;
        if (isset($this->ClientName)) $o['ClientName'] = $this->ClientName;
        if (isset($this->ClientId)) $o['ClientId'] = $this->ClientId;
        if (isset($this->ClientSerialNumber)) $o['ClientSerialNumber'] = $this->ClientSerialNumber;
        if (isset($this->UserName)) $o['UserName'] = $this->UserName;
        if (isset($this->UserEmail)) $o['UserEmail'] = $this->UserEmail;
        if (isset($this->UserHomeFolder)) $o['UserHomeFolder'] = $this->UserHomeFolder;
        if (isset($this->TemplateQuestions)) $o['TemplateQuestions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->TemplateQuestions);
        if (isset($this->GlobalQuestions)) $o['GlobalQuestions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->GlobalQuestions);
        return empty($o) ? new class(){} : $o;
    }
}

class JsonMetadataUploadResponse extends JsonDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $TemplateGuid=null,
        /** @var bool|null */
        public ?bool $InError=null,
        /** @var string|null */
        public ?string $ErrorMessage=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['TemplateGuid'])) $this->TemplateGuid = $o['TemplateGuid'];
        if (isset($o['InError'])) $this->InError = $o['InError'];
        if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->TemplateGuid)) $o['TemplateGuid'] = $this->TemplateGuid;
        if (isset($this->InError)) $o['InError'] = $this->InError;
        if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
        return empty($o) ? new class(){} : $o;
    }
}

PHP JsonMetadataUploadRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /json/reply/JsonMetadataUploadRequest HTTP/1.1 
Host: buildmax.org 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"UploadFileName":"String","OriginalFileName":"String","TemplateGuid":"String","ClientIpAddress":"String","ClientGuid":"String","ClientName":"String","ClientId":"String","ClientSerialNumber":"String","UserName":"String","UserEmail":"String","UserHomeFolder":"String","ClientCode":"String","ClientRegistrationCode":"String","Token":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"TemplateGuid":"String","InError":false,"ErrorMessage":"String"}