buildUpdateUserMessage static method

Command buildUpdateUserMessage(
  1. String channelUrl,
  2. int messageId,
  3. UserMessageParams params
)

Implementation

static Command buildUpdateUserMessage(
  String channelUrl,
  int messageId,
  UserMessageParams params,
) {
  List<String>? mentionedUserList;
  if (params.mentionedUsers != null) {
    mentionedUserList = params.mentionedUsers!.map((e) => e.userId).toList();
  }

  final payload = <String, dynamic>{
    'msg_id': messageId,
    'channel_url': channelUrl,
    'message': params.message,
    '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.userMessageUpdate, payload: payload);
}