@ekwoka/spotify-api
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -14,2 +14,3 @@ /** | ||
albums: {}, | ||
tracks: {}, | ||
}, | ||
@@ -16,0 +17,0 @@ }; |
@@ -10,2 +10,3 @@ export function spotifyApiClient(token) { | ||
albums: {}, | ||
tracks: {}, | ||
}, | ||
@@ -12,0 +13,0 @@ }, |
@@ -8,2 +8,3 @@ import { Album } from '../endpoints/albums'; | ||
albums: Record<string, boolean>; | ||
tracks: Record<string, boolean>; | ||
}; | ||
@@ -10,0 +11,0 @@ [key: string]: unknown; |
@@ -12,2 +12,5 @@ export { albumIsSaved } from './albums/albumIsSaved'; | ||
export { searchString } from './search/searchString'; | ||
export { removeTracks } from './tracks/removeTracks'; | ||
export { saveTracks } from './tracks/saveTracks'; | ||
export { trackIsSaved } from './tracks/trackIsSaved'; | ||
export { getCurrentUser } from './users/getCurrentUser'; | ||
@@ -14,0 +17,0 @@ export { getTopItems } from './users/getTopItems'; |
@@ -12,4 +12,7 @@ export { albumIsSaved } from './albums/albumIsSaved'; | ||
export { searchString } from './search/searchString'; | ||
export { removeTracks } from './tracks/removeTracks'; | ||
export { saveTracks } from './tracks/saveTracks'; | ||
export { trackIsSaved } from './tracks/trackIsSaved'; | ||
export { getCurrentUser } from './users/getCurrentUser'; | ||
export { getTopItems } from './users/getTopItems'; | ||
export { getUserProfile } from './users/getUserProfile'; |
@@ -1,2 +0,5 @@ | ||
export type { Track } from './types'; | ||
export { removeTracks } from './removeTracks'; | ||
export { saveTracks } from './saveTracks'; | ||
export { trackIsSaved } from './trackIsSaved'; | ||
export type { Track, TrackStub } from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,3 @@ | ||
export {}; | ||
export { removeTracks } from './removeTracks'; | ||
export { saveTracks } from './saveTracks'; | ||
export { trackIsSaved } from './trackIsSaved'; |
export { fetchOptions, makeAuthURL, refreshToken, tokensFromCode, } from './auth'; | ||
export { resetCache, setToken, spotifyApiClient } from './core'; | ||
export { albumIsSaved, getAlbum, getAlbums, getAlbumTracks, getCurrentUser, getSavedAlbums, getTopItems, getUserProfile, newReleases, removeAlbums, saveAlbums, search, } from './endpoints'; | ||
export { albumIsSaved, getAlbum, getAlbums, getAlbumTracks, getCurrentUser, getSavedAlbums, getTopItems, getUserProfile, newReleases, 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, getCurrentUser, getSavedAlbums, getTopItems, getUserProfile, newReleases, removeAlbums, saveAlbums, search, } from './endpoints'; | ||
export { albumIsSaved, getAlbum, getAlbums, getAlbumTracks, getCurrentUser, getSavedAlbums, getTopItems, getUserProfile, newReleases, removeAlbums, removeTracks, saveAlbums, saveTracks, search, trackIsSaved, } from './endpoints'; | ||
export { spotifyFetch } from './utils/spotifyFetch'; |
@@ -16,3 +16,3 @@ { | ||
"license": "MIT", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Composable Wrapper for the Spotify Web Api and Spotify Web Playback SDK", | ||
@@ -30,5 +30,5 @@ "repository": "github:ekwoka/spotify-api", | ||
"devDependencies": { | ||
"@types/node": "^18.7.8", | ||
"@typescript-eslint/eslint-plugin": "^5.33.1", | ||
"@typescript-eslint/parser": "^5.33.1", | ||
"@types/node": "^18.7.11", | ||
"@typescript-eslint/eslint-plugin": "^5.34.0", | ||
"@typescript-eslint/parser": "^5.34.0", | ||
"@vitest/coverage-c8": "^0.22.1", | ||
@@ -35,0 +35,0 @@ "esbuild": "^0.15.5", |
@@ -305,3 +305,3 @@ # ⚡️A tree-shakable, composable, lightweight wrapper for the multiple Spotify APIs🔥 | ||
const results = client(search(searchString(query))) | ||
const results = client(search(searchString(query, 'track'))) | ||
``` | ||
@@ -312,2 +312,41 @@ | ||
### Tracks | ||
Current available endpoints within the Tracks category include: | ||
- `trackIsSaved` - Retrieves whether a provided album id is in the user's library | ||
- `saveTracks` - Adds albums to the user's library | ||
- `removeTracks` - Removes albums from the user's library | ||
> These last 3 all use batching to improve performance, and these 3 all also use a shared cache of in-Library states. | ||
Cachekey: `saved.tracks[id]` | ||
Batching Limit: 50 | ||
#### albumIsSaved | ||
Gets whether the provided album IDs are present in the user's library. Works with single IDs or arrays of IDs. | ||
```js | ||
const isSaved = client(albumIsSaved('0skYUMpS0AcbpjcGsAbRGj')) // true | false | ||
const areSaved = client(albumIsSaved(['0skYUMpS0AcbpjcGsAbRGj', '60jFaQV7Z4boGC4ob5B5c6'])) // [true, false] | ||
``` | ||
#### saveAlbums | ||
Puts album ID into the user's library. Returns `true` if successful. Works with single IDs or arrays of IDs. | ||
```js | ||
const isSaved = client(saveAlbums('0skYUMpS0AcbpjcGsAbRGj')) // true | ||
const wasSaved = client(saveAlbums(['0skYUMpS0AcbpjcGsAbRGj', '60jFaQV7Z4boGC4ob5B5c6'])) // [true, true] | ||
``` | ||
#### removeAlbums | ||
Deletes album ID from the user's library. Returns `true` if successful. Works with single IDs or arrays of IDs. | ||
```js | ||
const isRemoved = client(removeAlbums('0skYUMpS0AcbpjcGsAbRGj')) // true | ||
const wasRemoved = client(removeAlbums(['0skYUMpS0AcbpjcGsAbRGj', '60jFaQV7Z4boGC4ob5B5c6'])) // [true, true] | ||
``` | ||
### Users | ||
@@ -314,0 +353,0 @@ |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86555
155
1187
452