update method

Future<WikiPageSettings> update(
  1. bool listed,
  2. WikiPermissionLevel permissionLevel
)

Updates the settings for this WikiPageRef.

listed specifies whether this page appears on the page list. permissionLevel specifies who can edit this page. See WikiPermissionLevel for details.

Returns a new WikiPageSettings object with the updated settings.

Implementation

Future<WikiPageSettings> update(
    bool listed, WikiPermissionLevel permissionLevel) async {
  final data = <String, String>{
    'listed': listed.toString(),
    'permlevel': permissionLevel.index.toString(),
  };
  final url = apiPath['wiki_page_settings']
      .replaceAll(
          WikiPageRef._kSubredditRegExp, wikiPage._subreddit.displayName)
      .replaceAll(WikiPageRef._kPageRegExp, wikiPage.name);
  final result =
      (await wikiPage.reddit.post(url, data, objectify: false))['data'];
  return WikiPageSettings._(wikiPage, result);
}