Completed
Push — master ( e847a5...5b0cc0 )
by Matěj
25s queued 10s
created

NextCloud.api_wrappers.apps.Apps.enable_app()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 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