Skip to content

thalescm/kuestioner

Repository files navigation

Kuestioner

A lightweight kotlin query builder and client for GraphQL


Build Status Download


Warning

THIS LIBRARY IS STILL IN EXPERIMENTAL PHASE. But I'm open to contributions and ideas!


Basic usage

// 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} }"
}

Query with parameters

@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}}"
}

Installation

Add the dependency:

dependencies {
    compile 'br.com.thalesmachado:kuestioner:0.1.1'
}

RoadMap

  • Make a complete API following graphQL language:
  • Integrate with Retrofit to enable this as a parameter to requests, and parse the response accordingly

About

A lightweight kotlin query generator for GraphQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages