阿里大鱼服务端Node库API,ES6版本
API构造函数
Examples:
// 创建api实例
var api = new API("appkey", "appsecret", "use_https", "sandbox");
方法签名
| 函数 | API() | ||
| 参数 | appKey(String) | 应用的app key |
|
| 参数 | appSecret(String) | 应用的app secret |
|
| 参数 | use_https(Boolean) | 是否使用https通道 |
|
| 参数 | sandbox(Boolean) | 是否使用砂箱 |
|
计算签名。单独使用可以用于验证各种回调接口的签名。
Examples:
// 计算签名
var shasum = api.getSignature("nonce", "timestamp");
方法签名
| 方法 | API.prototype.sign() | ||
| 参数 | nonce(String) | ||
| 参数 | timestamp(String) | ||
设置HTTP请求的参数
Examples:
// 设定超时为15秒
var token = api.setOpts({
timeout: 15000
});
方法签名
| 方法 | API.prototype.setOpts() | ||
| 参数 | obj(Object) | 请求的配置参数 |
|
用于支持对象合并。将对象合并到API.prototype上,使得能够支持扩展
Examples:
// 加入发送短信的模块
API.mixin(require('./lib/api_sms'));
方法签名
| 方法 | API.mixin() | ||
| 参数 | obj(Object) | 要合并的对象 |
|
发送短信
http://open.taobao.com/doc2/apiDetail?spm=0.0.0.0.a90QvS&apiId=25450
举例:
// 发送短信
var ret = yield api.send_sms(args);
方法签名
| 方法 | exports.send_sms() | ||
| 参数 | args(Object) | 请求的参数(必填) |
|
文本转语音通知
http://open.taobao.com/doc2/apiDetail?spm=0.0.0.0.F0x8qp&apiId=25444
举例:
// 文本转语音通知
var flag = yield api.tts_singlecall(args);
方法签名
| 方法 | exports.tts_singlecall() | ||
| 参数 | args(Object) | 请求的参数(必填) |
|
语音双呼
http://open.taobao.com/doc2/apiDetail?spm=0.0.0.0.56MDBW&apiId=25443
举例:
// 语音双呼
var flag = yield api.voice_doublecall(args);
方法签名
| 方法 | exports.voice_doublecall() | ||
| 参数 | args(Object) | 请求的参数(必填) |
|
语音通知
http://open.taobao.com/doc2/apiDetail?spm=0.0.0.0.gZWjRM&apiId=25445
举例:
// 语音通知
var flag = yield api.voice_singlecall(args);
方法签名
| 方法 | exports.voice_singlecall() | ||
| 参数 | args(Object) | 请求的参数(必填) |
|