Expand description
Rust client library for the MediaWiki Action API.
§Quick start
use mediawiki::prelude::*;
let api = Api::new("https://en.wikipedia.org/w/api.php").await.unwrap();
// Fetch the first five pages starting with "Albert"
let result = ActionApiList::allpages()
.apprefix("Albert")
.aplimit(5)
.run(&api)
.await
.unwrap();See prelude for the full set of re-exported types and traits.
Re-exports§
pub use crate::api::Api;pub use crate::api_sync::ApiSync;pub use crate::api_utils::MediaWikiApi;pub use crate::media_wiki_error::MediaWikiError;pub use crate::page::Page;pub use crate::revision::Revision;pub use crate::title::Title;pub use crate::user::User;pub use reqwest;
Modules§
- action_
api - api
- The
Apiclass serves as a universal interface to a MediaWiki API. - api_
sync - The
ApiSyncclass serves as a universal interface to a MediaWiki API. This sync version is kept for backwards compatibility. - api_
utils - Shared utilities and trait for
ApiandApiSync. - media_
wiki_ error - page
- The
Pageclass deals with operations done on pages, like editing. - page_
categories - Typed representations of MediaWiki
action=query&prop=categoriesresults. - page_
info - Typed representations of MediaWiki
action=query&prop=inforesults. - page_
links - Typed representations of MediaWiki
action=query&prop=linksresults. - page_
query - Generic infrastructure for parsing paginated MediaWiki
action=queryresults into typed Rust collections. - page_
revisions - Typed representations of MediaWiki
action=query&prop=revisionsresults. - prelude
- revision
- The
Revisionclass deals with page revisions. - title
- The
Titleclass deals with page titles and namespaces - user
- The
Userclass deals with the (current) ApiSync user.
Macros§
- hashmap
- To quickly create a hashmap.
Example:
hashmap!["action"=>"query","meta"=>"siteinfo","siprop"=>"general|namespaces|namespacealiases|libraries|extensions|statistics"]