nextcloud#

class platypush.message.event.nextcloud.NextCloudActivityEvent(*args, activity_id: int, activity_type: str, object_id: int, object_type: str, object_name: str, app: str, user: str, subject: str, message: str, subject_rich: list | None = None, message_rich: list | None = None, objects: dict | None = None, link: str | None = None, icon: str | None = None, datetime: datetime | None = None, **kwargs)[source]#

Bases: Event

Event triggered when a new activity is detected on a NextCloud instance.

__init__(*args, activity_id: int, activity_type: str, object_id: int, object_type: str, object_name: str, app: str, user: str, subject: str, message: str, subject_rich: list | None = None, message_rich: list | None = None, objects: dict | None = None, link: str | None = None, icon: str | None = None, datetime: datetime | None = None, **kwargs)[source]#
Parameters:
  • activity_id – Activity ID.

  • activity_type – Activity type - can be file_created, file_deleted, file_changed, file_restored, file_shared, file_unshared, file_downloaded, etc.

  • object_id – Object ID.

  • object_type – Object type - can be files, comment, tag, share, etc.

  • object_name – Object name. In the case of files, it’s the file path relative to the user’s root directory.

  • app – Application that generated the activity.

  • user – User that generated the activity.

  • subject – Activity subject, in plain text. For example, You created hd/test1.txt and hd/test2.txt.

  • message – Activity message, in plain text.

  • subject_rich

    Activity subject, in rich/structured format. Example:

    [
      "You created {file2} and {file1}",
      {
        "file1": {
          "type": "file",
          "id": "1234",
          "name": "test1.txt",
          "path": "hd/text1.txt",
          "link": "https://cloud.example.com/index.php/f/1234"
        },
        "file2": {
          "type": "file",
          "id": "1235",
          "name": "test2.txt",
          "path": "hd/text2.txt",
          "link": "https://cloud.example.com/index.php/f/1235"
        }
      }
    ]
    

  • message_rich – Activity message, in rich/structured format.

  • objects – Additional objects associated to the activity, in the format {object_id: object}. For example, if the activity involves files, the objects dictionary will contain the mapping of the involved files in the format {file_id: path}.

  • link – Link to the main object of this activity. Example: https://cloud.example.com/index.php/files/apps/files/?dir=/hd&fileid=1234

  • icon – URL of the icon associated to the activity.

  • datetime – Activity timestamp.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object