Documentation ¶
Overview ¶
Generic-ish HATEOAS client for golang
Index ¶
- Variables
- type Client
- func (c *Client) Delete(url string, navigateLinks Navigate, headers Headers, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Do(method string, url string, navigateLinks Navigate, headers Headers, ...) (*http.Response, error)
- func (c *Client) Get(url string, navigateLinks Navigate, headers Headers, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Post(url string, navigateLinks Navigate, headers Headers, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PostForm(url string, navigateLinks Navigate, headers Headers, data url.Values, ...) (*http.Response, error)
- type HTTPDoer
- type Headers
- type Link
- type Links
- type Navigate
- type SimpleEndpoint
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorLinkNotFound = "Link not found" ErrorHttpStatus = "HTTP status error" ErrorBadConfig = "bad config" )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the main object for executing requests
func (*Client) Delete ¶
func (c *Client) Delete(url string, navigateLinks Navigate, headers Headers, body io.Reader, response interface{}) (*http.Response, error)
Delete is a small wrapper around Do
func (*Client) Do ¶
func (c *Client) Do(method string, url string, navigateLinks Navigate, headers Headers, body io.Reader, result interface{}) (*http.Response, error)
Do will start at the provided URL (or default to `Client.EntryURL`) and traverse the links specified by `navigateLinks` (with GET) before finally issuing `method` to the resultant URL
func (*Client) Get ¶
func (c *Client) Get(url string, navigateLinks Navigate, headers Headers, body io.Reader, response interface{}) (*http.Response, error)
Get is a small wrapper around Do
type HTTPDoer ¶
HTTPDoer would normally be an instance of *http.Client but by making it an interface we allow wrapping to permit logging or caching etc
type Links ¶
type Links []Link
Links is just an array of Link, but with some helper methods
type SimpleEndpoint ¶
type SimpleEndpoint struct {
Links Links `json:"Links"`
}
SimpleEndpoint is used when navigating links on endpoints
Click to show internal directories.
Click to hide internal directories.