@ekwoka/spotify-api
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -13,2 +13,3 @@ export { albumIsSaved } from './albums/albumIsSaved'; | ||
export { getArtists } from './artists/getArtists'; | ||
export { addToQueue } from './player/addToQueue'; | ||
export { recentlyPlayedTracks } from './player/recentlyPlayedTracks'; | ||
@@ -15,0 +16,0 @@ export { getPlaylist } from './playlists/getPlaylist'; |
@@ -13,2 +13,3 @@ export { albumIsSaved } from './albums/albumIsSaved'; | ||
export { getArtists } from './artists/getArtists'; | ||
export { addToQueue } from './player/addToQueue'; | ||
export { recentlyPlayedTracks } from './player/recentlyPlayedTracks'; | ||
@@ -15,0 +16,0 @@ export { getPlaylist } from './playlists/getPlaylist'; |
@@ -0,1 +1,2 @@ | ||
export { addToQueue } from './addToQueue'; | ||
export { recentlyPlayedTracks } from './recentlyPlayedTracks'; | ||
@@ -2,0 +3,0 @@ export type { RecentlyPlayedTrackList } from './recentlyPlayedTracks'; |
@@ -0,1 +1,2 @@ | ||
export { addToQueue } from './addToQueue'; | ||
export { recentlyPlayedTracks } from './recentlyPlayedTracks'; |
export { fetchOptions, makeAuthURL, refreshToken, tokensFromCode, } from './auth'; | ||
export { resetCache, setToken, spotifyApiClient } from './core'; | ||
export { albumIsSaved, getAlbum, getAlbums, getAlbumTracks, getArtist, getArtists, getCurrentUser, getPlaylist, getRecommendations, getSavedAlbums, getTopItems, getUserProfile, getUsersPlaylists, newReleases, recentlyPlayedTracks, removeAlbums, removeTracks, saveAlbums, saveTracks, search, trackIsSaved, } from './endpoints'; | ||
export { albumIsSaved, addToQueue, getAlbum, getAlbums, getAlbumTracks, getArtist, getArtists, getCurrentUser, getPlaylist, getRecommendations, getSavedAlbums, getTopItems, getUserProfile, getUsersPlaylists, newReleases, recentlyPlayedTracks, removeAlbums, removeTracks, saveAlbums, saveTracks, search, trackIsSaved, } from './endpoints'; | ||
export { spotifyFetch } from './utils/spotifyFetch'; | ||
@@ -5,0 +5,0 @@ export type { RefreshedToken, SpotifyTokens } from './auth'; |
export { fetchOptions, makeAuthURL, refreshToken, tokensFromCode, } from './auth'; | ||
export { resetCache, setToken, spotifyApiClient } from './core'; | ||
export { albumIsSaved, getAlbum, getAlbums, getAlbumTracks, getArtist, getArtists, getCurrentUser, getPlaylist, getRecommendations, getSavedAlbums, getTopItems, getUserProfile, getUsersPlaylists, newReleases, recentlyPlayedTracks, removeAlbums, removeTracks, saveAlbums, saveTracks, search, trackIsSaved, } from './endpoints'; | ||
export { albumIsSaved, addToQueue, getAlbum, getAlbums, getAlbumTracks, getArtist, getArtists, getCurrentUser, getPlaylist, getRecommendations, getSavedAlbums, getTopItems, getUserProfile, getUsersPlaylists, newReleases, recentlyPlayedTracks, removeAlbums, removeTracks, saveAlbums, saveTracks, search, trackIsSaved, } from './endpoints'; | ||
export { spotifyFetch } from './utils/spotifyFetch'; |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare const spotifyFetch: <T>(endpoint: string, token: string, data?: Record<string, unknown>) => Promise<T>; | ||
export declare const spotifyFetch: <T>(endpoint: string, token: string, data?: Record<string, unknown>, hasReturn?: boolean) => Promise<T>; | ||
//# sourceMappingURL=spotifyFetch.d.ts.map |
@@ -11,3 +11,3 @@ import { SPOTIFY_URL } from '../constants'; | ||
*/ | ||
export const spotifyFetch = async (endpoint, token, data = {}) => { | ||
export const spotifyFetch = async (endpoint, token, data = {}, hasReturn = true) => { | ||
try { | ||
@@ -23,2 +23,4 @@ const headers = { | ||
throw new Error(response.status.toString()); | ||
if (!hasReturn) | ||
return null; | ||
return await response.json(); | ||
@@ -25,0 +27,0 @@ } |
@@ -16,3 +16,3 @@ { | ||
"license": "MIT", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Composable Wrapper for the Spotify Web Api and Spotify Web Playback SDK", | ||
@@ -19,0 +19,0 @@ "repository": "github:ekwoka/spotify-api", |
@@ -271,5 +271,15 @@ # ⚡️A tree-shakable, composable, lightweight wrapper for the multiple Spotify APIs🔥 | ||
- `addToQueue` - Posts new item to the current playback queue | ||
- `recentlyPlayedTracks` - Gets user's recently played tracks | ||
#### addToQueue | ||
Posts the provided item URI (track or episode) to the active playback queue. | ||
```js | ||
client(addToQueue('spotify:track:5expoVGQPvXuwBBFuNGqBd')) | ||
``` | ||
If there is any error, this function will throw (as with all endpoints) but will return `null` when successful. | ||
#### recentlyPlayedTracks | ||
@@ -280,4 +290,4 @@ | ||
```js | ||
const recentlyPlayed = client(recentlyPlayed()) | ||
const recentlypPlayedFiltered = client(recentlyPlayed({ | ||
const recentlyPlayed = await client(recentlyPlayed()) | ||
const recentlypPlayedFiltered = await client(recentlyPlayed({ | ||
after: 1145736000000, | ||
@@ -284,0 +294,0 @@ before: 1653508800000, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
115343
194
1598
577