o
    lWis8                     @   s   d dl 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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   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ResourceMetadataResponseModel)WorkspaceResourceType   )AsyncRawResourcesClientRawResourcesClient)EBodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole.c                   @      e Zd ZdefddZedefddZddd	ed
e	de
je defddZeeeddd	eded
e	de
je de
je de
je de
je de
jfddZeeeddd	ed
e	de
je de
je de
je de
je de
jfddZdS )ResourcesClientclient_wrapperc                C      t |d| _d S N)r   )r
   _raw_clientselfr    r   i/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/workspace/resources/client.py__init__      zResourcesClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawResourcesClient
        r   r   r   r   r   with_raw_response      	z!ResourcesClient.with_raw_responseNrequest_optionsresource_idresource_typer   c                C   s   | j j|||d}|jS )a  
        Gets the metadata of a resource by ID.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

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

        Returns
        -------
        ResourceMetadataResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.workspace.resources.get(
            resource_id="resource_id",
            resource_type="voice",
        )
        r!   r   r   getdatar   r    r!   r   	_responser   r   r   r$   !   s   &zResourcesClient.get
user_emailgroup_idworkspace_api_key_idr   roler)   r*   r+   c          	   	   C   s    | j j|||||||d}|jS )aX  
        Grants a role on a workspace resource to a user or a group. It overrides any existing role this user/service account/group/workspace api key has on the resource. To target a user or service account, pass only the user email. The user must be in your workspace. To target a group, pass only the group id. To target a workspace api key, pass the api key id. The resource will be shared with the service account associated with the api key. You must have admin access to the resource to share it.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole
            Role to update the target principal with.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

        user_email : typing.Optional[str]
            The email of the user or service account.

        group_id : typing.Optional[str]
            The ID of the target group. To target the permissions principals have by default on this resource, use the value 'default'.

        workspace_api_key_id : typing.Optional[str]
            The ID of the target workspace API key. This isn't the same as the key itself that would you pass in the header for authentication. Workspace admins can find this in the workspace settings UI.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.workspace.resources.share(
            resource_id="resource_id",
            role="admin",
            resource_type="voice",
        )
        r,   r!   r)   r*   r+   r   r   sharer%   	r   r    r,   r!   r)   r*   r+   r   r'   r   r   r   r/   J   s   7	zResourcesClient.sharec                C   s   | j j||||||d}|jS )a  
        Removes any existing role on a workspace resource from a user, service account, group or workspace api key. To target a user or service account, pass only the user email. The user must be in your workspace. To target a group, pass only the group id. To target a workspace api key, pass the api key id. The resource will be unshared from the service account associated with the api key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

        user_email : typing.Optional[str]
            The email of the user or service account.

        group_id : typing.Optional[str]
            The ID of the target group. To target the permissions principals have by default on this resource, use the value 'default'.

        workspace_api_key_id : typing.Optional[str]
            The ID of the target workspace API key. This isn't the same as the key itself that would you pass in the header for authentication. Workspace admins can find this in the workspace settings UI.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.workspace.resources.unshare(
            resource_id="resource_id",
            resource_type="voice",
        )
        r!   r)   r*   r+   r   r   unsharer%   r   r    r!   r)   r*   r+   r   r'   r   r   r   r3      s   2zResourcesClient.unshare)__name__
__module____qualname__r   r   propertyr
   r   strr   typingOptionalr   r   r$   OMITr   Anyr/   r3   r   r   r   r   r      sl    
/	

G	r   c                   @   r   )AsyncResourcesClientr   c                C   r   r   )r	   r   r   r   r   r   r      r   zAsyncResourcesClient.__init__r   c                 C   r   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawResourcesClient
        r   r   r   r   r   r      r   z&AsyncResourcesClient.with_raw_responseNr   r    r!   r   c                   s    | j j|||dI dH }|jS )ab  
        Gets the metadata of a resource by ID.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

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

        Returns
        -------
        ResourceMetadataResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.resources.get(
                resource_id="resource_id",
                resource_type="voice",
            )


        asyncio.run(main())
        r"   Nr#   r&   r   r   r   r$      s
   .zAsyncResourcesClient.getr(   r,   r)   r*   r+   c          	   	      s(   | j j|||||||dI dH }|jS )a  
        Grants a role on a workspace resource to a user or a group. It overrides any existing role this user/service account/group/workspace api key has on the resource. To target a user or service account, pass only the user email. The user must be in your workspace. To target a group, pass only the group id. To target a workspace api key, pass the api key id. The resource will be shared with the service account associated with the api key. You must have admin access to the resource to share it.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole
            Role to update the target principal with.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

        user_email : typing.Optional[str]
            The email of the user or service account.

        group_id : typing.Optional[str]
            The ID of the target group. To target the permissions principals have by default on this resource, use the value 'default'.

        workspace_api_key_id : typing.Optional[str]
            The ID of the target workspace API key. This isn't the same as the key itself that would you pass in the header for authentication. Workspace admins can find this in the workspace settings UI.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.resources.share(
                resource_id="resource_id",
                role="admin",
                resource_type="voice",
            )


        asyncio.run(main())
        r-   Nr.   r0   r   r   r   r/     s   ?	zAsyncResourcesClient.sharec                   s&   | j j||||||dI dH }|jS )aB  
        Removes any existing role on a workspace resource from a user, service account, group or workspace api key. To target a user or service account, pass only the user email. The user must be in your workspace. To target a group, pass only the group id. To target a workspace api key, pass the api key id. The resource will be unshared from the service account associated with the api key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource.

        Parameters
        ----------
        resource_id : str
            The ID of the target resource.

        resource_type : WorkspaceResourceType
            Resource type of the target resource.

        user_email : typing.Optional[str]
            The email of the user or service account.

        group_id : typing.Optional[str]
            The ID of the target group. To target the permissions principals have by default on this resource, use the value 'default'.

        workspace_api_key_id : typing.Optional[str]
            The ID of the target workspace API key. This isn't the same as the key itself that would you pass in the header for authentication. Workspace admins can find this in the workspace settings UI.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.resources.unshare(
                resource_id="resource_id",
                resource_type="voice",
            )


        asyncio.run(main())
        r1   Nr2   r4   r   r   r   r3   U  s   :zAsyncResourcesClient.unshare)r5   r6   r7   r   r   r8   r	   r   r9   r   r:   r;   r   r   r$   r<   r   r=   r/   r3   r   r   r   r   r>      sl    
9	

O	r>   )r:   core.client_wrapperr   r   core.request_optionsr   &types.resource_metadata_response_modelr   types.workspace_resource_typer   
raw_clientr	   r
   Wtypes.body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_roler   castr=   r<   r   r>   r   r   r   r   <module>   s    8