| GET,OPTIONS | /v1/pm/resources |
|---|
<?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 PmResCommitment implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ProjectName=null,
/** @var string|null */
public ?string $JobName=null,
/** @var string|null */
public ?string $StartDate=null,
/** @var string|null */
public ?string $EndDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
if (isset($o['JobName'])) $this->JobName = $o['JobName'];
if (isset($o['StartDate'])) $this->StartDate = $o['StartDate'];
if (isset($o['EndDate'])) $this->EndDate = $o['EndDate'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
if (isset($this->JobName)) $o['JobName'] = $this->JobName;
if (isset($this->StartDate)) $o['StartDate'] = $this->StartDate;
if (isset($this->EndDate)) $o['EndDate'] = $this->EndDate;
return empty($o) ? new class(){} : $o;
}
}
class PmResEquipment implements JsonSerializable
{
public function __construct(
/** @var int */
public int $EquipmentID=0,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $EquipmentType=null,
/** @var string|null */
public ?string $SerialNumber=null,
/** @var int */
public int $JobCount=0,
/** @var bool|null */
public ?bool $Overbooked=null,
/** @var string|null */
public ?string $MaintenanceState=null,
/** @var array<PmResCommitment>|null */
public ?array $Commitments=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['EquipmentID'])) $this->EquipmentID = $o['EquipmentID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['EquipmentType'])) $this->EquipmentType = $o['EquipmentType'];
if (isset($o['SerialNumber'])) $this->SerialNumber = $o['SerialNumber'];
if (isset($o['JobCount'])) $this->JobCount = $o['JobCount'];
if (isset($o['Overbooked'])) $this->Overbooked = $o['Overbooked'];
if (isset($o['MaintenanceState'])) $this->MaintenanceState = $o['MaintenanceState'];
if (isset($o['Commitments'])) $this->Commitments = JsonConverters::fromArray('PmResCommitment', $o['Commitments']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->EquipmentID)) $o['EquipmentID'] = $this->EquipmentID;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->EquipmentType)) $o['EquipmentType'] = $this->EquipmentType;
if (isset($this->SerialNumber)) $o['SerialNumber'] = $this->SerialNumber;
if (isset($this->JobCount)) $o['JobCount'] = $this->JobCount;
if (isset($this->Overbooked)) $o['Overbooked'] = $this->Overbooked;
if (isset($this->MaintenanceState)) $o['MaintenanceState'] = $this->MaintenanceState;
if (isset($this->Commitments)) $o['Commitments'] = JsonConverters::toArray('PmResCommitment', $this->Commitments);
return empty($o) ? new class(){} : $o;
}
}
class PmResMaterial implements JsonSerializable
{
public function __construct(
/** @var int */
public int $MaterialID=0,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $MaterialType=null,
/** @var int */
public int $OnHand=0,
/** @var int */
public int $NeededByJobs=0,
/** @var int */
public int $QtyNeeded=0,
/** @var bool|null */
public ?bool $Shortfall=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['MaterialID'])) $this->MaterialID = $o['MaterialID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['MaterialType'])) $this->MaterialType = $o['MaterialType'];
if (isset($o['OnHand'])) $this->OnHand = $o['OnHand'];
if (isset($o['NeededByJobs'])) $this->NeededByJobs = $o['NeededByJobs'];
if (isset($o['QtyNeeded'])) $this->QtyNeeded = $o['QtyNeeded'];
if (isset($o['Shortfall'])) $this->Shortfall = $o['Shortfall'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->MaterialID)) $o['MaterialID'] = $this->MaterialID;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->MaterialType)) $o['MaterialType'] = $this->MaterialType;
if (isset($this->OnHand)) $o['OnHand'] = $this->OnHand;
if (isset($this->NeededByJobs)) $o['NeededByJobs'] = $this->NeededByJobs;
if (isset($this->QtyNeeded)) $o['QtyNeeded'] = $this->QtyNeeded;
if (isset($this->Shortfall)) $o['Shortfall'] = $this->Shortfall;
return empty($o) ? new class(){} : $o;
}
}
class PmResourcesResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $FromDate=null,
/** @var string|null */
public ?string $ToDate=null,
/** @var int */
public int $OverbookedCount=0,
/** @var int */
public int $CommittedCount=0,
/** @var int */
public int $ShortfallCount=0,
/** @var array<PmResEquipment>|null */
public ?array $Equipment=null,
/** @var array<PmResMaterial>|null */
public ?array $Materials=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['FromDate'])) $this->FromDate = $o['FromDate'];
if (isset($o['ToDate'])) $this->ToDate = $o['ToDate'];
if (isset($o['OverbookedCount'])) $this->OverbookedCount = $o['OverbookedCount'];
if (isset($o['CommittedCount'])) $this->CommittedCount = $o['CommittedCount'];
if (isset($o['ShortfallCount'])) $this->ShortfallCount = $o['ShortfallCount'];
if (isset($o['Equipment'])) $this->Equipment = JsonConverters::fromArray('PmResEquipment', $o['Equipment']);
if (isset($o['Materials'])) $this->Materials = JsonConverters::fromArray('PmResMaterial', $o['Materials']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->FromDate)) $o['FromDate'] = $this->FromDate;
if (isset($this->ToDate)) $o['ToDate'] = $this->ToDate;
if (isset($this->OverbookedCount)) $o['OverbookedCount'] = $this->OverbookedCount;
if (isset($this->CommittedCount)) $o['CommittedCount'] = $this->CommittedCount;
if (isset($this->ShortfallCount)) $o['ShortfallCount'] = $this->ShortfallCount;
if (isset($this->Equipment)) $o['Equipment'] = JsonConverters::toArray('PmResEquipment', $this->Equipment);
if (isset($this->Materials)) $o['Materials'] = JsonConverters::toArray('PmResMaterial', $this->Materials);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class PmResourcesRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Days=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Days'])) $this->Days = $o['Days'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
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 .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/pm/resources HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"FromDate":"String","ToDate":"String","OverbookedCount":0,"CommittedCount":0,"ShortfallCount":0,"Equipment":[{"EquipmentID":0,"Name":"String","EquipmentType":"String","SerialNumber":"String","JobCount":0,"Overbooked":false,"MaintenanceState":"String","Commitments":[{"ProjectName":"String","JobName":"String","StartDate":"String","EndDate":"String"}]}],"Materials":[{"MaterialID":0,"Name":"String","MaterialType":"String","OnHand":0,"NeededByJobs":0,"QtyNeeded":0,"Shortfall":false}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}