buildUpdateFileMessage static method

Command buildUpdateFileMessage(
  1. String channelUrl,
  2. int messageId,
  3. FileMessageParams params
)

Implementation

static Command buildUpdateFileMessage(
    String channelUrl, int messageId, FileMessageParams params) {
  List<String>? mentionedUserList;
  if (params.mentionedUsers != null) {
    mentionedUserList = params.mentionedUsers!.map((e) => e.userId).toList();
  }
  final payload = <String, dynamic>{
    'channel_url': channelUrl,
    'msg_id': messageId,
    'data': params.data,
    'custom_type': params.customType,
    'mention_type': params.mentionType,
    'mentioned_user_ids': params.mentionedUserIds ?? mentionedUserList,
  };
  payload.removeWhere((key, value) => value == null);
  return Command(cmd: CommandString.fileMessageUpdate, payload: payload);
}