Documentation ¶
Overview ¶
Package rest allows for quick and easy access any REST or REST-like API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = &Client{HTTPClient: http.DefaultClient}
DefaultClient is used if no custom HTTP client is defined
Functions ¶
func AddQueryParameters ¶
AddQueryParameters adds query parameters to the URL.
func BuildRequestObject ¶
BuildRequestObject creates the HTTP request object.
Types ¶
type Client ¶
Client allows modification of client headers, redirect policy and other settings See https://golang.org/pkg/net/http
func (*Client) MakeRequest ¶
MakeRequest makes the API call.
type Request ¶
type Request struct { Method Method BaseURL string // e.g. https://api.sendgrid.com Headers map[string]string QueryParams map[string]string Body []byte }
Request holds the request to an API Call.
type Response ¶
type Response struct { StatusCode int // e.g. 200 Body string // e.g. {"result: success"} Headers map[string][]string // e.g. map[X-Ratelimit-Limit:[600]] }
Response holds the response from an API call.
func BuildResponse ¶
BuildResponse builds the response struct.
Click to show internal directories.
Click to hide internal directories.