5 releases

Uses old Rust 2015

0.1.4 Jul 1, 2018
0.1.3 Jun 30, 2018
0.1.2 Jun 28, 2018
0.1.1 Jun 28, 2018
0.1.0 Jun 28, 2018

#781 in #api-client

MIT license

13KB
250 lines

leanpub-rs

An (unofficial) Leanpub API client.

Crate
Documentation

Usage

Add a dependency to the leanpub crate.

[dependencies]
leanpub = "0.1.4"

Now you should be able to use it after you've imported the crate in your application or library.

extern crate leanpub;

use std::path::Path;

fn main() {
    let client = leanpub::Client::new(Option::Some("secret-api-key"));
    let result = client.get_summary("my-book").unwrap();

    println!("Title: {}", result.title);
    println!("Minimum price: {}", result.minimum_price);
    println!("Suggested price: {}", result.suggested_price);

    client.download_preview(
        "my-book",
        Path::new("./my_book.pdf"), 
        leanpub::PreviewFormat::Pdf).unwrap();
}

Dependencies

~8–16MB
~240K SLoC