| Requires any of the roles: | Agent, Administrator |
| GET,OPTIONS | /v1/invoice/generate/{ProjectUID}/{InvoiceStartDate}/{InvoiceEndDate} |
|---|
<?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 InvoiceLineItem implements JsonSerializable
{
public function __construct(
/** @var int */
public int $InvoiceLineItemID=0,
/** @var int */
public int $InvoiceID=0,
/** @var string|null */
public ?string $Type=null,
/** @var string|null */
public ?string $Name=null,
/** @var int|null */
public ?int $Quantity=null,
/** @var float|null */
public ?float $PercentageAdjust=null,
/** @var float|null */
public ?float $AmountAdjust=null,
/** @var float|null */
public ?float $Price=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Notes=null,
/** @var bool|null */
public ?bool $IsTaxable=null,
/** @var int|null */
public ?int $DisplayOrder=null,
/** @var bool|null */
public ?bool $IsLocked=null,
/** @var bool|null */
public ?bool $IsDeleted=null,
/** @var bool|null */
public ?bool $IsPaid=null,
/** @var DateTime|null */
public ?DateTime $CreatedDate=null,
/** @var DateTime|null */
public ?DateTime $ModifiedDate=null,
/** @var string|null */
public ?string $CreatedByUID=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['InvoiceLineItemID'])) $this->InvoiceLineItemID = $o['InvoiceLineItemID'];
if (isset($o['InvoiceID'])) $this->InvoiceID = $o['InvoiceID'];
if (isset($o['Type'])) $this->Type = $o['Type'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
if (isset($o['PercentageAdjust'])) $this->PercentageAdjust = $o['PercentageAdjust'];
if (isset($o['AmountAdjust'])) $this->AmountAdjust = $o['AmountAdjust'];
if (isset($o['Price'])) $this->Price = $o['Price'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['IsTaxable'])) $this->IsTaxable = $o['IsTaxable'];
if (isset($o['DisplayOrder'])) $this->DisplayOrder = $o['DisplayOrder'];
if (isset($o['IsLocked'])) $this->IsLocked = $o['IsLocked'];
if (isset($o['IsDeleted'])) $this->IsDeleted = $o['IsDeleted'];
if (isset($o['IsPaid'])) $this->IsPaid = $o['IsPaid'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTime', $o['ModifiedDate']);
if (isset($o['CreatedByUID'])) $this->CreatedByUID = $o['CreatedByUID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->InvoiceLineItemID)) $o['InvoiceLineItemID'] = $this->InvoiceLineItemID;
if (isset($this->InvoiceID)) $o['InvoiceID'] = $this->InvoiceID;
if (isset($this->Type)) $o['Type'] = $this->Type;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
if (isset($this->PercentageAdjust)) $o['PercentageAdjust'] = $this->PercentageAdjust;
if (isset($this->AmountAdjust)) $o['AmountAdjust'] = $this->AmountAdjust;
if (isset($this->Price)) $o['Price'] = $this->Price;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->IsTaxable)) $o['IsTaxable'] = $this->IsTaxable;
if (isset($this->DisplayOrder)) $o['DisplayOrder'] = $this->DisplayOrder;
if (isset($this->IsLocked)) $o['IsLocked'] = $this->IsLocked;
if (isset($this->IsDeleted)) $o['IsDeleted'] = $this->IsDeleted;
if (isset($this->IsPaid)) $o['IsPaid'] = $this->IsPaid;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTime', $this->ModifiedDate);
if (isset($this->CreatedByUID)) $o['CreatedByUID'] = $this->CreatedByUID;
return empty($o) ? new class(){} : $o;
}
}
class InvoiceGenerateResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<InvoiceLineItem>|null */
public ?array $ProjectInvoice=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['ProjectInvoice'])) $this->ProjectInvoice = JsonConverters::fromArray('InvoiceLineItem', $o['ProjectInvoice']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->ProjectInvoice)) $o['ProjectInvoice'] = JsonConverters::toArray('InvoiceLineItem', $this->ProjectInvoice);
return empty($o) ? new class(){} : $o;
}
}
class InvoiceGenerateRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ProjectUID='',
/** @var DateTime */
public DateTime $InvoiceStartDate=new DateTime(),
/** @var DateTime */
public DateTime $InvoiceEndDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
if (isset($o['InvoiceStartDate'])) $this->InvoiceStartDate = JsonConverters::from('DateTime', $o['InvoiceStartDate']);
if (isset($o['InvoiceEndDate'])) $this->InvoiceEndDate = JsonConverters::from('DateTime', $o['InvoiceEndDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
if (isset($this->InvoiceStartDate)) $o['InvoiceStartDate'] = JsonConverters::to('DateTime', $this->InvoiceStartDate);
if (isset($this->InvoiceEndDate)) $o['InvoiceEndDate'] = JsonConverters::to('DateTime', $this->InvoiceEndDate);
return empty($o) ? new class(){} : $o;
}
}
PHP InvoiceGenerateRequest 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.
GET /v1/invoice/generate/{ProjectUID}/{InvoiceStartDate}/{InvoiceEndDate} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<InvoiceGenerateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<ProjectInvoice>
<InvoiceLineItem>
<AmountAdjust>0</AmountAdjust>
<CreatedByUID>00000000-0000-0000-0000-000000000000</CreatedByUID>
<CreatedDate>0001-01-01T00:00:00</CreatedDate>
<Description>String</Description>
<DisplayOrder>0</DisplayOrder>
<InvoiceID>0</InvoiceID>
<InvoiceLineItemID>0</InvoiceLineItemID>
<IsDeleted>false</IsDeleted>
<IsLocked>false</IsLocked>
<IsPaid>false</IsPaid>
<IsTaxable>false</IsTaxable>
<ModifiedDate>0001-01-01T00:00:00</ModifiedDate>
<Name>String</Name>
<Notes>String</Notes>
<PercentageAdjust>0</PercentageAdjust>
<Price>0</Price>
<Quantity>0</Quantity>
<Type>String</Type>
</InvoiceLineItem>
</ProjectInvoice>
<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>
</InvoiceGenerateResponse>