2026-04-21 22:07:29 +08:00
|
|
|
export type ChatType = 'SINGLE' | 'GROUP'
|
|
|
|
|
|
|
|
|
|
export type MsgType =
|
|
|
|
|
| 'TEXT'
|
|
|
|
|
| 'IMAGE'
|
|
|
|
|
| 'VIDEO'
|
|
|
|
|
| 'AUDIO'
|
|
|
|
|
| 'FILE'
|
|
|
|
|
| 'CUSTOM'
|
|
|
|
|
| 'LOCATION'
|
|
|
|
|
| 'NOTIFY'
|
2026-04-24 10:42:11 +08:00
|
|
|
| 'RICH_TEXT'
|
|
|
|
|
| 'CALL_AUDIO'
|
|
|
|
|
| 'CALL_VIDEO'
|
2026-04-21 22:07:29 +08:00
|
|
|
| 'REVOKED'
|
|
|
|
|
| 'FORWARD'
|
|
|
|
|
|
|
|
|
|
export type MsgStatus = 'SENT' | 'DELIVERED' | 'READ' | 'REVOKED'
|
|
|
|
|
|
|
|
|
|
export interface ImMessage {
|
|
|
|
|
id: string
|
|
|
|
|
appId: string
|
|
|
|
|
fromUserId: string
|
|
|
|
|
toId: string
|
|
|
|
|
chatType: ChatType
|
|
|
|
|
msgType: MsgType
|
|
|
|
|
content: string
|
|
|
|
|
status: MsgStatus
|
|
|
|
|
mentionedUserIds?: string
|
|
|
|
|
createdAt: string
|
2026-04-29 00:37:10 +08:00
|
|
|
editedAt?: string | null
|
2026-04-21 22:07:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ImEventListener {
|
|
|
|
|
onConnected?: () => void
|
|
|
|
|
onDisconnected?: (reason?: string) => void
|
|
|
|
|
onMessage?: (msg: ImMessage) => void
|
|
|
|
|
onGroupMessage?: (msg: ImMessage) => void
|
|
|
|
|
onError?: (error: string) => void
|
|
|
|
|
}
|
2026-04-24 10:42:11 +08:00
|
|
|
|
|
|
|
|
export interface SendMessageParams {
|
|
|
|
|
toId: string
|
|
|
|
|
chatType: ChatType
|
|
|
|
|
msgType: MsgType
|
|
|
|
|
content: string
|
|
|
|
|
mentionedUserIds?: string
|
|
|
|
|
}
|
2026-04-24 11:14:41 +08:00
|
|
|
|
|
|
|
|
export interface ImGroup {
|
|
|
|
|
id: string
|
|
|
|
|
appId: string
|
|
|
|
|
name: string
|
|
|
|
|
creatorId: string
|
|
|
|
|
memberIds: string
|
|
|
|
|
adminIds: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
}
|