InteleServiceStack

<back to all web services

RestSmsRequest

import 'package:servicestack/servicestack.dart';

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsMessageResp implements IConvertible
{
    /**
    * 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")
    int? StatusCode;

    /**
    * 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")
    String? StatusDescription;

    /**
    * 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")
    String? MessageId;

    /**
    * Unique transaction id from server
    */
    // @DataMember(Name="TransactionId")
    // @ApiMember(DataType="string", Description="Unique transaction id from server", IsRequired=true, Name="TransactionId", ParameterType="form")
    String? TransactionId;

    /**
    * 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")
    Map<String,String?>? ExtraInfo;

    RestSmsMessageResp({this.StatusCode,this.StatusDescription,this.MessageId,this.TransactionId,this.ExtraInfo});
    RestSmsMessageResp.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        StatusCode = json['statusCode'];
        StatusDescription = json['statusDescription'];
        MessageId = json['messageId'];
        TransactionId = json['transactionId'];
        ExtraInfo = JsonConverters.toStringMap(json['extraInfo']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'statusCode': StatusCode,
        'statusDescription': StatusDescription,
        'messageId': MessageId,
        'transactionId': TransactionId,
        'extraInfo': ExtraInfo
    };

    getTypeName() => "RestSmsMessageResp";
    TypeContext? context = _ctx;
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsResponse implements IConvertible
{
    /**
    * 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")
    bool? ProcessResult;

    /**
    * 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)
    String? ProcessResultDescription;

    /**
    * Collection of messages sent or failed
    */
    // @DataMember(Name="Messages")
    // @ApiMember(Description="Collection of messages sent or failed", Name="Description", ParameterType="form")
    List<RestSmsMessageResp>? Messages = [];

    RestSmsResponse({this.ProcessResult,this.ProcessResultDescription,this.Messages});
    RestSmsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ProcessResult = json['processResult'];
        ProcessResultDescription = json['processResultDescription'];
        Messages = JsonConverters.fromJson(json['messages'],'List<RestSmsMessageResp>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'processResult': ProcessResult,
        'processResultDescription': ProcessResultDescription,
        'messages': JsonConverters.toJson(Messages,'List<RestSmsMessageResp>',context!)
    };

    getTypeName() => "RestSmsResponse";
    TypeContext? context = _ctx;
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsMessageReq implements IConvertible
{
    /**
    * 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")
    dynamic? Gateway;

    /**
    * 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")
    dynamic? OriginatorAddress;

    /**
    * 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")
    dynamic? DestinationAddress;

    /**
    * 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")
    dynamic? Price;

    /**
    * 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")
    String? MessageType;

    /**
    * 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")
    dynamic? ValidationPeriod;

    /**
    * 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")
    String? MessageId;

    /**
    * GSM User Data Header (HEX)
    */
    // @DataMember(Name="UserDataHeader")
    // @ApiMember(DataType="string", Description="GSM User Data Header (HEX)", Name="UserDataHeader", ParameterType="form")
    String? UserDataHeader;

    /**
    * 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")
    String? UserData;

    /**
    * 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")
    String? Category;

    /**
    * 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")
    Map<String,dynamic?>? CustomData;

    /**
    * 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")
    String? DeliveryReportUrl;

    /**
    * 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")
    String? ServiceCode;

    /**
    * 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")
    String? ServiceDescription;

    RestSmsMessageReq({this.Gateway,this.OriginatorAddress,this.DestinationAddress,this.Price,this.MessageType,this.ValidationPeriod,this.MessageId,this.UserDataHeader,this.UserData,this.Category,this.CustomData,this.DeliveryReportUrl,this.ServiceCode,this.ServiceDescription});
    RestSmsMessageReq.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Gateway = JsonConverters.fromJson(json['gateway'],'dynamic',context!);
        OriginatorAddress = JsonConverters.fromJson(json['originatorAddress'],'dynamic',context!);
        DestinationAddress = JsonConverters.fromJson(json['destinationAddress'],'dynamic',context!);
        Price = JsonConverters.fromJson(json['price'],'dynamic',context!);
        MessageType = json['messageType'];
        ValidationPeriod = JsonConverters.fromJson(json['validationPeriod'],'dynamic',context!);
        MessageId = json['messageId'];
        UserDataHeader = json['userDataHeader'];
        UserData = json['userData'];
        Category = json['category'];
        CustomData = JsonConverters.fromJson(json['customData'],'Map<String,dynamic?>',context!);
        DeliveryReportUrl = json['deliveryReportUrl'];
        ServiceCode = json['serviceCode'];
        ServiceDescription = json['serviceDescription'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'gateway': JsonConverters.toJson(Gateway,'dynamic',context!),
        'originatorAddress': JsonConverters.toJson(OriginatorAddress,'dynamic',context!),
        'destinationAddress': JsonConverters.toJson(DestinationAddress,'dynamic',context!),
        'price': JsonConverters.toJson(Price,'dynamic',context!),
        'messageType': MessageType,
        'validationPeriod': JsonConverters.toJson(ValidationPeriod,'dynamic',context!),
        'messageId': MessageId,
        'userDataHeader': UserDataHeader,
        'userData': UserData,
        'category': Category,
        'customData': JsonConverters.toJson(CustomData,'Map<String,dynamic?>',context!),
        'deliveryReportUrl': DeliveryReportUrl,
        'serviceCode': ServiceCode,
        'serviceDescription': ServiceDescription
    };

    getTypeName() => "RestSmsMessageReq";
    TypeContext? context = _ctx;
}

// @DataContract(Namespace="http://schemas.datacontract.org/2004/07/PushSmsLib.Dto")
class RestSmsRequest implements IConvertible
{
    /**
    * 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)
    dynamic? Username;

    /**
    * API Password
    */
    // @DataMember(Name="Password")
    // @ApiMember(DataType="string", Description="API Password", IsRequired=true, Name="Password", ParameterType="form")
    // @StringLength(128)
    String? Password;

    /**
    * Collection of messages to send
    */
    // @DataMember(Name="Messages")
    // @ApiMember(Description="Collection of messages to send", IsRequired=true, Name="Messages", ParameterType="form")
    List<RestSmsMessageReq>? Messages = [];

    RestSmsRequest({this.Username,this.Password,this.Messages});
    RestSmsRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Username = JsonConverters.fromJson(json['username'],'dynamic',context!);
        Password = json['password'];
        Messages = JsonConverters.fromJson(json['messages'],'List<RestSmsMessageReq>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'username': JsonConverters.toJson(Username,'dynamic',context!),
        'password': Password,
        'messages': JsonConverters.toJson(Messages,'List<RestSmsMessageReq>',context!)
    };

    getTypeName() => "RestSmsRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'smsgw.intele.no', types: <String, TypeInfo> {
    'RestSmsMessageResp': TypeInfo(TypeOf.Class, create:() => RestSmsMessageResp()),
    'RestSmsResponse': TypeInfo(TypeOf.Class, create:() => RestSmsResponse()),
    'List<RestSmsMessageResp>': TypeInfo(TypeOf.Class, create:() => <RestSmsMessageResp>[]),
    'RestSmsMessageReq': TypeInfo(TypeOf.Class, create:() => RestSmsMessageReq()),
    'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
    'RestSmsRequest': TypeInfo(TypeOf.Class, create:() => RestSmsRequest()),
    'List<RestSmsMessageReq>': TypeInfo(TypeOf.Class, create:() => <RestSmsMessageReq>[]),
});

Dart 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"}}]}