Skip to main content

Java client

Izanami Java client aims to help you fetch your features' status from remote Izanami instances.

In addition to perform http requests for you, client offers some nice features :

Importing the client

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.1</version>
</dependency>

Getting started

To instantiate Izanami client, you'll need a remote instance url and an API key.

IzanamiClient client = IzanamiClient.newBuilder(
connectionInformation()
.withUrl(<REMOTE_IZANAMI_BASE_URL>/api)
.withClientId(<YOUR_KEY_CLIENT_ID>)
.withClientSecret(<YOUR_KEY_CLIENT_SECRET>)
).build();

The client can be used to query a single feature...

CompletableFuture<Boolean> res = client.checkFeatureActivation(
newSingleFeatureRequest("<YOUR_FEATURE_ID>")
);

... or multiple features at once

// Resulting map associates feature id to its activation
CompletableFuture<Map<String, Boolean>> results = client.checkFeatureActivations(
newFeatureRequest()
.withFeatures("<YOUR_ID_1>", "<YOUR_ID_2>")
);

With these queries, you can specify user, context or payload :

CompletableFuture<Map<String, Boolean>> results = client.checkFeatureActivations(
newFeatureRequest()
.withFeatures("<YOUR_ID_1>", "<YOUR_ID_2>")
.withUser("<YOUR_USER>")
.withContext("prod/mobile")
);