This commit is contained in:
@@ -115,16 +115,11 @@ class GroupInfo {
|
||||
}
|
||||
|
||||
/// Corresponding Conversation Type for Group Type
|
||||
int get sessionType => groupType == GroupType.general
|
||||
? ConversationType.group
|
||||
: ConversationType.superGroup;
|
||||
int get sessionType => groupType == GroupType.general ? ConversationType.group : ConversationType.superGroup;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is GroupInfo &&
|
||||
runtimeType == other.runtimeType &&
|
||||
groupID == other.groupID;
|
||||
identical(this, other) || other is GroupInfo && runtimeType == other.runtimeType && groupID == other.groupID;
|
||||
|
||||
@override
|
||||
int get hashCode => groupID.hashCode;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class InitConfig {
|
||||
String systemType;
|
||||
int platformID;
|
||||
String apiAddr;
|
||||
String wsAddr;
|
||||
@@ -6,6 +7,7 @@ class InitConfig {
|
||||
int logLevel;
|
||||
bool isLogStandardOutput;
|
||||
String? logFilePath;
|
||||
bool enabledCompression;
|
||||
|
||||
InitConfig({
|
||||
required this.platformID,
|
||||
@@ -15,18 +17,21 @@ class InitConfig {
|
||||
this.logLevel = 6,
|
||||
this.isLogStandardOutput = true,
|
||||
this.logFilePath,
|
||||
this.enabledCompression = false,
|
||||
this.systemType = 'flutter',
|
||||
});
|
||||
|
||||
factory InitConfig.fromJson(Map<String, dynamic> json) {
|
||||
return InitConfig(
|
||||
platformID: json['platformID'],
|
||||
apiAddr: json['apiAddr'],
|
||||
wsAddr: json['wsAddr'],
|
||||
dataDir: json['dataDir'],
|
||||
logLevel: json['logLevel'],
|
||||
isLogStandardOutput: json['isLogStandardOutput'],
|
||||
logFilePath: json['logFilePath'],
|
||||
);
|
||||
platformID: json['platformID'],
|
||||
apiAddr: json['apiAddr'],
|
||||
wsAddr: json['wsAddr'],
|
||||
dataDir: json['dataDir'],
|
||||
logLevel: json['logLevel'],
|
||||
isLogStandardOutput: json['isLogStandardOutput'],
|
||||
logFilePath: json['logFilePath'],
|
||||
enabledCompression: json['isCompression'],
|
||||
systemType: json['systemType']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -38,6 +43,8 @@ class InitConfig {
|
||||
'logLevel': logLevel,
|
||||
'isLogStandardOutput': isLogStandardOutput,
|
||||
'logFilePath': logFilePath,
|
||||
'isCompression': enabledCompression,
|
||||
'systemType': systemType,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
41
lib/src/models/set_group_member_info.dart
Normal file
41
lib/src/models/set_group_member_info.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
class SetGroupMemberInfo {
|
||||
SetGroupMemberInfo({
|
||||
required this.groupID,
|
||||
required this.userID,
|
||||
this.roleLevel,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
final String groupID;
|
||||
final String userID;
|
||||
final int? roleLevel;
|
||||
final String? nickname;
|
||||
final String? faceURL;
|
||||
final String? ex;
|
||||
|
||||
SetGroupMemberInfo.fromJson(Map<String, dynamic> json)
|
||||
: groupID = json['groupID'],
|
||||
userID = json['userID'],
|
||||
roleLevel = json['roleLevel'],
|
||||
nickname = json['nickname'],
|
||||
faceURL = json['faceURL'],
|
||||
ex = json['ex'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupID'] = groupID;
|
||||
data['userID'] = userID;
|
||||
data['roleLevel'] = roleLevel;
|
||||
data['nickname'] = nickname;
|
||||
data['faceURL'] = faceURL;
|
||||
data['ex'] = ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetGroupMemberInfo{groupID: $groupID, userID: $userID, roleLevel: $roleLevel, nickname: $nickname, faceURL: $faceURL, ex: $ex}';
|
||||
}
|
||||
}
|
||||
91
lib/src/models/update_req.dart
Normal file
91
lib/src/models/update_req.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
class UpdateFriendsReq {
|
||||
final String? ownerUserID;
|
||||
final List<String>? friendUserIDs;
|
||||
final bool? isPinned;
|
||||
final String? remark;
|
||||
final String? ex;
|
||||
|
||||
UpdateFriendsReq({
|
||||
this.ownerUserID,
|
||||
this.friendUserIDs,
|
||||
this.isPinned,
|
||||
this.remark,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
UpdateFriendsReq.fromJson(Map<String, dynamic> json)
|
||||
: ownerUserID = json['ownerUserID'],
|
||||
friendUserIDs = json['friendUserIDs'],
|
||||
isPinned = json['isPinned'],
|
||||
remark = json['remark'],
|
||||
ex = json['ex'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['ownerUserID'] = ownerUserID;
|
||||
data['friendUserIDs'] = friendUserIDs;
|
||||
data['isPinned'] = isPinned;
|
||||
data['remark'] = remark;
|
||||
data['ex'] = ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFriendsReq{ownerUserID: $ownerUserID, friendUserIDs: $friendUserIDs, isPinned: $isPinned, remark: $remark, ex: $ex}';
|
||||
}
|
||||
}
|
||||
|
||||
class ConversationReq {
|
||||
final String? userID;
|
||||
final String? groupID;
|
||||
final int? recvMsgOpt;
|
||||
final bool? isPinned;
|
||||
final bool? isPrivateChat;
|
||||
final String? ex;
|
||||
final int? burnDuration;
|
||||
final bool? isMsgDestruct;
|
||||
final int? msgDestructTime;
|
||||
final int? groupAtType;
|
||||
|
||||
ConversationReq({
|
||||
this.userID,
|
||||
this.groupID,
|
||||
this.recvMsgOpt,
|
||||
this.isPinned,
|
||||
this.isPrivateChat,
|
||||
this.ex,
|
||||
this.burnDuration,
|
||||
this.isMsgDestruct,
|
||||
this.msgDestructTime,
|
||||
this.groupAtType,
|
||||
});
|
||||
|
||||
ConversationReq.fromJson(Map<String, dynamic> json)
|
||||
: userID = json['userID'],
|
||||
groupID = json['groupID'],
|
||||
recvMsgOpt = json['recvMsgOpt'],
|
||||
isPinned = json['isPinned'],
|
||||
isPrivateChat = json['isPrivateChat'],
|
||||
ex = json['ex'],
|
||||
burnDuration = json['burnDuration'],
|
||||
isMsgDestruct = json['isMsgDestruct'],
|
||||
msgDestructTime = json['msgDestructTime'],
|
||||
groupAtType = json['groupAtType'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['userID'] = userID;
|
||||
data['groupID'] = groupID;
|
||||
data['recvMsgOpt'] = recvMsgOpt;
|
||||
data['isPinned'] = isPinned;
|
||||
data['isPrivateChat'] = isPrivateChat;
|
||||
data['ex'] = ex;
|
||||
data['burnDuration'] = burnDuration;
|
||||
data['isMsgDestruct'] = isMsgDestruct;
|
||||
data['msgDestructTime'] = msgDestructTime;
|
||||
data['groupAtType'] = groupAtType;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -74,48 +74,6 @@ class UserInfo {
|
||||
int get hashCode => userID.hashCode;
|
||||
}
|
||||
|
||||
class FullUserInfo {
|
||||
/// User's public information
|
||||
PublicUserInfo? publicInfo;
|
||||
|
||||
/// Information visible only to friends
|
||||
FriendInfo? friendInfo;
|
||||
|
||||
/// Blacklist information
|
||||
BlacklistInfo? blackInfo;
|
||||
|
||||
FullUserInfo.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;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['publicInfo'] = this.publicInfo?.toJson();
|
||||
data['friendInfo'] = this.friendInfo?.toJson();
|
||||
data['blackInfo'] = this.blackInfo?.toJson();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
String get userID {
|
||||
return publicInfo?.userID ?? friendInfo?.userID ?? blackInfo?.userID ?? '';
|
||||
}
|
||||
|
||||
String get nickname {
|
||||
return publicInfo?.nickname ?? friendInfo?.nickname ?? blackInfo?.nickname ?? '';
|
||||
}
|
||||
|
||||
String get faceURL {
|
||||
return publicInfo?.faceURL ?? friendInfo?.faceURL ?? blackInfo?.faceURL ?? '';
|
||||
}
|
||||
|
||||
String get showName {
|
||||
return friendInfo?.nickname ?? nickname;
|
||||
}
|
||||
}
|
||||
|
||||
class PublicUserInfo {
|
||||
/// User ID
|
||||
String? userID;
|
||||
|
||||
Reference in New Issue
Block a user