| POST,OPTIONS | /v1/safety/toolbox/{ToolboxTalkID}/ack |
|---|
<?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 ToolboxAckRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ToolboxTalkID=0,
/** @var int|null */
public ?int $ContactID=null,
/** @var string|null */
public ?string $CrewName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ToolboxTalkID'])) $this->ToolboxTalkID = $o['ToolboxTalkID'];
if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ToolboxTalkID)) $o['ToolboxTalkID'] = $this->ToolboxTalkID;
if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/safety/toolbox/{ToolboxTalkID}/ack HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ToolboxTalkID: 0,
ContactID: 0,
CrewName: 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
}
},
Talk:
{
ToolboxTalkID: 0,
Topic: String,
Presenter: String,
AckCount: 0,
CrewTotal: 0,
Roster:
[
{
ContactID: 0,
ContactName: String,
HasAcked: False
}
]
}
}