| POST | /v1/coverage/pto |
|---|
<?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 CoveragePtoCheck implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Ok=null,
/** @var string|null */
public ?string $Text=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Ok'])) $this->Ok = $o['Ok'];
if (isset($o['Text'])) $this->Text = $o['Text'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Ok)) $o['Ok'] = $this->Ok;
if (isset($this->Text)) $o['Text'] = $this->Text;
return empty($o) ? new class(){} : $o;
}
}
class CoveragePlannedItem implements JsonSerializable
{
public function __construct(
/** @var int */
public int $WorkerTimeOffID=0,
/** @var int */
public int $ContactId=0,
/** @var string|null */
public ?string $WorkerName=null,
/** @var string|null */
public ?string $Initials=null,
/** @var string|null */
public ?string $Dates=null,
/** @var string|null */
public ?string $Reason=null,
/** @var string|null */
public ?string $Stage=null,
/** @var string|null */
public ?string $StageLabel=null,
/** @var bool|null */
public ?bool $NeedBook=null,
/** @var int|null */
public ?int $CoverageGapId=null,
/** @var array<CoveragePtoCheck>|null */
public ?array $Checks=null,
/** @var string|null */
public ?string $DenyReason=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['WorkerTimeOffID'])) $this->WorkerTimeOffID = $o['WorkerTimeOffID'];
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
if (isset($o['Initials'])) $this->Initials = $o['Initials'];
if (isset($o['Dates'])) $this->Dates = $o['Dates'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['Stage'])) $this->Stage = $o['Stage'];
if (isset($o['StageLabel'])) $this->StageLabel = $o['StageLabel'];
if (isset($o['NeedBook'])) $this->NeedBook = $o['NeedBook'];
if (isset($o['CoverageGapId'])) $this->CoverageGapId = $o['CoverageGapId'];
if (isset($o['Checks'])) $this->Checks = JsonConverters::fromArray('CoveragePtoCheck', $o['Checks']);
if (isset($o['DenyReason'])) $this->DenyReason = $o['DenyReason'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->WorkerTimeOffID)) $o['WorkerTimeOffID'] = $this->WorkerTimeOffID;
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
if (isset($this->Initials)) $o['Initials'] = $this->Initials;
if (isset($this->Dates)) $o['Dates'] = $this->Dates;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->Stage)) $o['Stage'] = $this->Stage;
if (isset($this->StageLabel)) $o['StageLabel'] = $this->StageLabel;
if (isset($this->NeedBook)) $o['NeedBook'] = $this->NeedBook;
if (isset($this->CoverageGapId)) $o['CoverageGapId'] = $this->CoverageGapId;
if (isset($this->Checks)) $o['Checks'] = JsonConverters::toArray('CoveragePtoCheck', $this->Checks);
if (isset($this->DenyReason)) $o['DenyReason'] = $this->DenyReason;
return empty($o) ? new class(){} : $o;
}
}
class CoveragePlannedResponse implements JsonSerializable
{
public function __construct(
/** @var array<CoveragePlannedItem>|null */
public ?array $Items=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('CoveragePlannedItem', $o['Items']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('CoveragePlannedItem', $this->Items);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class CoveragePtoCreateRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ContactID=0,
/** @var DateTime */
public DateTime $StartDate=new DateTime(),
/** @var DateTime */
public DateTime $EndDate=new DateTime(),
/** @var string|null */
public ?string $Reason=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
return empty($o) ? new class(){} : $o;
}
}
PHP CoveragePtoCreateRequest 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 /v1/coverage/pto HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"ContactID":0,"StartDate":"0001-01-01T00:00:00.0000000","EndDate":"0001-01-01T00:00:00.0000000","Reason":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Items":[{"WorkerTimeOffID":0,"ContactId":0,"WorkerName":"String","Initials":"String","Dates":"String","Reason":"String","Stage":"String","StageLabel":"String","NeedBook":false,"CoverageGapId":0,"Checks":[{"Ok":false,"Text":"String"}],"DenyReason":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}