| GET,OPTIONS | /v1/visits/week |
|---|
<?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 CrewWeekCell implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Date=null,
/** @var int */
public int $VisitCount=0,
/** @var int */
public int $LoadPct=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Date'])) $this->Date = $o['Date'];
if (isset($o['VisitCount'])) $this->VisitCount = $o['VisitCount'];
if (isset($o['LoadPct'])) $this->LoadPct = $o['LoadPct'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Date)) $o['Date'] = $this->Date;
if (isset($this->VisitCount)) $o['VisitCount'] = $this->VisitCount;
if (isset($this->LoadPct)) $o['LoadPct'] = $this->LoadPct;
return empty($o) ? new class(){} : $o;
}
}
class CrewWeekRow implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CrewID=0,
/** @var string|null */
public ?string $CrewName=null,
/** @var string|null */
public ?string $CrewColor=null,
/** @var array<CrewWeekCell>|null */
public ?array $Cells=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
if (isset($o['CrewColor'])) $this->CrewColor = $o['CrewColor'];
if (isset($o['Cells'])) $this->Cells = JsonConverters::fromArray('CrewWeekCell', $o['Cells']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
if (isset($this->CrewColor)) $o['CrewColor'] = $this->CrewColor;
if (isset($this->Cells)) $o['Cells'] = JsonConverters::toArray('CrewWeekCell', $this->Cells);
return empty($o) ? new class(){} : $o;
}
}
class VisitWeekResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $From=null,
/** @var string|null */
public ?string $To=null,
/** @var array<string>|null */
public ?array $Days=null,
/** @var array<CrewWeekRow>|null */
public ?array $Rows=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['From'])) $this->From = $o['From'];
if (isset($o['To'])) $this->To = $o['To'];
if (isset($o['Days'])) $this->Days = JsonConverters::fromArray('string', $o['Days']);
if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('CrewWeekRow', $o['Rows']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->From)) $o['From'] = $this->From;
if (isset($this->To)) $o['To'] = $this->To;
if (isset($this->Days)) $o['Days'] = JsonConverters::toArray('string', $this->Days);
if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('CrewWeekRow', $this->Rows);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class VisitWeekRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $From=null,
/** @var int */
public int $Days=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['From'])) $this->From = $o['From'];
if (isset($o['Days'])) $this->Days = $o['Days'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->From)) $o['From'] = $this->From;
if (isset($this->Days)) $o['Days'] = $this->Days;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/visits/week HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"From":"String","To":"String","Days":["String"],"Rows":[{"CrewID":0,"CrewName":"String","CrewColor":"String","Cells":[{"Date":"String","VisitCount":0,"LoadPct":0}]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}