5 releases

0.0.4 Sep 13, 2023
0.0.3 Jun 19, 2023
0.0.2 Mar 5, 2023
0.0.1 Mar 5, 2023
0.0.0 Jan 23, 2023

#231 in Authentication

Download history 13/week @ 2024-02-25 1/week @ 2024-03-03 1/week @ 2024-03-10 52/week @ 2024-03-31

53 downloads per month

MIT license

98KB
2K SLoC

Bombay - Monstercat API Bindings

GitHub Workflow Status (with branch) Crates.io Crates.io (latest)

This library provides safe Rust bindings for the Monstercat API.

Finally, the prophecy foretold becomes reality as crustaceans join the Monstercat community and Ferris joins the crab rave. Bombay is named after the cat breed and after my favorite liquor.

Disclaimer

Bombay is not endorsed by Monstercat in any way, and I don't even know if they like me doing this. Be responsible! Do not use this library to abuse, compete with, or otherwise irritate Monstercat. This should go without saying, but please do not try to use this library to get around any access or copyright restrictions.

Bombay interacts with the Monstercat API, which is completely out of my control and subject to change at any time. For this reason, the library can stop working correctly or at all, at any moment. It is written to be strict and safe, for good reason: I do not want any unexpected behavior to result in requests that would upset Monstercat. Please be mindful of all this and avoid relying on this library for anything critically important to you or others, and also avoid altering the code in ways that might irritate Monstercat if something goes wrong.

I am not responsible for what you do with this project or the knowledge you gain from it, so use it at your own risk.

Thanks

Monstercat, for bringing together an incredible community of talented artists and listeners. And also for exposing this API and letting us (I think) play with it!.

defvs and other contributors, for connect-v2-docs. I first started writing this by poking around the Monstercat web player, but then I found those docs and it saved me tons of work and I only had to update a few things from there.

DNSimple, for dnsimple-rust. The structure of this library's client was inspired by that library. I do not know if their approach is "good" or if my derived approach is either, but I appreciate them!

Docs and Tests

There is not full coverage of endpoints and endpoint options/parameters.

There are some examples in the Bombay docs.rs page. More will be added as I have time. Please navigate the various modules and structs to see how to use them. Not all functions have examples.

There are integration tests to attempt to catch changes to the Monstercat API, and to serve as more examples of how to use the library. More will be added as I have time. The error approach handling in those is a little different from the function examples.

Some tests are ignored if the following environment variables are not set:

  • MC_EMAIL
  • MC_PASSWORD
  • MC_TOTP_SECRET

Capabilities

Bombay supports the following:

  • Artists
    • Get all
    • Get latest
    • Get by artist name URI
    • Get photo
  • Moods
    • Get all
    • Get by mood name URI
  • Playlists
    • Get top 30 playlist
    • Get by playlist ID
    • Get playlist tracks
    • Get user playlists
    • Create playlist
    • Edit playlist
    • Modify a playlist item
    • Modify multiple playlist items
    • Delete a playlist
    • Get tile image
    • Get background image
  • Releases
    • Get all
    • Get latest
    • Get by artist name URI
    • Get by release catalog ID
    • Get related by release ID
    • Get cover art
    • Stream track
    • Download track
  • User
    • Sign-in / Authentication
      • email + password + 2FA (whichever requested: none, TOTP, or email)
      • email + password + 2FA (try to use email link)
      • email + password + 2FA (try to use totp)
    • Get user information and settings
    • Set user information and settings (supported values only)
    • Set notification interests
    • Set email
    • Set password
    • Enable 2FA email
    • Disable 2FA email
    • Enable 2FA TOTP
    • Disable 2FA TOTP
    • Get 2FA TOTP qr-code
    • Get licenses
    • Remove license
    • Remove video claims
    • Get streaming widget player code
    • Generate streaming widget player code
    • Generate shop discount code

And, where applicable:

  • Search and filtering parameters
  • Pagination parameters

Next Steps

  • Iterating on paginated queries/responses.
  • Logging in with other social accounts.

❗ Security

Bombay is by no means cryptographically secure. It simply abides by the Monstercat API. I did not make a strong effort towards best security practices in how sign-in details are used and stored. Be sure to use Bombay in a trusted environment.

Issues

Throughout the development of this library, I constantly encountered responses that did not fit my expectation and broke the deserialization. If you notice something is not deserializing, feel free to open an issue and I will take a look when I have time. Alternatively, put up a pull request!

Maturity

There are still plenty of gaps. As I have time to revisit best practices, I will improve things and there may be some breaking changes. I will bump the Bombay version to 0.1.0 when I believe it is stable, baring any major changes due to Monstercat's API changing. I'm not sure if there will ever be a 1.0.0, since I have no control over their API; I don't want to create a false sense of reliability.

License

MIT License, Copyright (c) 2023 xohmz

Dependencies

~7.5MB
~169K SLoC