| GET,OPTIONS | /portal/{Token}/visits |
|---|
<?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 CustomerVisit implements JsonSerializable
{
public function __construct(
/** @var int */
public int $AgreementJobID=0,
/** @var DateTime|null */
public ?DateTime $VisitDate=null,
/** @var DateTime|null */
public ?DateTime $CompletedAt=null,
/** @var string|null */
public ?string $ServiceName=null,
/** @var string|null */
public ?string $CrewNotes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
if (isset($o['VisitDate'])) $this->VisitDate = JsonConverters::from('DateTime', $o['VisitDate']);
if (isset($o['CompletedAt'])) $this->CompletedAt = JsonConverters::from('DateTime', $o['CompletedAt']);
if (isset($o['ServiceName'])) $this->ServiceName = $o['ServiceName'];
if (isset($o['CrewNotes'])) $this->CrewNotes = $o['CrewNotes'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
if (isset($this->VisitDate)) $o['VisitDate'] = JsonConverters::to('DateTime', $this->VisitDate);
if (isset($this->CompletedAt)) $o['CompletedAt'] = JsonConverters::to('DateTime', $this->CompletedAt);
if (isset($this->ServiceName)) $o['ServiceName'] = $this->ServiceName;
if (isset($this->CrewNotes)) $o['CrewNotes'] = $this->CrewNotes;
return empty($o) ? new class(){} : $o;
}
}
class CustomerVisitPhoto implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectLocationAttachmentID=0,
/** @var int|null */
public ?int $AgreementJobID=null,
/** @var string|null */
public ?string $DocTitle=null,
/** @var string|null */
public ?string $MimeType=null,
/** @var DateTime|null */
public ?DateTime $UploadDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectLocationAttachmentID'])) $this->ProjectLocationAttachmentID = $o['ProjectLocationAttachmentID'];
if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
if (isset($o['DocTitle'])) $this->DocTitle = $o['DocTitle'];
if (isset($o['MimeType'])) $this->MimeType = $o['MimeType'];
if (isset($o['UploadDate'])) $this->UploadDate = JsonConverters::from('DateTime', $o['UploadDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectLocationAttachmentID)) $o['ProjectLocationAttachmentID'] = $this->ProjectLocationAttachmentID;
if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
if (isset($this->DocTitle)) $o['DocTitle'] = $this->DocTitle;
if (isset($this->MimeType)) $o['MimeType'] = $this->MimeType;
if (isset($this->UploadDate)) $o['UploadDate'] = JsonConverters::to('DateTime', $this->UploadDate);
return empty($o) ? new class(){} : $o;
}
}
class PortalVisitsResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<CustomerVisit>|null */
public ?array $Visits=null,
/** @var array<CustomerVisitPhoto>|null */
public ?array $Photos=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Visits'])) $this->Visits = JsonConverters::fromArray('CustomerVisit', $o['Visits']);
if (isset($o['Photos'])) $this->Photos = JsonConverters::fromArray('CustomerVisitPhoto', $o['Photos']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Visits)) $o['Visits'] = JsonConverters::toArray('CustomerVisit', $this->Visits);
if (isset($this->Photos)) $o['Photos'] = JsonConverters::toArray('CustomerVisitPhoto', $this->Photos);
return empty($o) ? new class(){} : $o;
}
}
class PortalVisitsRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Token=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Token'])) $this->Token = $o['Token'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Token)) $o['Token'] = $this->Token;
return empty($o) ? new class(){} : $o;
}
}
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 /portal/{Token}/visits HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<PortalVisitsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Photos>
<CustomerVisitPhoto>
<AgreementJobID>0</AgreementJobID>
<DocTitle>String</DocTitle>
<MimeType>String</MimeType>
<ProjectLocationAttachmentID>0</ProjectLocationAttachmentID>
<UploadDate>0001-01-01T00:00:00</UploadDate>
</CustomerVisitPhoto>
</Photos>
<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>
<Visits>
<CustomerVisit>
<AgreementJobID>0</AgreementJobID>
<CompletedAt>0001-01-01T00:00:00</CompletedAt>
<CrewNotes>String</CrewNotes>
<ServiceName>String</ServiceName>
<VisitDate>0001-01-01T00:00:00</VisitDate>
</CustomerVisit>
</Visits>
</PortalVisitsResponse>