| Total Complexity | 4 |
| Total Lines | 46 |
| 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 | SUCCESS_CODE = 100 |
||
| 7 | |||
| 8 | def get_apps(self, filter=None): |
||
| 9 | """ |
||
| 10 | Get a list of apps installed on the Nextcloud server |
||
| 11 | |||
| 12 | :param filter: str, optional "enabled" or "disabled" |
||
| 13 | :return: |
||
| 14 | """ |
||
| 15 | params = { |
||
| 16 | "filter": filter |
||
| 17 | } |
||
| 18 | return self.requester.get(params=params) |
||
| 19 | |||
| 20 | def get_app(self, app_id): |
||
| 21 | """ |
||
| 22 | Provide information on a specific application |
||
| 23 | |||
| 24 | :param app_id: str, app id |
||
| 25 | :return: |
||
| 26 | """ |
||
| 27 | return self.requester.get(app_id) |
||
| 28 | |||
| 29 | def enable_app(self, app_id): |
||
| 30 | """ |
||
| 31 | Enable an app |
||
| 32 | |||
| 33 | :param app_id: str, app id |
||
| 34 | :return: |
||
| 35 | """ |
||
| 36 | return self.requester.post(app_id) |
||
| 37 | |||
| 38 | def disable_app(self, app_id): |
||
| 39 | """ |
||
| 40 | Disable the specified app |
||
| 41 | |||
| 42 | :param app_id: str, app id |
||
| 43 | :return: |
||
| 44 | """ |
||
| 45 | return self.requester.delete(app_id) |
||
| 46 |