[−][src]Struct parsoid::Client
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]
&'_ self,
wikitext: &'_ str
) -> Result<Wikicode>
Get a Wikicode
instance for the specified wikitext
pub async fn transform_to_html_raw<'_, '_>(
&'_ self,
wikitext: &'_ str
) -> Result<String>
[src]
&'_ self,
wikitext: &'_ str
) -> Result<String>
Get the Parsoid HTML for the specified wikitext
pub async fn transform_to_wikitext<'_, '_>(
&'_ self,
code: &'_ Wikicode
) -> Result<String>
[src]
&'_ self,
code: &'_ Wikicode
) -> Result<String>
Get the wikitext for the specified Parsoid HTML
pub async fn transform_to_wikitext_raw<'_, '_>(
&'_ self,
html: &'_ str
) -> Result<String>
[src]
&'_ self,
html: &'_ str
) -> Result<String>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,