getMessagesByMessageId method
Retrieves previous or next messages based on the message ID in a specific channel.
The messageId
to be the reference point for messages to retrieve.
Implementation
Future<List<RootMessage>> getMessagesByMessageId(
int messageId,
MessageListParams params,
) async {
sbLog.i(StackTrace.current, 'messageId: $messageId');
if (messageId <= 0) {
throw InvalidParameterException();
}
if (channelType == ChannelType.group) {
params.showSubChannelMessagesOnly = false;
}
final res = await chat.apiClient.send<ChannelMessagesGetResponse>(
ChannelMessagesGetRequest(
chat,
channelType: channelType,
channelUrl: channelUrl,
params: params.toJson(),
messageId: messageId,
),
);
return res.messages;
}