added channel user capabilities

This commit is contained in:
Deven Joshi
2021-11-08 21:29:48 +05:30
parent a3cce7ffff
commit 11b5de6fd7
2 changed files with 14 additions and 0 deletions
@@ -13,6 +13,7 @@ class ChannelModel {
String? id,
String? type,
String? cid,
this.ownCapabilities = const [],
ChannelConfig? config,
this.createdBy,
this.frozen = false,
@@ -51,6 +52,10 @@ class ChannelModel {
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final String cid;
/// List of user permissions on this channel
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final List<String> ownCapabilities;
/// The channel configuration data
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final ChannelConfig config;
@@ -101,6 +106,7 @@ class ChannelModel {
'id',
'type',
'cid',
'own_capabilities',
'config',
'created_by',
'frozen',
@@ -127,6 +133,7 @@ class ChannelModel {
String? id,
String? type,
String? cid,
List<String>? ownCapabilities,
ChannelConfig? config,
User? createdBy,
bool? frozen,
@@ -143,6 +150,7 @@ class ChannelModel {
id: id ?? this.id,
type: type ?? this.type,
cid: cid ?? this.cid,
ownCapabilities: ownCapabilities ?? this.ownCapabilities,
config: config ?? this.config,
createdBy: createdBy ?? this.createdBy,
frozen: frozen ?? this.frozen,
@@ -164,6 +172,7 @@ class ChannelModel {
id: other.id,
type: other.type,
cid: other.cid,
ownCapabilities: other.ownCapabilities,
config: other.config,
createdBy: other.createdBy,
frozen: other.frozen,
@@ -10,6 +10,10 @@ ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) => ChannelModel(
id: json['id'] as String?,
type: json['type'] as String?,
cid: json['cid'] as String?,
ownCapabilities: (json['own_capabilities'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const [],
config: json['config'] == null
? null
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
@@ -48,6 +52,7 @@ Map<String, dynamic> _$ChannelModelToJson(ChannelModel instance) {
}
writeNotNull('cid', readonly(instance.cid));
writeNotNull('own_capabilities', readonly(instance.ownCapabilities));
writeNotNull('config', readonly(instance.config));
writeNotNull('created_by', readonly(instance.createdBy));
val['frozen'] = instance.frozen;