getPostsAroundLastUnreadWithHttpInfo method

Future<Response> getPostsAroundLastUnreadWithHttpInfo(
  1. String userId,
  2. String channelId, {
  3. int? limitBefore,
  4. int? limitAfter,
  5. bool? skipFetchThreads,
  6. bool? collapsedThreads,
  7. bool? collapsedThreadsExtended,
})

Get posts around oldest unread

Get the oldest unread post in the channel for the given user as well as the posts around it. The returned list is sorted in descending order (most recent post first). ##### Permissions Must be logged in as the user or have edit_other_users permission, and must have read_channel permission for the channel. Minimum server version: 5.14

Note: This method returns the HTTP Response.

Parameters:

  • String userId (required): ID of the user

  • String channelId (required): The channel ID to get the posts for

  • int limitBefore: Number of posts before the oldest unread posts. Maximum is 200 posts if limit is set greater than that.

  • int limitAfter: Number of posts after and including the oldest unread post. Maximum is 200 posts if limit is set greater than that.

  • 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<Response> getPostsAroundLastUnreadWithHttpInfo(
  String userId,
  String channelId, {
  int? limitBefore,
  int? limitAfter,
  bool? skipFetchThreads,
  bool? collapsedThreads,
  bool? collapsedThreadsExtended,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/users/{user_id}/channels/{channel_id}/posts/unread'
      .replaceAll('{user_id}', userId)
      .replaceAll('{channel_id}', channelId);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <MmQueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (limitBefore != null) {
    queryParams.addAll(_queryParams('', 'limit_before', limitBefore));
  }
  if (limitAfter != null) {
    queryParams.addAll(_queryParams('', 'limit_after', limitAfter));
  }
  if (skipFetchThreads != null) {
    queryParams.addAll(_queryParams('', 'skipFetchThreads', skipFetchThreads));
  }
  if (collapsedThreads != null) {
    queryParams.addAll(_queryParams('', 'collapsedThreads', collapsedThreads));
  }
  if (collapsedThreadsExtended != null) {
    queryParams.addAll(_queryParams('', 'collapsedThreadsExtended', collapsedThreadsExtended));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}