SlideShare a Scribd company logo
1 of 40
Download to read offline
Exploring GraphQL
Kami
Proprietary & Confidential
Outline
• Introduction
• Queries & Mutations
• Schemas & Types
• Integrate with Android
• Coming issues
• Reference
Proprietary & Confidential
What is GraphQL ?
• A query language for APIs
• Specification for server-side to execute queries
• Single endpoint
Proprietary & Confidential
Why GraphQL ?
• Ask for what you need, get exactly that
• Get many resources in a single request
Proprietary & Confidential
GraphQL Example
Proprietary & Confidential
Queries & Mutations
Proprietary & Confidential
Fields
Proprietary & Confidential
Proprietary & Confidential
Arguments
Proprietary & Confidential
Aliases
Proprietary & Confidential
Fragments
Proprietary & Confidential
Queries
Proprietary & Confidential
Variables
Proprietary & Confidential
Mutations
Proprietary & Confidential
Schemas & Types
Proprietary & Confidential
Object types
Proprietary & Confidential
Arguments
Proprietary & Confidential
Query & Mutation types
Proprietary & Confidential
Proprietary & Confidential
Scalar types
• Int
• Float
• String
• Boolean
• ID
Proprietary & Confidential
Enum types
Proprietary & Confidential
Interfaces
Proprietary & Confidential
Proprietary & Confidential
Union types
Proprietary & Confidential
Proprietary & Confidential
Input types
Proprietary & Confidential
Integrate with Android
Proprietary & Confidential
Gradle
• build.gradle
classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.0-alpha'
• app/build.gradle
apply plugin: 'com.apollographql.android'
implementation 'com.apollographql.apollo:apollo-runtime:1.0.0-alpha'
implementation 'com.apollographql.apollo:apollo-android-support:1.0.0-alpha'
Proprietary & Confidential
Codegen
• Use Apollo GraphQL code generator
$ apollo-codegen introspect-schema https://{ip}/graphql --output schema.json
Proprietary & Confidential
Proprietary & Confidential
OkHttp Support
val okHttpClient = OkHttpClient.Builder()
.addNetWorkInterceptor(interceptor)
.build()
Proprietary & Confidential
Apollo Client
val apolloClient = ApolloClient.builder()
.serverUrl(BASE_URL)
.okHttpClient(okHttpClient)
.build()
Proprietary & Confidential
Query Request
val trendQuery = TrendQuery.builder()
.first(25)
.query("Android Taipei")
.type(SearchType.REPOSITORY)
.build()
Proprietary & Confidential
ApolloCall & execute
val apolloCall = apolloClient.query(trendQuery)
apolloCall.enqueue(object : ApolloCall.Callback<TrendQuery.Data>() {
override fun onResponse(response: Response<TrendQuery.Data>) {}
override fun onFailure(e: ApolloException) {}
})
Proprietary & Confidential
RxJava Support
Rx2Apollo.from(apolloClient.query(trendQuery))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
Proprietary & Confidential
Coming issues
• Multiple schemas ?
• Mock API response
Proprietary & Confidential
Multiple schemas ?
Proprietary & Confidential
Mock API response
Proprietary & Confidential
Reference
• https://graphql.org/
• https://github.com/apollographql/apollo-cli/tree/apollo-codegen
• https://github.com/apollographql/apollo-android
• https://developer.github.com/v4/
Proprietary & Confidential
Thank you : )

More Related Content

Similar to Exploring GraphQL

Similar to Exploring GraphQL (9)

Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019
 
Ui devopler
Ui devoplerUi devopler
Ui devopler
 
Web designing course content
Web designing course contentWeb designing course content
Web designing course content
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
 
Software Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with ScalaSoftware Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with Scala
 
Joining Data From Different Source: Many options, but Which to See?
Joining Data From Different Source: Many options, but Which to See?Joining Data From Different Source: Many options, but Which to See?
Joining Data From Different Source: Many options, but Which to See?
 
Oracle apps technical online training in USA
Oracle apps technical online training in USAOracle apps technical online training in USA
Oracle apps technical online training in USA
 

Recently uploaded

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 

Exploring GraphQL