2026-04-21 22:07:29 +08:00
|
|
|
export interface SDKConfig {
|
|
|
|
|
appKey: string
|
|
|
|
|
appSecret: string
|
|
|
|
|
apiBaseUrl: string
|
|
|
|
|
imBaseUrl: string
|
|
|
|
|
debug?: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type MsgType =
|
|
|
|
|
| 'TEXT'
|
|
|
|
|
| 'IMAGE'
|
|
|
|
|
| 'VIDEO'
|
|
|
|
|
| 'AUDIO'
|
|
|
|
|
| 'FILE'
|
|
|
|
|
| 'CUSTOM'
|
|
|
|
|
| 'LOCATION'
|
|
|
|
|
| 'NOTIFY'
|
|
|
|
|
| 'RICH_TEXT'
|
|
|
|
|
| 'CALL_AUDIO'
|
|
|
|
|
| 'CALL_VIDEO'
|
|
|
|
|
| 'REVOKED'
|
|
|
|
|
| 'FORWARD'
|
|
|
|
|
|
|
|
|
|
export type ChatType = 'SINGLE' | 'GROUP'
|
|
|
|
|
|
2026-04-28 16:55:12 +08:00
|
|
|
export type MsgStatus = 'SENDING' | 'SENT' | 'DELIVERED' | 'READ' | 'FAILED' | 'REVOKED'
|
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
export interface ImMessage {
|
|
|
|
|
id: string
|
2026-04-28 16:55:12 +08:00
|
|
|
appId: string
|
|
|
|
|
fromUserId: string
|
|
|
|
|
fromId?: string
|
2026-04-21 22:07:29 +08:00
|
|
|
toId: string
|
|
|
|
|
chatType: ChatType
|
|
|
|
|
msgType: MsgType
|
|
|
|
|
content: string
|
2026-04-28 16:55:12 +08:00
|
|
|
status: MsgStatus
|
|
|
|
|
mentionedUserIds?: string
|
|
|
|
|
groupReadCount?: number
|
|
|
|
|
revoked?: boolean
|
2026-04-21 22:07:29 +08:00
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:55:12 +08:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
export interface SendMessageParams {
|
2026-04-28 16:55:12 +08:00
|
|
|
messageId?: string
|
2026-04-21 22:07:29 +08:00
|
|
|
toId: string
|
|
|
|
|
chatType: ChatType
|
|
|
|
|
msgType: MsgType
|
|
|
|
|
content: string
|
|
|
|
|
extra?: string
|
2026-04-28 16:55:12 +08:00
|
|
|
mentionedUserIds?: string
|
2026-04-21 22:07:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ImEventMap {
|
|
|
|
|
message: (msg: ImMessage) => void
|
|
|
|
|
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
|
|
|
|
|
}
|