Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lark): add more api, correct function name #210

Merged
merged 2 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adapters/lark/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class LarkBot<C extends Context = Context> extends Bot<C, LarkBot.Config>
}

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)
}

Expand Down
17 changes: 17 additions & 0 deletions adapters/lark/src/types/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@
getMessage(message_id: string): Promise<BaseResponse & { data: Message }>
/** @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/delete */
deleteMessage(message_id: string): Promise<BaseResponse>
/** @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<BaseResponse & { data: Message }>
/** @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[] },

Check failure on line 217 in adapters/lark/src/types/message/index.ts

View workflow job for this annotation

GitHub Actions / lint

Expected a semicolon

Check failure on line 217 in adapters/lark/src/types/message/index.ts

View workflow job for this annotation

GitHub Actions / lint

Expected a semicolon
MaikoTan marked this conversation as resolved.
Show resolved Hide resolved
): Promise<BaseResponse & { data: { message: Message, invalid_message_id_list: string[] }}>

Check failure on line 218 in adapters/lark/src/types/message/index.ts

View workflow job for this annotation

GitHub Actions / lint

Expected a semicolon

Check failure on line 218 in adapters/lark/src/types/message/index.ts

View workflow job for this annotation

GitHub Actions / lint

Expected a semicolon
MaikoTan marked this conversation as resolved.
Show resolved Hide resolved
/** @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<BaseResponse & { data: Paginated<ReadUser> }>
/** @see https://open.larksuite.com/document/server-docs/im-v1/message/list */
Expand All @@ -230,4 +241,10 @@
'/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',
},
})
4 changes: 2 additions & 2 deletions adapters/lark/src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<BaseResponse & { data: Lark.User }>
getContactUser(user_id: string, user_id_type?: Lark.UserIdType, department_id_type?: Lark.DepartmentIdType): Promise<BaseResponse & { data: Lark.User }>
}
}

Internal.define({
'contact/v3/users/{user_id}': {
GET: 'getUserInfo',
GET: 'getContactUser',
},
})
Loading