11 releases

0.4.2 Feb 22, 2024
0.4.1 May 15, 2023
0.4.0 Dec 13, 2022
0.3.4 Dec 10, 2022
0.1.0 Jul 19, 2022

#108 in Audio

Download history 176/week @ 2024-02-22 9/week @ 2024-02-29 6/week @ 2024-03-07 2/week @ 2024-03-14

193 downloads per month

MIT/Apache

345KB
6.5K SLoC

Ferrispot

Crates.io docs.rs

A wrapper for the Spotify Web API that (hopefully) doesn't suck (too much) (I think).

A lot of the functionality is largely opinionated for my own use but I'm trying to make the library ergonomic and efficient to use. So far only the endpoints I care about are implemented, but if you need some endpoints implemented, feel free to open an issue.

Features

  • Type-safe clients and model.
  • Asynchronous and synchronous (blocking) clients.
  • Every OAuth authorization flow Spotify supports is implemented.
  • Supports multiple simultaneous user clients.
  • Automatically refreshes access tokens when they expire, where applicable.
  • Reacts to API rate limits using either Tokio's or async-std's sleep functions at your discretion when using an asynchronous client. Synchronous clients block the running thread.

Crate feature flags

  • async (default): enable the asynchronous API.
  • sync: enable the synchronous API.
    • In case neither API is enabled (default-features = false), the crate only includes the object model structure with minimal dependencies on serde and thiserror.
  • tokio_sleep (default): react to API rate limits using Tokio's sleep function.
  • async_std_sleep: react to API rate limits using async-std's sleep function.
    • In case both tokio_sleep and async_std_sleep are enabled, Tokio's sleep function will be used.
    • In case neither are enabled, the library will return a rate limit error when it occurs.
    • These features are meaningless unless the async feature is also enabled.
  • native-tls (default): use native system TLS library for secure connections.
  • rustls-tls: use rustls for secure connections.

Changelog

See CHANGELOG.md.

Attribution

This crate draws a lot of inspiration from:

  • aspotify by Sabrina Jewson, licensed under the MIT license
  • rspotify by Ramsay Leung and Mario Ortiz Manero, licensed under the MIT license

License

Dual-licensed under MIT or Apache 2.0.

Dependencies

~0.4–16MB
~218K SLoC