Last active
July 12, 2018 21:14
-
-
Save sgrove/5f17d046e535763c3c85258054ed00fb to your computer and use it in GitHub Desktop.
Example multi-service query with OneGraph and GraphQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
## Retrieve a YouTube video by its id | |
youTubeVideo(id: "YX40hbAHx3s") { | |
snippet { | |
# Pull out the title | |
title | |
# Jump to the channel the video was uploaded to | |
uploadChannel { | |
snippet { | |
# Get the title of the channel | |
title | |
} | |
# Find all of the Twitter accounts associated with the YouTube channel | |
twitterLinks { | |
# Retrieve the first 5 tweets for each account | |
twitter(first: 5) { | |
tweets { | |
# For each tweet, pull out the text body | |
text | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": { | |
"youTubeVideo": { | |
"snippet": { | |
"title": "P vs. NP and the Computational Complexity Zoo", | |
"uploadChannel": { | |
"snippet": { | |
"title": "hackerdashery" | |
}, | |
"twitterLinks": [ | |
{ | |
"twitter": { | |
"tweets": [ | |
{ | |
"text": "RT @hankgreen: \"The universe is math on fire\" - Afterworlds, @ScottWesterfeld" | |
}, | |
{ | |
"text": "RT @carlzimmer: My @nytimes column this week: Can game theory fight cancer? http://t.co/WLaKrZM5T3" | |
}, | |
{ | |
"text": "RT @mitchellmoffit: How to make a baby - this gif is amazing! http://t.co/4v4TI5Enrg" | |
}, | |
{ | |
"text": "RT @vihartvihart: This game shows how good intentions lead to systemic problems. http://t.co/wlJ9jyr5KB Public domain. @ncasenmare http://t…" | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment