setPostUnread method

Future<MmChannelUnreadAt?> setPostUnread(
  1. String userId,
  2. String postId
)

Mark as unread from a post.

Mark a channel as being unread from a given post. ##### 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. Must have edit_other_users permission if the user is not the one marking the post for himself. Minimum server version: 5.18

Parameters:

  • String userId (required): User GUID

  • String postId (required): Post GUID

Implementation

Future<MmChannelUnreadAt?> setPostUnread(
  String userId,
  String postId,
) async {
  final response = await setPostUnreadWithHttpInfo(
    userId,
    postId,
  );
  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),
      'MmChannelUnreadAt',
    ) as MmChannelUnreadAt;
  }
  return null;
}