invite method

Future<void> invite(
  1. dynamic redditor, {
  2. List<ModeratorPermission> permissions = const <ModeratorPermission>[],
})

Invite redditor to be a moderator of this subreddit. /// redditor is either a RedditorRef or username. If permissions is not provided, the +all permission will be used. Otherwise, permissions should specify the subset of permissions to grant. If the empty list is provided, no permissions are granted (default).

Implementation

Future<void> invite(/* RedditorRef, String */ redditor,
    {List<ModeratorPermission> permissions =
        const <ModeratorPermission>[]}) async {
  final data = <String, String>{
    'name': _redditorNameHelper(redditor),
    'type': 'moderator_invite',
    'api_type': 'json',
  };
  data.addAll(_handlePermissions(permissions));
  return await _subreddit.reddit.post(
      apiPath['friend']
          .replaceAll(SubredditRef._subredditRegExp, _subreddit.displayName),
      data);
}