| GET,OPTIONS | /v1/pm/projects |
|---|
<?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 PmProjectRow implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectID=0,
/** @var string|null */
public ?string $ProjectUID=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Client=null,
/** @var string|null */
public ?string $ProjectType=null,
/** @var string|null */
public ?string $Status=null,
/** @var string|null */
public ?string $Branch=null,
/** @var string|null */
public ?string $StartDate=null,
/** @var string|null */
public ?string $EndDate=null,
/** @var float */
public float $Budget=0.0,
/** @var float */
public float $Spent=0.0,
/** @var float */
public float $EstimatedCost=0.0,
/** @var int */
public int $HealthPct=0,
/** @var int */
public int $JobCount=0,
/** @var int */
public int $OpenJobs=0,
/** @var int */
public int $GapCount=0,
/** @var bool|null */
public ?bool $OverBudget=null,
/** @var int */
public int $ProgressPct=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Client'])) $this->Client = $o['Client'];
if (isset($o['ProjectType'])) $this->ProjectType = $o['ProjectType'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['Branch'])) $this->Branch = $o['Branch'];
if (isset($o['StartDate'])) $this->StartDate = $o['StartDate'];
if (isset($o['EndDate'])) $this->EndDate = $o['EndDate'];
if (isset($o['Budget'])) $this->Budget = $o['Budget'];
if (isset($o['Spent'])) $this->Spent = $o['Spent'];
if (isset($o['EstimatedCost'])) $this->EstimatedCost = $o['EstimatedCost'];
if (isset($o['HealthPct'])) $this->HealthPct = $o['HealthPct'];
if (isset($o['JobCount'])) $this->JobCount = $o['JobCount'];
if (isset($o['OpenJobs'])) $this->OpenJobs = $o['OpenJobs'];
if (isset($o['GapCount'])) $this->GapCount = $o['GapCount'];
if (isset($o['OverBudget'])) $this->OverBudget = $o['OverBudget'];
if (isset($o['ProgressPct'])) $this->ProgressPct = $o['ProgressPct'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Client)) $o['Client'] = $this->Client;
if (isset($this->ProjectType)) $o['ProjectType'] = $this->ProjectType;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->Branch)) $o['Branch'] = $this->Branch;
if (isset($this->StartDate)) $o['StartDate'] = $this->StartDate;
if (isset($this->EndDate)) $o['EndDate'] = $this->EndDate;
if (isset($this->Budget)) $o['Budget'] = $this->Budget;
if (isset($this->Spent)) $o['Spent'] = $this->Spent;
if (isset($this->EstimatedCost)) $o['EstimatedCost'] = $this->EstimatedCost;
if (isset($this->HealthPct)) $o['HealthPct'] = $this->HealthPct;
if (isset($this->JobCount)) $o['JobCount'] = $this->JobCount;
if (isset($this->OpenJobs)) $o['OpenJobs'] = $this->OpenJobs;
if (isset($this->GapCount)) $o['GapCount'] = $this->GapCount;
if (isset($this->OverBudget)) $o['OverBudget'] = $this->OverBudget;
if (isset($this->ProgressPct)) $o['ProgressPct'] = $this->ProgressPct;
return empty($o) ? new class(){} : $o;
}
}
class PmPortfolioTotals implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Projects=0,
/** @var float */
public float $Budget=0.0,
/** @var float */
public float $Spent=0.0,
/** @var int */
public int $OverBudget=0,
/** @var int */
public int $WithGaps=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Projects'])) $this->Projects = $o['Projects'];
if (isset($o['Budget'])) $this->Budget = $o['Budget'];
if (isset($o['Spent'])) $this->Spent = $o['Spent'];
if (isset($o['OverBudget'])) $this->OverBudget = $o['OverBudget'];
if (isset($o['WithGaps'])) $this->WithGaps = $o['WithGaps'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Projects)) $o['Projects'] = $this->Projects;
if (isset($this->Budget)) $o['Budget'] = $this->Budget;
if (isset($this->Spent)) $o['Spent'] = $this->Spent;
if (isset($this->OverBudget)) $o['OverBudget'] = $this->OverBudget;
if (isset($this->WithGaps)) $o['WithGaps'] = $this->WithGaps;
return empty($o) ? new class(){} : $o;
}
}
class PmProjectsResponse implements JsonSerializable
{
public function __construct(
/** @var array<PmProjectRow>|null */
public ?array $Projects=null,
/** @var PmPortfolioTotals|null */
public ?PmPortfolioTotals $Totals=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Projects'])) $this->Projects = JsonConverters::fromArray('PmProjectRow', $o['Projects']);
if (isset($o['Totals'])) $this->Totals = JsonConverters::from('PmPortfolioTotals', $o['Totals']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Projects)) $o['Projects'] = JsonConverters::toArray('PmProjectRow', $this->Projects);
if (isset($this->Totals)) $o['Totals'] = JsonConverters::to('PmPortfolioTotals', $this->Totals);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class PmProjectsRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Search=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Search'])) $this->Search = $o['Search'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Search)) $o['Search'] = $this->Search;
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/projects HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<PmProjectsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Projects>
<PmProjectRow>
<Branch>String</Branch>
<Budget>0</Budget>
<Client>String</Client>
<EndDate>String</EndDate>
<EstimatedCost>0</EstimatedCost>
<GapCount>0</GapCount>
<HealthPct>0</HealthPct>
<JobCount>0</JobCount>
<Name>String</Name>
<OpenJobs>0</OpenJobs>
<OverBudget>false</OverBudget>
<ProgressPct>0</ProgressPct>
<ProjectID>0</ProjectID>
<ProjectType>String</ProjectType>
<ProjectUID>String</ProjectUID>
<Spent>0</Spent>
<StartDate>String</StartDate>
<Status>String</Status>
</PmProjectRow>
</Projects>
<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>
<Totals>
<Budget>0</Budget>
<OverBudget>0</OverBudget>
<Projects>0</Projects>
<Spent>0</Spent>
<WithGaps>0</WithGaps>
</Totals>
</PmProjectsResponse>