Socket
Socket
Sign inDemoInstall

@ekwoka/spotify-api

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ekwoka/spotify-api - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

dist/src/auth/fetchOptions.d.ts

2

package.json

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc