cli/shurcooL-graphql is a open-source project on GitHub, written primarily in Go. It has 29 stars. Package graphql provides a GraphQL client implementation.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Package graphql provides a GraphQL client implementation, and is forked from https://github.com/shurcooL/graphql.
Installation
go get -u github.com/cli/shurcooL-graphql
Usage
Construct a GraphQL client, specifying the GraphQL server URL. Then, you can use it to make GraphQL queries and mutations.
client := graphql.NewClient("https://example.com/graphql", nil)
// Use client...
Authentication
Some GraphQL servers may require authentication. The graphql package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an http.Client that performs authentication. The easiest and recommended way to do this is to use the golang.org/x/oauth2 package. You'll need an OAuth token with the right scopes. Then:
However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names:
var q struct {
Human struct {
Name graphql.String
Height graphql.Float `graphql:"height(unit: $unit)"`
} `graphql:"human(id: $id)"`
}
Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that.
For example, to make the following GraphQL mutation:
mutation($ep: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
}
variables {
"ep": "JEDI",
"review": {
"stars": 5,
"commentary": "This is a great movie!"
}
}
You can define:
var m struct {
CreateReview struct {
Stars graphql.Int
Commentary graphql.String
} `graphql:"createReview(episode: $ep, review: $review)"`
}
variables := map[string]any{
"ep": starwars.Episode("JEDI"),
"review": starwars.ReviewInput{
Stars: graphql.Int(5),
Commentary: graphql.String("This is a great movie!"),
},
}
Then call client.Mutate:
err := client.Mutate(context.Background(), &m, variables)
if err != nil {
// Handle error.
}
fmt.Printf("Created a %v star review: %v\n", m.CreateReview.Stars, m.CreateReview.Commentary)
// Output:
// Created a 5 star review: This is a great movie!
No homepage URL was recorded for cli/shurcooL-graphql in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How many stars does cli/shurcooL-graphql have?
cli/shurcooL-graphql has 29 GitHub stars — refresh the page for the live number, or check github.com/cli/shurcooL-graphql. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is cli/shurcooL-graphql open source?
Yes — cli/shurcooL-graphql ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/cli/shurcooL-graphql.
What is cli/shurcooL-graphql?
cli/shurcooL-graphql (cli/shurcooL-graphql) is a Go project on GitHub. From the project's own README: Package graphql provides a GraphQL client implementation.
Where do I read more about cli/shurcooL-graphql?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/cli/shurcooL-graphql is the definitive source.
Read full README in the tab above.
Is shurcooL-graphql worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of shurcooL-graphql.