setUUIDMetadata method
Sets metadata for the specified uuid in the database. Returns the updated uuid object, optionally including custom properties.
- You can change all of the uuid object's properties, 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 include custom
property fields in response, set includeCustomFields
to true
Omit this parameter if you don't want to retrieve additional metadata.
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
.
uuid
is Unique identifier of an end-user. It may contain up to 92 UTF-8 byte sequences.
Prohibited characters are ,, /, , *, :, channel, non-printable ASCII control characters, and Unicode zero.
- If
uuid
parameter is provied then it sets metadata for given uuid. - In case of null
uuid
it sets metadata for PubNub instance'suuid
- If no
uuid
is set in PubNub instance default keyset,keyset
does not hold uuid anduuid
not provided in method argument then it throws InvariantException
Implementation
Future<SetUuidMetadataResult> setUUIDMetadata(
UuidMetadataInput uuidMetadataInput,
{String? uuid,
bool? includeCustomFields,
bool includeStatus = true,
bool includeType = true,
Keyset? keyset,
String? using}) async {
keyset ??= _core.keysets[using];
Ensure(uuidMetadataInput).isNotNull('uuid metadata input');
var include = <String>{};
if (includeCustomFields != null && includeCustomFields) {
include.add('custom');
}
if (includeStatus) {
include.add('status');
}
if (includeType) {
include.add('type');
}
var payload = await _core.parser.encode(uuidMetadataInput);
var params =
SetUuidMetadataParams(keyset, payload, uuid: uuid, include: include);
return defaultFlow<SetUuidMetadataParams, SetUuidMetadataResult>(
keyset: keyset,
core: _core,
params: params,
serialize: (object, [_]) => SetUuidMetadataResult.fromJson(object));
}