XuqmGroup-Vue3SDK/src/types/index.ts

146 行
2.8 KiB
TypeScript

2026-04-21 22:07:29 +08:00
export interface SDKConfig {
appKey: string
appSecret: string
debug?: boolean
baseUrl?: string
wsUrl?: string
2026-04-21 22:07:29 +08:00
}
export type MsgType =
| 'TEXT'
| 'IMAGE'
| 'VIDEO'
| 'AUDIO'
| 'FILE'
| 'CUSTOM'
| 'LOCATION'
| 'NOTIFY'
| 'RICH_TEXT'
| 'CALL_AUDIO'
| 'CALL_VIDEO'
| 'REVOKED'
| 'FORWARD'
export type ChatType = 'SINGLE' | 'GROUP'
export type MsgStatus = 'SENDING' | 'SENT' | 'DELIVERED' | 'READ' | 'FAILED' | 'REVOKED'
2026-04-21 22:07:29 +08:00
export interface ImMessage {
id: string
appId: string
fromUserId: string
fromId?: string
2026-04-21 22:07:29 +08:00
toId: string
chatType: ChatType
msgType: MsgType
content: string
status: MsgStatus
mentionedUserIds?: string
groupReadCount?: number
revoked?: boolean
2026-04-21 22:07:29 +08:00
createdAt: string
}
export interface ConversationView {
targetId: string
chatType: ChatType
lastMsgContent?: string | null
lastMsgType?: string | null
lastMsgTime: number
unreadCount: number
isMuted: boolean
isPinned: boolean
}
export interface PageResult<T> {
content: T[]
totalElements: number
totalPages: number
size: number
number: number
numberOfElements: number
first: boolean
last: boolean
empty: boolean
}
export interface HistoryQuery {
msgType?: MsgType
keyword?: string
startTime?: string | Date
endTime?: string | Date
page?: number
size?: number
}
export interface UserProfile {
id?: string
appId?: string
userId: string
nickname?: string | null
avatar?: string | null
gender?: string | null
status?: string | null
createdAt?: string | number | null
}
export interface ImGroup {
id: string
appId?: string
name: string
groupType?: string
creatorId: string
memberIds: string
adminIds: string
announcement?: string | null
createdAt?: string | number | null
}
export interface FriendRequest {
id: string
appId?: string
fromUserId: string
toUserId: string
remark?: string | null
status: 'PENDING' | 'ACCEPTED' | 'REJECTED'
createdAt: string | number
reviewedAt?: string | number | null
}
export interface GroupJoinRequest {
id: string
appId?: string
groupId: string
requesterId: string
remark?: string | null
status: 'PENDING' | 'ACCEPTED' | 'REJECTED'
createdAt: string | number
reviewedAt?: string | number | null
}
2026-04-21 22:07:29 +08:00
export interface SendMessageParams {
messageId?: string
2026-04-21 22:07:29 +08:00
toId: string
chatType: ChatType
msgType: MsgType
content: string
extra?: string
mentionedUserIds?: string
2026-04-21 22:07:29 +08:00
}
export interface ImEventMap {
message: (msg: ImMessage) => void
read: (msg: ImMessage) => void
2026-04-21 22:07:29 +08:00
revoke: (data: { msgId: string; operatorId: string }) => void
connected: () => void
disconnected: (code: number, reason: string) => void
error: (err: Event) => void
}
export interface ApiResponse<T> {
code: number
status: string
data: T
message: string
}