Soenneker.Twilio.RestClient 4.0.2580

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Twilio.RestClient --version 4.0.2580
                    
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 4.0.2580
                    
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.2580" />
                    
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.2580" />
                    
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.2580
                    
#r "nuget: Soenneker.Twilio.RestClient, 4.0.2580"
                    
#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.2580
                    
#: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.2580
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Twilio.RestClient&version=4.0.2580
                    
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.2590 97 5/13/2026
4.0.2589 94 5/13/2026
4.0.2588 92 5/13/2026
4.0.2587 100 5/13/2026
4.0.2586 96 5/12/2026
4.0.2585 95 5/7/2026
4.0.2584 98 5/6/2026
4.0.2583 98 5/3/2026
4.0.2582 99 5/2/2026
4.0.2581 99 5/2/2026
4.0.2580 108 4/24/2026
4.0.2579 101 4/24/2026
4.0.2578 107 4/23/2026
4.0.2577 112 4/23/2026
4.0.2575 97 4/23/2026
4.0.2574 103 4/22/2026
4.0.2573 103 4/22/2026
4.0.2572 104 4/22/2026
4.0.2571 93 4/22/2026
4.0.2570 100 4/21/2026
Loading failed

Update dependency Soenneker.Utils.HttpClientCache to 4.0.1942 (#2920)