Trendsic Platform Service

<back to all web services

SafetyTalkLibUpdateRequest

Requires Authentication
The following routes are available for this service:
PUT,OPTIONS/v1/safety/talks/{SafetyTalkLibraryID}
<?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 SafetyTalkLib implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $SafetyTalkLibraryID=0,
        /** @var string|null */
        public ?string $SafetyTalkLibraryUID=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Category=null,
        /** @var string|null */
        public ?string $Body=null,
        /** @var string|null */
        public ?string $MediaUrl=null,
        /** @var int|null */
        public ?int $DurationMinutes=null,
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var int */
        public int $AssignmentCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SafetyTalkLibraryID'])) $this->SafetyTalkLibraryID = $o['SafetyTalkLibraryID'];
        if (isset($o['SafetyTalkLibraryUID'])) $this->SafetyTalkLibraryUID = $o['SafetyTalkLibraryUID'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
        if (isset($o['MediaUrl'])) $this->MediaUrl = $o['MediaUrl'];
        if (isset($o['DurationMinutes'])) $this->DurationMinutes = $o['DurationMinutes'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['AssignmentCount'])) $this->AssignmentCount = $o['AssignmentCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SafetyTalkLibraryID)) $o['SafetyTalkLibraryID'] = $this->SafetyTalkLibraryID;
        if (isset($this->SafetyTalkLibraryUID)) $o['SafetyTalkLibraryUID'] = $this->SafetyTalkLibraryUID;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->Body)) $o['Body'] = $this->Body;
        if (isset($this->MediaUrl)) $o['MediaUrl'] = $this->MediaUrl;
        if (isset($this->DurationMinutes)) $o['DurationMinutes'] = $this->DurationMinutes;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->AssignmentCount)) $o['AssignmentCount'] = $this->AssignmentCount;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class SafetyTalkLibUpdateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $SafetyTalkLibraryID=0,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Category=null,
        /** @var string|null */
        public ?string $Body=null,
        /** @var string|null */
        public ?string $MediaUrl=null,
        /** @var int|null */
        public ?int $DurationMinutes=null,
        /** @var bool|null */
        public ?bool $Active=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SafetyTalkLibraryID'])) $this->SafetyTalkLibraryID = $o['SafetyTalkLibraryID'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
        if (isset($o['MediaUrl'])) $this->MediaUrl = $o['MediaUrl'];
        if (isset($o['DurationMinutes'])) $this->DurationMinutes = $o['DurationMinutes'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SafetyTalkLibraryID)) $o['SafetyTalkLibraryID'] = $this->SafetyTalkLibraryID;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->Body)) $o['Body'] = $this->Body;
        if (isset($this->MediaUrl)) $o['MediaUrl'] = $this->MediaUrl;
        if (isset($this->DurationMinutes)) $o['DurationMinutes'] = $this->DurationMinutes;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        return empty($o) ? new class(){} : $o;
    }
}

PHP SafetyTalkLibUpdateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /v1/safety/talks/{SafetyTalkLibraryID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"SafetyTalkLibraryID":0,"Title":"String","Kind":"String","Category":"String","Body":"String","MediaUrl":"String","DurationMinutes":0,"Active":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Talks":[{"SafetyTalkLibraryID":0,"SafetyTalkLibraryUID":"String","Title":"String","Kind":"String","Category":"String","Body":"String","MediaUrl":"String","DurationMinutes":0,"Active":false,"AssignmentCount":0}]}