Skip to content
Developer documentation

.NET

.NET 10 (also targets .NET 8)

.NET

.NET 10 (also targets .NET 8)

A typed client with separate Maps and Tracking families, so the credential for each is explicit. Uses IHttpClientFactory-friendly options and returns model types generated from the contract.

Install

dotnet
dotnet add package Bardiya.Map

What it supports

  • Maps, places, geocoding, directions, matrix, validation
  • Tracking sessions, ingest, history and state
  • Webhooks, subscriptions and client tokens
  • Idempotency keys and cancellation tokens on every call

Initialise the client

csharp
using Bardiya.Map;
using Bardiya.Map.Model;

using var client = new BardiyaClient(new BardiyaOptions
{
    MapsApiKey = "bdy_maps_...",
    TrackingApiKey = "bdy_tracking_...",
});

var places = await client.Places!.SearchPlacesAsync("coffee", latitude: 30.0444, longitude: 31.2357);

Typical operation

Create a tracking session idempotently

csharp
var session = await client.Tracking!.CreateSessionAsync(
    new PublicSessionCreate(subjectType: "device"),
    idempotencyKey: "order-123");

Error handling

csharp
try
{
    await client.Places!.SearchPlacesAsync("coffee");
}
catch (BardiyaApiException failure)
{
    failure.StatusCode;  // 429
    failure.Code;        // "rate_limited"
    failure.RequestId;
    failure.Retryable;
}

Things that catch people out

  • Maps and Tracking authenticate differently. Configure only the families you use; calling a family without its key throws before the request is sent.
  • The client is thread-safe; reuse one instance per process.