client
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package client provides internal utilities for the twilio-go client library.
Package error provides the interface for Twilio specific errors.
Package mock_client is a generated GoMock package.
Package client provides internal utilities for the twilio-go client library.
Package config for config files.
Index¶
- Constants
- func GetNext(baseUrl string, response interface{}, ...) (interface{}, error)
- func ReadLimits(pageSize *int, limit *int) int
- func UnmarshalFloat32(input *interface{}) (*float32, error)
- type BaseClient
- type Client
- func (c *Client) AccountSid() string
- func (c *Client) OAuth() OAuth
- func (c *Client) SendRequest(method string, rawURL string, data url.Values, headers map[string]interface{}, ...) (*http.Response, error)
- func (c *Client) SetAccountSid(sid string)
- func (c *Client) SetOauth(oauth OAuth)
- func (c *Client) SetTimeout(timeout time.Duration)
- type Credentials
- type MockBaseClient
- func (m *MockBaseClient) AccountSid() string
- func (m *MockBaseClient) EXPECT() *MockBaseClientMockRecorder
- func (m *MockBaseClient) OAuth() OAuth
- func (m *MockBaseClient) SendRequest(method, rawURL string, data url.Values, headers map[string]interface{}, ...) (*http.Response, error)
- func (m *MockBaseClient) SetOauth(auth OAuth)
- func (m *MockBaseClient) SetTimeout(timeout time.Duration)
- type MockBaseClientMockRecorder
- func (mr *MockBaseClientMockRecorder) AccountSid() *gomock.Call
- func (mr *MockBaseClientMockRecorder) OAuth() *gomock.Call
- func (mr *MockBaseClientMockRecorder) SendRequest(method, rawURL, data, headers interface{}, body ...interface{}) *gomock.Call
- func (mr *MockBaseClientMockRecorder) SetTimeout(timeout interface{}) *gomock.Call
- type OAuth
- type RequestHandler
- func (c *RequestHandler) BuildUrl(rawURL string) (string, error)
- func (c *RequestHandler) Delete(path string, queryData url.Values, headers map[string]interface{}) (*http.Response, error)
- func (c *RequestHandler) Get(path string, queryData url.Values, headers map[string]interface{}) (*http.Response, error)
- func (c *RequestHandler) Patch(path string, bodyData url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error)
- func (c *RequestHandler) Post(path string, bodyData url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error)
- func (c *RequestHandler) Put(path string, bodyData url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error)
- type RequestValidator
- type TwilioRestError
Constants¶
const LibraryVersion = "1.26.5"
LibraryVersion specifies the current version of twilio-go.
Variables¶
This section is empty.
Functions¶
funcReadLimits¶added inv0.13.0
Takes a limit on the max number of records to read and a max pageSize and calculates the max number of pages to read.
funcUnmarshalFloat32¶added inv0.25.0
Types¶
typeBaseClient¶added inv0.5.0
typeClient¶
type Client struct {*CredentialsHTTPClient *http.ClientUserAgentExtensions []string// contains filtered or unexported fields}
Client encapsulates a standard HTTP backend with authorization.
func (*Client)AccountSid¶added inv0.8.0
AccountSid returns the Account SID.
func (*Client)SendRequest¶
func (c *Client) SendRequest(methodstring, rawURLstring, dataurl.Values,headers map[string]interface{}, body ...byte) (*http.Response,error)
SendRequest verifies, constructs, and authorizes an HTTP request.
func (*Client)SetAccountSid¶added inv0.9.0
SetAccountSid sets the Client's accountSid field
func (*Client)SetTimeout¶
SetTimeout sets the Timeout for HTTP requests.
typeCredentials¶
Credentials store user authentication credentials.
funcNewCredentials¶added inv0.8.0
func NewCredentials(usernamestring, passwordstring) *Credentials
typeMockBaseClient¶added inv0.14.0
type MockBaseClient struct {// contains filtered or unexported fields}
MockBaseClient is a mock of BaseClient interface.
funcNewMockBaseClient¶added inv0.14.0
func NewMockBaseClient(ctrl *gomock.Controller) *MockBaseClient
NewMockBaseClient creates a new mock instance.
func (*MockBaseClient)AccountSid¶added inv0.14.0
func (m *MockBaseClient) AccountSid()string
AccountSid mocks base method.
func (*MockBaseClient)EXPECT¶added inv0.14.0
func (m *MockBaseClient) EXPECT() *MockBaseClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBaseClient)OAuth¶added inv1.26.2
func (m *MockBaseClient) OAuth()OAuth
func (*MockBaseClient)SendRequest¶added inv0.14.0
func (m *MockBaseClient) SendRequest(method, rawURLstring, dataurl.Values, headers map[string]interface{}, body ...byte) (*http.Response,error)
SendRequest mocks base method.
func (*MockBaseClient)SetOauth¶added inv1.26.2
func (m *MockBaseClient) SetOauth(authOAuth)
Oauth mocks base method.
func (*MockBaseClient)SetTimeout¶added inv0.14.0
func (m *MockBaseClient) SetTimeout(timeouttime.Duration)
SetTimeout mocks base method.
typeMockBaseClientMockRecorder¶added inv0.14.0
type MockBaseClientMockRecorder struct {// contains filtered or unexported fields}
MockBaseClientMockRecorder is the mock recorder for MockBaseClient.
func (*MockBaseClientMockRecorder)AccountSid¶added inv0.14.0
func (mr *MockBaseClientMockRecorder) AccountSid() *gomock.Call
AccountSid indicates an expected call of AccountSid.
func (*MockBaseClientMockRecorder)OAuth¶added inv1.26.2
func (mr *MockBaseClientMockRecorder) OAuth() *gomock.Call
OAuth indicates an expected call of OAuth.
func (*MockBaseClientMockRecorder)SendRequest¶added inv0.14.0
func (mr *MockBaseClientMockRecorder) SendRequest(method, rawURL, data, headers interface{}, body ...interface{}) *gomock.Call
SendRequest indicates an expected call of SendRequest.
func (*MockBaseClientMockRecorder)SetTimeout¶added inv0.14.0
func (mr *MockBaseClientMockRecorder) SetTimeout(timeout interface{}) *gomock.Call
SetTimeout indicates an expected call of SetTimeout.
typeRequestHandler¶added inv0.9.0
type RequestHandler struct {ClientBaseClientEdgestringRegionstring}
funcNewRequestHandler¶added inv0.9.0
func NewRequestHandler(clientBaseClient) *RequestHandler
func (*RequestHandler)BuildUrl¶added inv0.9.0
func (c *RequestHandler) BuildUrl(rawURLstring) (string,error)
BuildUrl builds the target host string taking into account region and edge configurations.
typeRequestValidator¶added inv0.13.0
type RequestValidator struct {// contains filtered or unexported fields}
RequestValidator is used to verify the Twilio Signature included with Twilio requests to webhooks.This ensures the request is actually coming from Twilio and helps with securing your webhooks.
funcNewRequestValidator¶added inv0.13.0
func NewRequestValidator(authTokenstring)RequestValidator
NewRequestValidator returns a new RequestValidator which uses the specified auth token when verifyingTwilio signatures.
func (*RequestValidator)Validate¶added inv0.13.0
func (rv *RequestValidator) Validate(urlstring, params map[string]string, expectedSignaturestring)bool
Validate can be used for Twilio Signatures sent with webhooks configured for GET calls. It returns trueif the computed signature matches the expectedSignature. Params are a map of string to string containingall the query params Twilio added to the configured webhook URL.
func (*RequestValidator)ValidateBody¶added inv0.13.0
func (rv *RequestValidator) ValidateBody(urlstring, body []byte, expectedSignaturestring)bool
ValidateBody can be used for Twilio Signatures sent with webhooks configured for POST calls. It returns trueif the computed signature matches the expectedSignature. Body is the HTTP request body from the webhook callas a slice of bytes.
typeTwilioRestError¶added inv0.11.0
type TwilioRestError struct {Codeint `json:"code"`Details map[string]interface{} `json:"details"`Messagestring `json:"message"`MoreInfostring `json:"more_info"`Statusint `json:"status"`}
TwilioRestError provides information about an unsuccessful request.
func (*TwilioRestError)Error¶added inv0.11.0
func (err *TwilioRestError) Error()string