Soenneker.X.ClientUtil
4.0.447
Prefix Reserved
dotnet add package Soenneker.X.ClientUtil --version 4.0.447
NuGet\Install-Package Soenneker.X.ClientUtil -Version 4.0.447
<PackageReference Include="Soenneker.X.ClientUtil" Version="4.0.447" />
<PackageVersion Include="Soenneker.X.ClientUtil" Version="4.0.447" />
<PackageReference Include="Soenneker.X.ClientUtil" />
paket add Soenneker.X.ClientUtil --version 4.0.447
#r "nuget: Soenneker.X.ClientUtil, 4.0.447"
#:package Soenneker.X.ClientUtil@4.0.447
#addin nuget:?package=Soenneker.X.ClientUtil&version=4.0.447
#tool nuget:?package=Soenneker.X.ClientUtil&version=4.0.447
Soenneker.X.ClientUtil
Provides a lazily created, cached XOpenApiClient that authenticates every request with one configured bearer token.
Installation
dotnet add package Soenneker.X.ClientUtil
Configuration
{
"X": {
"BearerToken": "your-app-bearer-token"
}
}
X:ApiKey remains supported as a legacy configuration key.
Registration
Register one client for the application:
services.AddXClientUtilAsSingleton();
Or register the OpenAPI client provider per scope while retaining the singleton HTTP transport:
services.AddXClientUtilAsScoped();
Usage
public sealed class XSearchService
{
private readonly IXClientUtil _xClientUtil;
public XSearchService(IXClientUtil xClientUtil)
{
_xClientUtil = xClientUtil;
}
public async Task SearchUsers(CancellationToken cancellationToken)
{
XOpenApiClient client = await _xClientUtil.Get(cancellationToken);
var response = await client.Two.Users.Search.GetAsync(request =>
{
request.QueryParameters.Query = "dotnet";
}, cancellationToken);
foreach (var user in response?.Data ?? [])
Console.WriteLine($"{user.Name} (@{user.Username})");
}
}
This package captures one bearer token when the provider is created, so it fits app-only access and other endpoints that accept that token. For requests made on behalf of different users, use Soenneker.X.Client and attach the appropriate OAuth token to each request instead of sharing it through this client.
Disposing a scoped IXClientUtil releases its generated client; it does not remove the singleton HTTP transport.
| 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.Kiota.BearerAuthenticationProvider (>= 4.0.50)
- Soenneker.X.Client (>= 4.0.291)
- Soenneker.X.OpenApiClient (>= 4.0.225)
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.447 | 42 | 9/11/2026 |
| 4.0.446 | 51 | 9/10/2026 |
| 4.0.445 | 43 | 9/9/2026 |
| 4.0.444 | 51 | 9/9/2026 |
| 4.0.443 | 40 | 9/8/2026 |
| 4.0.442 | 49 | 9/8/2026 |
| 4.0.441 | 49 | 9/8/2026 |
| 4.0.440 | 51 | 9/8/2026 |
| 4.0.439 | 52 | 9/8/2026 |
| 4.0.438 | 58 | 9/8/2026 |
| 4.0.437 | 67 | 9/8/2026 |
| 4.0.436 | 88 | 9/7/2026 |
| 4.0.435 | 93 | 9/7/2026 |
| 4.0.434 | 104 | 9/7/2026 |
| 4.0.433 | 94 | 9/6/2026 |
| 4.0.432 | 95 | 9/6/2026 |
| 4.0.431 | 92 | 9/5/2026 |
| 4.0.430 | 92 | 9/5/2026 |
| 4.0.429 | 92 | 9/4/2026 |
| 4.0.427 | 104 | 9/4/2026 |
Update dependency Soenneker.X.OpenApiClient to 4.0.225 (#758)