refactor(api): move interaction methods to InteractionApi (#6 commit 6/13)
Folds the entire `actions/interaction.ts` (sendPoke / sendLike / setGroupReaction / getEmojiLikes) plus the lone-survivor `setGroupEssence` from `actions/group-message.ts` into `apis/interaction.ts::InteractionApi`. Both action files deleted — the recall + markRead halves of group-message were already absorbed into MessageApi back in commit 1. Skipping the planned standalone GroupMessageApi commit: with only one method left (`setGroupEssence`), giving it its own Api class would be pure overhead. Essence is conceptually an "interaction" anyway (mark a message as essence is parallel to "react with an emoji"). Method renaming (Api namespace already says "interaction"): sendPoke → sendPoke (no rename — already minimal) sendLike → sendLike setGroupReaction → setReaction setGroupEssence → setEssence getEmojiLikes → getEmojiLikes (no rename — read-side, fine) Callers updated: `instance-context.ts`, `modules/message-actions.ts`, `actions/extended.ts`. Tests `interaction.test.ts` rewritten to use `new InteractionApi(bridge as any).method(...)` and gained a `setEssence` test. `group-message.test.ts` rewritten to target MessageApi.recall* / markRead* methods that were already moved. 587/587 tests pass.
This commit is contained in:
1 parent
c92daa56df
commit
73f1cd3c80
11 files changed
+155
-221
No files matched your search
@@ -44,8 +44,7 @@ export interface BridgeInterface {
|
||||
// ─── Fetch (contacts / profile / system) — moved to apis.contacts ───
|
||||
|
||||
// ─── Group admin (moved to apis.groupAdmin) ───
|
||||
setGroupReaction(groupId: number, sequence: number, code: string, isSet: boolean): Promise<void>;
|
||||
setGroupEssence(groupId: number, sequence: number, random: number, enable: boolean): Promise<void>;
|
||||
// ─── Group reaction / essence (moved to apis.interaction) ───
|
||||
|
||||
// ─── Friend ───
|
||||
setFriendAddRequest(uidOrFlag: string, approve: boolean): Promise<void>;
|
||||
@@ -71,10 +70,8 @@ export interface BridgeInterface {
|
||||
|
||||
// ─── Message ops (moved to apis.message) ───
|
||||
|
||||
// ─── Interaction ───
|
||||
sendPoke(isGroup: boolean, peerUin: number, targetUin?: number): Promise<void>;
|
||||
sendLike(userId: number, count: number): Promise<void>;
|
||||
getEmojiLikes(groupId: number, sequence: number, emojiId: string, emojiType?: number, count?: number, cookie?: string): Promise<{ users: Array<{ uin: number }>; cookie: string; isLast: boolean }>;
|
||||
// ─── Interaction (moved to apis.interaction) ───
|
||||
// - sendPoke / sendLike / setReaction / setEssence / getEmojiLikes
|
||||
|
||||
// ─── Web-backed ───
|
||||
getGroupHonorInfo(groupId: number, type: WebHonorType | string): Promise<any>;
|
||||
|
||||
Reference in new issue
Block a user