Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleHTTPError ¶
func NewHTTPClient ¶
func NewHTTPClient(opts ...ClientOption) *http.Client
NewHTTPClient initializes an http.Client
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client facilitates making HTTP requests to the GitHub API
func NewClientFromHTTP ¶
NewClientFromHTTP takes in an http.Client instance
func (Client) GraphQL ¶
func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, data interface{}) error
GraphQL performs a GraphQL request and parses the response
func (Client) HasMinimumScopes ¶
type ClientOption ¶
type ClientOption = func(http.RoundTripper) http.RoundTripper
ClientOption represents an argument to NewClient
func AddHeader ¶
func AddHeader(name, value string) ClientOption
AddHeader turns a RoundTripper into one that adds a request header
func AddHeaderFunc ¶
AddHeaderFunc is an AddHeader that gets the string value from a function
func ReplaceTripper ¶
func ReplaceTripper(tr http.RoundTripper) ClientOption
ReplaceTripper substitutes the underlying RoundTripper with a custom one
func VerboseLog ¶
func VerboseLog(out io.Writer, logTraffic bool, colorize bool) ClientOption
VerboseLog enables request/response logging within a RoundTripper
type GraphQLError ¶
GraphQLError is a single error returned in a GraphQL response
type GraphQLErrorResponse ¶
type GraphQLErrorResponse struct {
Errors []GraphQLError
}
GraphQLErrorResponse contains errors returned in a GraphQL response
func (GraphQLErrorResponse) Error ¶
func (gr GraphQLErrorResponse) Error() string
type MissingScopesError ¶
type MissingScopesError struct {
MissingScopes []string
}
func (MissingScopesError) Error ¶
func (e MissingScopesError) Error() string