From 05572298b8e59972ac5439f4d435d67b8714ab19 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Apr 2020 18:07:53 +0200 Subject: Add abality to use params for the list artists endpoint --- pyfunkwhale/funkwhale.py | 16 ++++++++++++++-- 1 file 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() -- cgit v1.2.1