POST, PUT | /documents/containerItems |
---|
<?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 DocumentRequestBase implements JsonSerializable
{
public function __construct(
/** @description ExternalID */
// @ApiMember(Description="ExternalID", ExcludeInSchema=true, IsRequired=true, ParameterType="path")
/** @var string */
public string $ExternalId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ExternalId'])) $this->ExternalId = $o['ExternalId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ExternalId)) $o['ExternalId'] = $this->ExternalId;
return empty($o) ? new class(){} : $o;
}
}
class ContainerItemsRequest extends DocumentRequestBase implements JsonSerializable
{
/**
* @param string $ExternalId
*/
public function __construct(
string $ExternalId=''
) {
parent::__construct($ExternalId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
class ResponseBase implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Message=null,
/** @var bool|null */
public ?bool $IsSuccess=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['IsSuccess'])) $this->IsSuccess = $o['IsSuccess'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->IsSuccess)) $o['IsSuccess'] = $this->IsSuccess;
return empty($o) ? new class(){} : $o;
}
}
class ContainerItemsResponse extends ResponseBase implements JsonSerializable
{
/**
* @param string|null $Message
* @param bool|null $IsSuccess
*/
public function __construct(
?string $Message=null,
?bool $IsSuccess=null,
/** @var array<string>|null */
public ?array $ContainerItems=null
) {
parent::__construct($Message,$IsSuccess);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ContainerItems'])) $this->ContainerItems = JsonConverters::fromArray('string', $o['ContainerItems']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ContainerItems)) $o['ContainerItems'] = JsonConverters::toArray('string', $this->ContainerItems);
return empty($o) ? new class(){} : $o;
}
}
PHP ContainerItemsRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /documents/containerItems HTTP/1.1
Host: initiation.sirva.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"ExternalId":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"ContainerItems":["String"],"Message":"String","IsSuccess":false}