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 VehicleDriverUse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $SessionId=0,
        /** @var int */
        public int $ContactID=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Board=null,
        /** @var DateTime */
        public DateTime $StartUtc=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $EndUtc=null,
        /** @var string|null */
        public ?string $EndReason=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SessionId'])) $this->SessionId = $o['SessionId'];
        if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Board'])) $this->Board = $o['Board'];
        if (isset($o['StartUtc'])) $this->StartUtc = JsonConverters::from('DateTime', $o['StartUtc']);
        if (isset($o['EndUtc'])) $this->EndUtc = JsonConverters::from('DateTime', $o['EndUtc']);
        if (isset($o['EndReason'])) $this->EndReason = $o['EndReason'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SessionId)) $o['SessionId'] = $this->SessionId;
        if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Board)) $o['Board'] = $this->Board;
        if (isset($this->StartUtc)) $o['StartUtc'] = JsonConverters::to('DateTime', $this->StartUtc);
        if (isset($this->EndUtc)) $o['EndUtc'] = JsonConverters::to('DateTime', $this->EndUtc);
        if (isset($this->EndReason)) $o['EndReason'] = $this->EndReason;
        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,
        /** @var array<VehicleDriverUse>|null */
        public ?array $Drivers=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']);
        if (isset($o['Drivers'])) $this->Drivers = JsonConverters::fromArray('VehicleDriverUse', $o['Drivers']);
    }
    
    /** @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);
        if (isset($this->Drivers)) $o['Drivers'] = JsonConverters::toArray('VehicleDriverUse', $this->Drivers);
        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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<EquipmentUsageResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Drivers>
    <VehicleDriverUse>
      <Board>String</Board>
      <ContactID>0</ContactID>
      <EndReason>String</EndReason>
      <EndUtc>0001-01-01T00:00:00</EndUtc>
      <Name>String</Name>
      <SessionId>0</SessionId>
      <StartUtc>0001-01-01T00:00:00</StartUtc>
    </VehicleDriverUse>
  </Drivers>
  <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>
  <Usage>
    <EquipmentUsageEntry>
      <BookingCount>0</BookingCount>
      <EndDate>0001-01-01T00:00:00</EndDate>
      <JobID>0</JobID>
      <JobName>String</JobName>
      <ProjectID>0</ProjectID>
      <ProjectJobEquipmentID>0</ProjectJobEquipmentID>
      <ProjectName>String</ProjectName>
      <StartDate>0001-01-01T00:00:00</StartDate>
      <StatusID>0</StatusID>
    </EquipmentUsageEntry>
  </Usage>
</EquipmentUsageResponse>