Trendsic Platform Service

<back to all web services

TimetrackerHistoryRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/TimeTracker/History/{AgentId}
<?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 TimeCard implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgentId=0,
        /** @var int */
        public int $CheckInId=0,
        /** @var DateTime */
        public DateTime $DateLogged=new DateTime(),
        /** @var DateInterval|null */
        public ?DateInterval $TimeIn=null,
        /** @var DateTime */
        public DateTime $TimeInDate=new DateTime(),
        /** @var DateInterval|null */
        public ?DateInterval $TimeOut=null,
        /** @var DateTime */
        public DateTime $TimeOutDate=new DateTime(),
        /** @var float */
        public float $TimeLogged=0.0,
        /** @var int */
        public int $PaymentType=0,
        /** @var int */
        public int $ServiceCodeId=0,
        /** @var string|null */
        public ?string $ServiceCode=null,
        /** @var float */
        public float $ServiceRate=0.0,
        /** @var string|null */
        public ?string $ServiceDescription=null,
        /** @var string|null */
        public ?string $WorkDescription=null,
        /** @var DateInterval|null */
        public ?DateInterval $AdjustedTimeIn=null,
        /** @var DateTime */
        public DateTime $AdjustedTimeInDate=new DateTime(),
        /** @var DateInterval|null */
        public ?DateInterval $AdjustedTimeOut=null,
        /** @var DateTime */
        public DateTime $AdjustedTimeOutDate=new DateTime(),
        /** @var bool|null */
        public ?bool $IsValid=null,
        /** @var bool|null */
        public ?bool $Adjusted=null,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var int */
        public int $ClientID=0,
        /** @var string|null */
        public ?string $ClientName=null,
        /** @var int */
        public int $CategoryID=0,
        /** @var string|null */
        public ?string $CategoryName=null,
        /** @var int */
        public int $JobID=0,
        /** @var string|null */
        public ?string $JobName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['CheckInId'])) $this->CheckInId = $o['CheckInId'];
        if (isset($o['DateLogged'])) $this->DateLogged = JsonConverters::from('DateTime', $o['DateLogged']);
        if (isset($o['TimeIn'])) $this->TimeIn = JsonConverters::from('DateInterval', $o['TimeIn']);
        if (isset($o['TimeInDate'])) $this->TimeInDate = JsonConverters::from('DateTime', $o['TimeInDate']);
        if (isset($o['TimeOut'])) $this->TimeOut = JsonConverters::from('DateInterval', $o['TimeOut']);
        if (isset($o['TimeOutDate'])) $this->TimeOutDate = JsonConverters::from('DateTime', $o['TimeOutDate']);
        if (isset($o['TimeLogged'])) $this->TimeLogged = $o['TimeLogged'];
        if (isset($o['PaymentType'])) $this->PaymentType = $o['PaymentType'];
        if (isset($o['ServiceCodeId'])) $this->ServiceCodeId = $o['ServiceCodeId'];
        if (isset($o['ServiceCode'])) $this->ServiceCode = $o['ServiceCode'];
        if (isset($o['ServiceRate'])) $this->ServiceRate = $o['ServiceRate'];
        if (isset($o['ServiceDescription'])) $this->ServiceDescription = $o['ServiceDescription'];
        if (isset($o['WorkDescription'])) $this->WorkDescription = $o['WorkDescription'];
        if (isset($o['AdjustedTimeIn'])) $this->AdjustedTimeIn = JsonConverters::from('DateInterval', $o['AdjustedTimeIn']);
        if (isset($o['AdjustedTimeInDate'])) $this->AdjustedTimeInDate = JsonConverters::from('DateTime', $o['AdjustedTimeInDate']);
        if (isset($o['AdjustedTimeOut'])) $this->AdjustedTimeOut = JsonConverters::from('DateInterval', $o['AdjustedTimeOut']);
        if (isset($o['AdjustedTimeOutDate'])) $this->AdjustedTimeOutDate = JsonConverters::from('DateTime', $o['AdjustedTimeOutDate']);
        if (isset($o['IsValid'])) $this->IsValid = $o['IsValid'];
        if (isset($o['Adjusted'])) $this->Adjusted = $o['Adjusted'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['ClientID'])) $this->ClientID = $o['ClientID'];
        if (isset($o['ClientName'])) $this->ClientName = $o['ClientName'];
        if (isset($o['CategoryID'])) $this->CategoryID = $o['CategoryID'];
        if (isset($o['CategoryName'])) $this->CategoryName = $o['CategoryName'];
        if (isset($o['JobID'])) $this->JobID = $o['JobID'];
        if (isset($o['JobName'])) $this->JobName = $o['JobName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->CheckInId)) $o['CheckInId'] = $this->CheckInId;
        if (isset($this->DateLogged)) $o['DateLogged'] = JsonConverters::to('DateTime', $this->DateLogged);
        if (isset($this->TimeIn)) $o['TimeIn'] = JsonConverters::to('DateInterval', $this->TimeIn);
        if (isset($this->TimeInDate)) $o['TimeInDate'] = JsonConverters::to('DateTime', $this->TimeInDate);
        if (isset($this->TimeOut)) $o['TimeOut'] = JsonConverters::to('DateInterval', $this->TimeOut);
        if (isset($this->TimeOutDate)) $o['TimeOutDate'] = JsonConverters::to('DateTime', $this->TimeOutDate);
        if (isset($this->TimeLogged)) $o['TimeLogged'] = $this->TimeLogged;
        if (isset($this->PaymentType)) $o['PaymentType'] = $this->PaymentType;
        if (isset($this->ServiceCodeId)) $o['ServiceCodeId'] = $this->ServiceCodeId;
        if (isset($this->ServiceCode)) $o['ServiceCode'] = $this->ServiceCode;
        if (isset($this->ServiceRate)) $o['ServiceRate'] = $this->ServiceRate;
        if (isset($this->ServiceDescription)) $o['ServiceDescription'] = $this->ServiceDescription;
        if (isset($this->WorkDescription)) $o['WorkDescription'] = $this->WorkDescription;
        if (isset($this->AdjustedTimeIn)) $o['AdjustedTimeIn'] = JsonConverters::to('DateInterval', $this->AdjustedTimeIn);
        if (isset($this->AdjustedTimeInDate)) $o['AdjustedTimeInDate'] = JsonConverters::to('DateTime', $this->AdjustedTimeInDate);
        if (isset($this->AdjustedTimeOut)) $o['AdjustedTimeOut'] = JsonConverters::to('DateInterval', $this->AdjustedTimeOut);
        if (isset($this->AdjustedTimeOutDate)) $o['AdjustedTimeOutDate'] = JsonConverters::to('DateTime', $this->AdjustedTimeOutDate);
        if (isset($this->IsValid)) $o['IsValid'] = $this->IsValid;
        if (isset($this->Adjusted)) $o['Adjusted'] = $this->Adjusted;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->ClientID)) $o['ClientID'] = $this->ClientID;
        if (isset($this->ClientName)) $o['ClientName'] = $this->ClientName;
        if (isset($this->CategoryID)) $o['CategoryID'] = $this->CategoryID;
        if (isset($this->CategoryName)) $o['CategoryName'] = $this->CategoryName;
        if (isset($this->JobID)) $o['JobID'] = $this->JobID;
        if (isset($this->JobName)) $o['JobName'] = $this->JobName;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class TimetrackerHistoryRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgentId=0,
        /** @var DateTime|null */
        public ?DateTime $MinDate=null,
        /** @var DateTime|null */
        public ?DateTime $MaxDate=null
    ) {
    }

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

PHP TimetrackerHistoryRequest 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/TimeTracker/History/{AgentId} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<TimetrackerHistoryRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <AgentId>0</AgentId>
  <MaxDate>0001-01-01T00:00:00</MaxDate>
  <MinDate>0001-01-01T00:00:00</MinDate>
</TimetrackerHistoryRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<TimetrackerHistoryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <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>
  <TimeTrackerHistory>
    <TimeCard>
      <Adjusted>false</Adjusted>
      <AdjustedTimeIn>PT0S</AdjustedTimeIn>
      <AdjustedTimeInDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
      </AdjustedTimeInDate>
      <AdjustedTimeOut>PT0S</AdjustedTimeOut>
      <AdjustedTimeOutDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
      </AdjustedTimeOutDate>
      <AgentId>0</AgentId>
      <CategoryID>0</CategoryID>
      <CategoryName>String</CategoryName>
      <CheckInId>0</CheckInId>
      <ClientID>0</ClientID>
      <ClientName>String</ClientName>
      <DateLogged>0001-01-01T00:00:00</DateLogged>
      <IsValid>false</IsValid>
      <JobID>0</JobID>
      <JobName>String</JobName>
      <PaymentType>0</PaymentType>
      <ProjectID>0</ProjectID>
      <ProjectName>String</ProjectName>
      <ServiceCode>String</ServiceCode>
      <ServiceCodeId>0</ServiceCodeId>
      <ServiceDescription>String</ServiceDescription>
      <ServiceRate>0</ServiceRate>
      <TimeIn>PT0S</TimeIn>
      <TimeInDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
      </TimeInDate>
      <TimeLogged>0</TimeLogged>
      <TimeOut>PT0S</TimeOut>
      <TimeOutDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
      </TimeOutDate>
      <WorkDescription>String</WorkDescription>
    </TimeCard>
  </TimeTrackerHistory>
</TimetrackerHistoryResponse>