DigiOffice API Services Services

<back to all web services

AddFile

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 AddFileResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $FileID=''
    ) {
    }

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

class AddFile implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Link=null,
        /** @var string|null */
        public ?string $BlobID=null,
        /** @var int|null */
        public ?int $Size=null,
        /** @var bool|null */
        public ?bool $IsAttachment=null,
        /** @var bool|null */
        public ?bool $Data=null,
        /** @var bool|null */
        public ?bool $OCR=null,
        /** @var bool|null */
        public ?bool $Preview=null,
        /** @var string|null */
        public ?string $Type=null,
        /** @var DateTime|null */
        public ?DateTime $DateTimeLastModified=null,
        /** @var int|null */
        public ?int $MetricHeight=null,
        /** @var int|null */
        public ?int $MetricWidth=null,
        /** @var string|null */
        public ?string $DocumentID=null,
        /** @var string|null */
        public ?string $OriginalFileName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Link'])) $this->Link = $o['Link'];
        if (isset($o['BlobID'])) $this->BlobID = $o['BlobID'];
        if (isset($o['Size'])) $this->Size = $o['Size'];
        if (isset($o['IsAttachment'])) $this->IsAttachment = $o['IsAttachment'];
        if (isset($o['Data'])) $this->Data = $o['Data'];
        if (isset($o['OCR'])) $this->OCR = $o['OCR'];
        if (isset($o['Preview'])) $this->Preview = $o['Preview'];
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['DateTimeLastModified'])) $this->DateTimeLastModified = JsonConverters::from('DateTime', $o['DateTimeLastModified']);
        if (isset($o['MetricHeight'])) $this->MetricHeight = $o['MetricHeight'];
        if (isset($o['MetricWidth'])) $this->MetricWidth = $o['MetricWidth'];
        if (isset($o['DocumentID'])) $this->DocumentID = $o['DocumentID'];
        if (isset($o['OriginalFileName'])) $this->OriginalFileName = $o['OriginalFileName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Link)) $o['Link'] = $this->Link;
        if (isset($this->BlobID)) $o['BlobID'] = $this->BlobID;
        if (isset($this->Size)) $o['Size'] = $this->Size;
        if (isset($this->IsAttachment)) $o['IsAttachment'] = $this->IsAttachment;
        if (isset($this->Data)) $o['Data'] = $this->Data;
        if (isset($this->OCR)) $o['OCR'] = $this->OCR;
        if (isset($this->Preview)) $o['Preview'] = $this->Preview;
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->DateTimeLastModified)) $o['DateTimeLastModified'] = JsonConverters::to('DateTime', $this->DateTimeLastModified);
        if (isset($this->MetricHeight)) $o['MetricHeight'] = $this->MetricHeight;
        if (isset($this->MetricWidth)) $o['MetricWidth'] = $this->MetricWidth;
        if (isset($this->DocumentID)) $o['DocumentID'] = $this->DocumentID;
        if (isset($this->OriginalFileName)) $o['OriginalFileName'] = $this->OriginalFileName;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AddFile 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/AddFile HTTP/1.1 
Host: test-do-services.klokgroep.nl 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Link":"String","BlobID":"00000000-0000-0000-0000-000000000000","Size":0,"IsAttachment":false,"Data":false,"OCR":false,"Preview":false,"Type":"String","DateTimeLastModified":"0001-01-01T00:00:00.0000000","MetricHeight":0,"MetricWidth":0,"DocumentID":"00000000-0000-0000-0000-000000000000","OriginalFileName":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"FileID":"00000000-0000-0000-0000-000000000000"}