Telnyx.net
1.0.0
See the version list below for details.
dotnet add package Telnyx.net --version 1.0.0
NuGet\Install-Package Telnyx.net -Version 1.0.0
<PackageReference Include="Telnyx.net" Version="1.0.0" />
paket add Telnyx.net --version 1.0.0
#r "nuget: Telnyx.net, 1.0.0"
// Install Telnyx.net as a Cake Addin #addin nuget:?package=Telnyx.net&version=1.0.0 // Install Telnyx.net as a Cake Tool #tool nuget:?package=Telnyx.net&version=1.0.0
Telnyx.net
The official Telnyx library, supporting .NET Standard 2.0, .NET Core 1.0+, and .NET Framework 4.5+
Documentation
See the .NET API docs.
Installation
Install Telnyx.net via NuGet
From the command line:
nuget install Telnyx.net
From Package Manager:
PM> Install-Package Telnyx.net
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "Telnyx.net".
- Click on the Telnyx.net package, select the appropriate version in the right-tab and click Install.
Set the API Key for your project
You can configure the Telnyx.net package to use your secret API key in one of two ways:
- In your application initialization, set your API Key (only once during startup):
TelnyxConfiguration.SetApiKey("YOUR_API_KEY");
- Pass the API key to RequestOptions:
var numberReservationsService = new NumberReservationsService();
numberReservationsService.Get("PHONE_NUMBER_ID", new RequestOptions { ApiKey = "YOUR_API_KEY" });
You can obtain your secret API key from the Auth section oin the Mission Control Portal.
Xamarin/Mono Developers (Optional)
If you are using Xamarin/Mono, you may want to provide your own HttpMessageHandler
. You can do so by passing an instance to TelnyxConfiguration.HttpMessageHandler
on your application's startup.
Support
- Make sure to review open issues and pull requests before opening a new issue.
- Feel free to leave a comment or reaction on any existing issues.
- For all other support requests, please reach out to the Telnyx support team.
Helpful Library Information
Run Test Project via Docker CLI
In order to run the tests you need to have the telnyx-mock running on your local port. This mock is used to mimic the Telnyx API in order to ensure responses will be correct.
Steps to install and run the telynx-mock can be found here: readme
Explicit steps are as follows:
- Make sure you have docker installed. This can be either windows/mac/linux.
- Run the docker pull cmd:
docker pull telnyx/telnyx-mock:latest
- Verify the image is pulled correctly:
docker images
- If you see the image listed, now we can run the image:
docker run -p 12111-12112:12111-12112 telnyx/telnyx-mock
- Keep this powershell or cmdline window open and run the TelynxTests project via test runner or dotnet-cli
- Add your API key to the appsettings file. For NET45+ use
App.config
fornetstandard/netcore use appsettings.json
found in the test project
Run Telnyx.Example Project with your API Key
In oder to get the Example project to run properly, you can add your API Key to the appsettings.json
file similar to above.
Here you can play around with the console app without requiring the telnyx-mock to run.
NOTE: This will hit the API directly so be aware of the different operations you are trying as rate limiting applies.
Request Options
All of the service methods accept an optional RequestOptions
object. This is used if you want to pass the secret API key on each method.
var requestOptions = new RequestOptions();
requestOptions.ApiKey = "YOUR_API_KEY"; // (optional) set the api key on a per-request basis
Responses
The TelnyxResponse
object is an attribute (with the same name) attached to all entities in Telnyx.net when they are returned from a service call.
Example: Access the TelnyxResponse
var numberReservationsService = new NumberReservationsService();
NumberReservation reservation = numberReservationsService.Create(...);
TelnyxResponse response = reservation.TelnyxResponse;
The information that can be derived from the TelnyxResponse
is available from the TelnyxResponse Class.
public class TelnyxResponse
{
// ResponseJson will always tell you the complete json Telnyx returned to Telnyx.net.
// this will be the same as the ObjectJson when you execute a create/get/delete call.
// however, if you execute a List() method, the ResponseJson will have the full api result
// from Telnyx (a phone number list with 10 phone numbers, for example).
public string ResponseJson { get; set; }
// when you call a List() method, the object json is the object in the response array that represents
// the entity. The ResponseJson will be the full array returned from Telnyx on every entity, however,
// since that was the full response from Telnyx. ObjectJson is always the same as ResponseJson when
// you are doing a regular create/get/delete, because you are dealing with a single object.
public string ObjectJson { get; set; }
// this is the request id of the call. I would recommend logging
// this and/or saving it to your database. this is very useful when troubleshooting with Telnyx support
public string RequestId { get; set; }
// this is the request date and time of the call. I would also recommend logging this and/or
// saving it to your database, as it tells you when Telnyx processed the request.
public DateTime RequestDate { get; set; }
}
Contribution Guidelines
We welcome contributions from anyone interested in Telnyx or Telnyx.net development. If you'd like to submit a pull request, it's best to start with an issue to describe what you'd like to build.
Once you've written your pull request, please make sure you test your changes.
Acknowledgments
The contributors and maintainers of Telnyx .NET would like to extend their deep gratitude to the authors of Stripe .NET, upon which this project is based. Thank you for developing such elegant, usable, and extensible code and for sharing it with the community.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.2 is compatible. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wpa81 was computed. |
Windows Store | netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- Newtonsoft.Json (>= 9.0.1)
- System.Collections.Immutable (>= 1.5.0)
-
.NETStandard 1.2
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 9.0.1)
- System.Collections.Immutable (>= 1.5.0)
- System.Console (>= 4.3.0)
- System.Security.Cryptography.Algorithms (>= 4.3.0)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 9.0.1)
- System.Collections.Immutable (>= 1.5.0)
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 |
---|---|---|
2.9.2 | 3,418 | 10/5/2024 |
2.9.1 | 91 | 10/5/2024 |
2.9.0 | 36,949 | 3/28/2024 |
2.8.0 | 38,215 | 9/28/2023 |
2.7.0 | 786,165 | 7/8/2021 |
2.6.2 | 625 | 6/14/2021 |
2.6.2-alpha | 214 | 6/14/2021 |
2.6.1 | 6,147 | 5/6/2021 |
2.6.0 | 551 | 4/8/2021 |
2.5.1 | 340 | 3/29/2021 |
2.4.0 | 373 | 3/19/2021 |
2.3.0 | 373 | 3/10/2021 |
2.2.0 | 4,278 | 12/16/2020 |
2.1.1 | 12,671 | 9/3/2020 |
2.1.0 | 455 | 9/2/2020 |
2.0.0 | 576 | 8/14/2020 |
1.0.1 | 1,301 | 4/21/2020 |
1.0.0 | 824 | 1/31/2020 |