feat: Optimize comments and field names.

This commit is contained in:
std-s
2023-10-12 15:01:38 +08:00
parent cc6d164985
commit 627ee54a67
40 changed files with 1126 additions and 1753 deletions

View File

@@ -3,66 +3,67 @@ import 'dart:convert';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class ConversationInfo {
/// 会话ID
// Unique identifier for the conversation
String conversationID;
/// 会话类型[ConversationType]
// Type of the conversation (e.g., single, group, super group)
int? conversationType;
/// 参与会话的userID
// User ID in case of a single chat
String? userID;
/// 参与会话的groupID
// Group ID in case of a group chat
String? groupID;
/// 昵称
// Display name or nickname
String? showName;
/// 头像
// URL of the user's or group's profile picture
String? faceURL;
/// 免打扰 0正常1不接受消息2接受在线消息不接受离线消息
// Message reception option (0: normal, 1: do not accept messages, 2: accept online messages but not offline messages)
int? recvMsgOpt;
/// 未读消息数
// Number of unread messages in the conversation
int? unreadCount;
/// 强制提示,[GroupAtType]包含@所有人,@个人以及公告提示
int? groupAtType;
/// 会话最新消息内容
// Latest message in the conversation
Message? latestMsg;
/// 最新消息发送时间
// Timestamp of the latest message
int? latestMsgSendTime;
/// 草稿
// Draft text for the conversation
String? draftText;
/// 草稿生成时间
// Timestamp when the draft text was created
int? draftTextTime;
/// 是否置顶
// Indicates whether the conversation is pinned
bool? isPinned;
/// 是否开启了私聊(阅后即焚)
// Indicates whether the conversation is a private chat with features like self-destructing messages
bool? isPrivateChat;
/// 可阅读期限 s
// Duration for which messages are readable (in seconds)
int? burnDuration;
/// 是否开启定期销毁
// Indicates whether the conversation has self-destructing messages enabled
bool? isMsgDestruct;
/// 定期销毁时间 s
// Timestamp for self-destructing messages (in seconds)
int? msgDestructTime;
/// 附加内容
// Additional data or metadata
String? ex;
/// 是否还在组内如果退群返回true
// Indicates whether the user is no longer in the group (if applicable)
bool? isNotInGroup;
// Group @ type, which includes @ all, @ individual, and announcement prompts
int? groupAtType;
// Constructor to create a ConversationInfo object
ConversationInfo({
required this.conversationID,
this.conversationType,
@@ -115,6 +116,7 @@ class ConversationInfo {
msgDestructTime = json['msgDestructTime'];
}
// Method to convert the ConversationInfo object to a JSON map
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['conversationID'] = this.conversationID;
@@ -140,16 +142,16 @@ class ConversationInfo {
return data;
}
/// 是单聊
// Check if it's a single chat
bool get isSingleChat => conversationType == ConversationType.single;
/// 是群聊
// Check if it's a group chat
bool get isGroupChat =>
conversationType == ConversationType.group ||
conversationType == ConversationType.superGroup;
/// 是有效的
bool get isValid => isSingleChat || isGroupChat && !isNotInGroup!;
// Check if it's a valid conversation (not in a group if isNotInGroup is true)
bool get isValid => isSingleChat || (isGroupChat && !isNotInGroup!);
@override
bool operator ==(Object other) =>

View File

@@ -1,56 +1,56 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 群信息
/// Group Information
class GroupInfo {
/// ID
/// Group ID
String groupID;
/// 群名
/// Group Name
String? groupName;
/// 群公告
/// Group Announcement
String? notification;
/// 群简介
/// Group Introduction
String? introduction;
/// 群头像
/// Group Avatar
String? faceURL;
/// 拥有者ID
/// Owner's ID
String? ownerUserID;
/// 创建时间
/// Creation Time
int? createTime;
/// 群成员数
/// Number of Group Members
int? memberCount;
/// 群状态0正常1被封2解散3禁言
/// Group Status: 0 - Normal, 1 - Blocked, 2 - Dissolved, 3 - Muted
int? status;
/// 创建者ID
/// Creator's ID
String? creatorUserID;
/// 群类型[GroupType]
/// Group Type [GroupType]
int? groupType;
/// 扩展字段
/// Extra Information
String? ex;
/// 进群验证方式[GroupVerification]
/// Entry Verification Method [GroupVerification]
int? needVerification;
/// 不允许通过群获取成员资料 0关闭1打开
/// Don't Allow Access to Member Information via the Group: 0 - Disabled, 1 - Enabled
int? lookMemberInfo;
/// 不允许通过群添加好友 0关闭1打开
/// Don't Allow Adding Friends via the Group: 0 - Disabled, 1 - Enabled
int? applyMemberFriend;
/// 通知更新时间
/// Notification Update Time
int? notificationUpdateTime;
/// 通知发起人
/// Notification Initiator
String? notificationUserID;
GroupInfo({
@@ -74,7 +74,6 @@ class GroupInfo {
});
GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] {
/*groupID = json['groupID'];*/
groupName = json['groupName'];
notification = json['notification'];
introduction = json['introduction'];
@@ -115,7 +114,7 @@ class GroupInfo {
return data;
}
/// 群类型对应的会话类型
/// Corresponding Conversation Type for Group Type
int get sessionType => groupType == GroupType.general
? ConversationType.group
: ConversationType.superGroup;
@@ -131,42 +130,42 @@ class GroupInfo {
int get hashCode => groupID.hashCode;
}
/// 群成员信息
/// Group Member Information
class GroupMembersInfo {
/// 群id
/// Group ID
String? groupID;
/// 用户id
/// User ID
String? userID;
/// 昵称
/// Nickname
String? nickname;
/// 头像
/// Avatar
String? faceURL;
/// 角色[GroupRoleLevel]
/// Role [GroupRoleLevel]
int? roleLevel;
/// 加入时间
/// Join Time
int? joinTime;
/// 入群方式 2邀请加入 3搜索加入 4通过二维码加入
/// Entry Source: 2 - Invited, 3 - Searched, 4 - QR Code
int? joinSource;
/// 操作者id
/// Operator's ID
String? operatorUserID;
/// 扩展字段
/// Extra Information
String? ex;
/// 禁言时间s
/// Mute End Time (seconds)
int? muteEndTime;
///
int? appMangerLevel;
/// Application Manager Level
int? appManagerLevel;
/// 邀请人id
/// Inviter's User ID
String? inviterUserID;
GroupMembersInfo({
@@ -180,7 +179,7 @@ class GroupMembersInfo {
this.joinSource,
this.operatorUserID,
this.muteEndTime,
this.appMangerLevel,
this.appManagerLevel,
this.inviterUserID,
});
@@ -195,7 +194,7 @@ class GroupMembersInfo {
joinSource = json['joinSource'];
operatorUserID = json['operatorUserID'];
muteEndTime = json['muteEndTime'];
appMangerLevel = json['appMangerLevel'];
appManagerLevel = json['appManagerLevel'];
inviterUserID = json['inviterUserID'];
}
@@ -211,7 +210,7 @@ class GroupMembersInfo {
data['joinSource'] = this.joinSource;
data['operatorUserID'] = this.operatorUserID;
data['muteEndTime'] = this.muteEndTime;
data['appMangerLevel'] = this.appMangerLevel;
data['appManagerLevel'] = this.appManagerLevel;
data['inviterUserID'] = this.inviterUserID;
return data;
}
@@ -228,12 +227,12 @@ class GroupMembersInfo {
int get hashCode => groupID.hashCode ^ userID.hashCode;
}
/// 群成员角色
/// Group Member Role
class GroupMemberRole {
/// 用户ID
/// User ID
String? userID;
/// [GroupRoleLevel] 1普通成员, 2群主3管理员
/// [GroupRoleLevel] 1: Normal Member, 2: Group Owner, 3: Administrator
int? roleLevel;
GroupMemberRole({this.userID, this.roleLevel = 1});
@@ -251,78 +250,78 @@ class GroupMemberRole {
}
}
/// 群申请信息
/// Group Application Information
class GroupApplicationInfo {
/// ID
/// Group ID
String? groupID;
/// 群昵称
/// Group Nickname
String? groupName;
/// 群公告
/// Group Announcement
String? notification;
/// 群介绍
/// Group Introduction
String? introduction;
/// 群头像
/// Group Avatar
String? groupFaceURL;
/// 群创建时间
/// Group Creation Time
int? createTime;
/// 群状态
/// Group Status
int? status;
/// 创建者id
/// Creator's ID
String? creatorUserID;
/// 群类型
/// Group Type
int? groupType;
/// 拥有者id
/// Owner's ID
String? ownerUserID;
/// 成员数量
/// Member Count
int? memberCount;
/// 发起入群申请的用户id
/// User ID Initiating the Group Join Request
String? userID;
/// 发起入群申请的用户昵称
/// User's Nickname Initiating the Group Join Request
String? nickname;
/// 发起入群申请的用户头像
/// User's Avatar Initiating the Group Join Request
String? userFaceURL;
/// 发起入群申请的用户性别
/// User's Gender Initiating the Group Join Request
int? gender;
/// 处理结果:-1拒绝1同意
/// Handling Result: -1 - Rejected, 1 - Accepted
int? handleResult;
/// 请求说明
/// Request Description
String? reqMsg;
/// 处理结果说明
/// Handling Result Description
String? handledMsg;
/// 请求时间
/// Request Time
int? reqTime;
/// 处理者用户ID
/// Handler User ID
String? handleUserID;
/// 处理时间
/// Handling Time
int? handledTime;
/// 扩展信息
/// Extra Information
String? ex;
/// 2通过邀请 3通过搜索 4通过二维码
/// Join Source: 2 - Invited, 3 - Searched, 4 - QR Code
int? joinSource;
/// 邀请进群用户ID
/// Inviting User's ID
String? inviterUserID;
GroupApplicationInfo({
@@ -409,6 +408,7 @@ class GroupApplicationInfo {
}
}
/// Group Invitation Result
class GroupInviteResult {
String? userID;
int? result;

View File

@@ -1,155 +0,0 @@
class MeetingInfoList {
List<MeetingInfo>? meetingInfoList;
MeetingInfoList({this.meetingInfoList});
MeetingInfoList.fromJson(Map<String, dynamic> json) {
if (json['meetingInfoList'] != null) {
meetingInfoList = <MeetingInfo>[];
json['meetingInfoList'].forEach((v) {
meetingInfoList!.add(MeetingInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.meetingInfoList != null) {
data['meetingInfoList'] =
this.meetingInfoList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class MeetingInfo {
String? roomID;
String? meetingName;
String? ex;
String? hostUserID;
List<String>? inviteeUserIDList; //邀请列表
int? createTime;
int? startTime;
int? endTime;
bool? participantCanUnmuteSelf; //成员是否能自己解除禁言
bool? participantCanEnableVideo; //成员是否能开启视频
bool? onlyHostInviteUser; //仅主持人可邀请用户
bool? onlyHostShareScreen; //仅主持人可共享屏幕
bool? joinDisableMicrophone; //加入是否默认关麦克风
bool? joinDisableVideo; //加入是否默认关视频
bool? isMuteAllVideo; // 是否全员禁用视频
bool? isMuteAllMicrophone; // 是否全员禁用麦克风
List<String>? canScreenUserIDList; // 可共享屏幕的ID列表
List<String>? disableMicrophoneUserIDList; // 当前被禁言麦克风的id列表
List<String>? disableVideoUserIDList; // 当前禁用视频流的ID列表
List<String>? pinedUserIDList; // 置顶ID列表
List<String>? beWatchedUserIDList; // 正在被观看用户列表
MeetingInfo({
this.roomID,
this.meetingName,
this.ex,
this.hostUserID,
this.inviteeUserIDList,
this.createTime,
this.startTime,
this.endTime,
this.participantCanUnmuteSelf,
this.participantCanEnableVideo,
this.onlyHostInviteUser,
this.onlyHostShareScreen,
this.joinDisableMicrophone,
this.joinDisableVideo,
this.isMuteAllVideo,
this.isMuteAllMicrophone,
this.canScreenUserIDList,
this.disableMicrophoneUserIDList,
this.disableVideoUserIDList,
this.pinedUserIDList,
this.beWatchedUserIDList,
});
MeetingInfo.fromJson(Map<String, dynamic> json) {
roomID = json['roomID'];
meetingName = json['meetingName'];
ex = json['ex'];
hostUserID = json['hostUserID'];
inviteeUserIDList = json['inviteeUserIDList'] == null
? null
: (json['inviteeUserIDList'] as List).cast<String>();
createTime = json['createTime'];
startTime = json['startTime'];
endTime = json['endTime'];
participantCanUnmuteSelf = json['participantCanUnmuteSelf'];
participantCanEnableVideo = json['participantCanEnableVideo'];
onlyHostInviteUser = json['onlyHostInviteUser'];
onlyHostShareScreen = json['onlyHostShareScreen'];
joinDisableMicrophone = json['joinDisableMicrophone'];
joinDisableVideo = json['joinDisableVideo'];
isMuteAllVideo = json['isMuteAllVideo'];
isMuteAllMicrophone = json['isMuteAllMicrophone'];
canScreenUserIDList = json['canScreenUserIDList'] == null
? null
: (json['canScreenUserIDList'] as List).cast<String>();
disableMicrophoneUserIDList = json['disableMicrophoneUserIDList'] == null
? null
: (json['disableMicrophoneUserIDList'] as List).cast<String>();
disableVideoUserIDList = json['disableVideoUserIDList'] == null
? null
: (json['disableVideoUserIDList'] as List).cast<String>();
pinedUserIDList = json['pinedUserIDList'] == null
? null
: (json['pinedUserIDList'] as List).cast<String>();
beWatchedUserIDList = json['beWatchedUserIDList'] == null
? null
: (json['beWatchedUserIDList'] as List).cast<String>();
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['roomID'] = roomID;
data['meetingName'] = meetingName;
data['ex'] = ex;
data['hostUserID'] = hostUserID;
data['inviteeUserIDList'] = inviteeUserIDList;
data['createTime'] = createTime;
data['startTime'] = startTime;
data['endTime'] = endTime;
data['participantCanUnmuteSelf'] = participantCanUnmuteSelf;
data['participantCanEnableVideo'] = participantCanEnableVideo;
data['onlyHostInviteUser'] = onlyHostInviteUser;
data['onlyHostShareScreen'] = onlyHostShareScreen;
data['joinDisableMicrophone'] = joinDisableMicrophone;
data['joinDisableVideo'] = joinDisableVideo;
data['isMuteAllVideo'] = isMuteAllVideo;
data['isMuteAllMicrophone'] = isMuteAllMicrophone;
data['canScreenUserIDList'] = canScreenUserIDList;
data['disableMicrophoneUserIDList'] = disableMicrophoneUserIDList;
data['disableVideoUserIDList'] = disableVideoUserIDList;
data['pinedUserIDList'] = pinedUserIDList;
data['beWatchedUserIDList'] = beWatchedUserIDList;
return data;
}
}
class MeetingStreamEvent {
String? roomID;
String? streamType;
bool? mute;
MeetingStreamEvent({this.roomID, this.streamType, this.mute});
MeetingStreamEvent.fromJson(Map<String, dynamic> json) {
roomID = json['roomID'];
streamType = json['streamType'];
mute = json['mute'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['roomID'] = this.roomID;
data['streamType'] = this.streamType;
data['mute'] = this.mute;
return data;
}
}

View File

@@ -3,116 +3,118 @@ import 'dart:io';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class Message {
/// 消息id唯一标识
/// Message ID, a unique identifier.
String? clientMsgID;
/// 服务端生成的id
/// Server-generated ID.
String? serverMsgID;
/// 创建时间
/// Creation time.
int? createTime;
/// 发送时间
/// Sending time.
int? sendTime;
/// 会话类型[ConversationType]
/// Conversation type [ConversationType].
int? sessionType;
/// 发送者id
/// Sender's ID.
String? sendID;
/// 接收者id
/// Receiver's ID.
String? recvID;
/// 来源
/// Source.
int? msgFrom;
/// 消息类型[MessageType]
/// Message type [MessageType].
int? contentType;
/// 平台[Platform]
/// Platform [Platform].
int? senderPlatformID;
/// 发送者昵称
/// Sender's nickname.
String? senderNickname;
/// 发送者头像
/// Sender's avatar.
String? senderFaceUrl;
/// ID
/// Group ID.
String? groupID;
/// 消息内容
// String? content;
/// Message content.
// String? content;
/// 消息的seq
/// Message sequence number.
int? seq;
/// 是否已读
/// Whether it's read.
bool? isRead;
/// 已读时间
/// Read time.
int? hasReadTime;
/// 消息发送状态[MessageStatus]
/// Message sending status [MessageStatus].
int? status;
/// Is it a reaction.
bool? isReact;
/// Is it an external extension.
bool? isExternalExtensions;
/// 离线显示内容
/// Offline display content.
OfflinePushInfo? offlinePush;
/// 附加信息
/// Additional information.
String? attachedInfo;
/// 扩展信息
/// Extended information.
String? ex;
/// 自定义扩展信息,目前用于客服端处理消息时间分段
/// Custom extended information, currently used for message time segmentation on the client side.
Map<String, dynamic> exMap = {};
/// 图片
/// Image.
PictureElem? pictureElem;
/// 语音
/// Voice.
SoundElem? soundElem;
/// 视频
/// Video.
VideoElem? videoElem;
/// 文件
/// File.
FileElem? fileElem;
/// @信息
/// @ Information.
AtTextElem? atTextElem;
/// 位置
/// Location.
LocationElem? locationElem;
/// 自定义
/// Custom.
CustomElem? customElem;
/// 引用
/// Quote.
QuoteElem? quoteElem;
/// 合并
/// Merge.
MergeElem? mergeElem;
/// 通知
/// Notification.
NotificationElem? notificationElem;
/// 自定义表情
/// Custom emoji.
FaceElem? faceElem;
/// 附加信息
/// Additional information.
AttachedInfoElem? attachedInfoElem;
/// 文本内容
/// Text content.
TextElem? textElem;
/// 个人名片
/// Business card.
CardElem? cardElem;
///
@@ -334,27 +336,27 @@ class Message {
typingElem = message.typingElem;
}
/// 单聊消息
/// Single chat message
bool get isSingleChat => sessionType == ConversationType.single;
/// 群聊消息
/// Group chat message
bool get isGroupChat =>
sessionType == ConversationType.group ||
sessionType == ConversationType.superGroup;
}
/// 图片消息内容
/// Image message content
class PictureElem {
/// 原路径
/// Original path
String? sourcePath;
/// 原图对象
/// Original picture object
PictureInfo? sourcePicture;
/// 大图对象
/// Big picture object
PictureInfo? bigPicture;
/// 缩率图对象
/// Thumbnail picture object
PictureInfo? snapshotPicture;
PictureElem(
@@ -392,24 +394,24 @@ class PictureElem {
}
}
/// 图片信息
/// Image information
class PictureInfo {
/// id
/// ID
String? uuid;
/// 图片mime类型
/// Image MIME type
String? type;
/// 大小
/// Size
int? size;
/// 宽度
/// Width
int? width;
/// 长度
/// Height
int? height;
/// 图片URL地址
/// Image URL
String? url;
PictureInfo(
@@ -436,21 +438,21 @@ class PictureInfo {
}
}
/// 语音消息内容
/// Voice message content
class SoundElem {
/// id
/// ID
String? uuid;
/// 原路径
/// Original path
String? soundPath;
/// url地址
/// URL address
String? sourceUrl;
/// 大小
/// Size
int? dataSize;
/// 时间s
/// Duration in seconds
int? duration;
SoundElem(
@@ -479,42 +481,42 @@ class SoundElem {
}
}
/// 视频消息内容
/// Video message content
class VideoElem {
/// 视频路径
/// Video path
String? videoPath;
/// uuid
/// UUID
String? videoUUID;
/// 视频的url地址
/// URL address of the video
String? videoUrl;
/// mime类型
/// MIME type
String? videoType;
/// 大小
/// Size
int? videoSize;
/// 时长s
/// Duration in seconds
int? duration;
/// 缩率图路径
/// Snapshot path
String? snapshotPath;
/// 缩率图uuid
/// Snapshot UUID
String? snapshotUUID;
/// 缩率图大小
/// Snapshot size
int? snapshotSize;
/// 缩率图URL地址
/// Snapshot URL address
String? snapshotUrl;
/// 缩率图宽度
/// Snapshot width
int? snapshotWidth;
/// 缩率图高度
/// Snapshot height
int? snapshotHeight;
VideoElem(
@@ -564,21 +566,21 @@ class VideoElem {
}
}
/// 文件消息内容
/// File message content
class FileElem {
/// 文件路径
/// File path
String? filePath;
/// uuid
/// UUID
String? uuid;
/// 文件URL地址
/// File URL address
String? sourceUrl;
/// 文件名
/// File name
String? fileName;
/// 文件大小
/// File size
int? fileSize;
FileElem(
@@ -603,21 +605,21 @@ class FileElem {
}
}
/// @消息内容
/// @ Message Content
class AtTextElem {
/// 消息内容
/// Message content
String? text;
/// 被@的用户ID列表
/// List of user IDs mentioned in the message
List<String>? atUserList;
/// 是否包含自己
/// Whether it includes a mention of oneself
bool? isAtSelf;
/// 被@的用户ID跟昵称关系列表用于将消息内容里的用户id替换为昵称显示
/// List of user IDs and their nicknames mentioned in the message, used to replace user IDs with nicknames in the message content
List<AtUserInfo>? atUsersInfo;
/// 被回复的消息体,回复别人并@了人
/// Message that is being replied to, when replying to someone and mentioning others
Message? quoteMessage;
AtTextElem({
@@ -655,15 +657,15 @@ class AtTextElem {
}
}
/// 位置消息内日
/// Location Message
class LocationElem {
/// 位置描述
/// Location description
String? description;
/// 经度
/// Longitude
double? longitude;
/// 纬度
/// Latitude
double? latitude;
LocationElem({this.description, this.longitude, this.latitude});
@@ -692,15 +694,15 @@ class LocationElem {
}
}
/// 自定义消息
/// Custom Message
class CustomElem {
/// 自定义数据
/// Custom data
String? data;
/// 扩展内容
/// Extended content
String? extension;
/// 描述内容
/// Description
String? description;
CustomElem({this.data, this.extension, this.description});
@@ -720,12 +722,12 @@ class CustomElem {
}
}
/// 引用消息(被回复的消息)
/// Quoted Message (Reply to a message)
class QuoteElem {
/// 回复内容内容
/// Reply content
String? text;
/// 被回复的消息体
/// The message being replied to
Message? quoteMessage;
QuoteElem({this.text, this.quoteMessage});
@@ -745,15 +747,15 @@ class QuoteElem {
}
}
/// 合并消息体
/// Merged Message Body
class MergeElem {
/// 标题
/// Title
String? title;
/// 摘要
/// Summary
List<String>? abstractList;
/// 具体选择合并的消息列表
/// List of specific messages to merge
List<Message>? multiMessage;
MergeElem({this.title, this.abstractList, this.multiMessage});
@@ -779,12 +781,12 @@ class MergeElem {
}
}
/// 通知
/// Notification
class NotificationElem {
/// 详情
/// Details
String? detail;
/// 提示
/// Default tips
String? defaultTips;
NotificationElem({this.detail, this.defaultTips});
@@ -802,12 +804,12 @@ class NotificationElem {
}
}
/// 表情
/// Emoticon
class FaceElem {
/// 位置表情,用户端对端自定义内嵌的表情包
/// Position emoticon, user-defined embedded emoticon for peer-to-peer communication
int? index;
/// 其他表情如URL表情直接返回url
/// Other emoticons, such as URL emoticons directly returning the URL
String? data;
FaceElem({this.index, this.data});
@@ -825,22 +827,22 @@ class FaceElem {
}
}
/// 附加信息
/// Additional Information
class AttachedInfoElem {
/// 群消息已读信息
/// Group message read information
GroupHasReadInfo? groupHasReadInfo;
/// 是否为私聊消息(阅后即焚消息),单聊有效
/// Whether it is a private chat message (burn after reading message), valid for one-on-one chats
bool? isPrivateChat;
/// 已读时间
/// Read time
int? hasReadTime;
/// 阅读时长 s
/// 即从hasReadTime时间算起超过了burnDuration秒触发销毁
/// Reading duration in seconds
/// That is, it triggers destruction after burnDuration seconds from the hasReadTime time
int? burnDuration;
/// 离线不发送推送
/// Do not send offline push notifications
bool? notSenderNotificationPush;
AttachedInfoElem({
@@ -981,15 +983,15 @@ class MessageEntity {
}
}
/// 群消息已读信息
/// Group message read information
class GroupHasReadInfo {
/// 已读的用户id列表
/// List of user IDs that have read the message
List<String>? hasReadUserIDList;
/// 已读总数
/// Total number of messages read
int? hasReadCount;
/// 发送此条消息时的群人数
/// Number of group members when this message was sent
int? groupMemberCount;
GroupHasReadInfo.fromJson(Map<String, dynamic> json) {
@@ -1011,27 +1013,27 @@ class GroupHasReadInfo {
}
}
/// 消息已读回执信息
/// Message read receipt information
class ReadReceiptInfo {
/// 发送者id
/// Sender's ID
String? userID;
/// 群id
/// Group ID
String? groupID;
/// 已读消息的clientMsgID集合
/// List of clientMsgIDs for read messages
List<String>? msgIDList;
/// 读时间
/// Read time
int? readTime;
/// 消息来源
/// Message source
int? msgFrom;
/// 消息类型[MessageType]
/// Message type [MessageType]
int? contentType;
/// 会话类型[ConversationType]
/// Conversation type [ConversationType]
int? sessionType;
ReadReceiptInfo(
@@ -1067,21 +1069,21 @@ class ReadReceiptInfo {
}
}
/// 离线推送信息
/// Offline push information
class OfflinePushInfo {
/// 通知标题
/// Notification title
String? title;
/// 通知描述
/// Notification description
String? desc;
/// 扩展内容
/// Extended content
String? ex;
/// 仅ios有效
/// iOS-specific
String? iOSPushSound;
/// 仅ios有效
/// iOS-specific
bool? iOSBadgeCount;
OfflinePushInfo(
@@ -1106,12 +1108,12 @@ class OfflinePushInfo {
}
}
/// @消息用户id跟昵称关系对象
/// @ message user ID and nickname relationship object
class AtUserInfo {
/// 被@的用户id
/// User ID who was @ mentioned
String? atUserID;
/// 被@的用户昵称
/// User nickname who was @ mentioned
String? groupNickname;
AtUserInfo({this.atUserID, this.groupNickname});
@@ -1129,33 +1131,33 @@ class AtUserInfo {
}
}
/// 消息撤回具体信息
/// Message revocation details
class RevokedInfo {
/// 撤回者ID
/// Revoker's ID
String? revokerID;
/// 撤回者群角色 [GroupRoleLevel]
/// Revoker's group role [GroupRoleLevel]
int? revokerRole;
/// 撤回者昵称
/// Revoker's nickname
String? revokerNickname;
/// 消息id
/// Message ID
String? clientMsgID;
/// 撤回时间
/// Revocation time
int? revokeTime;
/// 消息发送时间
/// Message sending time
int? sourceMessageSendTime;
/// 消息发送者
/// Message sender
String? sourceMessageSendID;
/// 消息发送者昵称
/// Message sender's nickname
String? sourceMessageSenderNickname;
/// 会话类型 [ConversationType]
/// Conversation type [ConversationType]
int? sessionType;
RevokedInfo({
@@ -1269,31 +1271,6 @@ class RichMessageInfo {
}
}
///////////////////// 消息修改相关/////////////////////
////////////////////////////////////////////////////
class KeyValue {
String? typeKey;
String? value;
int? latestUpdateTime;
KeyValue({this.typeKey, this.value, this.latestUpdateTime});
KeyValue.fromJson(Map<String, dynamic> json) {
typeKey = json['typeKey'];
value = json['value'];
latestUpdateTime = json['latestUpdateTime'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['typeKey'] = this.typeKey;
data['value'] = this.value;
data['latestUpdateTime'] = this.latestUpdateTime;
return data;
}
}
class UserExInfo {
String? userID;
String? ex;
@@ -1312,129 +1289,3 @@ class UserExInfo {
return data;
}
}
class SingleTypeKeyInfoSum {
String? typeKey;
int? counter;
List<UserExInfo>? infoList;
bool? isContainSelf;
SingleTypeKeyInfoSum({
this.typeKey,
this.counter,
this.infoList,
this.isContainSelf,
});
SingleTypeKeyInfoSum.fromJson(Map<String, dynamic> json) {
typeKey = json['typeKey'];
counter = json['counter'];
infoList = json['infoList'] == null
? null
: (json['infoList'] as List)
.map((e) => UserExInfo.fromJson(e))
.toList();
isContainSelf = json['isContainSelf'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['typeKey'] = this.typeKey;
data['counter'] = this.counter;
data['infoList'] = this.infoList?.map((e) => e.toJson()).toList();
data['isContainSelf'] = this.isContainSelf;
return data;
}
}
class MessageKv {
String? clientMsgID;
List<SingleTypeKeyInfoSum>? changedKvList;
MessageKv({this.clientMsgID, this.changedKvList});
MessageKv.fromJson(Map<String, dynamic> json) {
clientMsgID = json['clientMsgID'];
changedKvList = json['changedKvList'] == null
? null
: (json['changedKvList'] as List)
.map((e) => SingleTypeKeyInfoSum.fromJson(e))
.toList();
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['clientMsgID'] = this.clientMsgID;
data['changedKvList'] = this.changedKvList?.map((e) => e.toJson()).toList();
return data;
}
}
class TypeKeySetResult {
int? errCode;
String? errMsg;
String? typeKey;
int? latestUpdateTime;
String? value;
TypeKeySetResult(
{this.errCode,
this.errMsg,
this.typeKey,
this.latestUpdateTime,
this.value});
TypeKeySetResult.fromJson(Map<String, dynamic> json) {
errCode = json['errCode'];
errMsg = json['errMsg'];
typeKey = json['typeKey'];
latestUpdateTime = json['latestUpdateTime'];
value = json['value'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['errCode'] = this.errCode;
data['errMsg'] = this.errMsg;
data['typeKey'] = this.typeKey;
data['latestUpdateTime'] = this.latestUpdateTime;
data['value'] = this.value;
return data;
}
}
class MessageTypeKeyMapping {
int? errCode;
String? errMsg;
Map<String, KeyValue>? reactionExtensionList;
String? clientMsgID;
MessageTypeKeyMapping(
{this.errCode,
this.errMsg,
this.reactionExtensionList,
this.clientMsgID});
MessageTypeKeyMapping.fromJson(Map<String, dynamic> json) {
errCode = json['errCode'];
errMsg = json['errMsg'];
reactionExtensionList = json['reactionExtensionList'] != null
? (json['reactionExtensionList'] as Map)
.map((key, value) => MapEntry(key, KeyValue.fromJson(value)))
: null;
clientMsgID = json['clientMsgID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['errCode'] = this.errCode;
data['errMsg'] = this.errMsg;
if (this.reactionExtensionList != null) {
data['reactionExtensionList'] = this
.reactionExtensionList!
.map((key, value) => MapEntry(key, value.toJson()));
}
data['clientMsgID'] = this.clientMsgID;
return data;
}
}

View File

@@ -1,38 +1,41 @@
import '../../flutter_openim_sdk.dart';
/// oa 通知
/// OA notification
class OANotification {
/// 标题
/// Title
String? notificationName;
/// 头像
/// Avatar
String? notificationFaceURL;
/// 类型
/// Type
int? notificationType;
/// 文本内容
/// Text content
String? text;
/// 跳转链接
/// Redirect link
String? externalUrl;
/// 0:纯文字通知 1文字+图片通知 2文字+视频通知 3文字+文件通知
/// 0: Text-only notification
/// 1: Text + Image notification
/// 2: Text + Video notification
/// 3: Text + File notification
int? mixType;
/// 图片信息
/// Image information
PictureElem? pictureElem;
/// 语音信息
/// Sound information
SoundElem? soundElem;
/// 视频信息
/// Video information
VideoElem? videoElem;
/// 文件信息
/// File information
FileElem? fileElem;
/// 扩展字段
/// Additional field
String? ex;
OANotification(

View File

@@ -1,10 +1,10 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class SearchResult {
/// 获取到的总的消息数量
/// Total number of messages obtained
int? totalCount;
/// 搜索到的具体内容
/// Specific search results
List<SearchResultItems>? searchResultItems;
List<SearchResultItems>? findResultItems;
@@ -43,22 +43,22 @@ class SearchResult {
}
class SearchResultItems {
/// 会话ID
/// Conversation ID
String? conversationID;
/// 会话类型1单聊2群聊3超级大群4通知会话
/// Conversation type: 1 for single chat, 2 for group chat, 3 for supergroup, 4 for notification conversation
int? conversationType;
/// 显示名
/// Display name
String? showName;
/// 头像
/// Profile picture
String? faceURL;
/// 搜索到的这个会话下的消息数量
/// Number of messages found in this conversation
int? messageCount;
/// [Message]的列表
/// List of [Message]s
List<Message>? messageList;
SearchResultItems({this.conversationID, this.messageCount, this.messageList});

View File

@@ -1,68 +1,71 @@
/// Is a friend not in the blacklist
/// 是好友不在黑名单
/// Not a friend on the blacklist
/// 不是好友在黑名单
/// Not a friend is not on the blacklist
/// 不是好友不在黑名单
class UserInfo {
/// 用户id
/// User ID
String? userID;
/// 用户昵称
/// User nickname
String? nickname;
/// 头像
/// Profile picture
String? faceURL;
/// 性别
/// Gender
int? gender;
/// 手机号
/// Phone number
String? phoneNumber;
/// 出生时间
/// Date of birth
int? birth;
/// 邮箱
/// Email
String? email;
/// 扩展字段
/// Additional information
String? ex;
/// 创建时间
/// Creation time
int? createTime;
/// 备注
/// Remark
String? remark;
/// 全局免打扰 0正常1不接受消息2接受在线消息不接受离线消息
/// Global do not disturb setting:
/// 0: Normal
/// 1: Do not accept messages
/// 2: Accept online messages but not offline messages
int? globalRecvMsgOpt;
/// 是允许添加为好友 1允许2
/// Allow adding as a friend:
/// 1: Allowed
/// 2: Not allowed
int? allowAddFriend;
/// 新消息铃声 1允许2
/// New message ringtone:
/// 1: Allowed
/// 2: Not allowed
int? allowBeep;
/// 新消息震动 1允许2
/// New message vibration:
/// 1: Allowed
/// 2: Not allowed
int? allowVibration;
/// 禁止登录
/// Prohibited from logging in
int? forbidden;
/// 用户公开的资料
/// User's public information
PublicUserInfo? publicInfo;
/// 好友才能查看的资料
/// Information visible only to friends
FriendInfo? friendInfo;
/// 黑名单资料
/// Blacklist information
BlacklistInfo? blackInfo;
/// 是否好友关系
/// Whether there is a friendship relationship
bool? isFriendship;
/// 是否黑名单
/// Whether the user is in the blacklist
bool? isBlacklist;
UserInfo({
@@ -89,23 +92,17 @@ class UserInfo {
this.forbidden,
});
// UserInfo.self(Map<String, dynamic> json) {
// userID = json['userID'];
// nickname = json['nickname'];
// faceURL = json['faceURL'];
// gender = json['gender'];
// phoneNumber = json['phoneNumber'];
// birth = json['birth'];
// email = json['email'];
// ex = json['ex'];
// createTime = json['createTime'];
// }
UserInfo.fromJson(Map<String, dynamic> json) {
publicInfo = json['publicInfo'] != null ? PublicUserInfo.fromJson(json['publicInfo']) : null;
friendInfo = json['friendInfo'] != null ? FriendInfo.fromJson(json['friendInfo']) : null;
blackInfo = json['blackInfo'] != null ? BlacklistInfo.fromJson(json['blackInfo']) : null;
//
publicInfo = json['publicInfo'] != null
? PublicUserInfo.fromJson(json['publicInfo'])
: null;
friendInfo = json['friendInfo'] != null
? FriendInfo.fromJson(json['friendInfo'])
: null;
blackInfo = json['blackInfo'] != null
? BlacklistInfo.fromJson(json['blackInfo'])
: null;
isFriendship = friendInfo != null;
isBlacklist = blackInfo != null;
@@ -152,23 +149,27 @@ class UserInfo {
return data;
}
// bool get isFriendship => null != friendInfo;
//
// bool get isBlacklist => null != blackInfo;
bool get isMale => gender == 1;
String get _userID => isFriendship! ? friendInfo!.userID! : (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
String get _userID => isFriendship!
? friendInfo!.userID!
: (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
String? get _nickname =>
isFriendship! ? friendInfo?.nickname : (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
String? get _nickname => isFriendship!
? friendInfo?.nickname
: (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
String? get _faceUrl =>
isFriendship! ? friendInfo?.faceURL : (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
String? get _faceUrl => isFriendship!
? friendInfo?.faceURL
: (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
int? get _gender => isFriendship! ? friendInfo?.gender : (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
int? get _gender => isFriendship!
? friendInfo?.gender
: (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
String? get _ex => isFriendship! ? friendInfo?.ex : (isBlacklist! ? blackInfo?.ex : publicInfo?.ex);
String? get _ex => isFriendship!
? friendInfo?.ex
: (isBlacklist! ? blackInfo?.ex : publicInfo?.ex);
String? get _phoneNumber => friendInfo?.phoneNumber;
@@ -187,30 +188,34 @@ class UserInfo {
@override
bool operator ==(Object other) =>
identical(this, other) || other is UserInfo && runtimeType == other.runtimeType && userID == other.userID;
identical(this, other) ||
other is UserInfo &&
runtimeType == other.runtimeType &&
userID == other.userID;
@override
int get hashCode => userID.hashCode;
}
/// 公开的资料
class PublicUserInfo {
/// 用户id
/// User ID
String? userID;
/// 昵称
/// Nickname
String? nickname;
/// 头像
/// Profile picture
String? faceURL;
/// 性别
/// Gender
int? gender;
/// AppOrdinaryUsers = 1 AppAdmin = 2
int? appMangerLevel;
/// App Manager Level:
/// 1: AppOrdinaryUsers
/// 2: AppAdmin
int? appManagerLevel;
/// 扩展信息
/// Additional information
String? ex;
PublicUserInfo({
@@ -218,7 +223,7 @@ class PublicUserInfo {
this.nickname,
this.faceURL,
this.gender,
this.appMangerLevel,
this.appManagerLevel,
this.ex,
});
@@ -227,7 +232,7 @@ class PublicUserInfo {
nickname = json['nickname'];
faceURL = json['faceURL'];
gender = json['gender'];
appMangerLevel = json['appMangerLevel'];
appManagerLevel = json['appManagerLevel'];
ex = json['ex'];
}
@@ -237,48 +242,47 @@ class PublicUserInfo {
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['appMangerLevel'] = this.appMangerLevel;
data['appMangerLevel'] = this.appManagerLevel;
data['ex'] = this.ex;
return data;
}
}
/// 好友信息
class FriendInfo {
/// 用户id
/// User ID
String? userID;
/// 昵称
/// Nickname
String? nickname;
/// 头像
/// Profile picture
String? faceURL;
/// 性别
/// Gender
int? gender;
/// 手机号
/// Phone number
String? phoneNumber;
/// 出生日期
/// Date of birth
int? birth;
/// 邮箱
/// Email
String? email;
/// 备注
/// Remark
String? remark;
/// 扩展字段
/// Additional information
String? ex;
/// 创建时间
/// Creation time
int? createTime;
/// 添加方式
/// Add source
int? addSource;
/// 操作者id
/// Operator User ID
String? operatorUserID;
FriendInfo({
@@ -338,30 +342,29 @@ class FriendInfo {
}
}
/// 黑名单信息
class BlacklistInfo {
/// 用户id
/// User ID
String? userID;
/// 昵称
/// Nickname
String? nickname;
/// 头像
/// Profile picture
String? faceURL;
/// 性别
/// Gender
int? gender;
/// 创建时间
/// Creation time
int? createTime;
/// 添加方式
/// Add source
int? addSource;
/// 操作者
/// Operator User ID
String? operatorUserID;
/// 扩展信息
/// Additional information
String? ex;
BlacklistInfo({
@@ -400,12 +403,11 @@ class BlacklistInfo {
}
}
/// 关系
class FriendshipInfo {
/// 用户id
/// User ID
String? userID;
/// 1表示好友(并且不是黑名单)
/// 1 represents a friend (and not in the blacklist)
int? result;
FriendshipInfo({this.userID, this.result});
@@ -423,51 +425,50 @@ class FriendshipInfo {
}
}
/// 好友申请信息
class FriendApplicationInfo {
/// 发起者用户id
/// Initiator user ID
String? fromUserID;
/// 发起者用户昵称
/// Initiator user nickname
String? fromNickname;
/// 发起者用户头像
/// Initiator user profile picture
String? fromFaceURL;
/// 发起者性别
/// Initiator user gender
int? fromGender;
/// 接收者用户id
/// Recipient user ID
String? toUserID;
/// 接收者用户昵称
/// Recipient user nickname
String? toNickname;
/// 接收者头像
/// Recipient user profile picture
String? toFaceURL;
/// 接收者性别
/// Recipient user gender
int? toGender;
/// 处理结果
/// Handling result
int? handleResult;
/// 请求消息
/// Request message
String? reqMsg;
/// 创建时间
/// Creation time
int? createTime;
/// 处理者id
/// Handler user ID
String? handlerUserID;
/// 处理备注
/// Handling remark
String? handleMsg;
/// 处理时间
/// Handling time
int? handleTime;
/// 扩展字段
/// Additional information
String? ex;
FriendApplicationInfo(
@@ -525,24 +526,24 @@ class FriendApplicationInfo {
return data;
}
/// 等待处理
/// Waiting to be processed
bool get isWaitingHandle => handleResult == 0;
/// 已同意
/// Already agreed
bool get isAgreed => handleResult == 1;
/// 已拒绝
/// Already rejected
bool get isRejected => handleResult == -1;
}
class UserStatusInfo {
/// 用户id
/// User ID
String? userID;
/// 状态
/// Status
int? status;
/// 平台ID
/// Platform IDs
List<int>? platformIDs;
UserStatusInfo({
@@ -554,7 +555,9 @@ class UserStatusInfo {
UserStatusInfo.fromJson(Map<String, dynamic> json) {
userID = json['userID'];
status = json['status'];
platformIDs = json["platformIDs"] == null ? [] : List<int>.from(json["platformIDs"].map((x) => x));
platformIDs = json["platformIDs"] == null
? []
: List<int>.from(json["platformIDs"].map((x) => x));
}
Map<String, dynamic> toJson() {