A Java client that you can use to work with the public chy.stat API.
To install chy.stat API client with Maven2/3, you can use the library version available in Maven Central by adding the following dependency
<dependencies>
<dependency>
<groupId>cz.diribet</groupId>
<artifactId>chystat-api-client-java</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
To use the client you have to provide
- base URL
- JwtTokenProvider
and optionally an Gson object
It's a base URL. All request are then evaluated relative to this URL. For example
"https://some.chystat.site/api/v1"
We use Gson to serialize a Java object to the request body and deserialize response body to a Java object respectively.
All requests to the chy.stat API are authenticated and authorized. We use HMAC authentication and JWT (JSON Web Tokens)
You can use the default provider implementation which generates the JWT token for you. See API documentation where is described how to get the required token ID and the token secret.
String baseUrl = "https://some.chystat.site/api/v1"
String tokenId = "i54m56W5R2aJVw/JYq1wIQ"
String tokenSecret = "CFu5345NWMR2E4eP"
JwtTokenProvider jwtTokenProvider = new DefaultJwtTokenProvider(tokenId, tokenSecret);
IApiClient client = new ChystatApiClient(baseUrl, jwtTokenProvider);
ResponsePayload responsePayload = client.get("/orders/orders/1")
See the current API documentation for more details about the API and authentication.
Please feel free to open a GitHub Issue, or a pull Request if you find any bug or if you have some idea for improvement.
This project is licensed under the terms of the MIT license.