Trendsic Platform Service

<back to all web services

EquipmentUsageRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/Equipment/{EquipmentID}/usage
<?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 EquipmentUsageEntry implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectJobEquipmentID=0,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var int */
        public int $JobID=0,
        /** @var string|null */
        public ?string $JobName=null,
        /** @var int|null */
        public ?int $StatusID=null,
        /** @var DateTime|null */
        public ?DateTime $StartDate=null,
        /** @var DateTime|null */
        public ?DateTime $EndDate=null,
        /** @var int */
        public int $BookingCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectJobEquipmentID'])) $this->ProjectJobEquipmentID = $o['ProjectJobEquipmentID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
        if (isset($o['StatusID'])) $this->StatusID = $o['StatusID'];
        if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
        if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
        if (isset($o['BookingCount'])) $this->BookingCount = $o['BookingCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectJobEquipmentID)) $o['ProjectJobEquipmentID'] = $this->ProjectJobEquipmentID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        if (isset($this->StatusID)) $o['StatusID'] = $this->StatusID;
        if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
        if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
        if (isset($this->BookingCount)) $o['BookingCount'] = $this->BookingCount;
        return empty($o) ? new class(){} : $o;
    }
}

class EquipmentUsageResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<EquipmentUsageEntry>|null */
        public ?array $Usage=null
    ) {
    }

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

class EquipmentUsageRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $EquipmentID=0
    ) {
    }

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

PHP EquipmentUsageRequest 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/Equipment/{EquipmentID}/usage 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"}},"Usage":[{"ProjectJobEquipmentID":0,"ProjectID":0,"ProjectName":"String","JobID":0,"JobName":"String","StatusID":0,"StartDate":"0001-01-01T00:00:00.0000000","EndDate":"0001-01-01T00:00:00.0000000","BookingCount":0}]}