ArByte.Kvk.Api.Client
1.0.0
dotnet add package ArByte.Kvk.Api.Client --version 1.0.0
NuGet\Install-Package ArByte.Kvk.Api.Client -Version 1.0.0
<PackageReference Include="ArByte.Kvk.Api.Client" Version="1.0.0" />
<PackageVersion Include="ArByte.Kvk.Api.Client" Version="1.0.0" />
<PackageReference Include="ArByte.Kvk.Api.Client" />
paket add ArByte.Kvk.Api.Client --version 1.0.0
#r "nuget: ArByte.Kvk.Api.Client, 1.0.0"
#:package ArByte.Kvk.Api.Client@1.0.0
#addin nuget:?package=ArByte.Kvk.Api.Client&version=1.0.0
#tool nuget:?package=ArByte.Kvk.Api.Client&version=1.0.0
Kvk.Api.Client
Een eenvoudige, sterk getypeerde en configureerbare .NET API-client voor de Kvk API bedrijfsregistratie-API. Ondersteunt zoeken, basisprofiel, vestigingsprofiel, naamgeving en mutatieservice met ingebouwde foutverwerking en eenvoudige DI-integratie.
Features
- Automatische foutverwerking met expliciete uitzonderingen voor API-fouten
- Ondersteunt annuleringstokens voor asynchrone aanroepen
- Eenvoudige integratie met
IHttpClientFactoryen Dependency Injection - Inclusief integratietests om API-interacties te verifi�ren
Installatie
Install de NuGet package met:
dotnet add package ArByte.Kvk.Api.Client
Getting Started
Registratie van de cli�nt
Configureer uw services in Startup.cs of waar DI configureert wordt:
// Registreer alle Kvk API clients:
services.AddKvkApiClients(Configuration.GetSection("Kvk"));
// Of registreer afzonderlijk:
services.AddKvkApiV1Client(Configuration.GetSection("Kvk"));
services.AddKvkApiV2Client(Configuration.GetSection("Kvk"));
Uw configuratie moet minimaal het volgende bevatten:
{
"Kvk": {
"ApiKey": "your_api_key_here"
}
}
Gebruiksvoorbeeld
Injecteer IKvkApiV1Client of IKvkApiV2Client in een service of controller:
public class KvkService
{
private readonly IKvkApiV2Client _kvkApiV2Client;
public KvkService(IKvkApiV2Client kvkApiV2Client)
{
_kvkApiV2Client = kvkApiV2Client;
}
public async Task PrintCompanyNameAsync(string kvkNummer, CancellationToken cancellationToken = default)
{
var request = new ZoekRequest()
{
KvkNummer = kvkNummer,
};
var response = await _kvkApiV2Client.ZoekenAsync(request, cancellationToken);
foreach (var resulaat in response.Resultaten)
{
Console.WriteLine($"{resulaat.KvkNummer}: {resulaat.Naam}");
}
}
}
Foutafhandeling
API-fouten gooien expliciete uitzonderingen af die afgeleid zijn van KvkApiException, zoals:
KvkApiBadRequestException(400)KvkApiNotFoundException(404)KvkApiServerException(500)- En andere volgens de Kvk IPD codes.
Gebruik try-catch-blokken om deze op een nette manier af te handelen.
Testen
Inclusief integratietests met xUnit om het gedrag van de live API te verifi�ren.
Configureer je KVK_API_KEY omgevingsvariabele voordat je de tests uitvoert.
Bijdragen
Bijdragen zijn welkom! Open issues of pull requests.
Licentie
Dit project is gelicentieerd onder de MIT-licentie � zie het LICENSE bestand voor details.
Links
| 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 was computed. 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. |
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0 && < 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0 && < 10.0.0)
- Microsoft.Extensions.Http (>= 9.0.0 && < 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.0 | 201 | 9/24/2025 |