setChannelMetadata method
Sets metadata for the specified channelId
in the database.
Returns the updated uuid object, optionally including custom properties.
channelId
is Channel identifier. Must not be empty, and may contain up to 92 UTF-8 byte sequences.
Prohibited characters are ,, /, , *, :, channel, non-printable ASCII control characters, and Unicode zero.
- You can change all of the channel's metadata, except its identifier.
- Invalid property names are silently ignored and will not cause a request to fail.
- If you set the "custom" property, you must completely replace it; partial updates are not supported.
- The custom object can only contain scalar values.
To omit status
field from metadata, set includeStatus
to false
Default is true
.
To omit type
field from metadata, set includeType
to false
Default is true
.
To include custom
property fields in response, set includeCustomFields
to true
Omit this parameter if you don't want to retrieve additional metadata.
Implementation
Future<SetChannelMetadataResult> setChannelMetadata(
String channelId, ChannelMetadataInput channelMetadataInput,
{bool? includeCustomFields,
bool includeStatus = true,
bool includeType = true,
Keyset? keyset,
String? using}) async {
keyset ??= _core.keysets[using];
Ensure(channelId).isNotNull('channelId');
Ensure(channelMetadataInput).isNotNull('channelMetadataInput');
var payload = await _core.parser.encode(channelMetadataInput);
var include = <String>{};
if (includeCustomFields != null && includeCustomFields) {
include.add('custom');
}
if (includeStatus) {
include.add('status');
}
if (includeType) {
include.add('type');
}
var params =
SetChannelMetadataParams(keyset, channelId, payload, include: include);
return defaultFlow<SetChannelMetadataParams, SetChannelMetadataResult>(
keyset: keyset,
core: _core,
params: params,
serialize: (object, [_]) => SetChannelMetadataResult.fromJson(object));
}