africastalking

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Unlicense Imports: 9 Imported by: 0

README

africastalking

Minimal Go client for the Africa's Talking API

Go Reference

License

The Unlicense

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtClient added in v0.2.0

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

func New

func New(apiKey string, username string, sandbox bool) *AtClient

New returns an instance of an Africa's Talking client reusbale across different products.

func (*AtClient) SendBulkSMS added in v0.2.0

func (at *AtClient) SendBulkSMS(ctx context.Context, input BulkSMSInput) (BulkSMSResponse, error)

SendBulkSMS makes a POST request to send bulk SMS's the Africa's Talking and returns a response. It uses opinionated defaults.

func (*AtClient) SetHTTPClient added in v0.2.0

func (at *AtClient) SetHTTPClient(httpClient *http.Client) *AtClient

SetHTTPClient can be used to override the default client with a custom set one.

type BulkSMSInput

type BulkSMSInput struct {
	To      []string
	Message string
	From    string
}

BulkSMSInput is passed to SendBulkSMS as a parameter.

type BulkSMSRecipient

type BulkSMSRecipient struct {
	StatusCode uint   `json:"statusCode"`
	Number     string `json:"number"`
	Status     string `json:"status"`
	Cost       string `json:"cost"`
	MessageID  string `json:"messageId"`
}

BulkSMSRecipient is returned as part of the BulkSMSResponse.

type BulkSMSResponse

type BulkSMSResponse struct {
	SMSMessageData struct {
		Message    string             `json:"Message"`
		Recipients []BulkSMSRecipient `json:"Recipients"`
	} `json:"SMSMessageData"`
}

BulkSMSResponse is returned by SendBulkSMS as a response.

Jump to

Keyboard shortcuts

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