Soenneker.Apollo.OpenApiClientUtil
4.0.116
Prefix Reserved
dotnet add package Soenneker.Apollo.OpenApiClientUtil --version 4.0.116
NuGet\Install-Package Soenneker.Apollo.OpenApiClientUtil -Version 4.0.116
<PackageReference Include="Soenneker.Apollo.OpenApiClientUtil" Version="4.0.116" />
<PackageVersion Include="Soenneker.Apollo.OpenApiClientUtil" Version="4.0.116" />
<PackageReference Include="Soenneker.Apollo.OpenApiClientUtil" />
paket add Soenneker.Apollo.OpenApiClientUtil --version 4.0.116
#r "nuget: Soenneker.Apollo.OpenApiClientUtil, 4.0.116"
#:package Soenneker.Apollo.OpenApiClientUtil@4.0.116
#addin nuget:?package=Soenneker.Apollo.OpenApiClientUtil&version=4.0.116
#tool nuget:?package=Soenneker.Apollo.OpenApiClientUtil&version=4.0.116
Soenneker.Apollo.OpenApiClientUtil
The recommended DI entry point for the generated Apollo REST API client.
This package combines the generated ApolloOpenApiClient, a cached authenticated HttpClient, a Kiota request adapter, and lazy client initialization. Application services retrieve one configured client and call its typed request builders.
Installation
dotnet add package Soenneker.Apollo.OpenApiClientUtil
Configuration
{
"Apollo": {
"ApiKey": "your-api-key"
}
}
Apollo:ApiKey is required when the client is first retrieved. Optional transport settings are:
| Key | Default | Purpose |
|---|---|---|
Apollo:ClientBaseUrl |
https://api.apollo.io/api/v1 |
Overrides the API base URL. |
Apollo:AuthHeaderName |
x-api-key |
Overrides the authentication header. |
Apollo:AuthHeaderValueTemplate |
{token} |
Formats the header value after replacing {token} with the API key. |
Store the API key outside committed configuration by using environment variables, user secrets, or your application's secret provider.
Registration
using Soenneker.Apollo.OpenApiClientUtil.Registrars;
builder.Services.AddApolloOpenApiClientUtilAsSingleton();
This also registers the Apollo HTTP client provider and its shared HTTP client cache. A scoped client utility is available when required by the application's dependency graph:
builder.Services.AddApolloOpenApiClientUtilAsScoped();
Call Apollo
The following service retrieves the current Apollo user profile and includes credit-usage information:
using Soenneker.Apollo.OpenApiClient;
using Soenneker.Apollo.OpenApiClient.Models;
using Soenneker.Apollo.OpenApiClientUtil.Abstract;
public sealed class ApolloProfileService
{
private readonly IApolloOpenApiClientUtil _clientUtil;
public ApolloProfileService(IApolloOpenApiClientUtil clientUtil)
{
_clientUtil = clientUtil;
}
public async Task<GetCurrentUserProfile200Response?> Get(
CancellationToken cancellationToken)
{
ApolloOpenApiClient client = await _clientUtil.Get(cancellationToken);
return await client.Users.Api_profile.GetAsync(
request =>
{
request.QueryParameters.IncludeCreditUsage = true;
},
cancellationToken);
}
}
The generated client exposes request builders for accounts, contacts, conversations, email accounts, campaigns, fields, labels, companies, people, opportunities, organizations, phone calls, reports, sequences, tasks, usage statistics, users, webhook results, and other operations present in Apollo's OpenAPI document.
Kiota throws generated endpoint-specific exceptions for mapped error responses, such as 401 or 403 models. Catch the generated exception type when the application needs response-specific handling; otherwise allow normal exception policy and retries to operate above this service.
Lifetime and caching
Getinitializes the generated client on first use and returns the cached instance afterward.- The generated client and its
HttpClientare intended for reuse across calls. - Authentication and base-address configuration is captured during initialization. Rebuild the client stack when those values must change; creating another scope still reuses the singleton HTTP client.
- A scoped utility owns its generated client wrapper, while the underlying cached
HttpClientremains owned by the singleton HTTP-client cache. - Let the dependency-injection container dispose the utility. If you construct it manually, dispose it with
DisposeorDisposeAsync. - Registration uses
TryAdd, so an earlier application-providedIApolloOpenApiClientUtilis preserved.
The generated API surface can change when Apollo changes its OpenAPI specification. Prefer wrapping calls in application-owned services instead of exposing generated models throughout the entire codebase.
Related packages
Soenneker.Apollo.OpenApiClientcontains the generated Kiota client and models.Soenneker.Apollo.HttpClientsprovides the cached authenticated transport.
API
| Method | Purpose |
|---|---|
IApolloOpenApiClientUtil.Get(CancellationToken) |
Returns the lazily initialized, cached generated client. |
AddApolloOpenApiClientUtilAsSingleton() |
Registers the complete client stack as singleton services. |
AddApolloOpenApiClientUtilAsScoped() |
Registers a scoped client utility with the Apollo transport dependencies. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Soenneker.Apollo.HttpClients (>= 4.0.84)
- Soenneker.Apollo.OpenApiClient (>= 4.0.45)
- Soenneker.Kiota.GenericAuthenticationProvider (>= 4.0.56)
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 |
|---|---|---|
| 4.0.116 | 0 | 10/25/2026 |
| 4.0.115 | 44 | 10/23/2026 |
| 4.0.114 | 73 | 10/22/2026 |
| 4.0.113 | 80 | 10/21/2026 |
| 4.0.112 | 89 | 10/18/2026 |
| 4.0.111 | 93 | 10/15/2026 |
| 4.0.110 | 87 | 10/15/2026 |
| 4.0.109 | 86 | 10/14/2026 |
| 4.0.108 | 87 | 10/14/2026 |
| 4.0.107 | 89 | 10/14/2026 |
| 4.0.106 | 82 | 10/14/2026 |
| 4.0.105 | 87 | 10/14/2026 |
| 4.0.98 | 93 | 10/13/2026 |
| 4.0.97 | 83 | 10/13/2026 |
| 4.0.95 | 86 | 10/12/2026 |
| 4.0.94 | 83 | 10/12/2026 |
| 4.0.93 | 78 | 10/12/2026 |
| 4.0.92 | 95 | 10/11/2026 |
| 4.0.91 | 92 | 10/11/2026 |
| 4.0.90 | 82 | 10/11/2026 |
Update dependency Soenneker.Apollo.OpenApiClient to 4.0.45 (#98)