Crate megalodon

Source
Expand description

§Megalodon

The megalodon is a client library for Mastodon and Pleroma. It provides REST API and streaming method which uses WebSocket. By using this library, you can take Mastodon and Pleroma with the same interface.

§Making Mastodon request

For a request without authentication.

let client = megalodon::generator(
  megalodon::SNS::Mastodon,
  String::from("https://fedibird.com"),
  None,
  None,
)?;
let res = client.get_instance().await?;
println!("{:#?}", res.json());

§Making Mastodon request with authentication

For a request with authentication.

let client = megalodon::generator(
  megalodon::SNS::Mastodon,
  String::from("https://fedibird.com"),
  Some(String::from("your access token")),
  None,
)?;
let res = client.verify_account_credentials().await?;
println!("{:#?}", res.json());

Re-exports§

pub use self::megalodon::Megalodon;
pub use detector::detector;
pub use streaming::Streaming;

Modules§

default
Default values
detector
entities
Megalodon entities
error
Own errors
firefish
FireFish related modules
friendica
Friendica related modules
gotosocial
Gotosocial related modules
mastodon
Mastodon related modules
megalodon
Megalodon modules
oauth
OAuth related modules
pixelfed
Pixelfed related modules
pleroma
Pleroma related modules
response
Response modules
streaming
Streaming modules

Enums§

SNS
Which SNS.

Functions§

generator
Generate an API client which satisfies megalodon trait.