updateFileMessage method

Future<FileMessage> updateFileMessage(
  1. int messageId,
  2. FileMessageUpdateParams params
)

Updates a FileMessage that was previously sent in the channel. Note that the file itself cannot be changed; only the fields stored within the message can be modified.

Implementation

Future<FileMessage> updateFileMessage(
  int messageId,
  FileMessageUpdateParams params,
) async {
  sbLog.i(StackTrace.current);
  checkUnsupportedAction();

  if (messageId <= 0) {
    throw InvalidParameterException();
  }

  final cmd = Command.buildUpdateFileMessage(
    channelUrl,
    messageId,
    params,
  );

  final result = await chat.commandManager.sendCommand(cmd);
  if (result != null) {
    final baseMessage = BaseMessage.getMessageFromJsonWithChat<FileMessage>(
      chat,
      result.payload,
      commandType: cmd.cmd,
    );
    return baseMessage;
  } else {
    throw WebSocketFailedException();
  }
}