Rask.Api.Client 0.24.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.Api.Client --version 0.24.0
                    
NuGet\Install-Package Rask.Api.Client -Version 0.24.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rask.Api.Client" Version="0.24.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.Api.Client" Version="0.24.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.Api.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rask.Api.Client --version 0.24.0
                    
#r "nuget: Rask.Api.Client, 0.24.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rask.Api.Client@0.24.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rask.Api.Client&version=0.24.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Api.Client&version=0.24.0
                    
Install as a Cake Tool

Rask.Api.Client

Call your own API controllers and minimal API endpoints from C# with no URL at the call site.

// Server/PostsController.cs — ordinary ASP.NET, nothing Rask-specific
[ApiController, Route("api/posts")]
public sealed class PostsController(AppDb db) : ControllerBase
{
    [HttpGet("{id:int}")]
    public async Task<ActionResult<Post>> Get(int id) => ...;
}

// Any component. PostsClient is generated from the declaration above.
public sealed class PostDetail(PostsClient posts) : Component
{
    protected override async Task OnMount() => _post = await posts.Get(Id);
}
services.AddRaskApiClient();   // registers every generated client

The endpoint you already wrote is the source of truth. A source generator reads its routes, verbs, parameters and response types, and emits one client class per controller — so the URL, the verb, the request shape and the response shape are never restated. Rename a route on the server and the call site stops compiling, instead of 404ing in production.

Minimal APIs are read from the MapGet/MapPost invocations themselves and grouped by route (/api/widgets → WidgetsClient); .WithName("…") names a method. TypedResults — Ok<T>, Results<Ok<T>, NotFound>, NoContent — carries the response type.

Reflection-free JSON throughout, so it publishes clean under the WASM/AOT trimmer. In a one-project wasm-hosted app the client crosses into the browser bundle automatically, even though the controller under Server/ is never compiled there.

Failures

ApiException.StatusCode is null when the request never reached a server — DNS, TLS, a dropped connection, a timeout — with the cause in InnerException. A status means the server answered and said no. Blurring the two makes "is it down, or am I wrong?" unanswerable:

catch (ApiException ex) when (ex.StatusCode is null) { /* offline: queue it */ }
catch (ApiException ex) when (ex.StatusCode == 404)  { /* gone: show empty  */ }

Pairs with Rask.Api, which hosts the endpoints. Documentation: https://rask.sh

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Rask.Api.Client:

Package Downloads
Rask.Wasm

The Rask browser host: runs a Rask app's C# components client-side on .NET WebAssembly, with the client halves of the batteries — the mediator and query cache, remote dispatch, accounts, validation and the component kit — on by default. Ships the JS boot scripts, the page shell, and the MSBuild integration that stages them into the published bundle — and, opted in, prerenders every route to static HTML with a sitemap.xml at publish, so a static host serves real pages to visitors and crawlers. Depends on Rask, the shared core.

Rask.Server

The ASP.NET host for Rask, a full-stack .NET web framework, with every battery: database (SQLite or SQL Server, and PostgreSQL with the Rask.Postgres package, picked by Rask:Database:Provider), mediator and query cache, accounts, background jobs, transactional email, cache, file storage, outbox, operator dashboard, durable logs, Web Push, SQLite snapshots and continuous backup. Renders Rask components with live updates over a WebSocket. RaskApp.Create(args).Run<App>() is the whole Program.cs, and RaskApp.Create(args).Serve() the whole server of a WebAssembly client; app.Configure(c => c.Jobs.Off()) is how an app does without one. Depends on Rask, the shared core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.24.1-alpha.0.521 0 11/24/2026
0.24.1-alpha.0.489 0 11/24/2026
0.24.1-alpha.0.481 0 11/24/2026
0.24.1-alpha.0.257 52 11/23/2026
0.24.1-alpha.0.256 56 11/23/2026
0.24.1-alpha.0.253 54 11/23/2026
0.24.1-alpha.0.249 53 11/23/2026
0.24.1-alpha.0.246 49 11/23/2026
0.24.1-alpha.0.243 58 11/23/2026
0.24.1-alpha.0.242 61 11/22/2026
0.24.1-alpha.0.241 63 11/21/2026
0.24.1-alpha.0.240 66 11/21/2026
0.24.1-alpha.0.239 70 11/20/2026
0.24.1-alpha.0.237 66 11/20/2026
0.24.1-alpha.0.236 62 11/20/2026
0.24.1-alpha.0.156 58 11/20/2026
0.24.1-alpha.0.155 69 11/20/2026
0.24.1-alpha.0.154 70 11/19/2026
0.24.1-alpha.0.149 63 11/18/2026
0.24.0 144 11/16/2026
Loading failed