AuroraScienceHub.Framework.Http 10.0.5

Prefix Reserved
dotnet add package AuroraScienceHub.Framework.Http --version 10.0.5
                    
NuGet\Install-Package AuroraScienceHub.Framework.Http -Version 10.0.5
                    
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="AuroraScienceHub.Framework.Http" Version="10.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AuroraScienceHub.Framework.Http" Version="10.0.5" />
                    
Directory.Packages.props
<PackageReference Include="AuroraScienceHub.Framework.Http" />
                    
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 AuroraScienceHub.Framework.Http --version 10.0.5
                    
#r "nuget: AuroraScienceHub.Framework.Http, 10.0.5"
                    
#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 AuroraScienceHub.Framework.Http@10.0.5
                    
#: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=AuroraScienceHub.Framework.Http&version=10.0.5
                    
Install as a Cake Addin
#tool nuget:?package=AuroraScienceHub.Framework.Http&version=10.0.5
                    
Install as a Cake Tool

AuroraScienceHub.Framework.Http

HTTP client extensions and utilities for building robust API clients in .NET applications.

Overview

Provides extension methods for HttpClient to simplify JSON-based API communication, handle errors gracefully, and build URLs safely.

Key Features

  • Simplified HTTP Calls - Extension methods for common operations
  • Automatic JSON Handling - Built-in serialization/deserialization
  • Error Handling - Structured exception handling with ApiClientException
  • URL Builder - Safe and fluent URL construction
  • Problem Details Support - RFC 7807 compliant error responses

Installation

dotnet add package AuroraScienceHub.Framework.Http

Usage

Basic API Client

public class UserApiClient
{
    private readonly HttpClient _httpClient;

    public UserApiClient(HttpClient httpClient)
    {
        _httpClient = httpClient;
    }

    public async Task<User?> GetUserAsync(int userId)
    {
        return await _httpClient.GetFromJsonOrDefaultAsync<User>(
            new Uri($"/api/users/{userId}", UriKind.Relative));
    }

    public async Task<User?> CreateUserAsync(CreateUserRequest request)
    {
        return await _httpClient.PostAsJsonAsync<CreateUserRequest, User>(
            new Uri("/api/users", UriKind.Relative),
            request);
    }
}

URL Builder

var url = UrlBuilder.Create("/api/products/search")
    .AddQuery("q", searchTerm)
    .AddQuery("page", page)
    .AddQueryIfNotNull("category", category)
    .Build();

var products = await _httpClient.GetFromJsonOrDefaultAsync<List<Product>>(url);

Service Registration

builder.Services.AddHttpClient<OrderApiClient>(client =>
{
    client.BaseAddress = new Uri("https://api.example.com");
    client.Timeout = TimeSpan.FromSeconds(30);
});

Error Handling

try
{
    return await _httpClient.GetFromJsonOrDefaultAsync<Product>(uri);
}
catch (ApiClientException ex)
{
    _logger.LogError(ex, "API call failed. Status: {StatusCode}", ex.StatusCode);
    throw;
}

Extension Methods

Task<T?> GetFromJsonOrDefaultAsync<T>(Uri uri, CancellationToken ct = default)
Task<TResponse?> PostAsJsonAsync<TRequest, TResponse>(Uri uri, TRequest body, CancellationToken ct = default)
Task<TResponse?> PutAsJsonAsync<TRequest, TResponse>(Uri uri, TRequest body, CancellationToken ct = default)

License

See LICENSE file in the repository root.

  • AuroraScienceHub.Framework.Json - JSON serialization utilities
  • Polly - Resilience and transient-fault-handling (recommended)
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 (1)

Showing the top 1 NuGet packages that depend on AuroraScienceHub.Framework.Http:

Package Downloads
AuroraScienceHub.Integrations.NoaaClient

Provides unified HTTP client interfaces for accessing NOAA space weather data including solar wind measurements, magnetometer data, and geomagnetic activity indices from ACE and DSCOVR spacecraft with KP-index forecasts and nowcast data.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.5 106 4/23/2026
10.0.4 110 4/23/2026
10.0.3 137 2/11/2026
10.0.2 119 1/29/2026
10.0.1 221 12/25/2025
10.0.0 470 12/11/2025
9.0.7 427 11/20/2025
9.0.6 192 11/15/2025
9.0.5 147 11/8/2025
9.0.4 166 10/24/2025
9.0.3 216 10/15/2025
9.0.2 191 10/15/2025
9.0.1 203 10/14/2025
9.0.1-workflow-test-2.17 152 10/14/2025