Documentation ¶
Overview ¶
Package jsc (JSON Specification Client) is an http client that makes sending HTTP requests that match the JSON Specification: http://jsonapi.org/ simple.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Response ¶
Response is a wrapper around an http.Response that allows us to perform intelligent actions on them
func Get ¶
Get allows a user to make an outbound GET /resources(/:id) request.
For a GET request that retrieves multiple resources, pass an empty string for the id parameter:
GET "http://apiserver/users resp, err := jsh.Get("http://apiserver", "user", "") list, err := resp.GetList()
For a GET request on a specific attribute:
GET "http://apiserver/users/2 resp, err := jsh.Get("http://apiserver", "user", "2") obj := resp.GetObject()
func Patch ¶
Patch allows a consumer to perform a PATCH /resources/:id request Example:
obj, _ := jsh.NewObject("123", "resource_name", payload) resp, _ := jsc.Patch("http://postap.com", obj) updatedObj, _ := resp.GetObject()
func Post ¶
Post allows a user to make an outbound POST /resources request:
resp, err := jsh.Get("http://apiserver", "user", "2") obj := resp.GetObject()
func (*Response) BodyStr ¶
BodyStr is a convenience function that parses the body of the response into a string BUT DOESN'T close the ReadCloser