| Requires any of the roles: | Agent, Administrator, Agent, Administrator, Agent, Administrator |
| GET,POST,PUT,DELETE,OPTIONS | /v1/Document/{DocumentId} | ||
|---|---|---|---|
| GET,POST,PUT,DELETE,OPTIONS | /v1/Document/ |
<?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 Document implements JsonSerializable
{
public function __construct(
/** @var string */
public string $DocumentId='',
/** @var string|null */
public ?string $DocType=null,
/** @var string|null */
public ?string $DocCategory=null,
/** @var string|null */
public ?string $DocSubCategory=null,
/** @var string|null */
public ?string $DocTitle=null,
/** @var string|null */
public ?string $DocDescription=null,
/** @var ByteArray|null */
public ?ByteArray $DocData=null,
/** @var DateTime|null */
public ?DateTime $DocExpiration=null,
/** @var string|null */
public ?string $DocMimeType=null,
/** @var int */
public int $DisplayOrder=0,
/** @var float */
public float $FileSizeInKB=0.0,
/** @var string|null */
public ?string $Link=null,
/** @var DateTime|null */
public ?DateTime $UploadDate=null,
/** @var string|null */
public ?string $DocKey=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DocumentId'])) $this->DocumentId = $o['DocumentId'];
if (isset($o['DocType'])) $this->DocType = $o['DocType'];
if (isset($o['DocCategory'])) $this->DocCategory = $o['DocCategory'];
if (isset($o['DocSubCategory'])) $this->DocSubCategory = $o['DocSubCategory'];
if (isset($o['DocTitle'])) $this->DocTitle = $o['DocTitle'];
if (isset($o['DocDescription'])) $this->DocDescription = $o['DocDescription'];
if (isset($o['DocData'])) $this->DocData = JsonConverters::from('ByteArray', $o['DocData']);
if (isset($o['DocExpiration'])) $this->DocExpiration = JsonConverters::from('DateTime', $o['DocExpiration']);
if (isset($o['DocMimeType'])) $this->DocMimeType = $o['DocMimeType'];
if (isset($o['DisplayOrder'])) $this->DisplayOrder = $o['DisplayOrder'];
if (isset($o['FileSizeInKB'])) $this->FileSizeInKB = $o['FileSizeInKB'];
if (isset($o['Link'])) $this->Link = $o['Link'];
if (isset($o['UploadDate'])) $this->UploadDate = JsonConverters::from('DateTime', $o['UploadDate']);
if (isset($o['DocKey'])) $this->DocKey = $o['DocKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DocumentId)) $o['DocumentId'] = $this->DocumentId;
if (isset($this->DocType)) $o['DocType'] = $this->DocType;
if (isset($this->DocCategory)) $o['DocCategory'] = $this->DocCategory;
if (isset($this->DocSubCategory)) $o['DocSubCategory'] = $this->DocSubCategory;
if (isset($this->DocTitle)) $o['DocTitle'] = $this->DocTitle;
if (isset($this->DocDescription)) $o['DocDescription'] = $this->DocDescription;
if (isset($this->DocData)) $o['DocData'] = JsonConverters::to('ByteArray', $this->DocData);
if (isset($this->DocExpiration)) $o['DocExpiration'] = JsonConverters::to('DateTime', $this->DocExpiration);
if (isset($this->DocMimeType)) $o['DocMimeType'] = $this->DocMimeType;
if (isset($this->DisplayOrder)) $o['DisplayOrder'] = $this->DisplayOrder;
if (isset($this->FileSizeInKB)) $o['FileSizeInKB'] = $this->FileSizeInKB;
if (isset($this->Link)) $o['Link'] = $this->Link;
if (isset($this->UploadDate)) $o['UploadDate'] = JsonConverters::to('DateTime', $this->UploadDate);
if (isset($this->DocKey)) $o['DocKey'] = $this->DocKey;
return empty($o) ? new class(){} : $o;
}
}
class DocumentResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<Document>|null */
public ?array $Document=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Document'])) $this->Document = JsonConverters::fromArray('Document', $o['Document']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Document)) $o['Document'] = JsonConverters::toArray('Document', $this->Document);
return empty($o) ? new class(){} : $o;
}
}
class DocumentRequest implements JsonSerializable
{
public function __construct(
/** @var array<Document>|null */
public ?array $Document=null,
/** @var string */
public string $DocumentId='',
/** @var array<string,string>|null */
public ?array $Fields=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Document'])) $this->Document = JsonConverters::fromArray('Document', $o['Document']);
if (isset($o['DocumentId'])) $this->DocumentId = $o['DocumentId'];
if (isset($o['Fields'])) $this->Fields = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Fields']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Document)) $o['Document'] = JsonConverters::toArray('Document', $this->Document);
if (isset($this->DocumentId)) $o['DocumentId'] = $this->DocumentId;
if (isset($this->Fields)) $o['Fields'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Fields);
return empty($o) ? new class(){} : $o;
}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/Document/{DocumentId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"Document":[{"DocumentId":"00000000000000000000000000000000","DocType":"String","DocCategory":"String","DocSubCategory":"String","DocTitle":"String","DocDescription":"String","DocData":"AA==","DocExpiration":"0001-01-01T00:00:00.0000000","DocMimeType":"String","DisplayOrder":0,"FileSizeInKB":0,"Link":"String","UploadDate":"0001-01-01T00:00:00.0000000","DocKey":"String"}],"DocumentId":"00000000000000000000000000000000","Fields":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Document":[{"DocumentId":"00000000000000000000000000000000","DocType":"String","DocCategory":"String","DocSubCategory":"String","DocTitle":"String","DocDescription":"String","DocData":"AA==","DocExpiration":"0001-01-01T00:00:00.0000000","DocMimeType":"String","DisplayOrder":0,"FileSizeInKB":0,"Link":"String","UploadDate":"0001-01-01T00:00:00.0000000","DocKey":"String"}]}