Soenneker.X.ClientUtil 11.0.574

Prefix Reserved
dotnet add package Soenneker.X.ClientUtil --version 11.0.574
                    
NuGet\Install-Package Soenneker.X.ClientUtil -Version 11.0.574
                    
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.X.ClientUtil" Version="11.0.574" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.X.ClientUtil" Version="11.0.574" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.X.ClientUtil" />
                    
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.X.ClientUtil --version 11.0.574
                    
#r "nuget: Soenneker.X.ClientUtil, 11.0.574"
                    
#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.X.ClientUtil@11.0.574
                    
#: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.X.ClientUtil&version=11.0.574
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.X.ClientUtil&version=11.0.574
                    
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

alternate text is missing from this package README image 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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.X.ClientUtil:

Package Downloads
Soenneker.X.Users

Utilities for X users and creating posts.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.574 0 11/16/2026
11.0.573 42 11/15/2026
11.0.572 52 11/15/2026
11.0.571 54 11/15/2026
11.0.570 69 11/14/2026
11.0.569 71 11/13/2026
11.0.568 83 11/12/2026
11.0.567 60 11/11/2026
11.0.566 69 11/11/2026
11.0.565 66 11/11/2026
11.0.564 61 11/11/2026
11.0.563 67 11/11/2026
11.0.562 66 11/11/2026
11.0.561 82 11/11/2026
11.0.560 80 11/10/2026
11.0.559 124 11/9/2026
11.0.558 111 11/8/2026
11.0.557 114 11/7/2026
11.0.556 128 11/6/2026
11.0.555 123 11/4/2026
Loading failed

Update dependency Soenneker.X.OpenApiClient to 11.0.315 (#870)