@satorijs/adapter-lark 3.8.5 → 3.9.0
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/lib/bot.d.ts +1 -1
- package/lib/content.d.ts +433 -0
- package/lib/http.d.ts +1 -1
- package/lib/index.cjs +2796 -1713
- package/lib/index.cjs.map +6 -0
- package/lib/index.d.ts +4 -2
- package/lib/internal.d.ts +38 -0
- package/lib/message.d.ts +2 -0
- package/lib/types/acs.d.ts +177 -0
- package/lib/types/admin.d.ts +270 -0
- package/lib/types/aily.d.ts +221 -0
- package/lib/types/apaas.d.ts +499 -0
- package/lib/types/application.d.ts +406 -0
- package/lib/types/approval.d.ts +779 -0
- package/lib/types/attendance.d.ts +957 -0
- package/lib/types/auth.d.ts +86 -0
- package/lib/types/authen.d.ts +191 -0
- package/lib/types/baike.d.ts +239 -0
- package/lib/types/bitable.d.ts +691 -0
- package/lib/types/board.d.ts +19 -0
- package/lib/types/calendar.d.ts +653 -0
- package/lib/types/cardkit.d.ts +139 -0
- package/lib/types/compensation.d.ts +54 -0
- package/lib/types/contact.d.ts +1137 -0
- package/lib/types/corehr.d.ts +4383 -0
- package/lib/types/docs.d.ts +23 -0
- package/lib/types/document_ai.d.ts +257 -0
- package/lib/types/docx.d.ts +380 -0
- package/lib/types/drive.d.ts +1045 -0
- package/lib/types/ehr.d.ts +32 -0
- package/lib/types/event.d.ts +9 -18
- package/lib/types/guild.d.ts +59 -0
- package/lib/types/helpdesk.d.ts +738 -0
- package/lib/types/hire.d.ts +3150 -0
- package/lib/types/human_authentication.d.ts +27 -0
- package/lib/types/im.d.ts +1300 -0
- package/lib/types/index.d.ts +16432 -34
- package/lib/types/lingo.d.ts +254 -0
- package/lib/types/mail.d.ts +680 -0
- package/lib/types/mdm.d.ts +42 -0
- package/lib/types/message/asset.d.ts +40 -0
- package/lib/types/minutes.d.ts +31 -0
- package/lib/types/moments.d.ts +18 -0
- package/lib/types/okr.d.ts +205 -0
- package/lib/types/optical_char_recognition.d.ts +17 -0
- package/lib/types/passport.d.ts +45 -0
- package/lib/types/payroll.d.ts +50 -0
- package/lib/types/performance.d.ts +413 -0
- package/lib/types/personal_settings.d.ts +87 -0
- package/lib/types/report.d.ts +57 -0
- package/lib/types/search.d.ts +216 -0
- package/lib/types/security_and_compliance.d.ts +24 -0
- package/lib/types/sheets.d.ts +326 -0
- package/lib/types/speech_to_text.d.ts +39 -0
- package/lib/types/task.d.ts +1153 -0
- package/lib/types/tenant.d.ts +23 -0
- package/lib/types/translation.d.ts +37 -0
- package/lib/types/user.d.ts +78 -0
- package/lib/types/utils.d.ts +9 -0
- package/lib/types/vc.d.ts +948 -0
- package/lib/types/verification.d.ts +14 -0
- package/lib/types/wiki.d.ts +240 -0
- package/lib/types/workplace.d.ts +43 -0
- package/lib/utils.d.ts +143 -7
- package/package.json +6 -4
- package/src/bot.ts +19 -3
- package/src/{types/message/content.ts → content.ts} +1 -0
- package/src/http.ts +1 -3
- package/src/index.ts +4 -2
- package/src/internal.ts +144 -0
- package/src/message.ts +24 -11
- package/src/types/acs.ts +236 -0
- package/src/types/admin.ts +328 -0
- package/src/types/aily.ts +288 -0
- package/src/types/apaas.ts +646 -0
- package/src/types/application.ts +520 -0
- package/src/types/approval.ts +924 -0
- package/src/types/attendance.ts +1153 -0
- package/src/types/auth.ts +114 -0
- package/src/types/authen.ts +220 -0
- package/src/types/baike.ts +306 -0
- package/src/types/bitable.ts +879 -0
- package/src/types/board.ts +31 -0
- package/src/types/calendar.ts +817 -0
- package/src/types/cardkit.ts +182 -0
- package/src/types/compensation.ts +79 -0
- package/src/types/contact.ts +1411 -0
- package/src/types/corehr.ts +5288 -0
- package/src/types/docs.ts +33 -0
- package/src/types/document_ai.ts +352 -0
- package/src/types/docx.ts +471 -0
- package/src/types/drive.ts +1312 -0
- package/src/types/ehr.ts +43 -0
- package/src/types/event.ts +15 -21
- package/src/types/helpdesk.ts +916 -0
- package/src/types/hire.ts +3918 -0
- package/src/types/human_authentication.ts +38 -0
- package/src/types/im.ts +1605 -0
- package/src/types/index.ts +17754 -39
- package/src/types/lingo.ts +321 -0
- package/src/types/mail.ts +851 -0
- package/src/types/mdm.ts +57 -0
- package/src/types/minutes.ts +46 -0
- package/src/types/moments.ts +28 -0
- package/src/types/okr.ts +261 -0
- package/src/types/optical_char_recognition.ts +27 -0
- package/src/types/passport.ts +61 -0
- package/src/types/payroll.ts +69 -0
- package/src/types/performance.ts +524 -0
- package/src/types/personal_settings.ts +116 -0
- package/src/types/report.ts +77 -0
- package/src/types/search.ts +268 -0
- package/src/types/security_and_compliance.ts +33 -0
- package/src/types/sheets.ts +425 -0
- package/src/types/speech_to_text.ts +54 -0
- package/src/types/task.ts +1464 -0
- package/src/types/tenant.ts +36 -0
- package/src/types/translation.ts +52 -0
- package/src/types/vc.ts +1197 -0
- package/src/types/verification.ts +23 -0
- package/src/types/wiki.ts +313 -0
- package/src/types/workplace.ts +59 -0
- package/src/utils.ts +160 -8
- package/src/types/api.ts +0 -30835
- package/src/types/internal.ts +0 -84
- package/src/types/message/index.ts +0 -97
package/src/types/internal.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Dict, HTTP, makeArray } from '@satorijs/core'
|
|
2
|
-
import { LarkBot } from '../bot'
|
|
3
|
-
|
|
4
|
-
export interface Internal {}
|
|
5
|
-
|
|
6
|
-
export interface BaseResponse {
|
|
7
|
-
/** error code. would be 0 if success, and non-0 if failed. */
|
|
8
|
-
code: number
|
|
9
|
-
/** error message. would be 'success' if success. */
|
|
10
|
-
msg: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface InternalConfig {
|
|
14
|
-
multipart?: boolean
|
|
15
|
-
type?: 'json-body' | 'binary'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Internal {
|
|
19
|
-
constructor(private bot: LarkBot) {}
|
|
20
|
-
|
|
21
|
-
private _assertResponse(response: HTTP.Response<BaseResponse>) {
|
|
22
|
-
if (!response.data.code) return
|
|
23
|
-
this.bot.logger.debug('response: %o', response.data)
|
|
24
|
-
const error = new HTTP.Error(`request failed`)
|
|
25
|
-
error.response = response
|
|
26
|
-
throw error
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private _buildData(arg: object, options: InternalConfig) {
|
|
30
|
-
if (options.multipart) {
|
|
31
|
-
const form = new FormData()
|
|
32
|
-
for (const [key, value] of Object.entries(arg)) {
|
|
33
|
-
if (value instanceof File) {
|
|
34
|
-
form.append(key, value, value.name)
|
|
35
|
-
} else {
|
|
36
|
-
form.append(key, value)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return form
|
|
40
|
-
} else {
|
|
41
|
-
return arg
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static define(routes: Dict<Partial<Record<HTTP.Method, string | string[]>>>, options: InternalConfig = {}) {
|
|
46
|
-
for (const path in routes) {
|
|
47
|
-
for (const key in routes[path]) {
|
|
48
|
-
const method = key as HTTP.Method
|
|
49
|
-
for (const name of makeArray(routes[path][method])) {
|
|
50
|
-
Internal.prototype[name] = async function (this: Internal, ...args: any[]) {
|
|
51
|
-
const raw = args.join(', ')
|
|
52
|
-
const url = path.replace(/\{([^}]+)\}/g, () => {
|
|
53
|
-
if (!args.length) throw new Error(`too few arguments for ${path}, received ${raw}`)
|
|
54
|
-
return args.shift()
|
|
55
|
-
})
|
|
56
|
-
const config: HTTP.RequestConfig = {}
|
|
57
|
-
if (args.length === 1) {
|
|
58
|
-
if (method === 'GET' || method === 'DELETE') {
|
|
59
|
-
config.params = args[0]
|
|
60
|
-
} else {
|
|
61
|
-
config.data = this._buildData(args[0], options)
|
|
62
|
-
}
|
|
63
|
-
} else if (args.length === 2 && method !== 'GET' && method !== 'DELETE') {
|
|
64
|
-
config.data = this._buildData(args[0], options)
|
|
65
|
-
config.params = args[1]
|
|
66
|
-
} else if (args.length > 1) {
|
|
67
|
-
throw new Error(`too many arguments for ${path}, received ${raw}`)
|
|
68
|
-
}
|
|
69
|
-
if (options.type === 'binary') {
|
|
70
|
-
config.responseType = 'arraybuffer'
|
|
71
|
-
}
|
|
72
|
-
const response = await this.bot.http(method, url, config)
|
|
73
|
-
this._assertResponse(response)
|
|
74
|
-
if (options.type === 'json-body' || options.type === 'binary') {
|
|
75
|
-
return response.data
|
|
76
|
-
} else {
|
|
77
|
-
return response.data.data
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Lark, MessageContent } from '..'
|
|
2
|
-
|
|
3
|
-
export * from './content'
|
|
4
|
-
|
|
5
|
-
declare module '../event' {
|
|
6
|
-
export interface Events {
|
|
7
|
-
/**
|
|
8
|
-
* Receive message event.
|
|
9
|
-
* @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/receive
|
|
10
|
-
*/
|
|
11
|
-
'im.message.receive_v1': {
|
|
12
|
-
sender: {
|
|
13
|
-
sender_id: Lark.UserIds
|
|
14
|
-
sender_type?: string
|
|
15
|
-
tenant_key: string
|
|
16
|
-
}
|
|
17
|
-
message: {
|
|
18
|
-
message_id: string
|
|
19
|
-
root_id: string
|
|
20
|
-
parent_id: string
|
|
21
|
-
thread_id: string
|
|
22
|
-
create_time: string
|
|
23
|
-
chat_id: string
|
|
24
|
-
chat_type: string
|
|
25
|
-
message_type: keyof MessageContent
|
|
26
|
-
content: string
|
|
27
|
-
mentions: {
|
|
28
|
-
key: string
|
|
29
|
-
id: Lark.UserIds
|
|
30
|
-
name: string
|
|
31
|
-
tenant_key: string
|
|
32
|
-
}[]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Message read event.
|
|
37
|
-
* @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/message_read
|
|
38
|
-
*/
|
|
39
|
-
'im.message.message_read_v1': {
|
|
40
|
-
reader: {
|
|
41
|
-
reader_id: Lark.UserIds
|
|
42
|
-
read_time: string
|
|
43
|
-
tenant_key: string
|
|
44
|
-
}
|
|
45
|
-
message_id_list: string[]
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Message card callback event.
|
|
49
|
-
* @see https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication
|
|
50
|
-
*/
|
|
51
|
-
'card.action.trigger': {
|
|
52
|
-
operator: {
|
|
53
|
-
tenant_key: string
|
|
54
|
-
user_id: string
|
|
55
|
-
union_id: string
|
|
56
|
-
open_id: string
|
|
57
|
-
}
|
|
58
|
-
token: string
|
|
59
|
-
action: {
|
|
60
|
-
value: any
|
|
61
|
-
tag: string
|
|
62
|
-
timezone?: string
|
|
63
|
-
name?: string
|
|
64
|
-
form_value?: any
|
|
65
|
-
input_value?: string
|
|
66
|
-
option?: string
|
|
67
|
-
options?: string[]
|
|
68
|
-
checked?: boolean
|
|
69
|
-
}
|
|
70
|
-
host: string
|
|
71
|
-
/** 卡片分发类型,固定取值为 url_preview,表示链接预览卡片。仅链接预览卡片有此字段。 */
|
|
72
|
-
delivery_type?: 'url_preview'
|
|
73
|
-
context: {
|
|
74
|
-
url?: string
|
|
75
|
-
preview_token?: string
|
|
76
|
-
open_message_id: string
|
|
77
|
-
open_chat_id: string
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* 机器人自定义菜单事件
|
|
82
|
-
* @see https://open.feishu.cn/document/client-docs/bot-v3/events/menu
|
|
83
|
-
*/
|
|
84
|
-
'application.bot.menu_v6': {
|
|
85
|
-
operator: {
|
|
86
|
-
operator_name: string
|
|
87
|
-
operator_id: {
|
|
88
|
-
union_id: string
|
|
89
|
-
user_id: string
|
|
90
|
-
open_id: string
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
event_key: string
|
|
94
|
-
timestamp: number
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|