| GET | /v1/coverage/restriction/byworker/{WorkerContactID} |
|---|
<?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 ClientWorkerRestriction implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ClientWorkerRestrictionID=0,
/** @var string|null */
public ?string $BranchId=null,
/** @var int */
public int $ClientContactID=0,
/** @var int */
public int $WorkerContactID=0,
/** @var string|null */
public ?string $RestrictionLevel=null,
/** @var string|null */
public ?string $Reason=null,
/** @var int|null */
public ?int $SourceRatingID=null,
/** @var string|null */
public ?string $CreatedBy=null,
/** @var DateTime */
public DateTime $CreatedAt=new DateTime(),
/** @var DateTime|null */
public ?DateTime $UpdatedAt=null,
/** @var string|null */
public ?string $ClientName=null,
/** @var string|null */
public ?string $WorkerName=null,
/** @var string|null */
public ?string $LevelLabel=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ClientWorkerRestrictionID'])) $this->ClientWorkerRestrictionID = $o['ClientWorkerRestrictionID'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['ClientContactID'])) $this->ClientContactID = $o['ClientContactID'];
if (isset($o['WorkerContactID'])) $this->WorkerContactID = $o['WorkerContactID'];
if (isset($o['RestrictionLevel'])) $this->RestrictionLevel = $o['RestrictionLevel'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
if (isset($o['SourceRatingID'])) $this->SourceRatingID = $o['SourceRatingID'];
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']);
if (isset($o['ClientName'])) $this->ClientName = $o['ClientName'];
if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
if (isset($o['LevelLabel'])) $this->LevelLabel = $o['LevelLabel'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ClientWorkerRestrictionID)) $o['ClientWorkerRestrictionID'] = $this->ClientWorkerRestrictionID;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->ClientContactID)) $o['ClientContactID'] = $this->ClientContactID;
if (isset($this->WorkerContactID)) $o['WorkerContactID'] = $this->WorkerContactID;
if (isset($this->RestrictionLevel)) $o['RestrictionLevel'] = $this->RestrictionLevel;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
if (isset($this->SourceRatingID)) $o['SourceRatingID'] = $this->SourceRatingID;
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);
if (isset($this->ClientName)) $o['ClientName'] = $this->ClientName;
if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
if (isset($this->LevelLabel)) $o['LevelLabel'] = $this->LevelLabel;
return empty($o) ? new class(){} : $o;
}
}
class RestrictionParty implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ContactId=0,
/** @var string|null */
public ?string $Name=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->Name)) $o['Name'] = $this->Name;
return empty($o) ? new class(){} : $o;
}
}
class ClientWorkerRestrictionsResponse implements JsonSerializable
{
public function __construct(
/** @var array<ClientWorkerRestriction>|null */
public ?array $Restrictions=null,
/** @var array<RestrictionParty>|null */
public ?array $Clients=null,
/** @var array<RestrictionParty>|null */
public ?array $Workers=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Restrictions'])) $this->Restrictions = JsonConverters::fromArray('ClientWorkerRestriction', $o['Restrictions']);
if (isset($o['Clients'])) $this->Clients = JsonConverters::fromArray('RestrictionParty', $o['Clients']);
if (isset($o['Workers'])) $this->Workers = JsonConverters::fromArray('RestrictionParty', $o['Workers']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Restrictions)) $o['Restrictions'] = JsonConverters::toArray('ClientWorkerRestriction', $this->Restrictions);
if (isset($this->Clients)) $o['Clients'] = JsonConverters::toArray('RestrictionParty', $this->Clients);
if (isset($this->Workers)) $o['Workers'] = JsonConverters::toArray('RestrictionParty', $this->Workers);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class ClientWorkerRestrictionByWorkerRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $WorkerContactID=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['WorkerContactID'])) $this->WorkerContactID = $o['WorkerContactID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->WorkerContactID)) $o['WorkerContactID'] = $this->WorkerContactID;
return empty($o) ? new class(){} : $o;
}
}
PHP ClientWorkerRestrictionByWorkerRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/coverage/restriction/byworker/{WorkerContactID} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Restrictions:
[
{
ClientWorkerRestrictionID: 0,
BranchId: 00000000000000000000000000000000,
ClientContactID: 0,
WorkerContactID: 0,
RestrictionLevel: String,
Reason: String,
SourceRatingID: 0,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01,
ClientName: String,
WorkerName: String,
LevelLabel: String
}
],
Clients:
[
{
ContactId: 0,
Name: String
}
],
Workers:
[
{
ContactId: 0,
Name: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}