Socket
Socket
Sign inDemoInstall

spotify-api-request

A typescript supported wrapper for the Spotify Web API.


Version published
Maintainers
1
0

Weekly downloads

Readme

Source

Spotify API Request

A typescript supported wrapper for the Spotify web API

Build Status NPM version NPM download count

Installation

Install using Yarn or NPM

yarn add spotify-api-request

Authorization

Tokens are used to make requests. This method will get you a valid token for the next hour. There are four methods authorization (described in documentation).

import { getToken } from 'spotify-api-request'

const token = await getToken({
  clientId: clientId,
  clientSecret: clientSecret
})

Making requests

Now, we can use that token to make requests.

import { searchForItem } from 'spotify-api-request'

async function searchForShow(showName: string) {
  const token = await getToken()

	const searchRes = await searchForItem(token, {
    q: showName,
    type: 'shows'
  })
  
  return searchRes.shows.items
}

Every response is wrapped in a promise, so async/await is really helpful here.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure you update all test and documentation as appropriate.

Keywords

FAQs

Last updated on 02 Nov 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc