@airx/sdk
AirX SDK
Last updated a year ago by zhangyf92 .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @airx/sdk 
SYNC missed versions from official npm registry.

@airx/sdk

npm npm npm codebeat badge Maintainability

安装

npm i --save @airx/sdk
# 或
yarn add @airx/sdk

使用

const SDK = require('@airx/sdk');

const sdk = new SDK({
  SecretId: 'xxxx',
  SecretKey: 'xxxx',
  // 访问的域名:
  // Domain: 'api.airdwing.com',
  // 是否启用HTTPS:
  // Secure: true, 
  // 自定义预处理方法
  // filter: x => x.data,
  // 自定义异常捕获方法
  // catch: (err) => { throw err; }
});

(async () => {
  const result = await sdk.get('/user/check', {
    username: '13212341234'
  });
  console.log(result);
})();

文件上传

需要稍微注意一下的接口:

const SDK = require('@airx/sdk');
const fs = require('fs');

const sdk = new SDK({
  SecretId: 'xxxx',
  SecretKey: 'xxxx'
});

(async () => {
  const result = await sdk.upload({
    auth: 'xxxx',
    type: 'orgverify',
    file: fs.createReadStream('PATH/TO/xxx.jpg') // 注意这里, 本地文件可以用 path.join 拼装地址,或者直接用Stream
  });
  console.log(result);
})();

无缝对接腾讯云接口

Demo:

const SDK = require('@airx/sdk');

const cvm = new SDK({
  SecretId: 'xxxx',
  SecretKey: 'xxxx',
  Domain: 'cvm.api.qcloud.com'
});

(async () => {
  const result = await cvm.get('/v2/index.php', {
    Action: 'DescribeInstances',
    Region: 'gz'
  });
  console.log(result);
})();

License

Apache 2.0

通过支付宝捐赠:

qr

Current Tags

  • 0.5.9                                ...           latest (a year ago)

21 Versions

  • 0.5.9                                ...           a year ago
  • 0.5.8                                ...           2 years ago
  • 0.5.6                                ...           2 years ago
  • 0.5.5                                ...           2 years ago
  • 0.5.3                                ...           2 years ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.3.5                                ...           2 years ago
  • 0.3.4                                ...           2 years ago
  • 0.3.3                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 22
Last Month 65
Dependencies (5)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |