stamplay
v1.0.8
Published
NodeJs SDK for Stamplay
Downloads
23
Maintainers
Readme
This library gives you access to the powerful Stamplay cloud platform from your Node app. For more info on Stamplay and its features, see the website
##Getting Started This module is available for download on NPM:
npm install stamplay
To get started:
var Stamplay = require('stamplay')
var stamplay = new Stamplay('appId', 'apiKey')
##How to use it Register a new user:
var data = {
"email":"[email protected]",
"password":"john123"
}
stamplay.User.save(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
})
Executing code with Code Block:
var codeblock = new stamplay.Codeblock('codeBlockId');
var data = { foo: 'bar' }; // request body
var query = {
q1 : 1,
q2 : 'query parameter'
};
codeblock.run(data, query, function (err, res) {
if(err) return err;
// Handle Success
})
##Available components This NodeJS SDK expose the following components:
- User
- save(data, [callback])
- get(data, [callback])
- remove(id, [callback])
- update(id, data, [callback] )
- getRoles([callback] )
- getRole(roleId, [callback] )
- setRole(id, roleId, [callback] )
- Object
- save(data, [callback])
- get(data, [callback])
- remove(id, [callback])
- update(id, data, [callback])
- patch(id, data, [callback])
- upVote(id, [callback])
- downVote(id, [callback])
- rate(id, rate, [callback])
- comment(id, text, [callback])
- push(id, attribute, data, [callback])
- Code Block
- post(data, queryParams, [callback])
- put(data, queryParams, [callback])
- patch(data, queryParams, [callback])
- get(queryParams, [callback])
- delete(queryParams, [callback])
- Webhook
- post(data, [callback])
- Stripe
- deleteCustomer(userId, [callback])
- createSubscription(userId, planId, [callback])
- deleteSubscription(userId, subscriptionId, options, [callback])
- getSubscription(userId, subscriptionId, [callback])
- getSubscriptions(userId, options, [callback])
- updateSubscription(userId, subscriptionId, options, [callback])
- Query
- greaterThan(attr, value)
- greaterThanOrEqual(attr, value)
- lessThan(attr, value)
- lessThanOrEqual(attr, value)
- pagination(page, per_page)
- between(attr, value1, value2)
- equalTo(attr, value)
- exists(attr)
- notExists(attr)
- sortAscending(attr)
- sortDescending(attr)
- populate()
- populateOwner()
- select(attr,...)
- regex(attr, regex, options)
- near(type, coordinates, maxDistance, minDistance)
- nearSphere(type, coordinates, maxDistance, minDistance)
- geoIntersects(type, coordinates)
- geoWithinGeometry(type, coordinates)
- geoWithinCenterSphere(coordinates, radius)
- or(query,..)
- exec([callback])
Contributing
- Fork it ( https://github.com/[my-github-username]/stamplay-nodejs-sdk/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
One more thing
Go to Stamplay and try it now for free!.