Fhi.ClientCredentials.Refit
1.0.1
See the version list below for details.
dotnet add package Fhi.ClientCredentials.Refit --version 1.0.1
NuGet\Install-Package Fhi.ClientCredentials.Refit -Version 1.0.1
<PackageReference Include="Fhi.ClientCredentials.Refit" Version="1.0.1" />
paket add Fhi.ClientCredentials.Refit --version 1.0.1
#r "nuget: Fhi.ClientCredentials.Refit, 1.0.1"
// Install Fhi.ClientCredentials.Refit as a Cake Addin #addin nuget:?package=Fhi.ClientCredentials.Refit&version=1.0.1 // Install Fhi.ClientCredentials.Refit as a Cake Tool #tool nuget:?package=Fhi.ClientCredentials.Refit&version=1.0.1
Fhi.ClientCredentials.Refit
This package contains code to simplify working with Refit and HelseId.
This default setup will add a token handler to your Refit Interface in addition to letting you add multiple delegates if needed (f.ex. logging).
Usage
Include thhis code in your WebApi startup builder:
builder.AddClientCredentialsRefitBuilder()
.AddRefitClient<IMyRefitClient>();
If you want to add additional loggers add them before "AddRefitClient":
builder.AddClientCredentialsRefitBuilder()
.AddHandler<MyLoggingDelegationHandler>()
.AddRefitClient<IMyRefitClient>();
The code loads your configuration from IConfiguration using the section "ClientCredentialsConfiguration". If you want to override which section to use you can pass the correct section to AddClientCredentialsKeypairs:
builder.AddClientCredentialsRefitBuilder("CustomClientCredentialsConfiguration")
.AddRefitClient<IMyRefitClient>();
The default RefitSettings we are using use SystemTextJsonContentSerializer, is case insensitive and use camelCasing. If you want to override the default RefitSettings to use you can pass the settings to AddClientCredentialsKeypairs:
builder.AddClientCredentialsRefitBuilder(new RefitSettings())
.AddRefitClient<IMyRefitClient>();
Adding Correlation Id to all requests
Use "AddCorrelationId()" to add header propagation of the default FHI correlation id header.
builder.AddClientCredentialsRefitBuilder()
.AddCorrelationId()
.AddRefitClient<IMyRefitClient>();
A new correlation ID will be given to each request and response that does not contain the header when invoked. Remember to add usage of header propagation to your app startup code. It should be placed before any logging middleware:
app.UseCorrelationId();
More!
Add the handler "LoggingDelegationHandler" to automatically log all Refit requets. The logger has to be availible trough dependency injection using Microsoft.Extensions.Logging (ILogger).
builder.AddClientCredentialsRefitBuilder()
.AddHandler<LoggingDelegationHandler>();
Product | Versions 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. |
-
net6.0
- Fhi.ClientCredentialsKeypairs (>= 1.2.0)
- Microsoft.AspNetCore.HeaderPropagation (>= 6.0.24)
- NUnit (>= 4.0.0)
- Refit (>= 7.0.0)
- Refit.HttpClientFactory (>= 7.0.0)
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 |
---|---|---|
2.0.0-beta1 | 35 | 11/21/2024 |
1.2.3 | 247 | 10/7/2024 |
1.2.2 | 99 | 10/2/2024 |
1.2.1 | 88 | 10/1/2024 |
1.2.0 | 89 | 10/1/2024 |
1.1.3-alpha.1 | 223 | 5/6/2024 |
1.1.2 | 653 | 5/2/2024 |
1.1.1 | 91 | 5/2/2024 |
1.1.0 | 130 | 4/26/2024 |
1.0.3-alpha.2 | 94 | 1/10/2024 |
1.0.3-alpha.1 | 255 | 1/10/2024 |
1.0.2 | 402 | 1/10/2024 |
1.0.1 | 95 | 1/10/2024 |
1.0.0-beta.6 | 384 | 1/8/2024 |
1.0.0-beta.5 | 62 | 1/8/2024 |
1.0.0-beta.4 | 98 | 1/4/2024 |
1.0.0-beta.3 | 68 | 1/4/2024 |
1.0.0-beta.2 | 72 | 1/4/2024 |
1.0.0-beta.1 | 68 | 1/4/2024 |