| 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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<CloseoutItemPatchRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<CloseoutItemID>0</CloseoutItemID>
<Detail>String</Detail>
<IsApplicable>false</IsApplicable>
<ProjectID>0</ProjectID>
<Status>String</Status>
</CloseoutItemPatchRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<CloseoutListResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Items>
<CloseoutItem>
<CloseoutItemID>0</CloseoutItemID>
<CloseoutItemUID>00000000-0000-0000-0000-000000000000</CloseoutItemUID>
<CompletedAt>0001-01-01T00:00:00</CompletedAt>
<CompletedBy>String</CompletedBy>
<CreatedAt>0001-01-01T00:00:00</CreatedAt>
<CreatedBy>String</CreatedBy>
<Detail>String</Detail>
<IsApplicable>false</IsApplicable>
<ItemKey>String</ItemKey>
<Label>String</Label>
<ProjectID>0</ProjectID>
<SortOrder>0</SortOrder>
<Status>String</Status>
<UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
</CloseoutItem>
</Items>
<ProjectID>0</ProjectID>
<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>
<Status>
<AllClear>false</AllClear>
<DoneCount>0</DoneCount>
<OutstandingCount>0</OutstandingCount>
<ProjectID>0</ProjectID>
<ReleasedAt>0001-01-01T00:00:00</ReleasedAt>
<ReleasedInvoiceID>0</ReleasedInvoiceID>
<ReleasedPayApplicationID>0</ReleasedPayApplicationID>
<RetainageAmount>0</RetainageAmount>
<RetainageReleased>false</RetainageReleased>
<TotalItems>0</TotalItems>
</Status>
</CloseoutListResponse>