messagingsdkgo

package module
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 13 Imported by: 0

README

Go Reference GitHub Release GitHub License Static Badge

GSMService.pl Messaging REST API SDK for Go

This package includes Messaging SDK for Go to send SMS & MMS messages directly from your app via https://bramka.gsmservice.pl messaging platform.

Additional documentation:

A documentation of all methods and types is available below in section Available Resources and Operations .

Also you can refer to the REST API documentation for additional details about the basics of this SDK.

Table of Contents

SDK Installation

To add the SDK as a dependency to your project:

go get github.com/gsmservice-pl/messaging-sdk-go

SDK Example Usage

Sending single SMS Message

This example demonstrates simple sending SMS message to a single recipient:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"github.com/gsmservice-pl/messaging-sdk-go/models/components"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Outgoing.Sms.Send(ctx, operations.CreateSendSmsRequestBodyArrayOfSmsMessage(
		[]components.SmsMessage{
			components.SmsMessage{
				Recipients: components.CreateSmsMessageRecipientsArrayOfStr(
					[]string{
						"+48999999999",
					},
				),
				Message: "To jest treść wiadomości",
				Sender:  messagingsdkgo.String("Bramka SMS"),
				Type:    components.SmsTypeSmsPro.ToPointer(),
				Unicode: messagingsdkgo.Bool(true),
				Flash:   messagingsdkgo.Bool(false),
				Date:    nil,
			},
		},
	))
	if err != nil {
		log.Fatal(err)
	}
	if res.Messages != nil {
		// handle response
	}
}

Sending single MMS Message

This example demonstrates simple sending MMS message to a single recipient:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"github.com/gsmservice-pl/messaging-sdk-go/models/components"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Outgoing.Mms.Send(ctx, operations.CreateSendMmsRequestBodyArrayOfMmsMessage(
		[]components.MmsMessage{
			components.MmsMessage{
				Recipients: components.CreateRecipientsArrayOfStr(
					[]string{
						"+48999999999",
					},
				),
				Subject: messagingsdkgo.String("To jest temat wiadomości"),
				Message: messagingsdkgo.String("To jest treść wiadomości"),
				Attachments: messagingsdkgo.Pointer(components.CreateAttachmentsArrayOfStr(
					[]string{
						"<file_body in base64 format>",
					},
				)),
				Date: nil,
			},
		},
	))
	if err != nil {
		log.Fatal(err)
	}
	if res.Messages != nil {
		// handle response
	}
}

Available Resources and Operations

Available methods
Accounts
Common
  • Ping - Checks API availability and version
Incoming
  • List - List the received SMS messages
  • GetByIds - Get the incoming messages by IDs
Outgoing
  • GetByIds - Get the messages details and status by IDs
  • CancelScheduled - Cancel a scheduled messages
  • List - Lists the history of sent messages
Outgoing.Mms
  • GetPrice - Check the price of MMS Messages
  • Send - Send MMS Messages
Outgoing.Sms
  • GetPrice - Check the price of SMS Messages
  • Send - Send SMS Messages
Senders
  • List - List allowed senders names
  • Add - Add a new sender name
  • Delete - Delete a sender name
  • SetDefault - Set default sender name

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retry.Config object to the call by using the WithRetries option:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"github.com/gsmservice-pl/messaging-sdk-go/retry"
	"log"
	"models/operations"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx, operations.WithRetries(
		retry.Config{
			Strategy: "backoff",
			Backoff: &retry.BackoffStrategy{
				InitialInterval: 1,
				MaxInterval:     50,
				Exponent:        1.1,
				MaxElapsedTime:  100,
			},
			RetryConnectionErrors: false,
		}))
	if err != nil {
		log.Fatal(err)
	}
	if res.AccountResponse != nil {
		// handle response
	}
}

If you'd like to override the default retry strategy for all operations that support retries, you can use the WithRetryConfig option at SDK initialization:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"github.com/gsmservice-pl/messaging-sdk-go/retry"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithRetryConfig(
			retry.Config{
				Strategy: "backoff",
				Backoff: &retry.BackoffStrategy{
					InitialInterval: 1,
					MaxInterval:     50,
					Exponent:        1.1,
					MaxElapsedTime:  100,
				},
				RetryConnectionErrors: false,
			}),
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.AccountResponse != nil {
		// handle response
	}
}

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both.

By Default, an API error will return sdkerrors.SDKError. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective Errors tables in SDK docs for more details on possible error types for each operation.

For example, the Get function may return the following errors:

Error Type Status Code Content Type
sdkerrors.ErrorResponse 401, 403, 4XX, 5XX application/problem+json
Example
package main

import (
	"context"
	"errors"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"github.com/gsmservice-pl/messaging-sdk-go/models/sdkerrors"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx)
	if err != nil {

		var e *sdkerrors.ErrorResponse
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.SDKError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}
	}
}

Server Selection

Select Server by Name

You can override the default server globally using the WithServer option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

Name Server Variables
prod https://api.gsmservice.pl/rest None
sandbox https://api.gsmservice.pl/rest-sandbox None
Example
package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithServer("sandbox"),
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.AccountResponse != nil {
		// handle response
	}
}

Override Server URL Per-Client

The default server can also be overridden globally using the WithServerURL option when initializing the SDK client instance. For example:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithServerURL("https://api.gsmservice.pl/rest"),
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.AccountResponse != nil {
		// handle response
	}
}

Custom HTTP Client

The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

The built-in net/http client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.

import (
	"net/http"
	"time"
	"github.com/myorg/your-go-sdk"
)

var (
	httpClient = &http.Client{Timeout: 30 * time.Second}
	sdkClient  = sdk.New(sdk.WithClient(httpClient))
)

This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme Environment Variable
Bearer http HTTP Bearer GATEWAY_API_BEARER

You can configure it using the WithSecurity option when initializing the SDK client instance. For example:

package main

import (
	"context"
	messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
	"log"
	"os"
)

func main() {
	s := messagingsdkgo.New(
		messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
	)

	ctx := context.Background()
	res, err := s.Accounts.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.AccountResponse != nil {
		// handle response
	}
}

Special Types

Development

Maturity

This SDK is in continuous development and there may be breaking changes between a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

Documentation

Index

Constants

View Source
const (
	// Production system
	ServerProd string = "prod"
	// Test system (SANDBOX)
	ServerSandbox string = "sandbox"
)

Variables

View Source
var ServerList = map[string]string{
	ServerProd:    "https://api.gsmservice.pl/rest",
	ServerSandbox: "https://api.gsmservice.pl/rest-sandbox",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func Pointer

func Pointer[T any](v T) *T

Pointer provides a helper function to return a pointer to a type

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

func (*Accounts) Get

Get account details Get current account balance and other details of your account. You can check also account limit and if account is main one. Main accounts have unlimited privileges and using [User Panel](https://panel.gsmservice.pl) you can create as many subaccounts as you need.

As a successful result a details of current account you are logged in using an API Access Token will be returned.

func (*Accounts) GetSubaccount

func (s *Accounts) GetSubaccount(ctx context.Context, userLogin string, opts ...operations.Option) (*operations.GetSubaccountDetailsResponse, error)

GetSubaccount - Get subaccount details Check account balance and other details such subcredit balance of a subaccount. Subaccounts are additional users who can access your account services and the details. You can restrict access level and setup privileges to subaccounts using [User Panel](https://panel.gsmservice.pl).

This method accepts a `string` type parameter with user login. You should pass there the full subaccount login to access its data.

As a successful result the details of subaccount with provided login will be returned.

type Client

type Client struct {
	Accounts *Accounts
	Outgoing *Outgoing
	Incoming *Incoming
	Common   *Common
	Senders  *Senders
	// contains filtered or unexported fields
}

Client - Messaging Gateway GSMService.pl: This package includes Messaging SDK for GO to send SMS and MMS messages directly from your app via [https://bramka.gsmservice.pl](https://bramka.gsmservice.pl) messaging platform.

To initialize SDK environment please use this syntax:

``` import (

messagingsdkgo "github.com/gsmservice-pl/messaging-sdk-go"
"os"

)

s := messagingsdkgo.New(

messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),

) ```

If you want to use a Sandbox test system please initialize it as follows:

``` s := messagingsdkgo.New(

messagingsdkgo.WithSecurity(os.Getenv("GATEWAY_API_BEARER")),
messagingsdkgo.WithServer(messagingsdkgo.ServerSandbox),

) ```

https://bramka.gsmservice.pl - Bramka GSMService.pl

func New

func New(opts ...SDKOption) *Client

New creates a new instance of the SDK with the provided options

type Common

type Common struct {
	// contains filtered or unexported fields
}

func (*Common) Ping

func (s *Common) Ping(ctx context.Context, opts ...operations.Option) (*operations.PingResponse, error)

Ping - Checks API availability and version Check the API connection and the current API availability status. Also you will get the current API version number.

As a successful result a `PingResponse` object will be returned.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for suplying the SDK with a custom HTTP client

type Incoming

type Incoming struct {
	// contains filtered or unexported fields
}

func (*Incoming) GetByIds

GetByIds - Get the incoming messages by IDs Get the details of one or more received messages using their `ids`. This method accepts an array of type `[]int64` containing unique incoming message *IDs*, which were given while receiving a messages. The method will accept maximum 50 identifiers in one call.

As a successful result a `GetIncomingMessagesResponse` object will be returned with an `IncomingMessages` property of type `[]IncomingMessage` containing `IncomingMessage` objects, each object per single received message.

`GetIncomingMessagesResponse` object will contain also a `Headers` property where you can find `X-Success-Count` (a count of incoming messages which were found and returned correctly) and `X-Error-Count` (count of incoming messages which were not found) elements.

func (*Incoming) List

List the received SMS messages Get the details of all received messages from your account incoming messages box. This method supports pagination so you have to pass `page` (number of page with received messages which you want to access) and a `limit` (max of received messages per page) parameters. Messages are fetched from the latest one. This method will accept maximum **50** as `limit` parameter value.

As a successful result a `ListIncomingMessagesResponse` object will be returned with `IncomingMessages` property of type `[]IncomingMessage` containing `IncomingMessage` objects, each object per single received message.

`ListIncomingMessagesResponse` object will contain also a `Headers` property where you can find `X-Total-Results` (a total count of all received messages which are available in incoming box on your account), `X-Total-Pages` (a total number of all pages with results), `X-Current-Page` (A current page number) and `X-Limit` (messages count per single page) elements.

type Mms added in v1.2.5

type Mms struct {
	// contains filtered or unexported fields
}

func (*Mms) GetPrice added in v1.2.5

GetPrice - Check the price of MMS Messages Check the price of single or multiple MMS messages at the same time before sending them. You can pass a single `MmsMessage` object using `operations.CreateGetMmsPriceRequestBodyMmsMessage()` method (for single message) or `[]MmsMessage` array using `operations.CreateGetMmsPriceRequestBodyArrayOfMmsMessage()` method (for multiple messages). Each `MmsMessage` object has several properties, describing message parameters such as recipient phone number, content of the message, attachments, etc. The system will accept maximum **50** messages in one call.

As a successful result a `GetMmsPriceResponse` object will be returned with `Prices` property of type `[]Price` containing a `Price` objects, one object per each single message. You should check the `Error` property of each `Price` object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have `null` value of `Error` property.

`GetSmsPriceResponse` object will include also `Headers` property with `X-Success-Count` (a count of messages which were processed successfully) and `X-Error-Count` (count of messages which were rejected) elements.

func (*Mms) Send added in v1.2.5

Send MMS Messages Send single or multiple MMS messages at the same time. You can pass a single `MmsMessage` object using `operations.CreateSendMmsRequestBodyMmsMessage()` method (for single message) or `[]MmsMessage` array using `operations.CreateSendMmsRequestBodyArrayOfMmsMessage()` method (for multiple messages). Each `MmsMessage` object has several properties, describing message parameters such recipient phone number, content of the message, attachments or scheduled sending date, etc. This method will accept maximum 50 messages in one call.

As a successful result a `SendMmsResponse` object will be returned with `Messages` property of type `[]Message` containing `Message` objects, one object per each single message. You should check the `StatusCode` property of each `Message` object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, `StatusDescription` property will include a reason.

`SendMmsResponse` will also include `Headers` property with `X-Success-Count` (a count of messages which were processed successfully), `X-Error-Count` (count of messages which were rejected) and `X-Sandbox` (if a request was made in Sandbox or Production system) elements.

type Outgoing

type Outgoing struct {
	Mms *Mms
	Sms *Sms
	// contains filtered or unexported fields
}

func (*Outgoing) CancelScheduled

func (s *Outgoing) CancelScheduled(ctx context.Context, ids []int64, opts ...operations.Option) (*operations.CancelMessagesResponse, error)

CancelScheduled - Cancel a scheduled messages Cancel messages using their `ids` which were scheduled to be sent at a specific time. You have to pass an array of type `[]int64` containing the unique message IDs, which were returned after sending a message. This method will accept maximum 50 identifiers in one call. You can cancel only messages with *SCHEDULED* status.

As a successful result a `CancelMessagesResponse` object will be returned, with `CancelledMessages` property of type `[]CancelledMessage` containing `CancelledMessage` objects. The `Status` property of each `CancelledMessage` object will contain a status code of operation - `204` if a particular message was cancelled successfully and other code if an error occured.

`CancelMessagesResponse` object will also contain `Headers` property where you can find `X-Success-Count` (a count of messages which were cancelled successfully), `X-Error-Count` (count of messages which were not cancelled) and `X-Sandbox` (if a request was made in Sandbox or Production system) elements.

func (*Outgoing) GetByIds

func (s *Outgoing) GetByIds(ctx context.Context, ids []int64, opts ...operations.Option) (*operations.GetMessagesResponse, error)

GetByIds - Get the messages details and status by IDs Check the current status and details of one or more messages using their `ids`. You have to pass an array of type `[]int64` containing unique message *IDs* which details you want to fetch. This method will accept maximum 50 identifiers in one call.

As a successful result a `GetMessagesResponse` object will be returned containing `Messages` property of type `[]Message` with `Message` objects, each object per single found message. `GetMessagesResponse` object will also contain `Headers` property where you can find `X-Success-Count` (a count of messages which were found and returned correctly) and `X-Error-Count` (count of messages which were not found) elements.

func (*Outgoing) List

func (s *Outgoing) List(ctx context.Context, page *int64, limit *int64, opts ...operations.Option) (*operations.ListMessagesResponse, error)

List - Lists the history of sent messages Get the details and current status of all of sent messages from your account message history. This method supports pagination so you have to pass a `page` (number of page with messages which you want to access) and a `limit` (max of messages per page) parameters. Messages are fetched from the latest one. This method will accept maximum value of **50** as `limit` parameter value (of type `Int64`).

As a successful result a `ListMessagesResponse` object will be returned containing `Messages` property of type `[]Message` with a `Message` objects, each object per single message. `ListMessagesResponse` will also contain `Headers` property where you can find `X-Total-Results` (a total count of all messages which are available in history on your account), `X-Total-Pages` (a total number of all pages with results), `X-Current-Page` (A current page number) and `X-Limit` (messages count per single page) elements.

type SDKOption

type SDKOption func(*Client)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig

func WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(bearer string) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource

func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServer

func WithServer(server string) SDKOption

WithServer allows the overriding of the default server by name

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

type Senders

type Senders struct {
	// contains filtered or unexported fields
}

func (*Senders) Add

Add a new sender name Define a new allowed sender on your account. You should pass as parameter a `SenderInput` struct with two fields: `Sender` (defines sender name) and `Description`. Please carefully fill this field with the extensive description of a sender name (what will be its use, what the name mean, etc).

As a successful result a `AddSenderResponse` object will be returned with a `Sender` property containing a `Sender` object with details and status of added sender name.

func (*Senders) Delete

func (s *Senders) Delete(ctx context.Context, sender string, opts ...operations.Option) (*operations.DeleteSenderResponse, error)

Delete a sender name Removes defined sender name from your account. This method accepts a `string` type with a **sender name** you want to remove. Sender name will be deleted immediately.

As a successful response there would be `DeleteSenderResponse` object returned with no Exception thrown.

func (*Senders) List

List allowed senders names Get a list of allowed senders defined in your account.

As a successful result a `ListSendersResponse` object will be returned witch `Senders` property of type `[]Sender` array containing `Sender` objects, each object per single sender.

func (*Senders) SetDefault

func (s *Senders) SetDefault(ctx context.Context, sender string, opts ...operations.Option) (*operations.SetDefaultSenderResponse, error)

SetDefault - Set default sender name Set default sender name to one of the senders names already defined on your account. This method accepts a `string` type containing a **sender name** to be set as default on your account.

As a successful response a `SetDefaultSenderResponse` object will be returned no Exception to be thrown.

type Sms

type Sms struct {
	// contains filtered or unexported fields
}

func (*Sms) GetPrice

GetPrice - Check the price of SMS Messages Check the price of single or multiple SMS messages at the same time before sending them. You can pass a single `SmsMessage` object using `operations.CreateGetSmsPriceRequestBodySmsMessage()` method (for single message) or `[]SmsMessage` array using `operations.CreateGetSmsPriceRequestBodyArrayOfSmsMessage()` method (for multiple messages). Each `SmsMessage` object has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. The method will accept maximum **100** messages in one call.

As a successful result a `GetSmsPriceResponse` object will be returned with `Prices` property of type `[]Price` containing a `Price` objects, one object per each single message. You should check the `Error` property of each `Price` object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have `null` value of `Error` property.

`GetSmsPriceResponse` object will include also `Headers` property with `X-Success-Count` (a count of messages which were processed successfully) and `X-Error-Count` (count of messages which were rejected) elements.

func (*Sms) Send

Send SMS Messages Send single or multiple SMS messages at the same time. You can pass a single `SmsMessage` object using `operations.CreateSendSmsRequestBodySmsMessage()` method (for single message) or `[]SmsMessage` array using `operations.CreateSendSmsRequestBodyArrayOfSmsMessage()` method (for multiple messages). Each `SmsMessage` object has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. This method will accept maximum 100 messages in one call.

As a successful result a `SendSmsResponse` object will be returned with `Messages` property of type `[]Message` containing `Message` objects, one object per each single message. You should check the `StatusCode` property of each `Message` object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, `StatusDescription` property will include a reason.

`SendSmsResponse` will also include `Headers` property with `X-Success-Count` (a count of messages which were processed successfully), `X-Error-Count` (count of messages which were rejected) and `X-Sandbox` (if a request was made in Sandbox or Production system) elements.

Directories

Path Synopsis
internal
models

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL