@satorijs/adapter-lark 3.8.6 → 3.9.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/lib/bot.d.ts +1 -1
- package/lib/content.d.ts +433 -0
- package/lib/http.d.ts +1 -1
- package/lib/index.cjs +2792 -1719
- package/lib/index.d.ts +4 -2
- package/lib/internal.d.ts +37 -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 +4391 -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 +1053 -0
- package/lib/types/ehr.d.ts +32 -0
- package/lib/types/event.d.ts +9 -18
- package/lib/types/helpdesk.d.ts +746 -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/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/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 +143 -0
- package/src/message.ts +13 -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 +5297 -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 +1321 -0
- package/src/types/ehr.ts +43 -0
- package/src/types/event.ts +15 -21
- package/src/types/helpdesk.ts +925 -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 -30848
- package/src/types/internal.ts +0 -84
- package/src/types/message/index.ts +0 -97
package/src/internal.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
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 type Paginated<T = any, ItemsKey extends string = 'items'> =
|
|
14
|
+
& Promise<
|
|
15
|
+
& { [K in ItemsKey]: T[] }
|
|
16
|
+
& { page_token?: string; has_more: boolean }
|
|
17
|
+
>
|
|
18
|
+
& AsyncIterableIterator<T>
|
|
19
|
+
|
|
20
|
+
export interface Pagination {
|
|
21
|
+
page_size?: number
|
|
22
|
+
page_token?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface InternalRoute {
|
|
26
|
+
name: string
|
|
27
|
+
pagination?: {
|
|
28
|
+
argIndex: number
|
|
29
|
+
itemsKey?: string
|
|
30
|
+
tokenKey?: string
|
|
31
|
+
}
|
|
32
|
+
multipart?: boolean
|
|
33
|
+
type?: 'raw-json' | 'binary'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class Internal {
|
|
37
|
+
constructor(private bot: LarkBot) {}
|
|
38
|
+
|
|
39
|
+
private _assertResponse(response: HTTP.Response<BaseResponse>) {
|
|
40
|
+
if (!response.data.code) return
|
|
41
|
+
this.bot.logger.debug('response: %o', response.data)
|
|
42
|
+
const error = new HTTP.Error(`request failed`)
|
|
43
|
+
error.response = response
|
|
44
|
+
throw error
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private _buildData(arg: object, options: InternalRoute) {
|
|
48
|
+
if (options.multipart) {
|
|
49
|
+
const form = new FormData()
|
|
50
|
+
for (const [key, value] of Object.entries(arg)) {
|
|
51
|
+
if (value instanceof File) {
|
|
52
|
+
form.append(key, value, value.name)
|
|
53
|
+
} else {
|
|
54
|
+
form.append(key, value)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return form
|
|
58
|
+
} else {
|
|
59
|
+
return arg
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static define(routes: Dict<Partial<Record<HTTP.Method, string | InternalRoute>>>) {
|
|
64
|
+
for (const path in routes) {
|
|
65
|
+
for (const key in routes[path]) {
|
|
66
|
+
const method = key as HTTP.Method
|
|
67
|
+
for (let route of makeArray(routes[path][method])) {
|
|
68
|
+
if (typeof route === 'string') {
|
|
69
|
+
route = { name: route }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const impl = async function (this: Internal, ...args: any[]) {
|
|
73
|
+
const raw = args.join(', ')
|
|
74
|
+
const url = path.replace(/\{([^}]+)\}/g, () => {
|
|
75
|
+
if (!args.length) throw new Error(`too few arguments for ${path}, received ${raw}`)
|
|
76
|
+
return args.shift()
|
|
77
|
+
})
|
|
78
|
+
const config: HTTP.RequestConfig = {}
|
|
79
|
+
if (args.length === 1) {
|
|
80
|
+
if (method === 'GET' || method === 'DELETE') {
|
|
81
|
+
config.params = args[0]
|
|
82
|
+
} else {
|
|
83
|
+
config.data = this._buildData(args[0], route)
|
|
84
|
+
}
|
|
85
|
+
} else if (args.length === 2 && method !== 'GET' && method !== 'DELETE') {
|
|
86
|
+
config.data = this._buildData(args[0], route)
|
|
87
|
+
config.params = args[1]
|
|
88
|
+
} else if (args.length > 1) {
|
|
89
|
+
throw new Error(`too many arguments for ${path}, received ${raw}`)
|
|
90
|
+
}
|
|
91
|
+
if (route.type === 'binary') {
|
|
92
|
+
config.responseType = 'arraybuffer'
|
|
93
|
+
}
|
|
94
|
+
const response = await this.bot.http(method, url, config)
|
|
95
|
+
this._assertResponse(response)
|
|
96
|
+
if (route.type === 'raw-json' || route.type === 'binary') {
|
|
97
|
+
return response.data
|
|
98
|
+
} else {
|
|
99
|
+
return response.data.data
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
Internal.prototype[route.name] = function (this: Internal, ...args: any[]) {
|
|
104
|
+
let promise: Promise<any> | undefined
|
|
105
|
+
const result = {} as Paginated
|
|
106
|
+
for (const key of ['then', 'catch', 'finally']) {
|
|
107
|
+
result[key] = (...args2: any[]) => {
|
|
108
|
+
return (promise ??= impl.apply(this, args))[key](...args2)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (route.pagination) {
|
|
113
|
+
const { argIndex, itemsKey = 'items', tokenKey = 'page_token' } = route.pagination
|
|
114
|
+
const iterArgs = [...args]
|
|
115
|
+
iterArgs[argIndex] = { ...args[argIndex] }
|
|
116
|
+
let pagination: { data: any[]; next?: any } | undefined
|
|
117
|
+
result.next = async function () {
|
|
118
|
+
pagination ??= await this[Symbol.for('satori.pagination')]()
|
|
119
|
+
if (pagination.data.length) return { done: false, value: pagination.data.shift() }
|
|
120
|
+
if (!pagination.next) return { done: true, value: undefined }
|
|
121
|
+
pagination = await this[Symbol.for('satori.pagination')]()
|
|
122
|
+
return this.next()
|
|
123
|
+
}
|
|
124
|
+
result[Symbol.asyncIterator] = function () {
|
|
125
|
+
return this
|
|
126
|
+
}
|
|
127
|
+
result[Symbol.for('satori.pagination')] = async () => {
|
|
128
|
+
const data = await impl.apply(this, iterArgs)
|
|
129
|
+
iterArgs[argIndex].page_token = data[tokenKey]
|
|
130
|
+
return {
|
|
131
|
+
data: data[itemsKey],
|
|
132
|
+
next: data.has_more ? iterArgs : undefined,
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return result
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
package/src/message.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Context, Dict, h, MessageEncoder } from '@satorijs/core'
|
|
2
2
|
import { LarkBot } from './bot'
|
|
3
|
-
import { CreateImFileForm,
|
|
4
|
-
import { extractIdType } from './utils'
|
|
3
|
+
import { CreateImFileForm, Message } from './types'
|
|
4
|
+
import { EventPayload, extractIdType } from './utils'
|
|
5
|
+
import { MessageContent } from './content'
|
|
5
6
|
|
|
6
7
|
export class LarkMessageEncoder<C extends Context = Context> extends MessageEncoder<C, LarkBot<C>> {
|
|
8
|
+
declare referrer?: EventPayload
|
|
9
|
+
|
|
7
10
|
private quote: Dict | undefined
|
|
8
11
|
private textContent = ''
|
|
9
12
|
private richContent: MessageContent.RichText.Paragraph[] = []
|
|
@@ -15,21 +18,20 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
|
|
|
15
18
|
|
|
16
19
|
async post(data?: any) {
|
|
17
20
|
try {
|
|
18
|
-
let resp:
|
|
21
|
+
let resp: Message
|
|
19
22
|
let quote = this.quote
|
|
20
|
-
if (!quote) {
|
|
21
|
-
|
|
22
|
-
if (payload?.type === 'im.message.receive_v1' && payload.event.message.thread_id) {
|
|
23
|
+
if (!quote && this.referrer) {
|
|
24
|
+
if (this.referrer.type === 'im.message.receive_v1' && this.referrer.event.message.thread_id) {
|
|
23
25
|
quote = {
|
|
24
|
-
id:
|
|
26
|
+
id: this.referrer.event.message.message_id,
|
|
25
27
|
replyInThread: true,
|
|
26
28
|
}
|
|
27
|
-
} else if (
|
|
29
|
+
} else if (this.referrer.type === 'card.action.trigger') {
|
|
28
30
|
// cannot determine whether the card is in thread or not
|
|
29
|
-
const { items: [message] } = await this.bot.internal.getImMessage(
|
|
31
|
+
const { items: [message] } = await this.bot.internal.getImMessage(this.referrer.event.context.open_message_id)
|
|
30
32
|
if (message?.thread_id) {
|
|
31
33
|
quote = {
|
|
32
|
-
id:
|
|
34
|
+
id: this.referrer.event.context.open_message_id,
|
|
33
35
|
replyInThread: true,
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -156,7 +158,7 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
|
|
|
156
158
|
} else {
|
|
157
159
|
const ext = filename.split('.').pop()
|
|
158
160
|
if (['doc', 'xls', 'ppt', 'pdf'].includes(ext)) {
|
|
159
|
-
file_type = ext
|
|
161
|
+
file_type = ext as any
|
|
160
162
|
} else {
|
|
161
163
|
file_type = 'stream'
|
|
162
164
|
}
|
package/src/types/acs.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { AccessRecord, Device, Feature, Rule, User, UserExternal } from '.'
|
|
2
|
+
import { Internal, Pagination } from '../internal'
|
|
3
|
+
|
|
4
|
+
declare module '../internal' {
|
|
5
|
+
interface Internal {
|
|
6
|
+
/**
|
|
7
|
+
* 修改用户部分信息
|
|
8
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/patch
|
|
9
|
+
*/
|
|
10
|
+
patchAcsUser(user_id: string, body: PatchAcsUserRequest, query?: PatchAcsUserQuery): Promise<void>
|
|
11
|
+
/**
|
|
12
|
+
* 获取单个用户信息
|
|
13
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/get
|
|
14
|
+
*/
|
|
15
|
+
getAcsUser(user_id: string, query?: GetAcsUserQuery): Promise<GetAcsUserResponse>
|
|
16
|
+
/**
|
|
17
|
+
* 获取用户列表
|
|
18
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/list
|
|
19
|
+
*/
|
|
20
|
+
listAcsUser(query?: ListAcsUserQuery): Paginated<User>
|
|
21
|
+
/**
|
|
22
|
+
* 上传人脸图片
|
|
23
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/update
|
|
24
|
+
*/
|
|
25
|
+
updateAcsUserFace(user_id: string, form: UpdateAcsUserFaceForm, query?: UpdateAcsUserFaceQuery): Promise<void>
|
|
26
|
+
/**
|
|
27
|
+
* 下载人脸图片
|
|
28
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/get
|
|
29
|
+
*/
|
|
30
|
+
getAcsUserFace(user_id: string, query?: GetAcsUserFaceQuery): Promise<ArrayBuffer>
|
|
31
|
+
/**
|
|
32
|
+
* 设备绑定权限组
|
|
33
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/rule_external/device_bind
|
|
34
|
+
*/
|
|
35
|
+
deviceBindAcsRuleExternal(body: DeviceBindAcsRuleExternalRequest): Promise<void>
|
|
36
|
+
/**
|
|
37
|
+
* 获取权限组信息
|
|
38
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/rule_external/get
|
|
39
|
+
*/
|
|
40
|
+
getAcsRuleExternal(query?: GetAcsRuleExternalQuery): Promise<GetAcsRuleExternalResponse>
|
|
41
|
+
/**
|
|
42
|
+
* 删除权限组
|
|
43
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/rule_external/delete
|
|
44
|
+
*/
|
|
45
|
+
deleteAcsRuleExternal(query?: DeleteAcsRuleExternalQuery): Promise<void>
|
|
46
|
+
/**
|
|
47
|
+
* 创建或更新权限组
|
|
48
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/rule_external/create
|
|
49
|
+
*/
|
|
50
|
+
createAcsRuleExternal(body: CreateAcsRuleExternalRequest, query?: CreateAcsRuleExternalQuery): Promise<CreateAcsRuleExternalResponse>
|
|
51
|
+
/**
|
|
52
|
+
* 删除访客
|
|
53
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/visitor/delete
|
|
54
|
+
*/
|
|
55
|
+
deleteAcsVisitor(visitor_id: string, query?: DeleteAcsVisitorQuery): Promise<void>
|
|
56
|
+
/**
|
|
57
|
+
* 添加访客
|
|
58
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/visitor/create
|
|
59
|
+
*/
|
|
60
|
+
createAcsVisitor(body: CreateAcsVisitorRequest, query?: CreateAcsVisitorQuery): Promise<CreateAcsVisitorResponse>
|
|
61
|
+
/**
|
|
62
|
+
* 获取门禁设备列表
|
|
63
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/device/list
|
|
64
|
+
*/
|
|
65
|
+
listAcsDevice(): Promise<ListAcsDeviceResponse>
|
|
66
|
+
/**
|
|
67
|
+
* 获取门禁记录列表
|
|
68
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record/list
|
|
69
|
+
*/
|
|
70
|
+
listAcsAccessRecord(query?: ListAcsAccessRecordQuery): Paginated<AccessRecord>
|
|
71
|
+
/**
|
|
72
|
+
* 下载开门时的人脸识别图片
|
|
73
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record-access_photo/get
|
|
74
|
+
*/
|
|
75
|
+
getAcsAccessRecordAccessPhoto(access_record_id: string): Promise<ArrayBuffer>
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PatchAcsUserRequest {
|
|
80
|
+
/** 用户特征 */
|
|
81
|
+
feature?: Feature
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PatchAcsUserQuery {
|
|
85
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
86
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface GetAcsUserQuery {
|
|
90
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
91
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ListAcsUserQuery extends Pagination {
|
|
95
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
96
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface UpdateAcsUserFaceForm {
|
|
100
|
+
/** 人脸图片内容 */
|
|
101
|
+
files: Blob
|
|
102
|
+
/** 文件类型,可选的类型有jpg,png */
|
|
103
|
+
file_type: string
|
|
104
|
+
/** 带后缀的文件名 */
|
|
105
|
+
file_name: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface UpdateAcsUserFaceQuery {
|
|
109
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
110
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface GetAcsUserFaceQuery {
|
|
114
|
+
/** 裁剪图 */
|
|
115
|
+
is_cropped?: boolean
|
|
116
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
117
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface DeviceBindAcsRuleExternalRequest {
|
|
121
|
+
/** 设备id */
|
|
122
|
+
device_id: string
|
|
123
|
+
/** 权限组id列表 */
|
|
124
|
+
rule_ids: string[]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface GetAcsRuleExternalQuery {
|
|
128
|
+
/** 设备id */
|
|
129
|
+
device_id?: string
|
|
130
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
131
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface DeleteAcsRuleExternalQuery {
|
|
135
|
+
/** 权限组id */
|
|
136
|
+
rule_id: string
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface CreateAcsRuleExternalRequest {
|
|
140
|
+
/** 权限组信息 */
|
|
141
|
+
rule: Rule
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CreateAcsRuleExternalQuery {
|
|
145
|
+
/** 权限组id-为空创建,不为空则更新 */
|
|
146
|
+
rule_id?: string
|
|
147
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
148
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface DeleteAcsVisitorQuery {
|
|
152
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
153
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface CreateAcsVisitorRequest {
|
|
157
|
+
/** 访客信息 */
|
|
158
|
+
user: UserExternal
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface CreateAcsVisitorQuery {
|
|
162
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
163
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ListAcsAccessRecordQuery extends Pagination {
|
|
167
|
+
/** 记录开始时间,单位秒 */
|
|
168
|
+
from: number
|
|
169
|
+
/** 记录结束时间,单位秒,时间跨度不能超过30天 */
|
|
170
|
+
to: number
|
|
171
|
+
/** 门禁设备 ID */
|
|
172
|
+
device_id?: string
|
|
173
|
+
/** 此次调用中使用的用户ID的类型 */
|
|
174
|
+
user_id_type?: 'user_id' | 'union_id' | 'open_id'
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface GetAcsUserResponse {
|
|
178
|
+
/** 门禁用户信息 */
|
|
179
|
+
user?: User
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface GetAcsRuleExternalResponse {
|
|
183
|
+
/** 设备权限组信息 */
|
|
184
|
+
rules: Rule[]
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface CreateAcsRuleExternalResponse {
|
|
188
|
+
/** 权限组id */
|
|
189
|
+
rule_id: string
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface CreateAcsVisitorResponse {
|
|
193
|
+
/** 访客的id */
|
|
194
|
+
visitor_id: string
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface ListAcsDeviceResponse {
|
|
198
|
+
items?: Device[]
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
Internal.define({
|
|
202
|
+
'/acs/v1/users/{user_id}': {
|
|
203
|
+
PATCH: 'patchAcsUser',
|
|
204
|
+
GET: 'getAcsUser',
|
|
205
|
+
},
|
|
206
|
+
'/acs/v1/users': {
|
|
207
|
+
GET: { name: 'listAcsUser', pagination: { argIndex: 0 } },
|
|
208
|
+
},
|
|
209
|
+
'/acs/v1/users/{user_id}/face': {
|
|
210
|
+
PUT: { name: 'updateAcsUserFace', multipart: true },
|
|
211
|
+
GET: { name: 'getAcsUserFace', type: 'binary' },
|
|
212
|
+
},
|
|
213
|
+
'/acs/v1/rule_external/device_bind': {
|
|
214
|
+
POST: 'deviceBindAcsRuleExternal',
|
|
215
|
+
},
|
|
216
|
+
'/acs/v1/rule_external': {
|
|
217
|
+
GET: 'getAcsRuleExternal',
|
|
218
|
+
DELETE: 'deleteAcsRuleExternal',
|
|
219
|
+
POST: 'createAcsRuleExternal',
|
|
220
|
+
},
|
|
221
|
+
'/acs/v1/visitors/{visitor_id}': {
|
|
222
|
+
DELETE: 'deleteAcsVisitor',
|
|
223
|
+
},
|
|
224
|
+
'/acs/v1/visitors': {
|
|
225
|
+
POST: 'createAcsVisitor',
|
|
226
|
+
},
|
|
227
|
+
'/acs/v1/devices': {
|
|
228
|
+
GET: 'listAcsDevice',
|
|
229
|
+
},
|
|
230
|
+
'/acs/v1/access_records': {
|
|
231
|
+
GET: { name: 'listAcsAccessRecord', pagination: { argIndex: 0 } },
|
|
232
|
+
},
|
|
233
|
+
'/acs/v1/access_records/{access_record_id}/access_photo': {
|
|
234
|
+
GET: { name: 'getAcsAccessRecordAccessPhoto', type: 'binary' },
|
|
235
|
+
},
|
|
236
|
+
})
|