Arbeidstilsynet.Common.Altinn 4.2.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Arbeidstilsynet.Common.Altinn --version 4.2.2
                    
NuGet\Install-Package Arbeidstilsynet.Common.Altinn -Version 4.2.2
                    
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.Altinn" Version="4.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Arbeidstilsynet.Common.Altinn" Version="4.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Arbeidstilsynet.Common.Altinn" />
                    
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.Altinn --version 4.2.2
                    
#r "nuget: Arbeidstilsynet.Common.Altinn, 4.2.2"
                    
#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.Altinn@4.2.2
                    
#: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.Altinn&version=4.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Arbeidstilsynet.Common.Altinn&version=4.2.2
                    
Install as a Cake Tool

Arbeidstilsynet.Common.Altinn

A collection of common patterns and extensions for cross-cutting concerns for applications which need to interact with Altinns APIs.

📖 Installation

To install the package, use the following command in your terminal:

dotnet add package Arbeidstilsynet.Common.Altinn

🚀 Features

  • Extension methods for common Altinn operations.
  • Altinn adapters for subscriptions, instance data and correspondence.
  • Altinn API clients for direct interaction with Altinn services.
  • Per-client configuration to register only the APIs you use, each with its own Maskinporten scopes.

🧑‍💻 Usage

Dependency Injection Setup

Register the APIs your application actually uses:

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var appSettings = builder.Configuration.GetRequired<MyAppSettings>();

services
    .AddAltinn(builder.Environment, appSettings.MaskinportenConfiguration)
    .AddStorage(o => o.Scopes = ["altinn:serviceowner/instances.read"])
    .AddEvents(o => o.Scopes = ["altinn:events.subscribe"])
    .AddSubscriptionAdapter();

AddAltinn registers the shared plumbing — configuration, URL resolution and the token pipeline — but nothing that talks to an Altinn API. Each Add* call opts into one API:

Call Registers
AddStorage() IAltinnStorageClient
AddEvents() IAltinnEventsClient
AddApps() IAltinnAppsClient
AddCorrespondence() IAltinnCorrespondenceClient
AddDialogporten() IAltinnDialogportenClient
AddSubscriptionAdapter() IAltinnSubscriptionAdapter, plus storage and events
AddStorageAdapter() IAltinnStorageAdapter, plus storage
AddMeldingerAdapter() IAltinnMeldingerAdapter, plus correspondence
AddAllClients() every API client

Adding a client twice is harmless, and configuration is independent of call order — so an adapter can pull in a client and you can still configure it afterwards:

services
    .AddAltinn(builder.Environment, appSettings.MaskinportenConfiguration)
    .AddSubscriptionAdapter()
    .AddStorage(o => o.Scopes = ["altinn:serviceowner/instances.read"]);

To register everything in one call, as in earlier versions:

services.AddAltinnAdapter(builder.Environment, appSettings.MaskinportenConfiguration);
services.AddAltinnApiClients(builder.Environment, appSettings.MaskinportenConfiguration);

Authentication

Altinn grants scopes per API, so each client requests a token carrying only the scopes it was registered with. Tokens are cached per distinct scope set, so clients sharing a scope set share a token.

Scopes come from the client's own Scopes, falling back to MaskinportenConfiguration.Scopes:

services
    .AddAltinn(builder.Environment, new MaskinportenConfiguration
    {
        // Used by any client that does not state its own scopes.
        Scopes = ["altinn:serviceowner/instances.read"],
        // ...credentials
    })
    .AddStorage()                                        // uses the shared scopes
    .AddEvents(o => o.Scopes = ["altinn:events.subscribe"]);  // uses its own

Both are optional individually, but a registered client must end up with at least one scope. If it does not, registration fails at startup naming the client involved, rather than surfacing as a rejected token on the first request. Targeting AltinnEnvironment.Local is exempt, since a local Altinn issues test tokens directly and never involves Maskinporten.

Choosing which Altinn to talk to

Which Altinn instance you reach is stated explicitly rather than inferred, because several host environments can legitimately target either TT02 or a local Altinn.

Host environment Altinn target Base URL overrides
Production Always production Rejected — registration throws
Staging TT02 by default Allowed, logged as a warning at startup
Anything else Must be specified Allowed

So in Development, Test, QA and similar you must say what you mean:

services.AddAltinn(
    builder.Environment,
    appSettings.MaskinportenConfiguration,
    new AltinnConfiguration { Environment = AltinnEnvironment.Tt02 }
);

Use AltinnEnvironment.Local to target a locally running Altinn on local.altinn.cloud:8000. This also selects the local test-token provider, so the tokens in use always match the instance being called.

To point every platform client at a mock server, override the platform URL. The API-specific base paths are appended automatically:

new AltinnConfiguration
{
    Environment = AltinnEnvironment.Tt02,
    Overrides = new AltinnUrlOverrides { PlatformUrl = new Uri("http://localhost:1234/") },
}

To move a single client, set its BaseUrl instead:

.AddStorage(o => o.BaseUrl = new Uri("http://localhost:1234/storage/api/v1"))

Both forms obey the same rule: rejected in Production, warned about elsewhere.

Looking up correspondences by idempotent key

IAltinnMeldingerAdapter.GetCorrespondenceByIdempotentKey is obsolete. It is only a small simplification of IAltinnCorrespondenceClient.GetCorrespondences and is hard-wired to dat-meldinger-correspondence, a resource owned by team Meldinger.

Inject IAltinnCorrespondenceClient (registered by AddCorrespondence() or AddMeldingerAdapter()) and specify the resource, role and idempotent key directly:

var result = await correspondenceClient.GetCorrespondences(
    resourceId: resourceId,
    role: CorrespondencesRoleType.Sender,
    idempotentKey: idempotentKey
);

To preserve the deprecated method's behavior, use dat-meldinger-correspondence as the resource ID. Otherwise, use the resource your application owns.

Correspondence attachments

Pass the files to CreateCorrespondence or InitializeCorrespondence, with matching attachment metadata in the request. The upload uses repeated attachments multipart file fields, preserving file order and names even when names repeat. PropertyList dictionary keys, including dots, are preserved using bracketed form keys. Requests without files still use the JSON endpoint.

Upload serialization extends the generated request builder with MultipartFormDataContent: Kiota's MultipartBody replaces parts with the same field name and file name. The extension retains the generated route and the configured authentication, resilience and error-reporting pipeline. A successful initialization is not proof of publication or attachment availability; Altinn processes the upload asynchronously.

Models and errors

The clients return the package's own models from Model.Api.Response and Model.Adapter. They are plain records, so they serialise with System.Text.Json the way you would expect and are safe to return from your own API.

The Kiota-generated types are an implementation detail and are internal. They are Kiota IParsable types rather than System.Text.Json POCOs, so exposing them would mean consumers could not serialise them faithfully — enums would become integers and free-form maps such as dataValues would gain an extra additionalData level that no serializer option removes.

Errors surface as Kiota's ApiException, which carries ResponseStatusCode. Where a missing resource is an expected outcome the adapters translate it rather than throwing: GetAltinnSubscription and GetCorrespondence return null, and UnsubscribeForCompletedProcessEvents returns false. Any other failure propagates.

When Altinn returns a problem details document, GetAltinnProblemDetails() reads it off the exception:

try
{
    await storageClient.GetInstance(instanceGuid);
}
catch (ApiException e)
{
    var problem = e.GetAltinnProblemDetails();

    logger.LogError(
        "Altinn returned {Status}: {Title} — {Detail} (trace {TraceId})",
        problem?.Status, problem?.Title, problem?.Detail, problem?.TraceId);
}

It returns null when the response carried no problem details, or when the request failed before a response arrived. Problem details are also read from the captured response body for status codes an endpoint does not declare, as long as the body is a complete JSON problem document with at least one supported member of the expected type (not one cut off by the 4,096-byte capture limit, which multibyte UTF-8 text reaches in fewer characters). Beyond the RFC 9457 fields, AltinnProblemDetails exposes the Altinn-specific Code, ErrorCode, StatusDescription, TraceId, ValidationErrors and Errors, each populated by the APIs that return them. Altinn Correspondence sends errorCode as a JSON number (for example 1030); ErrorCode then holds it as text ("1030").

Maskinporten token rejections throw MaskinportenTokenException from Model.Exceptions, an HttpRequestException exposing StatusCode, the OAuth ErrorCode (for example invalid_scope), ErrorDescription, the bounded raw ResponseBody and a read-only snapshot of RequestedScopes. Unavailable parsed fields are null; the raw body is retained. Consumers choose what to log, since response details can contain sensitive data.

Generation is scoped to the functional area each client serves — instances for storage and apps, subscriptions for events, and dialogs for Dialogporten. To reach an endpoint outside those areas, widen the relevant --include-path filter in GenerateClients.targets, regenerate, and expose it through the corresponding port.

🔄 Regenerating the clients

The OpenAPI specifications live alongside the source. They are inputs to generation only and are not shipped inside the package. Generated clients are not committed either: a normal dotnet build restores the repository-pinned Kiota tool and generates changed clients incrementally under obj. Node.js is required to prepare temporary copies of the specifications.

From the Altinn directory, force regeneration of every client with:

npm run generate:client

Generation never modifies the committed specifications. It prepares temporary copies under obj and adds the missing server declarations there. This matters because Kiota only wires a client's base URL up when the specification declares a server, and the Altinn apps and authentication specifications declare none.

Correspondence and Dialogporten publish a specification per environment. The clients are generated from the TT02 specifications, which are a strict superset of the production ones — generating a client per environment would split the generated model types in two. The consequence is that a production application can call an endpoint that has not yet been released to production and receive a 404. To check that the assumption still holds, run this from the Altinn directory:

npm run check:spec-drift

🤝 Contributing

This library follows standard .NET conventions and includes comprehensive unit tests. When contributing:

  1. Add unit tests for new functionality
  2. Follow existing code patterns
  3. Update documentation for new features
  4. Ensure all tests pass

📄 License

This project is licensed under the terms specified by Arbeidstilsynet.

Product Compatible and additional computed target framework versions.
.NET 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
4.3.2 415 11/12/2026
4.3.1 1,553 11/9/2026
4.3.0 518 11/2/2026
4.2.2 103 11/2/2026
4.2.1 914 10/15/2026
4.2.0 237 10/14/2026
4.1.0 149 10/14/2026
4.0.7 365 10/9/2026
4.0.6 512 10/5/2026
4.0.5 197 10/5/2026
4.0.4 322 10/1/2026
4.0.3 239 10/1/2026
4.0.3-alpha2 105 10/1/2026
4.0.3-alpha1 105 10/1/2026
4.0.2 141 10/1/2026
4.0.1 132 10/1/2026
4.0.1-alpha1 115 10/1/2026
4.0.0 142 9/30/2026
4.0.0-alpha9 162 9/24/2026
4.0.0-alpha10 331 9/29/2026
Loading failed

# 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. -->

- Exclude declared data types from attachments while retaining legacy classification when the exclusion list is absent.

### 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. -->

## 4.2.2

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 4.2.1

### Fixed

- Standardized NuGet metadata with Arbeidstilsynet as author, an MIT license expression, an embedded icon and Git repository details.

## 4.2.0

### Added

- Exclude declared data types from attachments while retaining legacy classification when the exclusion list is absent.

## 4.1.0

### Added

- Rejected Maskinporten token requests now throw `MaskinportenTokenException`, an `HttpRequestException` subclass exposing the OAuth `ErrorCode`, `ErrorDescription`, bounded raw `ResponseBody` and a read-only snapshot of `RequestedScopes`. The inherited HTTP status and response-body message are preserved. Malformed or truncated OAuth bodies leave parsed fields unset while retaining the raw body. Consumers can inspect provider details without parsing the exception message, and select safe fields for their own logging policy. Response details can contain sensitive data; the error code is also untrusted provider text. Token caching, cancellation and successful responses are unchanged.

## 4.0.7

### Deprecated

- `IAltinnMeldingerAdapter.GetCorrespondenceByIdempotentKey` is obsolete. It provides only a small simplification of `IAltinnCorrespondenceClient.GetCorrespondences` and is hard-wired to the `dat-meldinger-correspondence` resource owned by team Meldinger. Use `GetCorrespondences` with explicit `resourceId`, `role` and `idempotentKey` instead. Existing behavior is unchanged.

## 4.0.6

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 4.0.5

### Fixed

- File metadata now includes application-defined metadata from the Altinn data element.

## 4.0.4

### Fixed

- Correspondence uploads now repeat the `attachments` file field so Altinn's ASP.NET form binder receives every file, including files with identical names. The v4 indexed file fields bound to an empty list.
- Multipart `PropertyList` keys use bracket notation so dotted keys are preserved with their values. Previously these could bind to a truncated key with a null value and trigger a generic HTTP 500 in Altinn's property validation. JSON-only correspondence is unchanged.

## 4.0.3

### Fixed

- `GetAltinnProblemDetails()` now reads the captured error response body for what the generated clients drop: Altinn Correspondence's numeric `errorCode` (returned as text, e.g. `"1030"`) and its `code`, which its declared `ProblemDetails` type lacks. A complete JSON problem document returned with a status code the specification does not declare is now returned too, instead of `null`, if at least one supported member has the expected type. Problem details parsed by the generated clients take precedence, and a truncated, non-JSON or unrelated body is ignored.

## 4.0.2

### Fixed

- Maskinporten JWT assertions now include a unique `jti`, preventing concurrent token requests from submitting an identical grant and receiving `MP-012: Grant has been used before`.
- The Maskinporten client and its per-scope token cache are shared across dependency injection scopes, avoiding unnecessary token requests from scoped consumers.

## 4.0.1

### Fixed

- Maskinporten token failures now throw an `HttpRequestException` that includes the status code and Maskinporten's error response (e.g. `invalid_scope`), instead of only the status code.
- Failed requests from every Altinn client (Storage, Events, Apps, Correspondence, Dialogporten and Authentication) now throw an `ApiException` whose message names the client, the HTTP method and URL, the status code, and the response body Altinn returned (truncated to 4096 characters). Before, the message was generic, and the body was lost entirely for status codes the API spec does not declare. `ResponseStatusCode`, `ResponseHeaders` and `GetAltinnProblemDetails()` work as before.

## 4.0.0

### Added

- Granular registration. `services.AddAltinn(...)` returns a builder on which each API is opted into individually — `AddStorage()`, `AddEvents()`, `AddApps()`, `AddCorrespondence()`, `AddDialogporten()`, `AddSubscriptionAdapter()`, `AddStorageAdapter()`, `AddMeldingerAdapter()` — so an application only registers, and only authenticates against, the APIs it uses. `AddAllClients()` registers them all. Adding a client twice is a no-op, and configuration is independent of call order, so a client pulled in by an adapter can still be configured afterwards.
- Per-client configuration via `AltinnClientOptions`, carrying `Scopes` and `BaseUrl` for a single API. A per-client `BaseUrl` is subject to the same rule as `AltinnUrlOverrides`: rejected in Production, logged as a warning elsewhere.
- Per-client Maskinporten scopes. Each client requests a token carrying only the scopes it was registered with, rather than the union of everything the application is entitled to, and Maskinporten tokens are cached per distinct scope set. A registered client that ends up with neither its own scopes nor the shared fallback fails validation at startup, naming the client involved. Targeting `AltinnEnvironment.Local` is exempt, since it issues test tokens without involving Maskinporten.
- `ApiException.GetAltinnProblemDetails()`, returning the problem details document Altinn sent with an error response as an `AltinnProblemDetails`. The generated clients already parse these and throw them as the exception itself, but the parsed types are internal; this exposes their contents, including the Altinn-specific `Code`, `ErrorCode`, `StatusDescription`, `TraceId`, `ValidationErrors` and `Errors`. Returns `null` when the response carried no problem details.

### Changed

- **BREAKING**: Replaced the hand-written Altinn HTTP clients with [Kiota](https://learn.microsoft.com/openapi/kiota/)-generated clients, generated from Altinn's OpenAPI specifications. The generated types are `internal`: they are Kiota `IParsable` types rather than `System.Text.Json` POCOs, so exposing them would leave consumers unable to serialise them faithfully. The `IAltinn*Client` and adapter ports keep their shape and continue to exchange this package's own models.
- **BREAKING**: The public models are now records with `init` accessors, and response models mirror the nullability of the underlying Altinn schema — most properties are nullable. They are reduced to the subset of fields this package exposes, so `AltinnInstance` no longer carries `SelfLinks`, `DueBefore`, `VisibleAfter`, `Status`, `PresentationTexts`, `Refs` or `DeleteStatus`, and `DataElement` no longer carries `BlobStoragePath` or `Locked`.
- **BREAKING**: `AltinnConfiguration` no longer exposes `AuthenticationUrl`, `StorageUrl`, `EventUrl`, `CorrespondenceUrl`, `DialogportenUrl` or `AppBaseUrl`. It now carries an explicit `Environment` (`AltinnEnvironment.Production`, `Tt02` or `Local`) from which every base URL is derived, plus an optional `Overrides` for testing against a mock server.
- **BREAKING**: The Altinn instance to target is no longer inferred from the host environment alone. Production always targets production and rejects overrides; Staging defaults to TT02 and logs any override as a startup warning; every other host environment (Development, Test, QA, …) must state its target explicitly and throws at registration if it does not. `AltinnEnvironment.Local` preserves the previous local-development behaviour.
- **BREAKING**: `MaskinportenConfiguration.MaskinportenUrl` moved to `AltinnUrlOverrides.MaskinportenUrl`, so that every URL override is subject to the same rules.
- **BREAKING**: `MaskinportenConfiguration.Scopes` is optional, acting as the default for clients that do not state their own scopes.
- **BREAKING**: `IMaskinportenClient.GetToken` and `IAltinnTokenProvider.GetToken` take the scopes to request.
- **BREAKING**: The token provider now follows the resolved Altinn target rather than `IsDevelopment()`. A local test token can no longer be paired with TT02 URLs.
- **BREAKING**: `IAltinnAdapter` and its implementation are renamed to `IAltinnSubscriptionAdapter` and `AltinnSubscriptionAdapter`; the fluent registration method is now `AddSubscriptionAdapter()`.
- **BREAKING**: `IAltinnEventsClient.Unsubscribe` returns `Task` rather than `Task<HttpResponseMessage>`. `IAltinnSubscriptionAdapter.UnsubscribeForCompletedProcessEvents` accordingly returns `false` only when the subscription does not exist, and propagates any other failure instead of reporting `false` for every non-success status.
- **BREAKING**: `IAltinnStorageClient.GetInstance` takes a `Guid` rather than an `InstanceRequest`, and calls the storage API's guid-only endpoint. Altinn keeps the two-segment form that also requires an instance owner party id only for backwards compatibility. `GetInstanceData` still takes the party id, because data elements are only addressable through the older form.
- **BREAKING**: Errors surface as Kiota's `ApiException` rather than `HttpRequestException` or `AltinnHttpRequestException`. Both adapters still return `null` for a missing resource.
- **BREAKING**: All client and adapter methods accept an optional `CancellationToken`.
- `InstanceQueryParameters` properties are `init`-only and its optional filters are nullable, matching the fact that they are optional.
- The correspondence multipart upload uses the field names and casing declared by the specification.

### Removed

- **BREAKING**: `HostEnvironmentExtensions` (`CreateDefaultAltinnConfiguration`, `GetMaskinportenUrl`, `GetAltinnPlattformUrl`, `GetAltinnAppBaseUrl`). Base URLs are resolved from `AltinnConfiguration.Environment` instead.
- **BREAKING**: `MappedQueryParameterAttribute` and `MappedRequestHeaderParameterAttribute`. Query parameters are now mapped explicitly rather than by reflection over attributes.
- **BREAKING**: `AltinnHttpRequestException`, which belonged to the retired hand-written HTTP layer and can no longer be thrown. Catch Kiota's `ApiException` and call `GetAltinnProblemDetails()` instead.
- **BREAKING**: Removed the deprecated correspondence `Sender` property. Altinn now determines the sender automatically from the Resource Registry using `ResourceId`.

### Fixed

- The generated apps and authentication clients could not build a URL at all, because Kiota only emits the `baseurl` path parameter when a specification declares a server and neither specification does. The token exchange sits on the critical path for every authenticated call, so this would have failed on the first request. The specifications are normalised as part of client generation.
- The generated storage and apps clients indexed instances by a `Guid` where Altinn expects an integer party id, because both specifications contain paths that collide at the same position in the request-builder tree and Kiota silently merged them.
- The Maskinporten token request ignored its `CancellationToken`, because the bespoke HTTP layer it used had no way to accept one. That layer is now gone entirely.
- Absolute storage data links are restricted to the configured storage API before the authenticated request is sent.
- The token provider lifetime now matches its scoped authentication client dependencies.
- Apps, events and correspondence mappings preserve the data, filters, nested content and notification fields exposed by the public models.
- Correspondence multipart requests retain every uploaded attachment instead of replacing earlier files.
- The correspondence multipart upload sent its form fields in camelCase where the specification declares PascalCase. Form binding is case-insensitive, so this was latent rather than broken.
- `InitializeCorrespondenceContent.Language` defaults to `nb`, as the correspondence specification declares. Leaving it unset previously omitted the field from the request.

### Notes

- The generated clients are scoped to the functional area each high-level client serves rather than the whole specification: instances for storage and apps, subscriptions for events, and dialogs for Dialogporten. Endpoints outside those areas are not generated, so reaching one means widening the filter in `GenerateClients.targets`, regenerating, and exposing it through the corresponding port.
- The generated clients are no longer committed. MSBuild restores the repository-pinned Kiota tool and generates each changed client incrementally under `obj`; `dotnet clean` removes them. Specifications are prepared as temporary copies so generation can add missing server declarations without modifying the committed inputs.
- The OpenAPI specifications are no longer shipped inside the package. They are inputs to client generation only and remain versioned in the repository.
- `AltinnCloudEvent` remains hand-written and must not be replaced by the generated `Events.Models.CloudEvent`: the events specification models `specversion` as an object rather than the string Altinn actually sends, so binding a real event to the generated model throws and an `[ApiController]` returns a 400. That would break subscription setup outright, since Altinn requires a success response to its `platform.events.validatesubscription` event before activating a subscription.
- `InstanceQueryParameters` also remains hand-written, because Kiota omits header parameters from the generated query-parameter class and the storage query needs `X-Ai-InstanceOwnerIdentifier`.
- Correspondence and Dialogporten publish a specification per environment. Both TT02 specifications are a strict superset of their production counterparts, so a single client is generated per API from TT02; generating one per environment would split the model types. A production application may therefore see a `404` from an endpoint that has not yet been released to production. `npm run check:spec-drift` fails if production ever declares a path or schema that TT02 lacks.

## 3.4.0

### Added

- feat: add `GetCorrespondences` to `IAltinnCorrespondenceClient` supporting all Altinn correspondence lookup query parameters (resourceId, from, to, status, role, onBehalfOf, sendersReference, idempotentKey, altinn2CorrespondenceId).
- feat: add `GetCorrespondenceByIdempotentKey` to `IAltinnMeldingerAdapter`, looking up correspondences by idempotent key using role `Sender` and resource `dat-meldinger-correspondence`.

### Changed

- feat!: replace `IAltinnCorrespondenceClient.GetCorrespondenceByIdempotentKey` with the more general `GetCorrespondences`. The idempotent-key lookup convenience now lives on `IAltinnMeldingerAdapter`.

## 3.3.0

### Added

- feat: enhance altinn meldinger adapter with lookup by idempotent key method

## 3.2.4

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 3.2.3

### Fixed

- fix(altinn): `GetNonCompletedInstances` now handles per-instance summary failures by logging a warning and continuing with remaining instances.
- fix(altinn): replaced generic `InvalidOperationException` throws in instance summary flow with custom exceptions containing instance-specific context.

## 3.2.2

### Fixed

- fix(altinn): `GetSpecification` no longer throws `NullReferenceException` when `DataValues` is `null` on an `AltinnInstance`

## 3.2.1

### Changed

- chore(altinn): Updated default URL mapping for development environment to match new altinn studiocli setup.

## 3.2.0

### Added

- feat(altinn): Added `Validated` property to `AltinnSubscription` response model, indicating whether the subscription has been validated by Altinn.

## 3.1.1

### Fixed

- fix(altinn): added necessary null checks when converting an altinn instance to metadata

## 3.1.0

### Added

- feat(altinn): Enhace `AltinnMetaData` to include dialogId and all DataValues which come from an altinn instance.
- feat(altinn): Added ``AltinnDialogportenClient`` to support communication with dialogporten. Can be injected via ``IAltinnDialogportenClient`` and requires a maskinporten integration with the following altinn scope to work: `altinn:serviceowner`. Right now the client only supports one method to retrieve a dialogId based on an instanceId.
- fix(extensions): make all methods in `HostEnvironmentExtensions` publicly available

## 3.0.0

### Removed

- **BREAKING**: Removed dependency on `Arbeidstilsynet.Common.AspNetCore.Extensions`

### Changed

- Added `FrameworkReference` to `Microsoft.AspNetCore.App` for ASP.NET Core types

## 2.6.1

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 2.6.0

### Added

- feat(altinn): Added ``AltinnCorrespondenceClient`` to support posting correspondences, with and without attachments. Can be injected via ``IAltinnCorrespondenceClient`` and requires a maskinporten integration with the following altinn scope to work: `altinn:correspondence.write`. It is also possible to retrieve a correspondence by ID.
- feat(altinn): Added ``AltinnMeldingerAdapter`` to make usage of the ``IAltinnCorrespondenceClient`` easier. Can be injected via ``IAltinnMeldingerAdapter``.

### Changed

- feat(maskinporten): Updated MaskinportenConfiguration to also support jwt token generation which includes a key identifier (`kid`) instead of only supporting identification by a certificate chain.

## 2.5.0

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 2.4.2

### Fixed

- Fixed a bug where a partial altinn configuration would overwrite defaults.

## 2.4.1

### Changed

- chore: moved package to nuget.org

## 2.4.0

### Added

- feat(altinn): Differentiate between structured data and the main content of the instance.
 - Implements the StructuredData configuration from AltinnApp 2.4.0.
 - Adds DataType and Id from the Altinn DataElement to the FileMetadata of the AltinnDocument.

## 2.3.0

### Added

- feat(altinn): Enhanced ``AltinnEventsClient`` to support retrieving details for a subscriptions. Also updated ``IAltinnAdapter`` to implement a convenience method for getting these details.

## 2.2.0

### Changed

- changed(deps): Applied minor and patch updates to dependencies

## 2.1.0

### Added

- feat(altinn): Enhanced ``AltinnEventsClient`` to support Unsubscribing. Also updated ``IAltinnAdapter`` to implement a convenience method for unsubscribing.

## 2.0.2

### Added

- feat(altinn): Added function to return only metadata for non completed instances (in order to not download attachments)

## 2.0.1

### Changed

- changed(deps): Updated internal package referances (remove prerelease version)

## 2.0.0

### Changed

- changed(deps): Major dotnet updated (v10)

## 1.4.0

### Changed

- changed: using "structured-data" as default dataType for MainDocument.

## 1.3.2

### Added

- chore: added extension methods to create a Dictionary based on `AltinnMetadata`.

## 1.3.1

### Fixed

- fix: add nullable declarations to `AltinnCloudEvent` dto to enable usage in a dotnet Controller.

## 1.3.0

### Changed

- changed: split up package to only contain logic to communicate with Altinns API. All logic with is only relevant for altinn apps was moved to the new AltinnApp package.

## 1.2.0

### Changed

- fix(deps): use correct version range to only support Microsoft version 8.* packages

## 1.1.0

### Fixed

- fix: move complete action to new "Apps Client" since all mutable instance actions must go through Apps Api instead of Storage Api

## 1.0.0

### Added

- feat: add altinn token provider and clients to handle token exchange

## 0.0.4

### Changed

- chore: enhance altinn metadata with process started / ended

## 0.0.3

### Changed

- chore(renovate): all non major update

## 0.0.2

### Changed

- chore(altinn-adapter): update FileMetadata model to return an enum of FileScanResults instead of a string

## 0.0.1

### Added

- **API Clients** to be used to consume public Altinn APIs
 - `Storage Api Client` for the storage API (Instance Data)
 - `Event Api Client` for the event API (Subscriptions)
- **Extension Methods** for common Altinn operations
 - `InstanceExtensions` - Extract GUID, app name, and party ID from instances
 - `DataClientExtensions` - Simplified form data retrieval and element deletion
 - `AssemblyExtensions` - Load and deserialize embedded JSON resources
- **Abstract Data Processors** for handling form data changes
 - `BaseDataProcessor<T>` - Base class for type-specific data processing
 - `MemberProcessor<T, TMember>` - Process changes to specific object members
 - `ListProcessor<T, TItem>` - Handle list/collection changes with item-level processing
- **Country Code Lookup Service** (`ILandskodeLookup`)
 - Country anmes and dial codes for 238 countries
- **Altinn Options Provider** for country dropdowns
 - `LandOptions` for Altinn dropdowns etc.