[][src]Crate aspotify

aspotify is an asynchronous client to the Spotify API. It is similar to rspotify, but is asynchronous and has a very different API.

Everything is in modules, but that is just to make documentation cleaner; re-exports make everything flat in the crate root.

Examples

use aspotify::{ClientCredentials, CCFlow};

// CCFlow is an object that holds your client credentials, and caches access tokens if it can.
// This from_env function tries to read the CLIENT_ID and CLIENT_SECRET environment variables.
// You can use the dotenv crate to read it from a file.
let flow = CCFlow::new(ClientCredentials::from_env()
    .expect("CLIENT_ID and CLIENT_SECRET not found.")
);

// Gets the album "Favourite Worst Nightmare" from Spotify, with no specified market.
let album = aspotify::get_album(
    &flow.send().await.unwrap(),
    "1XkGORuUX2QGOEIL4EbJKm",
    None
).await.unwrap();

Re-exports

pub use authorization::*;
pub use endpoints::*;
pub use model::*;

Modules

authorization

Everything relating to authorization for the Spotify endpoints.

endpoints

Endpoint functions to the Spotify API.

model

The Spotify Object Model, in deserializable Rust structures.

Enums

CountryCode

Re-export from isocountry. An enumeration of all ISO-3166-1 country codes

LanguageCode

Re-export from isolanguage-1. An enumeration of all ISO 639-1 language codes.