Ë
    Fü´j™(  ã                  ó†   — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ erddlmZ dd	lmZ  G d
„ de	«      Zy)zProvide the Front class.é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚAPI_PATH)ÚPRAWBase)ÚListingGenerator)Ústream_generator)ÚIterator)Úmodelsc                  ó�   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zddœ	 	 	 	 	 dd„Zy)ÚInboxz3Inbox is a Listing class that represents the inbox.c                ó>   — t        | j                  t        d   fi |¤ŽS )aˆ  Return a :class:`.ListingGenerator` for all inbox comments and messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        To output the type and ID of all items available via this listing do:

        .. code-block:: python

            for item in reddit.inbox.all(limit=None):
                print(repr(item))

        Úinbox©r   Ú_redditr   ©ÚselfÚgenerator_kwargss     úO/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/models/inbox.pyÚallz	Inbox.all   s    € ô   §¡¬h°wÑ.?ÑTÐCSÑTÐTó    c                óœ   — |rJddj                  d„ |dd D «       «      i}| j                  j                  t        d   |¬«       |dd }|rŒIyy)ae  Mark an inbox message as collapsed.

        :param items: A list containing instances of :class:`.Message`.

        Requests are batched at 25 items (reddit limit).

        For example, to collapse all unread Messages, try:

        .. code-block:: python

            from praw.models import Message

            unread_messages = []
            for item in reddit.inbox.unread(limit=None):
                if isinstance(item, Message):
                    unread_messages.append(item)
            reddit.inbox.collapse(unread_messages)

        .. seealso::

            :meth:`.Message.uncollapse`

        Úidú,c              3  ó4   K  — | ]  }|j                   –— Œ y ­w©N©Úfullname©Ú.0Úxs     r   ú	<genexpr>z!Inbox.collapse.<locals>.<genexpr>>   ó   è ø€ Ò"B°! 1§:¥:Ñ"Bùó   ‚Né   Úcollapse©Údata©Újoinr   Úpostr   ©r   Úitemsr(   s      r   r&   zInbox.collapse%   sR   € ñ0 Ø˜#Ÿ(™(Ñ"B°u¸S¸b°zÔ"BÓBÐCˆDØ�L‰L×Ñœh zÑ2¸ÐÔ>Ø˜"˜#�JˆEô r   c                ó>   — t        | j                  t        d   fi |¤ŽS )ay  Return a :class:`.ListingGenerator` for comment replies.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        To output the author of one request worth of comment replies try:

        .. code-block:: python

            for reply in reddit.inbox.comment_replies():
                print(reply.author)

        Úcomment_repliesr   r   s     r   r/   zInbox.comment_repliesB   s!   € ô   §¡¬hÐ7HÑ.IÑ^ÐM]Ñ^Ð^r   c                óH   — | j                   j                  t        d   «       y)a6  Mark all messages as read with just one API call.

        Example usage:

        .. code-block:: python

            reddit.inbox.mark_all_read()

        .. note::

            This method returns after Reddit acknowledges your request, instead of after
            the request has been fulfilled.

        Úread_all_messagesN)r   r+   r   )r   s    r   Úmark_all_readzInbox.mark_all_readR   s   € ð 	�‰×Ñœ(Ð#6Ñ7Õ8r   c                óœ   — |rJddj                  d„ |dd D «       «      i}| j                  j                  t        d   |¬«       |dd }|rŒIyy)a  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 mark all unread Messages as read, try:

        .. code-block:: python

            from praw.models import Message

            unread_messages = []
            for item in reddit.inbox.unread(limit=None):
                if isinstance(item, Message):
                    unread_messages.append(item)
            reddit.inbox.mark_read(unread_messages)

        .. seealso::

            - :meth:`.Comment.mark_read`
            - :meth:`.Message.mark_read`

        r   r   c              3  ó4   K  — | ]  }|j                   –— Œ y ­wr   r   r   s     r   r"   z"Inbox.mark_read.<locals>.<genexpr>   r#   r$   Nr%   Úread_messager'   r)   r,   s      r   Ú	mark_readzInbox.mark_readc   sR   € ñ6 Ø˜#Ÿ(™(Ñ"B°u¸S¸b°zÔ"BÓBÐCˆDØ�L‰L×Ñœh ~Ñ6¸TÐÔBØ˜"˜#�JˆEô r   c                óœ   — |rJddj                  d„ |dd D «       «      i}| j                  j                  t        d   |¬«       |dd }|rŒIyy)aX  Unmark Comments or Messages as read.

        :param items: A list containing instances of :class:`.Comment` and/or
            :class:`.Message` to be marked as unread relative to the authorized user's
            inbox.

        Requests are batched at 25 items (Reddit limit).

        For example, to mark the first 10 items as unread try:

        .. code-block:: python

            to_unread = list(reddit.inbox.all(limit=10))
            reddit.inbox.mark_unread(to_unread)

        .. seealso::

            - :meth:`.Comment.mark_unread`
            - :meth:`.Message.mark_unread`

        r   r   c              3  ó4   K  — | ]  }|j                   –— Œ y ­wr   r   r   s     r   r"   z$Inbox.mark_unread.<locals>.<genexpr>š   r#   r$   Nr%   Úunread_messager'   r)   r,   s      r   Úmark_unreadzInbox.mark_unreadƒ   sS   € ñ, Ø˜#Ÿ(™(Ñ"B°u¸S¸b°zÔ"BÓBÐCˆDØ�L‰L×ÑœhÐ'7Ñ8¸tÐÔDØ˜"˜#�JˆEô r   c                ó>   — t        | j                  t        d   fi |¤ŽS )a
  Return a :class:`.ListingGenerator` for mentions.

        A mention is :class:`.Comment` in which the authorized redditor is named in its
        body like u/spez.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        For example, to output the author and body of the first 25 mentions try:

        .. code-block:: python

            for mention in reddit.inbox.mentions(limit=25):
                print(f"{mention.author}\\n{mention.body}\\n")

        Úmentionsr   r   s     r   r<   zInbox.mentionsž   s    € ô"   §¡¬h°zÑ.BÑWÐFVÑWÐWr   c                ó`  — | j                   j                  t        d   j                  |¬«      «      }|d   g|d   j                  ¢D �ci c]  }|j
                  |“Œ }}|j                  «       D ]"  }|j                  |j                  «      |_        Œ$ |d|j                  «       › �   S c c}w )zéReturn a :class:`.Message` corresponding to ``message_id``.

        :param message_id: The base36 ID of a message.

        For example:

        .. code-block:: python

            message = reddit.inbox.message("7bnlgu")

        Úmessage)r   r   Út4_)
r   Úgetr   ÚformatÚrepliesr   ÚvaluesÚ	parent_idÚparentÚlower)r   Ú
message_idÚlistingr>   Úmessagess        r   r>   zInbox.message±   s®   € ð —,‘,×"Ñ"¤8¨IÑ#6×#=Ñ#=ÀÐ#=Ó#LÓMˆØ>EÀa¹jÐ=^È7ÐSTÉ:×K]ÑK]Ð=^Ö_°'�G×$Ñ$ gÑ-Ð_ˆÐ_Ø—‘Ó(ò 	=ˆGØ%Ÿ\™\¨'×*;Ñ*;Ó<ˆG�Nð	=à˜#˜j×.Ñ.Ó0Ð1Ð2Ñ3Ð3ùò `s   Á
B+c                ó>   — t        | j                  t        d   fi |¤ŽS )a�  Return a :class:`.ListingGenerator` for inbox messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        For example, to output the subject of the most recent 5 messages try:

        .. code-block:: python

            for message in reddit.inbox.messages(limit=5):
                print(message.subject)

        rI   r   r   s     r   rI   zInbox.messagesÃ   s    € ô   §¡¬h°zÑ.BÑWÐFVÑWÐWr   c                ó>   — t        | j                  t        d   fi |¤ŽS )a}  Return a :class:`.ListingGenerator` for sent messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        For example, to output the recipient of the most recent 15 messages try:

        .. code-block:: python

            for message in reddit.inbox.sent(limit=15):
                print(message.dest)

        Úsentr   r   s     r   rL   z
Inbox.sentÓ   s    € ô   §¡¬h°vÑ.>ÑSÐBRÑSÐSr   c                ó.   — t        | j                  fi |¤ŽS )a�  Yield new inbox items as they become available.

        Items are yielded oldest first. Up to 100 historical items will initially be
        returned.

        Keyword arguments are passed to :func:`.stream_generator`.

        For example, to retrieve all new inbox items, try:

        .. code-block:: python

            for item in reddit.inbox.stream():
                print(item)

        )r	   Úunread)r   Ústream_optionss     r   ÚstreamzInbox.streamã   s   € ô    §¡Ñ>¨~Ñ>Ð>r   c                ó>   — t        | j                  t        d   fi |¤ŽS )a‚  Return a :class:`.ListingGenerator` for submission replies.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        To output the author of one request worth of submission replies try:

        .. code-block:: python

            for reply in reddit.inbox.submission_replies():
                print(reply.author)

        Úsubmission_repliesr   r   s     r   rR   zInbox.submission_repliesõ   s!   € ô   §¡¬hÐ7KÑ.LÑaÐP`ÑaÐar   c                óœ   — |rJddj                  d„ |dd D «       «      i}| j                  j                  t        d   |¬«       |dd }|rŒIyy)ai  Mark an inbox message as uncollapsed.

        :param items: A list containing instances of :class:`.Message`.

        Requests are batched at 25 items (reddit limit).

        For example, to uncollapse all unread Messages, try:

        .. code-block:: python

            from praw.models import Message

            unread_messages = []
            for item in reddit.inbox.unread(limit=None):
                if isinstance(item, Message):
                    unread_messages.append(item)
            reddit.inbox.uncollapse(unread_messages)

        .. seealso::

            :meth:`.Message.collapse`

        r   r   c              3  ó4   K  — | ]  }|j                   –— Œ y ­wr   r   r   s     r   r"   z#Inbox.uncollapse.<locals>.<genexpr>  r#   r$   Nr%   Ú
uncollapser'   r)   r,   s      r   rU   zInbox.uncollapse  sR   € ñ0 Ø˜#Ÿ(™(Ñ"B°u¸S¸b°zÔ"BÓBÐCˆDØ�L‰L×Ñœh |Ñ4¸4ÐÔ@Ø˜"˜#�JˆEô r   F)r6   c               óf   — | j                  |d|¬«       t        | j                  t        d   fi |¤ŽS )a¸  Return a :class:`.ListingGenerator` for unread comments and messages.

        :param mark_read: Marks the inbox as read (default: ``False``).

        .. note::

            This only marks the inbox as read not the messages. Use
            :meth:`.Inbox.mark_read` to mark the messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        For example, to output the author of unread comments try:

        .. code-block:: python

            from praw.models import Comment

            for item in reddit.inbox.unread(limit=None):
                if isinstance(item, Comment):
                    print(item.author)

        Úparams)Ú	argumentsÚkeyÚmarkrN   )Ú_safely_add_argumentsr   r   r   )r   r6   r   s      r   rN   zInbox.unread"  s7   € ð: 	×"Ñ"Ð-=À8ÐR[Ð"Ô\Ü §¡¬h°xÑ.@ÑUÐDTÑUÐUr   N)r   r   Úreturnz)Iterator[models.Message | models.Comment])r-   zlist[models.Message]r\   ÚNone)r   r   r\   zIterator[models.Comment])r\   r]   )r-   z%list[models.Comment | models.Message]r\   r]   )rG   Ústrr\   zmodels.Message)r   r   r\   zIterator[models.Message])rO   r   r\   ú)Iterator[models.Comment | models.Message])r6   Úboolr   z
Any | Noner\   r_   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r/   r2   r6   r:   r<   r>   rI   rL   rP   rR   rU   rN   © r   r   r   r      sz   „ Ù=óUó ó:_ó 9ó"ó@ó6Xó&4ó$Xó Tó ?ó$bó ð@  ñVð ðVð 'ð	Vð
 
3ôVr   r   N)rd   Ú
__future__r   Útypingr   r   Ú
praw.constr   Úpraw.models.baser   Úpraw.models.listing.generatorr   Úpraw.models.utilr	   Úcollections.abcr
   Úprawr   r   re   r   r   ú<module>rn      s3   ðÙ å "ç %å Ý %Ý :Ý -áÝ(åônVˆHõ nVr   