Trendsic Platform Service

<back to all web services

VisitWeekRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/visits/week
<?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 CrewWeekCell implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Date=null,
        /** @var int */
        public int $VisitCount=0,
        /** @var int */
        public int $LoadPct=0
    ) {
    }

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

class CrewWeekRow implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CrewID=0,
        /** @var string|null */
        public ?string $CrewName=null,
        /** @var string|null */
        public ?string $CrewColor=null,
        /** @var array<CrewWeekCell>|null */
        public ?array $Cells=null
    ) {
    }

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

class VisitWeekResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $From=null,
        /** @var string|null */
        public ?string $To=null,
        /** @var array<string>|null */
        public ?array $Days=null,
        /** @var array<CrewWeekRow>|null */
        public ?array $Rows=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class VisitWeekRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $From=null,
        /** @var int */
        public int $Days=0
    ) {
    }

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

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

GET /v1/visits/week HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<VisitWeekResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Days xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </Days>
  <From>String</From>
  <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>
  <Rows>
    <CrewWeekRow>
      <Cells>
        <CrewWeekCell>
          <Date>String</Date>
          <LoadPct>0</LoadPct>
          <VisitCount>0</VisitCount>
        </CrewWeekCell>
      </Cells>
      <CrewColor>String</CrewColor>
      <CrewID>0</CrewID>
      <CrewName>String</CrewName>
    </CrewWeekRow>
  </Rows>
  <To>String</To>
</VisitWeekResponse>