diff options
author | neodarz <neodarz@neodarz.net> | 2020-04-11 18:07:53 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2020-04-11 18:07:53 +0200 |
commit | 05572298b8e59972ac5439f4d435d67b8714ab19 (patch) | |
tree | 7061e711784a4f2c962682451521e16a2d6e6507 | |
parent | 7bf12208b36efd45bfb1d9be1df6f261bfbd6a67 (diff) | |
download | pyfunkwhale-05572298b8e59972ac5439f4d435d67b8714ab19.tar.xz pyfunkwhale-05572298b8e59972ac5439f4d435d67b8714ab19.zip |
Add abality to use params for the list artists endpoint
Diffstat (limited to '')
-rw-r--r-- | pyfunkwhale/funkwhale.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pyfunkwhale/funkwhale.py b/pyfunkwhale/funkwhale.py index ec88f0d..79e9c65 100644 --- a/pyfunkwhale/funkwhale.py +++ b/pyfunkwhale/funkwhale.py @@ -21,5 +21,17 @@ class Funkwhale(object): return params - def artists(self): - return self.client.call('/artists/', 'get').json() + def artists(self, q: str = None, ordering: str = None, + playable: bool = None, page: int = None, + page_size: int = None) -> dict: + + arguments = locals() + + ordering_field = ['creation_date', 'id', 'name'] + if ordering is not None and ordering not in ordering_field: + raise ValueError("The ordering field {} is not in the ordering" + "fields accepted".format(ordering)) + + params = self._build_params(arguments) + + return self.client.call('/artists/', 'get', params).json() |