nextcloud.api_wrappers.apps   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 47
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
# -*- coding: utf-8 -*-
2
from nextcloud.base import WithRequester
3
4
5
class Apps(WithRequester):
6
    API_URL = "/ocs/v1.php/cloud/apps"
7
    SUCCESS_CODE = 100
8
9
    def get_apps(self, filter=None):
10
        """
11
        Get a list of apps installed on the Nextcloud server
12
13
        :param filter: str, optional "enabled" or "disabled"
14
        :return:
15
        """
16
        params = {
17
            "filter": filter
18
        }
19
        return self.requester.get(params=params)
20
21
    def get_app(self, app_id):
22
        """
23
        Provide information on a specific application
24
25
        :param app_id: str, app id
26
        :return:
27
        """
28
        return self.requester.get(app_id)
29
30
    def enable_app(self, app_id):
31
        """
32
        Enable an app
33
34
        :param app_id: str, app id
35
        :return:
36
        """
37
        return self.requester.post(app_id)
38
39
    def disable_app(self, app_id):
40
        """
41
        Disable the specified app
42
43
        :param app_id: str, app id
44
        :return:
45
        """
46
        return self.requester.delete(app_id)
47