Crystalize is a Crystal library that adds support for the Spotify API.
Crystalize is still a WIP. It is usable, but doesn't cover all of the API and may not have a stable interface.
Add the dependency to your
dependencies: crystalize: github: t1ra/crystalize
To use Crystalize, you first have to set credentials:
Crystalize.authenticate(id: "your-id", secret: "your-secret")
To get an ID and secret, create a new client using the Spotify Dashboard.
From there, you can send requests via the associated module:
album = Crystalize::Album.get("3ogb5zqMrLtSbT4HAvQhPc").not_nil! album.name.should eq "Твой первый диск - моя кассета" album.artists.first.name.should eq "Tima Belorusskih"
Crystalize's API can be found at https://t1ra.github.io/crystalize, and Spotify's API reference can be found at https://developer.spotify.com/documentation/web-api/reference/. Using these, it shouldn't be difficult to thoroughly understand Crystalize.
The long-term goal endpoints require authentication from a user, which, generally, requires a lot more setup to get than bot authentication. Until all of the bot-available endpoints are ready, there's no plan to implement user-based endpoints.
Users Profile can be partially implemented because some endpoints require user authentication
/v1/me), while others (
git checkout -b my-new-feature)
git commit -am 'Add some feature')
git push origin my-new-feature)
If you simply pull the repo and run
crystal spec, tests will fail because Crystalize doesn't
have any credentials to use. To add your own, create
spec/auth.cr and add the following:
module Auth @@id = "YOUR-ID" @@secret = "YOUR-SECRET" def self.id @@id end def self.secret @@secret end end
@@secret with your own.