Fixed example code, and {un}follow routes.

This commit is contained in:
Aaron Power
2018-06-29 11:10:50 +01:00
parent bc68726d23
commit 523d83022e
9 changed files with 120 additions and 68 deletions
+2
View File
@@ -2,6 +2,8 @@ use std::fmt;
/// Builder struct for defining your application.
/// ```
/// use mammut::apps::{AppBuilder, Scopes};
///
/// let app = AppBuilder {
/// client_name: "mammut_test",
/// redirect_uris: "urn:ietf:wg:oauth:2.0:oob",
+8 -14
View File
@@ -92,9 +92,8 @@ macro_rules! methods {
macro_rules! paged_routes {
(($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => {
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -116,9 +115,8 @@ macro_rules! paged_routes {
macro_rules! route {
((post multipart ($($param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => {
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -150,9 +148,8 @@ macro_rules! route {
};
(($method:ident ($($param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => {
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -184,9 +181,8 @@ macro_rules! route {
};
(($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => {
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -204,9 +200,8 @@ macro_rules! route_id {
($(($method:ident) $name:ident: $url:expr => $ret:ty,)*) => {
$(
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -220,9 +215,8 @@ macro_rules! route_id {
macro_rules! paged_routes_with_id {
(($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => {
/// Equivalent to `/api/v1/
/// Equivalent to /api/v1/
#[doc = $url]
/// `
///
#[doc = "# Errors"]
/// If `access_token` is not set.
@@ -415,8 +409,8 @@ impl Mastodon {
route_id! {
(get) get_account: "accounts/{}" => Account,
(get) follow: "accounts/{}/follow" => Account,
(get) unfollow: "accounts/{}/unfollow" => Account,
(post) follow: "accounts/{}/follow" => Account,
(post) unfollow: "accounts/{}/unfollow" => Account,
(get) block: "accounts/{}/block" => Account,
(get) unblock: "accounts/{}/unblock" => Account,
(get) mute: "accounts/{}/mute" => Account,
+2
View File
@@ -29,6 +29,8 @@ struct AccessToken {
impl Registration {
/// Construct a new registration process to the instance of the `base` url.
/// ```
/// use mammut::registration::Registration;
///
/// let registration = Registration::new("https://mastodon.social");
/// ```
pub fn new<I: Into<String>>(base: I) -> Self {
+2
View File
@@ -41,6 +41,8 @@ impl StatusBuilder {
/// Create a new status with text.
/// ```
/// use mammut::status_builder::StatusBuilder;
///
/// let status = StatusBuilder::new("Hello World!".into());
/// ```
pub fn new(status: String) -> Self {