تخطَّ إلى المحتوى
توثيق المطورين

جافا

Java 11+

جافا

Java 11+

A blocking, closeable client with generated models and a typed exception. Published to Maven Central with sources and Javadoc attached.

Install

<dependency>
  <groupId>com.bardiyamap</groupId>
  <artifactId>bardiya-map-java</artifactId>
  <version>0.1.0</version>
</dependency>

What it supports

  • Every public Maps operation
  • Every public Tracking operation
  • Signing-free install: no repository block required
  • try-with-resources lifecycle

Initialise the client

java
BardiyaOptions options = BardiyaOptions.builder()
    .mapsApiKey(System.getenv("BARDIYA_MAPS_KEY"))
    .trackingApiKey(System.getenv("BARDIYA_TRACKING_KEY"))
    .build();

try (BardiyaClient client = new BardiyaClient(options)) {
    PlaceSearchResponse places = client.places()
        .searchPlaces("coffee", 30.0444, 31.2357, 2000, null, null, 5, "en");
    System.out.println(places.getCount());
}

Typical operation

Error inspection

java
try {
    client.tracking().getSession(sessionId);
} catch (BardiyaApiException failure) {
    failure.getStatusCode();  // 404
    failure.getCode();        // "session_not_found"
    failure.getRequestId();   // quote this to support
    failure.isRetryable();    // false for a terminal refusal
}

Things that catch people out

  • The client is blocking. In a reactive stack, run it on a dedicated scheduler rather than on the event loop.
  • Artifacts are signed; the public key is published on keyserver.ubuntu.com under the Bardiya Map release key.