
    jM                         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 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mZ ddlmZ  e j2                  e j4                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)AlertPagePublic)AlertPublic)AlertTriggerWrite)AlertWriteAlertType)WebhookExamples)WebhookTestResult)WebhookWrite   )AsyncRawAlertsClientRawAlertsClient)"GetWebhookExamplesRequestAlertType.c                   8   e Zd ZdefdZedefd       Zdddddddej                  e
   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   defdZeeeeeedddedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej&                  eef      dej                  ej(                  e      dej                  e   ddfdZdddej(                  e   dej                  e   ddfdZdddedej                  e   defdZeee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                  ej&                  eef      dej                  ej(                  e      dej                  e   ddfdZddddej                  e   dej                  e   defdZeeeeeedddedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej&                  eef      dej                  ej(                  e      dej                  e   defdZy)AlertsClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     t/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/alerts/client.py__init__zAlertsClient.__init__   s    *.I    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAlertsClient
        r   r   s    r   with_raw_responsezAlertsClient.with_raw_response        r   Npagesizesortingfiltersrequest_optionsr$   r%   r&   r'   r(   c                Z    | j                   j                  |||||      }|j                  S )aM  
        Find alerts

        Parameters
        ----------
        page : typing.Optional[int]

        size : typing.Optional[int]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        AlertPagePublic
            OK

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.find_alerts()
        r#   r   find_alertsdatar   r$   r%   r&   r'   r(   	_responses          r   r+   zAlertsClient.find_alerts$   s8    H $$00D'7Tc 1 
	 ~~r   idnameenabled
alert_typemetadatatriggersr(   webhookr0   r1   r2   r3   r4   r5   c          
      `    | j                   j                  ||||||||      }	|	j                  S )a3  
        Create alert

        Parameters
        ----------
        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import WebhookWrite
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.create_alert(webhook=WebhookWrite(url='url', ), )
        r6   r0   r1   r2   r3   r4   r5   r(   r   create_alertr,   
r   r6   r0   r1   r2   r3   r4   r5   r(   r.   s
             r   r:   zAlertsClient.create_alertM   sD    Z $$11!+ 2 	
	 ~~r   r(   idsc                T    | j                   j                  ||      }|j                  S )a  
        Delete multiple alerts by their IDs

        Parameters
        ----------
        ids : typing.Sequence[str]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.delete_alert_batch(ids=['ids'], )
        r=   r(   r   delete_alert_batchr,   r   r=   r(   r.   s       r   rA   zAlertsClient.delete_alert_batch   s*    . $$77CQ`7a	~~r   c                T    | j                   j                  ||      }|j                  S )a  
        Get Alert by id

        Parameters
        ----------
        id : str

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

        Returns
        -------
        AlertPublic
            Alert resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.get_alert_by_id(id='id', )
        r<   r   get_alert_by_idr,   r   r0   r(   r.   s       r   rE   zAlertsClient.get_alert_by_id   s)    , $$44R4Y	~~r   id_c                b    | j                   j                  |||||||||		      }
|
j                  S )aP  
        Update alert

        Parameters
        ----------
        id_ : str

        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import WebhookWrite
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.update_alert(id_='id', webhook=WebhookWrite(url='url', ), )
        r8   r   update_alertr,   r   rG   r6   r0   r1   r2   r3   r4   r5   r(   r.   s              r   rJ   zAlertsClient.update_alert   sG    ` $$11!+ 2 

	 ~~r   r3   r(   c                T    | j                   j                  ||      }|j                  S )ab  
        Get webhook payload examples for all alert event types, optionally filtered by alert type

        Parameters
        ----------
        alert_type : typing.Optional[GetWebhookExamplesRequestAlertType]

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

        Returns
        -------
        WebhookExamples
            Webhook examples

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.get_webhook_examples()
        rL   r   get_webhook_examplesr,   r   r3   r(   r.   s       r   rO   z!AlertsClient.get_webhook_examples   s*    6 $$99Zap9q	~~r   c          
      `    | j                   j                  ||||||||      }	|	j                  S )a_  
        Test alert webhook

        Parameters
        ----------
        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        WebhookTestResult
            Webhook test

        Examples
        --------
        from Opik import OpikApi
        from Opik import WebhookWrite
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.alerts.test_webhook(webhook=WebhookWrite(url='url', ), )
        r8   r   test_webhookr,   r;   s
             r   rS   zAlertsClient.test_webhook  sD    \ $$11!+ 2 	
	 ~~r   ) __name__
__module____qualname__r   r   propertyr   r!   typingOptionalintstrr   r   r+   OMITr   boolr
   DictSequencer	   r:   rA   r   rE   rJ   r   r   rO   r   rS    r   r   r   r      s   J*; J  ?     &*%)(,(,;?' ooc"' ooc"	'
 %' %'  8' 
'Z $(%))-;?;?HL;?7 7 OOC 	7
 ooc"7 &7 OO$787 //&++c3h"787 //&//2C"DE7  87 
7t `dooc*=C__^=\	4 ^b # 6??>;Z fq < $(%))-;?;?HL;?;; 	;
 OOC ; ooc"; &; OO$78; //&++c3h"78; //&//2C"DE;  8; 
;@ KO;?	 OO$FG  8	
 
D $(%))-;?;?HL;?8 8 OOC 	8
 ooc"8 &8 OO$788 //&++c3h"788 //&//2C"DE8  88 
8r   r   c                   8   e Zd ZdefdZedefd       Zdddddddej                  e
   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   defdZeeeeeedddedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej&                  eef      dej                  ej(                  e      dej                  e   ddfdZdddej(                  e   dej                  e   ddfdZdddedej                  e   defdZeee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                  ej&                  eef      dej                  ej(                  e      dej                  e   ddfdZddddej                  e   dej                  e   defdZeeeeeedddedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej&                  eef      dej                  ej(                  e      dej                  e   defdZy)AsyncAlertsClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   zAsyncAlertsClient.__init__P  s    /~Nr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAlertsClient
        r   r    s    r   r!   z#AsyncAlertsClient.with_raw_responseS  r"   r   Nr#   r$   r%   r&   r'   r(   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Find alerts

        Parameters
        ----------
        page : typing.Optional[int]

        size : typing.Optional[int]

        sorting : typing.Optional[str]

        filters : typing.Optional[str]

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

        Returns
        -------
        AlertPagePublic
            OK

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.find_alerts()
        asyncio.run(main())
        r#   Nr*   r-   s          r   r+   zAsyncAlertsClient.find_alerts^  sF     N **66D'7Tc 7 
 
	 ~~
s   $979r/   r6   r0   r1   r2   r3   r4   r5   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)a  
        Create alert

        Parameters
        ----------
        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import WebhookWrite
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.create_alert(webhook=WebhookWrite(url='url', ), )
        asyncio.run(main())
        r8   Nr9   r;   s
             r   r:   zAsyncAlertsClient.create_alert  sR     ` **77!+ 8 	
 	
	 ~~	
   '<:<r<   r=   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aR  
        Delete multiple alerts by their IDs

        Parameters
        ----------
        ids : typing.Sequence[str]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.delete_alert_batch(ids=['ids'], )
        asyncio.run(main())
        r?   Nr@   rB   s       r   rA   z$AsyncAlertsClient.delete_alert_batch  s7     4 **==#Wf=gg	~~ h   !646c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)aG  
        Get Alert by id

        Parameters
        ----------
        id : str

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

        Returns
        -------
        AlertPublic
            Alert resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.get_alert_by_id(id='id', )
        asyncio.run(main())
        r<   NrD   rF   s       r   rE   z!AsyncAlertsClient.get_alert_by_id  s6     2 **::2:__	~~ `ri   rG   c                ~   K   | j                   j                  |||||||||		       d{   }
|
j                  S 7 w)a  
        Update alert

        Parameters
        ----------
        id_ : str

        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import WebhookWrite
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.update_alert(id_='id', webhook=WebhookWrite(url='url', ), )
        asyncio.run(main())
        r8   NrI   rK   s              r   rJ   zAsyncAlertsClient.update_alert  sU     f **77!+ 8 

 

	 ~~

s   (=;=rL   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Get webhook payload examples for all alert event types, optionally filtered by alert type

        Parameters
        ----------
        alert_type : typing.Optional[GetWebhookExamplesRequestAlertType]

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

        Returns
        -------
        WebhookExamples
            Webhook examples

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.get_webhook_examples()
        asyncio.run(main())
        rL   NrN   rP   s       r   rO   z&AsyncAlertsClient.get_webhook_examples?  s7     < **??:gv?ww	~~ xri   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)a  
        Test alert webhook

        Parameters
        ----------
        webhook : WebhookWrite

        id : typing.Optional[str]

        name : typing.Optional[str]

        enabled : typing.Optional[bool]

        alert_type : typing.Optional[AlertWriteAlertType]

        metadata : typing.Optional[typing.Dict[str, str]]

        triggers : typing.Optional[typing.Sequence[AlertTriggerWrite]]

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

        Returns
        -------
        WebhookTestResult
            Webhook test

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import WebhookWrite
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.alerts.test_webhook(webhook=WebhookWrite(url='url', ), )
        asyncio.run(main())
        r8   NrR   r;   s
             r   rS   zAsyncAlertsClient.test_webhook`  sR     b **77!+ 8 	
 	
	 ~~	
rg   ) rT   rU   rV   r   r   rW   r   r!   rX   rY   rZ   r[   r   r   r+   r\   r   r]   r
   r^   r_   r	   r:   rA   r   rE   rJ   r   r   rO   r   rS   r`   r   r   rb   rb   O  s   O*< O  #7     &*%)(,(,;?* ooc"* ooc"	*
 %* %*  8* 
*` $(%))-;?;?HL;?: : OOC 	:
 ooc": &: OO$78: //&++c3h"78: //&//2C"DE:  8: 
:z `dooc*=C__^=\	: dh  Q_A` lw B $(%))-;?;?HL;?>> 	>
 OOC > ooc"> &> OO$78> //&++c3h"78> //&//2C"DE>  8> 
>F KO;?	 OO$FG  8	
 
J $(%))-;?;?HL;?; ; OOC 	;
 ooc"; &; OO$78; //&++c3h"78; //&//2C"DE;  8; 
;r   rb   )rX   core.client_wrapperr   r   core.request_optionsr   types.alert_page_publicr   types.alert_publicr   types.alert_trigger_writer	   types.alert_write_alert_typer
   types.webhook_examplesr   types.webhook_test_resultr   types.webhook_writer   
raw_clientr   r   -types.get_webhook_examples_request_alert_typer   castAnyr\   r   rb   r`   r   r   <module>r{      s\     G 1 5 , 9 > 4 9 . = ] v{{6::s#w wt	L Lr   