a
    ž˜ëj|  ã                   @   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mZ ddlmZ ddlZddlZdd	lmZmZmZmZmZ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"Z"e�r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. G dd„ deƒZ/dS )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.é   )ÚBaseSDK)ÚAsyncHttpClientÚClientOwnerÚ
HttpClientÚclose_clients)ÚSDKConfiguration)ÚLoggerÚget_default_logger)ÚRetryConfigé    N)ÚAnyÚCallableÚDictÚOptionalÚTYPE_CHECKINGÚUnionÚcast)Úutils)ÚSDKHooks)Úshared)ÚOptionalNullableÚUNSET)ÚDestinations)ÚGeneral)ÚJobs)ÚSources)Ú	Templates)Ú	Workflowsc                       s  e Zd ZU ded< ded< ded< ded< d	ed
< ded< dddddddœZddddddeddf	eeee e	g ee f f  ee ee ee
eef  ee ee ee ee ee ddœ
dd„Zedœdd„Z‡ fdd„Zdd„ Zdd „ Zd!d"„ Zd#d$„ Z‡  ZS )%ÚUnstructuredClientr   Údestinationsr   Újobsr   Úsourcesr   Ú	templatesr   Ú	workflowsr   Úgeneral)z unstructured_client.destinationsr   )zunstructured_client.jobsr   )zunstructured_client.sourcesr   )zunstructured_client.templatesr   )zunstructured_client.workflowsr   )zunstructured_client.generalr   )r   r    r!   r"   r#   r$   N)
Úapi_key_authÚserverÚ
server_urlÚ
url_paramsÚclientÚasync_clientÚretry_configÚ
timeout_msÚdebug_loggerÚreturnc
                    sH  d}
|du rt  ¡ }d}
tt|ƒtƒs.J dƒ‚d}|du rFt  ¡ }d}|	du rTtƒ }	tt|ƒtƒsjJ dƒ‚d}tˆ ƒr„‡ fdd„}nt	j
ˆ d�}|dur¬|dur¬t ||¡}t | t||
||||||||	d	�
¡ tƒ }|| jjd
< | j ¡ ^}}| ||¡\}| j_||k�r|| j_t | ttt| jƒ| jj| jj| jj| jj¡ dS )a½  Instantiates the SDK configuring it with the provided parameters.

        :param api_key_auth: The api_key_auth required for authentication
        :param server: The server by name to use for all methods
        :param server_url: The server URL to use for all methods
        :param url_params: Parameters to optionally template the server URL with
        :param client: The HTTP client to use for all synchronous methods
        :param async_client: The Async HTTP client to use for all asynchronous methods
        :param retry_config: The retry configuration to use for all supported methods
        :param timeout_ms: Optional request timeout applied to each operation in milliseconds
        TNFz;The provided client must implement the HttpClient protocol.zFThe provided async_client must implement the AsyncHttpClient protocol.c                      s   t jˆ ƒ d�S )N©r%   )r   ÚSecurity© r/   r1   úV/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/unstructured_client/sdk.pyÚ<lambda>[   ó    z-UnstructuredClient.__init__.<locals>.<lambda>r/   )
r)   Úclient_suppliedr*   Úasync_client_suppliedÚsecurityr'   r&   r+   r,   r-   Z_hooks)ÚhttpxZClientÚ
issubclassÚtyper   ZAsyncClientr	   r   Úcallabler   r0   r   Ztemplate_urlr   Ú__init__r   r   Úsdk_configurationÚ__dict__Zget_server_detailsZsdk_initr)   r'   ÚweakrefÚfinalizer   r   r   r5   r*   r6   )Úselfr%   r&   r'   r(   r)   r*   r+   r,   r-   r5   r6   r7   ÚhooksZcurrent_server_urlÚ_r1   r/   r2   r<   *   sv    ÿþÿþöþÿ

ùzUnstructuredClient.__init__)Únamec                 C   sî   || j v rÎ| j | \}}z0t |¡}t||ƒ}|| jƒ}t| ||ƒ |W S  tyˆ } z(td|› d|› d|› �ƒ|‚W Y d }~nNd }~0  tyÌ } z.td|› d|› d|› d|› �ƒ|‚W Y d }~n
d }~0 0 tdt| ƒj	› d|› d�ƒ‚d S )NzFailed to import module z for attribute z: zFailed to find class z in module ú'z' object has no attribute ')
Ú_sub_sdk_mapÚ	importlibÚimport_moduleÚgetattrr=   ÚsetattrÚImportErrorÚAttributeErrorr:   Ú__name__)rA   rD   Úmodule_pathÚ
class_nameÚmoduleÚklassÚinstanceÚer1   r1   r2   Ú__getattr__‰   s.    



ÿþÿþÿzUnstructuredClient.__getattr__c                    s0   t tƒ  ¡ ƒ}t | j ¡ ƒ}tt t|| ƒƒƒS ©N)ÚlistÚsuperÚ__dir__rF   ÚkeysÚsortedÚset)rA   Zdefault_attrsZ
lazy_attrs©Ú	__class__r1   r2   rX   Ÿ   s    zUnstructuredClient.__dir__c                 C   s   | S rU   r1   ©rA   r1   r1   r2   Ú	__enter__¤   s    zUnstructuredClient.__enter__c                 Ã   s   | S rU   r1   r^   r1   r1   r2   Ú
__aenter__§   s    zUnstructuredClient.__aenter__c                 C   s,   | j jd ur | j js | j j ¡  d | j _d S rU   )r=   r)   r5   Úclose©rA   Úexc_typeÚexc_valÚexc_tbr1   r1   r2   Ú__exit__ª   s    
ÿþzUnstructuredClient.__exit__c                 Ã   s2   | j jd ur&| j js&| j j ¡ I d H  d | j _d S rU   )r=   r*   r6   Úacloserb   r1   r1   r2   Ú	__aexit__²   s    
ÿþzUnstructuredClient.__aexit__)rM   Ú
__module__Ú__qualname__Ú__annotations__rF   r   r   r   Ústrr   r   r   r   r   r
   Úintr   r<   rT   rX   r_   r`   rf   rh   Ú__classcell__r1   r1   r\   r2   r      sT   
úôÿó_r   )0Ú__doc__Zbasesdkr   Z
httpclientr   r   r   r   Zsdkconfigurationr   Zutils.loggerr   r	   Zutils.retriesr
   r8   rG   Útypingr   r   r   r   r   r   r   Zunstructured_clientr   Zunstructured_client._hooksr   Zunstructured_client.modelsr   Zunstructured_client.typesr   r   r?   Z unstructured_client.destinationsr   Zunstructured_client.generalr   Zunstructured_client.jobsr   Zunstructured_client.sourcesr   Zunstructured_client.templatesr   Zunstructured_client.workflowsr   r   r1   r1   r1   r2   Ú<module>   s*   $