Skip to content

Latest commit

 

History

History
89 lines (62 loc) · 3.6 KB

README.md

File metadata and controls

89 lines (62 loc) · 3.6 KB

Common Client

Dependency Check Maven Central License

This library helps you to easily create other libraries interacting with services using asynchronous requests and returning CompletableFuture. The serialization and deserialization of domain objects are performed using Jackson.

Presently, it supports the following HTTP clients:

Installation

The dependency is available in maven central (see badge for version):

<dependency>
    <groupId>com.chavaillaz</groupId>
    <artifactId>common-client</artifactId>
</dependency>

Usage

  • Create the interfaces corresponding to every API you want to interact with (e.g. UserApi)
    • Make them extend Client to have methods to set proxy and authentication information
    • Always return completable futures, either CompletableFuture<YourDomainType> or CompletableFuture<Void>
  • Create the authentication method for your service (in case it does not already exist) by extending Authentication
    • Presently, there are token and password authentications available
  • Create an implementation of your interfaces by extending the available abstract classes for each HTTP client
  • Create a central client to manage and get other ones by extending AbstractClient

Contributing

If you have a feature request or found a bug, you can:

  • Write an issue
  • Create a pull request

Code style

The code style is based on the default one from IntelliJ, except for the following cases:

Imports

Imports are ordered as follows:

  • All static imports in a block
  • Java non-static imports in a block
  • All non-static imports in a block

A single blank line separates every block. Within each block the imported names appear in alphabetical sort order. Wildcard imports, static or otherwise, are not used.

License

This project is under Apache 2.0 License.