
    ]j>                         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mZ dd
lmZ  e j"                  e j$                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ActionsEnum)Webhook)WebhookSerializerForUpdate   )AsyncRawWebhooksClientRawWebhooksClient)InfoWebhooksResponse.c                      e Zd ZdefdZedefd       Zddddej                  e
   dej                  e   dej                  e   fd	Zeeeeeedd
de
dej                  ej                   e      dej                  ej$                     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ddddej                  e   dej                  e   defdZdddedej                  e   defdZdddedej                  e   ddfdZeeeeeedddedej                  ej                   e      dej                  ej$                     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y)WebhooksClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     J/root/env/lib/python3.12/site-packages/label_studio_sdk/webhooks/client.py__init__zWebhooksClient.__init__   s    ,NK    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawWebhooksClient
        r   r   s    r   with_raw_responsez WebhooksClient.with_raw_response        r   Nprojectrequest_optionsr    r!   c                T    | j                   j                  ||      }|j                  S )a  
        List all webhooks set up for your organization.

        Parameters
        ----------
        project : typing.Optional[str]
            Project ID

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

        Returns
        -------
        typing.List[Webhook]


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.list()
        r   r   listdatar   r    r!   	_responses       r   r$   zWebhooksClient.list    s)    8 $$))'?)[	~~r   actionsheaders	is_activer    send_for_all_actionssend_payloadr!   urlr)   r*   r+   r,   r-   c          
      `    | j                   j                  ||||||||      }	|	j                  S )a  
        Create a webhook for your organization.

        Parameters
        ----------
        url : str
            URL of webhook

        actions : typing.Optional[typing.Sequence[ActionsEnum]]

        headers : typing.Optional[typing.Any]
            Key Value Json of headers

        is_active : typing.Optional[bool]
            If value is False the webhook is disabled

        project : typing.Optional[int]

        send_for_all_actions : typing.Optional[bool]
            If value is False - used only for actions from WebhookAction

        send_payload : typing.Optional[bool]
            If value is False send only action

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

        Returns
        -------
        Webhook


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.create(
            url="url",
        )
        r.   r)   r*   r+   r    r,   r-   r!   r   creater%   
r   r.   r)   r*   r+   r    r,   r-   r!   r'   s
             r   r2   zWebhooksClient.create?   sD    n $$++!5%+ , 	
	 ~~r   organization_onlyr!   r5   c                T    | j                   j                  ||      }|j                  S )ao  
        Get descriptions of all available webhook actions to set up webhooks.

        Parameters
        ----------
        organization_only : typing.Optional[bool]
            organization-only or not

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

        Returns
        -------
        InfoWebhooksResponse
            Object with webhook action descriptions.

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.info()
        r4   r   infor%   r   r5   r!   r'   s       r   r8   zWebhooksClient.info   s+    > $$))<M_n)o	~~r   r!   idc                T    | j                   j                  ||      }|j                  S )a  
        Parameters
        ----------
        id : int

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

        Returns
        -------
        Webhook


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.get(
            id=1,
        )
        r:   r   getr%   r   r;   r!   r'   s       r   r>   zWebhooksClient.get   s)    2 $$((_(M	~~r   c                T    | j                   j                  ||      }|j                  S )a  
        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.delete(
            id=1,
        )
        r:   r   deleter%   r?   s       r   rB   zWebhooksClient.delete   s)    0 $$++B+P	~~r   r)   r*   r+   r,   r-   r.   r!   c          
      `    | j                   j                  ||||||||      }	|	j                  S )a  
        Parameters
        ----------
        id : int

        actions : typing.Optional[typing.Sequence[ActionsEnum]]

        headers : typing.Optional[typing.Any]
            Key Value Json of headers

        is_active : typing.Optional[bool]
            If value is False the webhook is disabled

        send_for_all_actions : typing.Optional[bool]
            If value is False - used only for actions from WebhookAction

        send_payload : typing.Optional[bool]
            If value is False send only action

        url : typing.Optional[str]
            URL of webhook

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

        Returns
        -------
        WebhookSerializerForUpdate


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.webhooks.update(
            id=1,
        )
        rC   r   updater%   
r   r;   r)   r*   r+   r,   r-   r.   r!   r'   s
             r   rF   zWebhooksClient.update   sD    j $$++!5%+ , 	
	 ~~r   )__name__
__module____qualname__r   r   propertyr   r   typingOptionalstrr   Listr   r$   OMITSequencer   Anyboolintr2   r   r8   r>   rB   r	   rF    r   r   r   r      s   L*; L  #4     26jn //#.HNXfHg	W	F BF/3+/(,6:.2;?A A !=>	A
 ,A ??4(A %A %ood3A ood+A  8A 
AL 48;?	  "??40   8	 
 
 D RV c v~/N Za 8 UY  &//.2Q ]a > BF/3+/6:.2$(;??? !=>	?
 ,? ??4(? %ood3? ood+? __S!?  8? 
$?r   r   c                      e Zd ZdefdZedefd       Zddddej                  e
   dej                  e   dej                  e   fd	Zeeeeeedd
de
dej                  ej                   e      dej                  ej$                     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ddddej                  e   dej                  e   defdZdddedej                  e   defdZdddedej                  e   ddfdZeeeeeedddedej                  ej                   e      dej                  ej$                     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y)AsyncWebhooksClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   zAsyncWebhooksClient.__init__  s    1Pr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawWebhooksClient
        r   r   s    r   r   z%AsyncWebhooksClient.with_raw_response!  r   r   Nr   r    r!   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)az  
        List all webhooks set up for your organization.

        Parameters
        ----------
        project : typing.Optional[str]
            Project ID

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

        Returns
        -------
        typing.List[Webhook]


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.list()


        asyncio.run(main())
        r   Nr#   r&   s       r   r$   zAsyncWebhooksClient.list,  s8     H **//Q`/aa	~~ b   !646r(   r.   r)   r*   r+   r,   r-   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)ay  
        Create a webhook for your organization.

        Parameters
        ----------
        url : str
            URL of webhook

        actions : typing.Optional[typing.Sequence[ActionsEnum]]

        headers : typing.Optional[typing.Any]
            Key Value Json of headers

        is_active : typing.Optional[bool]
            If value is False the webhook is disabled

        project : typing.Optional[int]

        send_for_all_actions : typing.Optional[bool]
            If value is False - used only for actions from WebhookAction

        send_payload : typing.Optional[bool]
            If value is False send only action

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

        Returns
        -------
        Webhook


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.create(
                url="url",
            )


        asyncio.run(main())
        r0   Nr1   r3   s
             r   r2   zAsyncWebhooksClient.createS  sR     ~ **11!5%+ 2 	
 	
	 ~~	
   '<:<r4   r5   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Get descriptions of all available webhook actions to set up webhooks.

        Parameters
        ----------
        organization_only : typing.Optional[bool]
            organization-only or not

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

        Returns
        -------
        InfoWebhooksResponse
            Object with webhook action descriptions.

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.info()


        asyncio.run(main())
        r4   Nr7   r9   s       r   r8   zAsyncWebhooksClient.info  s9     N **//BSet/uu	~~ vr[   r:   r;   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a)  
        Parameters
        ----------
        id : int

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

        Returns
        -------
        Webhook


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.get(
                id=1,
            )


        asyncio.run(main())
        r:   Nr=   r?   s       r   r>   zAsyncWebhooksClient.get  s7     B **..r?.SS	~~ Tr[   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a(  
        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.delete(
                id=1,
            )


        asyncio.run(main())
        r:   NrA   r?   s       r   rB   zAsyncWebhooksClient.delete  s7     @ **11"o1VV	~~ Wr[   rC   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)aQ  
        Parameters
        ----------
        id : int

        actions : typing.Optional[typing.Sequence[ActionsEnum]]

        headers : typing.Optional[typing.Any]
            Key Value Json of headers

        is_active : typing.Optional[bool]
            If value is False the webhook is disabled

        send_for_all_actions : typing.Optional[bool]
            If value is False - used only for actions from WebhookAction

        send_payload : typing.Optional[bool]
            If value is False send only action

        url : typing.Optional[str]
            URL of webhook

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

        Returns
        -------
        WebhookSerializerForUpdate


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.webhooks.update(
                id=1,
            )


        asyncio.run(main())
        rC   NrE   rG   s
             r   rF   zAsyncWebhooksClient.update  sR     z **11!5%+ 2 	
 	
	 ~~	
r]   )rH   rI   rJ   r   r   rK   r   r   rL   rM   rN   r   rO   r   r$   rP   rQ   r   rR   rS   rT   r2   r   r8   r>   rB   r	   rF   rU   r   r   rW   rW     s   Q*< Q  #9     26jn% //#.%HNXfHg%	W	%V BF/3+/(,6:.2;?I I !=>	I
 ,I ??4(I %I %ood3I ood+I  8I 
I\ 48;?	( "??40(  8	(
 
(T X\ "C "V__^5T "`g "H [_ !s !8W !cg !N BF/3+/6:.2$(;?GG !=>	G
 ,G ??4(G %ood3G ood+G __S!G  8G 
$Gr   rW   )rL   core.client_wrapperr   r   core.request_optionsr   types.actions_enumr   types.webhookr   #types.webhook_serializer_for_updater	   
raw_clientr   r   types.info_webhooks_responser   castrR   rP   r   rW   rU   r   r   <module>rj      sP     G 1 , # L A > v{{6::s#I IXy yr   