getThreadedMessagesByTimestamp method

Future<ThreadedMessages> getThreadedMessagesByTimestamp(
  1. int timestamp,
  2. ThreadedMessageListParams params
)

Retrieves the threaded replies of the current message depending on the timestamp. If the current message doesn’t have replies, the result is an empty list. The result is passed to handler as list.

Specifies the timestamp to be the reference point of the retrieval, in Unix milliseconds format. params for getting thread message list. See ThreadedMessageListParams.

Implementation

Future<ThreadedMessages> getThreadedMessagesByTimestamp(
  int timestamp,
  ThreadedMessageListParams params,
) async {
  sbLog.i(StackTrace.current, 'timestamp: $timestamp');

  final result = await chat.apiClient.send<List<BaseMessage>>(
    ChannelMessagesGetRequest(
      chat,
      channelType: channelType,
      channelUrl: channelUrl,
      params: params.toJson(),
      timestamp: timestamp,
      parentMessageId: messageId,
    ),
  );

  return ThreadedMessages(
    parentMessage: result.first,
    threadMessages: result.sublist(1),
  );
}