API Library Template¶
ConnectSoft.ApiLibraryTemplate (dotnet new connectsoft-api-library) scaffolds a service-agent / HTTP API client package: HttpClientFactory, Polly resilience, one AuthenticationType per run (None, Basic, OAuth, OpenIDConnect, ApiKey), optional metrics, WireMock.Net-based tests (not Moq for HTTP/API simulation), multi-target net8.0;net9.0;net10.0, .slnx, CPM, and Azure Pipelines.
When to use it¶
- You need a typed client for an external or internal HTTP API, with resilience and auth patterns aligned to ConnectSoft conventions.
- You will publish a NuGet client library consumed by microservices or workers.
When to use Library Template instead¶
Use Library Template for general-purpose .NET libraries (utilities, options, metrics, optional tracing / ActivitySource samples) without the API-client stack, auth layout, and WireMock harness that this template provides.
Full specification¶
- Parameters and CLI: ConnectSoft.Documentation — API Library Template parameters
- Factory-facing overview: ConnectSoft.AI.SoftwareFactory.Documentation → API Library Template (
templates-docs/api-library-template.md)
Quick scaffold¶
dotnet new install ConnectSoft.ApiLibraryTemplate
dotnet new connectsoft-api-library -n "MyCompany.ExampleApi" -o ./out/ExampleApi \
--api-service-name "Example" \
--api-service-description "Example API" \
--authentication-type None \
--use-metrics true
Run dotnet new connectsoft-api-library -h after install for authoritative flags (--framework default net10.0 is primary moniker only; TFMs stay net8;net9;net10).