| Requires any of the roles: | Agent, Administrator |
| POST,OPTIONS | /v1/invoice/workchanges/{ProjectUID}/decide |
|---|
<?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 InvoiceWorkChange implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $SourceType=null,
/** @var int */
public int $SourceID=0,
/** @var int|null */
public ?int $JobID=null,
/** @var DateTime|null */
public ?DateTime $WorkDate=null,
/** @var string|null */
public ?string $WorkDay=null,
/** @var string|null */
public ?string $DisplayDay=null,
/** @var string|null */
public ?string $Label=null,
/** @var string|null */
public ?string $JobName=null,
/** @var DateTime|null */
public ?DateTime $DisplayDate=null,
/** @var string|null */
public ?string $Unit=null,
/** @var float */
public float $Billed=0.0,
/** @var float */
public float $NowQuantity=0.0,
/** @var float */
public float $OverBilled=0.0,
/** @var float */
public float $UnitFactor=0.0,
/** @var float */
public float $Price=0.0,
/** @var float */
public float $Amount=0.0,
/** @var string|null */
public ?string $LineType=null,
/** @var bool|null */
public ?bool $IsTaxable=null,
/** @var int */
public int $InvoiceID=0,
/** @var string */
public string $InvoiceUID='',
/** @var string|null */
public ?string $InvoiceNumber=null,
/** @var float */
public float $InvoiceTotal=0.0,
/** @var bool|null */
public ?bool $InvoiceIsLocked=null,
/** @var bool|null */
public ?bool $InvoiceIsPaid=null,
/** @var string|null */
public ?string $State=null,
/** @var string|null */
public ?string $Remembered=null,
/** @var string|null */
public ?string $DecidedByName=null,
/** @var DateTime|null */
public ?DateTime $DecidedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SourceType'])) $this->SourceType = $o['SourceType'];
if (isset($o['SourceID'])) $this->SourceID = $o['SourceID'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['WorkDate'])) $this->WorkDate = JsonConverters::from('DateTime', $o['WorkDate']);
if (isset($o['WorkDay'])) $this->WorkDay = $o['WorkDay'];
if (isset($o['DisplayDay'])) $this->DisplayDay = $o['DisplayDay'];
if (isset($o['Label'])) $this->Label = $o['Label'];
if (isset($o['JobName'])) $this->JobName = $o['JobName'];
if (isset($o['DisplayDate'])) $this->DisplayDate = JsonConverters::from('DateTime', $o['DisplayDate']);
if (isset($o['Unit'])) $this->Unit = $o['Unit'];
if (isset($o['Billed'])) $this->Billed = $o['Billed'];
if (isset($o['NowQuantity'])) $this->NowQuantity = $o['NowQuantity'];
if (isset($o['OverBilled'])) $this->OverBilled = $o['OverBilled'];
if (isset($o['UnitFactor'])) $this->UnitFactor = $o['UnitFactor'];
if (isset($o['Price'])) $this->Price = $o['Price'];
if (isset($o['Amount'])) $this->Amount = $o['Amount'];
if (isset($o['LineType'])) $this->LineType = $o['LineType'];
if (isset($o['IsTaxable'])) $this->IsTaxable = $o['IsTaxable'];
if (isset($o['InvoiceID'])) $this->InvoiceID = $o['InvoiceID'];
if (isset($o['InvoiceUID'])) $this->InvoiceUID = $o['InvoiceUID'];
if (isset($o['InvoiceNumber'])) $this->InvoiceNumber = $o['InvoiceNumber'];
if (isset($o['InvoiceTotal'])) $this->InvoiceTotal = $o['InvoiceTotal'];
if (isset($o['InvoiceIsLocked'])) $this->InvoiceIsLocked = $o['InvoiceIsLocked'];
if (isset($o['InvoiceIsPaid'])) $this->InvoiceIsPaid = $o['InvoiceIsPaid'];
if (isset($o['State'])) $this->State = $o['State'];
if (isset($o['Remembered'])) $this->Remembered = $o['Remembered'];
if (isset($o['DecidedByName'])) $this->DecidedByName = $o['DecidedByName'];
if (isset($o['DecidedAt'])) $this->DecidedAt = JsonConverters::from('DateTime', $o['DecidedAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SourceType)) $o['SourceType'] = $this->SourceType;
if (isset($this->SourceID)) $o['SourceID'] = $this->SourceID;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->WorkDate)) $o['WorkDate'] = JsonConverters::to('DateTime', $this->WorkDate);
if (isset($this->WorkDay)) $o['WorkDay'] = $this->WorkDay;
if (isset($this->DisplayDay)) $o['DisplayDay'] = $this->DisplayDay;
if (isset($this->Label)) $o['Label'] = $this->Label;
if (isset($this->JobName)) $o['JobName'] = $this->JobName;
if (isset($this->DisplayDate)) $o['DisplayDate'] = JsonConverters::to('DateTime', $this->DisplayDate);
if (isset($this->Unit)) $o['Unit'] = $this->Unit;
if (isset($this->Billed)) $o['Billed'] = $this->Billed;
if (isset($this->NowQuantity)) $o['NowQuantity'] = $this->NowQuantity;
if (isset($this->OverBilled)) $o['OverBilled'] = $this->OverBilled;
if (isset($this->UnitFactor)) $o['UnitFactor'] = $this->UnitFactor;
if (isset($this->Price)) $o['Price'] = $this->Price;
if (isset($this->Amount)) $o['Amount'] = $this->Amount;
if (isset($this->LineType)) $o['LineType'] = $this->LineType;
if (isset($this->IsTaxable)) $o['IsTaxable'] = $this->IsTaxable;
if (isset($this->InvoiceID)) $o['InvoiceID'] = $this->InvoiceID;
if (isset($this->InvoiceUID)) $o['InvoiceUID'] = $this->InvoiceUID;
if (isset($this->InvoiceNumber)) $o['InvoiceNumber'] = $this->InvoiceNumber;
if (isset($this->InvoiceTotal)) $o['InvoiceTotal'] = $this->InvoiceTotal;
if (isset($this->InvoiceIsLocked)) $o['InvoiceIsLocked'] = $this->InvoiceIsLocked;
if (isset($this->InvoiceIsPaid)) $o['InvoiceIsPaid'] = $this->InvoiceIsPaid;
if (isset($this->State)) $o['State'] = $this->State;
if (isset($this->Remembered)) $o['Remembered'] = $this->Remembered;
if (isset($this->DecidedByName)) $o['DecidedByName'] = $this->DecidedByName;
if (isset($this->DecidedAt)) $o['DecidedAt'] = JsonConverters::to('DateTime', $this->DecidedAt);
return empty($o) ? new class(){} : $o;
}
}
class InvoiceWorkChangesResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var bool|null */
public ?bool $Success=null,
/** @var array<InvoiceWorkChange>|null */
public ?array $Changes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Success'])) $this->Success = $o['Success'];
if (isset($o['Changes'])) $this->Changes = JsonConverters::fromArray('InvoiceWorkChange', $o['Changes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Success)) $o['Success'] = $this->Success;
if (isset($this->Changes)) $o['Changes'] = JsonConverters::toArray('InvoiceWorkChange', $this->Changes);
return empty($o) ? new class(){} : $o;
}
}
class InvoiceWorkChangeKey implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $SourceType=null,
/** @var int */
public int $SourceID=0,
/** @var int|null */
public ?int $JobID=null,
/** @var string|null */
public ?string $WorkDay=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SourceType'])) $this->SourceType = $o['SourceType'];
if (isset($o['SourceID'])) $this->SourceID = $o['SourceID'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['WorkDay'])) $this->WorkDay = $o['WorkDay'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SourceType)) $o['SourceType'] = $this->SourceType;
if (isset($this->SourceID)) $o['SourceID'] = $this->SourceID;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->WorkDay)) $o['WorkDay'] = $this->WorkDay;
return empty($o) ? new class(){} : $o;
}
}
class InvoiceWorkChangesDecideRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ProjectUID='',
/** @var int */
public int $InvoiceID=0,
/** @var string|null */
public ?string $Decision=null,
/** @var bool|null */
public ?bool $Remember=null,
/** @var array<InvoiceWorkChangeKey>|null */
public ?array $Sources=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
if (isset($o['InvoiceID'])) $this->InvoiceID = $o['InvoiceID'];
if (isset($o['Decision'])) $this->Decision = $o['Decision'];
if (isset($o['Remember'])) $this->Remember = $o['Remember'];
if (isset($o['Sources'])) $this->Sources = JsonConverters::fromArray('InvoiceWorkChangeKey', $o['Sources']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
if (isset($this->InvoiceID)) $o['InvoiceID'] = $this->InvoiceID;
if (isset($this->Decision)) $o['Decision'] = $this->Decision;
if (isset($this->Remember)) $o['Remember'] = $this->Remember;
if (isset($this->Sources)) $o['Sources'] = JsonConverters::toArray('InvoiceWorkChangeKey', $this->Sources);
return empty($o) ? new class(){} : $o;
}
}
PHP InvoiceWorkChangesDecideRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/invoice/workchanges/{ProjectUID}/decide HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"ProjectUID":"00000000000000000000000000000000","InvoiceID":0,"Decision":"String","Remember":false,"Sources":[{"SourceType":"String","SourceID":0,"JobID":0,"WorkDay":"String"}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Success":false,"Changes":[{"SourceType":"String","SourceID":0,"JobID":0,"WorkDate":"0001-01-01T00:00:00.0000000","WorkDay":"String","DisplayDay":"String","Label":"String","JobName":"String","DisplayDate":"0001-01-01T00:00:00.0000000","Unit":"String","Billed":0,"NowQuantity":0,"OverBilled":0,"UnitFactor":0,"Price":0,"Amount":0,"LineType":"String","IsTaxable":false,"InvoiceID":0,"InvoiceUID":"00000000000000000000000000000000","InvoiceNumber":"String","InvoiceTotal":0,"InvoiceIsLocked":false,"InvoiceIsPaid":false,"State":"String","Remembered":"String","DecidedByName":"String","DecidedAt":"0001-01-01T00:00:00.0000000"}]}