
    b?i*                         S r 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Jr  \
" SS	\	\   05      r " S
 S5      rg)zTemplates API operations.    )AnyDictListOptionalUnioncast)NotRequired	TypedDict)request)PaginationHelper   )TemplateTemplateListItemVariable_CreateParamsFromfromc                      \ 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\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\4S jj5       r\S\	S\
4S j5       r\S\S\4S j5       r\S\S\4S j5       r\S\S\4S j5       rS rg)"	Templates   z~Templates API resource.

The Templates API allows you to create, manage, and publish email templates
with optional variables.
c                       \ rS rSr% Sr\\S'    \\S'    \\   \S'    \\   \S'    \\\	\   \4      \S'    \\   \S'    \\	\
      \S	'   S
rg)Templates.CreateParams   aW  Parameters for creating a template.

Attributes:
    name (str): The name of the template (required).
    alias (str): The alias of the template.
    from (str): Sender email address. To include a friendly name, use the format
        "Your Name <sender@domain.com>". If provided, this value can be overridden
        when sending an email using the template.
    subject (str): Email subject. If provided, this value can be overridden when
        sending an email using the template.
    reply_to (Union[List[str], str]): Reply-to email address(es). For multiple
        addresses, send as an array of strings. If provided, this value can be
        overridden when sending an email using the template.
    html (str): The HTML version of the template (required).
    text (str): The plain text version of the message. If not provided, the HTML
        will be used to generate a plain text version. You can opt out of this
        behavior by setting value to an empty string.
    variables (List[Variable]): The array of variables used in the template.
        Each template may contain up to 20 variables.
namehtmlaliassubjectreply_totext	variables N__name__
__module____qualname____firstlineno____doc__str__annotations__r	   r   r   r   __static_attributes__r        _/var/www/html/livechat/backend/venv/lib/python3.13/site-packages/resend/templates/_templates.pyCreateParamsr      sp    	* 	'	/3(S!!eDIsN344)#4tH~..:r*   r,   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Templates.CreateResponseG   zResponse from creating a template.

Attributes:
    id (str): The Template ID.
    object (str): The object type (always "template").
idobjectr    Nr"   r#   r$   r%   r&   r'   r(   r)   r    r*   r+   CreateResponser.   G       	 2r*   r3   c                       \ rS rSr% Sr\\S'    \\   \S'    \\   \S'    \\   \S'    \\\	\   \4      \S'    \\   \S'    \\   \S	'    \\	\
      \S
'   Srg)Templates.UpdateParamsU   a  Parameters for updating a template.

Attributes:
    id (str): The Template ID (required).
    name (str): The name of the template.
    alias (str): The alias of the template.
    from (str): Sender email address.
    subject (str): Email subject.
    reply_to (Union[List[str], str]): Reply-to email address(es).
    html (str): The HTML version of the template.
    text (str): The plain text version of the message.
    variables (List[Variable]): The array of variables used in the template.
r0   r   r   r   r   r   r   r   r    Nr!   r    r*   r+   UpdateParamsr6   U   s    	 #'3(S!!eDIsN344)#/#4tH~..:r*   r8   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Templates.UpdateResponse|   zResponse from updating a template.

Attributes:
    id (str): The Template ID.
    object (str): The object type (always "template").
r0   r1   r    Nr2   r    r*   r+   UpdateResponser:   |   r4   r*   r<   c                   N    \ rS rSr% Sr\\   \S'    \\   \S'    \\   \S'   Sr	g)Templates.ListParams   zParameters for listing templates.

Attributes:
    limit (int): The number of templates to return (max 100).
    after (str): Return templates after this cursor.
    before (str): Return templates before this cursor.
limitafterbeforer    N)
r"   r#   r$   r%   r&   r	   intr(   r'   r)   r    r*   r+   
ListParamsr>      s3    	 3:31C  2r*   rD   c                   B    \ rS rSr% Sr\\S'    \\   \S'    \	\S'   Sr
g)Templates.ListResponse   a  Response from listing templates.

Attributes:
    object (str): The object type (always "list").
    data (List[TemplateListItem]): Array of template list items with a subset of template properties.
    has_more (bool): Whether there are more results available.
r1   datahas_morer    N)r"   r#   r$   r%   r&   r'   r(   r   r   boolr)   r    r*   r+   ListResponserF      s(    	 .#$$P7r*   rK   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Templates.PublishResponse   zResponse from publishing a template.

Attributes:
    id (str): The Template ID.
    object (str): The object type (always "template").
r0   r1   r    Nr2   r    r*   r+   PublishResponserM      r4   r*   rO   c                   0    \ rS rSr% Sr\\S'    \\S'   Srg)Templates.DuplicateResponse   zResponse from duplicating a template.

Attributes:
    id (str): The Template ID of the duplicated template.
    object (str): The object type (always "template").
r0   r1   r    Nr2   r    r*   r+   DuplicateResponserQ      s    	 92r*   rS   c                   <    \ rS rSr% Sr\\S'    \\S'    \\S'   Srg)Templates.RemoveResponse   zResponse from removing a template.

Attributes:
    id (str): The Template ID.
    object (str): The object type (always "template").
    deleted (bool): Whether the template was deleted.
r0   r1   deletedr    N)	r"   r#   r$   r%   r&   r'   r(   rJ   r)   r    r*   r+   RemoveResponserU      s!    	 2/r*   rX   paramsreturnc                     Sn[         R                  [        R                     " U[	        [
        [        [        4   U5      SS9R                  5       nU$ )a$  Create a new template.

Before you can use a template, you must publish it first. To publish a template,
use the Templates dashboard or publish() method.

Args:
    params: The template creation parameters.

Returns:
    CreateResponse: The created template response with ID and object type.

/templatespostpathrY   verb)r   Requestr   r3   r   r   r   perform_with_content)clsrY   r_   resps       r+   createTemplates.create   sK     y778d4S>6:



  	 r*   template_idc                 f    SU 3n[         R                  [           " U0 SS9R                  5       nU$ )zqRetrieve a template by ID.

Args:
    template_id: The Template ID.

Returns:
    Template: The template object.
/templates/getr^   )r   ra   r   rb   rc   rg   r_   rd   s       r+   rj   Templates.get   s=     [M*x(bu



  	 r*   Nc                     SnU(       a  [        [        [        [        4   U5      OSn[        R                  " X#5      n[
        R                  [        R                     " U0 SS9R                  5       nU$ )zList all templates with pagination support.

Args:
    params: Optional pagination parameters (limit, after, before).

Returns:
    ListResponse: The paginated list of templates.
r\   Nrj   r^   )
r   r   r   r   build_paginated_pathr   ra   r   rK   rb   )rc   rY   	base_pathquery_paramsr_   rd   s         r+   listTemplates.list   sd     !	7=tDcNF3444YMy556bu



  	 r*   c                    US   nSU 3nUR                  5        VVs0 s H  u  pEUS:w  d  M  XE_M     nnn[        R                  [        R                     " U[        [        [        [        4   U5      SS9R                  5       nU$ s  snnf )zUpdate an existing template.

Args:
    params: The template update parameters (must include id).

Returns:
    UpdateResponse: The updated template response with ID and object type.
r0   ri   patchr^   )	itemsr   ra   r   r<   r   r   r   rb   )rc   rY   rg   r_   kvupdate_paramsrd   s           r+   updateTemplates.update  s     Tl[M**0,,.F.$!AI.Fy778d4S>=A



  	 	 Gs
   B	B	c                 |    SU S3n[         R                  [        R                     " U0 SS9R	                  5       nU$ )zPublish a template to make it available for use.

Before you can use a template to send emails, you must publish it first.

Args:
    template_id: The Template ID.

Returns:
    PublishResponse: The published template response with ID and object type.
ri   z/publishr]   r^   )r   ra   r   rO   rb   rk   s       r+   publishTemplates.publish$  sE     [M2y889bv



  	 r*   c                 |    SU S3n[         R                  [        R                     " U0 SS9R	                  5       nU$ )zDuplicate a template.

Creates a copy of the specified template with all its properties and variables.

Args:
    template_id: The Template ID to duplicate.

Returns:
    DuplicateResponse: The duplicated template response with new ID and object type.
ri   z
/duplicater]   r^   )r   ra   r   rS   rb   rk   s       r+   	duplicateTemplates.duplicate6  sE     [M4y::;bv



  	 r*   c                 z    SU 3n[         R                  [        R                     " U0 SS9R	                  5       nU$ )zDelete a template.

Args:
    template_id: The Template ID.

Returns:
    RemoveResponse: The deletion response with ID, object type, and deleted status.
ri   deleter^   )r   ra   r   rX   rb   rk   s       r+   removeTemplates.removeH  sC     [M*y778bx



  	 r*   r    )N)r"   r#   r$   r%   r&   r   r,   r
   r3   r8   r<   rD   rK   rO   rS   rX   classmethodre   r'   r   rj   r   rq   ry   r|   r   r   r)   r    r*   r+   r   r      sk   );( );V3 3%;( %;N3 33Y 3$8y 8$3) 33I 30 0$ L ^  $ c h   (:. ,  " L ^  $ # /  " C ,=  "    r*   r   N)r&   typingr   r   r   r   r   r   typing_extensionsr	   r
   resendr   resend.pagination_helperr   	_templater   r   r   r'   r   r   r    r*   r+   <module>r      sH     9 9 4  5 ; ; C  A Ar*   