Crate aspotify

Source
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§

endpoints
Endpoint types.
model
The Spotify Object Model, in deserializable Rust structures.

Structs§

Client
A client to the Spotify API.
ClientCredentials
An object that holds your Spotify Client ID and Client Secret.
Response
The result of a request to a Spotify endpoint.

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.
RedirectedError
An error caused by the Client::redirected function.
Scope
A scope that the user can grant access to.

Functions§

authorization_url
Get the URL to redirect the user’s browser to so that the URL can be generated for the Client::redirected function.
authorization_url_with_state
Like authorization_url, but you supply your own state.