diff --git a/tenant-platform/src/api/im.ts b/tenant-platform/src/api/im.ts index 050346f..3fa724d 100644 --- a/tenant-platform/src/api/im.ts +++ b/tenant-platform/src/api/im.ts @@ -40,6 +40,17 @@ export interface ImUser { createdAt: number } +export interface ImProfile { + id?: string + appId?: string + userId: string + nickname?: string | null + avatar?: string | null + gender?: 'UNKNOWN' | 'MALE' | 'FEMALE' | string | null + status?: 'ACTIVE' | 'BANNED' | string | null + createdAt?: number | null +} + export interface ImGroup { id: string appId: string @@ -162,4 +173,26 @@ export const imAdminApi = { { params: { appId, keyword, size } }, ) }, + + getProfile(appId: string, userId: string) { + return imClient.get<{ data: ImProfile }>( + `/api/im/accounts/${encodeURIComponent(userId)}`, + { params: { appId } }, + ) + }, + + updateProfile(appId: string, userId: string, nickname?: string, avatar?: string, gender?: string) { + return imClient.put<{ data: ImProfile }>( + `/api/im/accounts/${encodeURIComponent(userId)}`, + {}, + { + params: { + appId, + ...(nickname ? { nickname } : {}), + ...(avatar ? { avatar } : {}), + ...(gender ? { gender } : {}), + }, + }, + ) + }, }