|
|
@ -1,18 +1,19 @@ |
|
|
|
# Mammut. A API Wrapper for the Mastodon API. |
|
|
|
# Mammut. A API Wrapper for the Mastodon API. |
|
|
|
|
|
|
|
|
|
|
|
### [Documentation](https://docs.rs/mammut/) |
|
|
|
## [Documentation](https://docs.rs/mammut/) |
|
|
|
|
|
|
|
|
|
|
|
A wrapper around the [API](https://github.com/tootsuite/mastodon/blob/master/docs/Using-the-API/API.md#tag) for [Mastodon](https://mastodon.social/) |
|
|
|
A wrapper around the [API](https://github.com/tootsuite/mastodon/blob/master/docs/Using-the-API/API.md#tag) for [Mastodon](https://mastodon.social/) |
|
|
|
|
|
|
|
|
|
|
|
```rust |
|
|
|
```rust |
|
|
|
# extern crate mammut; |
|
|
|
extern crate mammut; |
|
|
|
# fn main() { |
|
|
|
|
|
|
|
# try().unwrap(); |
|
|
|
|
|
|
|
# } |
|
|
|
|
|
|
|
# fn try() -> mammut::Result<()> { |
|
|
|
|
|
|
|
use mammut::Registration; |
|
|
|
use mammut::Registration; |
|
|
|
use mammut::apps::{AppBuilder, Scope}; |
|
|
|
use mammut::apps::{AppBuilder, Scope}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn main() { |
|
|
|
|
|
|
|
run().unwrap(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn run() -> mammut::Result<()> { |
|
|
|
let app = AppBuilder { |
|
|
|
let app = AppBuilder { |
|
|
|
client_name: "mammut_test", |
|
|
|
client_name: "mammut_test", |
|
|
|
redirect_uris: "urn:ietf:wg:oauth:2.0:oob", |
|
|
|
redirect_uris: "urn:ietf:wg:oauth:2.0:oob", |
|
|
@ -29,6 +30,6 @@ let code = String::from("RETURNED_FROM_BROWSER"); |
|
|
|
let mastodon = registration.create_access_token(code)?; |
|
|
|
let mastodon = registration.create_access_token(code)?; |
|
|
|
|
|
|
|
|
|
|
|
println!("{:?}", mastodon.get_home_timeline()?); |
|
|
|
println!("{:?}", mastodon.get_home_timeline()?); |
|
|
|
# Ok(()) |
|
|
|
Ok(()) |
|
|
|
# } |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|