Passed
Pull Request — master (#27)
by
unknown
01:13
created

nextcloud.api_wrappers.activity   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A Activity.get_activities() 0 26 3
1
from nextcloud.base import WithRequester
2
3
4
class Activity(WithRequester):
5
    API_URL = "/ocs/v2.php/apps/activity/api/v2/activity"
6
    SUCCESS_CODE = 200
7
8
    def get_activities(self, since=None, limit=None, object_type=None, object_id=None, sort=None):
9
        """
10
        Get an activity feed showing your file changes and other interesting things going on in your Nextcloud
11
12
        All args are optional
13
14
        Args:
15
            since (int): ID of the last activity that you’ve seen
16
            limit (int): How many activities should be returned (default: 50)
17
            object_type (string): Filter the activities to a given object. May only appear together with object_id
18
            object_id (string): Filter the activities to a given object. May only appear together with object_type
19
            sort (str, "asc" or "desc"): Sort activities ascending or descending (from the since) (Default: desc)
20
21
        Returns:
22
23
        """
24
        params = dict(
25
            since=since,
26
            limit=limit,
27
            object_type=object_type,
28
            object_id=object_id,
29
            sort=sort
30
        )
31
        if params['object_type'] and params['object_id']:
32
            return self.requester.get(url="filter", params=params)
33
        return self.requester.get(params=params)
34