11 releases (7 breaking)

0.18.0 Jan 5, 2019
0.17.1 Dec 13, 2018
0.16.0 Oct 3, 2018
0.15.2 Sep 20, 2018
0.1.0 Aug 21, 2018

#36 in HTTP client

Download history 25/week @ 2018-10-11 77/week @ 2018-10-18 11/week @ 2018-10-25 32/week @ 2018-11-01 100/week @ 2018-11-08 124/week @ 2018-11-15 60/week @ 2018-11-22 30/week @ 2018-11-29 78/week @ 2018-12-06 74/week @ 2018-12-13 23/week @ 2018-12-20 57/week @ 2018-12-27 17/week @ 2019-01-03

241 downloads per month

MIT/Apache

609KB
5K SLoC

Rust 4.5K SLoC // 0.2% comments JavaScript 885 SLoC // 0.1% comments

Elefren

A Wrapper for the Mastodon API.

Build Status Build Status Coverage Status crates.io Docs MIT/APACHE-2.0

Documentation

A wrapper around the API for Mastodon

Installation

To add elefren to your project, add the following to the [dependencies] section of your Cargo.toml

elefren = "0.17"

Usage

To use this crate in your project, add this to your crate root (lib.rs, main.rs, etc):

extern crate elefren;

Example

extern crate elefren;

use std::error::Error;

use elefren::prelude::*;
use elefren::helpers::toml; // requires `features = ["toml"]`
use elefren::helpers::cli;

fn main() -> Result<(), Box<Error>> {
    let mastodon = if let Ok(data) = toml::from_file("mastodon-data.toml") {
        Mastodon::from(data)
    } else {
        register()?
    };

    let you = mastodon.verify_credentials()?;

    println!("{:#?}", you);

    Ok(())
}

fn register() -> Result<Mastodon, Box<Error>> {
    let registration = Registration::new("https://mastodon.social")
                                    .client_name("elefren-examples")
                                    .build()?;
    let mastodon = cli::authenticate(registration)?;

    // Save app data for using on the next run.
    toml::to_file(&*mastodon, "mastodon-data.toml")?;

    Ok(mastodon)
}

Dependencies

~17MB
~435K SLoC