getFlaggedPostsForUser method

Future<List<MmPostList>?> getFlaggedPostsForUser(
  1. String userId, {
  2. String? teamId,
  3. String? channelId,
  4. int? page,
  5. int? perPage,
})

Get a list of flagged posts

Get a page of flagged posts of a user provided user id string. Selects from a channel, team, or all flagged posts by a user. Will only return posts from channels in which the user is member. ##### Permissions Must be user or have manage_system permission.

Parameters:

  • String userId (required): ID of the user

  • String teamId: Team ID

  • String channelId: Channel ID

  • int page: The page to select

  • int perPage: The number of posts per page

Implementation

Future<List<MmPostList>?> getFlaggedPostsForUser(
  String userId, {
  String? teamId,
  String? channelId,
  int? page,
  int? perPage,
}) async {
  final response = await getFlaggedPostsForUserWithHttpInfo(
    userId,
    teamId: teamId,
    channelId: channelId,
    page: page,
    perPage: perPage,
  );
  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) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<MmPostList>') as List).cast<MmPostList>().toList();
  }
  return null;
}