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

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 SaksarkivClient and request/response models
  • AddSaksarkivClient(...) for dependency injection
  • SaksarkivConfiguration for base URL and scope
  • ISaksarkivTokenProvider so 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 POST requests 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 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. 
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.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.