Skip to main content

Client Setup

The NexudusApiClient is the central object you use to interact with the Nexudus API. It requires an HttpClient, an authentication provider, and an optional configuration object.

Basic setup

using Nexudus.Sdk;
using Nexudus.Sdk.Auth;
using Nexudus.Sdk.Configuration;

var auth = new BasicAuthProvider("email@example.com", "password");

using var client = new NexudusApiClient(new HttpClient(), auth);

Configuration options

Pass a NexudusOptions object to customise the client behaviour:
var options = new NexudusOptions
{
    BaseUrl = "https://spaces.nexudus.com", // Default
    PageSize = 25,                          // Default page size for listings
    Timeout = TimeSpan.FromSeconds(30)      // HTTP request timeout
};

using var client = new NexudusApiClient(new HttpClient(), auth, options);
OptionTypeDefaultDescription
BaseUrlstringhttps://spaces.nexudus.comThe Nexudus API base URL.
PageSizeint25Default number of records per page.
TimeoutTimeSpan30 secondsHTTP request timeout.

Using environment variables

For scripts and CI/CD pipelines, store credentials in environment variables instead of hard-coding them:
var email = Environment.GetEnvironmentVariable("NEXUDUS_EMAIL")
    ?? throw new InvalidOperationException("NEXUDUS_EMAIL not set");
var password = Environment.GetEnvironmentVariable("NEXUDUS_PASSWORD")
    ?? throw new InvalidOperationException("NEXUDUS_PASSWORD not set");

var auth = new BasicAuthProvider(email, password);
using var client = new NexudusApiClient(new HttpClient(), auth);
Set the variables before running your app:
$env:NEXUDUS_EMAIL = "you@example.com"
$env:NEXUDUS_PASSWORD = "your-password"
Never commit credentials to source control. Use environment variables, user secrets, or a vault for production deployments.

Entity endpoints

Once you have a client, create endpoint instances for the entities you need:
var coworkers  = new CoworkerEndpoint(client);
var bookings   = new BookingEndpoint(client);
var products   = new ProductEndpoint(client);
var businesses = new BusinessEndpoint(client);
There are 200+ endpoint classes available — one for every entity type in the Nexudus API. They all expose the same set of methods described in the following pages.