Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Latest commit

 

History

History

monobank4j-jackson

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Monobank4J with Jackson

Unofficial Java wrapper for Monobank API: get exchange rates (public), get client info and statements and set a webhook to receive transaction events (personal).

It uses Jackson to encode and decode JSON. There are other packages for Gson, Jackson Jr., and JSON-java.

It implements:

  • currency rates

Acquire

The package is not published to Maven Central yet. Use project's GitLab repository instead, please:

<repositories>
  <repository>
    <id>monobank4j-maven</id>
    <url>https://gitlab.example.com/api/v4/projects/28690779/packages/maven</url>
  </repository>
</repositories>

Please add dependency to your project:

<dependency>
  <groupId>uk.bot-by.monobank4j</groupId>
  <artifactId>monobank4j-jackson</artifactId>
  <version>1.1.0</version>
</dependency>

Usage

Currency

Create an instance of currency Monobank Currency API using Currency.getInstance() or with Feign manually, e.g. if you want to use custom client.

currency = Feign.builder()
                .client(new Http2Client())
                .decoder(new JacksonDecoder())
                .target(Currency.class, "https://api.monobank.ua/");

Then just get exchange rates, it's easy:

List<CurrencyInfo> currencyExchangeRates = currency.getRates();

To run the example GetExchangeRates:

  1. Build the whole project: mvn

  2. Go to the monobank4j-jackson and get all dependencies: mvn dependency:copy-dependencies

  3. Then go to target/dependency and run the following to get rates of pound and zloty:

    • java -cp jackson-annotations-2.12.4.jar:jackson-core-2.12.4.jar:jackson-databind-2.12.4.jar:feign-core-11.6.jar:feign-jackson-11.6.jar:feign-java11-11.6.jar:../classes:../test-classes GetExchangeRates 826
    • java -cp jackson-annotations-2.12.4.jar:jackson-core-2.12.4.jar:jackson-databind-2.12.4.jar:feign-core-11.6.jar:feign-jackson-11.6.jar:feign-java11-11.6.jar:../classes:../test-classes GetExchangeRates 985

License

Apache License v2.0 License