| POST | /api/sendmessage | ||
|---|---|---|---|
| POST | /api/sendmessage/immediate | ||
| POST | /api/send | ||
| POST | /api/sms/send | ||
| POST | /api/send/immediate | ||
| POST | /api/sms/send/immediate |
<?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 CommResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $CommId='',
/** @var string|null */
public ?string $Reference=null,
/** @var bool|null */
public ?bool $Status=null,
/** @var string|null */
public ?string $Message=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CommId'])) $this->CommId = $o['CommId'];
if (isset($o['Reference'])) $this->Reference = $o['Reference'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['Message'])) $this->Message = $o['Message'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CommId)) $o['CommId'] = $this->CommId;
if (isset($this->Reference)) $o['Reference'] = $this->Reference;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->Message)) $o['Message'] = $this->Message;
return empty($o) ? new class(){} : $o;
}
}
class BaseLicenseeEnforcedServiceModel 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 SMSContact implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $PhoneNumber=null,
/** @var string */
public string $ContactId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
return empty($o) ? new class(){} : $o;
}
}
class SMSModel extends BaseLicenseeEnforcedServiceModel implements JsonSerializable
{
/**
* @param string $LicenseeId
*/
public function __construct(
string $LicenseeId='',
/** @var SMSContact|null */
public ?SMSContact $From=null,
/** @var array<SMSContact>|null */
public ?array $To=null,
/** @var string|null */
public ?string $MessageBody=null,
/** @var bool|null */
public ?bool $ReplyIsAllowed=null,
/** @var bool|null */
public ?bool $ReplyIsRequired=null,
/** @var string|null */
public ?string $Notes=null,
/** @var string */
public string $LinkedObjectId='',
/** @var string */
public string $SuiteId=''
) {
parent::__construct($LicenseeId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['From'])) $this->From = JsonConverters::from('SMSContact', $o['From']);
if (isset($o['To'])) $this->To = JsonConverters::fromArray('SMSContact', $o['To']);
if (isset($o['MessageBody'])) $this->MessageBody = $o['MessageBody'];
if (isset($o['ReplyIsAllowed'])) $this->ReplyIsAllowed = $o['ReplyIsAllowed'];
if (isset($o['ReplyIsRequired'])) $this->ReplyIsRequired = $o['ReplyIsRequired'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['LinkedObjectId'])) $this->LinkedObjectId = $o['LinkedObjectId'];
if (isset($o['SuiteId'])) $this->SuiteId = $o['SuiteId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->From)) $o['From'] = JsonConverters::to('SMSContact', $this->From);
if (isset($this->To)) $o['To'] = JsonConverters::toArray('SMSContact', $this->To);
if (isset($this->MessageBody)) $o['MessageBody'] = $this->MessageBody;
if (isset($this->ReplyIsAllowed)) $o['ReplyIsAllowed'] = $this->ReplyIsAllowed;
if (isset($this->ReplyIsRequired)) $o['ReplyIsRequired'] = $this->ReplyIsRequired;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->LinkedObjectId)) $o['LinkedObjectId'] = $this->LinkedObjectId;
if (isset($this->SuiteId)) $o['SuiteId'] = $this->SuiteId;
return empty($o) ? new class(){} : $o;
}
}
/** @description Saves the specified SMS and sends it for background processing */
// @Api(Description="Saves the specified SMS and sends it for background processing")
class SMSSend implements JsonSerializable
{
public function __construct(
/** @var SMSModel|null */
public ?SMSModel $SMSModel=null,
/** @var bool|null */
public ?bool $CreateCommunicationReferencesImmediately=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SMSModel'])) $this->SMSModel = JsonConverters::from('SMSModel', $o['SMSModel']);
if (isset($o['CreateCommunicationReferencesImmediately'])) $this->CreateCommunicationReferencesImmediately = $o['CreateCommunicationReferencesImmediately'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SMSModel)) $o['SMSModel'] = JsonConverters::to('SMSModel', $this->SMSModel);
if (isset($this->CreateCommunicationReferencesImmediately)) $o['CreateCommunicationReferencesImmediately'] = $this->CreateCommunicationReferencesImmediately;
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 /api/sendmessage HTTP/1.1
Host: production-eros-gateway-api-sms-wa.azurewebsites.net
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"SMSModel":{"From":{"Name":"String","PhoneNumber":"String","ContactId":"00000000000000000000000000000000"},"To":[{"Name":"String","PhoneNumber":"String","ContactId":"00000000000000000000000000000000"}],"MessageBody":"String","ReplyIsAllowed":false,"ReplyIsRequired":false,"Notes":"String","LinkedObjectId":"00000000000000000000000000000000","SuiteId":"00000000000000000000000000000000","LicenseeId":"00000000000000000000000000000000"},"CreateCommunicationReferencesImmediately":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"CommId":"00000000000000000000000000000000","Reference":"String","Status":false,"Message":"String"}