<?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};
// @ApiResponse(Description="Communications Data for synching to Framework")
class GetCommunicationDataResponse implements JsonSerializable
{
public function __construct(
/** @description Bin Row Version of the last update */
// @ApiMember(DataType="byte[]", Description="Bin Row Version of the last update", Name="BinRowVersion")
/** @var ByteArray|null */
public ?ByteArray $BinRowVersion=null,
/** @description Communication Data string (compressed/zipped) */
// @ApiMember(DataType="string", Description="Communication Data string (compressed/zipped)", Name="Communications")
/** @var string|null */
public ?string $Communications=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['BinRowVersion'])) $this->BinRowVersion = JsonConverters::from('ByteArray', $o['BinRowVersion']);
if (isset($o['Communications'])) $this->Communications = $o['Communications'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->BinRowVersion)) $o['BinRowVersion'] = JsonConverters::to('ByteArray', $this->BinRowVersion);
if (isset($this->Communications)) $o['Communications'] = $this->Communications;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Retrieves communications from the Communication database to be saved to Framework */
// @Api(Description="Retrieves communications from the Communication database to be saved to Framework")
class GetCommunicationData implements ISubscription, JsonSerializable
{
public function __construct(
/** @description Bin Row Version of the last update */
// @ApiMember(DataType="byte[]", Description="Bin Row Version of the last update", Name="BinRowVersion")
/** @var ByteArray|null */
public ?ByteArray $BinRowVersion=null,
/** @description Suite Data Source Instance Id to determine which licensees data to retrieve. */
// @ApiMember(DataType="Guid", Description="Suite Data Source Instance Id to determine which licensees data to retrieve.", Name="SuiteDataSourceInstanceId")
/** @var string */
public string $SuiteDataSourceInstanceId='',
/** @description Batch Call Number. */
// @ApiMember(DataType="int", Description="Batch Call Number.", Name="BatchNumber")
/** @var int */
public int $BatchNumber=0,
/** @description Number of records to retrieve per call. */
// @ApiMember(DataType="int", Description="Number of records to retrieve per call.", Name="BatchSize")
/** @var int */
public int $BatchSize=0,
/** @var bool|null */
public ?bool $IgnoreValidation=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['BinRowVersion'])) $this->BinRowVersion = JsonConverters::from('ByteArray', $o['BinRowVersion']);
if (isset($o['SuiteDataSourceInstanceId'])) $this->SuiteDataSourceInstanceId = $o['SuiteDataSourceInstanceId'];
if (isset($o['BatchNumber'])) $this->BatchNumber = $o['BatchNumber'];
if (isset($o['BatchSize'])) $this->BatchSize = $o['BatchSize'];
if (isset($o['IgnoreValidation'])) $this->IgnoreValidation = $o['IgnoreValidation'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->BinRowVersion)) $o['BinRowVersion'] = JsonConverters::to('ByteArray', $this->BinRowVersion);
if (isset($this->SuiteDataSourceInstanceId)) $o['SuiteDataSourceInstanceId'] = $this->SuiteDataSourceInstanceId;
if (isset($this->BatchNumber)) $o['BatchNumber'] = $this->BatchNumber;
if (isset($this->BatchSize)) $o['BatchSize'] = $this->BatchSize;
if (isset($this->IgnoreValidation)) $o['IgnoreValidation'] = $this->IgnoreValidation;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /json/reply/GetCommunicationData HTTP/1.1
Host: gatewayframeworkapi.pstpf.com.au
Accept: application/json
Content-Type: application/json
Content-Length: length
{"BinRowVersion":"AA==","BatchNumber":0,"BatchSize":0,"IgnoreValidation":true}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"BinRowVersion":"AA==","Communications":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}