pub struct Page { /* private fields */ }
Expand description
A Page
represents a wiki page on a specific wiki (Bot
). You can get
metadata about a page, its contents (in HTML or wikitext) and edit the
page.
Pages are obtained by calling bot.page("<title>")?
. Each page is Sync
and designed to easily Clone
d so it can be sent across multiple threads
for concurrent processing.
Most metadata lookups are internally batched and cached so it might not
reflect the live state on the wiki if someone has edited or modified the
page in the meantime. To get fresh information create a new Page
instance.
Saving a page will respect {{nobots}}
(if not disabled), wait as needed
for the configured rate limit and automatically implement edit conflict
detection.
Implementations§
source§impl Page
impl Page
sourcepub fn as_title(&self) -> &Title
pub fn as_title(&self) -> &Title
Get a reference to the underlying mwtitle::Title
sourcepub fn is_category(&self) -> bool
pub fn is_category(&self) -> bool
Whether this page refers to a category
sourcepub async fn id(&self) -> Result<Option<u32>>
pub async fn id(&self) -> Result<Option<u32>>
Get the page’s internal database ID, if it exists
sourcepub async fn is_redirect(&self) -> Result<bool>
pub async fn is_redirect(&self) -> Result<bool>
Whether the page is a redirect or not
sourcepub async fn associated_page(&self) -> Result<Page>
pub async fn associated_page(&self) -> Result<Page>
The associated page for this page (subject page for a talk page or talk page for a subject page)
sourcepub async fn redirect_target(&self) -> Result<Option<Page>>
pub async fn redirect_target(&self) -> Result<Option<Page>>
If this page is a redirect, get the Page
it targets
sourcepub async fn html(&self) -> Result<ImmutableWikicode>
pub async fn html(&self) -> Result<ImmutableWikicode>
Get Parsoid HTML for self.baserevid if it’s set, or the latest revision otherwise
sourcepub async fn revision_html(&self, revid: u64) -> Result<ImmutableWikicode>
pub async fn revision_html(&self, revid: u64) -> Result<ImmutableWikicode>
Get Parsoid HTML for the specified revision