Documentation ¶
Overview ¶
Package client provides internal utilities for the twilio-go client library.
Copyright 2014 Alvaro J. Genial. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. nolint
Package form implements encoding and decoding of application/x-www-form-urlencoded data.
Copyright 2014 Alvaro J. Genial. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. nolint
Index ¶
- func EncodeToString(dst interface{}) (string, error)
- func EncodeToStringWith(dst interface{}, d rune, e rune, z bool) (string, error)
- func EncodeToValues(dst interface{}) (url.Values, error)
- func EncodeToValuesWith(dst interface{}, d rune, e rune, z bool) (url.Values, error)
- type BaseClient
- type Client
- func (c *Client) BuildHost(rawHost string) string
- func (c Client) Delete(path string, nothing interface{}, headers map[string]interface{}) (*http.Response, error)
- func (c Client) Get(path string, queryData interface{}, headers map[string]interface{}) (*http.Response, error)
- func (c Client) GetAccountSid() string
- func (c Client) Post(path string, bodyData url.Values, headers map[string]interface{}) (*http.Response, error)
- func (c Client) SendRequest(method string, rawURL string, queryParams interface{}, formData url.Values, ...) (*http.Response, error)
- func (c *Client) SetTimeout(timeout time.Duration)
- type Credentials
- type Encoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeToString ¶
EncodeToString encodes dst as a form and returns it as a string.
func EncodeToStringWith ¶
EncodeToStringWith encodes dst as a form with delimiter d, escape e, keeping zero values if z, and returns it as a string.
func EncodeToValues ¶
EncodeToValues encodes dst as a form and returns it as Values.
Types ¶
type BaseClient ¶ added in v0.5.0
type BaseClient interface { GetAccountSid() string Post(path string, bodyData url.Values, headers map[string]interface{}) (*http.Response, error) Get(path string, queryData interface{}, headers map[string]interface{}) (*http.Response, error) Delete(path string, nothing interface{}, headers map[string]interface{}) (*http.Response, error) }
type Client ¶
type Client struct { *Credentials HTTPClient *http.Client BaseURL string Edge string Region string AccountSid string }
Client encapsulates a standard HTTP backend with authorization.
func (*Client) BuildHost ¶ added in v0.6.0
BuildHost builds the target host string taking into account region and edge configurations.
func (Client) Delete ¶
func (c Client) Delete(path string, nothing interface{}, headers map[string]interface{}) (*http.Response, error)
Delete performs a DELETE request on the object at the provided URI in the context of the Request's BaseURL with the provided data as parameters.
func (Client) Get ¶
func (c Client) Get(path string, queryData interface{}, headers map[string]interface{}) (*http.Response, error)
Get performs a GET request on the object at the provided URI in the context of the Request's BaseURL with the provided data as parameters.
func (Client) GetAccountSid ¶ added in v0.8.0
Returns the Account SID.
func (Client) Post ¶
func (c Client) Post(path string, bodyData url.Values, headers map[string]interface{}) (*http.Response, error)
Post performs a POST request on the object at the provided URI in the context of the Request's BaseURL with the provided data as parameters.
func (Client) SendRequest ¶
func (c Client) SendRequest(method string, rawURL string, queryParams interface{}, formData url.Values, headers map[string]interface{}) (*http.Response, error)
SendRequest verifies, constructs, and authorizes an HTTP request.
func (*Client) SetTimeout ¶
SetTimeout sets the Timeout for HTTP requests.
type Credentials ¶
Credentials store user authentication credentials.
func NewCredentials ¶ added in v0.8.0
func NewCredentials(username string, password string) *Credentials
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder provides a way to encode to a Writer.
func (*Encoder) DelimitWith ¶
DelimitWith sets r as the delimiter used for composite keys by Encoder e and returns the latter; it is '.' by default.
func (*Encoder) EscapeWith ¶
EscapeWith sets r as the escape used for delimiters (and to escape itself) by Encoder e and returns the latter; it is '\\' by default.