Passed
Pull Request — master (#27)
by
unknown
01:13
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
eloc 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nop 2
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