Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Lichthagel/trakt-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trakt-rust

ci_badge discord_badge docs_badge cratesio_badge

A api wrapper in Rust for trakt.tv.

Installation

Add

trakt = "0.0.2"

to your dependencies

Example

use trakt::TraktApi;

fn main() {
    let api = TraktApi::new(
        "YOUR APP ID".to_owned(),
        None,
    );

    dbg!(api.show("fairy-tail").unwrap());
}

Async

trakt-rust also has an async implementation using futures. If you want to use it add this to your Cargo.toml

[dependencies.trakt]
version = "0.0.2"
default-features = false
features = ["async"]

Example

use tokio::prelude::Future;
use trakt::asyn::TraktApi;

fn fetch() -> impl Future<Item = (), Error = ()> {
    let api = TraktApi::new(
        "CLIENT_ID".to_owned(),
        None,
    );

    api.show("fairy-tail")
        .map(|data| {
            dbg!(data);
        })
        .map_err(|e| {
            panic!(e);
        })
}

fn main() {
    tokio::run(fetch())
}

License

MIT

Powered by

trakt