| PATCH,PUT,OPTIONS | /v1/projects/{ProjectID}/closeout/{CloseoutItemID} |
|---|
<?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 CloseoutItem implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CloseoutItemID=0,
/** @var string */
public string $CloseoutItemUID='',
/** @var int */
public int $ProjectID=0,
/** @var string|null */
public ?string $ItemKey=null,
/** @var string|null */
public ?string $Label=null,
/** @var string|null */
public ?string $Detail=null,
/** @var string|null */
public ?string $Status=null,
/** @var bool|null */
public ?bool $IsApplicable=null,
/** @var int */
public int $SortOrder=0,
/** @var DateTime|null */
public ?DateTime $CompletedAt=null,
/** @var string|null */
public ?string $CompletedBy=null,
/** @var string|null */
public ?string $CreatedBy=null,
/** @var DateTime|null */
public ?DateTime $CreatedAt=null,
/** @var DateTime|null */
public ?DateTime $UpdatedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CloseoutItemID'])) $this->CloseoutItemID = $o['CloseoutItemID'];
if (isset($o['CloseoutItemUID'])) $this->CloseoutItemUID = $o['CloseoutItemUID'];
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['ItemKey'])) $this->ItemKey = $o['ItemKey'];
if (isset($o['Label'])) $this->Label = $o['Label'];
if (isset($o['Detail'])) $this->Detail = $o['Detail'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['IsApplicable'])) $this->IsApplicable = $o['IsApplicable'];
if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
if (isset($o['CompletedAt'])) $this->CompletedAt = JsonConverters::from('DateTime', $o['CompletedAt']);
if (isset($o['CompletedBy'])) $this->CompletedBy = $o['CompletedBy'];
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
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->CloseoutItemID)) $o['CloseoutItemID'] = $this->CloseoutItemID;
if (isset($this->CloseoutItemUID)) $o['CloseoutItemUID'] = $this->CloseoutItemUID;
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->ItemKey)) $o['ItemKey'] = $this->ItemKey;
if (isset($this->Label)) $o['Label'] = $this->Label;
if (isset($this->Detail)) $o['Detail'] = $this->Detail;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->IsApplicable)) $o['IsApplicable'] = $this->IsApplicable;
if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
if (isset($this->CompletedAt)) $o['CompletedAt'] = JsonConverters::to('DateTime', $this->CompletedAt);
if (isset($this->CompletedBy)) $o['CompletedBy'] = $this->CompletedBy;
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
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 CloseoutStatus implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectID=0,
/** @var int */
public int $TotalItems=0,
/** @var int */
public int $DoneCount=0,
/** @var int */
public int $OutstandingCount=0,
/** @var bool|null */
public ?bool $AllClear=null,
/** @var float */
public float $RetainageAmount=0.0,
/** @var bool|null */
public ?bool $RetainageReleased=null,
/** @var int|null */
public ?int $ReleasedPayApplicationID=null,
/** @var int|null */
public ?int $ReleasedInvoiceID=null,
/** @var DateTime|null */
public ?DateTime $ReleasedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['TotalItems'])) $this->TotalItems = $o['TotalItems'];
if (isset($o['DoneCount'])) $this->DoneCount = $o['DoneCount'];
if (isset($o['OutstandingCount'])) $this->OutstandingCount = $o['OutstandingCount'];
if (isset($o['AllClear'])) $this->AllClear = $o['AllClear'];
if (isset($o['RetainageAmount'])) $this->RetainageAmount = $o['RetainageAmount'];
if (isset($o['RetainageReleased'])) $this->RetainageReleased = $o['RetainageReleased'];
if (isset($o['ReleasedPayApplicationID'])) $this->ReleasedPayApplicationID = $o['ReleasedPayApplicationID'];
if (isset($o['ReleasedInvoiceID'])) $this->ReleasedInvoiceID = $o['ReleasedInvoiceID'];
if (isset($o['ReleasedAt'])) $this->ReleasedAt = JsonConverters::from('DateTime', $o['ReleasedAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->TotalItems)) $o['TotalItems'] = $this->TotalItems;
if (isset($this->DoneCount)) $o['DoneCount'] = $this->DoneCount;
if (isset($this->OutstandingCount)) $o['OutstandingCount'] = $this->OutstandingCount;
if (isset($this->AllClear)) $o['AllClear'] = $this->AllClear;
if (isset($this->RetainageAmount)) $o['RetainageAmount'] = $this->RetainageAmount;
if (isset($this->RetainageReleased)) $o['RetainageReleased'] = $this->RetainageReleased;
if (isset($this->ReleasedPayApplicationID)) $o['ReleasedPayApplicationID'] = $this->ReleasedPayApplicationID;
if (isset($this->ReleasedInvoiceID)) $o['ReleasedInvoiceID'] = $this->ReleasedInvoiceID;
if (isset($this->ReleasedAt)) $o['ReleasedAt'] = JsonConverters::to('DateTime', $this->ReleasedAt);
return empty($o) ? new class(){} : $o;
}
}
class CloseoutListResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var int */
public int $ProjectID=0,
/** @var array<CloseoutItem>|null */
public ?array $Items=null,
/** @var CloseoutStatus|null */
public ?CloseoutStatus $Status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('CloseoutItem', $o['Items']);
if (isset($o['Status'])) $this->Status = JsonConverters::from('CloseoutStatus', $o['Status']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('CloseoutItem', $this->Items);
if (isset($this->Status)) $o['Status'] = JsonConverters::to('CloseoutStatus', $this->Status);
return empty($o) ? new class(){} : $o;
}
}
class CloseoutItemPatchRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectID=0,
/** @var int */
public int $CloseoutItemID=0,
/** @var string|null */
public ?string $Status=null,
/** @var string|null */
public ?string $Detail=null,
/** @var bool|null */
public ?bool $IsApplicable=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['CloseoutItemID'])) $this->CloseoutItemID = $o['CloseoutItemID'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['Detail'])) $this->Detail = $o['Detail'];
if (isset($o['IsApplicable'])) $this->IsApplicable = $o['IsApplicable'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->CloseoutItemID)) $o['CloseoutItemID'] = $this->CloseoutItemID;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->Detail)) $o['Detail'] = $this->Detail;
if (isset($this->IsApplicable)) $o['IsApplicable'] = $this->IsApplicable;
return empty($o) ? new class(){} : $o;
}
}
PHP CloseoutItemPatchRequest 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.
PUT /v1/projects/{ProjectID}/closeout/{CloseoutItemID} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ProjectID: 0,
CloseoutItemID: 0,
Status: String,
Detail: String,
IsApplicable: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
ProjectID: 0,
Items:
[
{
CloseoutItemID: 0,
CloseoutItemUID: 00000000000000000000000000000000,
ProjectID: 0,
ItemKey: String,
Label: String,
Detail: String,
Status: String,
IsApplicable: False,
SortOrder: 0,
CompletedAt: 0001-01-01,
CompletedBy: String,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01
}
],
Status:
{
ProjectID: 0,
TotalItems: 0,
DoneCount: 0,
OutstandingCount: 0,
AllClear: False,
RetainageAmount: 0,
RetainageReleased: False,
ReleasedPayApplicationID: 0,
ReleasedInvoiceID: 0,
ReleasedAt: 0001-01-01
}
}