Soenneker.Twilio.RestClient 4.0.2561

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

An async thread-safe singleton for a Twilio RestClient

Installation

dotnet add package Soenneker.Twilio.RestClient

Why?

This library provides a singleton of a TwilioRestClient.

Internally it implements an HttpClient singleton. This HttpClient has less overhead than new instances of HttpClient and IHttpClientFactory all while correctly handling connection pooling for DNS changes.

See soenneker.utils.httpclientcache for more information.

Usage

  1. Register ITwilioRestClientUtil with DI.
public static async Task Main(string[] args)
{
    ...
    builder.Services.AddTwilioRestClientUtilAsSingleton();
}
  1. Inject ITwilioRestClientUtil via constructor, and retrieve a TwilioRestClient.
public class TestClass
{
    ITwilioRestClientUtil _twilioRestClientUtil;

    public TestClass(ITwilioRestClientUtil twilioRestClientUtil)
    {
        _twilioRestClientUtil = twilioRestClientUtil;
    }

    public async ValueTask SendMessage()
    {
        var message = await MessageResource.CreateAsync(
            new PhoneNumber("+11234567890"),
            from: new PhoneNumber("+10987654321"),
            body: "Hello World!",
            client: await _twilioRestClientUtil.Get()
        );

        Console.WriteLine(message.Sid);
    }
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.2561 75 3/31/2026
4.0.2560 75 3/31/2026
4.0.2559 69 3/31/2026
4.0.2558 91 3/20/2026
4.0.2557 83 3/20/2026
4.0.2556 76 3/20/2026
4.0.2555 84 3/19/2026
4.0.2554 94 3/15/2026
4.0.2553 89 3/15/2026
4.0.2552 92 3/14/2026
4.0.2551 86 3/13/2026
4.0.2550 88 3/13/2026
4.0.2549 90 3/13/2026
4.0.2548 89 3/13/2026
4.0.2547 87 3/13/2026
4.0.2546 88 3/12/2026
4.0.2545 84 3/12/2026
4.0.2543 87 3/12/2026
4.0.2541 90 3/12/2026
4.0.2539 91 3/11/2026
Loading failed

Update dependency Soenneker.Utils.HttpClientCache to 4.0.1924 (#2885)