Mark Comments or Messages as read. :param items: A list containing instances of :class:`.Comment` and/or :class:`.Message` to be marked as read relative to the authorized user's inbox. Requests are batched at 25 items (reddit limit). For example, to
(self, items: list[models.Comment | models.Message])
| 97 | self._reddit.post(API_PATH["read_all_messages"]) |
| 98 | |
| 99 | def mark_read(self, items: list[models.Comment | models.Message]) -> None: |
| 100 | """Mark Comments or Messages as read. |
| 101 | |
| 102 | :param items: A list containing instances of :class:`.Comment` and/or |
| 103 | :class:`.Message` to be marked as read relative to the authorized user's |
| 104 | inbox. |
| 105 | |
| 106 | Requests are batched at 25 items (reddit limit). |
| 107 | |
| 108 | For example, to mark all unread Messages as read, try: |
| 109 | |
| 110 | .. code-block:: python |
| 111 | |
| 112 | from praw.models import Message |
| 113 | |
| 114 | unread_messages = [] |
| 115 | for item in reddit.inbox.unread(limit=None): |
| 116 | if isinstance(item, Message): |
| 117 | unread_messages.append(item) |
| 118 | reddit.inbox.mark_read(unread_messages) |
| 119 | |
| 120 | .. seealso:: |
| 121 | |
| 122 | - :meth:`.Comment.mark_read` |
| 123 | - :meth:`.Message.mark_read` |
| 124 | |
| 125 | """ |
| 126 | while items: |
| 127 | data = {"id": ",".join(x.fullname for x in items[:25])} |
| 128 | self._reddit.post(API_PATH["read_message"], data=data) |
| 129 | items = items[25:] |
| 130 | |
| 131 | def mark_unread(self, items: list[models.Comment | models.Message]) -> None: |
| 132 | """Unmark Comments or Messages as read. |