Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAZK API Java Client

A robust and strictly-typed Java 11+ client library for the NAZK API (ЄДИНИЙ ДЕРЖАВНИЙ РЕЄСТР ДЕКЛАРАЦІЙ).

Features

  • Strict Typing: Uses Jackson for robust parsing, mapped precisely to the structure of API steps.
  • Resilient: Wraps Java 11's HttpClient with Resilience4j to automatically retry transient errors (502, 503, 504) with exponential backoff.
  • Fluent API: Easily construct complex queries using the Lombok-powered Builder pattern for DocumentFilter.
  • Pagination: Provides a seamless DocumentIterator that auto-fetches subsequent pages for large document lists.

Requirements

  • Java 11 or higher
  • Maven

Installation

Clone the repository and install it locally via Maven:

git clone https://github.com/AlexMelanFromRingo/nazk-api-java.git
cd nazk-api-java
mvn clean install

Usage

Fetching Countries

NazkClient client = new NazkClient();
CountryResponse countries = client.getCountries();
countries.getData().forEach(country -> {
    System.out.println(country.getName());
});

Fetching a List of Documents

Use the DocumentFilter builder to specify your search criteria.

NazkClient client = new NazkClient();
DocumentFilter filter = DocumentFilter.builder()
    .query("Шевченко")
    .declarationYear(2023)
    .build();

DocumentListResponse list = client.getDocuments(filter);
list.getData().forEach(doc -> {
    System.out.println("Document ID: " + doc.getId());
});

Pagination (Iterator)

If you want to seamlessly iterate over all pages without manual fetching:

NazkClient client = new NazkClient();
DocumentFilter filter = DocumentFilter.builder().query("Шевченко").build();

DocumentIterator iterator = new DocumentIterator(client, filter);
while (iterator.hasNext()) {
    DocumentListItem doc = iterator.next();
    System.out.println("Document ID: " + doc.getId());
}

Fetching a Specific Document

Once you have a document ID, you can fetch its full details (Steps 0-17).

NazkClient client = new NazkClient();
DocumentResponse document = client.getDocument("some-document-id");

// Access specific steps
System.out.println(document.getData().getStep0().getData());
System.out.println(document.getData().getStep2().getData());

Testing

Tests are designed to be entirely dynamic and anonymized. They do not rely on hardcoded document IDs. Run the tests with:

mvn test

License

MIT License

About

Java 11+ client for Ukraine's NAZK public declarations registry (ЄДРД): Jackson-mapped declaration steps 0–17, an auto-paginating DocumentIterator, a Lombok filter builder, and Resilience4j retries.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages