1.0.0 • Published 8 years ago

secken-sdk v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

Secken Private Cloud Server SDK For Nodejs

NPM version Build Status Downloads

中文文档

Description

Nodejs SDK for Secken-SDK Server

Website: https://www.yangcong.com

Wechat: yangcongAPP

Wechat Group: http://t.cn/RLGDwMJ

QQ: 475510094

Sina Weibo: http://weibo.com/secken

Business: 010-64772882 / market@secken.com

Support: support@secken.com

Documents: https://www.yangcong.com/help

Install && Usage

To install Secken.Private.ServerSdk, Import these packages

npm install secken-sdk
let SeckenSDK = require('secken-sdk');
let sdk = new SeckenSDK({
    app_id: 'appid',
    app_key: 'appkey',
});

all the functions in SDK will return a Promise object by node module Q

Release

1.0.0

  • Add unit testing

0.0.3

  • Update Readme

0.0.1

  • Add #getQrcode, #postAuthPush, #getResult, #checkAuthToken

Secken-SDK wrote by ES6, please using in Node 5.0 +

getQrcode (get a qrcode picture for auth)

sdk.getQrcode(options).then(data => {
    // data.qrcode_url
    // data.event_id   
});

params:

options = {
    auth_type: '',
    action_type: '',
    action_details: '',
    callback: ''
}
statusdescription
200OK
400params error
403signature error
404no such app id
407time out
500system error
609ip address blocked

getResult (get action result by event id)

accept 2 params: event_id and times

times will set 2000 by default, the function will get result in loop with delay time 2000 ms, by setting times to change the loop delay time, if times was false, function will run only one times

sdk.getQrcode(options).then(data => {
    return sdk.getResult(data.event_id, times);
}).then(data => {
    // success
}, error => {
    // error
}, notify => {
    // waiting for user auth, status 602
});
statusdescription
200OK
201event has been resolved
400params error
403signature error
404no such app id
407time out
500system error
601reject by user
602waiting for user auth
604no such event id
606callback is set
609ip address blocked

postAuthPush (push a message to user for auth)

sdk.postAuthPush({
    uid: "",
}).then(data => {
    // success
}, error => {
    // failed
});

params:

options = {
    uid: "",   // required
    auth_type: "",
    action_type: "",
    action_details: ""
}
statusdescription
200OK
400params error
403signature error
404no such app id
407time out
500system error
609ip address blocked

checkAuthToken (check auth token)

sdk.checkAuthToken({
    auth_token: "1234567890123456789012345678901234567890",
}).then(data => {
    // success
}, error => {
    // failed
});
statusdesciption
200OK
400params error
403signature error
404no such app id
407time out
500system error
608no such token
609ip address blocked
1.0.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago