Last active
April 3, 2019 10:28
-
-
Save martinbonnin/e3922f19f1e8f55a083cc5cf8919f42d to your computer and use it in GitHub Desktop.
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
val repositoriesQuery = GithubRepositoriesQuery.builder() | |
.repositoriesCount(50) | |
.orderBy(RepositoryOrderField.UPDATED_AT) | |
.orderDirection(OrderDirection.DESC) | |
.build() | |
val callback = ApolloCallback.wrap(object : ApolloCall.Callback<GithubRepositoriesQuery.Data>() { | |
override fun onResponse(response: Response<GithubRepositoriesQuery.Data>) { | |
val repositories = mapResponseToRepositories(response) | |
repositoriesAdapter.setItems(repositories) | |
} | |
override fun onFailure(e: ApolloException) { | |
e.printStackTrace() | |
} | |
}, Handler(Looper.getMainLooper())) | |
apolloClient | |
.query(repositoriesQuery) | |
.httpCachePolicy(HttpCachePolicy.CACHE_FIRST) | |
.enqueue(callback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment