InteleServiceStack

<back to all web services

RestSmsRequest

<?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};


// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsMessageResp implements JsonSerializable
{
    public function __construct(
        /** @description Result of sending message. 0 if success. See documentation for full list of codes */
        // @DataMember(Name="StatusCode")
        // @ApiMember(DataType="integer", Description="Result of sending message. 0 if success. See documentation for full list of codes", IsRequired=true, Name="StatusCode", ParameterType="form")
        /** @var int */
        public int $StatusCode=0,

        /** @description Describes the result of sending Sms text message */
        // @DataMember(Name="StatusDescription")
        // @ApiMember(DataType="string", Description="Describes the result of sending Sms text message", IsRequired=true, Name="StatusDescription", ParameterType="form")
        /** @var string */
        public string $StatusDescription='',

        /** @description Your unique message id from send request message item. Will be empty if you did not provide any id in the request item. */
        // @DataMember(Name="MessageId")
        // @ApiMember(DataType="string", Description="Your unique message id from send request message item. Will be empty if you did not provide any id in the request item.", Name="MessageId", ParameterType="form")
        /** @var string|null */
        public ?string $MessageId=null,

        /** @description Unique transaction id from server */
        // @DataMember(Name="TransactionId")
        // @ApiMember(DataType="string", Description="Unique transaction id from server", IsRequired=true, Name="TransactionId", ParameterType="form")
        /** @var string */
        public string $TransactionId='',

        /** @description Key/Value attributes returned from server. E.g. subnumref and the server name that processed the message. Eg. subnumref=19331234567891,server=smsgw1 */
        // @DataMember(Name="ExtraInfo")
        // @ApiMember(DataType="string", Description="Key/Value attributes returned from server. E.g. subnumref and the server name that processed the message. Eg. subnumref=19331234567891,server=smsgw1", Name="ExtraInfo", ParameterType="form")
        /** @var array<string,string>|null */
        public ?array $ExtraInfo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
        if (isset($o['StatusDescription'])) $this->StatusDescription = $o['StatusDescription'];
        if (isset($o['MessageId'])) $this->MessageId = $o['MessageId'];
        if (isset($o['TransactionId'])) $this->TransactionId = $o['TransactionId'];
        if (isset($o['ExtraInfo'])) $this->ExtraInfo = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['ExtraInfo']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
        if (isset($this->StatusDescription)) $o['StatusDescription'] = $this->StatusDescription;
        if (isset($this->MessageId)) $o['MessageId'] = $this->MessageId;
        if (isset($this->TransactionId)) $o['TransactionId'] = $this->TransactionId;
        if (isset($this->ExtraInfo)) $o['ExtraInfo'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->ExtraInfo);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsResponse implements JsonSerializable
{
    public function __construct(
        /** @description Overall status of processing the request. Each message will have it's own status. This value indicates if any other error occured or not */
        // @DataMember(Name="ProcessResult")
        // @ApiMember(DataType="boolean", Description="Overall status of processing the request. Each message will have it's own status. This value indicates if any other error occured or not", IsRequired=true, Name="ProcessResult", ParameterType="form")
        /** @var bool|null */
        public ?bool $ProcessResult=null,

        /** @description Description of any error occured, if ProcessResult equals false */
        // @DataMember(Name="ProcessResultDescription")
        // @ApiMember(DataType="string", Description="Description of any error occured, if ProcessResult equals false", Name="ProcessResultDescription", ParameterType="form")
        // @StringLength(2048)
        /** @var string|null */
        public ?string $ProcessResultDescription=null,

        /** @description Collection of messages sent or failed */
        // @DataMember(Name="Messages")
        // @ApiMember(Description="Collection of messages sent or failed", Name="Description", ParameterType="form")
        /** @var RestSmsMessageResp[] */
        public array $Messages=[]
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProcessResult'])) $this->ProcessResult = $o['ProcessResult'];
        if (isset($o['ProcessResultDescription'])) $this->ProcessResultDescription = $o['ProcessResultDescription'];
        if (isset($o['Messages'])) $this->Messages = JsonConverters::fromArray('RestSmsMessageResp', $o['Messages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProcessResult)) $o['ProcessResult'] = $this->ProcessResult;
        if (isset($this->ProcessResultDescription)) $o['ProcessResultDescription'] = $this->ProcessResultDescription;
        if (isset($this->Messages)) $o['Messages'] = JsonConverters::toArray('RestSmsMessageResp', $this->Messages);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsMessageReq implements JsonSerializable
{
    public function __construct(
        /** @description Gateway number. Default 99700999 for cross country delivery, non premium messages */
        // @DataMember(Name="Gateway")
        // @ApiMember(DataType="integer", Description="Gateway number. Default 99700999 for cross country delivery, non premium messages", IsRequired=true, Name="Gateway", ParameterType="form")
        /** @var Object|null */
        public ?Object $Gateway=null,

        /** @description Originator address. Defaults to gateway number if not set. Maximum 11 chars if using alphanumeric value. See documentation for full details. */
        // @DataMember(Name="OriginatorAddress")
        // @ApiMember(DataType="string", Description="Originator address. Defaults to gateway number if not set. Maximum 11 chars if using alphanumeric value. See documentation for full details.", Name="OriginatorAddress", ParameterType="form")
        /** @var Object|null */
        public ?Object $OriginatorAddress=null,

        /** @description Destination address.The recipient of the message. Must be a valid MSISDN */
        // @DataMember(Name="DestinationAddress")
        // @ApiMember(DataType="integer", Description="Destination address.The recipient of the message. Must be a valid MSISDN", IsRequired=true, Name="DestinationAddress", ParameterType="form")
        /** @var Object|null */
        public ?Object $DestinationAddress=null,

        /** @description Price to bill recipient. Premium messaging. Leave value to 0 if not using premium. Premium is only available on short number gateway number for each country available in documentation */
        // @DataMember(Name="Price")
        // @ApiMember(DataType="integer", Description="Price to bill recipient. Premium messaging. Leave value to 0 if not using premium. Premium is only available on short number gateway number for each country available in documentation", IsRequired=true, Name="Price", ParameterType="form")
        /** @var Object|null */
        public ?Object $Price=null,

        /** @description Message type according to documentation. Defaults to 00 if not set. If text length is above 160 chars, it defaults to value 11 */
        // @DataMember(Name="MessageType")
        // @ApiMember(DataType="string", Description="Message type according to documentation. Defaults to 00 if not set. If text length is above 160 chars, it defaults to value 11", Name="MessageType", ParameterType="form")
        /** @var string|null */
        public ?string $MessageType=null,

        /** @description Delivery expire timestamp (yyyymmddhhmmss) or relative value. See documentation and default value if not defined */
        // @DataMember(Name="ValidationPeriod")
        // @ApiMember(DataType="string", Description="Delivery expire timestamp (yyyymmddhhmmss) or relative value. See documentation and default value if not defined", Name="ValidationPeriod", ParameterType="form")
        /** @var Object|null */
        public ?Object $ValidationPeriod=null,

        /** @description Your unique message id to track delivery status and response from sending process */
        // @DataMember(Name="MessageId")
        // @ApiMember(DataType="string", Description="Your unique message id to track delivery status and response from sending process", Name="MessageId", ParameterType="form")
        /** @var string|null */
        public ?string $MessageId=null,

        /** @description GSM User Data Header (HEX) */
        // @DataMember(Name="UserDataHeader")
        // @ApiMember(DataType="string", Description="GSM User Data Header (HEX)", Name="UserDataHeader", ParameterType="form")
        /** @var string|null */
        public ?string $UserDataHeader=null,

        /** @description GSM User Data. Plain text or hex encoded. Depending on the used MessageType */
        // @DataMember(Name="UserData")
        // @ApiMember(DataType="string", Description="GSM User Data. Plain text or hex encoded. Depending on the used MessageType", IsRequired=true, Name="UserData", ParameterType="form")
        /** @var string */
        public string $UserData='',

        /** @description Parameter to categorize messages on payment bill from Intele */
        // @DataMember(Name="Category")
        // @ApiMember(DataType="string", Description="Parameter to categorize messages on payment bill from Intele", Name="Category", ParameterType="form")
        /** @var string|null */
        public ?string $Category=null,

        /** @description Custom key/value attributes for the Sms Text Message. See documentation for further details */
        // @DataMember(Name="CustomData")
        // @ApiMember(DataType="string", Description="Custom key/value attributes for the Sms Text Message. See documentation for further details", Name="CustomData", ParameterType="form")
        /** @var array<string,Object>|null */
        public ?array $CustomData=null,

        /** @description Url where Intele should send delivery report. See documentation for url formatting */
        // @DataMember(Name="DeliveryReportUrl")
        // @ApiMember(DataType="string", Description="Url where Intele should send delivery report. See documentation for url formatting", Name="DeliveryReportUrl", ParameterType="form")
        /** @var string|null */
        public ?string $DeliveryReportUrl=null,

        /** @description For Premium messaging only. See documentation for further details */
        // @DataMember(Name="ServiceCode")
        // @ApiMember(DataType="string", Description="For Premium messaging only. See documentation for further details", Name="ServiceCode", ParameterType="form")
        /** @var string|null */
        public ?string $ServiceCode=null,

        /** @description For Premium messaging only. See documentation for further details */
        // @DataMember(Name="ServiceDescription")
        // @ApiMember(DataType="string", Description="For Premium messaging only. See documentation for further details", Name="ServiceDescription", ParameterType="form")
        /** @var string|null */
        public ?string $ServiceDescription=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Gateway'])) $this->Gateway = JsonConverters::from('Object', $o['Gateway']);
        if (isset($o['OriginatorAddress'])) $this->OriginatorAddress = JsonConverters::from('Object', $o['OriginatorAddress']);
        if (isset($o['DestinationAddress'])) $this->DestinationAddress = JsonConverters::from('Object', $o['DestinationAddress']);
        if (isset($o['Price'])) $this->Price = JsonConverters::from('Object', $o['Price']);
        if (isset($o['MessageType'])) $this->MessageType = $o['MessageType'];
        if (isset($o['ValidationPeriod'])) $this->ValidationPeriod = JsonConverters::from('Object', $o['ValidationPeriod']);
        if (isset($o['MessageId'])) $this->MessageId = $o['MessageId'];
        if (isset($o['UserDataHeader'])) $this->UserDataHeader = $o['UserDataHeader'];
        if (isset($o['UserData'])) $this->UserData = $o['UserData'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['CustomData'])) $this->CustomData = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['CustomData']);
        if (isset($o['DeliveryReportUrl'])) $this->DeliveryReportUrl = $o['DeliveryReportUrl'];
        if (isset($o['ServiceCode'])) $this->ServiceCode = $o['ServiceCode'];
        if (isset($o['ServiceDescription'])) $this->ServiceDescription = $o['ServiceDescription'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Gateway)) $o['Gateway'] = JsonConverters::to('Object', $this->Gateway);
        if (isset($this->OriginatorAddress)) $o['OriginatorAddress'] = JsonConverters::to('Object', $this->OriginatorAddress);
        if (isset($this->DestinationAddress)) $o['DestinationAddress'] = JsonConverters::to('Object', $this->DestinationAddress);
        if (isset($this->Price)) $o['Price'] = JsonConverters::to('Object', $this->Price);
        if (isset($this->MessageType)) $o['MessageType'] = $this->MessageType;
        if (isset($this->ValidationPeriod)) $o['ValidationPeriod'] = JsonConverters::to('Object', $this->ValidationPeriod);
        if (isset($this->MessageId)) $o['MessageId'] = $this->MessageId;
        if (isset($this->UserDataHeader)) $o['UserDataHeader'] = $this->UserDataHeader;
        if (isset($this->UserData)) $o['UserData'] = $this->UserData;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->CustomData)) $o['CustomData'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->CustomData);
        if (isset($this->DeliveryReportUrl)) $o['DeliveryReportUrl'] = $this->DeliveryReportUrl;
        if (isset($this->ServiceCode)) $o['ServiceCode'] = $this->ServiceCode;
        if (isset($this->ServiceDescription)) $o['ServiceDescription'] = $this->ServiceDescription;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsRequest implements JsonSerializable
{
    public function __construct(
        /** @description API Username. Usually your customer id */
        // @DataMember(Name="Username")
        // @ApiMember(DataType="string", Description="API Username. Usually your customer id", IsRequired=true, Name="Username", ParameterType="form")
        // @StringLength(128)
        /** @var Object|null */
        public ?Object $Username=null,

        /** @description API Password */
        // @DataMember(Name="Password")
        // @ApiMember(DataType="string", Description="API Password", IsRequired=true, Name="Password", ParameterType="form")
        // @StringLength(128)
        /** @var string */
        public string $Password='',

        /** @description Collection of messages to send */
        // @DataMember(Name="Messages")
        // @ApiMember(Description="Collection of messages to send", IsRequired=true, Name="Messages", ParameterType="form")
        /** @var RestSmsMessageReq[] */
        public array $Messages=[]
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Username'])) $this->Username = JsonConverters::from('Object', $o['Username']);
        if (isset($o['Password'])) $this->Password = $o['Password'];
        if (isset($o['Messages'])) $this->Messages = JsonConverters::fromArray('RestSmsMessageReq', $o['Messages']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Username)) $o['Username'] = JsonConverters::to('Object', $this->Username);
        if (isset($this->Password)) $o['Password'] = $this->Password;
        if (isset($this->Messages)) $o['Messages'] = JsonConverters::toArray('RestSmsMessageReq', $this->Messages);
        return empty($o) ? new class(){} : $o;
    }
}

PHP RestSmsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsonl/reply/RestSmsRequest HTTP/1.1 
Host: smsgw.intele.no 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Username":{},"Password":"String","Messages":[{"Gateway":{},"OriginatorAddress":{},"DestinationAddress":{},"Price":{},"MessageType":"String","ValidationPeriod":{},"MessageId":"String","UserDataHeader":"String","UserData":"String","Category":"String","CustomData":{"String":{}},"DeliveryReportUrl":"String","ServiceCode":"String","ServiceDescription":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ProcessResult":false,"ProcessResultDescription":"String","Messages":[{"StatusCode":0,"StatusDescription":"String","MessageId":"String","TransactionId":"String","ExtraInfo":{"String":"String"}}]}