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