Documentation ¶
Index ¶
- type Client
- type ClientOption
- func WithAPIKey(apiKey string) ClientOption
- func WithCredential(credential string) ClientOption
- func WithHTTPHeader(header http.Header) ClientOption
- func WithHTTPProxy(proxy string) ClientOption
- func WithMaxElapsedTime(maxElapsedTime time.Duration) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- type PostRequest
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a generic GraphQL API client.
func NewClient ¶
func NewClient(endpoint string, opts ...ClientOption) *Client
NewClient returns a Client instance.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption represents options for a generic GraphQL client.
func WithAPIKey ¶
func WithAPIKey(apiKey string) ClientOption
WithAPIKey returns a ClientOption configured with the given API key
func WithCredential ¶
func WithCredential(credential string) ClientOption
WithCredential returns a ClientOption configured with the given credential
func WithHTTPHeader ¶ added in v1.4.0
func WithHTTPHeader(header http.Header) ClientOption
WithHTTPHeader returns a ClientOption configured with the given http.Header
func WithHTTPProxy ¶
func WithHTTPProxy(proxy string) ClientOption
WithHTTPProxy returns a ClientOption configured with the given http proxy
func WithMaxElapsedTime ¶
func WithMaxElapsedTime(maxElapsedTime time.Duration) ClientOption
WithMaxElapsedTime returns a ClientOption configured with the given maxElapsedTime
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout returns a ClientOption configured with the given timeout
type PostRequest ¶
type PostRequest struct { Query string `json:"query"` OperationName *string `json:"operationName"` Variables *json.RawMessage `json:"variables"` }
PostRequest is a generic GraphQL POST request body.
func (*PostRequest) IsMutation ¶
func (p *PostRequest) IsMutation() bool
IsMutation checks if the Request is "Mutation" or not.
func (*PostRequest) IsQuery ¶
func (p *PostRequest) IsQuery() bool
IsQuery checks if the Request is "Query" or not.
func (*PostRequest) IsSubscription ¶
func (p *PostRequest) IsSubscription() bool
IsSubscription checks if the Request is "Subscription" or not.