Rystem.Api.Client
10.0.7
dotnet add package Rystem.Api.Client --version 10.0.7
NuGet\Install-Package Rystem.Api.Client -Version 10.0.7
<PackageReference Include="Rystem.Api.Client" Version="10.0.7" />
<PackageVersion Include="Rystem.Api.Client" Version="10.0.7" />
<PackageReference Include="Rystem.Api.Client" />
paket add Rystem.Api.Client --version 10.0.7
#r "nuget: Rystem.Api.Client, 10.0.7"
#:package Rystem.Api.Client@10.0.7
#addin nuget:?package=Rystem.Api.Client&version=10.0.7
#tool nuget:?package=Rystem.Api.Client&version=10.0.7
Rystem.Api.Client
Rystem.Api.Client is the runtime client layer for Rystem.Api.
It does not generate source files. Instead, it builds runtime DispatchProxy implementations for your interfaces and sends HTTP requests based on the shared endpoint metadata.
Installation
dotnet add package Rystem.Api.Client
Architecture
The client package expects the same endpoint registrations that the server uses.
In practice, both sides should call a shared method, like the sample AddBusiness() in src/Api/Test/Rystem.Api.Test.Domain/ServiceCollectionExtensions.cs.
The flow is:
- share
ConfigureEndpoints(...)andAddEndpoint...(...)registrations between client and server - register clients with
AddClientsForAllEndpointsApi(...)orAddClientForEndpointApi<T>(...) - optionally add
IRequestEnhancerimplementations - inject the interface directly and call it like a normal service
Each generated client is a transient factory-backed proxy that uses a named HttpClient internally.
Minimal setup
This follows the sample app in src/Api/Test/Rystem.Api.TestClient/Program.cs.
builder.Services.AddBusiness();
builder.Services.AddClientsForAllEndpointsApi(http =>
{
http.ConfigurationHttpClientForApi(client =>
{
client.BaseAddress = new Uri("https://localhost:7117");
});
});
After that, you can inject the interface directly:
public sealed class ProductPage
{
private readonly ISalubry _service;
public ProductPage(ISalubry service)
=> _service = service;
public Task<bool> RunAsync(int id, Stream stream)
=> _service.GetAsync(id, stream);
}
Registration APIs
| Method | Purpose |
|---|---|
AddClientsForAllEndpointsApi(Action<HttpClientBuilder>) |
register proxies for every endpoint currently known to EndpointsManager |
AddClientForEndpointApi<T>(Action<HttpClientBuilder>, factoryName?) |
register a proxy for one endpoint type, optionally targeting a named instance |
Generated proxies are registered through the same factory system used elsewhere in the repo and currently use ServiceLifetime.Transient.
When you target a named endpoint instance, resolve that proxy through IFactory<T> rather than relying on plain interface injection.
HttpClientBuilder
HttpClientBuilder exposes:
| Method | Purpose |
|---|---|
ConfigurationHttpClientForApi(Action<HttpClient>) |
default HttpClient configuration for all endpoint proxies |
ConfigurationHttpClientForEndpointApi<T>(Action<HttpClient>) |
HttpClient configuration only for interface T |
Precedence is:
- endpoint-specific
ConfigurationHttpClientForEndpointApi<T>(...) - shared
ConfigurationHttpClientForApi(...) - default
AddHttpClient(...)with no extra configuration
Request enhancers
IRequestEnhancer is the client-side interception hook.
public sealed class CorrelationEnhancer : IRequestEnhancer
{
public ValueTask EnhanceAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
request.Headers.Add("X-Correlation-Id", Guid.NewGuid().ToString());
return ValueTask.CompletedTask;
}
}
Register enhancers with:
| Method | Scope |
|---|---|
AddEnhancerForAllEndpoints<TEnhancer>() |
all generated clients |
AddEnhancerForEndpoint<TEnhancer, T>() |
only the client for interface T |
Enhancer execution order is:
- all-endpoint enhancers
- endpoint-specific enhancers
The sample client registers both kinds in src/Api/Test/Rystem.Api.TestClient/Program.cs.
Request building behavior
The client proxy uses the endpoint metadata from Rystem.Api to build requests.
- query parameters are appended to the URI
- path parameters are appended as URI segments
- cookies are written into the
cookieheader - headers are copied into request headers
- body parameters become either plain content or multipart form-data
IAsyncEnumerable<T>results are read as streamed JSONStream,IHttpFile, andIFormFileresponse shapes are supported
The route pattern mirrors the server-side metadata:
{BasePath}{EndpointName}/{FactoryName?}{MethodName}
Important caveats
The client depends on shared registrations
If the client and server do not share the same ConfigureEndpoints(...) and AddEndpoint...(...) definitions, route generation drifts and calls fail.
Factory auto-expansion is not mirrored client-side
AddEndpointWithFactory<T>() is expanded automatically on the server during UseEndpointApi(), but the client package does not do the same factory-name fan-out automatically.
If you need named factory-backed clients, use explicit named registrations or AddClientForEndpointApi<T>(..., factoryName) for the specific named endpoint you want.
URI composition is intentionally simple
Query, path, header, and cookie values are composed very directly.
The current implementation does not provide polished URL encoding or rich handling for non-primitive query/header/cookie payloads, so keep those cases simple.
This is runtime proxy generation
There is no compile-time client code generation here. Debugging behavior is closer to a dynamic proxy than to a handwritten typed HttpClient.
Grounded by sample files
src/Api/Test/Rystem.Api.Test.Domain/ServiceCollectionExtensions.cssrc/Api/Test/Rystem.Api.TestClient/Program.cssrc/Api/Test/Rystem.Api.TestClient/Services/Enhancer.cssrc/Api/Test/Rystem.Api.Test.Domain/IColam.cssrc/Api/Test/Rystem.Api.Test.Domain/IEmbeddingService.cs
Use this package when you want to call Rystem.Api.Server endpoints through the same interface contracts instead of writing manual HTTP code.
| 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.Http (>= 10.0.5)
- Rystem.Api (>= 10.0.7)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Rystem.Api.Client:
| Package | Downloads |
|---|---|
|
Rystem.Api.Client.Authentication.BlazorServer
Rystem.Api helps you to integrate Api Server and Automated Client for Aspect-Oriented programming. |
|
|
Rystem.Api.Client.Authentication.BlazorWasm
Rystem.Api helps you to integrate Api Server and Automated Client for Aspect-Oriented programming. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.7 | 110 | 3/26/2026 |
| 10.0.6 | 188,341 | 3/3/2026 |
| 10.0.5 | 187 | 2/22/2026 |
| 10.0.4 | 190 | 2/9/2026 |
| 10.0.3 | 147,973 | 1/28/2026 |
| 10.0.1 | 209,122 | 11/12/2025 |
| 9.1.3 | 305 | 9/2/2025 |
| 9.1.2 | 764,538 | 5/29/2025 |
| 9.1.1 | 97,832 | 5/2/2025 |
| 9.0.32 | 186,728 | 4/15/2025 |
| 9.0.31 | 5,861 | 4/2/2025 |
| 9.0.30 | 88,875 | 3/26/2025 |
| 9.0.29 | 9,028 | 3/18/2025 |
| 9.0.28 | 261 | 3/17/2025 |
| 9.0.27 | 256 | 3/16/2025 |
| 9.0.26 | 272 | 3/13/2025 |
| 9.0.25 | 52,150 | 3/9/2025 |
| 9.0.21 | 339 | 3/6/2025 |
| 9.0.20 | 19,589 | 3/6/2025 |
| 9.0.19 | 320 | 3/6/2025 |