Misar IO Docs

C# SDK

Install and use the Misar.IO C# SDK

Installation

dotnet add package Misar.IO

Quick Start

using Misar.IO;
using Misar.IO.Models;

var client = new MisarIOClient(Environment.GetEnvironmentVariable("MISARIO_API_KEY")!);

var profile = await client.Account.GetAsync();
Console.WriteLine($"Hello, {profile.DisplayName}!");

Available Methods

| Method | Description | |--------|-------------| | client.Account.GetAsync(ct) | Get the current account profile | | client.Account.UpdateAsync(request, ct) | Update account details | | client.Sessions.ListAsync(ct) | List active sessions | | client.Sessions.RevokeAsync(id, ct) | Revoke a session | | client.Keys.ListAsync(ct) | List API keys | | client.Keys.CreateAsync(request, ct) | Create an API key | | client.Keys.RevokeAsync(id, ct) | Revoke an API key | | client.Sso.TokenAsync(request, ct) | Generate a cross-TLD SSO token |

Error Handling

using Misar.IO.Exceptions;

try
{
    var profile = await client.Account.GetAsync();
    Console.WriteLine($"Hello, {profile.DisplayName}!");
}
catch (MisarIOApiException ex)
{
    Console.WriteLine($"API error {ex.StatusCode}: {ex.Message}");
}
catch (MisarIONetworkException ex)
{
    Console.WriteLine($"Network error: {ex.Message}");
}