Trendsic Platform Service

<back to all web services

ProjectInvoiceRequest

Requires Authentication
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/Project/Invoice/{ProjectID}/{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 ProjectInvoice implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CostType=null,
        /** @var string|null */
        public ?string $CostName=null,
        /** @var float */
        public float $CostToDate=0.0,
        /** @var int */
        public int $JobID=0,
        /** @var float */
        public float $Rate=0.0,
        /** @var int */
        public int $Hours=0
    ) {
    }

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

class ProjectInvoiceResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<ProjectInvoice>|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('ProjectInvoice', $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('ProjectInvoice', $this->ProjectInvoice);
        return empty($o) ? new class(){} : $o;
    }
}

class ProjectInvoiceRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var DateTime */
        public DateTime $InvoiceStartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $InvoiceEndDate=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        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->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        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 ProjectInvoiceRequest 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.

POST /v1/Project/Invoice/{ProjectID}/{InvoiceStartDate}/{InvoiceEndDate} HTTP/1.1 
Host: api.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ProjectID: 0,
	InvoiceStartDate: 0001-01-01,
	InvoiceEndDate: 0001-01-01
}
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
		}
	},
	ProjectInvoice: 
	[
		{
			CostType: String,
			CostName: String,
			CostToDate: 0,
			JobID: 0,
			Rate: 0,
			Hours: 0
		}
	]
}