getPostThread method

Future<MmPostList?> getPostThread(
  1. String postId, {
  2. int? perPage,
  3. String? fromPost,
  4. int? fromCreateAt,
  5. String? direction,
  6. bool? skipFetchThreads,
  7. bool? collapsedThreads,
  8. bool? collapsedThreadsExtended,
})

Get a thread

Get a post and the rest of the posts in the same thread. ##### Permissions Must have read_channel permission for the channel the post is in or if the channel is public, have the read_public_channels permission for the team.

Parameters:

  • String postId (required): ID of a post in the thread

  • int perPage: The number of posts per page

  • String fromPost: The post_id to return the next page of posts from

  • int fromCreateAt: The create_at timestamp to return the next page of posts from

  • String direction: The direction to return the posts. Either up or down.

  • bool skipFetchThreads: Whether to skip fetching threads or not

  • bool collapsedThreads: Whether the client uses CRT or not

  • bool collapsedThreadsExtended: Whether to return the associated users as part of the response or not

Implementation

Future<MmPostList?> getPostThread(
  String postId, {
  int? perPage,
  String? fromPost,
  int? fromCreateAt,
  String? direction,
  bool? skipFetchThreads,
  bool? collapsedThreads,
  bool? collapsedThreadsExtended,
}) async {
  final response = await getPostThreadWithHttpInfo(
    postId,
    perPage: perPage,
    fromPost: fromPost,
    fromCreateAt: fromCreateAt,
    direction: direction,
    skipFetchThreads: skipFetchThreads,
    collapsedThreads: collapsedThreads,
    collapsedThreadsExtended: collapsedThreadsExtended,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'MmPostList',
    ) as MmPostList;
  }
  return null;
}