Franz.Common.Http.Client 1.2.62

dotnet add package Franz.Common.Http.Client --version 1.2.62                
NuGet\Install-Package Franz.Common.Http.Client -Version 1.2.62                
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="Franz.Common.Http.Client" Version="1.2.62" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Http.Client --version 1.2.62                
#r "nuget: Franz.Common.Http.Client, 1.2.62"                
#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.
// Install Franz.Common.Http.Client as a Cake Addin
#addin nuget:?package=Franz.Common.Http.Client&version=1.2.62

// Install Franz.Common.Http.Client as a Cake Tool
#tool nuget:?package=Franz.Common.Http.Client&version=1.2.62                

Franz.Common.Http.Client

A powerful library within the Franz Framework that simplifies the creation, configuration, and management of HTTP clients in .NET applications. This package provides tools for handling HTTP requests, authentication, custom request builders, and error management, enabling consistent and efficient communication with external APIs.


Features

  • HTTP Client Abstractions:
    • HttpService for streamlined HTTP request execution.
    • HttpClientException for managing HTTP-related errors.
  • Authentication:
    • AuthenticationService for token-based authentication workflows.
  • Request Builders:
    • Customizable request builders for advanced HTTP scenarios:
      • AuthorizationRequestBuilder
      • DomainRequestBuilder
      • HeaderPropagationRequestBuilder
  • Delegating Handlers:
    • Middleware for HTTP client pipelines:
      • ExceptionDelegatingHandler
      • RequestBuilderDelegatingHandler
  • File Handling:
    • HttpFileParameter and FileParameter for file uploads.
  • Dependency Injection:
    • ServiceCollectionExtensions to register HTTP client services easily.
  • Content Utilities:
    • HttpContentParameter for building HTTP content with flexibility.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • Microsoft.Extensions.Http (8.0.0): Provides core HTTP client factory functionality.
  • Newtonsoft.Json (13.0.3): Advanced JSON serialization and deserialization.
  • Microsoft.Extensions.Configuration.Abstractions (8.0.0): Configuration management utilities.
  • Franz.Common: Core utilities for shared functionality.
  • Franz.Common.DependencyInjection: Simplified DI setup.
  • Franz.Common.Headers: HTTP header utilities and extensions.
  • Franz.Common.Errors: Error handling and management.
  • Franz.Common.Identity: Identity integration for authentication.
  • Franz.Common.MultiTenancy: Multi-tenant HTTP client configurations.
  • Franz.Common.Serialization: Serialization utilities for API communication.

Installation

From Private Azure Feed

Since this package is hosted privately, configure your NuGet client:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Install the package:

dotnet add package Franz.Common.Http.Client --version 1.2.62

Usage

1. Configure HTTP Client Services

Use ServiceCollectionExtensions to register HTTP clients:

using Franz.Common.Http.Client.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddHttpClientServices(); // Registers HTTP clients and related services
    }
}

2. Execute HTTP Requests

Use the HttpService for simplified HTTP interactions:

using Franz.Common.Http.Client.Files;

var httpService = serviceProvider.GetRequiredService<HttpService>();

var response = await httpService.GetAsync<MyResponse>("https://api.example.com/resource");

3. Custom Request Builders

Create custom request configurations with request builders:

using Franz.Common.Http.Client.Delegating;

var requestBuilder = new DomainRequestBuilder("https://api.example.com")
    .AddHeader("Authorization", "Bearer token")
    .AddQueryParameter("key", "value");

4. File Uploads

Handle file uploads using HttpFileParameter:

using Franz.Common.Http.Client.Content;

var fileParameter = new HttpFileParameter
{
    FileName = "document.pdf",
    ContentType = "application/pdf",
    Content = fileStream
};

await httpService.PostFileAsync("https://api.example.com/upload", fileParameter);

5. Authentication

Integrate authentication workflows with AuthenticationService:

using Franz.Common.Http.Client.Authentication;

var authService = serviceProvider.GetRequiredService<IAuthenticationService>();
var token = await authService.GetAccessTokenAsync("my-client-id", "my-client-secret");

Integration with Franz Framework

The Franz.Common.Http.Client package integrates seamlessly with:

  • Franz.Common: Provides core utilities.
  • Franz.Common.Headers: Simplifies header management.
  • Franz.Common.Errors: Handles HTTP-specific errors consistently.
  • Franz.Common.Serialization: Enhances serialization for HTTP payloads.
  • Franz.Common.MultiTenancy: Enables tenant-specific HTTP configurations.

Ensure these dependencies are installed to fully leverage the library's capabilities.


Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository.
  2. Create a feature branch.
  3. Submit a pull request for review.

License

This library is licensed under the MIT License. See the LICENSE file for more details.


Changelog

Version 1.2.62

  • Added HttpService for simplified HTTP interactions.
  • Introduced custom request builders and delegating handlers.
  • Added file upload utilities with HttpFileParameter.
  • Integrated AuthenticationService for token-based workflows.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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.2.62 52 1/8/2025