Documentation ¶
Index ¶
- Constants
- type Client
- func (p *Client) Delete(target string, response interface{}, options ...Option) error
- func (p *Client) Get(target string, response interface{}, options ...Option) error
- func (p *Client) MustDelete(target string, response interface{}, options ...Option)
- func (p *Client) MustGet(target string, response interface{}, options ...Option)
- func (p *Client) MustPost(query string, response interface{}, options ...Option)
- func (p *Client) MustPut(target string, response interface{}, options ...Option)
- func (p *Client) Post(target string, response interface{}, options ...Option) error
- func (p *Client) Put(target string, response interface{}, options ...Option) error
- func (p *Client) RawRequest(method string, target string, options ...Option) (*Response, error)
- type Option
- type RawJsonError
- type Request
- type Response
Constants ¶
const OK = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client used for testing GraphREST servers. Not for production use.
func New ¶
New creates a graphql client Options can be set that should be applied to all requests made with this client
func (*Client) Delete ¶
Post sends a http POST request to the graphql endpoint with the given query then unpacks the response into the given object.
func (*Client) Get ¶
Post sends a http POST request to the graphql endpoint with the given query then unpacks the response into the given object.
func (*Client) MustDelete ¶
MustPost is a convenience wrapper around Post that automatically panics on error
func (*Client) MustGet ¶
MustPost is a convenience wrapper around Post that automatically panics on error
func (*Client) MustPost ¶
MustPost is a convenience wrapper around Post that automatically panics on error
func (*Client) MustPut ¶
MustPost is a convenience wrapper around Post that automatically panics on error
func (*Client) Post ¶
Post sends a http POST request to the graphql endpoint with the given query then unpacks the response into the given object.
type Option ¶
type Option func(bd *Request)
Option implements a visitor that mutates an outgoing GraphQL request
This is the Option pattern - https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
func AddHeader ¶
AddHeader adds a header to the outgoing request. This is useful for setting expected Authentication headers for example.
type RawJsonError ¶
type RawJsonError struct {
json.RawMessage
}
RawJsonError is a json formatted error from a GraphQL server.
func (RawJsonError) Error ¶
func (r RawJsonError) Error() string