Arbeidstilsynet.Common.Saksarkiv
1.0.3
dotnet add package Arbeidstilsynet.Common.Saksarkiv --version 1.0.3
NuGet\Install-Package Arbeidstilsynet.Common.Saksarkiv -Version 1.0.3
<PackageReference Include="Arbeidstilsynet.Common.Saksarkiv" Version="1.0.3" />
<PackageVersion Include="Arbeidstilsynet.Common.Saksarkiv" Version="1.0.3" />
<PackageReference Include="Arbeidstilsynet.Common.Saksarkiv" />
paket add Arbeidstilsynet.Common.Saksarkiv --version 1.0.3
#r "nuget: Arbeidstilsynet.Common.Saksarkiv, 1.0.3"
#:package Arbeidstilsynet.Common.Saksarkiv@1.0.3
#addin nuget:?package=Arbeidstilsynet.Common.Saksarkiv&version=1.0.3
#tool nuget:?package=Arbeidstilsynet.Common.Saksarkiv&version=1.0.3
Arbeidstilsynet.Common.Saksarkiv
Generated Saksarkiv client with reusable configuration and dependency injection extensions.
Installation
dotnet add package Arbeidstilsynet.Common.Saksarkiv
What the package contains
- The generated
SaksarkivClientand request/response models AddSaksarkivClient(...)for dependency injectionSaksarkivConfigurationfor base URL and scopeISaksarkivTokenProviderso the consuming app can decide how access tokens are fetched
Registering the client
The package does not depend on Texas or any other project-specific token provider. Consumers must register an ISaksarkivTokenProvider implementation themselves.
using Arbeidstilsynet.Common.Saksarkiv.DependencyInjection;
using Arbeidstilsynet.Common.Saksarkiv.DependencyInjection.Configuration;
using Arbeidstilsynet.Common.Saksarkiv.Ports;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<ISaksarkivTokenProvider, MySaksarkivTokenProvider>();
builder.Services.AddSaksarkivClient(
new SaksarkivConfiguration
{
BaseUrl = "https://saksarkiv.example.no/",
Scope = "api://saksarkiv/.default",
}
);
If you need to customize the retry/timeouts/circuit-breaker behavior, use the resilience callback:
builder.Services.AddScoped<ISaksarkivTokenProvider, MySaksarkivTokenProvider>();
builder.Services.AddSaksarkivClient(
new SaksarkivConfiguration
{
BaseUrl = "https://saksarkiv.example.no/",
Scope = "api://saksarkiv/.default",
},
options =>
{
options.Retry.MaxRetryAttempts = 2;
options.AttemptTimeout.Timeout = TimeSpan.FromSeconds(15);
options.TotalRequestTimeout.Timeout = TimeSpan.FromMinutes(1);
}
);
The default resilience settings are:
- 2 retry attempts
- 5 seconds retry delay
- 15 seconds per-attempt timeout
- 1 minute total request timeout
- retries disabled for all
POSTrequests and for/apiv2/health*
Token provider example
using Arbeidstilsynet.Common.Saksarkiv.Ports;
public sealed class MySaksarkivTokenProvider : ISaksarkivTokenProvider
{
public async Task<string> GetAccessToken(
string scope,
CancellationToken cancellationToken = default
)
{
// Replace with the token source used by your application.
return await Task.FromResult("access-token");
}
}
Usage
You can use SaksarkivClient directly, but it is highly recommended that you wrap it in your own narrow interface that matches the intended use in that service or bounded context. That keeps tests simpler, avoids coupling every consumer to the full Saksarkiv API surface, and gives you a stable seam if the generated fluent API changes later.
Define an interface for only the operations your service needs, and implement it as a thin adapter over SaksarkivClient:
using Arbeidstilsynet.Common.Saksarkiv;
using Arbeidstilsynet.Common.Saksarkiv.Models.Entiteter.Meldinger;
public interface IArchiveClient
{
Task<bool?> CreateCase(OpprettSakParameter parameter, CancellationToken cancellationToken);
}
public sealed class SaksarkivArchiveClient(SaksarkivClient saksarkivClient) : IArchiveClient
{
public async Task<bool?> CreateCase(OpprettSakParameter parameter, CancellationToken cancellationToken)
{
var response = await saksarkivClient.Apiv2.Sak.Opprett.PostAsync(
parameter,
cancellationToken: cancellationToken
);
return response?.Success;
}
}
Register the adapter alongside the client:
builder.Services.AddScoped<ISaksarkivTokenProvider, MySaksarkivTokenProvider>();
builder.Services.AddSaksarkivClient(...);
builder.Services.AddScoped<IArchiveClient, SaksarkivArchiveClient>();
The rest of your application then depends on IArchiveClient, not on SaksarkivClient directly.
AddSaksarkivClient(...) also registers a health check named Saksarkiv.
| 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. 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 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.9)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Kiota.Bundle (>= 2.0.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.9)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Kiota.Bundle (>= 2.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 |
|---|---|---|
| 1.0.3 | 2,036 | 7/3/2026 |
| 1.0.2 | 208 | 7/1/2026 |
| 1.0.1 | 376 | 6/25/2026 |
| 1.0.0 | 146 | 6/25/2026 |
| 1.0.0-alpha1 | 122 | 6/24/2026 |
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added <!-- for new features. -->
### Changed <!-- for changes in existing functionality. -->
### Deprecated <!-- for soon-to-be removed features. -->
### Removed <!-- for now removed features. -->
### Fixed <!-- for any bug fixes. -->
### Security <!-- in case of vulnerabilities. -->
## 1.0.3
### Changed
- changed(deps): Regenerated the client with Kiota `1.32.4`.
## 1.0.2
### Changed
- changed(deps): Applied minor and patch updates to dependencies
## 1.0.1
- Added XML documentation comments for `ISaksarkivTokenProvider` to improve package API documentation.
## 1.0.0
- Initial package with generated Saksarkiv client, configuration, and dependency injection support.
- Bumped `Microsoft.Kiota.Bundle` to `2.0.0` and updated regeneration instructions to the latest Kiota CLI.