More Related Content
Similar to Exploring GraphQL (9)
Exploring GraphQL
- 28. 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'
- 34. 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) {}
})
- 35. Proprietary & Confidential
RxJava Support
Rx2Apollo.from(apolloClient.query(trendQuery))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
- 39. 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/