Rask.Api.Client 0.23.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.23.0
                    
NuGet\Install-Package Rask.Api.Client -Version 0.23.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.23.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.23.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.23.0
                    
#r "nuget: Rask.Api.Client, 0.23.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.23.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.23.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Api.Client&version=0.23.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 OnMountAsync() => _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 net10.0 is compatible.  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.  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, PostgreSQL or SQL Server, 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; 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.23.1-alpha.0.84 40 9/25/2026
0.23.1-alpha.0.82 37 9/25/2026
0.23.1-alpha.0.81 33 9/25/2026
0.23.1-alpha.0.80 30 9/25/2026
0.23.1-alpha.0.79 39 9/25/2026
0.23.1-alpha.0.78 35 9/25/2026
0.23.1-alpha.0.76 38 9/25/2026
0.23.1-alpha.0.74 33 9/25/2026
0.23.1-alpha.0.72 35 9/25/2026
0.23.1-alpha.0.70 39 9/25/2026
0.23.1-alpha.0.69 46 9/25/2026
0.23.1-alpha.0.68 51 9/25/2026
0.23.1-alpha.0.67 50 9/25/2026
0.23.1-alpha.0.66 34 9/24/2026
0.23.1-alpha.0.65 36 9/24/2026
0.23.1-alpha.0.64 28 9/24/2026
0.23.1-alpha.0.62 33 9/24/2026
0.23.1-alpha.0.61 33 9/24/2026
0.23.1-alpha.0.50 35 9/24/2026
0.23.0 163 9/18/2026
Loading failed