Documentation ¶
Index ¶
- type ApiClient
- func (api *ApiClient) CreateGraphQLPayload(query string, variables map[string]interface{}) (*bytes.Buffer, error)
- func (api *ApiClient) Post(ctx context.Context, payload interface{}, ...) (*http.Response, error)
- func (api *ApiClient) SendGraphQLQuery(ctx context.Context, query string, variables map[string]interface{}) (*ApiResponse, error)
- type ApiResponse
- type ApiResponseParsed
- type GQLApiErrors
- type GraphQLOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct { Endpoint string Header http.Header // contains filtered or unexported fields }
func (*ApiClient) CreateGraphQLPayload ¶
func (*ApiClient) SendGraphQLQuery ¶
type ApiResponse ¶
type ApiResponse struct { Data *json.RawMessage `json:"data"` Errors GQLApiErrors `json:"errors"` // contains filtered or unexported fields }
func (*ApiResponse) DecodeIntoInterface ¶
func (r *ApiResponse) DecodeIntoInterface() (target interface{}, err error)
func (*ApiResponse) GetBody ¶
func (r *ApiResponse) GetBody() []byte
func (*ApiResponse) GetResponse ¶
func (r *ApiResponse) GetResponse() *http.Response
func (*ApiResponse) GetStringBody ¶
func (r *ApiResponse) GetStringBody() string
func (*ApiResponse) GetStringReader ¶
func (r *ApiResponse) GetStringReader() *strings.Reader
type ApiResponseParsed ¶
type ApiResponseParsed struct { Data map[string]interface{} `json:"data"` Errors GQLApiErrors `json:"errors"` }
type GQLApiErrors ¶
GQLApiErrors represents the "errors" array in a response from a GraphQL server. If returned via error interface, the slice is expected to contain at least 1 element.
Specification: https://facebook.github.io/graphql/#sec-Errors.
func (GQLApiErrors) Error ¶
func (e GQLApiErrors) Error() string
Error implements error interface for GQLApiErrors.
type GraphQLOperation ¶
type GraphQLOperation string
const ( GraphQLQuery GraphQLOperation = "query" GraphQLMutation GraphQLOperation = "mutation" )
Click to show internal directories.
Click to hide internal directories.