listPublicArchivedThreads method

Future<ThreadList> listPublicArchivedThreads(
  1. Snowflake id,
  2. {DateTime? before,
  3. int? limit}
)

List the public archived threads in a channel.

Implementation

Future<ThreadList> listPublicArchivedThreads(Snowflake id, {DateTime? before, int? limit}) async {
  final route = HttpRoute()
    ..channels(id: id.toString())
    ..threads()
    ..archived()
    ..public();
  final request = BasicRequest(
    route,
    queryParameters: {
      if (before != null) 'before': before.toIso8601String(),
      if (limit != null) 'limit': limit.toString(),
    },
  );

  final response = await client.httpHandler.executeSafe(request);
  // TODO: Can we provide the guild ID?
  final threadList = parseThreadList(response.jsonBody as Map<String, Object?>);

  client.updateCacheWith(threadList);
  return threadList;
}