Platform API

<back to all web services

GetTimezones

Get a list of timezones

The following routes are available for this service:
All Verbs/api/timezones
<?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 DataListItemModel implements JsonSerializable
{
    public function __construct(
        /** @description Guid of the list item PKID. */
        // @ApiMember(DataType="Guid", Description="Guid of the list item PKID.", IsRequired=true, Name="ListItemId", ParameterType="query")
        /** @var string */
        public string $ListItemId='',

        /** @description Name of the list item. */
        // @ApiMember(DataType="string", Description="Name of the list item.", Name="Name", ParameterType="query")
        /** @var string|null */
        public ?string $Name=null,

        /** @description Short Version Name of the list item. */
        // @ApiMember(DataType="string", Description="Short Version Name of the list item.", Name="ShortName", ParameterType="query")
        /** @var string|null */
        public ?string $ShortName=null,

        /** @description The primary image url */
        // @ApiMember(DataType="string", Description="The primary image url", Name="PrimaryImagePath", ParameterType="query")
        /** @var string|null */
        public ?string $PrimaryImagePath=null,

        /** @description Record Status of the List Item (A=Active, I=Inactive, D=Deleted). */
        // @ApiMember(DataType="string", Description="Record Status of the List Item (A=Active, I=Inactive, D=Deleted).", Name="RecordStatus", ParameterType="query")
        /** @var string|null */
        public ?string $RecordStatus=null,

        /** @description The order (if any) of this item in the list. */
        // @ApiMember(DataType="int", Description="The order (if any) of this item in the list.", Name="Order", ParameterType="query")
        /** @var int */
        public int $Order=0,

        /** @description The owner of this item. */
        // @ApiMember(DataType="Guid", Description="The owner of this item.", Name="OwnerContactId", ParameterType="query")
        /** @var string */
        public string $OwnerContactId='',

        /** @var array<Object>|null */
        public ?array $ExtraValues=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ListItemId'])) $this->ListItemId = $o['ListItemId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['ShortName'])) $this->ShortName = $o['ShortName'];
        if (isset($o['PrimaryImagePath'])) $this->PrimaryImagePath = $o['PrimaryImagePath'];
        if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
        if (isset($o['Order'])) $this->Order = $o['Order'];
        if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
        if (isset($o['ExtraValues'])) $this->ExtraValues = JsonConverters::fromArray('Object', $o['ExtraValues']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ListItemId)) $o['ListItemId'] = $this->ListItemId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->ShortName)) $o['ShortName'] = $this->ShortName;
        if (isset($this->PrimaryImagePath)) $o['PrimaryImagePath'] = $this->PrimaryImagePath;
        if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
        if (isset($this->Order)) $o['Order'] = $this->Order;
        if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
        if (isset($this->ExtraValues)) $o['ExtraValues'] = JsonConverters::toArray('Object', $this->ExtraValues);
        return empty($o) ? new class(){} : $o;
    }
}

class DataListModel implements JsonSerializable
{
    public function __construct(
        /** @description Guid of the List PKID. */
        // @ApiMember(DataType="Guid", Description="Guid of the List PKID.", IsRequired=true, Name="ListId", ParameterType="query")
        /** @var string */
        public string $ListId='',

        /** @description Name of the list. */
        // @ApiMember(DataType="String", Description="Name of the list.", Name="Name", ParameterType="query")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The owner of this item. */
        // @ApiMember(DataType="Guid", Description="The owner of this item.", Name="OwnerContactId", ParameterType="query")
        /** @var string */
        public string $OwnerContactId='',

        /** @description List Items in the list. */
        // @ApiMember(DataType="List<DataListItemModel>", Description="List Items in the list.", Name="ListItems", ParameterType="query")
        /** @var array<DataListItemModel>|null */
        public ?array $DataListItems=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ListId'])) $this->ListId = $o['ListId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
        if (isset($o['DataListItems'])) $this->DataListItems = JsonConverters::fromArray('DataListItemModel', $o['DataListItems']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ListId)) $o['ListId'] = $this->ListId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
        if (isset($this->DataListItems)) $o['DataListItems'] = JsonConverters::toArray('DataListItemModel', $this->DataListItems);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="List of timezones matching the criteria")
class GetTimezonesResponse implements JsonSerializable
{
    public function __construct(
        /** @var DataListModel|null */
        public ?DataListModel $Timezones=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

/** @description Get a list of timezones */
// @Api(Description="Get a list of timezones")
class GetTimezones implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetTimezones DTOs

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

HTTP + CSV

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

POST /api/timezones HTTP/1.1 
Host: pfapi.pstpf.com.au 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Timezones":{"ListId":"00000000-0000-0000-0000-000000000000","Name":"String","OwnerContactId":"00000000-0000-0000-0000-000000000000","DataListItems":[{"ListItemId":"00000000-0000-0000-0000-000000000000","Name":"String","ShortName":"String","PrimaryImagePath":"String","RecordStatus":"String","Order":0,"OwnerContactId":"00000000-0000-0000-0000-000000000000","ExtraValues":[{}]}]},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}