Skip to content

Instantly share code, notes, and snippets.

@florent37
Created May 23, 2017 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save florent37/84ae33fa2c0257ac13faa7c8aad06b66 to your computer and use it in GitHub Desktop.
Save florent37/84ae33fa2c0257ac13faa7c8aad06b66 to your computer and use it in GitHub Desktop.
HEADER : Content-Type:application/graphql
graphQl
.query("todos { title }")
.cast(Data.class)
.enqueue(new Callback<Data>(){
public void onResponse(Data data){
}
});
graphQl
.query("todos { title }")
.cast(Data.class)
.rx()
.subscribe(data -> {});
graphQl
.mutation("add (title: "@title") { id, title }")
.cast(Data.class)
.query("title", this.title)
.rx()
.subscribe(data -> {});
graphQl
.query("query HeroNameAndFriends($episode: Episode) {
hero(episode: $episode) {
name
friends {
name
}
}
}")
.cast(Data.class)
.variable("
{
"episode": "@EPISODE"
}
")
.rx()
.subscribe(data -> {});
@Fragment
@Query("todos { title }")
public Observable<Data> getTodos();
$ curl -XPOST -H "Content-Type:application/graphql" -d 'mutation { add (title: "Clean garage") { id, title } }' http://localhost:8080
@Mutation("add (title: "@title") { id, title }")
public Observable<> cleanGarage(@Query("title") String title);
@GraphQlMethod("query")
public Observable<>
@Query("
query HeroNameAndFriends($episode: Episode) {
hero(episode: $episode) {
name
friends {
name
}
}
}
")
@Variable("
{
"episode": "@EPISODE"
}
")
public Observable<Data> heroNameAndFriends(@Query("EPISODE") String episode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment