141 lines
2.5 KiB
TypeScript
141 lines
2.5 KiB
TypeScript
|
|
// 联系人数据接口
|
||
|
|
export interface ContactData {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
phone: string;
|
||
|
|
avatar?: string;
|
||
|
|
online: boolean;
|
||
|
|
lastSeen?: string;
|
||
|
|
status?: string;
|
||
|
|
department?: string;
|
||
|
|
position?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 消息类型枚举
|
||
|
|
export enum MessageType {
|
||
|
|
TEXT = "text",
|
||
|
|
IMAGE = "image",
|
||
|
|
VOICE = "voice",
|
||
|
|
VIDEO = "video",
|
||
|
|
FILE = "file",
|
||
|
|
LOCATION = "location",
|
||
|
|
}
|
||
|
|
|
||
|
|
// 消息数据接口
|
||
|
|
export interface MessageData {
|
||
|
|
id: string;
|
||
|
|
senderId: string;
|
||
|
|
senderName: string;
|
||
|
|
content: string;
|
||
|
|
type: MessageType;
|
||
|
|
timestamp: string;
|
||
|
|
isRead: boolean;
|
||
|
|
replyTo?: string;
|
||
|
|
forwardFrom?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 聊天会话类型
|
||
|
|
export type ChatType = "private" | "group";
|
||
|
|
|
||
|
|
// 聊天会话接口
|
||
|
|
export interface ChatSession {
|
||
|
|
id: string;
|
||
|
|
type: ChatType;
|
||
|
|
name: string;
|
||
|
|
avatar?: string;
|
||
|
|
lastMessage: string;
|
||
|
|
lastTime: string;
|
||
|
|
unreadCount: number;
|
||
|
|
online: boolean;
|
||
|
|
members?: string[];
|
||
|
|
pinned?: boolean;
|
||
|
|
muted?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 群组信息接口
|
||
|
|
export interface GroupData {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
avatar?: string;
|
||
|
|
description?: string;
|
||
|
|
members: ContactData[];
|
||
|
|
adminIds: string[];
|
||
|
|
createdAt: string;
|
||
|
|
updatedAt: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 聊天历史响应接口
|
||
|
|
export interface ChatHistoryResponse {
|
||
|
|
messages: MessageData[];
|
||
|
|
hasMore: boolean;
|
||
|
|
total: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 发送消息请求接口
|
||
|
|
export interface SendMessageRequest {
|
||
|
|
chatId: string;
|
||
|
|
content: string;
|
||
|
|
type: MessageType;
|
||
|
|
replyTo?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 联系人列表响应接口
|
||
|
|
export interface ContactListResponse {
|
||
|
|
contacts: ContactData[];
|
||
|
|
total: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 搜索联系人请求接口
|
||
|
|
export interface SearchContactRequest {
|
||
|
|
keyword: string;
|
||
|
|
limit?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 在线状态接口
|
||
|
|
export interface OnlineStatus {
|
||
|
|
userId: string;
|
||
|
|
online: boolean;
|
||
|
|
lastSeen: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 消息状态接口
|
||
|
|
export interface MessageStatus {
|
||
|
|
messageId: string;
|
||
|
|
status: "sending" | "sent" | "delivered" | "read" | "failed";
|
||
|
|
timestamp: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 文件上传响应接口
|
||
|
|
export interface FileUploadResponse {
|
||
|
|
url: string;
|
||
|
|
filename: string;
|
||
|
|
size: number;
|
||
|
|
type: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 表情包接口
|
||
|
|
export interface EmojiData {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
url: string;
|
||
|
|
category: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 快捷回复接口
|
||
|
|
export interface QuickReply {
|
||
|
|
id: string;
|
||
|
|
content: string;
|
||
|
|
category: string;
|
||
|
|
useCount: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 聊天设置接口
|
||
|
|
export interface ChatSettings {
|
||
|
|
autoReply: boolean;
|
||
|
|
autoReplyMessage: string;
|
||
|
|
notification: boolean;
|
||
|
|
sound: boolean;
|
||
|
|
theme: "light" | "dark";
|
||
|
|
fontSize: "small" | "medium" | "large";
|
||
|
|
}
|