GithubHelp home page GithubHelp logo

solaris-api-client's Introduction

Solaris API Client.

API Client for binary options platform Solaris.

Installation

Install using Composer, doubtless.

$ composer require resnext/solaris-api-client

General API Client usage.

Your can configure used HTTP client using $options param of ApiClient constructor.

Error handling

Each method of \Solaris\ApiClient can return response object (instance of \Solaris\Response) or throws two kind of exceptions.

  1. \Solaris\ServerException Server-side exception assigned with invalid data received of impossible operation is requested.
  2. \Solaris\ClientException Client-side exception means API Client cannot connect to Solaris servers or receive valid response with any reasons.

Configuration and customization

Example:

$httpClient = new GuzzleHttp\Client([
   GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 2,
]);

$apiClient = new \Solaris\ApiClient(<API_URL>, <API_USERNAME>, <API_PASSWORD>, [
    'httpClient' => $httpClient,
]);

Get available countries list

For customer adding you need specify countryISO 3166-1 code (ex.: en, us, gb). You can get available for registration countries list as bellow:

/** @var \Solaris\Responses\GetCountriesResponse $response */
$response = $apiClient->getCountries();
/** @var \Solaris\Entities\Country[] $countries */
$countries = $response->getCountries();

Add customer

Customer's adding is main method of any trade platform...

$request = new \Solaris\Requests\AddCustomerRequest([
    'firstName' => 'John',
    'lastName' => 'Smith',
    'email' => '[email protected]',
    'phone' => '123456789',
    'country' => 'cz',
    'currency' => 'USD',
    'password' => 'qwerty',
]);

/** @var \Solaris\Responses\AddCustomerResponse $response */
$response = $apiClient->addCustomer($request);

Get customer auto-login URL and auth key.

It is really easy:

$request = new \Solaris\Requests\GetCustomerAuthKeyRequest(['email' => '[email protected]']);

/**
 * @var \Solaris\Responses\GetCustomerAuthKeyResponse $response
 */
$response = $apiClient->getCustomerAuthKey($request);

echo $response->getAuthUrl();

Deposits retrieving

/** @var \Solaris\Responses\GetDepositsResponse $response */
$response = $apiClient->getDeposits();
/** @var \Solaris\Entities\Deposit[] $deposits */
$deposits = $response->getDeposits();

solaris-api-client's People

Contributors

alexander-emelyanov avatar lasayter avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.