a
    ž˜ëj	
  ã                   @   st   d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
 ddlmZ ddlmZmZ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.é    Né   )ÚSDKInitHookÚBeforeRequestContextÚBeforeRequestHookÚAfterSuccessContextÚAfterSuccessHookÚAfterErrorContextÚAfterErrorHookÚHooks)Ú
init_hooks)ÚListÚOptionalÚTuple)Ú
HttpClientc                   @   sÐ   e Zd Zddœdd„Zeddœdd„Zeddœdd	„Zeddœd
d„Z	e
ddœdd„Zeeeeef dœdd„Zeejejdœdd„Zeejejdœdd„Zeeej ee eeej ee f dœdd„ZdS )ÚSDKHooksN)Úreturnc                 C   s$   g | _ g | _g | _g | _t| ƒ d S ©N)Úsdk_init_hooksÚbefore_request_hooksÚafter_success_hooksÚafter_error_hooksr   )Úself© r   úb/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/unstructured_client/_hooks/sdkhooks.pyÚ__init__   s
    zSDKHooks.__init__)Úhookr   c                 C   s   | j  |¡ d S r   )r   Úappend©r   r   r   r   r   Úregister_sdk_init_hook   s    zSDKHooks.register_sdk_init_hookc                 C   s   | j  |¡ d S r   )r   r   r   r   r   r   Úregister_before_request_hook   s    z%SDKHooks.register_before_request_hookc                 C   s   | j  |¡ d S r   )r   r   r   r   r   r   Úregister_after_success_hook!   s    z$SDKHooks.register_after_success_hookc                 C   s   | j  |¡ d S r   )r   r   r   r   r   r   Úregister_after_error_hook$   s    z"SDKHooks.register_after_error_hook)Úbase_urlÚclientr   c                 C   s$   | j D ]}| ||¡\}}q||fS r   )r   Úsdk_init)r   r"   r#   r   r   r   r   r$   '   s    
zSDKHooks.sdk_init)Úhook_ctxÚrequestr   c                 C   s.   | j D ]"}| ||¡}t|tƒr$|‚|}q|S r   )r   Úbefore_requestÚ
isinstanceÚ	Exception)r   r%   r&   r   Úoutr   r   r   r'   ,   s    

zSDKHooks.before_request)r%   Úresponser   c                 C   s.   | j D ]"}| ||¡}t|tƒr$|‚|}q|S r   )r   Úafter_successr(   r)   )r   r%   r+   r   r*   r   r   r   r,   7   s    

zSDKHooks.after_success)r%   r+   Úerrorr   c                 C   s8   | j D ](}| |||¡}t|tƒr&|‚|\}}q||fS r   )r   Úafter_errorr(   r)   )r   r%   r+   r-   r   Úresultr   r   r   r.   A   s    


zSDKHooks.after_error)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r    r	   r!   Ústrr   r   r$   r   ÚhttpxÚRequestr'   r   ÚResponser,   r   r   r)   r.   r   r   r   r   r      s"   þþûr   )Ú__doc__r4   Útypesr   r   r   r   r   r   r	   r
   Zregistrationr   Útypingr   r   r   Zunstructured_client.httpclientr   r   r   r   r   r   Ú<module>   s   (
