Trendsic Platform Service

<back to all web services

ChangeOrderUpdateRequest

Requires Authentication
The following routes are available for this service:
PUT,OPTIONS/v1/projects/{ProjectID}/change-orders/{ChangeOrderID}
<?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 ChangeOrderLine implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ChangeOrderLineID=0,
        /** @var int */
        public int $ChangeOrderID=0,
        /** @var string|null */
        public ?string $Category=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var float */
        public float $CostUSD=0.0,
        /** @var float */
        public float $MarkupPct=0.0,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var int */
        public int $SortOrder=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ChangeOrderLineID'])) $this->ChangeOrderLineID = $o['ChangeOrderLineID'];
        if (isset($o['ChangeOrderID'])) $this->ChangeOrderID = $o['ChangeOrderID'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['CostUSD'])) $this->CostUSD = $o['CostUSD'];
        if (isset($o['MarkupPct'])) $this->MarkupPct = $o['MarkupPct'];
        if (isset($o['CostCode'])) $this->CostCode = $o['CostCode'];
        if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ChangeOrderLineID)) $o['ChangeOrderLineID'] = $this->ChangeOrderLineID;
        if (isset($this->ChangeOrderID)) $o['ChangeOrderID'] = $this->ChangeOrderID;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->CostUSD)) $o['CostUSD'] = $this->CostUSD;
        if (isset($this->MarkupPct)) $o['MarkupPct'] = $this->MarkupPct;
        if (isset($this->CostCode)) $o['CostCode'] = $this->CostCode;
        if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
        return empty($o) ? new class(){} : $o;
    }
}

class ChangeOrder implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ChangeOrderID=0,
        /** @var string */
        public string $ChangeOrderUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $CONumber=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Scope=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var float */
        public float $CostUSD=0.0,
        /** @var float */
        public float $PriceUSD=0.0,
        /** @var int */
        public int $ScheduleDays=0,
        /** @var float */
        public float $OverheadProfitPct=0.0,
        /** @var string|null */
        public ?string $PricingMethod=null,
        /** @var string|null */
        public ?string $OriginType=null,
        /** @var string|null */
        public ?string $OriginRef=null,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var DateTime|null */
        public ?DateTime $OpenedAt=null,
        /** @var DateTime|null */
        public ?DateTime $SubmittedAt=null,
        /** @var DateTime|null */
        public ?DateTime $DecidedAt=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null,
        /** @var int */
        public int $DaysOpen=0,
        /** @var array<ChangeOrderLine>|null */
        public ?array $Lines=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ChangeOrderID'])) $this->ChangeOrderID = $o['ChangeOrderID'];
        if (isset($o['ChangeOrderUID'])) $this->ChangeOrderUID = $o['ChangeOrderUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['CONumber'])) $this->CONumber = $o['CONumber'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Scope'])) $this->Scope = $o['Scope'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['CostUSD'])) $this->CostUSD = $o['CostUSD'];
        if (isset($o['PriceUSD'])) $this->PriceUSD = $o['PriceUSD'];
        if (isset($o['ScheduleDays'])) $this->ScheduleDays = $o['ScheduleDays'];
        if (isset($o['OverheadProfitPct'])) $this->OverheadProfitPct = $o['OverheadProfitPct'];
        if (isset($o['PricingMethod'])) $this->PricingMethod = $o['PricingMethod'];
        if (isset($o['OriginType'])) $this->OriginType = $o['OriginType'];
        if (isset($o['OriginRef'])) $this->OriginRef = $o['OriginRef'];
        if (isset($o['CostCode'])) $this->CostCode = $o['CostCode'];
        if (isset($o['OpenedAt'])) $this->OpenedAt = JsonConverters::from('DateTime', $o['OpenedAt']);
        if (isset($o['SubmittedAt'])) $this->SubmittedAt = JsonConverters::from('DateTime', $o['SubmittedAt']);
        if (isset($o['DecidedAt'])) $this->DecidedAt = JsonConverters::from('DateTime', $o['DecidedAt']);
        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']);
        if (isset($o['DaysOpen'])) $this->DaysOpen = $o['DaysOpen'];
        if (isset($o['Lines'])) $this->Lines = JsonConverters::fromArray('ChangeOrderLine', $o['Lines']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ChangeOrderID)) $o['ChangeOrderID'] = $this->ChangeOrderID;
        if (isset($this->ChangeOrderUID)) $o['ChangeOrderUID'] = $this->ChangeOrderUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->CONumber)) $o['CONumber'] = $this->CONumber;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Scope)) $o['Scope'] = $this->Scope;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->CostUSD)) $o['CostUSD'] = $this->CostUSD;
        if (isset($this->PriceUSD)) $o['PriceUSD'] = $this->PriceUSD;
        if (isset($this->ScheduleDays)) $o['ScheduleDays'] = $this->ScheduleDays;
        if (isset($this->OverheadProfitPct)) $o['OverheadProfitPct'] = $this->OverheadProfitPct;
        if (isset($this->PricingMethod)) $o['PricingMethod'] = $this->PricingMethod;
        if (isset($this->OriginType)) $o['OriginType'] = $this->OriginType;
        if (isset($this->OriginRef)) $o['OriginRef'] = $this->OriginRef;
        if (isset($this->CostCode)) $o['CostCode'] = $this->CostCode;
        if (isset($this->OpenedAt)) $o['OpenedAt'] = JsonConverters::to('DateTime', $this->OpenedAt);
        if (isset($this->SubmittedAt)) $o['SubmittedAt'] = JsonConverters::to('DateTime', $this->SubmittedAt);
        if (isset($this->DecidedAt)) $o['DecidedAt'] = JsonConverters::to('DateTime', $this->DecidedAt);
        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);
        if (isset($this->DaysOpen)) $o['DaysOpen'] = $this->DaysOpen;
        if (isset($this->Lines)) $o['Lines'] = JsonConverters::toArray('ChangeOrderLine', $this->Lines);
        return empty($o) ? new class(){} : $o;
    }
}

class ChangeOrderContractSummary implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var float */
        public float $OriginalContract=0.0,
        /** @var float */
        public float $ApprovedCOValue=0.0,
        /** @var int */
        public int $ApprovedCOCount=0,
        /** @var float */
        public float $PendingCOValue=0.0,
        /** @var int */
        public int $PendingCOCount=0,
        /** @var float */
        public float $RevisedContract=0.0,
        /** @var float */
        public float $PotentialContract=0.0,
        /** @var int */
        public int $ApprovedScheduleDays=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['OriginalContract'])) $this->OriginalContract = $o['OriginalContract'];
        if (isset($o['ApprovedCOValue'])) $this->ApprovedCOValue = $o['ApprovedCOValue'];
        if (isset($o['ApprovedCOCount'])) $this->ApprovedCOCount = $o['ApprovedCOCount'];
        if (isset($o['PendingCOValue'])) $this->PendingCOValue = $o['PendingCOValue'];
        if (isset($o['PendingCOCount'])) $this->PendingCOCount = $o['PendingCOCount'];
        if (isset($o['RevisedContract'])) $this->RevisedContract = $o['RevisedContract'];
        if (isset($o['PotentialContract'])) $this->PotentialContract = $o['PotentialContract'];
        if (isset($o['ApprovedScheduleDays'])) $this->ApprovedScheduleDays = $o['ApprovedScheduleDays'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->OriginalContract)) $o['OriginalContract'] = $this->OriginalContract;
        if (isset($this->ApprovedCOValue)) $o['ApprovedCOValue'] = $this->ApprovedCOValue;
        if (isset($this->ApprovedCOCount)) $o['ApprovedCOCount'] = $this->ApprovedCOCount;
        if (isset($this->PendingCOValue)) $o['PendingCOValue'] = $this->PendingCOValue;
        if (isset($this->PendingCOCount)) $o['PendingCOCount'] = $this->PendingCOCount;
        if (isset($this->RevisedContract)) $o['RevisedContract'] = $this->RevisedContract;
        if (isset($this->PotentialContract)) $o['PotentialContract'] = $this->PotentialContract;
        if (isset($this->ApprovedScheduleDays)) $o['ApprovedScheduleDays'] = $this->ApprovedScheduleDays;
        return empty($o) ? new class(){} : $o;
    }
}

class ChangeOrderResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var ChangeOrder|null */
        public ?ChangeOrder $Order=null,
        /** @var ChangeOrderContractSummary|null */
        public ?ChangeOrderContractSummary $Summary=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Order'])) $this->Order = JsonConverters::from('ChangeOrder', $o['Order']);
        if (isset($o['Summary'])) $this->Summary = JsonConverters::from('ChangeOrderContractSummary', $o['Summary']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Order)) $o['Order'] = JsonConverters::to('ChangeOrder', $this->Order);
        if (isset($this->Summary)) $o['Summary'] = JsonConverters::to('ChangeOrderContractSummary', $this->Summary);
        return empty($o) ? new class(){} : $o;
    }
}

class ChangeOrderUpdateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var int */
        public int $ChangeOrderID=0,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Scope=null,
        /** @var string|null */
        public ?string $OriginType=null,
        /** @var string|null */
        public ?string $OriginRef=null,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var int */
        public int $ScheduleDays=0,
        /** @var float */
        public float $OverheadProfitPct=0.0,
        /** @var string|null */
        public ?string $PricingMethod=null,
        /** @var array<ChangeOrderLine>|null */
        public ?array $Lines=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ChangeOrderID'])) $this->ChangeOrderID = $o['ChangeOrderID'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Scope'])) $this->Scope = $o['Scope'];
        if (isset($o['OriginType'])) $this->OriginType = $o['OriginType'];
        if (isset($o['OriginRef'])) $this->OriginRef = $o['OriginRef'];
        if (isset($o['CostCode'])) $this->CostCode = $o['CostCode'];
        if (isset($o['ScheduleDays'])) $this->ScheduleDays = $o['ScheduleDays'];
        if (isset($o['OverheadProfitPct'])) $this->OverheadProfitPct = $o['OverheadProfitPct'];
        if (isset($o['PricingMethod'])) $this->PricingMethod = $o['PricingMethod'];
        if (isset($o['Lines'])) $this->Lines = JsonConverters::fromArray('ChangeOrderLine', $o['Lines']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ChangeOrderID)) $o['ChangeOrderID'] = $this->ChangeOrderID;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Scope)) $o['Scope'] = $this->Scope;
        if (isset($this->OriginType)) $o['OriginType'] = $this->OriginType;
        if (isset($this->OriginRef)) $o['OriginRef'] = $this->OriginRef;
        if (isset($this->CostCode)) $o['CostCode'] = $this->CostCode;
        if (isset($this->ScheduleDays)) $o['ScheduleDays'] = $this->ScheduleDays;
        if (isset($this->OverheadProfitPct)) $o['OverheadProfitPct'] = $this->OverheadProfitPct;
        if (isset($this->PricingMethod)) $o['PricingMethod'] = $this->PricingMethod;
        if (isset($this->Lines)) $o['Lines'] = JsonConverters::toArray('ChangeOrderLine', $this->Lines);
        return empty($o) ? new class(){} : $o;
    }
}

PHP ChangeOrderUpdateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /v1/projects/{ProjectID}/change-orders/{ChangeOrderID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ProjectID: 0,
	ChangeOrderID: 0,
	Title: String,
	Scope: String,
	OriginType: String,
	OriginRef: String,
	CostCode: String,
	ScheduleDays: 0,
	OverheadProfitPct: 0,
	PricingMethod: String,
	Lines: 
	[
		{
			ChangeOrderLineID: 0,
			ChangeOrderID: 0,
			Category: String,
			Description: String,
			CostUSD: 0,
			MarkupPct: 0,
			CostCode: String,
			SortOrder: 0
		}
	]
}
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
		}
	},
	Order: 
	{
		ChangeOrderID: 0,
		ChangeOrderUID: 00000000000000000000000000000000,
		ProjectID: 0,
		CONumber: String,
		Title: String,
		Scope: String,
		Status: String,
		CostUSD: 0,
		PriceUSD: 0,
		ScheduleDays: 0,
		OverheadProfitPct: 0,
		PricingMethod: String,
		OriginType: String,
		OriginRef: String,
		CostCode: String,
		OpenedAt: 0001-01-01,
		SubmittedAt: 0001-01-01,
		DecidedAt: 0001-01-01,
		CreatedBy: String,
		CreatedAt: 0001-01-01,
		UpdatedAt: 0001-01-01,
		DaysOpen: 0,
		Lines: 
		[
			{
				ChangeOrderLineID: 0,
				ChangeOrderID: 0,
				Category: String,
				Description: String,
				CostUSD: 0,
				MarkupPct: 0,
				CostCode: String,
				SortOrder: 0
			}
		]
	},
	Summary: 
	{
		ProjectID: 0,
		OriginalContract: 0,
		ApprovedCOValue: 0,
		ApprovedCOCount: 0,
		PendingCOValue: 0,
		PendingCOCount: 0,
		RevisedContract: 0,
		PotentialContract: 0,
		ApprovedScheduleDays: 0
	}
}