refactor(api): move 3 friend methods to FriendApi (#6 commit 7/13)

Inlines `actions/friend.ts` into `apis/friend.ts::FriendApi`. The
roster READ side (fetchFriendList) stays on ContactsApi where it
naturally lives next to fetchGroupList — the friend/group rosters
share the same pipeline.

Method renaming (Api namespace already says "friend"):

  setFriendAddRequest → handleRequest    (accept/reject UID-or-flag)
  deleteFriend        → delete           (with cache refresh)
  setFriendRemark     → setRemark

`delete` still does the post-OIDB best-effort
`apis.contacts.fetchFriendList()` refresh to evict the stale entry.

Callers updated: `instance-context.ts`, `actions/extended.ts`.
Tests rewritten to use `new FriendApi(bridge as any).method(...)`.

587/587 tests pass.
This commit is contained in:
DrSmoothl committed 2026-05-20 23:20:33 +08:00
1 parent 73f1cd3c80
commit 2ec72d59f9
8 files changed
+97 -80

No files matched your search

+2 -4
View File
@@ -46,10 +46,8 @@ export interface BridgeInterface {
// ─── Group admin (moved to apis.groupAdmin) ───
// ─── Group reaction / essence (moved to apis.interaction) ───
// ─── Friend ───
setFriendAddRequest(uidOrFlag: string, approve: boolean): Promise<void>;
deleteFriend(userId: number, block?: boolean): Promise<void>;
setFriendRemark(userId: number, remark: string): Promise<void>;
// ─── Friend (moved to apis.friend) ───
// - handleRequest / delete / setRemark
// ─── Files (moved to apis.groupFile) ───
// - upload / uploadPrivate / publish