MoceanAPI Client Library for Dart

Latest Stable Version Build Status codecov MIT license

This is the Dart library for use Mocean's API. To use this, you'll need a Mocean account. Sign up for free at moceanapi.com.

Installation

To install the client

  • add moceansdk to your pubspec.yaml
  • run pub get

Usage

Create a client with your API key and secret

import 'package:moceansdk/moceansdk.dart';

var mocean = Mocean(
  Basic('your api key', 'your api secret'),
);

Available API

mocean.balance.inquiry();       //Get Account Balance
mocean.pricing.inquiry();       //Get Account Pricing
mocean.sms.send();              //Send SMS
mocean.messageStatus.inquiry(); //Get Message Status
mocean.sendCode.send();         //Send Verify Code
mocean.verifyCode.send();       //Check Verify Code
mocean.numberLookup.inquiry();  //Number Lookup

Example

To use Mocean's SMS API to send an SMS message, call the mocean.sms.send() method.

The API can be called directly, using a simple array of parameters, the keys match the parameters of the API.

var res = await mocean.sms.send({
  'mocean-to': '60123456789',
  'mocean-text': 'hello world',
  'mocean-from': 'dart'
});

print(res);
*All calls will return Future object

Responses

For your convenient, the API response has been parsed to Map

print(res);           // show full response string
print(res['status']); // show response status, '0' in this case

Documentation

Kindly visit MoceanApi Docs for more usage

License

This library is released under the MIT License

Libraries

moceansdk