InteleServiceStack

<back to all web services

RestSmsRequest

import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RestSmsMessageResp:
    # @ApiMember(DataType="integer", Description="Result of sending message. 0 if success. See documentation for full list of codes", IsRequired=true, Name="StatusCode", ParameterType="form")
    status_code: int = 0
    """
    Result of sending message. 0 if success. See documentation for full list of codes
    """


    # @ApiMember(DataType="string", Description="Describes the result of sending Sms text message", IsRequired=true, Name="StatusDescription", ParameterType="form")
    status_description: Optional[str] = None
    """
    Describes the result of sending Sms text message
    """


    # @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")
    message_id: Optional[str] = None
    """
    Your unique message id from send request message item. Will be empty if you did not provide any id in the request item.
    """


    # @ApiMember(DataType="string", Description="Unique transaction id from server", IsRequired=true, Name="TransactionId", ParameterType="form")
    transaction_id: Optional[str] = None
    """
    Unique transaction id from server
    """


    # @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")
    extra_info: Optional[Dict[str, str]] = None
    """
    Key/Value attributes returned from server. E.g. subnumref and the server name that processed the message. Eg. subnumref=19331234567891,server=smsgw1
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RestSmsResponse:
    # @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")
    process_result: bool = False
    """
    Overall status of processing the request. Each message will have it's own status. This value indicates if any other error occured or not
    """


    # @ApiMember(DataType="string", Description="Description of any error occured, if ProcessResult equals false", Name="ProcessResultDescription", ParameterType="form")
    # @StringLength(2048)
    process_result_description: Optional[str] = None
    """
    Description of any error occured, if ProcessResult equals false
    """


    # @ApiMember(Description="Collection of messages sent or failed", Name="Description", ParameterType="form")
    messages: List[RestSmsMessageResp] = field(default_factory=list)
    """
    Collection of messages sent or failed
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RestSmsMessageReq:
    # @ApiMember(DataType="integer", Description="Gateway number. Default 99700999 for cross country delivery, non premium messages", IsRequired=true, Name="Gateway", ParameterType="form")
    gateway: Optional[Object] = None
    """
    Gateway number. Default 99700999 for cross country delivery, non premium messages
    """


    # @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")
    originator_address: Optional[Object] = None
    """
    Originator address. Defaults to gateway number if not set. Maximum 11 chars if using alphanumeric value. See documentation for full details.
    """


    # @ApiMember(DataType="integer", Description="Destination address.The recipient of the message. Must be a valid MSISDN", IsRequired=true, Name="DestinationAddress", ParameterType="form")
    destination_address: Optional[Object] = None
    """
    Destination address.The recipient of the message. Must be a valid MSISDN
    """


    # @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")
    price: Optional[Object] = None
    """
    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
    """


    # @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")
    message_type: Optional[str] = None
    """
    Message type according to documentation. Defaults to 00 if not set. If text length is above 160 chars, it defaults to value 11
    """


    # @ApiMember(DataType="string", Description="Delivery expire timestamp (yyyymmddhhmmss) or relative value. See documentation and default value if not defined", Name="ValidationPeriod", ParameterType="form")
    validation_period: Optional[Object] = None
    """
    Delivery expire timestamp (yyyymmddhhmmss) or relative value. See documentation and default value if not defined
    """


    # @ApiMember(DataType="string", Description="Your unique message id to track delivery status and response from sending process", Name="MessageId", ParameterType="form")
    message_id: Optional[str] = None
    """
    Your unique message id to track delivery status and response from sending process
    """


    # @ApiMember(DataType="string", Description="GSM User Data Header (HEX)", Name="UserDataHeader", ParameterType="form")
    user_data_header: Optional[str] = None
    """
    GSM User Data Header (HEX)
    """


    # @ApiMember(DataType="string", Description="GSM User Data. Plain text or hex encoded. Depending on the used MessageType", IsRequired=true, Name="UserData", ParameterType="form")
    user_data: Optional[str] = None
    """
    GSM User Data. Plain text or hex encoded. Depending on the used MessageType
    """


    # @ApiMember(DataType="string", Description="Parameter to categorize messages on payment bill from Intele", Name="Category", ParameterType="form")
    category: Optional[str] = None
    """
    Parameter to categorize messages on payment bill from Intele
    """


    # @ApiMember(DataType="string", Description="Custom key/value attributes for the Sms Text Message. See documentation for further details", Name="CustomData", ParameterType="form")
    custom_data: Optional[Dict[str, Object]] = None
    """
    Custom key/value attributes for the Sms Text Message. See documentation for further details
    """


    # @ApiMember(DataType="string", Description="Url where Intele should send delivery report. See documentation for url formatting", Name="DeliveryReportUrl", ParameterType="form")
    delivery_report_url: Optional[str] = None
    """
    Url where Intele should send delivery report. See documentation for url formatting
    """


    # @ApiMember(DataType="string", Description="For Premium messaging only. See documentation for further details", Name="ServiceCode", ParameterType="form")
    service_code: Optional[str] = None
    """
    For Premium messaging only. See documentation for further details
    """


    # @ApiMember(DataType="string", Description="For Premium messaging only. See documentation for further details", Name="ServiceDescription", ParameterType="form")
    service_description: Optional[str] = None
    """
    For Premium messaging only. See documentation for further details
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RestSmsRequest:
    # @ApiMember(DataType="string", Description="API Username. Usually your customer id", IsRequired=true, Name="Username", ParameterType="form")
    # @StringLength(128)
    username: Optional[Object] = None
    """
    API Username. Usually your customer id
    """


    # @ApiMember(DataType="string", Description="API Password", IsRequired=true, Name="Password", ParameterType="form")
    # @StringLength(128)
    password: Optional[str] = None
    """
    API Password
    """


    # @ApiMember(Description="Collection of messages to send", IsRequired=true, Name="Messages", ParameterType="form")
    messages: List[RestSmsMessageReq] = field(default_factory=list)
    """
    Collection of messages to send
    """

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