Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = NewClient()
A simple client with no default URL.
Functions ¶
This section is empty.
Types ¶
type GraphQLClient ¶
type GraphQLClient struct {
// The underlying http client to use.
// Use this to configure settings like timeouts.
HttpClient *http.Client
// The GraphQL endpoint to make requests to.
// This can be left as nil if you want to configure it on a per-request level.
Url *url.URL
// Shared HTTP headers to send with every request.
Header http.Header
}
A simple GraphQL client with configurable defaults.
func (*GraphQLClient) Do ¶
func (client *GraphQLClient) Do(request *GraphQLRequest, unmarshal interface{}) error
Perform a GraphQL request and unmarshal the response to the provided type.
func (*GraphQLClient) SetUrl ¶ added in v0.2.0
func (client *GraphQLClient) SetUrl(baseUrl string) error
Set the endpoint URL from a string.
type GraphQLError ¶
type GraphQLError struct {
Message string `json:"message"`
Locations []GraphQLErrorLocation `json:"locations"`
Path []interface{} `json:"path"`
Extensions map[string]interface{} `json:"extensions"`
}
func (GraphQLError) Error ¶
func (err GraphQLError) Error() string
type GraphQLErrorList ¶
type GraphQLErrorList []GraphQLError
func (GraphQLErrorList) Error ¶
func (errs GraphQLErrorList) Error() string
type GraphQLErrorLocation ¶
type GraphQLRequest ¶
type GraphQLRequest struct {
// The URL to request from.
// If a URL was provided to the client, you can leave this empty.
Url string
// Headers to include in the request.
// Headers provided here will override the ones provided in the client.
Header http.Header
// The GraphQL query string.
Query string
// The input variable type. Should be JSON-marshalable.
// Minigen automatically generates these types where applicable.
Variables interface{}
// If multiple queries are included in the Query string,
// provide the name of the query to execute.
OperationName string
}
Input type for GraphQLClient.Do()
Click to show internal directories.
Click to hide internal directories.