A lightweight kotlin query builder and client for GraphQL
THIS LIBRARY IS STILL IN EXPERIMENTAL PHASE. But I'm open to contributions and ideas!
// Define the models you want to query for (they can be nested) with the `@Queryable` annotation
@Queryable
class Person (
val name : String,
val age : Int
)
Then use Kuestioner to build the query for this class
val query = Kuestioner.queryOn(Person::class.java)
The result will be a kotlin object corresponding to:
{
"query" : "{ person {name age} }"
}
@Queryable(query = "id")
class Person (
val name : String,
val age : Int
)
Then use Kuestioner to build the query for this class
val query = Kuestioner.queryOn(
Person::class.java,
mapOf("id" to "12")
)
The result will be
{
"query" : "{ person(id: 12) {name age}}"
}
Add the dependency:
dependencies {
compile 'br.com.thalesmachado:kuestioner:0.1.1'
}
- Make a complete API following graphQL language:
- Integrate with Retrofit to enable this as a parameter to requests, and parse the response accordingly