Documentation
¶
Index ¶
- Constants
- func AddQueryParams(baseURL string, opts ...interface{}) (string, error)
- type Client
- func (c *Client) ConstructRequest(r, body interface{}) *resty.Request
- func (c *Client) Delete(url string, r, body interface{}) (*Response, error)
- func (c *Client) Dispatch(request *resty.Request) (*Response, error)
- func (c *Client) Get(url string, r, body interface{}) (*Response, error)
- func (c *Client) Patch(url string, r, body interface{}) (*Response, error)
- func (c *Client) Post(url string, r, body interface{}) (*Response, error)
- func (c *Client) Put(url string, r, body interface{}) (*Response, error)
- func (c *Client) RequestURL(template string, args ...interface{}) string
- func (c *Client) RequestURLWithQueryParams(url string, opts ...interface{}) (string, error)
- func (c *Client) SetBaseURL(url string)
- type Response
Constants ¶
const ( GetMethod = "GET" PostMethod = "POST" PutMethod = "PUT" DeleteMethod = "DELETE" PatchMethod = "PATCH" )
Variables ¶
This section is empty.
Functions ¶
func AddQueryParams ¶
AddQueryParams takes a slice of opts and adds each field as escaped URL query parameters to a base URL string.
Each element in opts must be a struct whose fields contain "url" tags.
Based on: https://github.com/google/go-github/blob/master/github/github.go#L226
Types ¶
type Client ¶
type Client struct {
*resty.Client
// contains filtered or unexported fields
}
Client represents a SimpleResty client. It embeds the resty.client so users have access to its methods.
func (*Client) ConstructRequest ¶
func (c *Client) ConstructRequest(r, body interface{}) *resty.Request
ConstructRequest creates a new request.
func (*Client) Dispatch ¶
Dispatch method is a wrapper around the send method which performs the HTTP request using the method and URL already defined.
func (*Client) RequestURL ¶
RequestURL appends the template argument to the base URL and returns the full request URL.
func (*Client) RequestURLWithQueryParams ¶
RequestURLWithQueryParams first constructs the request URL and then appends any URL encoded query parameters.
This function operates nearly the same as RequestURL
func (*Client) SetBaseURL ¶
SetBaseURL sets the base url for the client.