Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Created June 9, 2019 16:25
Show Gist options
  • Save Lavanyagaur22/82cacfc21ac792a39774eb7a3de254c7 to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/82cacfc21ac792a39774eb7a3de254c7 to your computer and use it in GitHub Desktop.
private fun createtask(title: String, description: String) {
Log.e(TAG, "inside create task")
val client = Utils.getApolloClient(this)?.mutate(
CreateTask.builder().title(title).description(description).build()
)?.refetchQueries(object : OperationName {
override fun name(): String {
return AllTasksQuery.OPERATION_DEFINITION
}
})
client?.enqueue(object : ApolloCall.Callback<CreateTask.Data>() {
override fun onFailure(e: ApolloException) {
Log.e("onFailure" + "createTask", e.toString())
}
override fun onResponse(response: Response<CreateTask.Data>) {
val result = response.data()?.createTask()
Log.e(TAG, "onResponse-CreateTask")
Log.e(TAG, "${result?.id()}")
Log.e(TAG, "${result?.title()}")
Log.e(TAG, "${result?.description()}")
Log.e(TAG, "${result?.version()}")
getTasks()
runOnUiThread {
noteslist.clear()
getTasks()
Log.e(TAG, "createTask : ${noteslist.size}")
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment