{"id":15045076,"url":"https://github.com/emiperez/repeson","last_synced_at":"2026-02-24T07:31:50.726Z","repository":{"id":57719056,"uuid":"271549813","full_name":"emiperez/repeson","owner":"emiperez","description":"A JSON-RPC Client for Java","archived":false,"fork":false,"pushed_at":"2022-11-16T02:40:37.000Z","size":113,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T13:23:36.495Z","etag":null,"topics":["asynchronous","java-11","java-11-http-client","json-rpc","json-rpc-client","json-rpc-transport","json-rpc2","json-rpc2-client"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emiperez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-11T13:13:06.000Z","updated_at":"2023-07-13T20:15:28.000Z","dependencies_parsed_at":"2022-08-27T19:40:23.763Z","dependency_job_id":null,"html_url":"https://github.com/emiperez/repeson","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emiperez%2Frepeson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emiperez%2Frepeson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emiperez%2Frepeson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emiperez%2Frepeson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emiperez","download_url":"https://codeload.github.com/emiperez/repeson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243451605,"owners_count":20293168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","java-11","java-11-http-client","json-rpc","json-rpc-client","json-rpc-transport","json-rpc2","json-rpc2-client"],"created_at":"2024-09-24T20:51:25.619Z","updated_at":"2026-02-24T07:31:45.695Z","avatar_url":"https://github.com/emiperez.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# repeson\nA JSON-RPC Client for Java.\nIt uses the HttpClient of JDK11, so requests can be sent either blocking (synchronous) or not blocking (asynchronous)\n## How to use it\n### 1. Adding the dependency to your project\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.emiperez.repeson\u003c/groupId\u003e\n  \u003cartifactId\u003erepeson\u003c/artifactId\u003e\n  \u003cversion\u003e0.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n### 2. Configuring the Transport\n1. Currently only HTTP/HTTPS Transport has been developed.\n1. Create a new [HttpClient](https://openjdk.java.net/groups/net/httpclient/intro.html) and Configure it with any HTTP related properties (Authentication, Proxy, Cookie Handler, SSL and so on)\n1. Build a new `HttpTransport` and inject the `HttpClient` to it\n```java\nTransport transport = HttpTransport.builder(httpClient).uri(uri).contentType(contentType).build();\n```\n### 3. Building the JsonRpcClient\n```java\nJsonRpcClient jsonRpcClient = JsonRpcClient.builder()\n\t\t\t\t\t.transport(transport)\n\t\t\t\t\t.version(JsonRpcVersion.v2_0)\n\t\t\t\t\t.idGenerator(idGenerator)\n\t\t\t\t\t.build();\n```\n### 4.- Sending the Request and getting the Response\nSynchronous or blocking:\n```java\nJsonRpcResponse\u003cCustomer\u003e r = jsonRpcClient.sendRequestWithDefaults(\"getcustomer\", paramsPojo);\nr.ifHasResultOrElse(customer -\u003e System.out.println(customer.getName(),\n\t\t\t\t\t\t\t\t() -\u003e System.out.println(\"No customer returned\"));\n```\nor Asynchronous (not blocking)\n```java\nCompletableFuture\u003cCustomer\u003e cc = jsonRpcClient\n  .sendRequestWithDefaultsAsync(\"getcustomer\", paramsPojo)\n  .thenApply(JsonRpcResponse::getResult);\n```\nIf the returned Type uses Generics, for example; `ArrayList\u003cCustomer\u003e`, to prevent the [Type Erasure](https://docs.oracle.com/javase/tutorial/java/generics/erasure.html), a class file, that extends JsonRpcResponse must be created,\n```java\npublic class CustomerListResponse extends JsonRpcResponse\u003cArrayList\u003cCustomer\u003e\u003e {}\n```\nand passed as an argument to send methods:\n```java\nCustomerListResponse r = jsonRpcClient.sendRequestWithDefaults(\"listcustomers\", paramsPojo, \n\t\t\t\t\t\t\t\tCustomerListResponse.class);\nif (r.hasResult()) {\n  ArrayList\u003cCustomer\u003e cs = r.getResult();\n  //Do whatever with cs\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femiperez%2Frepeson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femiperez%2Frepeson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femiperez%2Frepeson/lists"}