
    b?i-                         S SK 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  SSKJr  SSKJr   " S	 S
5      rg)    )AnyDictListOptionalcast)NotRequired	TypedDict)request)PaginationHelper   )Contact)Topics)ContactSegmentsc            
          \ rS rSr\r\r " S S\5      r " S S\5      r	 " S S\5      r
 " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r\S\S\4S j5       r\S\S\4S j5       r\ SS\\   S\\	   S\
4S jj5       r\   SS\\   S\\   S\\   S\4S jj5       r\   SS\\   S\\   S\\   S\4S jj5       rSrg)Contacts   c                   <    \ rS rSr% Sr\\S'    \\S'    \\S'   Srg)Contacts.RemoveContactResponse   z
RemoveContactResponse is the type that wraps the response of the contact that was removed

Attributes:
    object (str): 'contact'
    contact (str): The ID of the removed contact
    deleted (bool): Whether the contact was deleted
objectcontactdeleted N)	__name__
__module____qualname____firstlineno____doc__str__annotations__bool__static_attributes__r       ]/var/www/html/livechat/backend/venv/lib/python3.13/site-packages/resend/contacts/_contacts.pyRemoveContactResponser      s+    	 	 	 	r#   r%   c                   J    \ rS rSr% \\   \S'    \\   \S'    \\   \S'   Srg)Contacts.ListParams)   limitafterbeforer   N)	r   r   r   r   r   intr    r   r"   r   r#   r$   
ListParamsr'   )   s6    3	 3	
 C  	r#   r-   c                   B    \ rS rSr% Sr\\S'    \\   \S'    \	\S'   Sr
g)Contacts.ListResponse;   a  
ListResponse type that wraps a list of contact objects with pagination metadata

Attributes:
    object (str): The object type, always "list"
    data (List[Contact]): A list of contact objects
    has_more (bool): Whether there are more results available
r   datahas_morer   N)r   r   r   r   r   r   r    r   r   r!   r"   r   r#   r$   ListResponser/   ;   s0    	 	 7m	 	r#   r3   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Contacts.CreateContactResponseR   z
CreateContactResponse is the type that wraps the response of the contact that was created

Attributes:
    object (str): The ID of the created contact
    id (str): The ID of the created contact
r   idr   Nr   r   r   r   r   r   r    r"   r   r#   r$   CreateContactResponser5   R       	 	 	r#   r9   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Contacts.UpdateContactResponsed   z
UpdateContactResponse is the type that wraps the response of the contact that was updated

Attributes:
    object (str): The ID of the updated contact
    id (str): The ID of the updated contact
r   r7   r   Nr8   r   r#   r$   UpdateContactResponser<   d   r:   r#   r>   c                       \ rS rSr% \\S'    \\   \S'    \\   \S'    \\   \S'    \\   \S'    \\\\	4      \S'   Sr
g	)
Contacts.CreateParamsv   emailaudience_id
first_name	last_nameunsubscribed
propertiesr   N)r   r   r   r   r   r    r   r!   r   r   r"   r   r#   r$   CreateParamsr@   v   sn    
	 !%%	  $$	 s##	 "$''	  S#X//	r#   rH   c                       \ rS rSr% \\   \S'    \\   \S'    \\   \S'    \\   \S'    \\   \S'    \\   \S'    \\\\	4      \S'   S	r
g
)Contacts.UpdateParams   r7   rB   rC   rD   rE   rF   rG   r   N)r   r   r   r   r   r   r    r!   r   r   r"   r   r#   r$   UpdateParamsrJ      s    	 3	 !%%	  $$	 s##	 "$''	  S#X//	r#   rL   paramsreturnc                     UR                  S5      nU(       a  SU S3nOSn[        R                  [        R                     " U[        [        [        [        4   U5      SS9R                  5       nU$ )a  
Create a new contact.
Can create either a global contact or an audience-specific contact.
see more: https://resend.com/docs/api-reference/contacts/create-contact

Args:
    params (CreateParams): The contact creation parameters
        - If audience_id is provided: creates audience-specific contact
        - If audience_id is omitted: creates global contact with optional properties field

Returns:
    CreateContactResponse: The created contact response
rC   /audiences/	/contactspostpathrM   verb)	getr
   Requestr   r9   r   r   r   perform_with_content)clsrM   rC   rT   resps        r$   createContacts.create   sl     jj/ Y7D Dx==>d4S>6:



  	 r#   c                    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UR                  S5      nU(       a	  SU SU 3nOSU 3n[        R                  [        R
                     " U[        [        [        [        4   U5      SS9R                  5       nU$ )	a  
Update an existing contact.
Can update either a global contact or an audience-specific contact.
see more: https://resend.com/docs/api-reference/contacts/update-contact

Args:
    params (UpdateParams): The contact update parameters
        - If audience_id is provided: updates audience-specific contact
        - If audience_id is omitted: updates global contact with optional properties field

Returns:
    UpdateContactResponse: The updated contact response.
r7   rB   id or email must be providedrC   rP   
/contacts/patchrS   )
rV   
ValueErrorr
   rW   r   r>   r   r   r   rX   )rY   rM   contact_identifierrC   rT   rZ   s         r$   updateContacts.update   s     ::d#

7(;(C;<< $*::g#6#BFJJw

SWHX 	 jj/ Z8J7KLD   234Dx==>d4S>6:



  	 r#   NrC   c                    U(       a  SU S3nOSnU(       a  [        [        [        [        4   U5      OSn[        R                  " X45      n[
        R                  [        R                     " U0 SS9R                  5       nU$ )a|  
List all contacts.
Can list either global contacts or audience-specific contacts.
see more: https://resend.com/docs/api-reference/contacts/list-contacts

Args:
    audience_id (Optional[str]): The audience ID. If not provided, lists all global contacts.
    params (Optional[ListParams]): Optional pagination parameters
        - limit: Number of contacts to retrieve (max 100, min 1).
          If not provided, all contacts will be returned without pagination.
        - after: ID after which to retrieve more contacts
        - before: ID before which to retrieve more contacts

Returns:
    ListResponse: A list of contact objects
rP   rQ   NrV   rS   )
r   r   r   r   build_paginated_pathr
   rW   r   r3   rX   )rY   rC   rM   	base_pathquery_paramsrT   rZ   s          r$   listContacts.list   sw    ( %k])<I $I7=tDcNF3444YMx445bu



  	 r#   r7   rB   c                     Ub  UOUnUc  [        S5      eU(       a	  SU SU 3nOSU 3n[        R                  [           " U0 SS9R	                  5       nU$ )a  
Get a contact.
Can retrieve either a global contact or an audience-specific contact.
see more: https://resend.com/docs/api-reference/contacts/get-contact

Args:
    audience_id (Optional[str]): The audience ID. If not provided, retrieves global contact.
    id (Optional[str]): The contact ID. Either id or email must be provided.
    email (Optional[str]): The contact email. Either id or email must be provided.

Returns:
    Contact: The contact object
r^   rP   r_   rV   rS   )ra   r
   rW   r   rX   rY   rC   r7   rB   rb   rT   rZ   s          r$   rV   Contacts.get  sw    * ',&7UR%;<< Z8J7KLD   234Dw'bu



  	 r#   c                     Ub  UOUnUc  [        S5      eU(       a	  SU SU 3nOSU 3n[        R                  [        R                     " U0 SS9R                  5       nU$ )a  
Remove a contact by ID or by Email.
Can remove either a global contact or an audience-specific contact.
see more: https://resend.com/docs/api-reference/contacts/delete-contact

Args:
    audience_id (Optional[str]): The audience ID. If not provided, removes global contact.
    id (Optional[str]): The contact ID. Either id or email must be provided.
    email (Optional[str]): The contact email. Either id or email must be provided.

Returns:
    RemoveContactResponse: The removed contact response object
r^   rP   r_   deleterS   )ra   r
   rW   r   r%   rX   rl   s          r$   removeContacts.remove6  s}    * ',&7UR%;<< Z8J7KLD   234Dx==>bx



  	 r#   r   )NN)NNN)r   r   r   r   r   Segmentsr   r	   r%   r-   r3   r9   r>   rH   rL   classmethodr[   rc   r   r   ri   r   rV   rp   r"   r   r#   r$   r   r      s   HF	 .Y $y .	 $	 $y 4y < L -B  8 !L !-B ! !F OS"3-8@8L	 B  &* #	"c]" SM" }	"
 
" "H  &* #	"c]" SM" }	"
 
" "r#   r   N)typingr   r   r   r   r   typing_extensionsr   r	   resendr
   resend.pagination_helperr   _contactr   _topicsr   segments._contact_segmentsr   r   r   r#   r$   <module>r{      s)    2 2 4  5   7L Lr#   