Dibk.Oppsamlingsregister.IngestApi.Client
1.0.17
dotnet add package Dibk.Oppsamlingsregister.IngestApi.Client --version 1.0.17
NuGet\Install-Package Dibk.Oppsamlingsregister.IngestApi.Client -Version 1.0.17
<PackageReference Include="Dibk.Oppsamlingsregister.IngestApi.Client" Version="1.0.17" />
<PackageVersion Include="Dibk.Oppsamlingsregister.IngestApi.Client" Version="1.0.17" />
<PackageReference Include="Dibk.Oppsamlingsregister.IngestApi.Client" />
paket add Dibk.Oppsamlingsregister.IngestApi.Client --version 1.0.17
#r "nuget: Dibk.Oppsamlingsregister.IngestApi.Client, 1.0.17"
#:package Dibk.Oppsamlingsregister.IngestApi.Client@1.0.17
#addin nuget:?package=Dibk.Oppsamlingsregister.IngestApi.Client&version=1.0.17
#tool nuget:?package=Dibk.Oppsamlingsregister.IngestApi.Client&version=1.0.17
Dibk.Oppsamlingsregister.IngestApi.Client
A lightweight .NET client for sending batches to the Oppsamlingsregisteret Ingest API. It is designed for use with IHttpClientFactory, handles multi-file uploads (multipart/form-data), and provides resilient retries with exponential backoff + jitter. Authentication/authorization is expected to be handled by the Azure resource itself (for example RBAC on the managed identity or by exposing the API only inside a private VNet), so the client does not attach tokens or API keys.
Contents
- Installation
- Target framework
- Quickstart
- Usage
- Configuration options
- Error handling
- Publishing to NuGet
- Notes
- License
Installation
dotnet add package Dibk.Oppsamlingsregister.IngestApi.Client
Target frameworks
- .NET 8.0
- .NET 10.0
Quickstart
Via appsettings.json
OppsamlingsregisterIngestApiOptions can be bound directly from configuration. The DI extension registers an HttpClient, binds the options, and sets sensible defaults (BaseAddress, Accept: application/json, Timeout).
{
"OppsamlingsregisterIngestApiOptions": {
"BaseUrl": "https://ingest.example.com",
"RetryCount": 3,
"RetryBaseDelayMs": 250
}
}
// Program.cs
builder.Services.AddOppsamlingsregisterIngestApiClient(builder.Configuration);
// IOppsamlingsregisterIngestApiClient can now be injected
Programmatic configuration
You can also configure the client without appsettings by passing an Action<OppsamlingsregisterIngestApiOptions>.
builder.Services.AddOppsamlingsregisterIngestApiClient(opts =>
{
opts.BaseUrl = "https://ingest.example.com";
opts.RetryCount = 3;
opts.RetryBaseDelayMs = 250;
});
Usage
IOppsamlingsregisterIngestApiClient exposes SendBatchAsync to submit a batch of files. The client builds a multipart/form-data request containing metadata (archiveReference, distributionSubmittalType, sentAtUtc) alongside every file in the IngestRequest.
using Dibk.Oppsamlingsregister.IngestApi.Client;
using Dibk.Oppsamlingsregister.IngestApi.Client.Models;
public class MyService(IOppsamlingsregisterIngestApiClient client)
{
public async Task RunAsync(CancellationToken ct)
{
var request = new IngestRequest
{
ArchiveReference = "ar-2025-09-08-001",
DistributionSubmittalType = "demo",
Files = new[]
{
new IngestFilePart
{
FileName = "data.xml",
ContentType = "application/xml",
Metadata = new Dictionary<string, string>
{
["source"] = "client-demo",
["note"] = "optional"
},
OpenReadAsync = _ => Task.FromResult<Stream>(File.OpenRead("data.xml"))
},
new IngestFilePart
{
FileName = "map.gml",
ContentType = "application/gml+xml",
OpenReadAsync = _ => Task.FromResult<Stream>(File.OpenRead("map.gml"))
}
}
};
await client.SendBatchAsync(request, ct);
}
}
IngestFilePart.OpenReadAsyncmust return a new stream for every attempt (retries included), therefore it is aFunc<CancellationToken, Task<Stream>>. Add per-file metadata using theMetadatadictionary when needed.
Configuration options
All settings live on OppsamlingsregisterIngestApiOptions:
| Field | Type | Default | Description |
|---|---|---|---|
BaseUrl |
string |
– | Base URL of the ingest API (no trailing slash). |
RetryCount |
int |
3 |
Number of retries for transient failures (HTTP 5xx/408/connection issues). |
RetryBaseDelayMs |
int |
250 |
Base delay (ms) for exponential backoff with jitter. |
Error handling
- Transient failures (HTTP 5xx/408, network/timeout exceptions) trigger exponential backoff with jitter. The number of attempts is controlled by
RetryCount. - Non-transient failures (or when the retry budget is exhausted) throw
IngestApiExceptionwith the HTTP status and any raw response payload as text. - On success the API is expected to return
204 No Content, soSendBatchAsyncsimply completes.
Publishing to NuGet
Tag a release:
git tag ingest-client_1.2.3
git push origin ingest-client_1.2.3
Notes
- Authentication: access control should be enforced at the Azure resource (e.g. RBAC on the managed identity or private endpoints inside a VNet). The client intentionally omits auth headers/tokens.
- Models: see
IOppsamlingsregisterIngestApiClient,IngestFilePart, andIngestRequestfor the payload structure. - DI registration: use
AddOppsamlingsregisterIngestApiClient(...)with either theIConfigurationorAction<OppsamlingsregisterIngestApiOptions>overload.
License
MIT
| 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
- Azure.Core (>= 1.50.0)
- Azure.Identity (>= 1.17.1)
-
net8.0
- Azure.Core (>= 1.50.0)
- Azure.Identity (>= 1.17.1)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.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.17 | 332 | 1/21/2026 |
| 1.0.15 | 94 | 1/20/2026 |
| 1.0.14 | 270 | 11/28/2025 |
| 1.0.13 | 139 | 11/28/2025 |
| 1.0.12 | 187 | 11/27/2025 |
| 1.0.11 | 369 | 11/21/2025 |
| 1.0.10 | 557 | 11/19/2025 |
| 1.0.9 | 406 | 11/19/2025 |
| 1.0.8 | 446 | 11/18/2025 |
| 1.0.7 | 396 | 11/18/2025 |
| 1.0.6 | 403 | 11/18/2025 |
| 1.0.5 | 339 | 11/17/2025 |
| 1.0.4 | 236 | 11/14/2025 |
| 1.0.3 | 260 | 11/14/2025 |
| 1.0.2 | 284 | 11/13/2025 |
| 1.0.1 | 198 | 9/9/2025 |
| 1.0.0 | 177 | 9/9/2025 |
| 0.0.1 | 183 | 9/9/2025 |