Trendsic Platform Service

<back to all web services

LinesRequest

Requires Authentication
Required roles:Administrator, Administrator, Administrator
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/Lines/{Id}
GET,POST,PUT,DELETE,OPTIONS/v1/LinesByLocationId/{LocationId}
GET,POST,PUT,DELETE,OPTIONS/v1/Lines
<?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 LineImage implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ImageId=null,
        /** @var string|null */
        public ?string $FileName=null,
        /** @var string|null */
        public ?string $ImageTitle=null,
        /** @var DateTime */
        public DateTime $UploadDate=new DateTime()
    ) {
    }

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

class Line implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string */
        public string $LocationId='',
        /** @var string|null */
        public ?string $LocationName=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var int */
        public int $ServiceDurationMinutes=0,
        /** @var int */
        public int $WaitTime=0,
        /** @var float */
        public float $Cost=0.0,
        /** @var int|null */
        public ?int $UpperThreshold=null,
        /** @var int|null */
        public ?int $LowerThreshold=null,
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var DateTime|null */
        public ?DateTime $EntDate=null,
        /** @var DateTime|null */
        public ?DateTime $ModDate=null,
        /** @var bool|null */
        public ?bool $SendQuestionnaire=null,
        /** @var bool|null */
        public ?bool $RequireUpload=null,
        /** @var string|null */
        public ?string $UploadMessage=null,
        /** @var array<LineImage>|null */
        public ?array $LineImages=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['LocationId'])) $this->LocationId = $o['LocationId'];
        if (isset($o['LocationName'])) $this->LocationName = $o['LocationName'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ServiceDurationMinutes'])) $this->ServiceDurationMinutes = $o['ServiceDurationMinutes'];
        if (isset($o['WaitTime'])) $this->WaitTime = $o['WaitTime'];
        if (isset($o['Cost'])) $this->Cost = $o['Cost'];
        if (isset($o['UpperThreshold'])) $this->UpperThreshold = $o['UpperThreshold'];
        if (isset($o['LowerThreshold'])) $this->LowerThreshold = $o['LowerThreshold'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['EntDate'])) $this->EntDate = JsonConverters::from('DateTime', $o['EntDate']);
        if (isset($o['ModDate'])) $this->ModDate = JsonConverters::from('DateTime', $o['ModDate']);
        if (isset($o['SendQuestionnaire'])) $this->SendQuestionnaire = $o['SendQuestionnaire'];
        if (isset($o['RequireUpload'])) $this->RequireUpload = $o['RequireUpload'];
        if (isset($o['UploadMessage'])) $this->UploadMessage = $o['UploadMessage'];
        if (isset($o['LineImages'])) $this->LineImages = JsonConverters::fromArray('LineImage', $o['LineImages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->LocationId)) $o['LocationId'] = $this->LocationId;
        if (isset($this->LocationName)) $o['LocationName'] = $this->LocationName;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ServiceDurationMinutes)) $o['ServiceDurationMinutes'] = $this->ServiceDurationMinutes;
        if (isset($this->WaitTime)) $o['WaitTime'] = $this->WaitTime;
        if (isset($this->Cost)) $o['Cost'] = $this->Cost;
        if (isset($this->UpperThreshold)) $o['UpperThreshold'] = $this->UpperThreshold;
        if (isset($this->LowerThreshold)) $o['LowerThreshold'] = $this->LowerThreshold;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->EntDate)) $o['EntDate'] = JsonConverters::to('DateTime', $this->EntDate);
        if (isset($this->ModDate)) $o['ModDate'] = JsonConverters::to('DateTime', $this->ModDate);
        if (isset($this->SendQuestionnaire)) $o['SendQuestionnaire'] = $this->SendQuestionnaire;
        if (isset($this->RequireUpload)) $o['RequireUpload'] = $this->RequireUpload;
        if (isset($this->UploadMessage)) $o['UploadMessage'] = $this->UploadMessage;
        if (isset($this->LineImages)) $o['LineImages'] = JsonConverters::toArray('LineImage', $this->LineImages);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class LinesRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string */
        public string $LocationId='',
        /** @var array<Line>|null */
        public ?array $Lines=null
    ) {
    }

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

PHP LinesRequest 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.

POST /v1/Lines/{Id} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Id":"00000000000000000000000000000000","LocationId":"00000000000000000000000000000000","Lines":[{"Id":"00000000000000000000000000000000","LocationId":"00000000000000000000000000000000","LocationName":"String","Name":"String","Description":"String","ServiceDurationMinutes":0,"WaitTime":0,"Cost":0,"UpperThreshold":0,"LowerThreshold":0,"Active":false,"EntDate":"0001-01-01T00:00:00.0000000","ModDate":"0001-01-01T00:00:00.0000000","SendQuestionnaire":false,"RequireUpload":false,"UploadMessage":"String","LineImages":[{"ImageId":"00000000000000000000000000000000","FileName":"String","ImageTitle":"String","UploadDate":"0001-01-01T00:00:00.0000000"}]}]}
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"}},"Lines":[{"Id":"00000000000000000000000000000000","LocationId":"00000000000000000000000000000000","LocationName":"String","Name":"String","Description":"String","ServiceDurationMinutes":0,"WaitTime":0,"Cost":0,"UpperThreshold":0,"LowerThreshold":0,"Active":false,"EntDate":"0001-01-01T00:00:00.0000000","ModDate":"0001-01-01T00:00:00.0000000","SendQuestionnaire":false,"RequireUpload":false,"UploadMessage":"String","LineImages":[{"ImageId":"00000000000000000000000000000000","FileName":"String","ImageTitle":"String","UploadDate":"0001-01-01T00:00:00.0000000"}]}]}