Skip to content
The Releans .NET SDK allow you to get up an running with Releans API quickly in your project. # What you can do with Releans Services? 1- Send emails 2- On-time SMS 3- Automation for reminders and appointments
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Releans.Standard
LICENSE
README.md
Releans.sln
_config.yml

README.md

Getting started

The Releans SDK enables developers to use Releans Services in their code. You can get started in minutes.

Create Releans Account

First, sign up for a Releans account if you don't already have one, and make a note of your API key on the dashboard API page.

How to Build

The Releans SDK code uses the Newtonsoft Json.NET NuGet Package. If the automatic NuGet package restore is enabled, these dependencies will be installed automatically. Therefore, you will need internet access for build.

"This library requires Visual Studio 2017 for compilation."

  1. Open the solution (Releans.sln) file.
  2. Invoke the build process using Ctrl+Shift+B shortcut key or using the Build menu as shown below.

Building SDK using Visual Studio

How to Use

The build process generates a portable class library, which can be used like a normal class library. The Releans library is compatible with Windows Forms, Windows RT, Windows Phone 8, Silverlight 5, Xamarin iOS, Xamarin Android and Mono. More information on how to use can be found at the MSDN Portable Class Libraries documentation.

The following section explains how to use the Releans library in a new console project.

1. Starting a new project

For starting a new project, right click on the current solution from the solution explorer and choose Add -> New Project.

Add a new project in the existing solution using Visual Studio

Next, choose "Console Application", provide a TestConsoleProject as the project name and click OK.

Create a new console project using Visual Studio

2. Set as startup project

The new console project is the entry point for the eventual execution. This requires us to set the TestConsoleProject as the start-up project. To do this, right-click on the TestConsoleProject and choose Set as StartUp Project form the context menu.

Set the new cosole project as the start up project

3. Add reference of the library project

In order to use the Releans library in the new project, first we must add a projet reference to the TestConsoleProject. First, right click on the References node in the solution explorer and click Add Reference....

Open references of the TestConsoleProject

Next, a window will be displayed where we must set the checkbox on Releans.Standard and click OK. By doing this, we have added a reference of the Releans.Standard project into the new TestConsoleProject.

Add a reference to the TestConsoleProject

4. Write sample code

Once the TestConsoleProject is created, a file named Program.cs will be visible in the solution explorer with an empty Main method. This is the entry point for the execution of the entire solution. Here, you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.

Add a reference to the TestConsoleProject

How to Test

The Releans SDK also contain one or more Tests, which are contained in the Tests project. In order to invoke these test cases, you will need NUnit 3.0 Test Adapter Extension for Visual Studio. Once the SDK is complied, the test cases should appear in the Test Explorer window. Here, you can click Run All to execute these test cases.

Initialization

Authentication

In order to setup authentication and initialization of the API client, you need the following information.

Parameter Description
oAuthAccessToken OAuth 2.0 Access Token

API client can be initialized as following.

// Configuration parameters and credentials
string oAuthAccessToken = "oAuthAccessToken"; // OAuth 2.0 Access Token

ReleansClient client = new ReleansClient(oAuthAccessToken);

Class Reference

List of Controllers

Class: MessageController

Get singleton instance

The singleton instance of the MessageController class can be accessed from the API Client.

MessageController message = client.Message;

Method: GetAllMessages

List all messages sent by the account.

Task<dynamic> GetAllMessages()

Example Usage

dynamic result = await message.GetAllMessages();

Method: GetPriceOfMessage

Return cost of sending a message to the number.

Task<string> GetPriceOfMessage(string mobileNumber)

Parameters

Parameter Tags Description
mobileNumber Required Mobile number you want to know the price of sending a message.

Example Usage

string mobileNumber = "mobileNumber";

string result = await message.GetPriceOfMessage(mobileNumber);

Method: GetViewMessage

Return the details of the message.

Task<dynamic> GetViewMessage(string id)

Parameters

Parameter Tags Description
id Required DefaultValue Id of the message you need to return its details.

Example Usage

string id = "id";

dynamic result = await message.GetViewMessage(id);

Method: CreateSendSMSMessage

Send a single message.

Task<string> CreateSendSMSMessage(string senderId, string mobileNumber, string message)

Parameters

Parameter Tags Description
senderId Required DefaultValue Sender id to send the message from.
mobileNumber Required DefaultValue The mobile number supposed to receive the message.
message Required DefaultValue Message text.

Example Usage

string senderId = "sender-id";
string mobileNumber = "mobile-number";
string message = "message";

string result = await message.CreateSendSMSMessage(senderId, mobileNumber, message);

Back to List of Controllers

Class: SenderController

Get singleton instance

The singleton instance of the SenderController class can be accessed from the API Client.

SenderController sender = client.Sender;

Method: GetSenderNameDetails

Return the details of the sender name.

Task<dynamic> GetSenderNameDetails(string id)

Parameters

Parameter Tags Description
id Required DefaultValue The sender id you want its details

Example Usage

string id = "sender-id";

dynamic result = await sender.GetSenderNameDetails(id);

Method: CreateSenderName

Create a new sender id to send messages using it

Task<string> CreateSenderName(string senderName)

Parameters

Parameter Tags Description
senderName Required DefaultValue Name you want to register as Sender Name

Example Usage

string senderName = "Your sender name";

string result = await sender.CreateSenderName(senderName);

Method: GetAllSenders

List all senders names associated with the account

Task<dynamic> GetAllSenders()

Example Usage

dynamic result = await sender.GetAllSenders();

Back to List of Controllers

Class: BalanceController

Get singleton instance

The singleton instance of the BalanceController class can be accessed from the API Client.

BalanceController balance = client.Balance;

Method: GetBalance

Get your available balance

Task<string> GetBalance()

Example Usage

string result = await balance.GetBalance();

Back to List of Controllers

You can’t perform that action at this time.