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

NextCloud.api_wrappers.activity   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

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
7
    def get_activities(self, since=None, limit=None, object_type=None, object_id=None, sort=None):
8
        """
9
        Get an activity feed showing your file changes and other interesting things going on in your Nextcloud
10
11
        All args are optional
12
13
        Args:
14
            since (int): ID of the last activity that you’ve seen
15
            limit (int): How many activities should be returned (default: 50)
16
            object_type (string): Filter the activities to a given object. May only appear together with object_id
17
            object_id (string): Filter the activities to a given object. May only appear together with object_type
18
            sort (str, "asc" or "desc"): Sort activities ascending or descending (from the since) (Default: desc)
19
20
        Returns:
21
22
        """
23
        params = dict(
24
            since=since,
25
            limit=limit,
26
            object_type=object_type,
27
            object_id=object_id,
28
            sort=sort
29
        )
30
        if params['object_type'] and params['object_id']:
31
            return self.requester.get(url="filter", params=params)
32
        return self.requester.get(params=params)
33