<?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};
enum GatewayResponseStatus : string
{
case Initiated = 'Initiated';
case Successful = 'Successful';
case JobError = 'JobError';
}
class GatewayTaskResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ReferenceId='',
/** @var GatewayResponseStatus|null */
public ?GatewayResponseStatus $GatewayTaskResponseStatus=null,
/** @var string|null */
public ?string $Payload=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ReferenceId'])) $this->ReferenceId = $o['ReferenceId'];
if (isset($o['GatewayTaskResponseStatus'])) $this->GatewayTaskResponseStatus = JsonConverters::from('GatewayResponseStatus', $o['GatewayTaskResponseStatus']);
if (isset($o['Payload'])) $this->Payload = $o['Payload'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ReferenceId)) $o['ReferenceId'] = $this->ReferenceId;
if (isset($this->GatewayTaskResponseStatus)) $o['GatewayTaskResponseStatus'] = JsonConverters::to('GatewayResponseStatus', $this->GatewayTaskResponseStatus);
if (isset($this->Payload)) $o['Payload'] = $this->Payload;
return empty($o) ? new class(){} : $o;
}
}
class BaseQueueMessage implements JsonSerializable
{
public function __construct(
/** @var string */
public string $LicenseeId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['LicenseeId'])) $this->LicenseeId = $o['LicenseeId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->LicenseeId)) $o['LicenseeId'] = $this->LicenseeId;
return empty($o) ? new class(){} : $o;
}
}
class GatewayTask extends BaseQueueMessage implements JsonSerializable
{
/**
* @param string $LicenseeId
*/
public function __construct(
string $LicenseeId='',
/** @var string */
public string $ReferenceId='',
/** @var string */
public string $JobTypeId='',
/** @var bool|null */
public ?bool $IsBeingProcessed=null,
/** @var string|null */
public ?string $Payload=null,
/** @var bool|null */
public ?bool $ContentStoredExternally=null,
/** @var bool|null */
public ?bool $ResendRequest=null
) {
parent::__construct($LicenseeId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ReferenceId'])) $this->ReferenceId = $o['ReferenceId'];
if (isset($o['JobTypeId'])) $this->JobTypeId = $o['JobTypeId'];
if (isset($o['IsBeingProcessed'])) $this->IsBeingProcessed = $o['IsBeingProcessed'];
if (isset($o['Payload'])) $this->Payload = $o['Payload'];
if (isset($o['ContentStoredExternally'])) $this->ContentStoredExternally = $o['ContentStoredExternally'];
if (isset($o['ResendRequest'])) $this->ResendRequest = $o['ResendRequest'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ReferenceId)) $o['ReferenceId'] = $this->ReferenceId;
if (isset($this->JobTypeId)) $o['JobTypeId'] = $this->JobTypeId;
if (isset($this->IsBeingProcessed)) $o['IsBeingProcessed'] = $this->IsBeingProcessed;
if (isset($this->Payload)) $o['Payload'] = $this->Payload;
if (isset($this->ContentStoredExternally)) $o['ContentStoredExternally'] = $this->ContentStoredExternally;
if (isset($this->ResendRequest)) $o['ResendRequest'] = $this->ResendRequest;
return empty($o) ? new class(){} : $o;
}
}
class SendTask implements JsonSerializable
{
public function __construct(
/** @var GatewayTask|null */
public ?GatewayTask $GatewayTask=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['GatewayTask'])) $this->GatewayTask = JsonConverters::from('GatewayTask', $o['GatewayTask']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->GatewayTask)) $o['GatewayTask'] = JsonConverters::to('GatewayTask', $this->GatewayTask);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsonl/reply/SendTask HTTP/1.1
Host: production-eros-gateway-api-sms-wa.azurewebsites.net
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"GatewayTask":{"ReferenceId":"00000000000000000000000000000000","JobTypeId":"00000000000000000000000000000000","IsBeingProcessed":false,"Payload":"String","ContentStoredExternally":false,"ResendRequest":false,"LicenseeId":"00000000000000000000000000000000"}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"ReferenceId":"00000000000000000000000000000000","GatewayTaskResponseStatus":"Initiated","Payload":"String"}