SDKs

C# SDK

Official .NET client for the MUDBASE API (NuGet).

Installation

bash
dotnet add package Mudbase.Sdk
dotnet add package Mudbase.Sdk

Quick Start

The C# SDK is built on Microsoft.Extensions.DependencyInjection — register it with ConfigureApi on your host builder, then resolve each API interface (e.g. IAuthenticationApi, IDataApi) from the service provider. There is no unified client wrapper.

csharp
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Mudbase.Sdk.Api;
using Mudbase.Sdk.Client;
using Mudbase.Sdk.Model;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureApi((context, options) => {
        BearerToken token = new(Environment.GetEnvironmentVariable("MUDBASE_API_KEY")!);
        options.AddTokens(token);
    })
    .Build();

var auth = host.Services.GetRequiredService<IAuthenticationApi>();
var data = host.Services.GetRequiredService<IDataApi>();

// Log in an end-user of your project
var session = await auth.LoginUserAsync(new LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2"));

// List documents in a collection
var items = await data.ListDataAsync(projectId, collectionId);
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Mudbase.Sdk.Api;
using Mudbase.Sdk.Client;
using Mudbase.Sdk.Model;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureApi((context, options) => {
        BearerToken token = new(Environment.GetEnvironmentVariable("MUDBASE_API_KEY")!);
        options.AddTokens(token);
    })
    .Build();

var auth = host.Services.GetRequiredService<IAuthenticationApi>();
var data = host.Services.GetRequiredService<IDataApi>();

// Log in an end-user of your project
var session = await auth.LoginUserAsync(new LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2"));

// List documents in a collection
var items = await data.ListDataAsync(projectId, collectionId);

More

For error handling, pagination, and other languages, see the SDKs Overview.