MessageMetaArrayAddRequest constructor

MessageMetaArrayAddRequest({
  1. required BaseMessage message,
  2. required List<MessageMetaArray> metaArrays,
})

Implementation

MessageMetaArrayAddRequest({
  required BaseMessage message,
  required List<MessageMetaArray> metaArrays,
}) : super() {
  if (message is UserMessage) {
    cmd = CommandString.userMessageUpdate;
  } else if (message is FileMessage) {
    cmd = CommandString.fileMessageUpdate;
  } else {
    throw InvalidParameterError();
  }

  payload.addAll({
    'channel_url': message.channelUrl,
    'msg_id': message.messageId,
    'metaarray': {
      'array': metaArrays.map((e) => e.toJson()).toList(),
      'mode': MetaArrayUpdateMode.add.asString(),
      'upsert': true
    },
  });
}