HttpConnector 1.0.0

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

// Install HttpConnector as a Cake Tool
#tool nuget:?package=HttpConnector&version=1.0.0

HttpConnector

Custom HttpClient connector where you can consume external or internal APIs with custom model and plugin module.

Documentation

Follow the link for Git Repository

How to use

  1. Add the HttpConnector package
  2. Create the models for request & response
  3. Create the instance of HttpConnector with request & response model
  4. Call the method (either Get, Post, Put, Delete or Patch)

Usage/Examples

using HttpConnection;

// initialize the instance
HttpConnector<WeatherResponse, WeatherRequest> httpWeatherConnector
    = new HttpConnector<WeatherResponse, WeatherRequest>(new Uri("http://api.weatherstack.com/"), null, null);

// consume post call
var result = await httpWeatherConnector.Post($"current?access_key=<api key>&query={city}", null); // pass your API key    

Custom overridden method

To use any custom method to update the HttpClient use the below method.

  1. Create a class and inherited from IHttpConnectorModule
  2. Write down your custom code to modify the HttpClient
  3. Add the class in HttpConnector while initializing
public class WeatherHttpService : IHttpConnectorModule
{
    public async Task<HttpClient> ModifyClient(HttpClient client)
    {
        // your code
        return client;
    }
}
// initialize the instance
HttpConnector<WeatherResponse, WeatherRequest> httpWeatherConnector
    = new HttpConnector<WeatherResponse, WeatherRequest>(new Uri("http://api.weatherstack.com/")
    , null, typeof(WeatherHttpService));
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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 138 7/21/2023