From d3d9a9b940f8727aea5fe22a0e983dff5c83ec9d Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Apr 2020 21:31:34 +0200 Subject: Add licenses endpoint --- README.md | 6 +++--- pyfunkwhale/funkwhale.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc8b4a0..548c2d3 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,6 @@ List of features implemented or planned: - [x] Retrieve a single tracks - [x] List available user libraries containing work from this track - [x] Download the audio file matching the given track uuid -- [ ] License - - [ ] List licences - - [ ] Retrieve a single license +- [x] License + - [x] List licences + - [x] Retrieve a single license diff --git a/pyfunkwhale/funkwhale.py b/pyfunkwhale/funkwhale.py index ec55875..23d6412 100644 --- a/pyfunkwhale/funkwhale.py +++ b/pyfunkwhale/funkwhale.py @@ -317,3 +317,37 @@ class Funkwhale(object): params = self._build_params(arguments) return self.client.call(f'/listen/{_uuid}', 'get', params) + + def licenses(self, page: str = None, page_size: str = None) -> dict: + """ + List license + + Parameters + ---------- + page : int, optional + Default value: 1 + page_size : int, optional + Default value: 25 + """ + + arguments = locals() + + params = self._build_params(arguments) + + return self.client.call(f'/licenses/', 'get', params).json() + + def license(self, _code) -> dict: + """ + Retrieve a single license + + Parameters + ---------- + _code : str + License code + """ + + arguments = locals() + + params = self._build_params(arguments) + + return self.client.call(f'/licenses/{_code}', 'get', params).json() -- cgit v1.2.1