Rask.Api.Client
0.20.1-alpha.0.228
dotnet add package Rask.Api.Client --version 0.20.1-alpha.0.228
NuGet\Install-Package Rask.Api.Client -Version 0.20.1-alpha.0.228
<PackageReference Include="Rask.Api.Client" Version="0.20.1-alpha.0.228" />
<PackageVersion Include="Rask.Api.Client" Version="0.20.1-alpha.0.228" />
<PackageReference Include="Rask.Api.Client" />
paket add Rask.Api.Client --version 0.20.1-alpha.0.228
#r "nuget: Rask.Api.Client, 0.20.1-alpha.0.228"
#:package Rask.Api.Client@0.20.1-alpha.0.228
#addin nuget:?package=Rask.Api.Client&version=0.20.1-alpha.0.228&prerelease
#tool nuget:?package=Rask.Api.Client&version=0.20.1-alpha.0.228&prerelease
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 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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Rask.Wire (>= 0.20.1-alpha.0.228)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rask.Api.Client:
| Package | Downloads |
|---|---|
|
Rask
The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.1-alpha.0.228 | 35 | 9/4/2026 |
| 0.20.1-alpha.0.227 | 32 | 9/4/2026 |
| 0.20.1-alpha.0.226 | 38 | 9/4/2026 |
| 0.20.1-alpha.0.225 | 37 | 9/4/2026 |
| 0.20.1-alpha.0.224 | 35 | 9/4/2026 |
| 0.20.1-alpha.0.223 | 43 | 9/4/2026 |
| 0.20.1-alpha.0.221 | 42 | 9/4/2026 |
| 0.20.1-alpha.0.220 | 40 | 9/4/2026 |
| 0.20.1-alpha.0.217 | 42 | 9/4/2026 |
| 0.20.1-alpha.0.216 | 38 | 9/4/2026 |
| 0.20.1-alpha.0.215 | 44 | 9/3/2026 |
| 0.20.1-alpha.0.213 | 36 | 9/3/2026 |
| 0.20.1-alpha.0.212 | 37 | 9/3/2026 |