bulkRead method

Future<List<ModmailConversationRef>> bulkRead({
  1. List<SubredditRef>? otherSubreddits,
  2. ModmailState state = ModmailState.all,
})

Mark the conversations for provided subreddits as read.

otherSubreddits: if provided, all messages in the listed subreddits will also be marked as read.

state: can be one of all, archived, highlighted, inprogress, mod, new, notifications, (default: all). "all" does not include internal or archived conversations.

Returns a List of ModmailConversation instances which were marked as read.

Implementation

Future<List<ModmailConversationRef>> bulkRead(
    {List<SubredditRef>? otherSubreddits,
    ModmailState state = ModmailState.all}) async {
  final params = {
    'entity': _buildSubredditList(otherSubreddits),
    'state': modmailStateToString(state),
  };
  final response = await _subreddit.reddit
      .post(apiPath['modmail_bulk_read'], params, objectify: false);
  final ids = response['conversation_ids'] as List;
  return ids.map<ModmailConversationRef>((id) => this(id)).toList();
}