diff --git a/liblistenbrainz/client.py b/liblistenbrainz/client.py index 96ca8a1..92f281a 100644 --- a/liblistenbrainz/client.py +++ b/liblistenbrainz/client.py @@ -267,6 +267,34 @@ def delete_listen(self, listen): ) + def follow(self, username): + """ Follow a user + + :param username: User to follow + """ + headers = { + 'Content-Type': 'application/json', + } + return self._post( + f'/1/user/{username}/follow', + headers=headers + ) + + + def unfollow(self, username): + """ Unfollow a user + + :param username: User to unfollow + """ + headers = { + 'Content-Type': 'application/json', + } + return self._post( + f'/1/user/{username}/unfollow' + headers=headers + ) + + def is_token_valid(self, token): """ Check if the specified ListenBrainz auth token is valid using the ``/1/validate-token`` endpoint. @@ -495,3 +523,25 @@ def get_user_feedback(self, username, score, metadata, count=100, offset=0 ): return None else: raise + + + def get_user_followers(self, username): + """ Get followers for a user + + : param username: The user to get followers for + """ + try: + return self._get(f'/1/user/{username}/followers') + except errors.ListenBrainzAPIException: + raise + + + def get_user_following(self, username): + """ Get following for a user + + : param username: The user to get following for + """ + try: + return self._get(f'/1/user/{username}/following') + except errors.ListenBrainzAPIException: + raise