| GET,OPTIONS | /v1/branch/context |
|---|
<?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 Branch implements JsonSerializable
{
public function __construct(
/** @var string */
public string $BranchId='',
/** @var string */
public string $TenantId='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $Address1=null,
/** @var string|null */
public ?string $Address2=null,
/** @var string|null */
public ?string $City=null,
/** @var string|null */
public ?string $State=null,
/** @var string|null */
public ?string $Zip=null,
/** @var string|null */
public ?string $Phone=null,
/** @var float|null */
public ?float $Latitude=null,
/** @var float|null */
public ?float $Longitude=null,
/** @var string|null */
public ?string $TimeZoneId=null,
/** @var bool|null */
public ?bool $IsDefault=null,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var string|null */
public ?string $CreatedBy=null,
/** @var DateTime|null */
public ?DateTime $CreatedAt=null,
/** @var DateTime|null */
public ?DateTime $UpdatedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['TenantId'])) $this->TenantId = $o['TenantId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['Address1'])) $this->Address1 = $o['Address1'];
if (isset($o['Address2'])) $this->Address2 = $o['Address2'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['State'])) $this->State = $o['State'];
if (isset($o['Zip'])) $this->Zip = $o['Zip'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['Latitude'])) $this->Latitude = $o['Latitude'];
if (isset($o['Longitude'])) $this->Longitude = $o['Longitude'];
if (isset($o['TimeZoneId'])) $this->TimeZoneId = $o['TimeZoneId'];
if (isset($o['IsDefault'])) $this->IsDefault = $o['IsDefault'];
if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->TenantId)) $o['TenantId'] = $this->TenantId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->Address1)) $o['Address1'] = $this->Address1;
if (isset($this->Address2)) $o['Address2'] = $this->Address2;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->State)) $o['State'] = $this->State;
if (isset($this->Zip)) $o['Zip'] = $this->Zip;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->Latitude)) $o['Latitude'] = $this->Latitude;
if (isset($this->Longitude)) $o['Longitude'] = $this->Longitude;
if (isset($this->TimeZoneId)) $o['TimeZoneId'] = $this->TimeZoneId;
if (isset($this->IsDefault)) $o['IsDefault'] = $this->IsDefault;
if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
return empty($o) ? new class(){} : $o;
}
}
class BranchContextResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<Branch>|null */
public ?array $Branches=null,
/** @var string|null */
public ?string $SelectedBranchId=null,
/** @var string|null */
public ?string $DefaultBranchId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Branches'])) $this->Branches = JsonConverters::fromArray('Branch', $o['Branches']);
if (isset($o['SelectedBranchId'])) $this->SelectedBranchId = $o['SelectedBranchId'];
if (isset($o['DefaultBranchId'])) $this->DefaultBranchId = $o['DefaultBranchId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Branches)) $o['Branches'] = JsonConverters::toArray('Branch', $this->Branches);
if (isset($this->SelectedBranchId)) $o['SelectedBranchId'] = $this->SelectedBranchId;
if (isset($this->DefaultBranchId)) $o['DefaultBranchId'] = $this->DefaultBranchId;
return empty($o) ? new class(){} : $o;
}
}
class BranchContextRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/branch/context HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Branches":[{"BranchId":"00000000000000000000000000000000","TenantId":"00000000000000000000000000000000","Name":"String","Code":"String","Address1":"String","Address2":"String","City":"String","State":"String","Zip":"String","Phone":"String","Latitude":0,"Longitude":0,"TimeZoneId":"String","IsDefault":false,"IsActive":false,"CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","UpdatedAt":"0001-01-01T00:00:00.0000000"}],"SelectedBranchId":"00000000000000000000000000000000","DefaultBranchId":"00000000000000000000000000000000"}