Vulttech_HttpClient 1.0.5

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

HttpClient Customizado para los llamados a los endpoint

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.  net10.0 was computed.  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.5 154 6/25/2025
1.0.4 143 6/19/2025
1.0.3 143 6/19/2025
1.0.2 147 6/19/2025
1.0.1 140 6/18/2025
1.0.0 143 6/17/2025

🌐 Vulttech_HttpClient
Cliente HTTP reutilizable para microservicios basado en HttpClientFactory. Facilita llamados HTTP con soporte para autenticación, serialización automática, logging y configuración por appsettings.
📦 Instalación
bash
dotnet add package Vulttech.HttpClient --version 1.0.5

🚀 Características
Soporte para GET, POST, PUT, PATCH, HEAD
Autenticación por Bearer, Basic, o ninguna (None)
Lectura automática de endpoints desde appsettings.json
Compatible con IHttpClientFactory
Factory personalizado HttpClientVulttechFactory
Inyección de dependencias lista para usar
Manejo de errores centralizado
Logging integrado

🔧 Configuración
1. En appsettings.json
json ejemplo:
"ServiceEndpoints": {
     "Usuarios": "https://api.midominio.com/usuarios",
       "Turnos": "https://api.midominio.com/turnos",
     "Authentication": {
     "User": "UsuarioBasic",
     "Password": "123456",
     "ApiUser": "UsuarioApi",
     "ApiKey": "123456789"
      }
},
"JwtSeccion": {
 "Key": "clave-qweqwewqeqweqweqweqwe",
 "Issuer": "Issuer",
 "Audience": "Audience",
 "ExpiresInMinutes": 1000
},
La key Authentication puede estar dentro de los endpoint o fuera de el independientemente

2. En Program.cs
builder.Services.AddVulttechHttpClients(builder.Configuration, "ServiceEndpoints", "Authentication", "JwtSeccion");

Esto agrega automáticamente un HttpClient nombrado para cada microservicio.

🧑‍💻 Cómo usar
1. Inyectar la Factory
Csharp
public class UsuarioClient
{
     private readonly HttpClientVulttech _httpClienteVult;
     public UsuarioClient(IHttpClientVulttechFactory factory)
     {
              _httpClienteVult = factory.CreateClientVult("Usuarios")
     }
🔐 Autenticación
El método GetAsync, PostAsync, etc., aceptan un parámetro AuthenticationType:

csharp
public enum AuthenticationType
{
   None,
   Bearer,
   Basic,
   ApiKey
}
Ejemplo de POST con autenticación Bearer:

csharp
var usuario = new Usuario { Nombre = "Juan" };
Usuario usuarioResponse = await httpClienteVult.PostAsync<Usuario>("api/usuarios", usuario, AuthenticationType.Bearer);
🔍 Logging
Incluye logs de entrada/salida si inyectás ILogger<IHttpClientVulttech>.

📤 Métodos disponibles
csharp
Task<T?> GetAsync<T>(string requestUri, AuthenticationType auth = None);
Task<TResponse?> PostAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<TResponse?> PutAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<TResponse?> PatchAsync<TResponse>(string requestUri, object body, AuthenticationType auth = None);
Task<HttpResponseMessage> HeadAsync(string requestUri, AuthenticationType auth = None);
🤝 Requisitos
.NET 6 o superior

Configuración de ServiceEndpoints en tu aplicación

Token disponible en HttpContext si usás Bearer