Solid.Superset.Client
1.0.2
dotnet add package Solid.Superset.Client --version 1.0.2
NuGet\Install-Package Solid.Superset.Client -Version 1.0.2
<PackageReference Include="Solid.Superset.Client" Version="1.0.2" />
<PackageVersion Include="Solid.Superset.Client" Version="1.0.2" />
<PackageReference Include="Solid.Superset.Client" />
paket add Solid.Superset.Client --version 1.0.2
#r "nuget: Solid.Superset.Client, 1.0.2"
#:package Solid.Superset.Client@1.0.2
#addin nuget:?package=Solid.Superset.Client&version=1.0.2
#tool nuget:?package=Solid.Superset.Client&version=1.0.2
Solid.Superset.Client - the C# library for the Apache Superset API
A .NET 9 client library for Apache Superset, generated from Superset's OpenAPI specification. This client provides strongly-typed access to Superset's API endpoints with automatic session-based authentication and CSRF token management.
Command used to generate the API
This C# SDK is generated from Superset's OpenAPI specification using NSwag:
- API version: 1.0
- SDK version: 1.0.0
- Build package: NSwag.MSBuild
For more information, please visit https://superset.apache.org/
<a id="frameworks-supported"></a>
Frameworks supported
- .NET 9.0 or later
<a id="dependencies"></a>
Dependencies
- Microsoft.Extensions.Http - 9.0.0 or later
- Microsoft.Extensions.Options - 9.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package Microsoft.Extensions.Http
Install-Package Microsoft.Extensions.Options
<a id="installation"></a>
Installation
Install the package from NuGet:
Install-Package Solid.Superset.Client
Or via .NET CLI:
dotnet add package Solid.Superset.Client
<a id="usage"></a>
Usage
Basic Setup
Register the Superset client in your Program.cs or Startup.cs:
using Solid.Superset.Client.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSupersetClient(options =>
{
options.BaseUrl = "http://localhost:8088";
options.Username = "admin";
options.Password = "admin";
});
Configuration
Configuration options are provided via SupersetAuthOptions:
BaseUrl(required) - Base URL of the Superset instance (e.g., "http://localhost:8088")Username(required) - Username for service account authenticationPassword(required) - Password for service account authentication
Using the Client
Once registered, inject the generated client interface:
using Solid.Superset.Client.Generated;
public class MyService
{
private readonly ISupersetClient _supersetClient;
public MyService(ISupersetClient supersetClient)
{
_supersetClient = supersetClient;
}
public async Task DoSomething()
{
// Use the client - authentication and CSRF tokens are handled automatically
// var result = await _supersetClient.SomeEndpointAsync();
}
}
<a id="getting-started"></a>
Getting Started
using Solid.Superset.Client.Extensions;
using Solid.Superset.Client.Generated;
var builder = WebApplication.CreateBuilder(args);
// Register the Superset client
builder.Services.AddSupersetClient(options =>
{
options.BaseUrl = "https://superset.example.com";
options.Username = "your_username";
options.Password = "your_password";
});
var app = builder.Build();
// Use the client
var scope = app.Services.CreateScope();
var client = scope.ServiceProvider.GetRequiredService<ISupersetClient>();
try
{
// Make API calls - authentication and CSRF tokens are handled automatically
// var result = await client.SomeEndpointAsync();
}
catch (ApiException e)
{
Console.WriteLine($"Exception: {e.Message}");
Console.WriteLine($"Status Code: {e.StatusCode}");
}
Authentication
The client uses session-based authentication:
- Lazy authentication - Login occurs automatically on the first API request
- Session persistence - Session cookies are stored and reused across requests
- Automatic re-authentication - If a request returns 401, the client automatically re-authenticates and retries
- Thread-safe - Multiple concurrent requests are handled safely
CSRF Token Management
CSRF tokens are automatically managed:
- Lazy fetching - CSRF token is fetched before the first mutating request (POST/PUT/DELETE/PATCH)
- Automatic inclusion - Token is included in the
X-CSRFTokenheader for mutating requests - Token refresh - If a request returns 403, the token is refreshed and the request is retried
Features
- Strongly-typed API client - Generated from Superset's OpenAPI specification using NSwag
- Automatic authentication - Session-based authentication with cookie persistence
- CSRF token management - Automatic CSRF token retrieval and inclusion on mutating requests
- Dependency injection ready - Easy integration with .NET's dependency injection container
- Thread-safe - Handles concurrent requests safely with proper locking
<a id="packaging"></a>
Packaging
This package is published to NuGet and can be consumed via standard NuGet package management tools.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.