spotify.ts

An easy to use, object oriented API wrapper for the Spotify Web API.

Usage no npm install needed!

<script type="module">
  import spotifyTs from 'https://cdn.skypack.dev/spotify.ts';
</script>

README

spotify.ts

About

spotify.ts is an wrapper built around Spotify's Web API.

Features

  • Fast
  • Object Oriented
  • Typescript, ESM, CJS support
  • Easy to Use

Installing

npm i spotify.ts
yarn add spotify.ts
pnpm add spotify.ts

Usage

First, import Client from the library, then instantiate a a new client with the clientId and clientSecret credentials. Then you can use the managers to make API calls to the Spotify API. For an in-built guide, visit the documentation site (see below).

Examples:

Fetch an album:

import { Client } from 'spotify.ts';

const client = new Client({
    clientId: 'some-id',
    clientSecret: 'some-secret'
});

client.start().then(() => {
    client.albums.fetch('0NLkVxf0PyxsXBG3EuZcJf').then(console.log);
});

Fetch an artist:

import { Client } from 'spotify.ts';

const client = new Client({
    clientId: 'some-id',
    clientSecret: 'some-secret'
});

client.start().then(() => {
    client.artists.fetch('4gdMJYnopf2nEUcanAwstx').then(console.log);
});

Links