Trendsic Platform Service

<back to all web services

BranchWeatherRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/weather/branch
<?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 WeatherDay implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Date=null,
        /** @var string|null */
        public ?string $DayLabel=null,
        /** @var string|null */
        public ?string $ShortForecast=null,
        /** @var int|null */
        public ?int $TempHi=null,
        /** @var int|null */
        public ?int $TempLo=null,
        /** @var string|null */
        public ?string $TempUnit=null,
        /** @var int|null */
        public ?int $Pop=null,
        /** @var string|null */
        public ?string $Severity=null,
        /** @var bool|null */
        public ?bool $HasAlert=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Date'])) $this->Date = $o['Date'];
        if (isset($o['DayLabel'])) $this->DayLabel = $o['DayLabel'];
        if (isset($o['ShortForecast'])) $this->ShortForecast = $o['ShortForecast'];
        if (isset($o['TempHi'])) $this->TempHi = $o['TempHi'];
        if (isset($o['TempLo'])) $this->TempLo = $o['TempLo'];
        if (isset($o['TempUnit'])) $this->TempUnit = $o['TempUnit'];
        if (isset($o['Pop'])) $this->Pop = $o['Pop'];
        if (isset($o['Severity'])) $this->Severity = $o['Severity'];
        if (isset($o['HasAlert'])) $this->HasAlert = $o['HasAlert'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Date)) $o['Date'] = $this->Date;
        if (isset($this->DayLabel)) $o['DayLabel'] = $this->DayLabel;
        if (isset($this->ShortForecast)) $o['ShortForecast'] = $this->ShortForecast;
        if (isset($this->TempHi)) $o['TempHi'] = $this->TempHi;
        if (isset($this->TempLo)) $o['TempLo'] = $this->TempLo;
        if (isset($this->TempUnit)) $o['TempUnit'] = $this->TempUnit;
        if (isset($this->Pop)) $o['Pop'] = $this->Pop;
        if (isset($this->Severity)) $o['Severity'] = $this->Severity;
        if (isset($this->HasAlert)) $o['HasAlert'] = $this->HasAlert;
        return empty($o) ? new class(){} : $o;
    }
}

class WeatherForecastResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $BranchName=null,
        /** @var bool|null */
        public ?bool $Resolved=null,
        /** @var string|null */
        public ?string $AlertHeadline=null,
        /** @var array<WeatherDay>|null */
        public ?array $Days=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class BranchWeatherRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $BranchId=null,
        /** @var string|null */
        public ?string $Start=null,
        /** @var int|null */
        public ?int $Days=null
    ) {
    }

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

PHP BranchWeatherRequest 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/weather/branch HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<WeatherForecastResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <AlertHeadline>String</AlertHeadline>
  <BranchName>String</BranchName>
  <Days>
    <WeatherDay>
      <Date>String</Date>
      <DayLabel>String</DayLabel>
      <HasAlert>false</HasAlert>
      <Pop>0</Pop>
      <Severity>String</Severity>
      <ShortForecast>String</ShortForecast>
      <TempHi>0</TempHi>
      <TempLo>0</TempLo>
      <TempUnit>String</TempUnit>
    </WeatherDay>
  </Days>
  <Resolved>false</Resolved>
  <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>
</WeatherForecastResponse>