Skip to content

Instantly share code, notes, and snippets.

@balwa
Last active August 4, 2019 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balwa/5f01aaae58bb959f1e77d892a9c1ac4c to your computer and use it in GitHub Desktop.
Save balwa/5f01aaae58bb959f1e77d892a9c1ac4c to your computer and use it in GitHub Desktop.
GraphQL github API v4 basic examples
query Basic {
viewer {
login
id
}
}
query Second {
user(login: "<login-name>") {
repositories(first: 12) {
nodes {
name
}
totalCount
totalDiskUsage
}
}
}
mutation CreateRepo {
createRepository(input: {name: "hellographql", visibility: PUBLIC}) {
repository {
url
}
}
}
mutation CreateRepo($input: CreateRepositoryInput!) {
createRepository(input: $input) {
repository {
url
}
}
}
# In query variables
{
"input": {
"name": "hellographql",
"visibility": "PUBLIC"
}
}
query StarredRepos($first: Int = 10) {
user(login: "balwa") {
url
starredRepositories(first: $first, orderBy: {field: STARRED_AT, direction: DESC}) {
nodes {
url
}
}
}
}
query UserStatus{
viewer{
status {
createdAt
message
emoji
}
}
}
query UserGists{
viewer{
gists(first: 10) {
nodes {
...GistsNode
}
}
}
}
fragment GistsNode on Gist {
description
isPublic
url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment