Crate aspotify[][src]

Expand description

Note: This crate is deprecated in favour of rspotify.

aspotify is an asynchronous client to the Spotify API.

Examples

use aspotify::{Client, ClientCredentials};

// 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 credentials = ClientCredentials::from_env()
    .expect("CLIENT_ID and CLIENT_SECRET not found.");

// Create a Spotify client.
let client = Client::new(credentials);

// Gets the album "Favourite Worst Nightmare" from Spotify, with no specified market.
let album = client.albums().get_album("1XkGORuUX2QGOEIL4EbJKm", None).await.unwrap();

Notes

  • Spotify often imposes limits on endpoints, for example you can’t get more than 50 tracks at once. This crate removes this limit by making multiple requests when necessary.

Re-exports

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

Modules

Endpoint types.

The Spotify Object Model, in deserializable Rust structures.

Structs

A client to the Spotify API.

An object that holds your Spotify Client ID and Client Secret.

The result of a request to a Spotify endpoint.

Enums

Re-export from isocountry.

Re-export from isolanguage_1.

An error caused by the Client::redirected function.

A scope that the user can grant access to.

Functions

Get the URL to redirect the user’s browser to so that the URL can be generated for the Client::redirected function.

Like authorization_url, but you supply your own state.