diff --git a/src/apis/LibraryApi.spec.ts b/src/apis/LibraryApi.spec.ts index f1ccebc..a0bca65 100644 --- a/src/apis/LibraryApi.spec.ts +++ b/src/apis/LibraryApi.spec.ts @@ -220,6 +220,20 @@ describe('LibraryApi', () => { }); }); + describe('removeSavedAlbum', () => { + it('should remove an album for the current user', async () => { + const { httpMock, library } = setup(); + + await library.removeSavedAlbum('foo'); + + expect(httpMock.delete).toBeCalledWith('/me/albums', { + data: { + ids: ['foo'], + }, + }); + }); + }); + describe('removeSavedAlbums', () => { it('should remove albums for the current user', async () => { const { httpMock, library } = setup(); @@ -234,6 +248,33 @@ describe('LibraryApi', () => { }); }); + describe('removeSavedShow', () => { + it('should remove a show for the current user (without options)', async () => { + const { httpMock, library } = setup(); + + await library.removeSavedShow('foo'); + + expect(httpMock.delete).toBeCalledWith('/me/shows', { + params: { + ids: ['foo'], + }, + }); + }); + + it('should remove a show for the current user (with options)', async () => { + const { httpMock, library } = setup(); + + await library.removeSavedShow('foo', { market: 'bar' }); + + expect(httpMock.delete).toBeCalledWith('/me/shows', { + params: { + ids: ['foo'], + market: 'bar', + }, + }); + }); + }); + describe('removeSavedShows', () => { it('should remove shows for the current user (without options)', async () => { const { httpMock, library } = setup(); @@ -261,6 +302,20 @@ describe('LibraryApi', () => { }); }); + describe('removeSavedTrack', () => { + it('should remove a track for the current user', async () => { + const { httpMock, library } = setup(); + + await library.removeSavedTrack('foo'); + + expect(httpMock.delete).toBeCalledWith('/me/tracks', { + data: { + ids: ['foo'], + }, + }); + }); + }); + describe('removeSavedTracks', () => { it('should remove tracks for the current user', async () => { const { httpMock, library } = setup(); diff --git a/src/apis/LibraryApi.ts b/src/apis/LibraryApi.ts index 7f3fcab..d243bc5 100644 --- a/src/apis/LibraryApi.ts +++ b/src/apis/LibraryApi.ts @@ -147,6 +147,17 @@ export class LibraryApi { return response[0]; } + /** + * Remove Album for the Current User + * + * Remove an album from the current user's library. + * + * @param albumId The Spotify ID of the album. + */ + removeSavedAlbum(albumId: string): Promise { + return this.removeSavedAlbums([albumId]); + } + /** * Remove Albums for the Current User * @@ -162,6 +173,21 @@ export class LibraryApi { }); } + /** + * Remove Show for the Current User + * + * Remove a show from the current user's library. + * + * @param showId The Spotify ID of the show. + * @param options Optional request information. + */ + removeSavedShow( + showId: string, + options?: RemoveSavedShowsOptions, + ): Promise { + return this.removeSavedShows([showId], options); + } + /** * Remove Shows for the Current User * @@ -182,6 +208,17 @@ export class LibraryApi { }); } + /** + * Remove Track for the Current User + * + * Remove a track from the current user's library. + * + * @param trackId The Spotify ID of the track. + */ + removeSavedTrack(trackId: string): Promise { + return this.removeSavedTracks([trackId]); + } + /** * Remove Tracks for the Current User *