Implementation
Future<FileMessage> sendFileMessage({
required ChannelType channelType,
required String channelUrl,
required FileMessageParams params,
String? senderId,
List<Thumbnail>? thumbnails,
bool markAsRead = false,
bool requireAuth = false,
List<String>? additionalMentionedUserIds,
}) async {
final url = endpoint.Channels.channelurl_messages.format([
channelType.urlString,
channelUrl,
]);
final body = <String, dynamic>{
'message_type': CommandType.fileMessage,
'user_id': senderId ?? currentUserId,
'mark_as_read': markAsRead,
'require_auth': requireAuth,
if (additionalMentionedUserIds != null)
'mentioned_user_ids': additionalMentionedUserIds,
};
body.addAll(params.toJson());
body.removeWhere((key, value) => value == null);
final res = await client.post(url: url, body: body);
return BaseMessage.msgFromJson<FileMessage>(res,
channelType: channelType)!; //mark!
}