Trendsic Platform Service

<back to all web services

FieldLogSubmitRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/fieldlog/submit
<?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 FieldLogSubmitResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var int */
        public int $FieldLogId=0,
        /** @var string */
        public string $FieldLogUID='',
        /** @var string|null */
        public ?string $Status=null
    ) {
    }

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

class FieldLogCrew implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $StatusCode=null,
        /** @var float */
        public float $Hours=0.0,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var string|null */
        public ?string $SplitCostCode=null,
        /** @var float */
        public float $SplitHours=0.0
    ) {
    }

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

class FieldLogEquipment implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $EquipmentId=0,
        /** @var string|null */
        public ?string $EquipmentKey=null,
        /** @var string|null */
        public ?string $StatusCode=null,
        /** @var float */
        public float $EngineHours=0.0,
        /** @var float */
        public float $FuelGallons=0.0,
        /** @var string|null */
        public ?string $IdleReason=null,
        /** @var string|null */
        public ?string $DownNote=null
    ) {
    }

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

class FieldLogSub implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Trade=null,
        /** @var int */
        public int $HeadCount=0,
        /** @var float */
        public float $HoursPer=0.0,
        /** @var string|null */
        public ?string $SourceCode=null,
        /** @var string|null */
        public ?string $Reporter=null,
        /** @var string|null */
        public ?string $Note=null,
        /** @var bool|null */
        public ?bool $Verified=null,
        /** @var string|null */
        public ?string $StateCode=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Trade'])) $this->Trade = $o['Trade'];
        if (isset($o['HeadCount'])) $this->HeadCount = $o['HeadCount'];
        if (isset($o['HoursPer'])) $this->HoursPer = $o['HoursPer'];
        if (isset($o['SourceCode'])) $this->SourceCode = $o['SourceCode'];
        if (isset($o['Reporter'])) $this->Reporter = $o['Reporter'];
        if (isset($o['Note'])) $this->Note = $o['Note'];
        if (isset($o['Verified'])) $this->Verified = $o['Verified'];
        if (isset($o['StateCode'])) $this->StateCode = $o['StateCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Trade)) $o['Trade'] = $this->Trade;
        if (isset($this->HeadCount)) $o['HeadCount'] = $this->HeadCount;
        if (isset($this->HoursPer)) $o['HoursPer'] = $this->HoursPer;
        if (isset($this->SourceCode)) $o['SourceCode'] = $this->SourceCode;
        if (isset($this->Reporter)) $o['Reporter'] = $this->Reporter;
        if (isset($this->Note)) $o['Note'] = $this->Note;
        if (isset($this->Verified)) $o['Verified'] = $this->Verified;
        if (isset($this->StateCode)) $o['StateCode'] = $this->StateCode;
        return empty($o) ? new class(){} : $o;
    }
}

class FieldLogQuantity implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $PayItemCode=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var float */
        public float $TodayQty=0.0
    ) {
    }

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

class FieldLogDelivery implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Po=null,
        /** @var string|null */
        public ?string $Material=null,
        /** @var string|null */
        public ?string $StatusCode=null,
        /** @var string|null */
        public ?string $QtyReceived=null
    ) {
    }

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

class FieldLogConsumed implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Qty=null,
        /** @var string|null */
        public ?string $Use=null
    ) {
    }

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

class FieldLogSubmitRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectId=0,
        /** @var int */
        public int $JobId=0,
        /** @var string|null */
        public ?string $LogDate=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var string|null */
        public ?string $Weather=null,
        /** @var int */
        public int $TempF=0,
        /** @var float */
        public float $WeatherDelayHours=0.0,
        /** @var string|null */
        public ?string $ToolboxTalk=null,
        /** @var bool|null */
        public ?bool $IncidentOccurred=null,
        /** @var string|null */
        public ?string $IncidentType=null,
        /** @var string|null */
        public ?string $IncidentNote=null,
        /** @var int */
        public int $IncidentPhotoCount=0,
        /** @var array<FieldLogCrew>|null */
        public ?array $Crew=null,
        /** @var array<FieldLogEquipment>|null */
        public ?array $Equipment=null,
        /** @var array<FieldLogSub>|null */
        public ?array $Subs=null,
        /** @var array<FieldLogQuantity>|null */
        public ?array $Quantities=null,
        /** @var array<FieldLogDelivery>|null */
        public ?array $Deliveries=null,
        /** @var array<FieldLogConsumed>|null */
        public ?array $Consumed=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectId'])) $this->ProjectId = $o['ProjectId'];
        if (isset($o['JobId'])) $this->JobId = $o['JobId'];
        if (isset($o['LogDate'])) $this->LogDate = $o['LogDate'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['Weather'])) $this->Weather = $o['Weather'];
        if (isset($o['TempF'])) $this->TempF = $o['TempF'];
        if (isset($o['WeatherDelayHours'])) $this->WeatherDelayHours = $o['WeatherDelayHours'];
        if (isset($o['ToolboxTalk'])) $this->ToolboxTalk = $o['ToolboxTalk'];
        if (isset($o['IncidentOccurred'])) $this->IncidentOccurred = $o['IncidentOccurred'];
        if (isset($o['IncidentType'])) $this->IncidentType = $o['IncidentType'];
        if (isset($o['IncidentNote'])) $this->IncidentNote = $o['IncidentNote'];
        if (isset($o['IncidentPhotoCount'])) $this->IncidentPhotoCount = $o['IncidentPhotoCount'];
        if (isset($o['Crew'])) $this->Crew = JsonConverters::fromArray('FieldLogCrew', $o['Crew']);
        if (isset($o['Equipment'])) $this->Equipment = JsonConverters::fromArray('FieldLogEquipment', $o['Equipment']);
        if (isset($o['Subs'])) $this->Subs = JsonConverters::fromArray('FieldLogSub', $o['Subs']);
        if (isset($o['Quantities'])) $this->Quantities = JsonConverters::fromArray('FieldLogQuantity', $o['Quantities']);
        if (isset($o['Deliveries'])) $this->Deliveries = JsonConverters::fromArray('FieldLogDelivery', $o['Deliveries']);
        if (isset($o['Consumed'])) $this->Consumed = JsonConverters::fromArray('FieldLogConsumed', $o['Consumed']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectId)) $o['ProjectId'] = $this->ProjectId;
        if (isset($this->JobId)) $o['JobId'] = $this->JobId;
        if (isset($this->LogDate)) $o['LogDate'] = $this->LogDate;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->Weather)) $o['Weather'] = $this->Weather;
        if (isset($this->TempF)) $o['TempF'] = $this->TempF;
        if (isset($this->WeatherDelayHours)) $o['WeatherDelayHours'] = $this->WeatherDelayHours;
        if (isset($this->ToolboxTalk)) $o['ToolboxTalk'] = $this->ToolboxTalk;
        if (isset($this->IncidentOccurred)) $o['IncidentOccurred'] = $this->IncidentOccurred;
        if (isset($this->IncidentType)) $o['IncidentType'] = $this->IncidentType;
        if (isset($this->IncidentNote)) $o['IncidentNote'] = $this->IncidentNote;
        if (isset($this->IncidentPhotoCount)) $o['IncidentPhotoCount'] = $this->IncidentPhotoCount;
        if (isset($this->Crew)) $o['Crew'] = JsonConverters::toArray('FieldLogCrew', $this->Crew);
        if (isset($this->Equipment)) $o['Equipment'] = JsonConverters::toArray('FieldLogEquipment', $this->Equipment);
        if (isset($this->Subs)) $o['Subs'] = JsonConverters::toArray('FieldLogSub', $this->Subs);
        if (isset($this->Quantities)) $o['Quantities'] = JsonConverters::toArray('FieldLogQuantity', $this->Quantities);
        if (isset($this->Deliveries)) $o['Deliveries'] = JsonConverters::toArray('FieldLogDelivery', $this->Deliveries);
        if (isset($this->Consumed)) $o['Consumed'] = JsonConverters::toArray('FieldLogConsumed', $this->Consumed);
        return empty($o) ? new class(){} : $o;
    }
}

PHP FieldLogSubmitRequest 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.

POST /v1/fieldlog/submit HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<FieldLogSubmitRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Consumed>
    <FieldLogConsumed>
      <Name>String</Name>
      <Qty>String</Qty>
      <Use>String</Use>
    </FieldLogConsumed>
  </Consumed>
  <Crew>
    <FieldLogCrew>
      <ContactId>0</ContactId>
      <CostCode>String</CostCode>
      <Hours>0</Hours>
      <SplitCostCode>String</SplitCostCode>
      <SplitHours>0</SplitHours>
      <StatusCode>String</StatusCode>
    </FieldLogCrew>
  </Crew>
  <Deliveries>
    <FieldLogDelivery>
      <Material>String</Material>
      <Po>String</Po>
      <QtyReceived>String</QtyReceived>
      <StatusCode>String</StatusCode>
    </FieldLogDelivery>
  </Deliveries>
  <Equipment>
    <FieldLogEquipment>
      <DownNote>String</DownNote>
      <EngineHours>0</EngineHours>
      <EquipmentId>0</EquipmentId>
      <EquipmentKey>String</EquipmentKey>
      <FuelGallons>0</FuelGallons>
      <IdleReason>String</IdleReason>
      <StatusCode>String</StatusCode>
    </FieldLogEquipment>
  </Equipment>
  <IncidentNote>String</IncidentNote>
  <IncidentOccurred>false</IncidentOccurred>
  <IncidentPhotoCount>0</IncidentPhotoCount>
  <IncidentType>String</IncidentType>
  <JobId>0</JobId>
  <LogDate>String</LogDate>
  <Notes>String</Notes>
  <ProjectId>0</ProjectId>
  <Quantities>
    <FieldLogQuantity>
      <Name>String</Name>
      <PayItemCode>String</PayItemCode>
      <TodayQty>0</TodayQty>
      <Unit>String</Unit>
    </FieldLogQuantity>
  </Quantities>
  <Subs>
    <FieldLogSub>
      <ContactId>0</ContactId>
      <HeadCount>0</HeadCount>
      <HoursPer>0</HoursPer>
      <Name>String</Name>
      <Note>String</Note>
      <Reporter>String</Reporter>
      <SourceCode>String</SourceCode>
      <StateCode>String</StateCode>
      <Trade>String</Trade>
      <Verified>false</Verified>
    </FieldLogSub>
  </Subs>
  <TempF>0</TempF>
  <ToolboxTalk>String</ToolboxTalk>
  <Weather>String</Weather>
  <WeatherDelayHours>0</WeatherDelayHours>
</FieldLogSubmitRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<FieldLogSubmitResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <FieldLogId>0</FieldLogId>
  <FieldLogUID>00000000-0000-0000-0000-000000000000</FieldLogUID>
  <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>
  <Status>String</Status>
</FieldLogSubmitResponse>