UNPKG

@larksuiteoapi/node-sdk

Version:
1,198 lines (1,188 loc) 16.3 MB
/** * MIT License * * Copyright (c) 2022 Lark Technologies Pte. Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { AxiosInstance, CustomParamsSerializer, ParamsSerializerOptions, AxiosRequestConfig } from 'axios'; import { Readable } from 'stream'; import fs from 'fs'; declare const defaultHttpInstance: AxiosInstance; interface Cache { set: (key: string | Symbol, value: any, expire?: number, options?: { namespace?: string; }) => Promise<boolean>; get: (key: string | Symbol, options?: { namespace?: string; }) => Promise<any>; } interface Logger { error: (...msg: any[]) => void | Promise<void>; warn: (...msg: any[]) => void | Promise<void>; info: (...msg: any[]) => void | Promise<void>; debug: (...msg: any[]) => void | Promise<void>; trace: (...msg: any[]) => void | Promise<void>; } declare enum AppType { SelfBuild = 0, ISV = 1 } declare enum Domain { Feishu = 0, Lark = 1 } declare enum LoggerLevel { fatal = 0, error = 1, warn = 2, info = 3, debug = 4, trace = 5 } declare const CTenantKey: unique symbol; declare const CAppTicket: unique symbol; declare const CTenantAccessToken: unique symbol; declare const CWithHelpdeskAuthorization: unique symbol; declare const CWithUserAccessToken: unique symbol; interface IRequestOptions$1 { lark?: { [CTenantKey]?: string; [CWithHelpdeskAuthorization]?: boolean; }; params?: Record<string, string>; data?: Record<string, string>; headers?: Record<string, string>; } interface HttpInstance { request<T = any, R = T, D = any>(opts: HttpRequestOptions<D>): Promise<R>; get<T = any, R = T, D = any>(url: string, opts?: HttpRequestOptions<D>): Promise<R>; delete<T = any, R = T, D = any>(url: string, opts?: HttpRequestOptions<D>): Promise<R>; head<T = any, R = T, D = any>(url: string, opts?: HttpRequestOptions<D>): Promise<R>; options<T = any, R = T, D = any>(url: string, opts?: HttpRequestOptions<D>): Promise<R>; post<T = any, R = T, D = any>(url: string, data?: D, opts?: HttpRequestOptions<D>): Promise<R>; put<T = any, R = T, D = any>(url: string, data?: D, opts?: HttpRequestOptions<D>): Promise<R>; patch<T = any, R = T, D = any>(url: string, data?: D, opts?: HttpRequestOptions<D>): Promise<R>; } type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata'; interface HttpRequestOptions<D> { url?: string; method?: string; headers?: Record<string, any>; params?: Record<string, any>; data?: D; responseType?: ResponseType; paramsSerializer?: CustomParamsSerializer | ParamsSerializerOptions; timeout?: number; $return_headers?: boolean; } /** * ClientAssertion (keyless / RFC 7523 `private_key_jwt`) shared module. * * The SDK does NOT generate, parse, sign or store JWTs. A caller-supplied * {@link ClientAssertionProvider} returns a short-lived assertion which the SDK * exchanges at the OAuth token endpoint. This module centralizes the public * types, error classes, OAuth constants and the three pure helpers (aud * extraction, OAuth base-URL resolution, GDPR proxy-URL construction) so they * don't leak into the Symbol-style `consts/index.ts`. */ /** GDPR proxy routing info. When present, requests go through the proxy. */ interface TargetInfo { targetService: string; targetPrefix?: string; } /** What a provider returns: the assertion value plus optional proxy info. */ interface ClientAssertionToken { value: string; targetInfo?: TargetInfo; } /** * Implemented by an external signing service. `aud` is the * target audience host the SDK is about to call. Sync or async. */ interface ClientAssertionProvider { retrieveToken(aud: string): ClientAssertionToken | Promise<ClientAssertionToken>; } /** Errors of the assertion chain itself (codes 7100–7104, TAT exchange). */ declare class ClientAssertionError extends Error { code: number; msg: string; constructor(code: number, msg: string); } /** Non-200 (or token-less) response from the `/oauth/v3/token` endpoint. */ declare class AccessTokenError extends Error { statusCode: number; code: number; error: string; errorDescription: string; constructor(statusCode: number, code: number, error: string, errorDescription: string); } interface IRequestOptions { lark?: { [CTenantKey]?: string; [CWithHelpdeskAuthorization]?: boolean; [CWithUserAccessToken]?: string; }; params?: Record<string, string>; data?: Record<string, string>; headers?: Record<string, string>; path?: Record<string, string>; } interface IClientParams { appId: string; /** * App secret. Optional: provide either `appSecret` or * `clientAssertionProvider` (at least one). When both are set, the * provider takes precedence. */ appSecret?: string; /** * Keyless (ClientAssertion) credential provider. When set, the SDK * exchanges the provider's short-lived assertion for tokens instead of * using `appSecret`. Self-build apps only. */ clientAssertionProvider?: ClientAssertionProvider; /** * OAuth base URL (e.g. `https://accounts.feishu.cn`). Official domains are * auto-derived and may be omitted; custom domains must set this. */ oauthBaseUrl?: string; domain?: Domain | string; loggerLevel?: LoggerLevel; logger?: Logger; cache?: Cache; disableTokenCache?: boolean; appType?: AppType; helpDeskId?: string; helpDeskToken?: string; httpInstance?: HttpInstance; /** Caller tag appended to User-Agent as `source/<name>`. */ source?: string; /** @internal Extra bare tokens appended to User-Agent, set by sub-modules. */ extraUaTags?: string[]; } interface IPayload { params?: Record<string, any>; data?: Record<string, any>; headers?: Record<string, any>; path?: Record<string, any>; } declare abstract class Client$16 { tokenManager: any; domain: any; logger: Logger; httpInstance: HttpInstance; abstract formatPayload(payload?: IPayload, options?: IRequestOptions$1): Promise<Required<IPayload>>; /** * 智能门禁 */ acs: { /** * access_record.access_photo */ accessRecordAccessPhoto: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=access_record.access_photo&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record-access_photo/get document } * * 下载开门时的人脸识别图片 * * 用户在门禁考勤机上成功开门或打卡后,智能门禁应用都会生成一条门禁记录,对于使用人脸识别方式进行开门的识别记录,还会有抓拍图。;;可以用该接口下载开门时的人脸识别照片。 */ get: (payload?: { path?: { access_record_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ writeFile: (filePath: string) => Promise<unknown>; getReadableStream: () => Readable; headers: any; }>; }; /** * 门禁记录 */ accessRecord: { listWithIterator: (payload?: { params: { page_size?: number; page_token?: string; from: number; to: number; device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ [Symbol.asyncIterator](): AsyncGenerator<{ items?: { access_record_id?: string | undefined; user_id?: string | undefined; device_id?: string | undefined; is_clock_in?: boolean | undefined; access_time?: string | undefined; access_type?: "FA" | "QRCode" | "Card" | "Fp" | undefined; access_data?: string | undefined; is_door_open?: boolean | undefined; }[] | undefined; } | null, void, unknown>; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=access_record&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record/list document } * * 获取门禁记录列表 * * 用户在门禁考勤机上成功开门或打卡后,智能门禁应用都会生成一条门禁记录。;;该接口返回满足查询参数的识别记录。 */ list: (payload?: { params: { page_size?: number; page_token?: string; from: number; to: number; device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { access_record_id?: string | undefined; user_id?: string | undefined; device_id?: string | undefined; is_clock_in?: boolean | undefined; access_time?: string | undefined; access_type?: "FA" | "QRCode" | "Card" | "Fp" | undefined; access_data?: string | undefined; is_door_open?: boolean | undefined; }[] | undefined; page_token?: string | undefined; has_more?: boolean | undefined; } | undefined; }>; }; /** * 门禁设备 */ device: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=device&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/device/list document } * * 获取门禁设备列表 * * 使用该接口获取租户内所有门禁设备。 */ list: (payload?: {}, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { device_id?: string | undefined; device_name?: string | undefined; device_sn?: string | undefined; property?: { version?: string | undefined; current_device_face_count?: number | undefined; max_face_capacity?: number | undefined; online_status?: number | undefined; device_name?: string | undefined; is_clock_in?: boolean | undefined; } | undefined; }[] | undefined; } | undefined; }>; }; /** * rule_external */ ruleExternal: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=create&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=acs&resource=rule_external&version=v1 document } */ create: (payload?: { data: { rule: { id?: string; name?: string; devices?: Array<{ id?: string; name?: string; }>; user_count?: string; users?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; visitor_count?: string; visitors?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; remind_face?: boolean; opening_time?: { valid_day?: { start_day: number; end_day: number; }; weekdays?: Array<number>; day_times?: Array<{ start_hhmm: number; end_hhmm: number; }>; }; is_temp?: boolean; }; }; params?: { rule_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { rule_id: string; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=delete&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=acs&resource=rule_external&version=v1 document } */ delete: (payload?: { params: { rule_id: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=device_bind&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=device_bind&project=acs&resource=rule_external&version=v1 document } */ deviceBind: (payload?: { data: { device_id: string; rule_ids: Array<string>; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=acs&resource=rule_external&version=v1 document } */ get: (payload?: { params?: { device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { rules: Array<{ id?: string; name?: string; devices?: Array<{ id?: string; name?: string; }>; user_count?: string; users?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; visitor_count?: string; visitors?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; remind_face?: boolean; opening_time?: { valid_day?: { start_day: number; end_day: number; }; weekdays?: Array<number>; day_times?: Array<{ start_hhmm: number; end_hhmm: number; }>; }; is_temp?: boolean; }>; } | undefined; }>; }; /** * user.face */ userFace: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user.face&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/get document } * * 下载人脸图片 * * 对于已经录入人脸图片的用户,可以使用该接口下载用户人脸图片。 */ get: (payload?: { params?: { is_cropped?: boolean; user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { user_id: string; }; }, options?: IRequestOptions$1) => Promise<{ writeFile: (filePath: string) => Promise<unknown>; getReadableStream: () => Readable; headers: any; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user.face&apiName=update&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/update document } * * 上传人脸图片 * * 用户需要录入人脸图片才可以使用门禁考勤机。使用该 API 上传门禁用户的人脸图片。 */ update: (payload?: { data: { files: Buffer | fs.ReadStream; file_type: string; file_name: string; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { user_id: string; }; }, options?: IRequestOptions$1) => Promise<{} | null>; }; /** * 用户管理 */ user: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/get document } * * 获取单个用户信息 * * 该接口用于获取智能门禁中单个用户的信息。 * * 只能获取已加入智能门禁权限组的用户 */ get: (payload?: { params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path?: { user_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { user?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; } | undefined; } | undefined; }>; listWithIterator: (payload?: { params?: { page_size?: number; page_token?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ [Symbol.asyncIterator](): AsyncGenerator<{ items?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; }[] | undefined; } | null, void, unknown>; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/list document } * * 获取用户列表 * * 使用该接口获取智能门禁中所有用户信息。 * * 只能获取已加入智能门禁权限组的用户。 */ list: (payload?: { params?: { page_size?: number; page_token?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; }[] | undefined; page_token?: string | undefined; has_more?: boolean | undefined; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=patch&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/patch document } * * 修改用户部分信息 * * 飞书智能门禁在人脸识别成功后会有韦根信号输出,输出用户的卡号。;对于使用韦根协议的门禁系统,企业可使用该接口录入用户卡号。 */ patch: (payload?: { data?: { feature?: { card?: number; }; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path?: { user_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; }; /** * visitor */ visitor: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=visitor&apiName=create&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=acs&resource=visitor&version=v1 document } */ create: (payload?: { data: { user: { user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { visitor_id: string; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=visitor&apiName=delete&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=acs&resource=visitor&version=v1 document } */ delete: (payload?: { params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { visitor_id: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; }; v1: { /** * access_record.access_photo */ accessRecordAccessPhoto: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=access_record.access_photo&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record-access_photo/get document } * * 下载开门时的人脸识别图片 * * 用户在门禁考勤机上成功开门或打卡后,智能门禁应用都会生成一条门禁记录,对于使用人脸识别方式进行开门的识别记录,还会有抓拍图。;;可以用该接口下载开门时的人脸识别照片。 */ get: (payload?: { path?: { access_record_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ writeFile: (filePath: string) => Promise<unknown>; getReadableStream: () => Readable; headers: any; }>; }; /** * 门禁记录 */ accessRecord: { listWithIterator: (payload?: { params: { page_size?: number; page_token?: string; from: number; to: number; device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ [Symbol.asyncIterator](): AsyncGenerator<{ items?: { access_record_id?: string | undefined; user_id?: string | undefined; device_id?: string | undefined; is_clock_in?: boolean | undefined; access_time?: string | undefined; access_type?: "FA" | "QRCode" | "Card" | "Fp" | undefined; access_data?: string | undefined; is_door_open?: boolean | undefined; }[] | undefined; } | null, void, unknown>; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=access_record&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record/list document } * * 获取门禁记录列表 * * 用户在门禁考勤机上成功开门或打卡后,智能门禁应用都会生成一条门禁记录。;;该接口返回满足查询参数的识别记录。 */ list: (payload?: { params: { page_size?: number; page_token?: string; from: number; to: number; device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { access_record_id?: string | undefined; user_id?: string | undefined; device_id?: string | undefined; is_clock_in?: boolean | undefined; access_time?: string | undefined; access_type?: "FA" | "QRCode" | "Card" | "Fp" | undefined; access_data?: string | undefined; is_door_open?: boolean | undefined; }[] | undefined; page_token?: string | undefined; has_more?: boolean | undefined; } | undefined; }>; }; /** * 门禁设备 */ device: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=device&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/device/list document } * * 获取门禁设备列表 * * 使用该接口获取租户内所有门禁设备。 */ list: (payload?: {}, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { device_id?: string | undefined; device_name?: string | undefined; device_sn?: string | undefined; property?: { version?: string | undefined; current_device_face_count?: number | undefined; max_face_capacity?: number | undefined; online_status?: number | undefined; device_name?: string | undefined; is_clock_in?: boolean | undefined; } | undefined; }[] | undefined; } | undefined; }>; }; /** * rule_external */ ruleExternal: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=create&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=acs&resource=rule_external&version=v1 document } */ create: (payload?: { data: { rule: { id?: string; name?: string; devices?: Array<{ id?: string; name?: string; }>; user_count?: string; users?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; visitor_count?: string; visitors?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; remind_face?: boolean; opening_time?: { valid_day?: { start_day: number; end_day: number; }; weekdays?: Array<number>; day_times?: Array<{ start_hhmm: number; end_hhmm: number; }>; }; is_temp?: boolean; }; }; params?: { rule_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { rule_id: string; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=delete&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=acs&resource=rule_external&version=v1 document } */ delete: (payload?: { params: { rule_id: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=device_bind&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=device_bind&project=acs&resource=rule_external&version=v1 document } */ deviceBind: (payload?: { data: { device_id: string; rule_ids: Array<string>; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=rule_external&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=acs&resource=rule_external&version=v1 document } */ get: (payload?: { params?: { device_id?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { rules: Array<{ id?: string; name?: string; devices?: Array<{ id?: string; name?: string; }>; user_count?: string; users?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; visitor_count?: string; visitors?: Array<{ user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }>; remind_face?: boolean; opening_time?: { valid_day?: { start_day: number; end_day: number; }; weekdays?: Array<number>; day_times?: Array<{ start_hhmm: number; end_hhmm: number; }>; }; is_temp?: boolean; }>; } | undefined; }>; }; /** * user.face */ userFace: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user.face&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/get document } * * 下载人脸图片 * * 对于已经录入人脸图片的用户,可以使用该接口下载用户人脸图片。 */ get: (payload?: { params?: { is_cropped?: boolean; user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { user_id: string; }; }, options?: IRequestOptions$1) => Promise<{ writeFile: (filePath: string) => Promise<unknown>; getReadableStream: () => Readable; headers: any; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user.face&apiName=update&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user-face/update document } * * 上传人脸图片 * * 用户需要录入人脸图片才可以使用门禁考勤机。使用该 API 上传门禁用户的人脸图片。 */ update: (payload?: { data: { files: Buffer | fs.ReadStream; file_type: string; file_name: string; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { user_id: string; }; }, options?: IRequestOptions$1) => Promise<{} | null>; }; /** * 用户管理 */ user: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=get&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/get document } * * 获取单个用户信息 * * 该接口用于获取智能门禁中单个用户的信息。 * * 只能获取已加入智能门禁权限组的用户 */ get: (payload?: { params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path?: { user_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { user?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; } | undefined; } | undefined; }>; listWithIterator: (payload?: { params?: { page_size?: number; page_token?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ [Symbol.asyncIterator](): AsyncGenerator<{ items?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; }[] | undefined; } | null, void, unknown>; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/list document } * * 获取用户列表 * * 使用该接口获取智能门禁中所有用户信息。 * * 只能获取已加入智能门禁权限组的用户。 */ list: (payload?: { params?: { page_size?: number; page_token?: string; user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { items?: { feature?: { card?: number | undefined; face_uploaded?: boolean | undefined; } | undefined; user_id?: string | undefined; }[] | undefined; page_token?: string | undefined; has_more?: boolean | undefined; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=user&apiName=patch&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/patch document } * * 修改用户部分信息 * * 飞书智能门禁在人脸识别成功后会有韦根信号输出,输出用户的卡号。;对于使用韦根协议的门禁系统,企业可使用该接口录入用户卡号。 */ patch: (payload?: { data?: { feature?: { card?: number; }; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path?: { user_id?: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; }; /** * visitor */ visitor: { /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=visitor&apiName=create&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=acs&resource=visitor&version=v1 document } */ create: (payload?: { data: { user: { user_type: number; user_id?: string; user_name?: string; phone_num?: string; department_id?: string; }; }; params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { visitor_id: string; } | undefined; }>; /** * {@link https://open.feishu.cn/api-explorer?project=acs&resource=visitor&apiName=delete&version=v1 click to debug } * * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=acs&resource=visitor&version=v1 document } */ delete: (payload?: { params?: { user_id_type?: "user_id" | "union_id" | "open_id"; }; path: { visitor_id: string; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: {} | undefined; }>; }; }; }; } declare abstract class Client$15 extends Client$16 { tokenManager: any; domain: any; logger: Logger; httpInstance: HttpInstance; abstract formatPayload(payload?: IPayload, options?: IRequestOptions$1): Promise<Required<IPayload>>; /** * 管理后台-密码 */ admin: { /** * 部门维度的数据报表 */ adminDeptStat: { /** * {@link https://open.feishu.cn/api-explorer?project=admin&resource=admin_dept_stat&apiName=list&version=v1 click to debug } * * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/admin-v1/admin_dept_stat/list document } * * 获取部门维度的用户活跃和功能使用数据 * * 该接口用于获取部门维度的用户活跃和功能使用数据,即IM(即时通讯)、日历、云文档、音视频会议功能的使用数据。 * * - 只有企业自建应用才有权限调用此接口;;- 当天的数据会在第二天的早上九点半产出(UTC+8) */ list: (payload?: { params: { department_id_type: "department_id" | "open_department_id"; start_date: string; end_date: string; department_id: string; contains_child_dept: boolean; page_size?: number; page_token?: string; target_geo?: string; with_product_version?: boolean; }; }, options?: IRequestOptions$1) => Promise<{ code?: number | undefined; msg?: string | undefined; data?: { has_more?: boolean | undefined; page_token?: string | undefined; items?: { date?: string | undefined; department_id?: string | undefined; department_name?: string | undefined; department_path?: string | undefined; total_user_num?: number | undefined; active_user_num?: number | undefined; active_user_rate?: string | undefined; suite_dau?: number | undefined; suite_active_rate?: string | undefined; new_user_num?: number | undefined; new_active_num?: number | undefined; resign_user_num?: number | undefined; im_dau?: number | undefined; send_messenger_user_num?: number | undefined; send_messenger_num?: number | undefined; avg_send_messenger_num?: string | undefined; doc