# 简介

推荐版本: NodeJs 14.13.0+

# Install

安装SDK包

npm install @opentapd/tapd-node-sdk
1

# Usage

# 申请应用

  1. 申请和使用应用

  2. 复制应用ID和密钥 https://open.tapd.cn/admin/{你的应用标识}/dashboard enter image description here

# DEMO

const SDK = require('@opentapd/tapd-node-sdk');

const api = new SDK({
    client: 'gggg123', // 你的应用CODE
    secret: '112A5B9F-D7B9-EC9C-B688-24E44F5043C4', // 密钥 注意保密
});


// api 详细文档可参考tapdAPI的文档
api.getStories({
    workspace_id: '755'
}).then(data => {
    console.log(data);
}).catch(e => console.log(e)); 

// 文件上传接口使用方式
var file = fs.createReadStream('your file path')

// 支持Buffer
// const {FILE}= require('@tencent/tapd-node-sdk');
// const { Readable } = require('stream');
// //Readable
// const file_stdout = Readable.from(bitmap);
// var file = new FILE({
//   stdout: file_stdout,
//   filename: 'test.jpg',
// });

api.uploadImage({
    workspace_id: "755", 
    image: file
}).then(data => {
    console.log(data);
}).catch(e => console.log(e));


api.uploadImage({
    workspace_id: "755", 
    image: file
}).then(data => {
    console.log(data);
}).catch(e => console.log(e));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

# 查看所有SDK方法和参数 (opens new window)