
    ,Of,                        d dl mZ d dlmZ d dlmZmZ d dlZd dlZd dlm	Z	 d dlm
Z
mZmZ d dlmZ erd dlmZ  G d	 d
e      Zy)    )annotations)datetime)TYPE_CHECKINGAnyN)Consts)	AttributeCompletableGithubObjectNotSet)PaginatedList)Reactionc                     e Zd ZdZddZddZedd       Zedd       Zedd       Z	edd       Z
edd       Zedd	       Zedd
       Zedd       Zedd       Zedd       ZddZddZddZddZd dZd!d"dZd#dZd$dZy)%IssueCommentz
    This class represents IssueComments.

    The reference can be found here
    https://docs.github.com/en/rest/reference/issues#comments

    c                    t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _	        t         | _
        y N)r
   _body_created_at_id
_issue_url_node_id_updated_at_url	_html_url_user
_reactionsselfs    3lib/python3.12/site-packages/github/IssueComment.py_initAttributeszIssueComment._initAttributesG   sJ    %+
06#)*0(.06$*	)/<B
+1    c                z    | j                  | j                  j                  | j                  j                  d      S )N)iduser)get__repr__r   valuer   r   s    r   __repr__zIssueComment.__repr__S   s*    txx~~tzz?O?O PQQr   c                d    | j                  | j                         | j                  j                  S r   )_completeIfNotSetr   r$   r   s    r   bodyzIssueComment.bodyV   $    tzz*zzr   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   
created_atzIssueComment.created_at[   (    t//0%%%r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   r!   zIssueComment.id`   s"    txx(xx~~r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   	issue_urlzIssueComment.issue_urle   $    t/$$$r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   node_idzIssueComment.node_idj   s$    t}}-}}"""r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   
updated_atzIssueComment.updated_ato   r,   r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   urlzIssueComment.urlt   s"    tyy)yyr   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   html_urlzIssueComment.html_urly   s$    t~~.~~###r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   r"   zIssueComment.user~   r)   r   c                d    | j                  | j                         | j                  j                  S r   )r'   r   r$   r   s    r   	reactionszIssueComment.reactions   r0   r   c                V    | j                   j                  d| j                        \  }}y)z
        :calls: `DELETE /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
        DELETEN)
_requesterrequestJsonAndCheckr6   )r   headersdatas      r   deletezIssueComment.delete   s"     ;;HdhhOr   c                    t        |t              sJ |       d|i}| j                  j                  d| j                  |      \  }}| j                  |       y)z
        :calls: `PATCH /repos/{owner}/{repo}/issues/comments/{id} <https://docs.github.com/en/rest/reference/issues#comments>`_
        r(   PATCH)inputN)
isinstancestrr>   r?   r6   _useAttributes)r   r(   post_parametersr@   rA   s        r   editzIssueComment.edit   sY     $$*d*$D
 ;;GTXXUd;eD!r   c                    t        t        j                  j                  | j                  | j                   dddt
        j                  i      S )z
        :calls: `GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
                <https://docs.github.com/en/rest/reference/reactions#list-reactions-for-an-issue-comment>`_
        
/reactionsNAcceptr@   )r   githubr   r>   r6   r   mediaTypeReactionsPreviewr   s    r   get_reactionszIssueComment.get_reactions   sD    
 OO$$OOxxj
#v??@
 	
r   c                   t        |t              sJ |       d|i}| j                  j                  d| j                   d|dt
        j                  i      \  }}t        j                  j                  | j                  ||d      S )z
        :calls: `POST /repos/{owner}/{repo}/issues/comments/{id}/reactions
                <https://docs.github.com/en/rest/reference/reactions#create-reaction-for-an-issue-comment>`_
        contentPOSTrL   rM   )rE   r@   T)	completed)	rF   rG   r>   r?   r6   r   rP   rO   r   )r   reaction_typerI   r@   rA   s        r   create_reactionzIssueComment.create_reaction   s    
 --<}<-}
 ;;xxj
#!v??@	 < 
 ''$RV'WWr   c                    t        |t              sJ |       | j                  j                  d| j                   d| dt
        j                  i      \  }}}|dk(  S )z
        :calls: `DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
                <https://docs.github.com/en/rest/reference/reactions#delete-an-issue-comment-reaction>`_
        r=   z/reactions/rM   rN      )rF   intr>   requestJsonr6   r   rP   )r   reaction_idstatus_s       r   delete_reactionzIssueComment.delete_reaction   sg    
 +s+8[8+22xxjK=1v??@ 3 
1
 }r   c                    t        |t              sJ |       | j                  |d}| j                  j	                  ddt        j                  |      id      \  }}|d   d   d   d	   d
u S )z
        :calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to minimize comment
        <https://docs.github.com/en/graphql/reference/mutations#minimizecomment>
        )	subjectId
classifierminimize_commentrE   z minimizedComment { isMinimized }mutation_name	variablesoutputrA   minimizeCommentminimizedCommentisMinimizedT)rF   rG   r2   r>   graphql_named_mutationr
   remove_unset_items)r   reasonrf   r^   rA   s        r   minimizezIssueComment.minimize   s    
 &#&..& 
	 //88, 9 9) DE5 9 
4
 F|-./AB=QUYYYr   c                    d| j                   i}| j                  j                  ddt        j                  |      id      \  }}|d   d   d   d	   d
u S )z
        :calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to unminimize comment
        <https://docs.github.com/en/graphql/reference/mutations#unminimizecomment>
        ra   unminimize_commentrE   z"unminimizedComment { isMinimized }rd   rA   unminimizeCommentunminimizedCommentrj   F)r2   r>   rk   r
   rl   )r   rf   r^   rA   s       r   
unminimizezIssueComment.unminimize   so     
	 //88. 9 9) DE7 9 
4
 F|/01EF}UY^^^r   c                |   d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j	                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j                  |d         | _	        d|v r| j                  |d         | _
        d	|v r2| j                  t        j                  j                  |d	         | _        d
|v r| j                  |d
         | _        y y )Nr(   r+   r!   r/   r2   r4   r6   r8   r"   r;   )_makeStringAttributer   _makeDatetimeAttributer   _makeIntAttributer   r   r   r   r   r   _makeClassAttributerO   	NamedUserr   _makeDictAttributer   )r   
attributess     r   rH   zIssueComment._useAttributes   sN   Z22:f3EFDJ:%#:::l;STD:--j.>?DH*$"77
;8OPDO
" 55j6KLDM:%#:::l;STDJ11*U2CDDI#!66z*7MNDNZ11&2B2B2L2LjY_N`aDJ*$"55j6MNDO %r   N)returnNone)r|   rG   )r|   r   )r|   rZ   )r|   zgithub.NamedUser.NamedUser)r|   dict)r(   rG   r|   r}   )r|   zPaginatedList[Reaction])rV   rG   r|   r   )r\   rZ   r|   bool)OUTDATED)rm   rG   r|   r   )r|   r   )r{   zdict[str, Any]r|   r}   )__name__
__module____qualname____doc__r   r%   propertyr(   r+   r!   r/   r2   r4   r6   r8   r"   r;   rB   rJ   rQ   rW   r_   rn   rs   rH    r   r   r   r   >   s   
2R     & &   % % # # & &   $ $     % %P	"
X"Z"_Or   r   )
__future__r   r   typingr   r   github.GithubObjectrO   github.NamedUserr   r   r	   r
   github.PaginatedListr   github.Reactionr   r   r   r   r   <module>r      s:   ^ #  %    J J .(zO* zOr   