{"id":30743442,"url":"https://github.com/ukho/ukho.adds.clients","last_synced_at":"2025-09-04T02:07:21.026Z","repository":{"id":278924542,"uuid":"936183488","full_name":"UKHO/UKHO.ADDS.Clients","owner":"UKHO","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-07T15:43:08.000Z","size":279,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-07T17:18:37.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UKHO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-20T16:59:02.000Z","updated_at":"2025-08-07T15:43:11.000Z","dependencies_parsed_at":"2025-02-22T15:45:12.246Z","dependency_job_id":"b39f7c8a-2d6d-4bb2-afc8-d993b1e9d4b6","html_url":"https://github.com/UKHO/UKHO.ADDS.Clients","commit_stats":null,"previous_names":["ukho/ukho.adds.clients"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/UKHO/UKHO.ADDS.Clients","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UKHO%2FUKHO.ADDS.Clients","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UKHO%2FUKHO.ADDS.Clients/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UKHO%2FUKHO.ADDS.Clients/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UKHO%2FUKHO.ADDS.Clients/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UKHO","download_url":"https://codeload.github.com/UKHO/UKHO.ADDS.Clients/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UKHO%2FUKHO.ADDS.Clients/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273539317,"owners_count":25123499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-04T02:07:20.051Z","updated_at":"2025-09-04T02:07:21.015Z","avatar_url":"https://github.com/UKHO.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UKHO.ADDS.Clients\n\n## Purpose\n\nThis repository stores code generated to serve as NuGet packages supporting the UKHO ADDS services.\n\nThese packages are designed as client libraries to facilitate easier consumption of our APIs.\n\n## Contents\n\n- **`/src`** - Contains the source code for the NuGet packages.\n- **`/tests`** - Unit tests and integration tests for the packages.\n\n## Getting Started\n\nTo get started with using or contributing to these packages, follow these steps:\n\n1. **Clone the repository:**\n   ```sh\n   git clone \u003crepository-url\u003e\n\n2. Navigate to the package you're interested in (located in /src) and follow the instructions in the README.md file.\n\n## Kiota Clients\nKiota 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](https://learn.microsoft.com/en-us/openapi/kiota/overview).\n\n\n1. **Consuming the client**\nThe Kiota Client can be easily consumed by registering the client using the helper methods found in the KiotaMiddlewareExtensions.cs\n\n# Kiota Middleware \u0026 Client Registration Helpers\n\nThis 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.\n\n## Features\n\n- **Automatic registration of Kiota middleware handlers**\n- **Centralized configuration of HTTP clients for Kiota clients**\n- **Flexible authentication provider injection**\n- **Simple client factory for creating Kiota clients with correct adapters**\n\n## Usage\n\n### 1. Register Kiota Defaults\n\nRegister the default Kiota handlers, client factory, and your authentication provider:\n\n   ```sh\n   services.AddKiotaDefaults(new T()); where T implemented IAuthenticationProvider\n   ```\n\nThere are some standard AuthenticationProviders that can be used out of the box:\n\n- When no authentication is required (interacting with mock services): AnonymousAuthenticationProvider\n    \n    ```sh\n    services.AddKiotaDefaults(new AnonymousAuthenticationProvider());\n    ```\n\n- For Authentication with Azure:  AzureIdentityAuthenticationProvider\n- \n    ```sh\n    services.AddKiotaDefaults(new AzureIdentityAuthenticationProvider(new DefaultAzureCredential()));\n    ```\n\n### 2. Register Kiota Client\n\nRegister the kiota client which will work with the previous defaults that have been registered:\n\n   ```sh\n   services.RegisterKiotaClient\u003cMyKiotaClient\u003e( \"MyApi:Endpoint\", new Dictionary\u003cstring, string\u003e { { \"Custom-Header\", \"Value\" } } );\n   ```\n\n- `\"MyApi:Endpoint\"` is the configuration key for the API base URL.\n- Optional headers can be provided as a dictionary.\n\n### 3. Configuration Example\n\nAdd your endpoint to `appsettings.json`: { \"MyApi:Endpoint\": \"https://api.example.com/\" }\n\n\n### 4. Dependency Injection\n\nAfter registration, inject your Kiota client anywhere in your application:\n\n```sh\npublic class MyService { private readonly MyKiotaClient _client;\npublic MyService(MyKiotaClient client)\n{\n    _client = client;\n}\n\n// Use _client to call your API\n}\n```\n\n## Extension Methods Overview\n\n- `AddKiotaDefaults\u003cT\u003e(IServiceCollection, T authProvider)`\n  - Registers Kiota handlers, client factory, and authentication provider.\n\n- `RegisterKiotaClient\u003cTClient\u003e(IServiceCollection, string endpointConfigKey, IDictionary\u003cstring, string\u003e? headers = null)`\n  - Registers a Kiota client and configures its HTTP client.\n\n- Internal helpers:\n  - `AddKiotaHandlers(IServiceCollection)`\n  - `AddConfiguredHttpClient\u003cTClient\u003e(IServiceCollection, string endpointConfigKey, IDictionary\u003cstring, string\u003e? headers = null)`\n\n## Requirements\n\n- .NET 8\n- C# 12\n- [Kiota](https://github.com/microsoft/kiota) generated clients\n- ASP.NET Core Dependency Injection\n\n## Notes\n\n- Middleware handlers are discovered via `KiotaClientFactory.GetDefaultHandlerActivatableTypes()`.\n- The client factory uses constructor injection for `IRequestAdapter`.\n\n---\n\nFor further customization, extend or override the provided helpers as needed.\n\n## Feedback\nYour feedback is crucial to improving these packages. If you encounter issues or have suggestions, please open an issue on GitHub or contact the maintainers.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fukho%2Fukho.adds.clients","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fukho%2Fukho.adds.clients","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fukho%2Fukho.adds.clients/lists"}