From aeb98762a8fe4a865fdf9f18ac3255dc09cb875e Mon Sep 17 00:00:00 2001 From: Adam Grieger Date: Sat, 13 Jun 2020 17:00:27 -0700 Subject: [PATCH] feat(followapi.ts): add 'unfollowArtist' --- src/apis/FollowApi.spec.ts | 17 +++++++++++++++++ src/apis/FollowApi.ts | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/apis/FollowApi.spec.ts b/src/apis/FollowApi.spec.ts index 10c0d70..fabd14e 100644 --- a/src/apis/FollowApi.spec.ts +++ b/src/apis/FollowApi.spec.ts @@ -262,6 +262,23 @@ describe('FollowApi', () => { }); }); + describe('unfollowArtist', () => { + it('should unfollow an artist', async () => { + const { httpMock, follow } = setup(); + + await follow.unfollowArtist('foo'); + + expect(httpMock.delete).toBeCalledWith('/me/following', { + params: { + type: 'artist', + }, + data: { + ids: ['foo'], + }, + }); + }); + }); + describe('unfollowArtists', () => { it('should unfollow artists', async () => { const { httpMock, follow } = setup(); diff --git a/src/apis/FollowApi.ts b/src/apis/FollowApi.ts index cc9080c..181d1fb 100644 --- a/src/apis/FollowApi.ts +++ b/src/apis/FollowApi.ts @@ -205,6 +205,17 @@ export class FollowApi { }); } + /** + * Unfollow Artist + * + * Remove the current user as a follower of an artist. + * + * @param artistId The Spotify ID of the artist. + */ + unfollowArtist(artistId: string): Promise { + return this.unfollowArtists([artistId]); + } + /** * Unfollow Artists *