a
    ž˜ëjÓ+  ã                   @   s¾   d Z ddlmZ ddlm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mZmZ dd	lmZmZmZ dd
lmZ ddlmZ G dd„ deeƒZG dd„ deƒZdS )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.é   )ÚBaseSDKé    )ÚEnum)ÚAnyÚDictÚListÚMappingÚOptionalÚUnionÚcast)Úutils)ÚHookContext)ÚerrorsÚ
operationsÚshared)Ú	BaseModelÚOptionalNullableÚUNSET)Úclean_server_url)Úunmarshal_json_responsec                   @   s   e Zd ZdZdZdS )ÚPartitionAcceptEnumúapplication/jsonútext/csvN)Ú__name__Ú
__module__Ú__qualname__ZAPPLICATION_JSONZTEXT_CSV© r   r   úZ/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/unstructured_client/general.pyr      s   r   c                
   @   s´   e Zd Zedddddœeejejf ee	j
 ee ee ee eeeef  ejdœdd„Zedddddœeejejf ee	j
 ee ee ee eeeef  ejdœdd„ZdS )ÚGeneralN)ÚretriesÚ
server_urlÚ
timeout_msÚaccept_header_overrideÚhttp_headers)Úrequestr   r    r!   r"   r#   Úreturnc                   s4  d}d}|du r| j j}|dur&|}n|  ||¡}t|ƒ}|dkrFd}tˆ tƒs^t ˆ tj	¡‰ t
tj	ˆ ƒ‰ | jdd||ˆ dddd|durŽ|jnd	|| j j‡ fd
d„|d�}	|tkrâ| j jturÈ| j j}nt dt dddd¡d¡}d}
t|tjƒrü|dgf}
| jt| j |�pddg | j jd�|	g d¢|
d�}d}t |dd¡�rxtjttttttf   |ƒ|j|j d¡�ppd|d�S t |dd¡�r¬tj|j|j|j d¡�p¤d|d�S t |dd¡�rÔtt j!|ƒ}t  "||¡‚t |dd ¡�rüt #|¡}t  $d!||¡‚t |d"d¡�r$tt j%|ƒ}t  &||¡‚t  $d#|¡‚dS )$á  Summary

        Description

        :param request: The request object to send.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param accept_header_override: Override the default accept header for this method
        :param http_headers: Additional headers to set or replace on requests.
        Nú#https://platform.unstructuredapp.ioúhttps://api.unstructuredapp.ioÚPOSTú/general/v0/generalTFú
user-agentú"application/json;q=1, text/csv;q=0c                      s   t  ˆ jdddtj¡S ©NFÚ	multipart©r   Zserialize_request_bodyZpartition_parametersr   ZPartitionParametersr   ©r$   r   r   Ú<lambda>O   s   ûz#General.partition.<locals>.<lambda>©ÚmethodÚpathÚbase_urlÚurl_variablesr$   Zrequest_body_requiredZrequest_has_path_paramsZrequest_has_query_paramsZuser_agent_headerZaccept_header_valuer#   ÚsecurityZget_serialized_bodyr!   Úbackoffé¸  é€ü
 ç®Gázþ?é@w Ú5xxÚ Ú	partition©Úconfigr5   Zoperation_idZoauth2_scopesZsecurity_source©Ú422Ú4XXÚ5XX©Zhook_ctxr$   Zerror_status_codesÚretry_configÚ200r   úContent-Type©ÚelementsÚstatus_codeÚcontent_typeÚraw_responser   ©Zcsv_elementsrL   rM   rN   rC   rD   Ú*úAPI error occurredrE   úUnexpected response received)'Úsdk_configurationr!   Ú_get_urlr   Ú
isinstancer   r   Ú	unmarshalr   ÚPartitionRequestr   Z_build_requestÚvaluer7   r   rG   ÚRetryConfigÚBackoffStrategyZ
do_requestr   Úmatch_responseÚPartitionResponser   r	   r   r   Ústrr   rL   ÚheadersÚgetÚtextr   ÚHTTPValidationErrorDataÚHTTPValidationErrorZstream_to_textÚSDKErrorÚServerErrorDataÚServerError©Úselfr$   r   r    r!   r"   r#   r5   r6   ÚreqrG   Zhttp_resZresponse_dataZhttp_res_textr   r0   r   r?      s¢    
ÿ
ê
ÿ
ûöÿúüÿ
zGeneral.partitionc                ƒ   s@  d}d}|du r| j j}|dur&|}n|  ||¡}t|ƒ}|dkrFd}tˆ tƒs^t ˆ tj	¡‰ t
tj	ˆ ƒ‰ | jdd||ˆ dddd|durŽ|jnd	|| j j‡ fd
d„|d�}	|tkrâ| j jturÈ| j j}nt dt dddd¡d¡}d}
t|tjƒrü|dgf}
| jt| j |�pddg | j jd�|	g d¢|
d�I dH }d}t |dd¡�r~tjttttttf   |ƒ|j|j d¡�pvd|d�S t |dd¡�r²tj|j|j|j d¡�pªd|d�S t |dd¡�rÚtt j!|ƒ}t  "||¡‚t |dd ¡�rt #|¡I dH }t  $d!||¡‚t |d"d¡�r0tt j%|ƒ}t  &||¡‚t  $d#|¡‚dS )$r&   Nr'   r(   r)   r*   TFr+   r,   c                      s   t  ˆ jdddtj¡S r-   r/   r   r0   r   r   r1   Ì   s   ûz)General.partition_async.<locals>.<lambda>r2   r8   r9   r:   r;   r<   r=   r>   r?   r@   rB   rF   rH   r   rI   rJ   r   rO   rC   rD   rP   rQ   rE   rR   )'rS   r!   rT   r   rU   r   r   rV   r   rW   r   Z_build_request_asyncrX   r7   r   rG   rY   rZ   Zdo_request_asyncr   r[   r\   r   r	   r   r   r]   r   rL   r^   r_   r`   r   ra   rb   Zstream_to_text_asyncrc   rd   re   rf   r   r0   r   Úpartition_async‘   s¢    
ÿ
ê
ÿ
ûöÿúüÿzGeneral.partition_async)r   r   r   r   r
   r   rW   ZPartitionRequestTypedDictr   r   rY   r	   r]   Úintr   r   r\   r?   ri   r   r   r   r   r      sB   ö
ÿõ ö
ÿõr   N) Ú__doc__Zbasesdkr   Úenumr   Útypingr   r   r   r   r	   r
   r   Zunstructured_clientr   Zunstructured_client._hooksr   Zunstructured_client.modelsr   r   r   Zunstructured_client.typesr   r   r   Z7unstructured_client._hooks.custom.clean_server_url_hookr   Z1unstructured_client.utils.unmarshal_json_responser   r]   r   r   r   r   r   r   Ú<module>   s   $