دوت نت
.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.MapPublished packagehttps://www.nuget.org/packages/Bardiya.Map/Source repositoryhttps://github.com/EngMohamed05/bardiya-dotnet
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.
