| GET,OPTIONS | /v1/visits/exceptions |
|---|
<?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 ExceptionItem implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Kind=null,
/** @var string|null */
public ?string $VisitKey=null,
/** @var int */
public int $JobID=0,
/** @var int */
public int $ProjectID=0,
/** @var int|null */
public ?int $AgreementID=null,
/** @var int|null */
public ?int $AgreementJobID=null,
/** @var string|null */
public ?string $OccurrenceDate=null,
/** @var string|null */
public ?string $CustomerName=null,
/** @var string|null */
public ?string $LocationName=null,
/** @var string|null */
public ?string $City=null,
/** @var float|null */
public ?float $Lat=null,
/** @var float|null */
public ?float $Lng=null,
/** @var int */
public int $AgeDays=0,
/** @var string|null */
public ?string $Reason=null,
/** @var int */
public int $DurationMinutes=0,
/** @var bool|null */
public ?bool $IsCommercial=null,
/** @var int|null */
public ?int $PreferredCrewID=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['VisitKey'])) $this->VisitKey = $o['VisitKey'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['AgreementID'])) $this->AgreementID = $o['AgreementID'];
if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
if (isset($o['OccurrenceDate'])) $this->OccurrenceDate = $o['OccurrenceDate'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['LocationName'])) $this->LocationName = $o['LocationName'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['Lat'])) $this->Lat = $o['Lat'];
if (isset($o['Lng'])) $this->Lng = $o['Lng'];
if (isset($o['AgeDays'])) $this->AgeDays = $o['AgeDays'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['DurationMinutes'])) $this->DurationMinutes = $o['DurationMinutes'];
if (isset($o['IsCommercial'])) $this->IsCommercial = $o['IsCommercial'];
if (isset($o['PreferredCrewID'])) $this->PreferredCrewID = $o['PreferredCrewID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->VisitKey)) $o['VisitKey'] = $this->VisitKey;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->AgreementID)) $o['AgreementID'] = $this->AgreementID;
if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
if (isset($this->OccurrenceDate)) $o['OccurrenceDate'] = $this->OccurrenceDate;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->LocationName)) $o['LocationName'] = $this->LocationName;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->Lat)) $o['Lat'] = $this->Lat;
if (isset($this->Lng)) $o['Lng'] = $this->Lng;
if (isset($this->AgeDays)) $o['AgeDays'] = $this->AgeDays;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->DurationMinutes)) $o['DurationMinutes'] = $this->DurationMinutes;
if (isset($this->IsCommercial)) $o['IsCommercial'] = $this->IsCommercial;
if (isset($this->PreferredCrewID)) $o['PreferredCrewID'] = $this->PreferredCrewID;
return empty($o) ? new class(){} : $o;
}
}
class VisitExceptionsResponse implements JsonSerializable
{
public function __construct(
/** @var array<ExceptionItem>|null */
public ?array $Items=null,
/** @var int */
public int $MissedCount=0,
/** @var int */
public int $SlaCount=0,
/** @var int */
public int $SkippedCount=0,
/** @var int */
public int $AtRiskCount=0,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('ExceptionItem', $o['Items']);
if (isset($o['MissedCount'])) $this->MissedCount = $o['MissedCount'];
if (isset($o['SlaCount'])) $this->SlaCount = $o['SlaCount'];
if (isset($o['SkippedCount'])) $this->SkippedCount = $o['SkippedCount'];
if (isset($o['AtRiskCount'])) $this->AtRiskCount = $o['AtRiskCount'];
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('ExceptionItem', $this->Items);
if (isset($this->MissedCount)) $o['MissedCount'] = $this->MissedCount;
if (isset($this->SlaCount)) $o['SlaCount'] = $this->SlaCount;
if (isset($this->SkippedCount)) $o['SkippedCount'] = $this->SkippedCount;
if (isset($this->AtRiskCount)) $o['AtRiskCount'] = $this->AtRiskCount;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class VisitExceptionsRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
PHP VisitExceptionsRequest 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.
GET /v1/visits/exceptions HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<VisitExceptionsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<AtRiskCount>0</AtRiskCount>
<Items>
<ExceptionItem>
<AgeDays>0</AgeDays>
<AgreementID>0</AgreementID>
<AgreementJobID>0</AgreementJobID>
<City>String</City>
<CustomerName>String</CustomerName>
<DurationMinutes>0</DurationMinutes>
<IsCommercial>false</IsCommercial>
<JobID>0</JobID>
<Kind>String</Kind>
<Lat>0</Lat>
<Lng>0</Lng>
<LocationName>String</LocationName>
<OccurrenceDate>String</OccurrenceDate>
<PreferredCrewID>0</PreferredCrewID>
<ProjectID>0</ProjectID>
<Reason>String</Reason>
<VisitKey>String</VisitKey>
</ExceptionItem>
</Items>
<MissedCount>0</MissedCount>
<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>
<SkippedCount>0</SkippedCount>
<SlaCount>0</SlaCount>
</VisitExceptionsResponse>