
    b?i                         S SK JrJrJrJrJrJr  S SKJrJ	r	  S SK
Jr  S SKJr  SSKJrJr   " S S\	5      r " S	 S
\	5      r " S S\	5      r " S S\	5      r " S S5      rg)    )AnyDictListOptionalUnioncast)NotRequired	TypedDict)request)PaginationHelper   )ContactTopicTopicSubscriptionUpdatec                   J    \ rS rSr% \\   \S'    \\   \S'    \\   \S'   Srg)_ListParams   limitafterbefore N)	__name__
__module____qualname____firstlineno__r	   int__annotations__str__static_attributes__r       [/var/www/html/livechat/backend/venv/lib/python3.13/site-packages/resend/contacts/_topics.pyr   r      s6    s s r   r   c                   >    \ rS rSr% \\S'    \\   \S'    \\S'   Sr	g)_ListResponse   objectdatahas_morer   N)
r   r   r   r   r   r   r   r   boolr   r   r   r    r"   r"      s*    K |
 Nr   r"   c                   J    \ rS rSr% \\   \S'    \\   \S'    \\   \S'   Sr	g)_UpdateParams)   idemailtopicsr   N)
r   r   r   r   r	   r   r   r   r   r   r   r   r    r)   r)   )   s7    C s ())r   r)   c                        \ rS rSr% \\S'   Srg)_UpdateResponse8   r+   r   N)r   r   r   r   r   r   r   r   r   r    r/   r/   8   s    Gr   r/   c            
           \ rS rSrSr " S S\5      r " S S\5      r " S S\	5      r
 " S	 S
\5      r\   SS\\   S\\   S\S   SS4S jj5       r\S\
S\4S j5       rSrg)Topics?   zN
Topics class that provides methods for managing contact topic subscriptions.
c                       \ rS rSrSrSrg)Topics.ListParamsD   aM  
ListParams is the class that wraps the parameters for the list method.

Attributes:
    limit (NotRequired[int]): Number of topics to retrieve. Maximum is 100, minimum is 1.
    after (NotRequired[str]): Return topics after this cursor for pagination.
    before (NotRequired[str]): Return topics before this cursor for pagination.
r   Nr   r   r   r   __doc__r   r   r   r    
ListParamsr5   D       	r   r9   c                       \ rS rSrSrSrg)Topics.ListResponseN   a  
ListResponse is the type that wraps the response for listing contact topics.

Attributes:
    object (str): The object type: "list"
    data (List[ContactTopic]): The list of contact topic objects.
    has_more (bool): Whether there are more topics available for pagination.
r   Nr7   r   r   r    ListResponser<   N   r:   r   r>   c                       \ rS rSrSrSrg)Topics.UpdateParamsX   aa  
UpdateParams is the class that wraps the parameters for updating contact topic subscriptions.

Attributes:
    id (NotRequired[str]): The contact ID (either id or email must be provided)
    email (NotRequired[str]): The contact email (either id or email must be provided)
    topics (List[TopicSubscriptionUpdate]): List of topic subscription updates
r   Nr7   r   r   r    UpdateParamsr@   X   r:   r   rB   c                       \ rS rSrSrSrg)Topics.UpdateResponseb   z{
UpdateResponse is the type that wraps the response for updating contact topics.

Attributes:
    id (str): The contact ID
r   Nr7   r   r   r    UpdateResponserD   b   s    	r   rF   N
contact_idr,   paramsr5   returnr<   c                 
   Uc  UOUnUc  [        S5      eSU S3nU(       a  [        [        [        [        4   U5      OSn[        R
                  " XV5      n[        R                  [           " U0 SS9R                  5       nU$ )a  
List all topics for a contact.
see more: https://resend.com/docs/api-reference/contacts/list-contact-topics

Args:
    contact_id (Optional[str]): The contact ID (either contact_id or email must be provided)
    email (Optional[str]): The contact email (either contact_id or email must be provided)
    params (Optional[ListParams]): Optional pagination parameters
        - limit: Number of topics to retrieve (max 100, min 1).
          If not provided, all topics will be returned without pagination.
        - after: ID after which to retrieve more topics
        - before: ID before which to retrieve more topics

Returns:
    ListResponse: A list of contact topic objects

Raises:
    ValueError: If neither contact_id nor email is provided
Nz$contact_id or email must be provided
/contacts//topicsgetpathrH   verb)

ValueErrorr   r   r   r   build_paginated_pathr   Requestr"   perform_with_content)	clsrG   r,   rH   contact	base_pathquery_paramsrO   resps	            r    listTopics.listj   s    4 &-%:?CDD 	1	7=tDcNF3444YM}-bu



  	 r   c                 z   UR                  S5      c  UR                  S5      c  [        S5      eUR                  S5      b  UR                  S5      OUR                  S5      nSU S3n[        [        [        [
        [        4      US   5      n[        R                  [           " X4SS9R                  5       nU$ )	a  
Update topic subscriptions for a contact.
see more: https://resend.com/docs/api-reference/contacts/update-contact-topics

Args:
    params (UpdateParams): The topic update parameters
        - id: The contact ID (either id or email must be provided)
        - email: The contact email (either id or email must be provided)
        - topics: List of topic subscription updates

Returns:
    UpdateResponse: The updated contact response

Raises:
    ValueError: If neither id nor email is provided in params
r+   r,   zid or email must be providedrK   rL   r-   patchrN   )rM   rQ   r   r   r   r   r   r   rS   r/   rT   )rU   rH   rV   rO   request_bodyrY   s         r    updateTopics.update   s    $ ::d#

7(;(C;<< !'

4 0 <FJJt&**WBU 	 G9G, EIc3h &"2E
 /



  	 r   r   )NNN)r   r   r   r   r8   r   r9   r"   r>   r)   rB   r/   rF   classmethodr   r   rZ   r_   r   r   r   r    r2   r2   ?   s    [ } }    %)#04	#SM# }# ,-	#
 
# #J "L "^ " "r   r2   N)typingr   r   r   r   r   r   typing_extensionsr	   r
   resendr   resend.pagination_helperr   _contact_topicr   r   r   r"   r)   r/   r2   r   r   r    <module>rg      sS    9 9 4  5 A) I I i t tr   