Documentation ¶
Index ¶
- Variables
- func BatchQuery[T any](ctx context.Context, c *Client, queries map[string]string, vars map[string]any) (map[string]T, error)
- func ErrorResponseStatusCode(err error) int
- func NewRetryRoundTripper(rt http.RoundTripper, logger *zap.Logger) http.RoundTripper
- type Client
- type GraphQLError
- type GraphQLErrors
Constants ¶
This section is empty.
Variables ¶
var ErrGraphQLNotFound = errors.New("GraphQL resource not found")
ErrGraphQLNotFound is an error used to test when GitHub GraphQL query returns a single error with the type "NOT_FOUND".
It should be used with errors.Is.
Functions ¶
func BatchQuery ¶
func BatchQuery[T any](ctx context.Context, c *Client, queries map[string]string, vars map[string]any) (map[string]T, error)
BatchQuery can be used to batch a set of requests together to GitHub's GraphQL API.
func ErrorResponseStatusCode ¶
ErrorResponseStatusCode will unwrap a github.ErrorResponse and return the status code inside.
If the error is nil, or not an ErrorResponse it will return a status code of 0.
func NewRetryRoundTripper ¶
func NewRetryRoundTripper(rt http.RoundTripper, logger *zap.Logger) http.RoundTripper
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides simple access to GitHub's REST and GraphQL APIs.
type GraphQLError ¶
type GraphQLError struct { Message string Type string // GitHub specific GraphQL error field Locations []struct { Line int Column int } }
GraphQLError stores the error result from a GitHub GraphQL query.
type GraphQLErrors ¶
type GraphQLErrors struct {
// contains filtered or unexported fields
}
GraphQLErrors wraps all the errors returned by a GraphQL response.
func (*GraphQLErrors) Error ¶
func (e *GraphQLErrors) Error() string
Error implements error interface.
func (*GraphQLErrors) Errors ¶
func (e *GraphQLErrors) Errors() []GraphQLError
Errors returns a slice with each Error returned by the GraphQL API.
func (*GraphQLErrors) HasType ¶
func (e *GraphQLErrors) HasType(t string) bool
HasType returns true if one of the errors matches the supplied type.
func (*GraphQLErrors) Is ¶
func (e *GraphQLErrors) Is(target error) bool
Is implements the errors.Is interface.