Fhi.VersionApiClient
2.0.2
dotnet add package Fhi.VersionApiClient --version 2.0.2
NuGet\Install-Package Fhi.VersionApiClient -Version 2.0.2
<PackageReference Include="Fhi.VersionApiClient" Version="2.0.2" />
paket add Fhi.VersionApiClient --version 2.0.2
#r "nuget: Fhi.VersionApiClient, 2.0.2"
// Install Fhi.VersionApiClient as a Cake Addin #addin nuget:?package=Fhi.VersionApiClient&version=2.0.2 // Install Fhi.VersionApiClient as a Cake Tool #tool nuget:?package=Fhi.VersionApiClient&version=2.0.2
Fhi.VersionApiClient
Small client to be used in clients that needs to upload version information to the Fhi.VersionApi. This applies to components that can not be reached directly from the Fhi Azure DevOps service.
Use of this client allows the component to instead upload its version information to the Fhi Azure VersionApi service.
Setup (using No authentication)
In program.cs, add the following:
services.AddVersionApiClient();
If you're using the Fhi.HelseId with Refit, add a section in the appsettings.json for HelseIdWebKonfigurasjon or HelseIdApiKonfigurasjon under the Apis
section:
{
"Name": "VersionService",
"Url": "https://versionapi-felles-fhi.azurewebsites.net/"
}
This url can be used for both test and production.
In the program.cs locate the builder.AddHelseidRefitBuilder()
and add the following line:
.AddRefitClient<IVersionApi>(nameof(VersionService))
Usage
Create a service class that set up the system and component names, and retrieves the environment.
An example implementation can be like:
namespace Fhi.Grunndata.OppslagWeb.Services;
public interface IOppslagsWebVersionService
{
Task UploadVersionInfo(string status="healthy");
}
public class OppslagsWebVersionService(IVersionService versionService) : IOppslagsWebVersionService
{
const string System = "Fhi.Grunndata";
const string Component = "OppslagWeb";
public async Task UploadVersionInfo(string status)
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (!string.IsNullOrEmpty(environment))
await versionService.UploadVersionInformation(environment, System, Component, status);
}
}
Locate a suitable place in the component which is accessed at start, or regularly, like a Ping function, inject your implementation based onm OppslagsWebVersionService, and call the UploadVersionInformation
method
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Refit (>= 8.0.0)
- Refit.HttpClientFactory (>= 8.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.2 | 42 | 11/27/2024 |