| Requires any of the permissions: | DISPATCH:HAUL:MANAGE, DISPATCH:JOB:MANAGE, DISPATCH:ONDEMAND:MANAGE |
| POST,OPTIONS | /v1/dispatch/holds |
|---|
<?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 DispatchHoldView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $HoldId=0,
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $ScopeKind=null,
/** @var string|null */
public ?string $ScopeKey=null,
/** @var string|null */
public ?string $ScopeLabel=null,
/** @var string|null */
public ?string $Reason=null,
/** @var string|null */
public ?string $Note=null,
/** @var DateTime */
public DateTime $StartUtc=new DateTime(),
/** @var DateTime */
public DateTime $EndUtc=new DateTime(),
/** @var string|null */
public ?string $Source=null,
/** @var string|null */
public ?string $IncidentRef=null,
/** @var DateTime|null */
public ?DateTime $LiftedUtc=null,
/** @var string|null */
public ?string $LiftedBy=null,
/** @var DateTime|null */
public ?DateTime $CreatedUtc=null,
/** @var string|null */
public ?string $CreatedBy=null,
/** @var string|null */
public ?string $Status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['HoldId'])) $this->HoldId = $o['HoldId'];
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['ScopeKind'])) $this->ScopeKind = $o['ScopeKind'];
if (isset($o['ScopeKey'])) $this->ScopeKey = $o['ScopeKey'];
if (isset($o['ScopeLabel'])) $this->ScopeLabel = $o['ScopeLabel'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['Note'])) $this->Note = $o['Note'];
if (isset($o['StartUtc'])) $this->StartUtc = JsonConverters::from('DateTime', $o['StartUtc']);
if (isset($o['EndUtc'])) $this->EndUtc = JsonConverters::from('DateTime', $o['EndUtc']);
if (isset($o['Source'])) $this->Source = $o['Source'];
if (isset($o['IncidentRef'])) $this->IncidentRef = $o['IncidentRef'];
if (isset($o['LiftedUtc'])) $this->LiftedUtc = JsonConverters::from('DateTime', $o['LiftedUtc']);
if (isset($o['LiftedBy'])) $this->LiftedBy = $o['LiftedBy'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['Status'])) $this->Status = $o['Status'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->HoldId)) $o['HoldId'] = $this->HoldId;
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->ScopeKind)) $o['ScopeKind'] = $this->ScopeKind;
if (isset($this->ScopeKey)) $o['ScopeKey'] = $this->ScopeKey;
if (isset($this->ScopeLabel)) $o['ScopeLabel'] = $this->ScopeLabel;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->Note)) $o['Note'] = $this->Note;
if (isset($this->StartUtc)) $o['StartUtc'] = JsonConverters::to('DateTime', $this->StartUtc);
if (isset($this->EndUtc)) $o['EndUtc'] = JsonConverters::to('DateTime', $this->EndUtc);
if (isset($this->Source)) $o['Source'] = $this->Source;
if (isset($this->IncidentRef)) $o['IncidentRef'] = $this->IncidentRef;
if (isset($this->LiftedUtc)) $o['LiftedUtc'] = JsonConverters::to('DateTime', $this->LiftedUtc);
if (isset($this->LiftedBy)) $o['LiftedBy'] = $this->LiftedBy;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->Status)) $o['Status'] = $this->Status;
return empty($o) ? new class(){} : $o;
}
}
class DispatchOfflineWindowView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $OfflineWindowId=0,
/** @var string|null */
public ?string $FromHour=null,
/** @var string|null */
public ?string $ToHour=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['OfflineWindowId'])) $this->OfflineWindowId = $o['OfflineWindowId'];
if (isset($o['FromHour'])) $this->FromHour = $o['FromHour'];
if (isset($o['ToHour'])) $this->ToHour = $o['ToHour'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->OfflineWindowId)) $o['OfflineWindowId'] = $this->OfflineWindowId;
if (isset($this->FromHour)) $o['FromHour'] = $this->FromHour;
if (isset($this->ToHour)) $o['ToHour'] = $this->ToHour;
return empty($o) ? new class(){} : $o;
}
}
class DispatchHoldScopeView implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Kind=null,
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $Label=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Label'])) $this->Label = $o['Label'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Label)) $o['Label'] = $this->Label;
return empty($o) ? new class(){} : $o;
}
}
class DispatchHoldSuggestionView implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ForDate=null,
/** @var string|null */
public ?string $Kind=null,
/** @var int */
public int $Severity=0,
/** @var string|null */
public ?string $Headline=null,
/** @var string|null */
public ?string $DayLabel=null,
/** @var string|null */
public ?string $ScopeKind=null,
/** @var string|null */
public ?string $ScopeLabel=null,
/** @var string|null */
public ?string $Reason=null,
/** @var DateTime */
public DateTime $StartUtc=new DateTime(),
/** @var DateTime */
public DateTime $EndUtc=new DateTime(),
/** @var string|null */
public ?string $WindowLocal=null,
/** @var string|null */
public ?string $Text=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ForDate'])) $this->ForDate = $o['ForDate'];
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['Severity'])) $this->Severity = $o['Severity'];
if (isset($o['Headline'])) $this->Headline = $o['Headline'];
if (isset($o['DayLabel'])) $this->DayLabel = $o['DayLabel'];
if (isset($o['ScopeKind'])) $this->ScopeKind = $o['ScopeKind'];
if (isset($o['ScopeLabel'])) $this->ScopeLabel = $o['ScopeLabel'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['StartUtc'])) $this->StartUtc = JsonConverters::from('DateTime', $o['StartUtc']);
if (isset($o['EndUtc'])) $this->EndUtc = JsonConverters::from('DateTime', $o['EndUtc']);
if (isset($o['WindowLocal'])) $this->WindowLocal = $o['WindowLocal'];
if (isset($o['Text'])) $this->Text = $o['Text'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ForDate)) $o['ForDate'] = $this->ForDate;
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->Severity)) $o['Severity'] = $this->Severity;
if (isset($this->Headline)) $o['Headline'] = $this->Headline;
if (isset($this->DayLabel)) $o['DayLabel'] = $this->DayLabel;
if (isset($this->ScopeKind)) $o['ScopeKind'] = $this->ScopeKind;
if (isset($this->ScopeLabel)) $o['ScopeLabel'] = $this->ScopeLabel;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->StartUtc)) $o['StartUtc'] = JsonConverters::to('DateTime', $this->StartUtc);
if (isset($this->EndUtc)) $o['EndUtc'] = JsonConverters::to('DateTime', $this->EndUtc);
if (isset($this->WindowLocal)) $o['WindowLocal'] = $this->WindowLocal;
if (isset($this->Text)) $o['Text'] = $this->Text;
return empty($o) ? new class(){} : $o;
}
}
class DispatchHoldsResponse implements JsonSerializable
{
public function __construct(
/** @var array<DispatchHoldView>|null */
public ?array $Holds=null,
/** @var array<DispatchOfflineWindowView>|null */
public ?array $Windows=null,
/** @var array<DispatchHoldScopeView>|null */
public ?array $Scopes=null,
/** @var DispatchHoldSuggestionView|null */
public ?DispatchHoldSuggestionView $Suggestion=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Holds'])) $this->Holds = JsonConverters::fromArray('DispatchHoldView', $o['Holds']);
if (isset($o['Windows'])) $this->Windows = JsonConverters::fromArray('DispatchOfflineWindowView', $o['Windows']);
if (isset($o['Scopes'])) $this->Scopes = JsonConverters::fromArray('DispatchHoldScopeView', $o['Scopes']);
if (isset($o['Suggestion'])) $this->Suggestion = JsonConverters::from('DispatchHoldSuggestionView', $o['Suggestion']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Holds)) $o['Holds'] = JsonConverters::toArray('DispatchHoldView', $this->Holds);
if (isset($this->Windows)) $o['Windows'] = JsonConverters::toArray('DispatchOfflineWindowView', $this->Windows);
if (isset($this->Scopes)) $o['Scopes'] = JsonConverters::toArray('DispatchHoldScopeView', $this->Scopes);
if (isset($this->Suggestion)) $o['Suggestion'] = JsonConverters::to('DispatchHoldSuggestionView', $this->Suggestion);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class DispatchHoldCreateRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ScopeKind=null,
/** @var string|null */
public ?string $ScopeKey=null,
/** @var string|null */
public ?string $ScopeLabel=null,
/** @var string|null */
public ?string $Reason=null,
/** @var string|null */
public ?string $Note=null,
/** @var string|null */
public ?string $StartUtc=null,
/** @var string|null */
public ?string $EndUtc=null,
/** @var string|null */
public ?string $SuggestionDate=null,
/** @var string|null */
public ?string $SuggestionKind=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ScopeKind'])) $this->ScopeKind = $o['ScopeKind'];
if (isset($o['ScopeKey'])) $this->ScopeKey = $o['ScopeKey'];
if (isset($o['ScopeLabel'])) $this->ScopeLabel = $o['ScopeLabel'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['Note'])) $this->Note = $o['Note'];
if (isset($o['StartUtc'])) $this->StartUtc = $o['StartUtc'];
if (isset($o['EndUtc'])) $this->EndUtc = $o['EndUtc'];
if (isset($o['SuggestionDate'])) $this->SuggestionDate = $o['SuggestionDate'];
if (isset($o['SuggestionKind'])) $this->SuggestionKind = $o['SuggestionKind'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ScopeKind)) $o['ScopeKind'] = $this->ScopeKind;
if (isset($this->ScopeKey)) $o['ScopeKey'] = $this->ScopeKey;
if (isset($this->ScopeLabel)) $o['ScopeLabel'] = $this->ScopeLabel;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->Note)) $o['Note'] = $this->Note;
if (isset($this->StartUtc)) $o['StartUtc'] = $this->StartUtc;
if (isset($this->EndUtc)) $o['EndUtc'] = $this->EndUtc;
if (isset($this->SuggestionDate)) $o['SuggestionDate'] = $this->SuggestionDate;
if (isset($this->SuggestionKind)) $o['SuggestionKind'] = $this->SuggestionKind;
return empty($o) ? new class(){} : $o;
}
}
PHP DispatchHoldCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/dispatch/holds HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<DispatchHoldCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<EndUtc>String</EndUtc>
<Note>String</Note>
<Reason>String</Reason>
<ScopeKey>String</ScopeKey>
<ScopeKind>String</ScopeKind>
<ScopeLabel>String</ScopeLabel>
<StartUtc>String</StartUtc>
<SuggestionDate>String</SuggestionDate>
<SuggestionKind>String</SuggestionKind>
</DispatchHoldCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<DispatchHoldsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Holds>
<DispatchHoldView>
<Code>String</Code>
<CreatedBy>String</CreatedBy>
<CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
<EndUtc>0001-01-01T00:00:00</EndUtc>
<HoldId>0</HoldId>
<IncidentRef>String</IncidentRef>
<LiftedBy>String</LiftedBy>
<LiftedUtc>0001-01-01T00:00:00</LiftedUtc>
<Note>String</Note>
<Reason>String</Reason>
<ScopeKey>String</ScopeKey>
<ScopeKind>String</ScopeKind>
<ScopeLabel>String</ScopeLabel>
<Source>String</Source>
<StartUtc>0001-01-01T00:00:00</StartUtc>
<Status>String</Status>
</DispatchHoldView>
</Holds>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<Scopes>
<DispatchHoldScopeView>
<Key>String</Key>
<Kind>String</Kind>
<Label>String</Label>
</DispatchHoldScopeView>
</Scopes>
<Suggestion>
<DayLabel>String</DayLabel>
<EndUtc>0001-01-01T00:00:00</EndUtc>
<ForDate>String</ForDate>
<Headline>String</Headline>
<Kind>String</Kind>
<Reason>String</Reason>
<ScopeKind>String</ScopeKind>
<ScopeLabel>String</ScopeLabel>
<Severity>0</Severity>
<StartUtc>0001-01-01T00:00:00</StartUtc>
<Text>String</Text>
<WindowLocal>String</WindowLocal>
</Suggestion>
<Windows>
<DispatchOfflineWindowView>
<FromHour>String</FromHour>
<OfflineWindowId>0</OfflineWindowId>
<ToHour>String</ToHour>
</DispatchOfflineWindowView>
</Windows>
</DispatchHoldsResponse>