Activity App

class nc_py_api.activity.ActivityFilter(raw_data: dict)[source]

Activity filter description.

property icon: str

Icon for filter.

property filter_id: str

Filter ID.

property name: str

Filter name.

property priority: int

Arrangement priority in ascending order. Values from 0 to 99.

class nc_py_api.activity.Activity(raw_data: dict)[source]

Description of one activity.

property activity_id: int

Unique for one Nextcloud instance activity ID.

property app: str

App that created the activity (e.g. ‘files’, ‘files_sharing’, etc.).

property activity_type: str

String describing the activity type, depends on the app field.

property actor_id: str

User ID of the user that triggered/created this activity.

Note

Can be empty in case of public link/remote share action.

property subject: str

Translated simple subject without markup, ready for use (e.g. ‘You created hello.jpg’).

property subject_rich: list

0 is the string subject including placeholders, 1 is an array with the placeholders.

property message: str

Translated message without markup, ready for use (longer text, unused by core apps).

property message_rich: list

See description of subject_rich.

property object_type: str

The Type of the object this activity is about (e.g. ‘files’ is used for files and folders).

property object_id: int

ID of the object this activity is about (e.g., ID in the file cache is used for files and folders).

property object_name: str

The name of the object this activity is about (e.g., for files it’s the relative path to the user’s root).

property objects: dict

Contains the objects involved in multi-object activities, like editing multiple files in a folder.

Note

They are stored in objects as key-value pairs of the object_id and the object_name: { object_id: object_name}

A full URL pointing to a suitable location (e.g. ‘http://localhost/apps/files/?dir=%2Ffolder’ for folder).

property icon: str

URL of the icon.

property time: datetime

Time when the activity occurred.

class nc_py_api.activity._ActivityAPI(session: NcSessionBasic)[source]

The class provides the Activity Application API.

last_given: int

Used by get_activities, when since param is True.

property available: bool

Returns True if the Nextcloud instance supports this feature, False otherwise.

get_activities(filter_id: ActivityFilter | str = '', since: int | bool = 0, limit: int = 50, object_type: str = '', object_id: int = 0, sort: str = 'desc') list[Activity][source]

Returns activities for the current user.

Parameters:
  • filter_id – Filter to apply, if needed.

  • since – Last activity ID you have seen. When specified, only activities after provided are returned. Can be set to True to automatically use last last_given from previous calls. Default = 0.

  • limit – Max number of activities to be returned.

  • object_type – Filter the activities to a given object.

  • object_id – Filter the activities to a given object.

  • sort – Sort activities ascending or descending. Default is desc.

Note

object_type and object_id should only appear together with filter_id unset.

get_filters() list[ActivityFilter][source]

Returns avalaible activity filters.