Node JS wrapper for Spotify Web APIs.
npm install wrapped-spotify
To use this package you will both a client id and a client secret from Spotify. These keys can be obtained from spotify. Keys are required on initialization of a SpotifyService
.
To begin using any of the endpoint methods, create a service:
import * as ws from "wrapped-spotify";
let clientData = {
clientId: keys.client_id,
clientSecret: keys.client_secret,
};
let service = new ws.SpotifyService(clientData);
await service.init();
Then pass this initialized service into the method for the desired spotify endpoint's method.
let query = {
q: "Taylor Swift",
type: ["track"],
limit: 10,
offset: 0,
};
let data = await ws.search(query, service);
data will contain the results of your query.
After cloning this repository:
npm install
npm start
Get Spotify catalog information about albums, artists, playlists, tracks, shows or episodes that match a keyword string.
search(query: Query, service: SpotifyService)
Get detailed profile information about the current user (including the current user's username).
getUserProfile(service: SpotifyService)
Start a new context or resume current playback on the user's active device.
play(service: SpotifyService, deviceId: string, trackInfo?: TrackInfo)
Pause playback on the user's account.
pause(service: SpotifyService, deviceId: string)
Get information about a user’s available devices.
getDevices(service: SpotifyService)