refactor(api): move 10 profile methods to ProfileApi (#6 commit 8/13)

Inlines `actions/profile.ts` into `apis/profile.ts::ProfileApi`. The
file covers personal profile (nickname / long-nick / personal note),
online status (regular + DIY with custom face/wording), avatars
(personal + group via highway), input-status, likes (received from
others), unidirectional friend list, and custom face roaming.

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

  getProfileLike → getLike    (only obvious shortening; rest keep
                               their `set*`/`fetch*` prefixes because
                               they're already minimal at the call
                               site under `apis.profile.X`)

Callers updated: `instance-context.ts`, `actions/group-admin.ts`,
`actions/extended.ts`. The extended-actions test gained a sizable
`APIS_ROUTING` block covering profile/interaction/friend (all of the
late-stage Api hubs need auto-promotion now), so legacy tests that
stub `setDiyOnlineStatus`/`setOnlineStatus`/`deleteFriend`/etc as flat
methods keep working.

Tests rewritten to use `new ProfileApi(bridge as any).method(...)`.

587/587 tests pass.
This commit is contained in:
DrSmoothl committed 2026-05-20 23:26:35 +08:00
1 parent 2ec72d59f9
commit 62c5590fe1
10 files changed
+335 -381

No files matched your search

+5
View File
@@ -28,6 +28,7 @@ import { GroupAlbumApi } from './group-album';
import { GroupFileApi } from './group-file';
import { InteractionApi } from './interaction';
import { MessageApi } from './message';
import { ProfileApi } from './profile';
export interface ApiHub {
/** Send/recall/markRead operations across c2c + group + c2c-file. */
@@ -44,6 +45,8 @@ export interface ApiHub {
readonly interaction: InteractionApi;
/** Friend roster mutations: handleRequest / delete / setRemark. */
readonly friend: FriendApi;
/** Personal profile: status / avatar / nickname / likes / custom-faces. */
readonly profile: ProfileApi;
// Pending — added as later commits land:
// readonly interaction: InteractionApi;
// readonly profile: ProfileApi;
@@ -70,6 +73,7 @@ export function buildApiHub(ctx: BridgeContext): ApiHub {
groupAlbum: new GroupAlbumApi(ctx),
interaction: new InteractionApi(ctx),
friend: new FriendApi(ctx),
profile: new ProfileApi(ctx),
};
}
@@ -83,3 +87,4 @@ export { GroupAlbumApi } from './group-album';
export { GroupFileApi } from './group-file';
export { InteractionApi } from './interaction';
export { MessageApi } from './message';
export { ProfileApi } from './profile';