GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kingdevnl/Java-GraphQL-Client: Simple & Lightweight GraphQL client for Java With Async and subscriptions Support!

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
gradle/wrapper
gradle/wrapper
 
 
src
src
 
 
.gitignore
.gitignore
 
 
Jenkinsfile
Jenkinsfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Java-GraphQL-Client

Simple & Lightweight GraphQL client for Java With Async and subscriptions Support!

Build Status

The dependencies of this project are:

  • Google GSON (https://mvnrepository.com/artifact/com.google.code.gson/gson)
  • Apache HttpClient (https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient)
  • Java-WebSocket (https://github.com/TooTallNate/Java-WebSocket)
    
    //Data class
    public class User {
        public String id, name, email;
    }

    //Create a client object
    Client client = new Client("https://api.mocki.io/v1/44cb3920");
    
    //For example we can set global variables and headers
    client.setGlobalVariable("someId", "1");
    client.setHeader("auth", "someAuthToken")

    //Find a user in the GraphQL api
    User user = client.query(
            new Query("query user($id: ID!) { user(id: $id) { id, name, email } }").setVariable("id", "1"))
            .get("user", User.class);
    System.out.println(user)

    //Subscriptions 
    client.setupWebsocket(() -> {
        System.out.println("Ready!");
        client.subscribe(new Query("subscription {commentAdded}"), data -> System.out.println("commentAdded: "+data.getRawJson()));
    }, (code, reason, remote)-> System.out.println("Websocket was close code: "+code + " reason: "+reason));

   //To close the client call
   client.closeClient();

About

Simple & Lightweight GraphQL client for Java With Async and subscriptions Support!

Topics

graphqlgraphql-clientjava

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.