56 releases (12 breaking)

0.13.4 Apr 15, 2024
0.13.2 Mar 14, 2024
0.11.8 Dec 28, 2023
0.11.6 Nov 5, 2023
0.2.5 Nov 26, 2022

#17 in WebSocket

Download history 4/week @ 2024-01-01 40/week @ 2024-01-08 28/week @ 2024-01-15 38/week @ 2024-01-22 43/week @ 2024-01-29 72/week @ 2024-02-05 169/week @ 2024-02-12 89/week @ 2024-02-19 166/week @ 2024-02-26 171/week @ 2024-03-04 691/week @ 2024-03-11 97/week @ 2024-03-18 49/week @ 2024-03-25 334/week @ 2024-04-01 105/week @ 2024-04-08 189/week @ 2024-04-15

700 downloads per month
Used in 4 crates

MIT license

1MB
26K SLoC

Megalodon

Crates.io docs.rs Build GitHub

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

Supporting

  • Mastodon
  • Pleroma
  • Friendica
  • Firefish
  • Gotosocial
  • Akkoma (Unofficial)

Features

  • REST API
  • Admin API
  • WebSocket for Streamings

Usage

Add your Cargo.toml like this:

[dependencies]
megalodon = { version = "0.11" }

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());

License

The software is available as open source under the terms of the Apache License 2.0.

Dependencies

~12–28MB
~454K SLoC