Documentation
¶
Index ¶
- func GetGraphQLAPIForHost(host string) string
- func GetV3APIForHost(host string) string
- func Mask(in string) string
- func ReplaceAllGroupFunc(re *regexp.Regexp, str string, repl func([]string) string) string
- type Client
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Download(url string) (*http.Response, error)
- func (c *Client) GraphQL(host string, query string, variables map[string]interface{}, data interface{}) error
- func (c *Client) REST(host string, method string, path string, body io.Reader, data interface{}) error
- type ClientOption
- type FakeHTTP
- func (f *FakeHTTP) RoundTrip(req *http.Request) (*http.Response, error)
- func (f *FakeHTTP) StubForkedRepoResponse(forkFullName, parentFullName string)
- func (f *FakeHTTP) StubRepoResponse(owner, repo string)
- func (f *FakeHTTP) StubRepoResponseWithPermission(owner, repo, permission string)
- func (f *FakeHTTP) StubResponse(status int, body io.Reader)
- func (f *FakeHTTP) StubWithFixture(status int, fixtureFileName string) func()
- type GraphQLError
- type GraphQLErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGraphQLAPIForHost ¶
func GetV3APIForHost ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client facilitates making HTTP requests to the GitHub API.
func NewClient ¶
func NewClient(authConfig auth.Config, opts ...ClientOption) *Client
NewClient initializes a Client.
type ClientOption ¶
type ClientOption = func(http.RoundTripper) http.RoundTripper
ClientOption represents an argument to NewClient.
func AddAuthorizationHeader ¶
func AddAuthorizationHeader(config auth.Config) ClientOption
AddAuthorizationHeader turns a RoundTripper into one that adds an authorization header.
func AddHeader ¶
func AddHeader(name, value string) ClientOption
AddHeader turns a RoundTripper into one that adds a request header.
func ReplaceTripper ¶
func ReplaceTripper(tr http.RoundTripper) ClientOption
ReplaceTripper substitutes the underlying RoundTripper with a custom one.
type FakeHTTP ¶
type FakeHTTP struct { // Requests stores references to sequential requests that RoundTrip has received Requests []*http.Request // contains filtered or unexported fields }
FakeHTTP provides a mechanism by which to stub HTTP responses through.
func (*FakeHTTP) StubForkedRepoResponse ¶
func (*FakeHTTP) StubRepoResponse ¶
func (*FakeHTTP) StubRepoResponseWithPermission ¶
func (*FakeHTTP) StubResponse ¶
StubResponse pre-records an HTTP response.
func (*FakeHTTP) StubWithFixture ¶
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
Click to show internal directories.
Click to hide internal directories.