[][src]Struct parsoid::Client

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

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

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, 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.