Skip to main content

C# SDK

Interact with the CubeStack API using C# and .NET.

Installation

dotnet add package CubeStack.SDK

Quick Start

using CubeStack;

var client = new CubeStackClient("your-api-key", "my-project");

// Fetch records
var result = await client.Records.ListAsync("blog-posts", new ListOptions
{
    Page = 1,
    PageSize = 10,
    Sort = "created_at",
    Order = "desc"
});

// Create a record
var record = await client.Records.CreateAsync("blog-posts", new Dictionary<string, object>
{
    ["title"] = "Hello World",
    ["content"] = "My first post"
});

// Update a record
await client.Records.UpdateAsync("blog-posts", record.Id, new Dictionary<string, object>
{
    ["title"] = "Updated Title"
});

// Delete a record
await client.Records.DeleteAsync("blog-posts", record.Id);

Error Handling

try
{
    var record = await client.Records.GetAsync("blog-posts", 999);
}
catch (CubeStackException ex) when (ex.StatusCode == 404)
{
    Console.WriteLine("Record not found");
}