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

<back to all web services

SaveArea

Requires Authentication
The following routes are available for this service:
All Verbs/SaveArea/{Area}
<?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 SaveArea implements JsonSerializable
{
    public function __construct(
        /** @description Area */
        // @ApiMember(Description="Area", IsRequired=true)
        /** @var Area|null */
        public ?Area $Area=null
    ) {
    }

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

PHP SaveArea DTOs

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

HTTP + XML

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

POST /SaveArea/{Area} HTTP/1.1 
Host: clouddemo.pickeos.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<SaveArea xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/GoToLightAPI">
  <Area>
    <AreaID>0</AreaID>
    <Content>
      <AreaContent>
        <AreaID>0</AreaID>
        <ID>0</ID>
        <LCAddress>String</LCAddress>
        <PixelStart>0</PixelStart>
        <PixelStop>0</PixelStop>
        <Pos>0</Pos>
        <Reverse>false</Reverse>
      </AreaContent>
    </Content>
    <Label>String</Label>
    <StockroomID>0</StockroomID>
  </Area>
</SaveArea>