
    b6iK                     *   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 ddlmZ ddlmZ ddlmZ ddlm Z   e jB                  e jD                  d      Z# G d d      Z$ G d d      Z%y)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)#DeleteWorkspaceWebhookResponseModel)HttpValidationError)"PatchWorkspaceWebhookResponseModel)WebhookHmacSettings)#WorkspaceCreateWebhookResponseModel)!WorkspaceWebhookListResponseModel.c                   $   e Zd ZdefdZddddej                  e   dej                  e   de	e
   fdZdd	d
edej                  e   de	e   fdZdd	dedej                  e   de	e   fdZdd	dedededej                  e   de	e   f
dZy)RawWebhooksClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     i/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/webhooks/raw_client.py__init__zRawWebhooksClient.__init__   
    -    Ninclude_usagesrequest_optionsr#   r$   returnc                   | j                   j                  j                  ddd|i|      }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t	        j
                  t        t        t        |j                                     
      |j                         }t        |j                  t        |j                        |      # t        $ r6 t        |j                  t        |j                        |j                         w xY w)a  
        List all webhooks for a workspace

        Parameters
        ----------
        include_usages : typing.Optional[bool]
            Whether to include active usages of the webhook, only usable by admins

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

        Returns
        -------
        HttpResponse[WorkspaceWebhookListResponseModel]
            Successful Response
        v1/workspace/webhooksGETr#   methodparamsr$      ,  type_object_responsedata  headersbodystatus_coder6   r7   )r   httpx_clientrequestr9   typingcastr   r   jsonr	   r   dictr6   r   r   r   textr   r#   r$   	_response_data_response_jsons         r   listzRawWebhooksClient.list   s@   & ((55==# . , > 
		ti++1c15"? ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD( 	A4D( (?E'r$   settingsc                   | j                   j                  j                  dddt        |t        d      iddi|t
              }	 d	|j                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t         t        t         |j                                           |j                         }t%        |j                  t        |j                        |      # t"        $ r6 t%        |j                  t        |j                        |j&                        w xY w)a  
        Create a new webhook for the workspace with the specified authentication type.

        Parameters
        ----------
        settings : WebhookHmacSettings
            Webhook settings object containing auth_type and corresponding configuration

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

        Returns
        -------
        HttpResponse[WorkspaceCreateWebhookResponseModel]
            Successful Response
        r'   POSTrG   writer0   
annotation	directioncontent-typeapplication/jsonr*   r>   r6   r$   omitr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r   r   OMITr9   r<   r=   r   r   r>   r	   r   r?   r6   r   r   r   r@   r   rG   r$   rB   rC   rD   s         r   createzRawWebhooksClient.createR   s_   & ((55==#C$1DPW  2 , > 
		ti++1c17"A ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AE  !A4E   ?E?
webhook_idc                   | j                   j                  j                  dt        |       d|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                                     	      |j                         }t!        |j                  t        |j                        |
      # t        $ r6 t!        |j                  t        |j                        |j"                  
      w xY w)a  
        Delete the specified workspace webhook

        Parameters
        ----------
        webhook_id : str
            The unique ID for the webhook

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

        Returns
        -------
        HttpResponse[DeleteWorkspaceWebhookResponseModel]
            Successful Response
        v1/workspace/webhooks/DELETEr*   r$   r,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r
   r9   r<   r=   r   r   r>   r	   r   r?   r6   r   r   r   r@   r   rU   r$   rB   rC   rD   s         r   deletezRawWebhooksClient.delete   sB   & ((55==$%5j%A$BC+ > 
	
	ti++1c17"A ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD1 A4D1 1?E0is_disablednamec                   | j                   j                  j                  dt        |       d||dddi|t              }	 d|j
                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j
                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	                  |j                         }t#        |j
                  t        |j                        |      # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY w)a6  
        Update the specified workspace webhook

        Parameters
        ----------
        webhook_id : str
            The unique ID for the webhook

        is_disabled : bool
            Whether to disable or enable the webhook

        name : str
            The display name of the webhook (used for display purposes only).

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

        Returns
        -------
        HttpResponse[PatchWorkspaceWebhookResponseModel]
            Successful Response
        rW   PATCHr\   r]   rN   rO   rP   r,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r
   rR   r9   r<   r=   r   r   r>   r	   r   r?   r6   r   r   r   r@   r   rU   r\   r]   r$   rB   rC   rD   s           r   updatezRawWebhooksClient.update   s_   2 ((55==$%5j%A$BC*
  2 , > 
		ti++1c16"@ ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD= A4D= =?E<)__name__
__module____qualname__r   r   r<   Optionalboolr   r	   r   rE   r   r   rT   strr   r[   r   rb    r!   r   r   r      s   .*; . :>rv3p!'!63pPVP_P_`nPo3p	7	83pl dh9p.9pAGQ_A`9p	9	:9px VZ0p0p39??>3R0p	9	:0pf tx>p>p/3>p;>>pQWQ`Q`aoQp>p	8	9>pr!   r   c                   $   e Zd ZdefdZddddej                  e   dej                  e   de	e
   fdZdd	d
edej                  e   de	e   fdZdd	dedej                  e   de	e   fdZdd	dedededej                  e   de	e   f
dZy)AsyncRawWebhooksClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawWebhooksClient.__init__  r    r!   Nr"   r#   r$   r%   c                  K   | j                   j                  j                  ddd|i|       d{   }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||	      S |j                  d
k(  rUt        t        |j                        t	        j
                  t        t        t        |j                                           |j                         }t        |j                  t        |j                        |      7 # t        $ r6 t        |j                  t        |j                        |j                         w xY ww)a  
        List all webhooks for a workspace

        Parameters
        ----------
        include_usages : typing.Optional[bool]
            Whether to include active usages of the webhook, only usable by admins

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

        Returns
        -------
        AsyncHttpResponse[WorkspaceWebhookListResponseModel]
            Successful Response
        r'   r(   r#   r)   Nr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r9   r<   r=   r   r   r>   r   r   r?   r6   r   r   r   r@   rA   s         r   rE   zAsyncRawWebhooksClient.list  sO    & ..;;CC# . , D 
 
		ti++1c15"? ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooA
<  	ty'<'<d9K\K\F]dmdrdrss	ts4   /E7D2E7AD5 E7A4D5 ,E75?E44E7rF   rG   c                "  K   | j                   j                  j                  dddt        |t        d      iddi|t
               d	{   }	 d
|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t         t        t         |j                                           |j                         }t%        |j                  t        |j                        |      7 # t"        $ r6 t%        |j                  t        |j                        |j&                        w xY ww)a  
        Create a new webhook for the workspace with the specified authentication type.

        Parameters
        ----------
        settings : WebhookHmacSettings
            Webhook settings object containing auth_type and corresponding configuration

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

        Returns
        -------
        AsyncHttpResponse[WorkspaceCreateWebhookResponseModel]
            Successful Response
        r'   rI   rG   rJ   rK   rN   rO   rP   Nr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r   r   rR   r9   r<   r=   r   r   r>   r   r   r?   r6   r   r   r   r@   rS   s         r   rT   zAsyncRawWebhooksClient.create9  so    & ..;;CC#C$1DPW  2 , D 
 
		ti++1c17"A ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooM
H  	ty'<'<d9K\K\F]dmdrdrss	ts8   AF	E

FAE *F+A4E ,F?FFrU   c                  K   | j                   j                  j                  dt        |       d|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t        j                  t        t        t        |j                                     
      |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a  
        Delete the specified workspace webhook

        Parameters
        ----------
        webhook_id : str
            The unique ID for the webhook

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

        Returns
        -------
        AsyncHttpResponse[DeleteWorkspaceWebhookResponseModel]
            Successful Response
        rW   rX   rY   Nr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r
   r9   r<   r=   r   r   r>   r   r   r?   r6   r   r   r   r@   rZ   s         r   r[   zAsyncRawWebhooksClient.deletet  sP    & ..;;CC$%5j%A$BC+ D 
 
	
	ti++1c17"A ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	ts5   8F D;F  AD> F A4D> ,F >?E==F r\   r]   c                  K   | j                   j                  j                  dt        |       d||dddi|t               d{   }	 d|j
                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j
                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         
                  |j                         }t#        |j
                  t        |j                        |      7 # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY ww)a;  
        Update the specified workspace webhook

        Parameters
        ----------
        webhook_id : str
            The unique ID for the webhook

        is_disabled : bool
            Whether to disable or enable the webhook

        name : str
            The display name of the webhook (used for display purposes only).

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

        Returns
        -------
        AsyncHttpResponse[PatchWorkspaceWebhookResponseModel]
            Successful Response
        rW   r_   r`   rN   rO   rP   Nr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r
   rR   r9   r<   r=   r   r   r>   r   r   r?   r6   r   r   r   r@   ra   s           r   rb   zAsyncRawWebhooksClient.update  so    2 ..;;CC$%5j%A$BC*
  2 , D 
 
		ti++1c16"@ ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooK
F  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE
 'F(A4E
 ,F
?F		F)rc   rd   re   r   r   r<   rf   rg   r   r   r   rE   r   r   rT   rh   r   r[   r   rb   ri   r!   r   rk   rk      s   .*< . :>rv3p!'!63pPVP_P_`nPo3p	<	=3pl dh9p.9pAGQ_A`9p	>	?9px VZ0p0p39??>3R0p	>	?0pf tx>p>p/3>p;>>pQWQ`Q`aoQp>p	=	>>pr!   rk   )&r<   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   -types.delete_workspace_webhook_response_modelr   types.http_validation_errorr   ,types.patch_workspace_webhook_response_modelr   types.webhook_hmac_settingsr   -types.workspace_create_webhook_response_modelr   +types.workspace_webhook_list_response_modelr   r=   AnyrR   r   rk   ri   r!   r   <module>r      sl     ( % G @ 4 1 H 6 H _ = ] = _ [ v{{6::s#dp dpNdp dpr!   