TextMagicClientNetStandard 1.0.1

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

Minimal Support

This library has only been ported to .Net Standard 2.1 and the RestSharp Dependancy has been updated to resolve some of the security flaws present in the older versions.

TextMagic C# / .Net SDK

This library provides you with an easy way to send SMS and receive replies, by integrating the the TextMagic SMS Gateway into your C# / .Net application.

What Is TextMagic?

TextMagic’s application programming interface (API) provides the communication link between your application and TextMagic’s SMS Gateway, allowing you to send and receive text messages and to check the delivery status of text messages you’ve already sent.

Frameworks supported

  • .NET Standard 2.1

Dependencies

The DLLs included in the package may not be the latest versions. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions later than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Add the library to your project references or install it as a NuGet package.

C# usage example

using System;
using System.IO;
using TextMagicClient.Api;
using TextMagicClient.Client;
using TextMagicClient.Model;

namespace ExampleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // put your Username and API Key from https://my.textmagic.com/online/api/rest-api/keys page.
            Configuration.Default.Username = "YOUR_USERNAME";
            Configuration.Default.Password = "YOUR_API_KEY";
            Configuration.Default.BasePath = "https://rest.textmagic.com";

            var apiInstance = new TextMagicApi();

            // Simple Ping request sample
            try
            {
                var result = apiInstance.Ping();
                Console.WriteLine(result.Ping);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling TextMagicApi.Ping: " + e.Message );
            }

            // Send a new message request sample
            try
            {
                var sendMessageInputObject = new SendMessageInputObject
                {
                    Text = "I love TextMagic!", Phones = "+199988887766"
                };

                var result = apiInstance.SendMessage(sendMessageInputObject);
                Console.WriteLine(result.Id);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling TextMagicApi.SendMessage: " + e.Message );
            }

            // Get all outgoing messages sample
            try
            {
                var result = apiInstance.GetAllOutboundMessages(1, 10);
                Console.WriteLine(result.Resources[0].Id);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling TextMagicApi.GetAllOutboundMessages: " + e.Message );
            }

            // Upload list avatar sample, 3223 here is a sample list id
            try
            {
                var stream = File.Open("/CustomPath/Images/test.png", FileMode.Open);
                var result = apiInstance.UploadListAvatar(stream, 3223);
                Console.WriteLine(result.Href);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling TextMagicApi.UploadListAvatar: " + e.Message );
            }
        }
    }
}

VB.Net usage example

Imports System
Imports System.IO
Imports TextMagicClient.Api
Imports TextMagicClient.Client
Imports TextMagicClient.Model

Module Program
    Sub Main(args As String())
        ' put your Username and API Key from https://my.textmagic.com/online/api/rest-api/keys page.
        Configuration.Default.Username = "YOUR_USERNAME"
        Configuration.Default.Password = "YOUR_API_KEY"
        Configuration.Default.BasePath = "https://rest.textmagic.com"

        Dim apiInstance = New TextMagicApi()

        ' Simple Ping request sample
        Try
            Dim result = apiInstance.Ping()
            Console.WriteLine(result.Ping)
            Catch ex As Exception
            Console.WriteLine("Exception when calling TextMagicApi.Ping: " + ex.Message )
        End Try

        ' Send a new message request sample
        Try
            Dim sendMessageInputObject = New SendMessageInputObject With {
            .Text = "I love TextMagic!",
            .Phones = "+199988887766"
            }
            Dim result = apiInstance.SendMessage(sendMessageInputObject)
            Console.WriteLine(result.Id)
        Catch e As Exception
            Console.WriteLine("Exception when calling TextMagicApi.SendMessage: " & e.Message)
        End Try

        ' Get all outgoing messages sample
        Try
            Dim result = apiInstance.GetAllOutboundMessages(1, 10)
            Console.WriteLine(result.Resources(0).Id)
        Catch e As Exception
            Console.WriteLine("Exception when calling TextMagicApi.GetAllOutboundMessages: " & e.Message)
        End Try

        ' Upload list avatar sample, 3223 here is a sample list id
        Try
            Dim stream = File.Open("/CustomPath/Images/test.png", FileMode.Open)
            Dim result = apiInstance.UploadListAvatar(stream, 3223)
            Console.WriteLine(result.Href)
        Catch e As Exception
            Console.WriteLine("Exception when calling TextMagicApi.UploadListAvatar: " & e.Message)
        End Try
    End Sub
End Module

License

The library is available as open source under the terms of the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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.  net9.0 was computed.  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.  net10.0 was computed.  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. 
.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 net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  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. 
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
1.0.1 1,620 7/6/2023
1.0.0 265 7/6/2023