Stamplay / stamplay-js-sdk

:rocket: JavaScript SDK of Stamplay cloud platform
https://stamplay.com
MIT License
88 stars 18 forks source link

Stamplay JavaScript SDK

Build Status Production version Bower version Code Climate

This library gives you access to the powerful Stamplay cloud platform from your JavaScript app. For more info on Stamplay and its features, see the website or the JavaScript guide

Installation

The SDK is available for on NPM, Bower and on our CDN.

Using npm

$ npm install -g stamplay-sdk

Using bower 

$ bower install -g stamplay-js-sdk

To get started import the library in your project and initialize it by calling init function with your appId

<script src="https://cdn.stamplay.com/libs/stamplay-js-sdk/2.1.4/stamplay.min.js"></script>
<script> Stamplay.init("APPID"); </script>

How to use it

Register a new user:

var data = {
    "email":"john@stamplay.com",
    "password":"john123"
}
Stamplay.User.signup(data, function(error, result){
    //manage the result and the error
})

Store data using Objects:

var data = {
    "description":"A description",
    "title":"New title"
}
Stamplay.Object('foo').save(data, function(error, result){
    //manage the result and the error
})

Skip the callback to get a promise back

var data = {
    "description":"A description",
    "title":"New title"
}
Stamplay.Object('foo').save(data).then(function(result){
    //manage the result
},function(error){
    //manage the error
})

Available components

This JavaScript SDK expose the following components:

Also this components the sdk have some support objects to help you in common operation:


Build

To build a production ready library you need to have NPM and Bower installed and then run those two commands:

npm install && bower install
grunt build

You can also download this project and using all the precompiled files in src folder

Contributing

  1. Fork it ( https://github.com/[my-github-username]/stamplay-js-sdk/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

One more thing

Go to API Reference to see a lot of examples. Enjoy!