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
                    
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="Atya.Http.Client" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atya.Http.Client" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Atya.Http.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 Atya.Http.Client --version 1.0.0
                    
#r "nuget: Atya.Http.Client, 1.0.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 Atya.Http.Client@1.0.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=Atya.Http.Client&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Atya.Http.Client&version=1.0.0
                    
Install as a Cake Tool

Atya.Http.Client

Typed HttpClient helpers that return Atya Result values, understand ProblemDetails failures, and propagate correlation identifiers.

NuGet Version Downloads .NET 10.0 License: MIT

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.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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