moceansdk 1.2.1 copy "moceansdk: ^1.2.1" to clipboard
moceansdk: ^1.2.1 copied to clipboard

SDK Library Dart to send SMS for FREE using MoceanAPI sms solution.

MoceanAPI Client Library for Dart #

Latest Stable Version build 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

  1. add moceansdk to your pubspec.yaml
name: my_app
dependencies:
  moceansdk: ^1.0.0
  1. 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
mocean.voice.call();            //Voice

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.

import 'package:moceansdk/moceansdk.dart';
  
var mocean = Mocean(
  Basic('MOCEAN_API_KEY', 'MOCEAN_API_SECRET')
);

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

  var result = res['messages'][0];

  print(result);
  print(result['status']);
  print(result['msgid']);
  print(result['receiver']);
}
*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['messages'][0]['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

3
likes
30
pub points
0%
popularity

Publisher

unverified uploader

SDK Library Dart to send SMS for FREE using MoceanAPI sms solution.

Homepage
Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on moceansdk