TelnyxSharp 1.0.0
See the version list below for details.
dotnet add package TelnyxSharp --version 1.0.0
NuGet\Install-Package TelnyxSharp -Version 1.0.0
<PackageReference Include="TelnyxSharp" Version="1.0.0" />
<PackageVersion Include="TelnyxSharp" Version="1.0.0" />
<PackageReference Include="TelnyxSharp" />
paket add TelnyxSharp --version 1.0.0
#r "nuget: TelnyxSharp, 1.0.0"
#addin nuget:?package=TelnyxSharp&version=1.0.0
#tool nuget:?package=TelnyxSharp&version=1.0.0
TelnyxSharp
Welcome to the TelnyxSharp SDK! This library provides a simple and intuitive way to interact with the Telnyx API using .NET. 🚀
Installation
To install the TelnyxSharp SDK, you can use the NuGet package manager:
dotnet add package TelnyxSharp
Or via the NuGet Package Manager Console:
Install-Package TelnyxSharp
Usage
Direct Initialization
Here's a quick example to get you started:
using TelnyxSharp;
using TelnyxSharp.Messaging.Models.Messages.Requests;
using TelnyxSharp.Messaging.Models.Messages.Responses;
var apiKey = "YOUR_API_KEY";
var client = new TelnyxClient(apiKey);
// Create a message request
var messageRequest = new SendMessageRequest
{
From = "+1234567890",
To = new List<string> { "+0987654321" },
Text = "Hello from TelnyxSharp!"
};
// Send the message
SendMessageResponse response = await client.Messages.Send(messageRequest);
Console.WriteLine($"Message sent with ID: {response.Id}");
Using Dependency Injection
For applications using Microsoft.Extensions.DependencyInjection, you can register the Telnyx client in your service collection:
using Microsoft.Extensions.DependencyInjection;
using TelnyxSharp;
// In your Startup.cs or Program.cs
services.AddTelnyxClient(options =>
{
options.ApiKey = "YOUR_API_KEY";
});
Then inject ITelnyxClient into your classes:
public class MessagingService
{
private readonly ITelnyxClient _telnyxClient;
public MessagingService(ITelnyxClient telnyxClient)
{
_telnyxClient = telnyxClient;
}
public async Task SendMessage(string to, string text)
{
var messageRequest = new SendMessageRequest
{
From = "+1234567890",
To = new List<string> { to },
Text = text
};
var response = await _telnyxClient.Messages.Send(messageRequest);
Console.WriteLine($"Message sent with ID: {response.Id}");
}
}
This approach is recommended for ASP.NET Core applications and other scenarios where you want to manage the lifetime of the client through dependency injection.
Contributing
We welcome contributions! Please read our contributing guidelines to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- Microsoft.Extensions.Options (>= 9.0.3)
- Polly (>= 8.5.2)
- RestSharp (>= 112.1.0)
-
net9.0
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- Microsoft.Extensions.Options (>= 9.0.3)
- Polly (>= 8.5.2)
- RestSharp (>= 112.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Please check the GitHub repository for release notes.