Implementation
static Command buildUpdateMessageMetaArray(
BaseMessage message,
List<MessageMetaArray> metaArrays,
MetaArrayUpdateMode updateMode,
bool upsert) {
if (message.messageId <= 0) {
throw InvalidParameterError();
}
if (metaArrays.isEmpty) {
throw InvalidParameterError();
}
String type;
if (message is UserMessage) {
type = CommandString.userMessageUpdate;
} else if (message is FileMessage) {
type = CommandString.fileMessageUpdate;
} else {
throw InvalidParameterError();
}
return Command(cmd: type, payload: {
'channel_url': message.channelUrl,
'msg_id': message.messageId,
'metaarray': {
'array': metaArrays.map((e) => e.toJson()).toList(),
'mode': updateMode.asString(),
'upsert': upsert
}
});
}