From ae058ac3bacedd869deb446af4f0318008a48d3f Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Sat, 23 Dec 2023 05:10:47 +0000 Subject: [PATCH] feat(lark): add more api, correct function name (#210) --- adapters/lark/src/bot.ts | 2 +- adapters/lark/src/types/message/index.ts | 17 +++++++++++++++++ adapters/lark/src/types/user.ts | 4 ++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/adapters/lark/src/bot.ts b/adapters/lark/src/bot.ts index d80579ac..e9431ae7 100644 --- a/adapters/lark/src/bot.ts +++ b/adapters/lark/src/bot.ts @@ -87,7 +87,7 @@ export class LarkBot extends Bot } async getUser(userId: string, guildId?: string) { - const data = await this.internal.getUserInfo(userId) + const data = await this.internal.getContactUser(userId) return Utils.decodeUser(data.data) } diff --git a/adapters/lark/src/types/message/index.ts b/adapters/lark/src/types/message/index.ts index 08c8a23e..47d841fe 100644 --- a/adapters/lark/src/types/message/index.ts +++ b/adapters/lark/src/types/message/index.ts @@ -205,6 +205,17 @@ declare module '../internal' { getMessage(message_id: string): Promise /** @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/delete */ deleteMessage(message_id: string): Promise + /** @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/forward */ + forwardMessage( + message_id: string, + receive_id_type: Lark.ReceiveIdType, + data: { receive_id: string }, + ): Promise + /** @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/merge_forward */ + mergeForwardMessage( + receive_id_type: Lark.ReceiveIdType, + data: { receive_id: string; message_id_list: string[] }, + ): Promise /** @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/read_users */ getMessageReadUsers(message_id: string, params: Pagination<{ user_id_type: Lark.UserIdType }>): Promise }> /** @see https://open.larksuite.com/document/server-docs/im-v1/message/list */ @@ -230,4 +241,10 @@ Internal.define({ '/im/v1/messages/{message_id}/read_users': { GET: 'getMessageReadUsers', }, + '/im/v1/messages/{message_id}/forward?receive_id_type={receive_id_type}': { + POST: 'forwardMessage', + }, + '/im/v1/messages/merge_forward?receive_id_type={receive_id_type}': { + POST: 'mergeForwardMessage', + }, }) diff --git a/adapters/lark/src/types/user.ts b/adapters/lark/src/types/user.ts index f6a46e3f..915c1c93 100644 --- a/adapters/lark/src/types/user.ts +++ b/adapters/lark/src/types/user.ts @@ -80,12 +80,12 @@ export interface GuildMember { declare module './internal' { export interface Internal { /** @see https://open.larksuite.com/document/server-docs/contact-v3/user/get */ - getUserInfo(user_id: string, user_id_type?: Lark.UserIdType, department_id_type?: Lark.DepartmentIdType): Promise + getContactUser(user_id: string, user_id_type?: Lark.UserIdType, department_id_type?: Lark.DepartmentIdType): Promise } } Internal.define({ 'contact/v3/users/{user_id}': { - GET: 'getUserInfo', + GET: 'getContactUser', }, })