Struct parsoid::Client[][src]

pub struct Client { /* fields omitted */ }

HTTP client to get Parsoid HTML from MediaWiki's Rest APIs

Note: This requires the http feature is enabled (it is by default).

Implementations

impl Client[src]

pub fn new(base_url: &str, user_agent: &str) -> Result<Self>[src]

Create a new Client. base_url should either point to rest.php or Restbase. For Wikimedia projects it would look something like: https://en.wikipedia.org/api/rest_v1. For other wikis it might be: https://wiki.example.org/rest.php/wiki.example.org/v3.

(Note: no trailing slash on either endpoint style.)

pub async fn get(&self, page: &str) -> Result<Wikicode>[src]

Get a Wikicode instance for the specified page

pub async fn get_raw(&self, page: &str) -> Result<String>[src]

Get the Parsoid HTML for the specified page

pub async fn transform_to_html(&self, wikitext: &str) -> Result<Wikicode>[src]

Get a Wikicode instance for the specified wikitext

pub async fn transform_to_html_raw(&self, wikitext: &str) -> Result<String>[src]

Get the Parsoid HTML for the specified wikitext

pub async fn transform_to_wikitext(&self, code: &Wikicode) -> Result<String>[src]

Get the wikitext for the specified Parsoid HTML

pub async fn transform_to_wikitext_raw(&self, html: &str) -> Result<String>[src]

Get the wikitext for the specified Parsoid HTML

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.