Skip to main content

Fetching Single Records

Use GetAsync to fetch a single entity by its ID, or GetMultipleAsync to fetch several at once.

Fetch by ID

var endpoint = new CoworkerEndpoint(client);
Coworker? coworker = await endpoint.GetAsync(12345);

if (coworker is not null)
    Console.WriteLine($"{coworker.FullName} ({coworker.Email})");
else
    Console.WriteLine("Coworker not found.");
GetAsync returns null when the entity does not exist — it does not throw an exception.

Fetch multiple by IDs

Retrieve several records in a single call:
List<Coworker> coworkers = await endpoint.GetMultipleAsync(100, 200, 300);

foreach (var c in coworkers)
    Console.WriteLine($"{c.Id}: {c.FullName}");

Works with any entity

Booking? booking = await new BookingEndpoint(client).GetAsync(9876);
Product? product = await new ProductEndpoint(client).GetAsync(5432);