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