Spotify API Request
A typescript supported wrapper for the Spotify web API
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.