Notifications

class nc_py_api.notifications._NotificationsAPI(session: NcSessionBasic)[source]

Class providing an API for managing user notifications on the Nextcloud server.

property available: bool

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

create(subject: str, message: str = '', subject_params: dict | None = None, message_params: dict | None = None, link: str = '') str[source]

Create a Notification for the current user and returns it’s ObjectID.

Note

Does not work in Nextcloud client mode, only for NextcloudApp mode.

get_all() list[Notification][source]

Gets all notifications for a current user.

get_one(notification_id: int) Notification[source]

Gets a single notification for a current user.

by_object_id(object_id: str) Notification | None[source]

Returns Notification if any by its object ID.

Note

this method is a temporary workaround until create can return notification_id.

delete(notification_id: int) None[source]

Deletes a notification for the current user.

delete_all() None[source]

Deletes all notifications for the current user.

exists(notification_ids: list[int]) list[int][source]

Checks the existence of notifications for the current user.

class nc_py_api.notifications.Notification(raw_data: dict)[source]

Class representing information about Nextcloud notification.

property notification_id: int

ID of the notification.

property object_id: str

Randomly generated unique object ID.

property object_type: str

Currently not used.

property app_name: str

Application name that generated notification.

property user_id: str

User ID of user for which this notification is.

property subject: str

Subject of the notification.

property message: str

Message of the notification.

property time: datetime

Time when the notification was created.

Link, which will be opened when user clicks on notification.

property icon: str

Relative to instance url of the icon image.