Documentation ¶
Overview ¶
Package messagebird is an official library for interacting with MessageBird.com API. The MessageBird API connects your website or application to operators around the world. With our API you can integrate SMS, Chat & Voice. More documentation you can find on the MessageBird developers portal: https://developers.messagebird.com/
Index ¶
Constants ¶
const ( // ClientVersion is used in User-Agent request header to provide server with API level. ClientVersion = "9.1.0" // Endpoint points you to MessageBird REST API. Endpoint = "https://rest.messagebird.com" )
Variables ¶
var DefaultPagination = &PaginationRequest{
Limit: 20,
Offset: 0,
}
DefaultPagination provides reasonable values for List requests.
var ( // ErrUnexpectedResponse is used when there was an internal server error and nothing can be done at this point. ErrUnexpectedResponse = errors.New("the MessageBird API is currently unavailable") )
Functions ¶
func SetErrorReader ¶
func SetErrorReader(r errorReader)
SetErrorReader takes an errorReader that must parse raw JSON errors
Types ¶
type DefaultClient ¶
type DefaultClient struct { AccessKey string // The API access key. HTTPClient *http.Client // The HTTP client to send requests on. DebugLog *log.Logger // Optional logger for debugging purposes. }
DefaultClient is used to access API with a given key. Uses standard lib HTTP client internally, so should be reused instead of created as needed and it is safe for concurrent use.
func (*DefaultClient) Request ¶
func (c *DefaultClient) Request(v interface{}, method, path string, data interface{}) error
Request is for internal use only and unstable.
type Error ¶
Error holds details including error code, human readable description and optional parameter that is related to the error.
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse represents errored API response.
func (ErrorResponse) Error ¶
func (r ErrorResponse) Error() string
Error implements error interface.
type PaginationRequest ¶
type PaginationRequest struct {
Limit, Offset int
}
PaginationRequest can be used to set pagination options in List().
func (*PaginationRequest) QueryParams ¶
func (cpr *PaginationRequest) QueryParams() string
type Recipient ¶
type Recipient struct { Recipient int64 Status string StatusDatetime *time.Time RecipientCountry *string RecipientCountryPrefix *int RecipientOperator *string MessageLength *int StatusErrorCode *int StatusReason *string Price *Price Mccmnc *string Mcc *string Mnc *string MessagePartCount int }
Recipient struct holds information for a single msisdn with status details.
Directories ¶
Path | Synopsis |
---|---|
Package conversation provides an interface to the Conversations API.
|
Package conversation provides an interface to the Conversations API. |
internal
|
|
mbtest
Package mbtest provides a test server that effectively mocks the MessageBird API.
|
Package mbtest provides a test server that effectively mocks the MessageBird API. |
Package signature implements signature verification for MessageBird webhooks.
|
Package signature implements signature verification for MessageBird webhooks. |
Package signature_jwt implements signature verification for MessageBird webhooks.
|
Package signature_jwt implements signature verification for MessageBird webhooks. |