Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 177 additions & 0 deletions docs/source/Resources/Notifications/Notification_Type.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
**Notification Type**
===================


.. _NotificationTriggerAnalysis:

NotificationTriggerAnalysis
--------------------------

**Attributes:**

| analysis_id: :ref:`GenericID`
| ID of the analysis to trigger.


.. _NotificationTriggerHTTP:

NotificationTriggerHTTP
----------------------

**Attributes:**

| url: str
| The URL to make the request to.

| method: "POST" or "GET" or "PUT" or "DELETE" or "REDIRECT"
| HTTP method to use for the request.

| body: dict[str, Any]
| Body of the HTTP request.


.. _NotificationTriggerProfile:

NotificationTriggerProfile
------------------------

**Attributes:**

| share_profile: "accept" or "refuse"
| Action to take on a profile share.


.. _NotificationButton:

NotificationButton
----------------

**Attributes:**

| id: str
| Unique identifier for the button.

| label: str
| Text displayed on the button.

| color: Optional[str]
| Color of the button.

| triggers: :ref:`NotificationTriggerAnalysis` or :ref:`NotificationTriggerHTTP` or list[:ref:`NotificationTriggerProfile`]
| Actions triggered when the button is clicked.


.. _NotificationIconImage:

NotificationIconImage
-------------------

**Attributes:**

| image_url: str
| URL of the image to use as the notification icon.

| bg_color: Optional[HexColor]
| Background color for the icon.

| fit: Optional["fill" or "contain" or "cover"]
| How the image should fit in its container.


.. _NotificationIconSVG:

NotificationIconSVG
-----------------

**Attributes:**

| svg_url: str
| URL of the SVG to use as the notification icon.

| svg_color: Optional[HexColor]
| Color of the SVG.

| bg_color: Optional[HexColor]
| Background color for the icon.


.. _NotificationCreate:

NotificationCreate
----------------

**Attributes:**

| title: str
| Title of the notification.

| message: str
| Content of the notification.

| read: Optional[bool]
| Whether the notification has been read.

| icon: Optional[:ref:`NotificationIconSVG` or :ref:`NotificationIconImage`]
| Icon for the notification.

| buttons: Optional[list[:ref:`NotificationButton`]]
| Buttons to display with the notification.

| buttons_enabled: Optional[bool]
| Whether buttons are enabled.

| buttons_autodisable: Optional[bool]
| Whether buttons should automatically disable after being clicked.


.. _NotificationQuery:

NotificationQuery(:ref:`Query`)
-------------

**Attributes:**

| fields: Optional[List["created_at"]]
| Fields to include in the query response.

| filter: Optional[Dict["read", bool]]
| Filters for the query.


.. _NotificationInfo:

NotificationInfo(:ref:`NotificationCreate`)
------------

**Attributes:**

| id: :ref:`GenericID`
| Unique identifier for the notification.

| created_at: datetime
| When the notification was created.


.. _NotificationInfoBasic:

NotificationInfoBasic
------------------

**Attributes:**

| id: :ref:`GenericID`
| Unique identifier for the notification.

| created_at: datetime
| When the notification was created.


.. _NotificationCreateReturn:

NotificationCreateReturn
---------------------

**Attributes:**

| id: :ref:`GenericID`
| Unique identifier for the newly created notification.
193 changes: 193 additions & 0 deletions docs/source/Resources/Notifications/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
**Notifications**
==========

Manage notifications in your application.

=======
list
=======

Retrieves all notifications from the application with optional filtering.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| *Optional* **queryObj**: :ref:`NotificationQuery`
| Query parameters to filter the results.

**Returns:**

| list[:ref:`NotificationInfo`]

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
result = resources.notifications.list({"filter": {"read": False}, "amount": 10})
print(result) # [{'id': 'notification-id-123', 'title': 'System Update', 'message': 'Features', ...}]


==========
markAsRead
==========

Marks one or multiple notifications as read.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| **notificationIDS**: Union[str, list[str]]
| Notification ID or list of notification IDs

**Returns:**

| string

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
# Mark single notification
resources.notifications.markAsRead("notification-id-123")

# Mark multiple notifications
resources.notifications.markAsRead(["id-1", "id-2"])


============
markAsUnread
============

Marks one or multiple notifications as unread.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| **notificationIDS**: Union[str, list[str]]
| Notification ID or list of notification IDs

**Returns:**

| string

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
# Mark single notification
resources.notifications.markAsUnread("notification-id-123")

# Mark multiple notifications
resources.notifications.markAsUnread(["id-1", "id-2"])


============
markAllAsRead
============

Marks all notifications in the application as read.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| None

**Returns:**

| string

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
result = resources.notifications.markAllAsRead()
print(result) # All TagoIO Notification Run Successfully Updated


=================
notificationButton
=================

Records when a notification button is pressed by the user.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| **notificationID**: str
| Notification ID

| **buttonID**: str
| Button ID

**Returns:**

| string

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
result = resources.notifications.notificationButton("notification-123", "button-456")
print(result)


======
create
======

Creates a new notification in the system.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| **notificationData**: :ref:`NotificationCreate`
| Notification data to create

**Returns:**

| dict

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
result = resources.notifications.create({"title": "System Update", "message": "New features available"})
print(result["id"]) # notification-id-123


======
remove
======

Permanently deletes a notification from the system.

See: `Notification <https://help.tago.io/portal/en/kb/articles/11-notification>`_

**Parameters:**

| **notificationID**: str
| Notification ID

**Returns:**

| string

.. code-block:: python

from tagoio_sdk import Resources

resources = Resources()
result = resources.notifications.remove("notification-123")
print(result) # Successfully Removed
Loading