platypush.backend.nextcloud

class platypush.backend.nextcloud.NextcloudBackend(url: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, object_type: Optional[str] = None, object_id: Optional[int] = None, poll_seconds: Optional[float] = 60.0, **kwargs)[source]

This backend triggers events when new activities occur on a NextCloud instance.

Triggers:

  • platypush.message.event.nextcloud.NextCloudActivityEvent when new activity occurs on the instance. The field activity_type identifies the activity type (e.g. file_created, file_deleted, file_changed). Example in the case of the creation of new files:

    {
      "activity_id": 387,
      "app": "files",
      "activity_type": "file_created",
      "user": "your-user",
      "subject": "You created InstantUpload/Camera/IMG_0100.jpg, InstantUpload/Camera/IMG_0101.jpg and InstantUpload/Camera/IMG_0102.jpg",
      "subject_rich": [
        "You created {file3}, {file2} and {file1}",
        {
          "file1": {
            "type": "file",
            "id": "41994",
            "name": "IMG_0100.jpg",
            "path": "InstantUpload/Camera/IMG_0100.jpg",
            "link": "https://your-domain/nextcloud/index.php/f/41994"
          },
          "file2": {
            "type": "file",
            "id": "42005",
            "name": "IMG_0101.jpg",
            "path": "InstantUpload/Camera/IMG_0102.jpg",
            "link": "https://your-domain/nextcloud/index.php/f/42005"
          },
          "file3": {
            "type": "file",
            "id": "42014",
            "name": "IMG_0102.jpg",
            "path": "InstantUpload/Camera/IMG_0102.jpg",
            "link": "https://your-domain/nextcloud/index.php/f/42014"
          }
        }
      ],
      "message": "",
      "message_rich": [
        "",
        []
      ],
      "object_type": "files",
      "object_id": 41994,
      "object_name": "/InstantUpload/Camera/IMG_0102.jpg",
      "objects": {
        "42014": "/InstantUpload/Camera/IMG_0100.jpg",
        "42005": "/InstantUpload/Camera/IMG_0101.jpg",
        "41994": "/InstantUpload/Camera/IMG_0102.jpg"
      },
      "link": "https://your-domain/nextcloud/index.php/apps/files/?dir=/InstantUpload/Camera",
      "icon": "https://your-domain/nextcloud/apps/files/img/add-color.svg",
      "datetime": "2020-09-07T17:04:29+00:00"
    }
    
__init__(url: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, object_type: Optional[str] = None, object_id: Optional[int] = None, poll_seconds: Optional[float] = 60.0, **kwargs)[source]
Parameters
  • url – NextCloud instance URL (default: same as the platypush.plugins.nextcloud.NextCloudPlugin).

  • username – NextCloud username (default: same as the platypush.plugins.nextcloud.NextCloudPlugin).

  • password – NextCloud password (default: same as the platypush.plugins.nextcloud.NextCloudPlugin).

  • object_type – If set, only filter events on this type of object.

  • object_id – If set, only filter events on this object ID.

  • poll_seconds – How often the backend should poll the instance (default: one minute).