forked from MightyPork/elefren-fork
Change Mastodon::from_data to just Mastodon::from
This commit is contained in:
@@ -15,7 +15,7 @@ use serde::Deserialize;
|
||||
/// # redirect: "".into(),
|
||||
/// # token: "".into(),
|
||||
/// # };
|
||||
/// let client = Mastodon::from_data(data);
|
||||
/// let client = Mastodon::from(data);
|
||||
/// let statuses = client.statuses("user-id", None)?;
|
||||
/// for status in statuses.items_iter() {
|
||||
/// // do something with `status`
|
||||
|
||||
+13
-11
@@ -438,8 +438,18 @@ impl Mastodon {
|
||||
}
|
||||
}
|
||||
|
||||
methods![get, post, delete,];
|
||||
|
||||
fn route(&self, url: &str) -> String {
|
||||
let mut s = (*self.base).to_owned();
|
||||
s += url;
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Data> for Mastodon {
|
||||
/// Creates a mastodon instance from the data struct.
|
||||
pub fn from_data(data: Data) -> Self {
|
||||
fn from(data: Data) -> Mastodon {
|
||||
let mut headers = Headers::new();
|
||||
headers.set(Authorization(Bearer { token: (*data.token).to_owned() }));
|
||||
|
||||
@@ -449,14 +459,6 @@ impl Mastodon {
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
||||
methods![get, post, delete,];
|
||||
|
||||
fn route(&self, url: &str) -> String {
|
||||
let mut s = (*self.base).to_owned();
|
||||
s += url;
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl MastodonClient for Mastodon {
|
||||
@@ -586,7 +588,7 @@ impl MastodonClient for Mastodon {
|
||||
/// # redirect: "".into(),
|
||||
/// # token: "".into(),
|
||||
/// # };
|
||||
/// let client = Mastodon::from_data(data);
|
||||
/// let client = Mastodon::from(data);
|
||||
/// let statuses = client.statuses("user-id", None)?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
@@ -604,7 +606,7 @@ impl MastodonClient for Mastodon {
|
||||
/// # redirect: "".into(),
|
||||
/// # token: "".into(),
|
||||
/// # };
|
||||
/// let client = Mastodon::from_data(data);
|
||||
/// let client = Mastodon::from(data);
|
||||
/// let request = StatusesRequest::default()
|
||||
/// .only_media();
|
||||
/// let statuses = client.statuses("user-id", request)?;
|
||||
|
||||
Reference in New Issue
Block a user