Skip to content

Commit

Permalink
feat(followapi.ts): add 'unfollowUser'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgrieger committed Jun 14, 2020
1 parent aeb9876 commit b1de94f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/apis/FollowApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,23 @@ describe('FollowApi', () => {
});
});

describe('unfollowUser', () => {
it('should unfollow a user', async () => {
const { httpMock, follow } = setup();

await follow.unfollowUser('foo');

expect(httpMock.delete).toBeCalledWith('/me/following', {
params: {
type: 'user',
},
data: {
ids: ['foo'],
},
});
});
});

describe('unfollowUsers', () => {
it('should unfollow users', async () => {
const { httpMock, follow } = setup();
Expand Down
11 changes: 11 additions & 0 deletions src/apis/FollowApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ export class FollowApi {
return this.http.delete<void>(`/playlists/${playlistId}/followers`);
}

/**
* Unfollow User
*
* Remove the current user as a follower of a Spotify user.
*
* @param userId The Spotify ID of the user.
*/
unfollowUser(userId: string): Promise<void> {
return this.unfollowUsers([userId]);
}

/**
* Unfollow Users
*
Expand Down

0 comments on commit b1de94f

Please sign in to comment.