open-im-sdk-flutter-m/lib/src/models/notification_info.dart
2024-11-17 18:31:14 +08:00

709 lines
18 KiB
Dart

import '../../flutter_openim_sdk.dart';
import 'channel_info.dart';
/// OA notification
class OANotification {
/// Title
String? notificationName;
/// Avatar
String? notificationFaceURL;
/// Type
int? notificationType;
/// Text content
String? text;
/// Redirect link
String? externalUrl;
/// 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(
{this.notificationName,
this.notificationFaceURL,
this.notificationType,
this.text,
this.externalUrl,
this.mixType,
this.pictureElem,
this.soundElem,
this.videoElem,
this.fileElem,
this.ex});
OANotification.fromJson(Map<String, dynamic> json) {
notificationName = json['notificationName'];
notificationFaceURL = json['notificationFaceURL'];
notificationType = json['notificationType'];
text = json['text'];
externalUrl = json['externalUrl'];
mixType = json['mixType'];
pictureElem = json['pictureElem'] != null
? PictureElem.fromJson(json['pictureElem'])
: null;
soundElem = json['soundElem'] != null
? SoundElem.fromJson(json['soundElem'])
: null;
videoElem = json['videoElem'] != null
? VideoElem.fromJson(json['videoElem'])
: null;
fileElem =
json['fileElem'] != null ? FileElem.fromJson(json['fileElem']) : null;
ex = json['ex'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['notificationName'] = this.notificationName;
data['notificationFaceURL'] = this.notificationFaceURL;
data['notificationType'] = this.notificationType;
data['text'] = this.text;
data['externalUrl'] = this.externalUrl;
data['mixType'] = this.mixType;
if (this.pictureElem != null) {
data['pictureElem'] = this.pictureElem!.toJson();
}
if (this.soundElem != null) {
data['soundElem'] = this.soundElem!.toJson();
}
if (this.videoElem != null) {
data['videoElem'] = this.videoElem!.toJson();
}
if (this.fileElem != null) {
data['fileElem'] = this.fileElem!.toJson();
}
data['ex'] = this.ex;
return data;
}
}
/// 群事件通知
class GroupNotification {
/// 群信息
GroupInfo? group;
/// 当前事件操作者信息
GroupMembersInfo? opUser;
/// 群拥有者信息
GroupMembersInfo? groupOwnerUser;
/// 产生影响的群成员列表
List<GroupMembersInfo>? memberList;
GroupNotification({
this.group,
this.opUser,
this.groupOwnerUser,
this.memberList,
});
GroupNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
groupOwnerUser = json['groupOwnerUser'] != null
? GroupMembersInfo.fromJson(json['groupOwnerUser'])
: null;
if (json['memberList'] != null) {
memberList = <GroupMembersInfo>[];
json['memberList'].forEach((v) {
memberList!.add(GroupMembersInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.groupOwnerUser != null) {
data['groupOwnerUser'] = this.groupOwnerUser!.toJson();
}
if (this.memberList != null) {
data['memberList'] = this.memberList!.map((v) => v.toJson()).toList();
}
return data;
}
}
/// 用户被邀请进群通知
class InvitedJoinGroupNotification {
/// 群信息
GroupInfo? group;
/// 操作者信息
GroupMembersInfo? opUser;
/// 被邀请进群的成员信息
List<GroupMembersInfo>? invitedUserList;
InvitedJoinGroupNotification({this.group, this.opUser, this.invitedUserList});
InvitedJoinGroupNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
if (json['invitedUserList'] != null) {
invitedUserList = <GroupMembersInfo>[];
json['invitedUserList'].forEach((v) {
invitedUserList!.add(GroupMembersInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.invitedUserList != null) {
data['invitedUserList'] =
this.invitedUserList!.map((v) => v.toJson()).toList();
}
return data;
}
}
/// 组踢出成员通知
class KickedGroupMemeberNotification {
/// 群信息
GroupInfo? group;
/// 操作者信息
GroupMembersInfo? opUser;
/// 被踢出群的成员信息列表
List<GroupMembersInfo>? kickedUserList;
KickedGroupMemeberNotification(
{this.group, this.opUser, this.kickedUserList});
KickedGroupMemeberNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
if (json['kickedUserList'] != null) {
kickedUserList = <GroupMembersInfo>[];
json['kickedUserList'].forEach((v) {
kickedUserList!.add(GroupMembersInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.kickedUserList != null) {
data['kickedUserList'] =
this.kickedUserList!.map((v) => v.toJson()).toList();
}
return data;
}
}
/// 退出群通知
class QuitGroupNotification {
/// 群信息
GroupInfo? group;
/// 退群的成员信息
GroupMembersInfo? quitUser;
QuitGroupNotification({this.group, this.quitUser});
QuitGroupNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
quitUser = json['quitUser'] != null
? GroupMembersInfo.fromJson(json['quitUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.quitUser != null) {
data['quitUser'] = this.quitUser!.toJson();
}
return data;
}
}
/// 进群通知
class EnterGroupNotification {
/// 群信息
GroupInfo? group;
/// 进入群的成员信息
GroupMembersInfo? entrantUser;
EnterGroupNotification({this.group, this.entrantUser});
EnterGroupNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
entrantUser = json['entrantUser'] != null
? GroupMembersInfo.fromJson(json['entrantUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.entrantUser != null) {
data['quitUser'] = this.entrantUser!.toJson();
}
return data;
}
}
/// 群权转让通知
class GroupRightsTransferNoticication {
/// 群信息
GroupInfo? group;
/// 操作者信息
GroupMembersInfo? opUser;
/// 群新的拥有者信息
GroupMembersInfo? newGroupOwner;
GroupRightsTransferNoticication({
this.group,
this.opUser,
this.newGroupOwner,
});
GroupRightsTransferNoticication.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
newGroupOwner = json['newGroupOwner'] != null
? GroupMembersInfo.fromJson(json['newGroupOwner'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.newGroupOwner != null) {
data['newGroupOwner'] = this.newGroupOwner!.toJson();
}
return data;
}
}
/// 禁言成员通知
class MuteMemberNotification {
/// 群信息
GroupInfo? group;
/// 操作者信息
GroupMembersInfo? opUser;
/// 被禁言的成员信息
GroupMembersInfo? mutedUser;
/// 禁言时间s
int? mutedSeconds;
MuteMemberNotification({
this.group,
this.opUser,
this.mutedUser,
this.mutedSeconds,
});
MuteMemberNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
mutedUser = json['mutedUser'] != null
? GroupMembersInfo.fromJson(json['mutedUser'])
: null;
mutedSeconds = json['mutedSeconds'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.mutedUser != null) {
data['mutedUser'] = this.mutedUser!.toJson();
}
data['mutedSeconds'] = this.mutedSeconds;
return data;
}
}
/// 阅后即焚通知
class BurnAfterReadingNotification {
/// 接收者
String? recvID;
/// 发送者
String? sendID;
/// 是否开启
bool? isPrivate;
BurnAfterReadingNotification({this.recvID, this.sendID, this.isPrivate});
BurnAfterReadingNotification.fromJson(Map<String, dynamic> json) {
recvID = json['recvID'];
sendID = json['sendID'];
isPrivate = json['isPrivate'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['recvID'] = this.recvID;
data['sendID'] = this.sendID;
data['isPrivate'] = this.isPrivate;
return data;
}
}
/// 群成员信息发送变化通知
class GroupMemberInfoChangedNotification {
/// 群信息
GroupInfo? group;
/// 操作者信息
GroupMembersInfo? opUser;
/// 资料发生改变的成员
GroupMembersInfo? changedUser;
GroupMemberInfoChangedNotification({
this.group,
this.opUser,
this.changedUser,
});
GroupMemberInfoChangedNotification.fromJson(Map<String, dynamic> json) {
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
opUser = json['opUser'] != null
? GroupMembersInfo.fromJson(json['opUser'])
: null;
changedUser = json['changedUser'] != null
? GroupMembersInfo.fromJson(json['changedUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.group != null) {
data['group'] = this.group!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.changedUser != null) {
data['changedUser'] = this.changedUser!.toJson();
}
return data;
}
}
///todo 所有的聊天的操作者都没有,暂时没有处理
/// 聊天室事件通知
class ChannelNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 当前事件操作者信息
ChannelMembersInfo? opUser;
/// 聊天室拥有者信息
ChannelMembersInfo? ChannelOwnerUser;
/// 产生影响的聊天室成员列表
List<ChannelMembersInfo>? memberList;
ChannelNotification({
this.Channel,
this.opUser,
this.ChannelOwnerUser,
this.memberList,
});
ChannelNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
opUser = json['opUser'] != null
? ChannelMembersInfo.fromJson(json['opUser'])
: null;
ChannelOwnerUser = json['channelOwnerUser'] != null
? ChannelMembersInfo.fromJson(json['channelOwnerUser'])
: null;
if (json['memberList'] != null) {
memberList = <ChannelMembersInfo>[];
json['memberList'].forEach((v) {
memberList!.add(ChannelMembersInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.Channel != null) {
data['channel'] = this.Channel!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.ChannelOwnerUser != null) {
data['channelOwnerUser'] = this.ChannelOwnerUser!.toJson();
}
if (this.memberList != null) {
data['memberList'] = this.memberList!.map((v) => v.toJson()).toList();
}
return data;
}
}
/// 组踢出成员通知
class KickedChannelMemeberNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 操作者信息
ChannelMembersInfo? opUser;
/// 被踢出聊天室的成员信息列表
List<ChannelMembersInfo>? kickedUserList;
KickedChannelMemeberNotification(
{this.Channel, this.opUser, this.kickedUserList});
KickedChannelMemeberNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
opUser = json['opUser'] != null
? ChannelMembersInfo.fromJson(json['opUser'])
: null;
if (json['kickedUserList'] != null) {
kickedUserList = <ChannelMembersInfo>[];
json['kickedUserList'].forEach((v) {
kickedUserList!.add(ChannelMembersInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.Channel != null) {
data['channel'] = this.Channel!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.kickedUserList != null) {
data['kickedUserList'] =
this.kickedUserList!.map((v) => v.toJson()).toList();
}
return data;
}
}
/// 退出聊天室通知
class QuitChannelNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 退聊天室的成员信息
ChannelMembersInfo? quitUser;
QuitChannelNotification({this.Channel, this.quitUser});
QuitChannelNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
quitUser = json['quitUser'] != null
? ChannelMembersInfo.fromJson(json['quitUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.Channel != null) {
data['channel'] = this.Channel!.toJson();
}
if (this.quitUser != null) {
data['quitUser'] = this.quitUser!.toJson();
}
return data;
}
}
/// 进聊天室通知
class EnterChannelNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 进入聊天室的成员信息
ChannelMembersInfo? entrantUser;
EnterChannelNotification({this.Channel, this.entrantUser});
EnterChannelNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
entrantUser = json['entrantUser'] != null
? ChannelMembersInfo.fromJson(json['entrantUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.Channel != null) {
data['channel'] = this.Channel!.toJson();
}
if (this.entrantUser != null) {
data['quitUser'] = this.entrantUser!.toJson();
}
return data;
}
}
/// 禁言成员通知
class MuteChannelMemberNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 操作者信息
ChannelMembersInfo? opUser;
/// 被禁言的成员信息
ChannelMembersInfo? mutedUser;
/// 禁言时间s
int? mutedSeconds;
MuteChannelMemberNotification({
this.Channel,
this.opUser,
this.mutedUser,
this.mutedSeconds,
});
MuteChannelMemberNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
opUser = json['opUser'] != null
? ChannelMembersInfo.fromJson(json['opUser'])
: null;
mutedUser = json['mutedUser'] != null
? ChannelMembersInfo.fromJson(json['mutedUser'])
: null;
mutedSeconds = json['mutedSeconds'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.Channel != null) {
data['channel'] = this.Channel!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.mutedUser != null) {
data['mutedUser'] = this.mutedUser!.toJson();
}
data['mutedSeconds'] = this.mutedSeconds;
return data;
}
}
/// 聊天室成员信息发送变化通知
class ChannelMemberInfoChangedNotification {
/// 聊天室信息
ChannelInfo? Channel;
/// 操作者信息
ChannelMembersInfo? opUser;
/// 资料发生改变的成员
ChannelMembersInfo? changedUser;
ChannelMemberInfoChangedNotification({
this.Channel,
this.opUser,
this.changedUser,
});
ChannelMemberInfoChangedNotification.fromJson(Map<String, dynamic> json) {
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
opUser = json['opUser'] != null
? ChannelMembersInfo.fromJson(json['opUser'])
: null;
changedUser = json['changedUser'] != null
? ChannelMembersInfo.fromJson(json['changedUser'])
: null;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.Channel != null) {
data['Channel'] = this.Channel!.toJson();
}
if (this.opUser != null) {
data['opUser'] = this.opUser!.toJson();
}
if (this.changedUser != null) {
data['changedUser'] = this.changedUser!.toJson();
}
return data;
}
}