removeMemberships method
- Set<
String> channelIds, { - String? uuid,
- int? limit,
- String? start,
- String? end,
- bool? includeCustomFields,
- bool? includeChannelFields,
- bool? includeChannelCustomFields,
- bool? includeCount = true,
- bool includeChannelStatus = false,
- bool includeChannelType = false,
- bool includeStatus = true,
- bool includeType = true,
- String? filter,
- Set<
String> ? sort, - Keyset? keyset,
- String? using,
Deletes memberships metadata for the specified uuid.
channelIds
is set of channelIds from which specified uuid's membership metadata removed
Returns the updated uuid's channel membership metadata, optionally including the custom data objects for: the uuid's perspective on their membership set ("custom"), the uuid's perspective on the channel ("channel"), and the channel's custom data ("channel.custom").
To include custom
property fields of membership in response, set includeCustomFields
to true
To include channel
metadata fields of uuid's membership in response, set includeChannelFields
to true
To include custom
fields of membership's channel metadata, set includeChannelCustomFields
to true
To omit status
field from membership metadata, set includeStatus
to false
Default is true
.
To omit type
field from membership metadata, set includeType
to false
Default is true
.
To get status
field of channel metadata, set includeChannelStatus
to true
Default is false
.
To omit type
field of channel metadata, set includeChannelType
to true
Default is false
.
- If
uuid
not provided then it picksuuid
from givenkeyset
or PubNub instance'suuid
- If no
uuid
is set in PubNub instance default keyset,keyset
does not hold uuid anduuid
not provided in argument then it throws InvariantException
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<MembershipsResult> removeMemberships(Set<String> channelIds,
{String? uuid,
int? limit,
String? start,
String? end,
bool? includeCustomFields,
bool? includeChannelFields,
bool? includeChannelCustomFields,
bool? includeCount = true,
bool includeChannelStatus = false,
bool includeChannelType = false,
bool includeStatus = true,
bool includeType = true,
String? filter,
Set<String>? sort,
Keyset? keyset,
String? using}) async {
keyset ??= _core.keysets[using];
var manageMembershipMetadata = <String, dynamic>{};
var deleteInputs = <ChannelIdInfo>[];
channelIds.forEach((id) => deleteInputs.add(ChannelIdInfo(id)));
manageMembershipMetadata['delete'] = deleteInputs;
var payload = await _core.parser.encode(manageMembershipMetadata);
var include = <String>{};
if (includeCustomFields != null && includeCustomFields) {
include.add('custom');
}
if (includeChannelFields != null && includeChannelFields) {
include.add('channel');
}
if (includeChannelCustomFields != null && includeChannelCustomFields) {
include.add('channel.custom');
}
if (includeChannelStatus) {
include.add('channel.status');
}
if (includeChannelType) {
include.add('channel.type');
}
if (includeStatus) {
include.add('status');
}
if (includeType) {
include.add('type');
}
var params = ManageMembershipsParams(keyset, payload,
uuid: uuid,
limit: limit,
start: start,
end: end,
include: include,
includeCount: includeCount,
filter: filter,
sort: sort);
return defaultFlow<ManageMembershipsParams, MembershipsResult>(
keyset: keyset,
core: _core,
params: params,
serialize: (object, [_]) => MembershipsResult.fromJson(object));
}