I am new to GraphQL, but now I am using Retrofit and it is easy to use and fast. GraphQL is very different from the rest of apis in terms of how you pass the data. There really aren't many tutorials on using GraphQL with Android, I could find this video ( https://www.youtube.com/watch?v=P0uJHI7GjIc&t=1s ), but there is no real code.
In my current code for callbacks, I have an endpoint that I set like this:
final RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(endPoint) .build(); T service = restAdapter.create(clazz);
Then I call the recreation service as follows:
@GET("/users/{login}") Observable<Github> getUser(@Path("login") String login);
Now with GraphQL you only have the base URL and there is no path to the service. In addition, if you are querying as userId = 1, then you need to send the Post parameters with the body:
operationName: arbitrary name , query: "{users(userid:$userId){username}}, variables: "{"userId":1}"
I'm just not sure how this translates to "Retrofit"
source share