diff --git a/README.md b/README.md index 8e7bd57..6e9114d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ - [Attendance WebApp UI](#attendance-webapp-ui) - [Refer to the Wiki for details on the project](#refer-to-the-wiki-for-details-on-the-project) - [Project general guidelines](#project-general-guidelines) + - [API/Services Architectures](#apiservices-architectures) + - [Extra mermaid diagram](#extra-mermaid-diagram) - [Setup](#setup) - [Build Web Package](#build-web-package) - [Maven Build](#maven-build) @@ -72,6 +74,28 @@ To find out more, visit: 3. Latest releases by using git tags 4. API references. API docs +## API/Services Architectures +```mermaid +graph LR + REST --> JSON + REST --> XML + REST --> Webhooks + REST --> gRPC + REST --> GraphQL + REST --> WebSockets + gRPC --> Protobuf + GraphQL --> Queries + GraphQL --> Mutations + WebSockets --> Full-duplex-communication + WebSockets --> Real-time-updates + Webhooks --> HTTP-callbacks + Webhooks --> Event-driven-architecture +``` +## Extra mermaid diagram +circular references + +[![](https://mermaid.ink/img/pako:eNptksEOgjAQRH-F7Fl-gIMXNV4wUTDx0kulKxCEklIOhvDvtmAoXeypfTOdySY7QCYFQgS54m0RxAlrAnOSU3oPwnAf5Mn1QNDZOm8xoQ98pjKrUHdboZCyMngWbOIkWAdBXvRCafRa8KJ_30n6mrpx1pQWEM3rcF5SQwTXRARvRqL9KZve2yqHvSKHaY1TXCfsoEZV81KYBRislYEusEYGkbkKrioGrBmNj_dapp8mg-jF3x3uoG8F13gsuVmceqEoSi3VZV6pabPGL4act8s?type=png)](https://mermaid.live/edit#pako:eNptksEOgjAQRH-F7Fl-gIMXNV4wUTDx0kulKxCEklIOhvDvtmAoXeypfTOdySY7QCYFQgS54m0RxAlrAnOSU3oPwnAf5Mn1QNDZOm8xoQ98pjKrUHdboZCyMngWbOIkWAdBXvRCafRa8KJ_30n6mrpx1pQWEM3rcF5SQwTXRARvRqL9KZve2yqHvSKHaY1TXCfsoEZV81KYBRislYEusEYGkbkKrioGrBmNj_dapp8mg-jF3x3uoG8F13gsuVmceqEoSi3VZV6pabPGL4act8s) + ## Setup > Tested in Win11 with WSL, Github codespaces and Ubuntu22 diff --git a/src/main/java/clients/GraphQL/GraphQLClient.java b/src/main/java/clients/GraphQL/GraphQLClient.java new file mode 100644 index 0000000..e9fc8f3 --- /dev/null +++ b/src/main/java/clients/GraphQL/GraphQLClient.java @@ -0,0 +1,31 @@ +import com.graphql.java.client.GraphQLClient; +import com.graphql.java.client.GraphQLClientBuilder; +import com.graphql.java.client.GraphQLRequest; +import com.graphql.java.client.GraphQLResponse; + +public class GraphQLClient { + + private final GraphQLClient graphQLClient; + + public GraphQLClientExample(String graphQLAPIEndpointURL) { + graphQLClient = GraphQLClientBuilder.newClient(graphQLAPIEndpointURL).build(); + } + + public GraphQLResponse executeQuery(String query) { + GraphQLRequest graphQLRequest = new GraphQLRequest(query); + return graphQLClient.execute(graphQLRequest); + } + + public static void main(String[] args) { + GraphQLClientExample graphQLClientExample = new GraphQLClientExample("https://graphql.example.com"); + + // Execute a GraphQL query + GraphQLResponse graphQLResponse = graphQLClientExample.executeQuery("{ hello }"); + + // Parse the GraphQL response + String hello = graphQLResponse.getData().get("hello").toString(); + + // Print the result + System.out.println(hello); + } +} \ No newline at end of file