| 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 .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/pm/projects HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Projects:
[
{
ProjectID: 0,
ProjectUID: String,
Name: String,
Client: String,
ProjectType: String,
Status: String,
Branch: String,
StartDate: String,
EndDate: String,
Budget: 0,
Spent: 0,
EstimatedCost: 0,
HealthPct: 0,
JobCount: 0,
OpenJobs: 0,
GapCount: 0,
OverBudget: False,
ProgressPct: 0
}
],
Totals:
{
Projects: 0,
Budget: 0,
Spent: 0,
OverBudget: 0,
WithGaps: 0
},
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}