Skip to content

Instantly share code, notes, and snippets.

@SonPatrick
Forked from amanjeetsingh150/QueryingApollo.kt
Created May 17, 2019 12:40
Show Gist options
  • Save SonPatrick/c0be9e4feec21a0ff7458fd912f054a2 to your computer and use it in GitHub Desktop.
Save SonPatrick/c0be9e4feec21a0ff7458fd912f054a2 to your computer and use it in GitHub Desktop.
client=setupApollo()
client.query(FindQuery //From the auto generated class
.builder()
.name(repo_name_edittext.text.toString()) //Passing required arguments
.owner(owner_name_edittext.text.toString()) //Passing required arguments
.build())
.enqueue(object : ApolloCall.Callback<FindQuery.Data>() {
override fun onFailure(e: ApolloException) {
Log.info(e.message.toString())
}
override fun onResponse(response: Response<FindQuery.Data>) {
Log.info(" " + response.data()?.repository())
runOnUiThread({
progress_bar.visibility = View.GONE
name_text_view.text = String.format(getString(R.string.name_text),
response.data()?.repository()?.name())
description_text_view.text = String.format(getString(R.string.description_text),
response.data()?.repository()?.description())
forks_text_view.text = String.format(getString(R.string.fork_count_text),
response.data()?.repository()?.forkCount().toString())
url_text_view.text = String.format(getString(R.string.url_count_text),
response.data()?.repository()?.url().toString())
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment