The Java SDK (io.fivexer:fivexer-sdk) targets Java 11 bytecode and works on the JVM and Android.
Install
Maven:
xml<dependency> <groupId>io.fivexer</groupId> <artifactId>fivexer-sdk</artifactId> <version>0.1.0</version> </dependency>
Gradle:
groovyimplementation 'io.fivexer:fivexer-sdk:0.1.0'
Quickstart
javaimport io.fivexer.sdk.Fivexer; import io.fivexer.sdk.model.*; import java.util.List; Fivexer client = new Fivexer("https://api.fivexer.com", "sk_test_..."); client.workers().upsert(new UpsertWorker("agent_1").tags(List.of("english", "billing"))); Task task = client.tasks().create(new CreateTask(List.of("english", "billing")).priority(90)); System.out.println(task.getId() + " " + task.getStatus());
Async
The sync Fivexer blocks on CompletableFuture internally. For async callers, use the async variants directly or wrap calls:
javaCompletableFuture<Task> future = CompletableFuture.supplyAsync(() -> client.tasks().create(input));
Errors and quotas
javatry { client.tasks().create(new CreateTask(List.of("english"))); } catch (FivexerApiException e) { System.out.println(e.getStatusCode() + " " + e.getCode()); System.out.println(e.getRetryAfterSeconds()); System.out.println(client.getQuota().getTaskRateRemaining()); }
Webhooks
javaimport io.fivexer.sdk.webhook.Webhook; import io.fivexer.sdk.webhook.WebhookEvent; WebhookEvent event = Webhook.constructEvent(rawBodyBytes, signatureHeader, "whsec_...");
Build & test
bash./gradlew check