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
                    
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="Soenneker.Apollo.OpenApiClientUtil" Version="4.0.116" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Apollo.OpenApiClientUtil" Version="4.0.116" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Apollo.OpenApiClientUtil" />
                    
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 Soenneker.Apollo.OpenApiClientUtil --version 4.0.116
                    
#r "nuget: Soenneker.Apollo.OpenApiClientUtil, 4.0.116"
                    
#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 Soenneker.Apollo.OpenApiClientUtil@4.0.116
                    
#: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=Soenneker.Apollo.OpenApiClientUtil&version=4.0.116
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Apollo.OpenApiClientUtil&version=4.0.116
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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

  • Get initializes the generated client on first use and returns the cached instance afterward.
  • The generated client and its HttpClient are 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 HttpClient remains owned by the singleton HTTP-client cache.
  • Let the dependency-injection container dispose the utility. If you construct it manually, dispose it with Dispose or DisposeAsync.
  • Registration uses TryAdd, so an earlier application-provided IApolloOpenApiClientUtil is 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.

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

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
Loading failed

Update dependency Soenneker.Apollo.OpenApiClient to 4.0.45 (#98)