Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-spotify-ts

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-spotify-ts

A Spotify Web API library in Typescript

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

EasySpotifyTS - A Spotify Web Api TS Wrapper

This is a TypeScript library that wraps Spotify Web API to make your life easier. It's still not published and in development. See features list to check what else I plan to add to this library.

Demo

There is also a JS version here.

Installation and Usage

This library is easier than the JS version to use, because it doesn't have any external dependencies. Also, if you like type hints, or intellisense, here you get them evem for responses that come from Spotify.

TypeScript environment

Install easy-spotify-ts, and then just import and use the library:

terminal

$ npm install node-fetch easy-spotify --save

app.ts

import { EasySpotify, EasySpotifyConfig } from "easy-spotify-ts";
import { Album } from "easy-spotify-ts/models";

const spotify = new EasySpotify(new EasySpotifyConfig("your-api-token"));

// Get multiple albums!
spotify.getAlbums(["382ObEPsp2rxGrnsizN5TX", "1A2GTWGtFfWp7KSQTwWOyo"], {market: "ES"}).then((albums) => {
  console.log(albums);
}).catch((error) => {
  console.log(error);
});

Methods available

getAlbum(id: string, options?: GetAlbumOptions): Promise<Album>

This method returns an album object with the provided id.

Check official documentation page

const album = await spotify.getAlbum("382ObEPsp2rxGrnsizN5TX", {market: "ES"});
// do something with the data
// album.tracks.items[0].preview_url

getAlbums(ids: string[], options?: GetAlbumOptions): Promise<Album[]>

This method returns an array of album objects with the provided ids.

Check official documentation page

const albums = await spotify.getAlbums(["382ObEPsp2rxGrnsizN5TX", "1A2GTWGtFfWp7KSQTwWOyo"], {market: "ES"});
// do something with the albums
// albums[0].tracks.items[0].name

getAlbumTracks(id: string, options?: GetAlbumTracksOptions): Promise<PagingTracks>

This method returns a paging object with the tracks for an album given it's id. Tracks are in items property.

Check official documentation page

const tracks = await spotify.getAlbumTracks("1A2GTWGtFfWp7KSQTwWOyo", {limit: 10, offset: 1, market: "ES"});
// do something with the albums
// tracks.total
// tracks.limit
// tracks.items[0].artists[1].name

getArtist(id: string): Promise<Artist>

This method returns an complete artist object for the given id.

Check official documentation page

const artist = await spotify.getArtist("0OdUWJ0sBjDrqHygGUXeCF");
// do something with the albums
// artist.id
// artist.genres
// artist.followers.total

Features to implement

  • Support Search endpoints
  • Support Artists endpoints
  • Support Browse endpoints
  • Support Follow endpoints
  • Support Library endpoints
  • Support Personalization endpoints
  • Support Player endpoints
  • Support Playlists endpoints
  • Support Tracks endpoints
  • Support User Profiles endpoints

Authors

Bruno Lombardi
Bruno Lombardi

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Package last updated on 28 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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