manageChannelMembers method
- String channelId,
- List<
ChannelMemberMetadataInput> setMetadata, - Set<
String> removeMemberUuids, { - int? limit,
- String? start,
- String? end,
- bool? includeCustomFields,
- bool? includeUUIDFields,
- bool? includeUUIDCustomFields,
- bool? includeCount = true,
- bool includeUUIDStatus = false,
- bool includeUUIDType = false,
- bool includeStatus = true,
- bool includeType = true,
- String? filter,
- Set<
String> ? sort, - Keyset? keyset,
- String? using,
Sets the members's metadata in the specified channel channelId
and/or deletes members uuids
metadata
it returns members paginated list optionally including
the custom data objects for: the channel's perspective on their members set ("custom"),
the channel's perspective of the member ("uuid"), and the uuid's custom data ("uuid.custom").
Provide removeMemberUuids
list of member uuids for which member metadata need to be deleted
To include custom
property fields of member in response, set includeCustomFields
to true
To include uuid
metadata fields of channel's memebrs in response, set includeUUIDFields
to true
To include custom
fields of channel member's uuidMetadata, set includeUUIDCustomFields
to true
To omit status
field from member metadata, set includeStatus
to false
Default is true
.
To omit type
field from member metadata, set includeType
to false
Default is true
.
To get status
field of UUID metadata, set includeUUIDStatus
to true
Default is false
.
To omit type
field of UUID metadata, set includeUUIDType
to true
Default is false
.
Use limit
to specify Number of objects to return in response.
Default is 100, which is also the maximum value.
filter
is a Expression used to filter the results.
Only objects whose properties satisfy the given expression are returned.
Provide start
and end
for Previously-returned cursor bookmark for
fetching the next/previous page.
To omit totalCount
field from paginated list, set includeCount
to false
Default is true
.
You can provide sort
List of attributes to sort by.
Append :asc or :desc to an attribute to specify sort direction.
The default sort direction is ascending.
Implementation
Future<ChannelMembersResult> manageChannelMembers(
String channelId,
List<ChannelMemberMetadataInput> setMetadata,
Set<String> removeMemberUuids,
{int? limit,
String? start,
String? end,
bool? includeCustomFields,
bool? includeUUIDFields,
bool? includeUUIDCustomFields,
bool? includeCount = true,
bool includeUUIDStatus = false,
bool includeUUIDType = false,
bool includeStatus = true,
bool includeType = true,
String? filter,
Set<String>? sort,
Keyset? keyset,
String? using}) async {
keyset ??= _core.keysets[using];
Ensure(channelId).isNotEmpty('channelId');
var manageInput = <String, dynamic>{};
manageInput['set'] = setMetadata;
var deleteInput = <UuIdInfo>[];
removeMemberUuids.forEach((id) => deleteInput.add(UuIdInfo(id)));
manageInput['delete'] = deleteInput;
var membersMetadata = await _core.parser.encode(manageInput);
var include = <String>{};
if (includeCustomFields != null && includeCustomFields) {
include.add('custom');
}
if (includeUUIDFields != null && includeUUIDFields) {
include.add('uuid');
}
if (includeUUIDCustomFields != null && includeUUIDCustomFields) {
include.add('uuid.custom');
}
if (includeUUIDStatus) {
include.add('uuid.status');
}
if (includeUUIDType) {
include.add('uuid.type');
}
if (includeStatus) {
include.add('status');
}
if (includeType) {
include.add('type');
}
var params = ManageChannelMembersParams(keyset, channelId, membersMetadata,
limit: limit,
start: start,
end: end,
include: include,
includeCount: includeCount,
filter: filter,
sort: sort);
return defaultFlow<ManageChannelMembersParams, ChannelMembersResult>(
keyset: keyset,
core: _core,
params: params,
serialize: (object, [_]) => ChannelMembersResult.fromJson(object));
}