KolClient 1.0.7

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

Start by defining headers to use with the http client.

E.g. for consuming soap services
var specialHeaders = new HeaderInfo[]
   {
       new HeaderInfo
       {
           Header = Constants.ACCEPT,
           Value = "*/*"
       }
   };
Define a base url in appsettings json
"BaseUrl": "http://127.0.0.1:1234/"

Inject the http client
builder.InjectHttpServiceFromBaseUrl(useUnsafe: true, specialHeaders: specialHeaders, configureAsJson: false);
useUnsafe means trust any ssl certificate

configureAsJson means accept header should be set to json. For soap set this to false

There are 3 ways of injecting http client

InjectHttpServiceFromBaseUrl
explained above

InjectHttpServiceFromSection
provide the appsettings json section name e.g. Urls:BaseUrl

InjectHttpService
Set everything manually

Explore the methods in KolHttpClient - GET, PUT, POST, DELETE, and methods for adding headers and all. There is also KolUtils, a static class which provides other helpful methods like base 64 encoding and decoding, Xml and JSON serialization and deserialization.

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.  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.7 213 12/9/2024
1.0.6 224 5/8/2024
1.0.5 237 2/15/2024
1.0.4 226 2/9/2024
1.0.3 228 1/17/2024
1.0.2 268 1/2/2024
1.0.1 260 11/29/2023
1.0.0 236 11/16/2023

Injecting:

public static void InjectKolClient(this WebApplicationBuilder builder)
       {
           var specialHeaders = new HeaderInfo[]
           {
               new HeaderInfo
               {
                   Header = Constants.ACCEPT,
                   Value = "*/*"
               }
           };

           builder.InjectHttpServiceFromBaseUrl(useUnsafe: KolUtils.GetValueFromAppSettings<bool>(builder.Configuration, "UseUnsafe"),
               specialHeaders: specialHeaders, configureAsJson: KolUtils.GetValueFromAppSettings<bool>(builder.Configuration, "ConfigureAsJson"));
       }