| 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 .xml suffix or ?format=xml
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/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<PmResourcesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<CommittedCount>0</CommittedCount>
<Equipment>
<PmResEquipment>
<Commitments>
<PmResCommitment>
<EndDate>String</EndDate>
<JobName>String</JobName>
<ProjectName>String</ProjectName>
<StartDate>String</StartDate>
</PmResCommitment>
</Commitments>
<EquipmentID>0</EquipmentID>
<EquipmentType>String</EquipmentType>
<JobCount>0</JobCount>
<MaintenanceState>String</MaintenanceState>
<Name>String</Name>
<Overbooked>false</Overbooked>
<SerialNumber>String</SerialNumber>
</PmResEquipment>
</Equipment>
<FromDate>String</FromDate>
<Materials>
<PmResMaterial>
<MaterialID>0</MaterialID>
<MaterialType>String</MaterialType>
<Name>String</Name>
<NeededByJobs>0</NeededByJobs>
<OnHand>0</OnHand>
<QtyNeeded>0</QtyNeeded>
<Shortfall>false</Shortfall>
</PmResMaterial>
</Materials>
<OverbookedCount>0</OverbookedCount>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<ShortfallCount>0</ShortfallCount>
<ToDate>String</ToDate>
</PmResourcesResponse>