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 .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 /v1/Lines/{Id} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<LinesRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Id>00000000-0000-0000-0000-000000000000</Id>
  <Lines>
    <Line>
      <Active>false</Active>
      <Cost>0</Cost>
      <Description>String</Description>
      <EntDate>0001-01-01T00:00:00</EntDate>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <LineImages>
        <LineImage>
          <FileName>String</FileName>
          <ImageId>00000000-0000-0000-0000-000000000000</ImageId>
          <ImageTitle>String</ImageTitle>
          <UploadDate>0001-01-01T00:00:00</UploadDate>
        </LineImage>
      </LineImages>
      <LocationId>00000000-0000-0000-0000-000000000000</LocationId>
      <LocationName>String</LocationName>
      <LowerThreshold>0</LowerThreshold>
      <ModDate>0001-01-01T00:00:00</ModDate>
      <Name>String</Name>
      <RequireUpload>false</RequireUpload>
      <SendQuestionnaire>false</SendQuestionnaire>
      <ServiceDurationMinutes>0</ServiceDurationMinutes>
      <UploadMessage>String</UploadMessage>
      <UpperThreshold>0</UpperThreshold>
      <WaitTime>0</WaitTime>
    </Line>
  </Lines>
  <LocationId>00000000-0000-0000-0000-000000000000</LocationId>
</LinesRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<LinesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Lines>
    <Line>
      <Active>false</Active>
      <Cost>0</Cost>
      <Description>String</Description>
      <EntDate>0001-01-01T00:00:00</EntDate>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <LineImages>
        <LineImage>
          <FileName>String</FileName>
          <ImageId>00000000-0000-0000-0000-000000000000</ImageId>
          <ImageTitle>String</ImageTitle>
          <UploadDate>0001-01-01T00:00:00</UploadDate>
        </LineImage>
      </LineImages>
      <LocationId>00000000-0000-0000-0000-000000000000</LocationId>
      <LocationName>String</LocationName>
      <LowerThreshold>0</LowerThreshold>
      <ModDate>0001-01-01T00:00:00</ModDate>
      <Name>String</Name>
      <RequireUpload>false</RequireUpload>
      <SendQuestionnaire>false</SendQuestionnaire>
      <ServiceDurationMinutes>0</ServiceDurationMinutes>
      <UploadMessage>String</UploadMessage>
      <UpperThreshold>0</UpperThreshold>
      <WaitTime>0</WaitTime>
    </Line>
  </Lines>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</LinesResponse>