Soenneker.Close.HttpClients
4.0.81
Prefix Reserved
dotnet add package Soenneker.Close.HttpClients --version 4.0.81
NuGet\Install-Package Soenneker.Close.HttpClients -Version 4.0.81
<PackageReference Include="Soenneker.Close.HttpClients" Version="4.0.81" />
<PackageVersion Include="Soenneker.Close.HttpClients" Version="4.0.81" />
<PackageReference Include="Soenneker.Close.HttpClients" />
paket add Soenneker.Close.HttpClients --version 4.0.81
#r "nuget: Soenneker.Close.HttpClients, 4.0.81"
#:package Soenneker.Close.HttpClients@4.0.81
#addin nuget:?package=Soenneker.Close.HttpClients&version=4.0.81
#tool nuget:?package=Soenneker.Close.HttpClients&version=4.0.81
Soenneker.Close.HttpClients
Provides a reusable HttpClient configured for the Close CRM API and dependency injection.
Installation
dotnet add package Soenneker.Close.HttpClients
API-key configuration
{
"Close": {
"ApiKey": "<Close API key>",
"ClientBaseUrl": "https://api.close.com/api/v1"
}
}
Close:ApiKey is required; the base URL above is the default. The client applies Close's required HTTP Basic authorization by encoding the API key as the username with an empty password. See Close's API-key authentication documentation.
OAuth or custom authorization
Override the header template when Close:ApiKey contains an OAuth access token:
{
"Close": {
"ApiKey": "<OAuth access token>",
"AuthHeaderName": "Authorization",
"AuthHeaderValueTemplate": "Bearer {token}"
}
}
{token} is replaced with the configured value. AuthHeaderName defaults to Authorization.
Keep API keys and OAuth tokens in a secret provider rather than source control or checked-in settings files.
Registration
using Microsoft.Extensions.DependencyInjection;
using Soenneker.Close.HttpClients.Registrars;
services.AddCloseOpenApiHttpClientAsSingleton();
AddCloseOpenApiHttpClientAsScoped() creates one wrapper and cached client per dependency-injection scope.
Usage
using Soenneker.Close.HttpClients.Abstract;
public sealed class CloseProfileClient
{
private readonly ICloseOpenApiHttpClient _closeHttpClient;
public CloseProfileClient(ICloseOpenApiHttpClient closeHttpClient)
{
_closeHttpClient = closeHttpClient;
}
public async ValueTask<string> GetCurrentUser(
CancellationToken cancellationToken)
{
HttpClient client = await _closeHttpClient.Get(cancellationToken);
using HttpResponseMessage response = await client.GetAsync(
"/api/v1/me/",
cancellationToken);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStringAsync(cancellationToken);
}
}
For a typed request-builder API, use this package through Soenneker.Close.OpenApiClientUtil.
Lifecycle and behavior
Getreturns the sameHttpClientfor the lifetime of the wrapper.- Do not dispose the returned client. Let dependency injection dispose
ICloseOpenApiHttpClientand its cache entry. - Configuration and credentials are captured when the client is first created. Recreate the owning scope or application instance after rotating them.
- The cancellation token passed to
Getapplies to initialization. Pass a token separately to each HTTP operation. - Non-success responses remain ordinary
HttpResponseMessageinstances until the caller inspects them or callsEnsureSuccessStatusCode.
| 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.Extensions.Configuration (>= 4.0.895)
- Soenneker.Utils.HttpClientCache (>= 4.0.2090)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Close.HttpClients:
| Package | Downloads |
|---|---|
|
Soenneker.Close.OpenApiClientUtil
A thread-safe utility for obtaining Close's OpenApiClient singleton. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.81 | 78 | 9/17/2026 |
| 4.0.80 | 52 | 9/16/2026 |
| 4.0.79 | 61 | 9/16/2026 |
| 4.0.78 | 56 | 9/16/2026 |
| 4.0.77 | 45 | 9/16/2026 |
| 4.0.76 | 45 | 9/15/2026 |
| 4.0.74 | 155 | 9/13/2026 |
| 4.0.73 | 101 | 9/13/2026 |
| 4.0.72 | 109 | 9/13/2026 |
| 4.0.71 | 103 | 9/13/2026 |
| 4.0.69 | 96 | 9/12/2026 |
| 4.0.68 | 131 | 9/12/2026 |
| 4.0.67 | 136 | 9/9/2026 |
| 4.0.66 | 103 | 9/9/2026 |
| 4.0.65 | 100 | 9/8/2026 |
| 4.0.64 | 143 | 9/8/2026 |
| 4.0.63 | 107 | 9/8/2026 |
| 4.0.62 | 112 | 9/7/2026 |
| 4.0.61 | 107 | 9/7/2026 |
| 4.0.60 | 105 | 9/7/2026 |