Telnyx.net
1.0.1
See the version list below for details.
dotnet add package Telnyx.net --version 1.0.1
NuGet\Install-Package Telnyx.net -Version 1.0.1
<PackageReference Include="Telnyx.net" Version="1.0.1" />
paket add Telnyx.net --version 1.0.1
#r "nuget: Telnyx.net, 1.0.1"
// Install Telnyx.net as a Cake Addin #addin nuget:?package=Telnyx.net&version=1.0.1 // Install Telnyx.net as a Cake Tool #tool nuget:?package=Telnyx.net&version=1.0.1
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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 was computed. net452 is compatible. 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 | tizen40 was computed. tizen60 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
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 11.0.2)
- System.Collections.Immutable (>= 1.7.0)
-
.NETFramework 4.5.2
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 11.0.2)
- System.Collections.Immutable (>= 1.7.0)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 11.0.2)
- System.Collections.Immutable (>= 1.7.0)
-
.NETStandard 2.1
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 11.0.2)
- System.Collections.Immutable (>= 1.7.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.0 | 27,474 | 3/28/2024 |
2.8.0 | 35,464 | 9/28/2023 |
2.7.0 | 725,723 | 7/8/2021 |
2.6.2 | 613 | 6/14/2021 |
2.6.2-alpha | 212 | 6/14/2021 |
2.6.1 | 5,469 | 5/6/2021 |
2.6.0 | 545 | 4/8/2021 |
2.5.1 | 336 | 3/29/2021 |
2.4.0 | 371 | 3/19/2021 |
2.3.0 | 368 | 3/10/2021 |
2.2.0 | 4,241 | 12/16/2020 |
2.1.1 | 12,507 | 9/3/2020 |
2.1.0 | 451 | 9/2/2020 |
2.0.0 | 574 | 8/14/2020 |
1.0.1 | 1,296 | 4/21/2020 |
1.0.0 | 820 | 1/31/2020 |