| GET | /v1/coverage/policies |
|---|
<?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 CoveragePolicy implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CoveragePolicyId=0,
/** @var string */
public string $CoveragePolicyUID='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $ScopeLevel=null,
/** @var string|null */
public ?string $BranchId=null,
/** @var string|null */
public ?string $BranchName=null,
/** @var string|null */
public ?string $WorkTypeKey=null,
/** @var int|null */
public ?int $JobID=null,
/** @var string|null */
public ?string $JobName=null,
/** @var int */
public int $CurrentVersion=0,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var DateTime */
public DateTime $CreatedAt=new DateTime(),
/** @var DateTime|null */
public ?DateTime $UpdatedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CoveragePolicyId'])) $this->CoveragePolicyId = $o['CoveragePolicyId'];
if (isset($o['CoveragePolicyUID'])) $this->CoveragePolicyUID = $o['CoveragePolicyUID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['ScopeLevel'])) $this->ScopeLevel = $o['ScopeLevel'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
if (isset($o['WorkTypeKey'])) $this->WorkTypeKey = $o['WorkTypeKey'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['JobName'])) $this->JobName = $o['JobName'];
if (isset($o['CurrentVersion'])) $this->CurrentVersion = $o['CurrentVersion'];
if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
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->CoveragePolicyId)) $o['CoveragePolicyId'] = $this->CoveragePolicyId;
if (isset($this->CoveragePolicyUID)) $o['CoveragePolicyUID'] = $this->CoveragePolicyUID;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->ScopeLevel)) $o['ScopeLevel'] = $this->ScopeLevel;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
if (isset($this->WorkTypeKey)) $o['WorkTypeKey'] = $this->WorkTypeKey;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->JobName)) $o['JobName'] = $this->JobName;
if (isset($this->CurrentVersion)) $o['CurrentVersion'] = $this->CurrentVersion;
if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
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 CoveragePoliciesResponse implements JsonSerializable
{
public function __construct(
/** @var array<CoveragePolicy>|null */
public ?array $Policies=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Policies'])) $this->Policies = JsonConverters::fromArray('CoveragePolicy', $o['Policies']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Policies)) $o['Policies'] = JsonConverters::toArray('CoveragePolicy', $this->Policies);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class CoveragePoliciesRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
PHP CoveragePoliciesRequest 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/policies HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Policies:
[
{
CoveragePolicyId: 0,
CoveragePolicyUID: 00000000000000000000000000000000,
Name: String,
ScopeLevel: String,
BranchId: 00000000000000000000000000000000,
BranchName: String,
WorkTypeKey: String,
JobID: 0,
JobName: String,
CurrentVersion: 0,
IsActive: False,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}