Nooq.Client (2026.11.0-ci.297.ga615437b.bar-without-day-notes)

Published 2026-11-14 16:56:26 +00:00 by ferociousbyte

Installation

dotnet nuget add source --name talaryonlabs --username your_username --password your_token 
dotnet add package --source talaryonlabs --version 2026.11.0-ci.297.ga615437b.bar-without-day-notes Nooq.Client

About this package

The client of nooq's public API for the website of a restaurant: the free times, booking, changing and cancelling a reservation.

Nooq.Client

The client of nooq's public API, for the website of a restaurant: the free times of a day, booking a table, and the guest changing or cancelling their reservation. Like Unilayer.Client: typed models, one exception for every failure, and calls that fail on the way are tried again.

Setup

dotnet add package Nooq.Client --source https://nuget.pkg.talaryon.dev/v3/index.json
builder.Services.AddNooqClient(options =>
{
    options.Url = "https://reservations.example.at";   // nooq's API
    options.Token = builder.Configuration["Nooq:Token"]!; // one of the API's public:tokens, never in the repository
});

INooqClient is registered per request. It sends the visitor's address and language along, so nooq limits a guest and not the whole website, and answers in the guest's language (German or English).

Use

var day = await nooq.GetAvailabilityAsync(new DateOnly(2026, 10, 17), guests: 4);
foreach (var time in day.Free)
    Console.WriteLine(time.Time);   // 17:30, 17:45, ...

var reservation = await nooq.CreateReservationAsync(new ReservationRequest(
    Date: new DateOnly(2026, 10, 17), Time: new TimeOnly(19, 0), Guests: 4,
    Name: "Kessler", Email: "kessler@example.at", Phone: "+43 660 1234567",
    Note: "Birthday", Language: "de"));
// reservation.Status: "confirmed", or "requested" for a large party the restaurant confirms itself

The guest gets a mail with a link to change or cancel the reservation; the website can offer the same with GetReservationAsync, ChangeReservationAsync and CancelReservationAsync and the reservation's Reference.

Events and the waiting list

foreach (var ev in await nooq.GetEventsAsync())             // published events to come, with the seats left per day
    Console.WriteLine($"{ev.Title}: {string.Join(", ", ev.Days.Select(d => $"{d.Date:dd.MM.} {d.SeatsLeft}"))}");

await nooq.BookEventAsync(ev.Id, new EventBooking(new DateOnly(2026, 10, 30), Guests: 2, Name: "Kessler",
    Email: "kessler@example.at", Variants: new Dictionary<string, int> { [ev.Variants[0].Id] = 2 }));

When an event asks every guest to choose (ChoiceRequired), the menus chosen add up to the party. A full day or event takes the guest onto the waiting list:

var entry = await nooq.JoinWaitlistAsync(new WaitlistRequest(new DateOnly(2026, 10, 17), Guests: 4, Name: "Kessler",
    Email: "kessler@example.at", Time: new TimeOnly(19, 0)));

nooq writes to the guest when a place frees up; it is theirs to take for a while (a link in the mail), then the next guest is asked.

Errors

Every failure is a NooqException. Code is one of ReasonCodes for the site to react on; Message is a sentence for the guest, in their language.

Code When
full, closed, too_late, too_far_ahead The time can't be booked (any more): offer the free times again
request_only The party is too large to book online; CreateReservationAsync sends a request instead
invalid The input is not right; the message says what
not_found, locked No such reservation, or it can't be changed any more
rate_limited, unavailable Too many requests, or nooq is not reachable right now

A time in Availability.Times that can't be booked carries the same code in Reason.

Bots

nooq limits the requests per guest address. The form on the website should still keep bots out on its own (a hidden field, a time check), since nooq only sees what the site sends.