| 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;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"BranchName":"String","Resolved":false,"AlertHeadline":"String","Days":[{"Date":"String","DayLabel":"String","ShortForecast":"String","TempHi":0,"TempLo":0,"TempUnit":"String","Pop":0,"Severity":"String","HasAlert":false}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}