Documentation
¶
Index ¶
- func EndpointNeedsScopes(resp *http.Response, s string) *http.Response
- func HandleHTTPError(resp *http.Response) error
- func ScopesSuggestion(resp *http.Response) string
- type Client
- func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, ...) error
- func (c *Client) HTTP() *http.Client
- func (c Client) Mutate(hostname, name string, mutation interface{}, variables map[string]interface{}) error
- func (c Client) Query(hostname, name string, query interface{}, variables map[string]interface{}) error
- func (c Client) QueryWithContext(ctx context.Context, hostname, name string, query interface{}, ...) error
- func (c Client) REST(hostname string, method string, p string, body io.Reader, data interface{}) error
- func (c Client) RESTWithNext(hostname string, method string, p string, body io.Reader, data interface{}) (string, error)
- type GraphQLError
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndpointNeedsScopes ¶
EndpointNeedsScopes adds additional OAuth scopes to an HTTP response as if they were returned from the server endpoint. This improves HTTP 4xx error messaging for endpoints that don't explicitly list the OAuth scopes they need.
func HandleHTTPError ¶
HandleHTTPError parses a http.Response into a HTTPError.
func ScopesSuggestion ¶
ScopesSuggestion is an error messaging utility that prints the suggestion to request additional OAuth scopes in case a server response indicates that there are missing scopes.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromHTTP ¶
func (Client) GraphQL ¶
func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, data interface{}) error
GraphQL performs a GraphQL request using the query string and parses the response into data receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
func (Client) Mutate ¶
func (c Client) Mutate(hostname, name string, mutation interface{}, variables map[string]interface{}) error
Mutate performs a GraphQL mutation based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
func (Client) Query ¶
func (c Client) Query(hostname, name string, query interface{}, variables map[string]interface{}) error
Query performs a GraphQL query based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
func (Client) QueryWithContext ¶
func (c Client) QueryWithContext(ctx context.Context, hostname, name string, query interface{}, variables map[string]interface{}) error
QueryWithContext performs a GraphQL query based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
type GraphQLError ¶
type GraphQLError struct {
*ghAPI.GraphQLError
}