Trendsic Platform Service

<back to all web services

GetInvoicesByProjectRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/invoice/project/{ProjectUID}
<?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 GetInvoicesByProjectRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ProjectUID=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
        return empty($o) ? new class(){} : $o;
    }
}

class Invoice implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $InvoiceID=0,
        /** @var string|null */
        public ?string $InvoiceUID=null,
        /** @var string|null */
        public ?string $ProjectUID=null,
        /** @var string|null */
        public ?string $InvoiceNumber=null,
        /** @var DateTime|null */
        public ?DateTime $InvoiceDate=null,
        /** @var DateTime|null */
        public ?DateTime $DueDate=null,
        /** @var string|null */
        public ?string $FromName=null,
        /** @var string|null */
        public ?string $FromPhone=null,
        /** @var string|null */
        public ?string $FromEmail=null,
        /** @var string|null */
        public ?string $FromAddress=null,
        /** @var string|null */
        public ?string $FromDesc=null,
        /** @var string|null */
        public ?string $ToName=null,
        /** @var string|null */
        public ?string $ToPhone=null,
        /** @var string|null */
        public ?string $ToEmail=null,
        /** @var string|null */
        public ?string $ToAddress=null,
        /** @var string|null */
        public ?string $ToDesc=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var string|null */
        public ?string $Currency=null,
        /** @var int */
        public int $Status=0,
        /** @var float|null */
        public ?float $Total=null,
        /** @var bool|null */
        public ?bool $IsPaid=null,
        /** @var DateTime|null */
        public ?DateTime $PaidDate=null,
        /** @var bool|null */
        public ?bool $IsDeleted=null,
        /** @var bool|null */
        public ?bool $IsLocked=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['InvoiceID'])) $this->InvoiceID = $o['InvoiceID'];
        if (isset($o['InvoiceUID'])) $this->InvoiceUID = $o['InvoiceUID'];
        if (isset($o['ProjectUID'])) $this->ProjectUID = $o['ProjectUID'];
        if (isset($o['InvoiceNumber'])) $this->InvoiceNumber = $o['InvoiceNumber'];
        if (isset($o['InvoiceDate'])) $this->InvoiceDate = JsonConverters::from('DateTime', $o['InvoiceDate']);
        if (isset($o['DueDate'])) $this->DueDate = JsonConverters::from('DateTime', $o['DueDate']);
        if (isset($o['FromName'])) $this->FromName = $o['FromName'];
        if (isset($o['FromPhone'])) $this->FromPhone = $o['FromPhone'];
        if (isset($o['FromEmail'])) $this->FromEmail = $o['FromEmail'];
        if (isset($o['FromAddress'])) $this->FromAddress = $o['FromAddress'];
        if (isset($o['FromDesc'])) $this->FromDesc = $o['FromDesc'];
        if (isset($o['ToName'])) $this->ToName = $o['ToName'];
        if (isset($o['ToPhone'])) $this->ToPhone = $o['ToPhone'];
        if (isset($o['ToEmail'])) $this->ToEmail = $o['ToEmail'];
        if (isset($o['ToAddress'])) $this->ToAddress = $o['ToAddress'];
        if (isset($o['ToDesc'])) $this->ToDesc = $o['ToDesc'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['Currency'])) $this->Currency = $o['Currency'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['IsPaid'])) $this->IsPaid = $o['IsPaid'];
        if (isset($o['PaidDate'])) $this->PaidDate = JsonConverters::from('DateTime', $o['PaidDate']);
        if (isset($o['IsDeleted'])) $this->IsDeleted = $o['IsDeleted'];
        if (isset($o['IsLocked'])) $this->IsLocked = $o['IsLocked'];
        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->InvoiceID)) $o['InvoiceID'] = $this->InvoiceID;
        if (isset($this->InvoiceUID)) $o['InvoiceUID'] = $this->InvoiceUID;
        if (isset($this->ProjectUID)) $o['ProjectUID'] = $this->ProjectUID;
        if (isset($this->InvoiceNumber)) $o['InvoiceNumber'] = $this->InvoiceNumber;
        if (isset($this->InvoiceDate)) $o['InvoiceDate'] = JsonConverters::to('DateTime', $this->InvoiceDate);
        if (isset($this->DueDate)) $o['DueDate'] = JsonConverters::to('DateTime', $this->DueDate);
        if (isset($this->FromName)) $o['FromName'] = $this->FromName;
        if (isset($this->FromPhone)) $o['FromPhone'] = $this->FromPhone;
        if (isset($this->FromEmail)) $o['FromEmail'] = $this->FromEmail;
        if (isset($this->FromAddress)) $o['FromAddress'] = $this->FromAddress;
        if (isset($this->FromDesc)) $o['FromDesc'] = $this->FromDesc;
        if (isset($this->ToName)) $o['ToName'] = $this->ToName;
        if (isset($this->ToPhone)) $o['ToPhone'] = $this->ToPhone;
        if (isset($this->ToEmail)) $o['ToEmail'] = $this->ToEmail;
        if (isset($this->ToAddress)) $o['ToAddress'] = $this->ToAddress;
        if (isset($this->ToDesc)) $o['ToDesc'] = $this->ToDesc;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->Currency)) $o['Currency'] = $this->Currency;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->IsPaid)) $o['IsPaid'] = $this->IsPaid;
        if (isset($this->PaidDate)) $o['PaidDate'] = JsonConverters::to('DateTime', $this->PaidDate);
        if (isset($this->IsDeleted)) $o['IsDeleted'] = $this->IsDeleted;
        if (isset($this->IsLocked)) $o['IsLocked'] = $this->IsLocked;
        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 ProjectInvoiceData implements JsonSerializable
{
    public function __construct(
        /** @var float|null */
        public ?float $InvoicedAmount=null,
        /** @var float|null */
        public ?float $PaidAmount=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InvoicedAmount'])) $this->InvoicedAmount = $o['InvoicedAmount'];
        if (isset($o['PaidAmount'])) $this->PaidAmount = $o['PaidAmount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InvoicedAmount)) $o['InvoicedAmount'] = $this->InvoicedAmount;
        if (isset($this->PaidAmount)) $o['PaidAmount'] = $this->PaidAmount;
        return empty($o) ? new class(){} : $o;
    }
}

class GetInvoicesByProjectResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<Invoice>|null */
        public ?array $Invoices=null,
        /** @var ProjectInvoiceData|null */
        public ?ProjectInvoiceData $ProjectInvoiceData=null
    ) {
    }

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

PHP GetInvoicesByProjectRequest DTOs

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

HTTP + OTHER

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

GET /v1/invoice/project/{ProjectUID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Invoices":[{"InvoiceID":0,"InvoiceUID":"00000000000000000000000000000000","ProjectUID":"00000000000000000000000000000000","InvoiceNumber":"String","InvoiceDate":"0001-01-01T00:00:00.0000000","DueDate":"0001-01-01T00:00:00.0000000","FromName":"String","FromPhone":"String","FromEmail":"String","FromAddress":"String","FromDesc":"String","ToName":"String","ToPhone":"String","ToEmail":"String","ToAddress":"String","ToDesc":"String","Notes":"String","Currency":"String","Status":0,"Total":0,"IsPaid":false,"PaidDate":"0001-01-01T00:00:00.0000000","IsDeleted":false,"IsLocked":false,"CreatedDate":"0001-01-01T00:00:00.0000000","ModifiedDate":"0001-01-01T00:00:00.0000000","CreatedByUID":"00000000000000000000000000000000"}],"ProjectInvoiceData":{"InvoicedAmount":0,"PaidAmount":0}}