o
    wi                     @  s   d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ erRddlmZ ddlmZ dd	lmZ dd
lmZmZmZ ddlmZmZ eeef ZG dd ded ZG dd deZG dd deZdS )zfW&B Public API for integrations.

This module provides classes for interacting with W&B integrations.
    )annotations)TYPE_CHECKINGAnyClassVarUnion)override)gql)RelayPaginator)Document
Connection)RetryingClient)IntegrationSlackIntegrationWebhookIntegration)SlackIntegrationFieldsWebhookIntegrationFieldsc                      sT   e Zd ZU dZdZded< ded< 	dd fddZedddZdddZ	  Z
S )Integrationsz[A lazy iterator of `Integration` objects.

    <!-- lazydoc-ignore-class: internal -->
    NzClassVar[Document | None]QUERYz$Connection[IntegrationFields] | Nonelast_response2   clientr   	variablesdict[str, Any]per_pageintc                   s:   | j d u rddlm} t|t| _ t j|||d d S )Nr   )INTEGRATIONS_BY_ENTITY_GQL)r   r   )r   wandb.automations._generatedr   r   typesuper__init__)selfr   r   r   r   	__class__ R/home/ubuntu/.local/lib/python3.10/site-packages/wandb/apis/public/integrations.pyr    &   s   
zIntegrations.__init__returnNonec                 C  sb   ddl m} ddlm} | jj| j| jd}||}|j	 }r%|j
 }s)td||| _dS )z7Fetch and parse the response data for the current page.r   r   )IntegrationsByEntity)variable_valueszUnexpected response dataN)wandb._pydanticr   r   r(   r   executer   r   model_validateentityintegrations
ValueErrorr   )r!   r   r(   dataresultr-   connr$   r$   r%   _update_response3   s   
zIntegrations._update_responsenodeIntegrationFieldsr   c                 C  s   ddl m} ||S )Nr   )IntegrationAdapter)wandb.automations.integrationsr6   validate_python)r!   r4   r6   r$   r$   r%   _convert?   s   
zIntegrations._convert)r   )r   r   r   r   r   r   )r&   r'   )r4   r5   r&   r   )__name__
__module____qualname____doc__r   __annotations__r    r   r3   r9   __classcell__r$   r$   r"   r%   r      s   
 r   )r5   r   c                   @     e Zd ZdZd	ddZdS )
WebhookIntegrationszbA lazy iterator of `WebhookIntegration` objects.

    <!-- lazydoc-ignore-class: internal -->
    r4   r5   r&   r   c                 C     |j dkr|S d S )NGenericWebhookIntegration
typename__r!   r4   r$   r$   r%   r9   O      zWebhookIntegrations._convertN)r4   r5   r&   r   r:   r;   r<   r=   r9   r$   r$   r$   r%   rA   I       rA   c                   @  r@   )
SlackIntegrationsz`A lazy iterator of `SlackIntegration` objects.

    <!-- lazydoc-ignore-class: internal -->
    r4   r5   r&   r   c                 C  rB   )Nr   rD   rF   r$   r$   r%   r9   Y   rG   zSlackIntegrations._convertN)r4   r5   r&   r   rH   r$   r$   r$   r%   rJ   S   rI   rJ   N)r=   
__future__r   typingr   r   r   r   typing_extensionsr   	wandb_gqlr   wandb.apis.paginatorr	   wandb_graphql.language.astr
   r*   r   wandb.apis.public.apir   wandb.automationsr   r   r   r   r   r   r5   r   rA   rJ   r$   r$   r$   r%   <module>   s     ,
