Trendsic Platform Service

<back to all web services

ClockInOutRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/TimeTracker/ClockInOut
<?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 ClockInOutResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var bool|null */
        public ?bool $response=null
    ) {
    }

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

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 ClockInOutRequest implements JsonSerializable
{
    public function __construct(
        /** @var TimeCard|null */
        public ?TimeCard $Timecard=null
    ) {
    }

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

PHP ClockInOutRequest 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/TimeTracker/ClockInOut HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Timecard: 
	{
		AgentId: 0,
		CheckInId: 0,
		DateLogged: 0001-01-01,
		TimeIn: PT0S,
		TimeInDate: 0001-01-01T00:00:00.0000000+00:00,
		TimeOut: PT0S,
		TimeOutDate: 0001-01-01T00:00:00.0000000+00:00,
		TimeLogged: 0,
		PaymentType: 0,
		ServiceCodeId: 0,
		ServiceCode: String,
		ServiceRate: 0,
		ServiceDescription: String,
		WorkDescription: String,
		AdjustedTimeIn: PT0S,
		AdjustedTimeInDate: 0001-01-01T00:00:00.0000000+00:00,
		AdjustedTimeOut: PT0S,
		AdjustedTimeOutDate: 0001-01-01T00:00:00.0000000+00:00,
		IsValid: False,
		Adjusted: False,
		ProjectID: 0,
		ProjectName: String,
		ClientID: 0,
		ClientName: String,
		CategoryID: 0,
		CategoryName: String,
		JobID: 0,
		JobName: String
	}
}
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
		}
	},
	response: False
}