| 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 .csv suffix or ?format=csv
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: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Visits":[{"AgreementJobID":0,"VisitDate":"0001-01-01T00:00:00.0000000","CompletedAt":"0001-01-01T00:00:00.0000000","ServiceName":"String","CrewNotes":"String"}],"Photos":[{"ProjectLocationAttachmentID":0,"AgreementJobID":0,"DocTitle":"String","MimeType":"String","UploadDate":"0001-01-01T00:00:00.0000000"}]}