| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 2 | from nextcloud.base import WithRequester |
||
| 3 | |||
| 4 | |||
| 5 | class Apps(WithRequester): |
||
| 6 | API_URL = "/ocs/v1.php/cloud/apps" |
||
| 7 | SUCCESS_CODE = 100 |
||
| 8 | |||
| 9 | def get_apps(self, filter=None): |
||
| 10 | """ |
||
| 11 | Get a list of apps installed on the Nextcloud server |
||
| 12 | |||
| 13 | :param filter: str, optional "enabled" or "disabled" |
||
| 14 | :return: |
||
| 15 | """ |
||
| 16 | params = { |
||
| 17 | "filter": filter |
||
| 18 | } |
||
| 19 | return self.requester.get(params=params) |
||
| 20 | |||
| 21 | def get_app(self, app_id): |
||
| 22 | """ |
||
| 23 | Provide information on a specific application |
||
| 24 | |||
| 25 | :param app_id: str, app id |
||
| 26 | :return: |
||
| 27 | """ |
||
| 28 | return self.requester.get(app_id) |
||
| 29 | |||
| 30 | def enable_app(self, app_id): |
||
| 31 | """ |
||
| 32 | Enable an app |
||
| 33 | |||
| 34 | :param app_id: str, app id |
||
| 35 | :return: |
||
| 36 | """ |
||
| 37 | return self.requester.post(app_id) |
||
| 38 | |||
| 39 | def disable_app(self, app_id): |
||
| 40 | """ |
||
| 41 | Disable the specified app |
||
| 42 | |||
| 43 | :param app_id: str, app id |
||
| 44 | :return: |
||
| 45 | """ |
||
| 46 | return self.requester.delete(app_id) |
||
| 47 |