FileMessage.fromParams constructor

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

Implementation

factory FileMessage.fromParams({
  required FileMessageParams params,
  required BaseChannel channel,
}) {
  final msg = FileMessage(
    requestId: Uuid().v1(),
    url: params.uploadFile.url ?? '',
    name: params.uploadFile.name,
    size: params.uploadFile.fileSize ?? 0,
    // thumbnails
    requireAuth: false,
    localFile: params.uploadFile.file,
    // requestId
    // message
    messageId: 0,
    // sending Status
    // sender
    channelUrl: channel.channelUrl,
    channelType: channel.channelType,
    mentionedUserIds: params.mentionedUserIds,
    mentionType: params.mentionType,
    // requestedMentionUserIds
    createdAt: DateTime.now().millisecondsSinceEpoch,
    // updatedAt
    parentMessageId: params.parentMessageId,
    // parentMessageText
    // threadInfo
    metaArrays: params.metaArrays,
    customType: params.customType,
    // messageSurvivalSeconds
    // forceUpdateLastMessage
    // isSilent
    // errorCode
    // isOperatorMessage
    data: params.data,
    // ogMetaData
    // reactions
    replyToChannel: params.replyToChannel,
    // parentMessage
    isPinnedMessage: params.isPinnedMessage,
  );
  return msg;
}