Completed
Push — master ( a9b8b6...971575 )
by Matěj
12s
created

nextcloud.api_wrappers.apps   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 46
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Apps.get_apps() 0 11 1
A Apps.disable_app() 0 8 1
A Apps.enable_app() 0 8 1
A Apps.get_app() 0 8 1
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