From 120452eb024c44ca520a3b5fa9efb551b7863ff0 Mon Sep 17 00:00:00 2001 From: petitminion <50751126+petitminion@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:59:08 +0100 Subject: [PATCH] add feedback params (#23) Co-authored-by: Petitminion --- pylistenbrainz/client.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pylistenbrainz/client.py b/pylistenbrainz/client.py index da48dc4..b2a5a0d 100644 --- a/pylistenbrainz/client.py +++ b/pylistenbrainz/client.py @@ -468,13 +468,28 @@ def get_user_listen_count(self, username): else: raise - def get_user_feedback(self, username): + def get_user_feedback(self, username, score, metadata, count=100, offset=0 ): """ Get feedback given by user - :param username The user to get the feedbacks from + :param username: The user to get the feedbacks from + :type username: str + :param count: Optional, number of feedback items to return. Default 100. + :type count: int, optional + :param offset: Optional, number of feedback items to skip from the beginning, for pagination. Ex. An offset of 5 means the top 5 feedback will be skipped, defaults to 0. + :type offset: int, optional + :param score: Optional, If 1 then returns the loved recordings, if -1 returns hated recordings. + :type score: int, optional + :param metadata: Optional, boolean if this call should return the metadata for the feedback. + :type metadata: bool, optional """ + params = { + 'count': count, + 'offset': offset, + 'score': score, + 'metadata': metadata, + } try: - return self._get(f'/1/feedback/user/{username}/get-feedback',) + return self._get(f'/1/feedback/user/{username}/get-feedback', params=params) except errors.ListenBrainzAPIException as e: if e.status_code == 204: return None