Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Klient napisany w języku javascript, pozwalający na wysyłanie wiadomości SMS, MMS, VMS oraz zarządzanie kontem w serwisie SMSAPI.pl

License

Notifications You must be signed in to change notification settings

bofort/smsapi-javascript-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSAPI JavaScript (node.js) Client

npm version

Klient JavaScript pozwalający na wysyłanie wiadomości SMS, MMS, VMS oraz zarządzanie kontem w serwisie SMSAPI.pl

Instalacja (node.js)

$ npm install smsapi --save

Przykład użycia

var SMSAPI = require('smsapi'),
    smsapi = new SMSAPI();

smsapi.authentication
    .login('username', 'password')
    .then(sendMessage)
    .then(displayResult)
    .catch(displayError);

function sendMessage(){
    return smsapi.message
        .sms()
        .from('Info')
        .to('605xxxxxx')
        .message('My first message!')
        .execute(); // return Promise
}

function displayResult(result){
    console.log(result);
}

function displayError(err){
    console.error(err);
}

Przykład wykorzystania serwera zapasowego

var SMSAPI = require('smsapi'),
    smsapi = new SMSAPI({
    	server: ‘https://api2.smsapi.pl/'
    });

smsapi.authentication
    .login('username', 'password')
    .then(sendMessage)
    .then(displayResult)
    .catch(displayError);

function sendMessage(){
    return smsapi.message
        .sms()
        .from('Info')
        .to('605xxxxxx')
        .message('My first message!')
        .execute(); // return Promise
}

function displayResult(result){
    console.log(result);
}

function displayError(err){
    console.error(err);
}

Dokumentacja

Dokumentacja interfejsu REST API znajduje się pod adresem http://www.smsapi.pl/rest.

Wszystkie odwołania do API zwracają obiekt Promise zgodny ze standardem Promises/A+. Użyta implementacja: https://github.com/tildeio/rsvp.js

Dostępne operacje

  • message
    • sms
    • mms
    • vms
  • points
    • get
  • sender
    • add
    • delete
    • status
    • default
    • list
  • hlr
    • check
  • user
    • add
    • delete
    • update
    • get
    • list
  • phonebook (deprecated)
    • contact
      • add
      • get
      • update
      • list
      • delete
    • group
      • get
      • add
      • update
      • list
      • delete
  • contacts
    • list
    • add
    • get
    • update
    • delete
    • fields
      • list
      • add
      • update
      • delete
    • groups
      • list
      • add
      • get
      • update
      • delete
      • assignments
        • list
        • add
        • get
        • delete
      • permissions
        • list
        • add
        • get
        • update
        • delete
      • members
        • add
        • get
        • delete

Przykłady

Dodatkowe przykłady użycia dostępnych operacji można znaleźć w testach (./test).

Testy

$ npm install mocha -g
$ npm install .
$ npm test

Licencja

Apache 2.0 License

About

Klient napisany w języku javascript, pozwalający na wysyłanie wiadomości SMS, MMS, VMS oraz zarządzanie kontem w serwisie SMSAPI.pl

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%