passkit-v2-sdk
v0.3.1
Published
This package is inspired by passkit-sdk
Downloads
28
Readme
Passkit V2 SDK
This node package is inspired by passkit-sdk
node >= 6.10.3
Installation
npm isntall passkit-v2-sdk --save
Documentation
Initialize
var PasskitSDK = require('passkit-v2-sdk');
PasskitSDK.init({
apiKey: 'yourapikey',
apiSecret: 'yoursecretkey',
});
This is default options
{
url: 'https://api-pass.passkit.net',
apiKey: '',
apiSecret: '',
apiVersion: 'v2',
};
General
Token
To generate JWT token
var token = PasskitSDK.generateToken('passId');
Pass
Get pass
- Method: 'GET',
- Params: 'passId',
- Output: 'json'
Note: This function does not require apiKey and apiSecret
PasskitSDK.pass.get('passId')
.then(function(res) {
// success
})
.catch(function(err) {
// fail
// err.message
})
Create pass
- Method: 'POST',
- Params: passObject
PasskitSDK.pass.create(passObject)
.then(function(res) {
// success
})
.catch(function(err) {
// fail
// err.message
})
Update pass
- Method: 'PUT',
- Params: ('passId', passObject)
PasskitSDK.pass.update('passId', passObject)
.then(function(res) {
// success
})
.catch(function(err) {
// fail
// err.message
})
Image
- Method: 'POST'
- Params: 'image'
PasskitSDK.image.upload(__dirname + '/image.png')
.then(function(res) {
// success
// res.path
})
.catch(function(err) {
// fail
// err.message
})