Trendsic Platform Service

<back to all web services

ToolboxTalkCreateRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/safety/toolbox
<?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 ToolboxRosterMember implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactID=0,
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var bool|null */
        public ?bool $HasAcked=null
    ) {
    }

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

class ToolboxTalkToday implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ToolboxTalkID=0,
        /** @var string|null */
        public ?string $Topic=null,
        /** @var string|null */
        public ?string $Presenter=null,
        /** @var int */
        public int $AckCount=0,
        /** @var int */
        public int $CrewTotal=0,
        /** @var array<ToolboxRosterMember>|null */
        public ?array $Roster=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ToolboxTalkID'])) $this->ToolboxTalkID = $o['ToolboxTalkID'];
        if (isset($o['Topic'])) $this->Topic = $o['Topic'];
        if (isset($o['Presenter'])) $this->Presenter = $o['Presenter'];
        if (isset($o['AckCount'])) $this->AckCount = $o['AckCount'];
        if (isset($o['CrewTotal'])) $this->CrewTotal = $o['CrewTotal'];
        if (isset($o['Roster'])) $this->Roster = JsonConverters::fromArray('ToolboxRosterMember', $o['Roster']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ToolboxTalkID)) $o['ToolboxTalkID'] = $this->ToolboxTalkID;
        if (isset($this->Topic)) $o['Topic'] = $this->Topic;
        if (isset($this->Presenter)) $o['Presenter'] = $this->Presenter;
        if (isset($this->AckCount)) $o['AckCount'] = $this->AckCount;
        if (isset($this->CrewTotal)) $o['CrewTotal'] = $this->CrewTotal;
        if (isset($this->Roster)) $o['Roster'] = JsonConverters::toArray('ToolboxRosterMember', $this->Roster);
        return empty($o) ? new class(){} : $o;
    }
}

class ToolboxTalkTodayResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var ToolboxTalkToday|null */
        public ?ToolboxTalkToday $Talk=null
    ) {
    }

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

class ToolboxTalkCreateRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Topic=null,
        /** @var string|null */
        public ?string $Presenter=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var DateTime|null */
        public ?DateTime $TalkDate=null
    ) {
    }

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

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

{
	Topic: String,
	Presenter: String,
	Notes: String,
	TalkDate: 0001-01-01
}
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
		}
	},
	Talk: 
	{
		ToolboxTalkID: 0,
		Topic: String,
		Presenter: String,
		AckCount: 0,
		CrewTotal: 0,
		Roster: 
		[
			{
				ContactID: 0,
				ContactName: String,
				HasAcked: False
			}
		]
	}
}