Documentation ¶
Index ¶
- Constants
- Variables
- func API(request rest.Request) (*rest.Response, error)
- func GetRequest(key, endpoint, host string) rest.Request
- func GetRequestSubuser(key, endpoint, host, subuser string) rest.Request
- func GetTwilioEmailRequest(twilioEmailOptions TwilioEmailOptions) rest.Request
- func MakeRequest(request rest.Request) (*rest.Response, error)
- func MakeRequestAsync(request rest.Request) (chan *rest.Response, chan error)
- func MakeRequestAsyncWithContext(ctx context.Context, request rest.Request) (chan *rest.Response, chan error)
- func MakeRequestRetry(request rest.Request) (*rest.Response, error)
- func MakeRequestRetryWithContext(ctx context.Context, request rest.Request) (*rest.Response, error)
- func MakeRequestWithContext(ctx context.Context, request rest.Request) (*rest.Response, error)
- func SetDataResidency(request rest.Request, region string) (rest.Request, error)
- type Client
- type TwilioEmailOptions
Constants ¶
const (
Version = "3.14.0"
)
Version is this client library's current version
Variables ¶
var DefaultClient = rest.DefaultClient
DefaultClient is used if no custom HTTP client is defined
Functions ¶
func API ¶
API sets up the request to the Twilio SendGrid API, this is main interface. Please use the MakeRequest or MakeRequestAsync functions instead. (deprecated)
func GetRequest ¶
GetRequest @return [Request] a default request object
func GetRequestSubuser ¶
GetRequestSubuser like GetRequest but with On-Behalf of Subuser @return [Request] a default request object
func GetTwilioEmailRequest ¶
func GetTwilioEmailRequest(twilioEmailOptions TwilioEmailOptions) rest.Request
GetTwilioEmailRequest create Request @return [Request] a default request object
func MakeRequest ¶
MakeRequest attempts a Twilio SendGrid request synchronously.
func MakeRequestAsync ¶
MakeRequestAsync attempts a request asynchronously in a new go routine. This function returns two channels: responses and errors. This function will retry in the case of a rate limit.
func MakeRequestAsyncWithContext ¶
func MakeRequestAsyncWithContext(ctx context.Context, request rest.Request) (chan *rest.Response, chan error)
MakeRequestAsyncWithContext attempts a request asynchronously in a new go routine with context.Context. This function returns two channels: responses and errors. This function will retry in the case of a rate limit.
func MakeRequestRetry ¶
MakeRequestRetry a synchronous request, but retry in the event of a rate limited response.
func MakeRequestRetryWithContext ¶
MakeRequestRetryWithContext a synchronous request with context.Context, but retry in the event of a rate limited response.
func MakeRequestWithContext ¶
MakeRequestWithContext attempts a Twilio SendGrid request synchronously with context.Context.
func SetDataResidency ¶
SetDataResidency modifies the host as per the region
- This allows support for global and eu regions only. This set will likely expand in the future.
- Global should be the default
- Global region means the message should be sent through:
- HTTP: api.sendgrid.com
- EU region means the message should be sent through:
- HTTP: api.eu.sendgrid.com
@return [Request] the modified request object
Types ¶
type Client ¶
Client is the Twilio SendGrid Go client
func NewSendClient ¶
NewSendClient constructs a new Twilio SendGrid client given an API key
func NewTwilioEmailSendClient ¶
NewTwilioEmailSendClient constructs a new Twilio Email client given a username and password