60 行
1.0 KiB
TypeScript
60 行
1.0 KiB
TypeScript
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'
|
|
|
|
export interface ImMessage {
|
|
id: string
|
|
fromId: string
|
|
toId: string
|
|
chatType: ChatType
|
|
msgType: MsgType
|
|
content: string
|
|
extra?: string
|
|
revoked: boolean
|
|
createdAt: string
|
|
}
|
|
|
|
export interface SendMessageParams {
|
|
toId: string
|
|
chatType: ChatType
|
|
msgType: MsgType
|
|
content: string
|
|
extra?: string
|
|
}
|
|
|
|
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
|
|
}
|