Overview

Get singleton instance

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

BalanceController balance = client.Balance;
BalanceController balanceController = client.getBalance();
Balance* balance  = [[Balance alloc]init]();
BalanceController balanceController = client.getBalance();
$balanceController = $client->getBalance();
balance_controller = client.balance
balance_controller = client.balance
var app = angular.module('myApp', ['Releans']);
app.controller('testController', BalanceController);

function BalanceController($scope,
    BalanceController) {
}
const lib = require('lib');
const controller = lib.BalanceController;

Get Balance

Get your available balance

GET /balance
GetBalanceAsync()
void getBalanceAsync(
    final APICallBack callBack)
function getBalanceWithCompletionBlock:(CompletedGetBalance) onCompleted:()
void getBalanceAsync(
    final APICallBack callBack)
function getBalance()
def get_balance(self)
def get_balance
getBalance()
getBalance()

Complete File code

Show complete file for code, with bootstrap and error handling included.

curl -X GET \
  --url 'https://platform.releans.com/api/balance' \
  -H 'Authorization: Bearer Your_API_Key'
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;

using Releans;
using Releans.Utilities;
using Releans.Models;
using Releans.Controllers;
using Releans.Exceptions;
using System.IO;

namespace Testing
{
    class Program {
        static void Main(string[] args){
            Configuration.OAuthAccessToken = "Your_API_Key";
            ReleansClient client = new ReleansClient();
            BalanceController balance = client.Balance;

            try
            {
                string result = balance.GetBalanceAsync().Result;
            }
            catch (APIException e){};
        }
    }
}
package com.example;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.*;
import java.io.*;

import Releans.*;
import Releans.models.*;
import Releans.controllers.*;
import Releans.http.client.*;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Configuration.oAuthAccessToken = "Your_API_Key";
        ReleansClient client = new ReleansClient();
        BalanceController balanceController = client.getBalance();

        balanceController.getBalanceAsync(new APICallBack() {
            public void onSuccess(HttpContext context, String response) {
                // TODO success callback handler
            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler
            }
        });
    }
}
#import 
#import Balance.h



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

@try {
    [balance getBalanceWithCompletionBlock:  ^(BOOL success, HttpContext* context, NSString* response, NSError* error){
    if(error!=null)
        // Handle error
    else
        NSString* = response;
}];}
} @catch (APIError * exception) {
    NSLog (@"Caught APIException:%@ %@", exception.reason);
}
package com.example;

import java.util.*;
import java.io.*;

import Releans.*;
import Releans.models.*;
import Releans.controllers.*;
import Releans.http.client.*;

public class Program {

    public static void main(String[] args) {
        Configuration.oAuthAccessToken = "Your_API_Key";
        ReleansClient client = new ReleansClient();
        BalanceController balanceController = client.getBalance();

        balanceController.getBalanceAsync(new APICallBack() {
            public void onSuccess(HttpContext context, String response) {
                // TODO success callback handler
            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler
            }
        });
    }
}


require_once "vendor/autoload.php";

use ReleansLib\Models;
use ReleansLib\Exceptions;

$oAuthAccessToken = 'Your_API_Key';

$client = new ReleansLib\ReleansClient($oAuthAccessToken);

$balanceController = $client->getBalance();

try {
    $result = $balanceController->getBalance();
} catch (ReleansLib\APIException $e) {
    echo 'Caught APIException: ',  $e->getMessage(), "\n";
}
from releans.releans import Releans
from releans.exceptions.api_exception import APIException

o_auth_access_token = 'Your_API_Key'

client = ReleansClient(o_auth_access_token)



balance_controller = client.balance
try:
    result = balance_controller.get_balance()
except APIException as e:
    print(e)
require 'releans'

include Releans

o_auth_access_token = 'Your_API_Key'

client = Releans.new(o_auth_access_token: o_auth_access_token)

balance_controller = client.balance
begin
  result = balance_controller.get_balance()
rescue APIException => ex
  puts "Caught APIException: #{ex.message}"
end
'use strict';

var app = angular.module('myApp', ['Releans']);
app.controller('testController', BalanceController);

function BalanceController($scope,
    Configuration,
    BalanceController) {

Configuration.oAuthAccessToken = 'Your_API_Key';

    var result = BalanceController.getBalance();
    result.then(function(response) {
        // this block will be executed on successful endpoint call
        // `response.body` will be of type 'string'
    }, function(err) {
        // this block will be executed on endpoint call failure
    });
}
'use strict';

const lib = require('lib');
const configuration = lib.Configuration;
const controller = lib.BalanceController;

configuration.oAuthAccessToken = 'Your_API_Key';

const promise = controller.getBalance();
promise.then((response) => {
    // this block will be executed on successful endpoint call
    // `response` will be of type 'string'
}, (err) => {
    // this block will be executed on endpoint call failure
    // `err` is an 'object' containing more information about the error
});