o
    lWiOD                     @   s   d dl Z d dlmZ ddlmZ ddlmZ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 ddlmZ ddlmZ ddlmZ e e jdZG dd dZG dd dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)construct_type)UnprocessableEntityError)AddWorkspaceInviteResponseModel)"DeleteWorkspaceInviteResponseModel)HttpValidationError   ):BodyInviteUserV1WorkspaceInvitesAddPostWorkspacePermission.c                   @      e Zd ZdefddZeedddedejej	e  deje
 d	eje d
ee f
ddZedddej	e dejej	e  d	eje d
ee fddZddded	eje d
ee fddZdS )RawInvitesClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   k/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/workspace/invites/raw_client.py__init__      
zRawInvitesClient.__init__N	group_idsworkspace_permissionrequest_optionsemailr   r    r!   returnc             	   C   s   | j jjdd|||dddi|td}z>d|j  krdk r4n ntttt|	 d	}t
||d
W S |jdkrLtt|jtttt|	 d	d|	 }W n tyd   t|jt|j|jdw t|jt|j|d)a  
        Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace administrators. If the user is already in the workspace a 400 error will be returned.

        Parameters
        ----------
        email : str
            The email of the customer

        group_ids : typing.Optional[typing.Sequence[str]]
            The group ids of the user

        workspace_permission : typing.Optional[BodyInviteUserV1WorkspaceInvitesAddPostWorkspacePermission]
            The workspace permission of the user

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[AddWorkspaceInviteResponseModel]
            Successful Response
        v1/workspace/invites/addPOSTr"   r   r    content-typeapplication/jsonmethodjsonheadersr!   omit   ,  type_object_responsedata  r,   bodystatus_coder,   r8   r   httpx_clientrequestOMITr:   typingcastr   r
   r+   r   r   dictr,   r   r   r   textr   r"   r   r    r!   	_response_data_response_jsonr   r   r   create   sL   

zRawInvitesClient.creater   r!   emailsc             	   C   s   | j jjdd||dddi|td}z>d|j  krdk r3n ntttt|	 d	}t
||d
W S |jdkrKtt|jtttt|	 d	d|	 }W n tyc   t|jt|j|jdw t|jt|j|d)aM  
        Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace administrators.

        Parameters
        ----------
        emails : typing.Sequence[str]
            The email of the customer

        group_ids : typing.Optional[typing.Sequence[str]]
            The group ids of the user

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[AddWorkspaceInviteResponseModel]
            Successful Response
        v1/workspace/invites/add-bulkr%   rI   r   r'   r(   r)   r.   r/   r0   r3   r6   r7   r9   r;   r   rI   r   r!   rD   rE   rF   r   r   r   create_batcha   sJ   

zRawInvitesClient.create_batchr!   c             	   C   s   | j jjddd|iddi|td}z>d|j  krdk r2n ntttt|	 d	}t
||d
W S |jdkrJtt|jtttt|	 d	d|	 }W n tyb   t|jt|j|jdw t|jt|j|d)a8  
        Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace administrators.

        Parameters
        ----------
        email : str
            The email of the customer

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[DeleteWorkspaceInviteResponseModel]
            Successful Response
        v1/workspace/invitesDELETEr"   r'   r(   r)   r.   r/   r0   r3   r6   r7   r9   )r   r<   r=   r>   r:   r?   r@   r   r
   r+   r   r   rA   r,   r   r   r   rB   r   r"   r!   rD   rE   rF   r   r   r   delete   sH   

zRawInvitesClient.delete)__name__
__module____qualname__r   r   r>   strr?   OptionalSequencer   r	   r   r   rG   rM   r   rR   r   r   r   r   r      F    
J
Br   c                   @   r   )AsyncRawInvitesClientr   c                C   r   r   r   r   r   r   r   r      r   zAsyncRawInvitesClient.__init__Nr   r"   r   r    r!   r#   c             	      s   | j jjdd|||dddi|tdI dH }z>d|j  kr#d	k r8n ntttt|	 d
}t
||dW S |jdkrPtt|jtttt|	 d
d|	 }W n tyh   t|jt|j|jdw t|jt|j|d)a  
        Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace administrators. If the user is already in the workspace a 400 error will be returned.

        Parameters
        ----------
        email : str
            The email of the customer

        group_ids : typing.Optional[typing.Sequence[str]]
            The group ids of the user

        workspace_permission : typing.Optional[BodyInviteUserV1WorkspaceInvitesAddPostWorkspacePermission]
            The workspace permission of the user

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[AddWorkspaceInviteResponseModel]
            Successful Response
        r$   r%   r&   r'   r(   r)   Nr.   r/   r0   r3   r6   r7   r9   r   r<   r=   r>   r:   r?   r@   r   r
   r+   r   r   rA   r,   r   r   r   rB   rC   r   r   r   rG      sN   

zAsyncRawInvitesClient.createrH   rI   c             	      s   | j jjdd||dddi|tdI dH }z>d|j  kr"d	k r7n ntttt|	 d
}t
||dW S |jdkrOtt|jtttt|	 d
d|	 }W n tyg   t|jt|j|jdw t|jt|j|d)aR  
        Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace administrators.

        Parameters
        ----------
        emails : typing.Sequence[str]
            The email of the customer

        group_ids : typing.Optional[typing.Sequence[str]]
            The group ids of the user

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[AddWorkspaceInviteResponseModel]
            Successful Response
        rJ   r%   rK   r'   r(   r)   Nr.   r/   r0   r3   r6   r7   r9   r[   rL   r   r   r   rM   &  sL   

z"AsyncRawInvitesClient.create_batchrN   c             	      s   | j jjddd|iddi|tdI dH }z>d|j  kr!d	k r6n ntttt|	 d
}t
||dW S |jdkrNtt|jtttt|	 d
d|	 }W n tyf   t|jt|j|jdw t|jt|j|d)a=  
        Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace administrators.

        Parameters
        ----------
        email : str
            The email of the customer

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[DeleteWorkspaceInviteResponseModel]
            Successful Response
        rO   rP   r"   r'   r(   r)   Nr.   r/   r0   r3   r6   r7   r9   )r   r<   r=   r>   r:   r?   r@   r   r
   r+   r   r   rA   r,   r   r   r   rB   rQ   r   r   r   rR   g  sJ   

zAsyncRawInvitesClient.delete)rS   rT   rU   r   r   r>   rV   r?   rW   rX   r   r	   r   r   rG   rM   r   rR   r   r   r   r   rZ      rY   rZ   )r?   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.request_optionsr	   core.unchecked_base_modelr
   !errors.unprocessable_entity_errorr   )types.add_workspace_invite_response_modelr   ,types.delete_workspace_invite_response_modelr   types.http_validation_errorr   Jtypes.body_invite_user_v_1_workspace_invites_add_post_workspace_permissionr   r@   Anyr>   r   rZ   r   r   r   r   <module>   s     F