getFileInfosForPost method

Future<List<MmFileInfo>?> getFileInfosForPost(
  1. String postId, {
  2. bool? includeDeleted,
})

Get file info for post

Gets a list of file information objects for the files attached to a post. ##### Permissions Must have read_channel permission for the channel the post is in.

Parameters:

  • String postId (required): ID of the post

  • bool includeDeleted: Defines if result should include deleted posts, must have 'manage_system' (admin) permission.

Implementation

Future<List<MmFileInfo>?> getFileInfosForPost(
  String postId, {
  bool? includeDeleted,
}) async {
  final response = await getFileInfosForPostWithHttpInfo(
    postId,
    includeDeleted: includeDeleted,
  );
  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<MmFileInfo>') as List).cast<MmFileInfo>().toList();
  }
  return null;
}