o
    pkj>                     @   s   d Z ddlmZmZ ddlmZmZmZ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mZ ddlmZ dd	lZdd
lmZmZmZmZmZ G dd deZG dd dZG dd dZG dd deZG dd dZG dd dZ d	S )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )AsyncBaseSDKBaseSDK)errorsmodelstypesutils)AfterParseErrorContextHookContextResponseContext)OptionalNullableUNSETenvironments)get_security_from_envresponse_helpers)unmarshal_json_response    N)AnyMappingOptionalUnioncastc                   @      e Zd Zedd Zedd Zdddddddddeded	ee d
ee dee dee	 dee
eef  dee
eef  deeeejf  dejfddZdS )Filesc                 C      t | S N)FilesWithRawResponseself r   V/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/google/genai/_gaos/files.pywith_raw_response      zFiles.with_raw_responsec                 C   r   r   )FilesWithStreamingResponser   r   r   r   with_streaming_response"   r!   zFiles.with_streaming_responseNapi_version	page_size
page_token	recursiveextra_headersextra_querytimeoutenvironmentpathr%   r&   r'   r(   r)   r*   r+   returnc                C   s  d}
d}t }d}|}| |	}|du r| jj}|dur|}
n| |
|}
tj||||||d}t|\}}| j	d3i ddddd|
d|d	|d
dddddddddd|d|dtj
| jjjdd| jjddd|}|t kr| jjt ur| jj}ntjdtddddddd }d}t|tjr|g d!f}d"d# }t| j|
pd$d%dt| jjtjddt|d&d'd(}| j||d)d* |d+k|d,}|d-kr&td.d/g|jr|  z|| W n! ty } zt| jjd0 t||| W Y d}~nd}~ww |d+krtj ntj!}t"t#|||d1| t|| jj$d0d2S z||W S  tyM } zt| jjd0 t||| W Y d}~dS d}~ww )4  Retrieves a file or directory from an environment's snapshot.

        :param environment:
        :param path:
        :param api_version: Which version of the API to use.
        :param page_size: Optional. Maximum number of entries to return per page (for directory listing).
        :param page_token: Optional. Pagination token for directory listing.
        :param recursive: Optional. If true and the path is a directory, recursively lists all files.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr%   r,   r-   r&   r'   r(   methodGETr-   6/{api_version}/environments/{environment}/files/{path}base_urlurl_variablesrequestrequest_body_requiredFrequest_has_path_paramsTrequest_has_query_paramsuser_agent_header
user-agentaccept_header_valueapplication/jsonhttp_headersextra_query_params_globalsr%   securityallow_empty_value
timeout_msattempt-count-backoff  @     0u     max_retries4084094295XXc                 S   sv   t | ddrttj| ddS t | ddr"t | }td| |t | ddr5t | }td| |td	| 
N200r=   F)validate4XX*zAPI error occurredrQ   zUnexpected response received)r   match_responser   r   GetEnvironmentFilesResponsestream_to_textr   GenAiDefaultErrorhttp_reshttp_res_textr   r   r   _speakeasy_parse_response}   s   

z-Files.list.<locals>._speakeasy_parse_response GetEnvironmentFilessyncmode	executionconfigr4   operation_idoauth2_scopessecurity_sourcetags
extensionsresponsec                 S      t ddg| S NrU   rQ   r   match_status_codescr   r   r   <lambda>       zFiles.list.<locals>.<lambda>	streaminghook_ctxr6   is_error_status_codestreamretry_configparsedrU   rQ   _hooksbuffered)rawparserrc   
client_refrw   hooksr   )%r   _coerce_timeout_mssdk_configurationrD   _get_urlr   GetEnvironmentFilesRequestr   consume_response_mode_build_requestGetEnvironmentFilesGlobalsglobalsr%   rB   rz   r   RetryConfigBackoffStrategy
isinstancer	   r   r   Securityr
   
do_requestrp   status_coderead	Exceptionraise_parse_error__dict__r   StreamedAPIResponseAPIResponser   r   getr   r,   r-   r%   r&   r'   r(   r)   r*   r+   r4   r5   retries
server_urlr>   rD   r6   _speakeasy_response_modereqrz   r^   _speakeasy_hook_ctxr\   
parse_exc__speakeasy_response_clsr   r   r   list&   s  
	
	






	

z
Files.list__name__
__module____qualname__propertyr    r#   strr   intboolr   r   r   floathttpxTimeoutr   rX   r   r   r   r   r   r      B    

	
r   c                   @      e Zd ZdeddfddZdS )r   sdkr.   Nc                 C      || _ t|jd| _d S Nr)   )_sdkr   to_raw_response_wrapperr   r   r   r   r   r   __init__   s   zFilesWithRawResponse.__init__r   r   r   r   r   r   r   r   r   r          r   c                   @   r   )r"   r   r.   Nc                 C   r   r   )r   r   to_streamed_response_wrapperr   r   r   r   r   r         
z#FilesWithStreamingResponse.__init__r   r   r   r   r   r"      r   r"   c                   @   r   )
AsyncFilesc                 C   r   r   )AsyncFilesWithRawResponser   r   r   r   r       r!   zAsyncFiles.with_raw_responsec                 C   r   r   )AsyncFilesWithStreamingResponser   r   r   r   r#      r!   z"AsyncFiles.with_streaming_responseNr$   r,   r-   r%   r&   r'   r(   r)   r*   r+   r.   c                   s  d}
d}t }d}|}| |	}|du r| jj}|dur|}
n| |
|}
tj||||||d}t|\}}| j	d4i ddddd|
d|d	|d
dddddddddd|d|dtj
| jjjdd| jjddd|}|t kr| jjt ur| jj}ntjdtddddddd }d}t|tjr|g d!f}d"d# }t| j|
pd$d%dt| jjtjddt|d&d'd(}| j||d)d* |d+k|d,I dH }|d-kr@td.d/g|jr| I dH  z	||I dH  W n+ ty } zt| jjd0| jjd1t |||I dH  W Y d}~nd}~ww |d+kr#tj!ntj"}t#t$|||d2| t || jjd1| jjd0d3S z||I dH W S  tyt } zt| jjd0| jjd1t |||I dH  W Y d}~dS d}~ww )5r/   Nr0   r1   r2   r-   r3   r4   r5   r6   r7   Fr8   Tr9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rM   c                    s   t | ddrttj| ddS t | ddr&t | I d H }td| |t | ddr<t | I d H }td| |td	| rR   )r   rW   r   r   rX   stream_to_text_asyncr   rZ   r[   r   r   r   r^   7  s    z2AsyncFiles.list.<locals>._speakeasy_parse_responser_   r`   asyncrb   re   c                 S   rm   rn   ro   rq   r   r   r   rs   X  rt   z!AsyncFiles.list.<locals>.<lambda>ru   rv   r{   rU   rQ   _async_hooksr|   r}   )r~   r   rc   r   rw   r   async_hooksr   )%r   r   r   rD   r   r   r   r   r   _build_request_asyncr   r   r%   rB   rz   r   r   r   r   r	   r   r   r   r
   do_request_asyncrp   r   areadr   raise_parse_error_asyncr   r   r   AsyncStreamedAPIResponseAsyncAPIResponser   r   r   r   r   r   r      s
  
	
	






zAsyncFiles.listr   r   r   r   r   r      r   r   c                   @   r   )r   r   r.   Nc                 C   r   r   )r   r   async_to_raw_response_wrapperr   r   r   r   r   r     r   z"AsyncFilesWithRawResponse.__init__r   r   r   r   r   r   r   r   r   r     r   r   c                   @   r   )r   r   r.   Nc                 C   r   r   )r   r   "async_to_streamed_response_wrapperr   r   r   r   r   r     r   z(AsyncFilesWithStreamingResponse.__init__r   r   r   r   r   r     r   r   )!__doc__basesdkr   r   r_   r   r   r   r   r|   r   r	   r
   r   r   r   r   r   utils.unmarshal_json_responser   r   typingr   r   r   r   r   r   r   r"   r   r   r   r   r   r   r   <module>   s"    - 0