diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-05 22:03:19 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-05 22:33:03 +0100 |
commit | 1d4bb7ceb0cef79d68df0bacc913b01e40e6ddd6 (patch) | |
tree | e088b0fa43058afde1db71541d8fcb4b94905d6e /vendor/github.com/shurcooL/githubv4/githubv4.go | |
parent | f093be96e98284580d61664adecd0a2ff8b354e4 (diff) | |
download | git-bug-1d4bb7ceb0cef79d68df0bacc913b01e40e6ddd6.tar.gz |
migrate to go modules
Diffstat (limited to 'vendor/github.com/shurcooL/githubv4/githubv4.go')
-rw-r--r-- | vendor/github.com/shurcooL/githubv4/githubv4.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/vendor/github.com/shurcooL/githubv4/githubv4.go b/vendor/github.com/shurcooL/githubv4/githubv4.go deleted file mode 100644 index 3a544bf2..00000000 --- a/vendor/github.com/shurcooL/githubv4/githubv4.go +++ /dev/null @@ -1,56 +0,0 @@ -package githubv4 - -import ( - "context" - "net/http" - - "github.com/shurcooL/graphql" -) - -// Client is a GitHub GraphQL API v4 client. -type Client struct { - client *graphql.Client -} - -// NewClient creates a new GitHub GraphQL API v4 client with the provided http.Client. -// If httpClient is nil, then http.DefaultClient is used. -// -// Note that GitHub GraphQL API v4 requires authentication, so -// the provided http.Client is expected to take care of that. -func NewClient(httpClient *http.Client) *Client { - return &Client{ - client: graphql.NewClient("https://api.github.com/graphql", httpClient), - } -} - -// NewEnterpriseClient creates a new GitHub GraphQL API v4 client for the GitHub Enterprise -// instance with the specified GraphQL endpoint URL, using the provided http.Client. -// If httpClient is nil, then http.DefaultClient is used. -// -// Note that GitHub GraphQL API v4 requires authentication, so -// the provided http.Client is expected to take care of that. -func NewEnterpriseClient(url string, httpClient *http.Client) *Client { - return &Client{ - client: graphql.NewClient(url, httpClient), - } -} - -// Query executes a single GraphQL query request, -// with a query derived from q, populating the response into it. -// q should be a pointer to struct that corresponds to the GitHub GraphQL schema. -func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { - return c.client.Query(ctx, q, variables) -} - -// Mutate executes a single GraphQL mutation request, -// with a mutation derived from m, populating the response into it. -// m should be a pointer to struct that corresponds to the GitHub GraphQL schema. -// Provided input will be set as a variable named "input". -func (c *Client) Mutate(ctx context.Context, m interface{}, input Input, variables map[string]interface{}) error { - if variables == nil { - variables = map[string]interface{}{"input": input} - } else { - variables["input"] = input - } - return c.client.Mutate(ctx, m, variables) -} |