FileMessage.fromParams constructor

FileMessage.fromParams(
  1. {required FileMessageCreateParams params,
  2. required BaseChannel channel}
)

Implementation

factory FileMessage.fromParams({
  required FileMessageCreateParams params,
  required BaseChannel channel,
}) {
  final message = FileMessage(
    requestId: const Uuid().v1(),
    url: params.fileInfo.fileUrl ?? '',
    messageId: 0,
    file: params.fileInfo.file,
    name: params.fileInfo.fileName,
    size: params.fileInfo.fileSize ?? 0,
    channelType: channel.channelType,
    channelUrl: channel.channelUrl,
    mentionType: params.mentionType,
    createdAt: DateTime.now().millisecondsSinceEpoch,
    requireAuth: false,
    replyToChannel: params.replyToChannel,
    // Check: Is needed to add other fields.
  );
  return message;
}