1package api 2 3import "io" 4 5// Raw can be used to do raw queries against custom endpoints 6type Raw struct { 7 c *Client 8} 9 10// Raw returns a handle to query endpoints 11func (c *Client) Raw() *Raw { 12 return &Raw{c} 13} 14 15// Query is used to do a GET request against an endpoint 16// and deserialize the response into an interface using 17// standard Nomad conventions. 18func (raw *Raw) Query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) { 19 return raw.c.query(endpoint, out, q) 20} 21 22// Response is used to make a GET request against an endpoint and returns the 23// response body 24func (raw *Raw) Response(endpoint string, q *QueryOptions) (io.ReadCloser, error) { 25 return raw.c.rawQuery(endpoint, q) 26} 27 28// Write is used to do a PUT request against an endpoint 29// and serialize/deserialized using the standard Nomad conventions. 30func (raw *Raw) Write(endpoint string, in, out interface{}, q *WriteOptions) (*WriteMeta, error) { 31 return raw.c.write(endpoint, in, out, q) 32} 33 34// Delete is used to do a DELETE request against an endpoint 35// and serialize/deserialized using the standard Nomad conventions. 36func (raw *Raw) Delete(endpoint string, out interface{}, q *WriteOptions) (*WriteMeta, error) { 37 return raw.c.delete(endpoint, out, q) 38} 39