Go-to-Light Service 4.0.0.2397 - 121 - API License to Cloud Demo

<back to all web services

DefineAreas

Requires Authentication
The following routes are available for this service:
All Verbs/DefineAreas/{Areas}
<?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 AreaContent implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ID=0,
        /** @var string */
        public string $LCAddress='',
        /** @var int */
        public int $PixelStart=0,
        /** @var int */
        public int $PixelStop=0,
        /** @var int */
        public int $AreaID=0,
        /** @var int */
        public int $Pos=0,
        /** @var bool|null */
        public ?bool $Reverse=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['LCAddress'])) $this->LCAddress = $o['LCAddress'];
        if (isset($o['PixelStart'])) $this->PixelStart = $o['PixelStart'];
        if (isset($o['PixelStop'])) $this->PixelStop = $o['PixelStop'];
        if (isset($o['AreaID'])) $this->AreaID = $o['AreaID'];
        if (isset($o['Pos'])) $this->Pos = $o['Pos'];
        if (isset($o['Reverse'])) $this->Reverse = $o['Reverse'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->LCAddress)) $o['LCAddress'] = $this->LCAddress;
        if (isset($this->PixelStart)) $o['PixelStart'] = $this->PixelStart;
        if (isset($this->PixelStop)) $o['PixelStop'] = $this->PixelStop;
        if (isset($this->AreaID)) $o['AreaID'] = $this->AreaID;
        if (isset($this->Pos)) $o['Pos'] = $this->Pos;
        if (isset($this->Reverse)) $o['Reverse'] = $this->Reverse;
        return empty($o) ? new class(){} : $o;
    }
}

class Area implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AreaID=0,
        /** @var string */
        public string $Label='',
        /** @var int|null */
        public ?int $StockroomID=null,
        /** @var array<AreaContent>|null */
        public ?array $Content=null,
        /** @var int */
        public int $NumberOfPixels=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AreaID'])) $this->AreaID = $o['AreaID'];
        if (isset($o['Label'])) $this->Label = $o['Label'];
        if (isset($o['StockroomID'])) $this->StockroomID = $o['StockroomID'];
        if (isset($o['Content'])) $this->Content = JsonConverters::fromArray('AreaContent', $o['Content']);
        if (isset($o['NumberOfPixels'])) $this->NumberOfPixels = $o['NumberOfPixels'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AreaID)) $o['AreaID'] = $this->AreaID;
        if (isset($this->Label)) $o['Label'] = $this->Label;
        if (isset($this->StockroomID)) $o['StockroomID'] = $this->StockroomID;
        if (isset($this->Content)) $o['Content'] = JsonConverters::toArray('AreaContent', $this->Content);
        if (isset($this->NumberOfPixels)) $o['NumberOfPixels'] = $this->NumberOfPixels;
        return empty($o) ? new class(){} : $o;
    }
}

class DefineAreas implements JsonSerializable
{
    public function __construct(
        /** @description Areas */
        // @ApiMember(Description="Areas", IsRequired=true)
        /** @var Area[] */
        public array $Areas=[]
    ) {
    }

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

PHP DefineAreas DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /DefineAreas/{Areas} HTTP/1.1 
Host: clouddemo.pickeos.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Areas":[{"AreaID":0,"Label":"String","StockroomID":0,"Content":[{"ID":0,"LCAddress":"String","PixelStart":0,"PixelStop":0,"AreaID":0,"Pos":0,"Reverse":false}],"NumberOfPixels":1}]}