@larksuiteoapi/node-sdk 1.7.1 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/README.zh.md +12 -12
- package/es/index.js +279 -240
- package/lib/index.js +279 -240
- package/package.json +1 -1
- package/types/index.d.ts +776 -423
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ const res = await client.im.message.create({
|
|
|
61
61
|
},
|
|
62
62
|
data: {
|
|
63
63
|
receive_id: 'receive_id',
|
|
64
|
-
content: 'hello world',
|
|
64
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
65
65
|
msg_type: 'text',
|
|
66
66
|
},
|
|
67
67
|
});
|
|
@@ -99,7 +99,7 @@ client.im.message.create({
|
|
|
99
99
|
},
|
|
100
100
|
data: {
|
|
101
101
|
receive_id: 'chat_id',
|
|
102
|
-
content: 'hello world',
|
|
102
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
103
103
|
msg_type: 'text'
|
|
104
104
|
},
|
|
105
105
|
}, lark.withTenantKey('tenant key'));
|
|
@@ -194,7 +194,7 @@ await client.im.message.create({
|
|
|
194
194
|
},
|
|
195
195
|
data: {
|
|
196
196
|
receive_id: 'receive_id',
|
|
197
|
-
content: 'hello world',
|
|
197
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
198
198
|
msg_type: 'text',
|
|
199
199
|
},
|
|
200
200
|
}, {
|
|
@@ -220,7 +220,7 @@ await client.im.message.create({
|
|
|
220
220
|
},
|
|
221
221
|
data: {
|
|
222
222
|
receive_id: 'receive_id',
|
|
223
|
-
content: 'hello world',
|
|
223
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
224
224
|
msg_type: 'text',
|
|
225
225
|
},
|
|
226
226
|
}, lark.withTenantToken('tenant token'));
|
|
@@ -231,7 +231,7 @@ await client.im.message.create({
|
|
|
231
231
|
},
|
|
232
232
|
data: {
|
|
233
233
|
receive_id: 'receive_id',
|
|
234
|
-
content: 'hello world',
|
|
234
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
235
235
|
msg_type: 'text',
|
|
236
236
|
},
|
|
237
237
|
}, lark.withAll([
|
|
@@ -265,7 +265,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
265
265
|
},
|
|
266
266
|
data: {
|
|
267
267
|
receive_id: chatId,
|
|
268
|
-
content: 'hello world',
|
|
268
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
269
269
|
msg_type: 'text'
|
|
270
270
|
},
|
|
271
271
|
});
|
|
@@ -312,7 +312,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
312
312
|
},
|
|
313
313
|
data: {
|
|
314
314
|
receive_id: chatId,
|
|
315
|
-
content: 'hello world',
|
|
315
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
316
316
|
msg_type: 'text'
|
|
317
317
|
},
|
|
318
318
|
});
|
|
@@ -345,7 +345,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
345
345
|
},
|
|
346
346
|
data: {
|
|
347
347
|
receive_id: open_chat_id,
|
|
348
|
-
content: 'hello world',
|
|
348
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
349
349
|
msg_type: 'text'
|
|
350
350
|
},
|
|
351
351
|
});
|
|
@@ -381,7 +381,7 @@ onst eventDispatcher = new lark.EventDispatcher({
|
|
|
381
381
|
},
|
|
382
382
|
data: {
|
|
383
383
|
receive_id: open_chat_id,
|
|
384
|
-
content: 'hello world',
|
|
384
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
385
385
|
msg_type: 'text'
|
|
386
386
|
},
|
|
387
387
|
});
|
|
@@ -399,7 +399,7 @@ If you want to adapt to services written by other libraries, you currently need
|
|
|
399
399
|
|
|
400
400
|
```typescript
|
|
401
401
|
const data = server.getData();
|
|
402
|
-
const
|
|
402
|
+
const result = await dispatcher.invoke(data);
|
|
403
403
|
server.sendResult(result);
|
|
404
404
|
````
|
|
405
405
|
|
|
@@ -488,4 +488,4 @@ new lark.AESCipher('encrypt key').decrypt('content');
|
|
|
488
488
|
MIT
|
|
489
489
|
|
|
490
490
|
## Contact Us
|
|
491
|
-
Click [Server SDK](https://open.feishu.cn/document/ukTMukTMukTM/uETO1YjLxkTN24SM5UjN) in the upper right corner of the page 【Is this document helpful to you? 】Submit feedback
|
|
491
|
+
Click [Server SDK](https://open.feishu.cn/document/ukTMukTMukTM/uETO1YjLxkTN24SM5UjN) in the upper right corner of the page 【Is this document helpful to you? 】Submit feedback
|
package/README.zh.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 飞书开放接口SDK
|
|
2
2
|
[English](https://github.com/larksuite/node-sdk/blob/main/README.md)
|
|
3
3
|
## 概述
|
|
4
|
-
[飞书开放平台](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)提供了一系列服务端的原子api来实现多元化的功能,但在实际编码过程中感受不是很顺畅,原因在于使用这些api完成功能时,需要考虑很多额外的工作,如token
|
|
4
|
+
[飞书开放平台](https://open.feishu.cn/document/ukTMukTMukTM/uITNz4iM1MjLyUzM)提供了一系列服务端的原子api来实现多元化的功能,但在实际编码过程中感受不是很顺畅,原因在于使用这些api完成功能时,需要考虑很多额外的工作,如token的获取及其维护、数据加解密、请求的验签等等;再者,在实际编码过程中,少了函数调用的语义化描述,类型系统的支持,使得心智负担过重。
|
|
5
5
|
|
|
6
6
|
凡此种种,都使得整体的开发体验不佳,基于此,为了让开放能力变得易用,我们编写了该SDK,将所有冗长的逻辑内置处理,提供完备的类型系统,对外提供语义化的编程接口,提高编码体验。😙
|
|
7
7
|
|
|
@@ -60,7 +60,7 @@ const res = await client.im.message.create({
|
|
|
60
60
|
},
|
|
61
61
|
data: {
|
|
62
62
|
receive_id: 'receive_id',
|
|
63
|
-
content: 'hello world',
|
|
63
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
64
64
|
msg_type: 'text',
|
|
65
65
|
},
|
|
66
66
|
});
|
|
@@ -98,7 +98,7 @@ client.im.message.create({
|
|
|
98
98
|
},
|
|
99
99
|
data: {
|
|
100
100
|
receive_id: 'chat_id',
|
|
101
|
-
content: 'hello world',
|
|
101
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
102
102
|
msg_type: 'text'
|
|
103
103
|
},
|
|
104
104
|
}, lark.withTenantKey('tenant key'));
|
|
@@ -193,7 +193,7 @@ await client.im.message.create({
|
|
|
193
193
|
},
|
|
194
194
|
data: {
|
|
195
195
|
receive_id: 'receive_id',
|
|
196
|
-
content: 'hello world',
|
|
196
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
197
197
|
msg_type: 'text',
|
|
198
198
|
},
|
|
199
199
|
}, {
|
|
@@ -219,7 +219,7 @@ await client.im.message.create({
|
|
|
219
219
|
},
|
|
220
220
|
data: {
|
|
221
221
|
receive_id: 'receive_id',
|
|
222
|
-
content: 'hello world',
|
|
222
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
223
223
|
msg_type: 'text',
|
|
224
224
|
},
|
|
225
225
|
}, lark.withTenantToken('tenant token'));
|
|
@@ -230,7 +230,7 @@ await client.im.message.create({
|
|
|
230
230
|
},
|
|
231
231
|
data: {
|
|
232
232
|
receive_id: 'receive_id',
|
|
233
|
-
content: 'hello world',
|
|
233
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
234
234
|
msg_type: 'text',
|
|
235
235
|
},
|
|
236
236
|
}, lark.withAll([
|
|
@@ -264,7 +264,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
264
264
|
},
|
|
265
265
|
data: {
|
|
266
266
|
receive_id: chatId,
|
|
267
|
-
content: 'hello world',
|
|
267
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
268
268
|
msg_type: 'text'
|
|
269
269
|
},
|
|
270
270
|
});
|
|
@@ -311,7 +311,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
311
311
|
},
|
|
312
312
|
data: {
|
|
313
313
|
receive_id: chatId,
|
|
314
|
-
content: 'hello world',
|
|
314
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
315
315
|
msg_type: 'text'
|
|
316
316
|
},
|
|
317
317
|
});
|
|
@@ -344,7 +344,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
344
344
|
},
|
|
345
345
|
data: {
|
|
346
346
|
receive_id: open_chat_id,
|
|
347
|
-
content: 'hello world',
|
|
347
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
348
348
|
msg_type: 'text'
|
|
349
349
|
},
|
|
350
350
|
});
|
|
@@ -380,7 +380,7 @@ const eventDispatcher = new lark.EventDispatcher({
|
|
|
380
380
|
},
|
|
381
381
|
data: {
|
|
382
382
|
receive_id: open_chat_id,
|
|
383
|
-
content: 'hello world',
|
|
383
|
+
content: JSON.stringify({text: 'hello world'}),
|
|
384
384
|
msg_type: 'text'
|
|
385
385
|
},
|
|
386
386
|
});
|
|
@@ -398,7 +398,7 @@ server.listen(3000);
|
|
|
398
398
|
|
|
399
399
|
```typescript
|
|
400
400
|
const data = server.getData();
|
|
401
|
-
const
|
|
401
|
+
const result = await dispatcher.invoke(data);
|
|
402
402
|
server.sendResult(result);
|
|
403
403
|
```
|
|
404
404
|
|
|
@@ -487,4 +487,4 @@ new lark.AESCipher('encrypt key').decrypt('content');
|
|
|
487
487
|
MIT
|
|
488
488
|
|
|
489
489
|
## 联系我们
|
|
490
|
-
点击[服务端SDK](https://open.feishu.cn/document/ukTMukTMukTM/uETO1YjLxkTN24SM5UjN) 页面右上角【这篇文档是否对你有帮助?】提交反馈😘
|
|
490
|
+
点击[服务端SDK](https://open.feishu.cn/document/ukTMukTMukTM/uETO1YjLxkTN24SM5UjN) 页面右上角【这篇文档是否对你有帮助?】提交反馈😘
|