redditwarp.siteprocs.wiki.SYNC#

class redditwarp.siteprocs.wiki.SYNC.WikiProcedures(client: Client)[source]#

Bases: object

class Page(outer: WikiProcedures)[source]#

Bases: object

read(sr: str, page: str) WikiPage[source]#

Get a wiki page.

Parameters:
  • sr (str) –

  • page (str) –

Return type:

WikiPage

Raises:

redditwarp.exceptions.RedditError

  • PAGE_NOT_FOUND:

    The specified wiki page does not exist.

  • INVALID_REVISION:

    The specified revision UUID does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

edit(sr: str, page: str, body: str, *, message: str = '') None[source]#

Edit a wiki page.

If the specifed content matches the current content of the wiki page, the edit will not go through.

Parameters:
  • sr (str) –

  • page (str) –

  • body (str) –

  • message (str) – A commit message.

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • WIKI_CREATE_ERROR:

    The specified wiki page does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

revert(sr: str, page: str, revision: str) None[source]#

Revert a wiki page to a previous revision.

This creates a new edit with content matching that of the specified revision.

The revision message will look something like ‘reverted back 53 minutes’.

Parameters:
  • sr (str) –

  • page (str) –

  • revision (str) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • INVALID_REVISION:

    The specified revision UUID does not exist.

revisions(sr: str, page: str, amount: int | None = None) ImpartedPaginatorChainingIterator[WikiPageRevisionsPaginator, WikiPageRevision][source]#

Get wiki page revision log entries.

Parameters:
  • sr (str) –

  • page (str) –

  • amount (Optional[int]) –

Return type:

WikiPageRevisionsPaginator, WikiPageRevision]

Raises:

redditwarp.exceptions.RedditError

  • WIKI_DISABLED:

    The specified subreddit does not have wikis enabled.

  • PAGE_NOT_FOUND:

    The specified wiki page does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

discussions(sr: str, page: str, amount: int | None = None) ImpartedPaginatorChainingIterator[SubmissionListingPaginator, Submission][source]#

Get link submissions linking to a particular wiki page.

Parameters:
  • sr (str) –

  • page (str) –

  • amount (Optional[int]) –

Return type:

WikiPageRevisionsPaginator, WikiPageRevision]

Raises:

redditwarp.exceptions.RedditError

  • WIKI_DISABLED:

    The specified subreddit does not have wikis enabled.

  • PAGE_NOT_FOUND:

    The specified wiki page does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

get_settings(sr: str, page: str) WikiPageSettings[source]#

Retrieve the current permission settings for a wiki page.

Parameters:
  • sr (str) –

  • page (str) –

Return type:

~.models.wiki_SYNC.WikiPageSettings

Raises:

redditwarp.exceptions.RedditError

  • MOD_REQUIRED:

    You are not a moderator of the specified subreddit.

  • WIKI_DISABLED:

    The specified subreddit does not have wikis enabled.

  • PAGE_NOT_FOUND:

    The specified wiki page does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

set_settings(sr: str, page: str, *, permlevel: int, indexed: bool) WikiPageSettings[source]#

Update the permissions and visibility of a particular wiki page.

Parameters:
  • sr (str) –

  • page (str) –

  • permlevel (int) –

    Permission level indicating who can edit this wiki page.

    ”who can edit this page?”

    0: “use subreddit wiki permissions” 1: “only approved wiki contributors for this page may edit” 2: “only mods may edit and view”

  • indexed (bool) – Whether this wiki page is to be indexed on the wiki page list.

Return type:

~.models.wiki_SYNC.WikiPageSettings

Raises:
add_editor(sr: str, page: str, username: str) None[source]#

Add a user as an editor for a wiki page.

If the user is already added, it is treated as a success.

Parameters:
  • sr (str) –

  • page (str) –

  • username (str) –

Return type:

None

Raises:

redditwarp.exceptions.RedditError

  • WIKI_DISABLED:

    The specified subreddit does not have wikis enabled.

  • UNKNOWN_USER:

    The specified user does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

remove_editor(sr: str, page: str, username: str) None[source]#

Remove a user as an editor for a wiki page.

Behaves similarly to add_editor().

property page: None#
revisions(sr: str, amount: int | None = None) ImpartedPaginatorChainingIterator[WikiPageRevisionsPaginator, WikiPageRevision][source]#

Get a revision log for all wiki pages.

Parameters:
  • sr (str) –

  • amount (Optional[int]) –

Return type:

WikiPageRevisionsPaginator, WikiPageRevision]

Raises:

redditwarp.exceptions.RedditError

  • WIKI_DISABLED:

    The specified subreddit does not have wikis enabled.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

list_pages(sr: str) Sequence[str][source]#

Get a list of wiki pages in a subreddit.

Parameters:

sr (str) –

Return type:

Sequence[str]

Raises:

redditwarp.exceptions.RedditError

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.

toggle_revision_hidden(sr: str, page: str, revision: str) bool[source]#

Toggle the public visibility of a wiki page revision.

Parameters:
  • sr (str) –

  • page (str) –

  • revision (str) –

Return type:

Sequence[str]

Raises:

redditwarp.exceptions.RedditError

  • PAGE_NOT_FOUND:

    The specified wiki page does not exist.

  • INVALID_REVISION:

    The specified revision UUID does not exist.

  • private:

    You do not have access to the specified subreddit; it is private.

  • banned:

    You do not have access to the specified subreddit; it is banned.