Skip to content

Instantly share code, notes, and snippets.

@gauravtiwari
Created October 2, 2016 10:23
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 gauravtiwari/226f19ea30583662ac9e4a36cea39d17 to your computer and use it in GitHub Desktop.
Save gauravtiwari/226f19ea30583662ac9e4a36cea39d17 to your computer and use it in GitHub Desktop.
A list of queries declared in ruby to execute against given graphql server
IndexQuery = API::Client.parse <<-'GRAPHQL'
query {
root {
id,
tags,
posts(first: 10) {
edges {
node {
id,
title,
slug,
excerpt,
voted,
user_id,
created_at,
comments_count,
tags,
votes_count,
user {
name,
}
}
}
pageInfo {
hasNextPage
}
}
}
}
GRAPHQL
ShowQuery = API::Client.parse <<-'GRAPHQL'
query($id: ID!) {
node(id: $id) {
id
... on Post {
id,
title,
slug,
body,
voted,
user_id,
created_at,
comments_count,
tags,
votes_count,
user {
name,
}
comments(first: 10, order: "-id") {
edges {
node {
id,
votes_count,
voted,
id,
body,
is_owner,
votes_count,
voted,
created_at,
user {
name,
},
}
},
pageInfo {
hasNextPage
}
}
}
}
}
GRAPHQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment