Atya.Http.Client
1.0.0
Prefix Reserved
dotnet add package Atya.Http.Client --version 1.0.0
NuGet\Install-Package Atya.Http.Client -Version 1.0.0
<PackageReference Include="Atya.Http.Client" Version="1.0.0" />
<PackageVersion Include="Atya.Http.Client" Version="1.0.0" />
<PackageReference Include="Atya.Http.Client" />
paket add Atya.Http.Client --version 1.0.0
#r "nuget: Atya.Http.Client, 1.0.0"
#:package Atya.Http.Client@1.0.0
#addin nuget:?package=Atya.Http.Client&version=1.0.0
#tool nuget:?package=Atya.Http.Client&version=1.0.0
Atya.Http.Client
Typed HttpClient helpers that return Atya Result values, understand ProblemDetails failures, and propagate correlation identifiers.
Overview
Atya.Http.Client wraps HttpClient calls in Result and Result<T> so callers handle expected upstream failures without exception control flow. It reads RFC ProblemDetails responses, aligns status-to-error-kind behavior with Atya.Errors.ProblemDetails, and forwards correlation identifiers on outbound requests.
Installation
dotnet add package Atya.Http.Client
Quick Start
using Atya.Http.Client;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddAtyaHttpClient(options =>
{
options.CorrelationIdAccessor = () => "current-correlation-id";
});
using var provider = services.BuildServiceProvider();
var client = provider.GetRequiredService<AtyaHttpClient>();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.example.test/customers/42");
var result = await client.SendJsonAsync<CustomerDto>(request);
if (result.IsSuccess)
{
Console.WriteLine(result.Value.Name);
}
else
{
Console.WriteLine(result.Error.Code);
}
public sealed record CustomerDto(string Name);
Feature Tour
Command-style calls
Use SendAsync when the response body is not part of the success contract:
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.example.test/customers/42");
var result = await client.SendAsync(request);
JSON calls
Use SendJsonAsync<TValue> when a successful response contains JSON:
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.example.test/customers/42");
var result = await client.SendJsonAsync<CustomerDto>(request);
Correlation
AtyaHttpClientOptions.CorrelationIdAccessor provides the current correlation id. The client forwards it through X-Correlation-ID unless the request already has that header.
Error Codes
| Code | Meaning |
|---|---|
atya.http.client.http_failure |
The upstream response was not successful and did not provide a specific Atya error code in ProblemDetails. |
atya.http.client.empty_json_response |
The upstream response succeeded but the JSON body deserialized to null. |
When an upstream ProblemDetails payload contains the errorCode extension from Atya.Errors.ProblemDetails, that code is returned instead of atya.http.client.http_failure.
Why This Dependency
Atya.Foundation.Results provides the Result and Error model. Atya.Errors.ProblemDetails owns the ProblemDetails extension names and error-kind mapping options consumed when interpreting upstream HTTP failures. Microsoft.Extensions.Http provides the standard typed-client registration surface.
Links
| 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
- Atya.Errors.ProblemDetails (>= 1.1.0)
- Atya.Foundation.Guards (>= 1.0.2)
- Atya.Foundation.Results (>= 1.1.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 96 | 7/12/2026 |