
    R-j%                     v   d dl mZ d dlZd dlZd dlZd dlZd dl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 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 ddlmZmZ ddlmZm Z   ejB                  d      Z"	 d)dede	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ&	 d)dede	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ'	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ(	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ)	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ*	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ+	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ,	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ-	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ.	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fdZ/	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fd Z0	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fd!Z1	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fd"Z2	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fd#Z3	 d)de	e#e$ef   e%f   dee#e$ef      de#e$ef   fd$Z4 G d% d&ejj                        Z6 G d' d(ejj                        Z7y)*    )cached_propertyN)AnyOptionalUnion)	urlencode   )_api_module)_common)_extra_utils)_transformers)types)BaseApiClient)get_value_by_path)set_value_by_path),_UploadToFileSearchStoreOperation_from_mldev)AsyncDocuments	Documents)
AsyncPagerPagerzgoogle_genai.filesearchstores
api_clientfrom_objectparent_objectreturnc                     i }t        |dg      t        |dgt        |dg             t        |dg      -t        |dgt        j                  | t        |dg                   |S )Ndisplay_namedisplayNameembedding_modelembeddingModel)getvsetvtt_modelr   r   r   	to_objects       m/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/google/genai/file_search_stores.py%_CreateFileSearchStoreConfig_to_mldevr&   )   st    
 !)	+'(4kN;K)LM	+)*+7				*d;1B0CDE 
    c                 T    i }t        |dg      t        | t        |dg      |       |S Nconfig)r   r&   r#   s       r%   )_CreateFileSearchStoreParameters_to_mldevr+   =   s8    
 !)	+z".)Dxj19 
r'   c                 X    i }t        | dg      t        |ddgt        | dg             |S )Nforce_queryr   r    r   r   r$   s      r%   %_DeleteFileSearchStoreConfig_to_mldevr1   K   s8     !)	+y!-7+T+y-IJ	r'   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        t        | dg      |       |S )Nname_urlr*   )r   r    r1   r0   s      r%   )_DeleteFileSearchStoreParameters_to_mldevr5   W   s_     !)	+x ,VV$d;&AB	+z".)[8*%y 
r'   c                 X    i }t        | dg      t        |ddgt        | dg             |S )Nr3   r4   r/   r0   s      r%   &_GetFileSearchStoreParameters_to_mldevr7   g   s8     !)	+x ,VV$d;&AB	r'   c                     i }t        | dg      't        |dgt        | dg      D cg c]  }| c}       t        | dg      t        |dgt        | dg             |S c c}w )Ncustom_metadatacustomMetadatachunking_configchunkingConfigr/   r   r   r$   items       r%   _ImportFileConfig_to_mldevr?   r   s     !)	+)*+7	{->,?@A@$@A 
+)*+7	[,-. 
 	Bs   	Ac           
         i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             |S )Nr3   metadatadoneerrorresponse)r   r    _ImportFileResponse_from_mldevr0   s      r%   _ImportFileOperation_from_mldevrF      s     !)	+x ,VHd;9:	+
|$0ZL${ZL"AB	+x ,VHd;9:	+y!-WItK';<	+
|$0	&zl+Y	
 
r'   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        t        | dg      |       |S )Nfile_search_store_namer4   	file_namefileNamer*   )r   r    r?   r0   s      r%   _ImportFileParameters_to_mldevrK      s     !)	+012>	)*[345 
+}%1ZL${[M"BC	+z".tK(<iH	r'   c                     i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S )NsdkHttpResponsesdk_http_responseparentdocumentNamedocument_namer/   r0   s      r%   rE   rE      s     !)	+)*+7'(${=N<O*P 
+z".XJ[8* =>	+'(4_%tK.9I'JK	r'   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        |ddgt        | dg             |S )N	page_sizer.   pageSize
page_token	pageTokenr/   r0   s      r%   $_ListFileSearchStoresConfig_to_mldevrW      sm     !)	+}%1*-tK+/O 
+~&2	;[<.) 
r'   c                 R    i }t        | dg      t        t        | dg      |       |S r)   )r   rW   r0   s      r%   (_ListFileSearchStoresParameters_to_mldevrY      s6     !)	+z".([8*%y 
r'   c                    i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      't        |dgt        | dg      D cg c]  }| c}       |S c c}w )NrM   rN   nextPageTokennext_page_tokenfileSearchStoresfile_search_storesr/   r=   s       r%   (_ListFileSearchStoresResponse_from_mldevr_      s     !)	+)*+7'(${=N<O*P 
+()5&'kO;L)MN	+*+,8	{-?,@ABA$AB 
 	Cs   3	Bc                 `   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      't        |dgt        | dg      D cg c]  }| c}       t        | dg      t        |dgt        | dg             |S c c}w )	N	mime_typemimeTyper   r   r9   r:   r;   r<   r/   r=   s       r%   '_UploadToFileSearchStoreConfig_to_mldevrc     s     !)	+}%1d;&FG	+'(4kN;K)LM	+)*+7	{->,?@A@$@A 
+)*+7	[,-. 
 	Bs   3	B+c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        t        | dg      |       |S )NrH   r4   r*   )r   r    rc   r0   s      r%   +_UploadToFileSearchStoreParameters_to_mldevre   $  sk     !)	+012>	)*[345 
+z".+[8*%y 
r'   c                 V    i }t        | dg      t        |dgt        | dg             |S )NrM   rN   r/   r0   s      r%   4_UploadToFileSearchStoreResumableResponse_from_mldevrg   8  s@     !)	+)*+7'(${=N<O*P 
r'   c            	          e Zd Zedefd       Zdddeej                     dej                  fdZ
dddedeej                     dej                  fdZdddedeej                     ddfd	Zdddeej                      dej"                  fd
Zdddedeej&                     dej(                  fdZdddededeej,                     dej.                  fdZdddedeeej6                  e   ej:                  f   deej&                     dej<                  fdZdddedeej@                     de!fdZ"dddeej                      de#ej                     fdZ$y)FileSearchStoresr   c                 ,    t        | j                        S N)r   _api_clientselfs    r%   	documentszFileSearchStores.documentsG  s    T%%&&r'   Nr*   r*   c                   t        j                  |      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }|j                   si nt#        j$                  |j                         }	t         j&                  j)                  |	t+        |dd      rGdt+        |j                  d
d      t+        |j                  dd      t+        |j                  dd      dini       }
| j                  j-                  |
       |
S zCreates a File Search Store.

    Args:
      config (CreateFileSearchStoreConfig | None): Optional parameters for the
        request.

    Returns:
      FileSearchStore
    rp   iThis method is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r4   r]   r.   ?r*   Npostresponse_schemaresponse_json_schemainclude_all_fieldsrv   rw   rx   rD   kwargs)r    _CreateFileSearchStoreParametersrl   vertexai
ValueErrorr+   get
format_mapr   popr*   http_optionsr
   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsFileSearchStore_from_responsegetattr_verify_responsern   r*   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr   rD   response_dictreturn_values              r%   createzFileSearchStores.createK  s    <<O
   4 
 ?


Ol &))&1	!,,-=>!##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH 'mmBHMM1JM((77 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 8 L& 	%%l3r'   r3   c                   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
t+        |dd      rGdt+        |j                  d
d      t+        |j                  dd      t+        |j                  dd      dini       }| j                  j-                  |       |S aR  Gets metadata about a FileSearchStore.

    Args:
      name (str): The resource name of the FileSearchStore. Example:
        `FileSearchStores/my-file-search-store-123`
      config (GetFileSearchStoreConfig | None): Optional parameters for the
        request.

    Returns:
      A FileSearchStore object containing the metadata.
    r3   r*   rs   r4   {name}r.   rt   r*   Nr   rv   rw   rx   ry   rz   )r   _GetFileSearchStoreParametersrl   r}   r~   r7   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r   r   r   r   rn   r3   r*   r   r   r   r   r   r   rD   r   r   s               r%   r   zFileSearchStores.get  s   $ 99O   4 
 <OLl%))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM((77 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 8 L& 	%%l3r'   c                F   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       y
a  Deletes a FileSearchStore.

    Args:
      name (str): The resource name of the FileSearchStore. Example:
        `FileSearchStores/my-file-search-store-123`
      config (DeleteFileSearchStoreConfig | None): Optional parameters for the
        request.

    Returns:
      None
    r   rs   r4   r   r.   rt   r*   Ndelete)r    _DeleteFileSearchStoreParametersrl   r}   r~   r5   r   r   r   r   r*   r   r
   r   r   r   	rn   r3   r*   r   r   r   r   r   r   s	            r%   r   zFileSearchStores.delete  s   $ <<O   4 
 ?Ol%))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DLXt\<Hr'   c                   t        j                  |      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }|j                   si nt#        j$                  |j                         }	| j                  j                  st'        |	      }	t         j(                  j+                  |	t-        |dd       rGdt-        |j                  d	d       t-        |j                  d
d       t-        |j                  dd       dini       }
| j                  j/                  |
       |
S Nrp   rs   r4   r]   r.   rt   r*   r   rv   rw   rx   ry   rz   )r   _ListFileSearchStoresParametersrl   r}   r~   rY   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r_   ListFileSearchStoresResponser   r   r   r   s              r%   _listzFileSearchStores._list  s    ;;O
   4 
 >oNl%))&1	!,,-=>!##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM$$>}Mm55DD ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! E L& 	%%l3r'   rH   c                   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }	|@t!        |d	d       r3t        j"                  |	
      }
| j                  j%                  |
       |
S |	j&                  si nt)        j*                  |	j&                        }| j                  j                  st-        |      }t         j"                  j/                  |t!        |dd       rGdt!        |j                  dd       t!        |j                  dd       t!        |j                  dd       dini       }
| j                  j%                  |
       |
S NrH   r*   rs   r4   z>upload/v1beta/{file_search_store_name}:uploadToFileSearchStorer.   rt   r*   ru   should_return_http_response)rN   rv   rw   rx   ry   rz   )r   "_UploadToFileSearchStoreParametersrl   r}   r~   re   r   r   r   r   r*   r   r
   r   r   r   r   (UploadToFileSearchStoreResumableResponser   r   r   r   rg   r   rn   rH   r*   r   r   r   r   r   r   rD   r   r   s               r%   _upload_to_file_search_storez-FileSearchStores._upload_to_file_search_store`  sP    >>5O   4 
 A
l &))&1	LZ() 	
 P##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH g-t CC$l ''5&mmBHMM1JM$$J
m
 	66EE" $7 '.'..0A4( -4'..0F- +2'..0Dd+
 ! 	F 	
 * 	%%l3r'   rI   c                   t        j                  |||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d	|||	      }
|
j                   si nt#        j$                  |
j                         }| j                  j                  st'        |      }t         j(                  j+                  |t-        |dd      rGdt-        |j                  d
d      t-        |j                  dd      t-        |j                  dd      dini       }| j                  j/                  |       |S a  Imports a File from File Service to a FileSearchStore.

    This is a long-running operation, see aip.dev/151

    Args:
      file_search_store_name (str): The resource name of the FileSearchStore.
        Example: `fileSearchStores/my-file-search-store-123`
      file_name (str): The resource name of the File to import. Example:
        `files/abc-123`
      config (ImportFileConfig | None): Optional parameters for the request.

    Returns:
      ImportFileOperation.
    )rH   rI   r*   rs   r4   z#{file_search_store_name}:importFiler.   rt   r*   Nru   rv   rw   rx   ry   rz   )r   _ImportFileParametersrl   r}   r~   rK   r   r   r   r   r*   r   r
   r   r   r   r   r   r   rF   ImportFileOperationr   r   r   rn   rH   rI   r*   r   r   r   r   r   r   rD   r   r   s                r%   import_filezFileSearchStores.import_file  s   , 115O   4 
 4ODl%))&1	4??
 5##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH 'mmBHMM1JM$$5mDm,,;; ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! < L& 	%%l3r'   filec                   | j                   j                  rt        d      |i }n.t        |t              rt	        |      }n|j                  d      }t        j                  ||j                  d      |j                  d            \  }}}i ||dd}| j                  |t        j                  di |      }	|	j                  F|	j                  j                  0d	|	j                  j                  vr#d
|	j                  j                  vrt        d      d	|	j                  j                  v r|	j                  j                  d	   }
n|	j                  j                  d
   }
t        |t        j                         r | j                   j#                  ||
||      }n4t%        j&                  |      }| j                   j#                  ||
||      }t)        |j*                        }t        j,                  j/                  |i       S )au  Calls the API to upload a file to the given file search store.

    Args:
      file_search_store_name: The resource name of the FileSearchStore. Example:
        `fileSearchStores/file-search-store-123`
      file: A path to the file or an `IOBase` object to be uploaded. If it's an
        IOBase object, it must be opened in blocking (the default) mode and
        binary mode. In other words, do not use non-blocking mode or text mode.
        The given stream must be seekable, that is, it must be able to call
        `seek()` on 'path'.
      config: Optional parameters to set `diplay_name`, `mime_type`, and others.
    =This method is only supported in the Gemini Developer client.Texclude_unsetr   ra   user_http_optionsuser_mime_typer   r   r   x-goog-upload-urlX-Goog-Upload-URL`Failed to upload file to file search store. Upload URL did not returned from the upload request.r   rz    )rl   r}   r~   
isinstancedict
model_dumpr   prepare_resumable_uploadr   r   r   UploadToFileSearchStoreConfigrN   headersKeyErrorioIOBaseupload_fileosfspathr   r    UploadToFileSearchStoreOperationr   rn   rH   r   r*   user_config_dictr   
size_bytes_final_config_dictrD   
upload_urlupload_responsefs_pathr   s                 r%   upload_to_file_search_storez,FileSearchStores.upload_to_file_search_store  s   &   
I  ~)+	FD	!f***>"."G"G*..~>'++K8#L*a

$'+
 00522G5FG 1 H
 	""*%%--5x'A'A'I'II#8+E+E+M+MM /  
 : : B B	B--556IJj--556IJj$		"((44

J\ 5 o 		$g((44
:z 5 o AM 11@@r A  r'   media_idc                h   | j                   j                  rt        d      |j                  d      }d|vrt        d|d      | d}d}|r(t	        |t
              rt        j                  d
i |}n|}d}|rt        |dg      t        |dg      }| j                   j                  ||	      }|S a  Downloads media using a Media ID.

    The media_id has the format:
      fileSearchStores/<store>/media/<blob_id>

    This is mapped to the DownloadMedia RPC which expects:
      GET /{name=fileSearchStores/*/media/*}

    Args:
      media_id: The Media ID from grounding metadata.
      config: Optional configuration for the download.

    Returns:
      bytes: The media data.
    r   /z/media/zInvalid media_id format: z;. Expected format: fileSearchStores/<store>/media/<blob_id>z
?alt=mediaNr   r   r   )
rl   r}   r~   lstripr   r   r   DownloadMediaConfigr   download_filern   r   r*   clean_idr   config_modelr   datas           r%   download_mediazFileSearchStores.download_mediaa  s    *   
I  s#H %h\ 2F F 
 Zz"DL	FD	!00:6:L\N+;<H,(89l))! * D Kr'   c                V    | j                   }t        d|| j                  |      |      S )a  Lists FileSearchStores.

    Args:
      config (ListFileSearchStoresConfig): Optional configuration for the list
        request.

    Returns:
      A Pager object that contains one page of file search stores. When
      iterating over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      for file_search_store in client.file_search_stores.list():
        print(f"file search store: {file_search_store.name} -
        {file_search_store.display_name}")
    r^   rp   )r   r   rn   r*   list_requests      r%   listzFileSearchStores.list  s1    , ::L

&
!	 r'   )%__name__
__module____qualname__r   r   ro   r   r   !CreateFileSearchStoreConfigOrDictr   r   strGetFileSearchStoreConfigOrDictr   !DeleteFileSearchStoreConfigOrDictr    ListFileSearchStoresConfigOrDictr   r   #UploadToFileSearchStoreConfigOrDictr   r   ImportFileConfigOrDictr   r   r   r   PathLiker   r   r   r   DownloadMediaConfigOrDictbytesr   r   r   r   r'   r%   ri   ri   E  sJ   ' ' ' LPK G GHKKb @D	M M u;;<	M
 Mf CG	5I 5I u>>?	5I
 5Ip KO@ F FG@))@L EI	X "X u@@A	X
 55X~ 8<Y "Y 	Y
 u334Y   Y@ EIJ "J #r{{3'23	J
 u@@AJ --J` ;?	2 2 u667	2
 2j KO F FGU""#r'   ri   c            	          e Zd Zedefd       Zdddeej                     dej                  fdZ
dddedeej                     dej                  fdZdddedeej                     ddfd	Zdddeej                      dej"                  fd
Zdddedeej&                     dej(                  fdZdddededeej,                     dej.                  fdZdddedeeej6                  e   ej:                  f   deej&                     dej<                  fdZdddedeej@                     de!fdZ"dddeej                      de#ej                     fdZ$y)AsyncFileSearchStoresr   c                 ,    t        | j                        S rk   )r   rl   rm   s    r%   ro   zAsyncFileSearchStores.documents  s    $**++r'   Nrp   r*   c                  K   t        j                  |      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }|j                   si nt#        j$                  |j                         }	t         j&                  j)                  |	t+        |dd      rGdt+        |j                  d
d      t+        |j                  dd      t+        |j                  dd      dini       }
| j                  j-                  |
       |
S 7 íwrr   )r   r|   rl   r}   r~   r+   r   r   r   r   r*   r   r
   r   r   async_requestr   r   r   r   r   r   r   r   s              r%   r   zAsyncFileSearchStores.create  s     <<O
   4 
 ?


Ol &))&1	!,,-=>!##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H 'mmBHMM1JM((77 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 8 L& 	%%l35s   D/G71G52CG7r3   c                  K   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }	|	j                   si nt#        j$                  |	j                         }
t         j&                  j)                  |
t+        |dd      rGdt+        |j                  d
d      t+        |j                  dd      t+        |j                  dd      dini       }| j                  j-                  |       |S 7 íwr   )r   r   rl   r}   r~   r7   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r   r   r   r   r   s               r%   r   zAsyncFileSearchStores.get  s    $ 99O   4 
 <OLl%))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM((77 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 8 L& 	%%l35s   D%G-'G+(CG-c                b  K   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{    y7 wr   )r   r   rl   r}   r~   r5   r   r   r   r   r*   r   r
   r   r   r   r   s	            r%   r   zAsyncFileSearchStores.deleteX  s+    $ <<O   4 
 ?Ol%))&1	""#34##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL



(
($l  s   D%D/'D-(D/c                  K   t        j                  |      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d {   }|j                   si nt#        j$                  |j                         }	| j                  j                  st'        |	      }	t         j(                  j+                  |	t-        |dd       rGdt-        |j                  d	d       t-        |j                  d
d       t-        |j                  dd       dini       }
| j                  j/                  |
       |
S 7 wr   )r   r   rl   r}   r~   rY   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r_   r   r   r   r   r   s              r%   r   zAsyncFileSearchStores._list  s     ;;O
   4 
 >oNl%))&1	!,,-=>!##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM$$>}Mm55DD ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! E L& 	%%l3;s   D$H&H'C%HrH   c                  K   t        j                  ||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d {   }	|@t!        |d	d       r3t        j"                  |	
      }
| j                  j%                  |
       |
S |	j&                  si nt)        j*                  |	j&                        }| j                  j                  st-        |      }t         j"                  j/                  |t!        |dd       rGdt!        |j                  dd       t!        |j                  dd       t!        |j                  dd       dini       }
| j                  j%                  |
       |
S 7 'wr   )r   r   rl   r}   r~   re   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r   r   r   rg   r   r   s               r%   r   z2AsyncFileSearchStores._upload_to_file_search_store  s_     >>5O   4 
 A
l &))&1	LZ() 	
 P##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H g-t CC$l ''5&mmBHMM1JM$$J
m
 	66EE" $7 '.'..0A4( -4'..0F- +2'..0Dd+
 ! 	F 	
 * 	%%l3Us   D%I'I(D'IrI   c                "  K   t        j                  |||      }| j                  j                  rt	        d      t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d	|||	       d{   }
|
j                   si nt#        j$                  |
j                         }| j                  j                  st'        |      }t         j(                  j+                  |t-        |dd      rGdt-        |j                  d
d      t-        |j                  dd      t-        |j                  dd      dini       }| j                  j/                  |       |S 7 wr   )r   r   rl   r}   r~   rK   r   r   r   r   r*   r   r
   r   r   r   r   r   r   rF   r   r   r   r   r   s                r%   r   z!AsyncFileSearchStores.import_file/  s    , 115O   4 
 4ODl%))&1	4??
 5##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H 'mmBHMM1JM$$5mDm,,;; ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! < L& 	%%l3;s   D&H(H)C%Hr   c                Z  K   | j                   j                  rt        d      |i }n.t        |t              rt	        |      }n|j                  d      }t        j                  ||j                  d      |j                  d            \  }}}i ||dd}| j                  |t        j                  di |	       d{   }	|	j                  F|	j                  j                  0d
|	j                  j                  vr#d|	j                  j                  vrt        d      d
|	j                  j                  v r|	j                  j                  d
   }
n|	j                  j                  d   }
t        |t        j                         r(| j                   j#                  ||
||       d{   }n<t%        j&                  |      }| j                   j#                  ||
||       d{   }t)        |j*                        }t        j,                  j/                  |i       S 7 a7 z7 ?w)at  Calls the API to upload a file to the given file search store.

    Args:
      file_search_store_name: The resource name of the FileSearchStore. Example:
        `fileSearchStores/file-search-store-123`
      file: A path to the file or an `IOBase` object to be uploaded. If it's an
        IOBase object, it must be opened in blocking (the default) mode and
        binary mode. In other words, do not use non-blocking mode or text mode.
        The given stream must be seekable, that is, it must be able to call
        `seek()` on 'path'.
      config: Optional parameters to set `diplay_name`, `mime_type` and others.
    r   NTr   r   ra   r   r   r   r   r   r   r   rz   r   )rl   r}   r~   r   r   r   r   r   r   r   r   r   rN   r   r   r   r   async_upload_filer   r   r   r   r   r   r   s                 r%   r   z1AsyncFileSearchStores.upload_to_file_search_store  s=    &   
I  ~)+	FD	!f***>"."G"G*..~>'++K8#L*a

$'+
 66522G5FG 7  H
 	""*%%--5x'A'A'I'II#8+E+E+M+MM /  
 : : B B	B--556IJj--556IJj$		""..@@

J\ A  o 		$g"..@@
:z A  o AM 11@@r A  A*
s7   CH+H$C(H+,H'-<H+)H)*;H+'H+)H+r   c                  K   | j                   j                  rt        d      |j                  d      }d|vrt        d|d      | d}d}|r(t	        |t
              rt        j                  d
i |}n|}d}|rt        |dg      t        |dg      }| j                   j                  ||	       d{   }|S 7 wr   )
rl   r}   r~   r   r   r   r   r   r   async_download_filer   s           r%   r   z$AsyncFileSearchStores.download_media  s     *   
I  s#H %h\ 2F F 
 Zz"DL	FD	!00:6:L\N+;<H,(89l!!55! 6  D K	s   B5C 7B>8C c                r   K   | j                   }t        d|| j                  |       d{   |      S 7 	w)a7  Lists FileSearchStores asynchronously.

    Args:
      config (ListFileSearchStoresConfig): Optional parameters for the request,
        such as page_size.

    Returns:
      A Pager object that contains one page of FileSearchStores. When iterating
      over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      async for file_search_store in await client.aio.file_search_stores.list():
        print(f"file search store: {file_search_store.name} -
        {file_search_store.display_name}")
    r^   rp   N)r   r   r   s      r%   r   zAsyncFileSearchStores.list
  s=     , ::Ljjj''	  	(s   )75
7)%r   r   r   r   r   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r%   r   r     sF   , , , LPK G GHKKb @D	O O u;;<	O
 Oj CG	7 7 u>>?	7
 7t KOB F FGB))BP EI	X "X u@@A	X
 55X~ 8<Y "Y 	Y
 u334Y   Y@ EIJ "J #r{{3'23	J
 u@@AJ --J` ;?	2 2 u667	2
 2j KO F FG%''(r'   r   rk   )8	functoolsr   r   r   loggingr   typingr   r   r   urllib.parser    r	   r
   r   r   r!   r   rl   r   r   r   r   r    _operations_convertersr   ro   r   r   pagersr   r   	getLoggerloggerr   r   objectr&   r+   r1   r5   r7   r?   rF   rK   rE   rW   rY   r_   rc   re   rg   
BaseModuleri   r   r   r'   r%   <module>r     s  $ & 	   	 ' ' "       & . . P 0 %			:	; /3tCH~v-. DcN+ 
#s(^	. /3tCH~v-. DcN+ 
#s(^	  /3	tCH~v-.	DcN+	 
#s(^	 /3tCH~v-.DcN+ 
#s(^$ /3tCH~v-.DcN+ 
#s(^ /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-.DcN+ 
#s(^> /3tCH~v-.DcN+ 
#s(^. /3tCH~v-.DcN+ 
#s(^* /3tCH~v-.DcN+ 
#s(^. /3
tCH~v-.
DcN+
 
#s(^
 /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-.DcN+ 
#s(^> /3tCH~v-.DcN+ 
#s(^, /3
tCH~v-.
DcN+
 
#s(^
l	{-- l	^r	K22 r	r'   