@ekwoka/spotify-api
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Composable Wrapper for the Spotify Web Api and Spotify Web Playback SDK", | ||
@@ -15,0 +15,0 @@ "keywords": [ |
@@ -62,9 +62,11 @@ # ⚡️A tree-shakable, composable, lightweight wrapper for the multiple Spotify APIs🔥 | ||
- `makeAuthURL`: Generates an Auth URL to direct the user to for logging in with Spotify OAuth | ||
- `getTokenFromCode`: Accepts a code from the Spotify authentication flow and returns a suite of tokens (access and refresh). | ||
- `refreshToken`: Accepts a refresh token and returns a new access token. | ||
These currently depend on you setting up and exposing certain environment variables for the functions to access: | ||
These currently depend on you setting up and exposing certain environment variables for the functions to access on the `process.env` object: | ||
- `SPOTIFY_CLIENT`: Client id from Spotify Developer Dashboard. | ||
- `SPOTIFY_SECRET`: Client secret. | ||
- `REDIRECT`: URL to pass to Spotify Auth for handling the user returning to your app. | ||
@@ -76,4 +78,9 @@ If these are not defined, the function will throw. | ||
```js | ||
import { getTokenFromCode, refreshToken } from '@ekwoka/spotify-api'; | ||
import { getTokenFromCode, refreshToken, makeAuthURL } from '@ekwoka/spotify-api'; | ||
const loginHandler = async(req, res) => { | ||
const url = makeAuthURL(['user-read-email']) | ||
res.redirect(302, url) | ||
} | ||
const codeHandler = async (req, res) => { | ||
@@ -107,2 +114,40 @@ try { | ||
### Albums | ||
Currently Available methods in the Albums category include: | ||
- `getAlbum` - Retrieves info about an album by ID | ||
- `getAlbums` - Retrieves info about multiple albums by ID | ||
- `getAlbumTracks` - Retrieves info about an albums tracks | ||
> While these correspond to 3 different endpoints to Spotify's API, internally these 3 use only the `getAlbums` endpoints for improved code-reuse as well as future batching and caching. | ||
### getAlbum | ||
Gets details of an Album by ID. | ||
```js | ||
const album = client(getAlbum('6tLZvqqoWszgPagzzNNQQF')) | ||
const albumInMarket = client(getAlbum('6tLZvqqoWszgPagzzNNQQF', 'KR')) | ||
``` | ||
#### getAlbums | ||
Gets Details about multiple Albums at once. | ||
```js | ||
const albums = client(getAlbums(['6tLZvqqoWszgPagzzNNQQF','6XBIkDFhDgc3PQOUEcO2fd'])) | ||
const albumsInMarket = client(getAlbums(['6tLZvqqoWszgPagzzNNQQF','6XBIkDFhDgc3PQOUEcO2fd'], 'KR')) | ||
``` | ||
#### getAlbumTracks | ||
Gets Track Info about Album | ||
```js | ||
const album = client(getAlbumTracks('6tLZvqqoWszgPagzzNNQQF')) | ||
const albumInMarket = client(getAlbumTracks('6tLZvqqoWszgPagzzNNQQF', 'KR')) | ||
``` | ||
### Users | ||
@@ -113,2 +158,4 @@ | ||
- `getCurrentUser` - Retrieves data related to the actively logged in user (as defined by access token) | ||
- `getTopItems` - Retrieves info covering the Users Top Tracks and Artists | ||
- `getUserProfile` - Retrieves public info regarding another User by ID | ||
@@ -115,0 +162,0 @@ #### getCurrentUser |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54174
116
818
214
6
4