Skip to content
The Releans iOS SDK allow you to get up an running with Releans API quickly in your project (Objective-C) # What you can do with Releans Services? 1- Send emails 2- On-time SMS 3- Automation for reminders and appointments
Objective-C Other
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.xcodeproj
Releans
.travis.yml
Jenkinsfile
LICENSE
PodFile
README.md
Releans.podspec
circle.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 code has dependencies over external libraries like UniRest. These dependencies are defined in the PodFile file that comes with the SDK. To resolve these dependencies, we use the Cocoapods package manager. Visit https://guides.cocoapods.org/using/getting-started.html to setup Cocoapods on your system. Open command prompt and type pod --version. This should display the current version of Cocoapods installed if the installation was successful.

Using command line, navigate to the directory containing the generated files (including PodFile) for the SDK. Run the command pod install. This should install all the required dependencies and create the pods directory in your project directory.

Installing dependencies using Cocoapods

Open the project workspace using the (Releans.xcworkspace) file. Invoke the build process using Command(⌘)+B shortcut key or using the Build menu as shown below.

Building SDK using Xcode

How to Use

The Releans code is a Cocoa Touch Static Library which can be used in any iOS project. The support for these generated libraries go all the way back to iOS 6.

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

1. Starting a new project

To start a new project, left-click on the Create a new Xcode project. Create Test Project - Step 1

Next, choose Single View Application and click Next. Create Test Project - Step 2

Provide Test-Project as the product name click Next. Create Test Project - Step 3

Choose the desired location of your project folder and click Create. Create Test Project - Step 4

2. Adding the static library dependency

To add this dependency open a terminal and navigate to your project folder. Next, input pod init and press enter. Add dependency - Step 1

Next, open the newly created PodFile in your favourite text editor. Add the following line : pod 'Releans', :path => 'Vendor/Releans' Add dependency - Step 2

Execute pod install from terminal to install the dependecy in your project. This would add the dependency to the newly created test project. Add dependency - Step 3

How to Test

Unit tests in this SDK can be run using Xcode.

First build the SDK as shown in the steps above and naivgate to the project directory and open the Releans.xcworkspace file.

Go to the test explorer in Xcode as shown in the picture below and click on run tests from the menu. Run tests

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

Configuration variables can be set as following.

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

Class Reference

List of Controllers

Class: MessageController

Get singleton instance

Message* message = [[Message alloc]init] ;

Method: getAllMessagesWithCompletionBlock

List all messages sent by the account.

function getAllMessagesWithCompletionBlock:(CompletedGetAllMessages) onCompleted()

Example Usage

    [self.message getAllMessagesWithCompletionBlock:  ^(BOOL success, HttpContext* context, id response, NSError* error) { 
       //Add code here
    }];

Method: getPriceOfMessageAsyncWithMobileNumber

Return cost of sending a message to the number.

function getPriceOfMessageAsyncWithMobileNumber:(NSString*) mobileNumber
                completionBlock:(CompletedGetPriceOfMessage) onCompleted(mobileNumber)

Parameters

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

Example Usage

    // Parameters for the API call
    NSString* mobileNumber = @"mobileNumber";

    [self.message getPriceOfMessageAsyncWithMobileNumber: mobileNumber  completionBlock:^(BOOL success, HttpContext* context, NSString* response, NSError* error) { 
       //Add code here
    }];

Method: getViewMessageAsyncWithId

Return the details of the message.

function getViewMessageAsyncWithId:(NSString*) mid
                completionBlock:(CompletedGetViewMessage) onCompleted(mid)

Parameters

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

Example Usage

    // Parameters for the API call
    NSString* mid = @"id";

    [self.message getViewMessageAsyncWithId: mid  completionBlock:^(BOOL success, HttpContext* context, id response, NSError* error) { 
       //Add code here
    }];

Method: createSendSMSMessageAsyncWithSenderId

Send a single message.

function createSendSMSMessageAsyncWithSenderId:(NSString*) senderId
                mobileNumber:(NSString*) mobileNumber
                message:(NSString*) message
                completionBlock:(CompletedPostSendSMSMessage) onCompleted(senderId mobileNumber : mobileNumber message : 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

    // Parameters for the API call
    NSString* senderId = @"senderId";
    NSString* mobileNumber = @"mobileNumber";
    NSString* message = @"message";

    [self.message createSendSMSMessageAsyncWithSenderId: senderId mobileNumber : mobileNumber message : message  completionBlock:^(BOOL success, HttpContext* context, NSString* response, NSError* error) { 
       //Add code here
    }];

Back to List of Controllers

Class: SenderController

Get singleton instance

Sender* sender = [[Sender alloc]init] ;

Method: getSenderNameDetailsAsyncWithId

Return the details of the sender name.

function getSenderNameDetailsAsyncWithId:(NSString*) mid
                completionBlock:(CompletedGetSenderNameDetails) onCompleted(mid)

Parameters

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

Example Usage

    // Parameters for the API call
    NSString* mid = @"id";

    [self.sender getSenderNameDetailsAsyncWithId: mid  completionBlock:^(BOOL success, HttpContext* context, id response, NSError* error) { 
       //Add code here
    }];

Method: createSenderNameAsyncWithSenderName

Create a new sender id to send messages using it

function createSenderNameAsyncWithSenderName:(NSString*) senderName
                completionBlock:(CompletedPostCreateSenderName) onCompleted(senderName)

Parameters

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

Example Usage

    // Parameters for the API call
    NSString* senderName = @"senderName";

    [self.sender createSenderNameAsyncWithSenderName: senderName  completionBlock:^(BOOL success, HttpContext* context, NSString* response, NSError* error) { 
       //Add code here
    }];

Method: getAllSendersWithCompletionBlock

List all senders names associated with the account

function getAllSendersWithCompletionBlock:(CompletedGetAllSenders) onCompleted()

Example Usage

    [self.sender getAllSendersWithCompletionBlock:  ^(BOOL success, HttpContext* context, id response, NSError* error) { 
       //Add code here
    }];

Back to List of Controllers

Class: BalanceController

Get singleton instance

Balance* balance = [[Balance alloc]init] ;

Method: getBalanceWithCompletionBlock

Get your available balance

function getBalanceWithCompletionBlock:(CompletedGetBalance) onCompleted()

Example Usage

    [self.balance getBalanceWithCompletionBlock:  ^(BOOL success, HttpContext* context, NSString* response, NSError* error) { 
       //Add code here
    }];

Back to List of Controllers

You can’t perform that action at this time.