getMessagesByTimestamp method

Future<List<BaseMessage>> getMessagesByTimestamp(
  1. int timestamp,
  2. MessageListParams params
)

Retrieves previous or next messages based on the timestamp in a specific channel.

The timestamp to be the reference point for messages to retrieve, in Unix milliseconds format.

Implementation

Future<List<BaseMessage>> getMessagesByTimestamp(
  int timestamp,
  MessageListParams params,
) async {
  sbLog.i(StackTrace.current, 'timestamp: $timestamp');
  checkUnsupportedAction();

  if (timestamp <= 0) {
    throw InvalidParameterException();
  }

  if (channelType == ChannelType.group) {
    params.showSubChannelMessagesOnly = false;
  }

  return await chat.apiClient
      .send<List<BaseMessage>>(ChannelMessagesGetRequest(
    chat,
    channelType: channelType,
    channelUrl: channelUrl,
    params: params.toJson(),
    timestamp: timestamp,
  ));
}