UKHO.ADDS.Clients.Common 0.0.50728-alpha.8

Prefix Reserved
This is a prerelease version of UKHO.ADDS.Clients.Common.
dotnet add package UKHO.ADDS.Clients.Common --version 0.0.50728-alpha.8
                    
NuGet\Install-Package UKHO.ADDS.Clients.Common -Version 0.0.50728-alpha.8
                    
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="UKHO.ADDS.Clients.Common" Version="0.0.50728-alpha.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UKHO.ADDS.Clients.Common" Version="0.0.50728-alpha.8" />
                    
Directory.Packages.props
<PackageReference Include="UKHO.ADDS.Clients.Common" />
                    
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 UKHO.ADDS.Clients.Common --version 0.0.50728-alpha.8
                    
#r "nuget: UKHO.ADDS.Clients.Common, 0.0.50728-alpha.8"
                    
#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 UKHO.ADDS.Clients.Common@0.0.50728-alpha.8
                    
#: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=UKHO.ADDS.Clients.Common&version=0.0.50728-alpha.8&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=UKHO.ADDS.Clients.Common&version=0.0.50728-alpha.8&prerelease
                    
Install as a Cake Tool

UKHO.ADDS.Clients

Purpose

This repository stores code generated to serve as NuGet packages supporting the UKHO ADDS services.

These packages are designed as client libraries to facilitate easier consumption of our APIs.

Contents

  • /src - Contains the source code for the NuGet packages.
  • /tests - Unit tests and integration tests for the packages.

Getting Started

To get started with using or contributing to these packages, follow these steps:

  1. Clone the repository:
    git clone <repository-url>
    
    
  2. Navigate to the package you're interested in (located in /src) and follow the instructions in the README.md file.

Kiota Clients

Kiota is a http client generation tool developed by Microsoft which we have used to generate clients using the OpenApi documents found on the UKHO github. For more infomation please refer to the documents here: Kiota.

  1. Consuming the client The Kiota Client can be easily consumed by registering the client using the helper methods found in the KiotaMiddlewareExtensions.cs

Kiota Middleware & Client Registration Helpers

This library provides extension methods to simplify the registration and configuration of Kiota-generated API clients in ASP.NET Core applications using dependency injection. It ensures that Kiota middleware handlers, authentication providers, and HTTP clients are set up in a consistent and maintainable way.

Features

  • Automatic registration of Kiota middleware handlers
  • Centralized configuration of HTTP clients for Kiota clients
  • Flexible authentication provider injection
  • Simple client factory for creating Kiota clients with correct adapters

Usage

1. Register Kiota Defaults

Register the default Kiota handlers, client factory, and your authentication provider:

services.AddKiotaDefaults(new T()); where T implemented IAuthenticationProvider

There are some standard AuthenticationProviders that can be used out of the box:

  • When no authentication is required (interacting with mock services): AnonymousAuthenticationProvider

    services.AddKiotaDefaults(new AnonymousAuthenticationProvider());
    
  • For Authentication with Azure: AzureIdentityAuthenticationProvider

  • services.AddKiotaDefaults(new AzureIdentityAuthenticationProvider(new DefaultAzureCredential()));
    

2. Register Kiota Client

Register the kiota client which will work with the previous defaults that have been registered:

services.RegisterKiotaClient<MyKiotaClient>( "MyApi:Endpoint", new Dictionary<string, string> { { "Custom-Header", "Value" } } );
  • "MyApi:Endpoint" is the configuration key for the API base URL.
  • Optional headers can be provided as a dictionary.

3. Configuration Example

Add your endpoint to appsettings.json: { "MyApi:Endpoint": "https://api.example.com/" }

4. Dependency Injection

After registration, inject your Kiota client anywhere in your application:

public class MyService { private readonly MyKiotaClient _client;
public MyService(MyKiotaClient client)
{
    _client = client;
}

// Use _client to call your API
}

Extension Methods Overview

  • AddKiotaDefaults<T>(IServiceCollection, T authProvider)

    • Registers Kiota handlers, client factory, and authentication provider.
  • RegisterKiotaClient<TClient>(IServiceCollection, string endpointConfigKey, IDictionary<string, string>? headers = null)

    • Registers a Kiota client and configures its HTTP client.
  • Internal helpers:

    • AddKiotaHandlers(IServiceCollection)
    • AddConfiguredHttpClient<TClient>(IServiceCollection, string endpointConfigKey, IDictionary<string, string>? headers = null)

Requirements

  • .NET 8
  • C# 12
  • Kiota generated clients
  • ASP.NET Core Dependency Injection

Notes

  • Middleware handlers are discovered via KiotaClientFactory.GetDefaultHandlerActivatableTypes().
  • The client factory uses constructor injection for IRequestAdapter.

For further customization, extend or override the provided helpers as needed.

Feedback

Your feedback is crucial to improving these packages. If you encounter issues or have suggestions, please open an issue on GitHub or contact the maintainers.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on UKHO.ADDS.Clients.Common:

Package Downloads
UKHO.ADDS.Clients.FileShareService.ReadOnly

ADDS Shared Clients

UKHO.ADDS.Clients.SalesCatalogueService

ADDS Shared Clients

UKHO.ADDS.Clients.PermitService

ADDS Shared Clients

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.50728-alpha.8 139 7/28/2025
0.0.50709-alpha.1 135 7/9/2025
0.0.50701-alpha.2 900 7/1/2025
0.0.50625-alpha.3 221 6/25/2025
0.0.50520-alpha.3 784 5/20/2025
0.0.50512-alpha.3 566 5/12/2025
0.0.50506-alpha.1 1,529 5/6/2025
0.0.50422-alpha.3 228 4/25/2025
0.0.50415-alpha.1 1,909 4/15/2025
0.0.50312-alpha.3 152 3/12/2025