Documentation
¶
Index ¶
- Constants
- func NewRetryableClient(logger func(s string), defaultWaitAfterTooManyRequests time.Duration) *http.Client
- type Client
- type ClientOption
- func ImmediatelyCloseReqBody() ClientOption
- func UseMultipartForm() ClientOption
- func WithHTTPClient(httpclient *http.Client) ClientOption
- func WithLogDebug(logger func(s string)) ClientOption
- func WithLogError(logger func(s string)) ClientOption
- func WithLogWarn(logger func(s string)) ClientOption
- func WithWaitAfterTooManyRequests(duration time.Duration) ClientOption
- type File
- type Request
Constants ¶
const RetryCount = 5
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with a GraphQL API.
func NewClient ¶
func NewClient(endpoint string, opts ...ClientOption) *Client
NewClient makes a new Client capable of making GraphQL requests.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption are functions that are passed into NewClient to modify the behaviour of the Client.
func ImmediatelyCloseReqBody ¶
func ImmediatelyCloseReqBody() ClientOption
ImmediatelyCloseReqBody will close the req body immediately after each request body is ready
func UseMultipartForm ¶
func UseMultipartForm() ClientOption
UseMultipartForm uses multipart/form-data and activates support for files.
func WithHTTPClient ¶
func WithHTTPClient(httpclient *http.Client) ClientOption
WithHTTPClient specifies the underlying http.Client to use when making requests.
NewClient(endpoint, WithHTTPClient(specificHTTPClient))
func WithLogDebug ¶
func WithLogDebug(logger func(s string)) ClientOption
func WithLogError ¶
func WithLogError(logger func(s string)) ClientOption
func WithLogWarn ¶
func WithLogWarn(logger func(s string)) ClientOption
func WithWaitAfterTooManyRequests ¶
func WithWaitAfterTooManyRequests(duration time.Duration) ClientOption
type Request ¶
type Request struct { // Header represent any request headers that will be set // when the request is made. Header http.Header // contains filtered or unexported fields }
Request is a GraphQL request.
func NewRequest ¶
NewRequest makes a new Request with the specified string.
func (*Request) File ¶
File sets a file to upload. Files are only supported with a Client that was created with the UseMultipartForm option.