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? id,
String? type, String? type,
String? cid, String? cid,
this.ownCapabilities = const [],
ChannelConfig? config, ChannelConfig? config,
this.createdBy, this.createdBy,
this.frozen = false, this.frozen = false,
@@ -51,6 +52,10 @@ class ChannelModel {
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final String cid; final String cid;
/// List of user permissions on this channel
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final List<String> ownCapabilities;
/// The channel configuration data /// The channel configuration data
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final ChannelConfig config; final ChannelConfig config;
@@ -101,6 +106,7 @@ class ChannelModel {
'id', 'id',
'type', 'type',
'cid', 'cid',
'own_capabilities',
'config', 'config',
'created_by', 'created_by',
'frozen', 'frozen',
@@ -127,6 +133,7 @@ class ChannelModel {
String? id, String? id,
String? type, String? type,
String? cid, String? cid,
List<String>? ownCapabilities,
ChannelConfig? config, ChannelConfig? config,
User? createdBy, User? createdBy,
bool? frozen, bool? frozen,
@@ -143,6 +150,7 @@ class ChannelModel {
id: id ?? this.id, id: id ?? this.id,
type: type ?? this.type, type: type ?? this.type,
cid: cid ?? this.cid, cid: cid ?? this.cid,
ownCapabilities: ownCapabilities ?? this.ownCapabilities,
config: config ?? this.config, config: config ?? this.config,
createdBy: createdBy ?? this.createdBy, createdBy: createdBy ?? this.createdBy,
frozen: frozen ?? this.frozen, frozen: frozen ?? this.frozen,
@@ -164,6 +172,7 @@ class ChannelModel {
id: other.id, id: other.id,
type: other.type, type: other.type,
cid: other.cid, cid: other.cid,
ownCapabilities: other.ownCapabilities,
config: other.config, config: other.config,
createdBy: other.createdBy, createdBy: other.createdBy,
frozen: other.frozen, frozen: other.frozen,
@@ -10,6 +10,10 @@ ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) => ChannelModel(
id: json['id'] as String?, id: json['id'] as String?,
type: json['type'] as String?, type: json['type'] as String?,
cid: json['cid'] 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 config: json['config'] == null
? null ? null
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>), : ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
@@ -48,6 +52,7 @@ Map<String, dynamic> _$ChannelModelToJson(ChannelModel instance) {
} }
writeNotNull('cid', readonly(instance.cid)); writeNotNull('cid', readonly(instance.cid));
writeNotNull('own_capabilities', readonly(instance.ownCapabilities));
writeNotNull('config', readonly(instance.config)); writeNotNull('config', readonly(instance.config));
writeNotNull('created_by', readonly(instance.createdBy)); writeNotNull('created_by', readonly(instance.createdBy));
val['frozen'] = instance.frozen; val['frozen'] = instance.frozen;