
    +j%                     .   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j!        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j5                  Z6 G d' d(ej5                  Z7dS )*    )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          4t          |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       c/home/wildlama/visual-decline/.venv/lib/python3.11/site-packages/google/genai/file_search_stores.py%_CreateFileSearchStoreConfig_to_mldevr&   )   s    
 !)	+'((4kN;K)L)LMMM	+)*++7			*d;1B0CDDEE   
    c                 l    i }t          |dg           t          | t          |dg          |           |S Nconfig)r   r&   r#   s       r%   )_CreateFileSearchStoreParameters_to_mldevr+   =   sH    
 !)	+z"".)Dxj119   
r'   c                 p    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   sD     !)	+y!!-7+T+y-I-IJJ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&ABBB	+z"".)[8*%%y   
r'   c                 p    i }t          | dg          "t          |ddgt          | dg                     |S )Nr3   r4   r/   r0   s      r%   &_GetFileSearchStoreParameters_to_mldevr7   g   sD     !)	+x  ,VV$d;&A&ABBB	r'   c           	          i }t          | dg          +t          |dgd t          | dg          D                        t          | dg          !t          |dgt          | dg                     |S )Ncustom_metadatacustomMetadatac                     g | ]}|S  r<   .0items     r%   
<listcomp>z._ImportFileConfig_to_mldev.<locals>.<listcomp>|       AAA$AAAr'   chunking_configchunkingConfigr/   r0   s      r%   _ImportFileConfig_to_mldevrD   r   s     !)	+)*++7	AA${->,?@@AAA   
+)*++7	[,-..   
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                     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_mldevrK      s#    !)	+x  ,VHd;99:::	+
|$$0ZL${ZL"A"ABBB	+x  ,VHd;99:::	+y!!-WItK';;<<<	+
|$$0	&zl++Y	
 	
   
r'   c                 4   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    rD   r0   s      r%   _ImportFileParameters_to_mldevrP      s     !)	+0122>	)*[3455   
+}%%1ZL${[M"B"BCCC	+z"".tK(<<iHHH	r'   c                 6   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%   rJ   rJ      s     !)	+)*++7'(${=N<O*P*P   
+z"".XJ[8* = =>>>	+'((4_%tK.9I'J'JKK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_mldevr\      s     !)	+}%%1*-tK+/O/O   
+~&&2	;[<.))   
r'   c                 j    i }t          | dg          t          t          | dg          |           |S r)   )r   r\   r0   s      r%   (_ListFileSearchStoresParameters_to_mldevr^      sF     !)	+z"".([8*%%y   
r'   c           	      J   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d t          | dg          D                        |S )NrR   rS   nextPageTokennext_page_tokenfileSearchStoresfile_search_storesc                     g | ]}|S r<   r<   r=   s     r%   r@   z<_ListFileSearchStoresResponse_from_mldev.<locals>.<listcomp>  s    BBB$BBBr'   r/   r0   s      r%   (_ListFileSearchStoresResponse_from_mldevre      s     !)	+)*++7'(${=N<O*P*P   
+())5&'kO;L)M)MNNN	+*+,,8	BB${-?,@AABBB   
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d t          | dg          D                        t          | dg          !t          |d	gt          | dg                     |S )
N	mime_typemimeTyper   r   r9   r:   c                     g | ]}|S r<   r<   r=   s     r%   r@   z;_UploadToFileSearchStoreConfig_to_mldev.<locals>.<listcomp>  rA   r'   rB   rC   r/   r0   s      r%   '_UploadToFileSearchStoreConfig_to_mldevrj     s    !)	+}%%1d;&F&FGGG	+'((4kN;K)L)LMMM	+)*++7	AA${->,?@@AAA   
+)*++7	[,-..   
r'   c                     i }t          | dg          "t          |ddgt          | dg                     t          | dg          t          t          | dg          |           |S )NrM   r4   r*   )r   r    rj   r0   s      r%   +_UploadToFileSearchStoreParameters_to_mldevrl   $  s     !)	+0122>	)*[3455   
+z"".+[8*%%y   
r'   c                 n    i }t          | dg          !t          |dgt          | dg                     |S )NrR   rS   r/   r0   s      r%   4_UploadToFileSearchStoreResumableResponse_from_mldevrn   8  sP     !)	+)*++7'(${=N<O*P*P   
r'   c            	       Z   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j        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$dS )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        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||          }|j        si nt#          j        |j                  }	t           j                            |	t+          |dd          rDdt+          |j
        d
d          t+          |j
        dd          t+          |j
        dd          dini           }
| j                            |
           |
S zCreates a File Search Store.

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

    Returns:
      FileSearchStore
    rw   iThis method is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r4   rb   r.   ?r*   Npostresponse_schemaresponse_json_schemainclude_all_fieldsr}   r~   r   rI   kwargs)r    _CreateFileSearchStoreParametersrs   vertexai
ValueErrorr+   get
format_mapr   popr*   http_optionsr
   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsFileSearchStore_from_responsegetattr_verify_responseru   r*   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr   rI   response_dictreturn_values              r%   createzFileSearchStores.createK  s$    <  O
   "4  
 ?

O l &))&11	 "!,,-=>>!##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM(77 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 8  L& 	%%l333r'   r3   c                   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||          }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d
d          t+          |j
        dd          t+          |j
        dd          dini           }| 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*   rz   r4   {name}r.   r{   r*   Nr   r}   r~   r   r   r   )r   _GetFileSearchStoreParametersrs   r   r   r7   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r   r   r   r   ru   r3   r*   r   r   r   r   r   r   rI   r   r   s               r%   r   zFileSearchStores.get  s   $ 9  O   4  
 <OLLl%))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''t\<PPH&mJBBHM1J1JM(77 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 8  L& 	%%l333r'   c                2   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||           dS 
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   rz   r4   r   r.   r{   r*   Ndelete)r    _DeleteFileSearchStoreParametersrs   r   r   r5   r   r   r   r   r*   r   r
   r   r   r   	ru   r3   r*   r   r   r   r   r   r   s	            r%   r   zFileSearchStores.delete  sB   $ <  O   4  
 ?OOl%))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDLXt\<HHHHHr'   c                   t          j        |          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }|j        si nt#          j        |j                  }	| j        j        st'          |	          }	t           j                            |	t-          |dd           rDdt-          |j
        d	d           t-          |j
        d
d           t-          |j
        dd           dini           }
| j                            |
           |
S Nrw   rz   r4   rb   r.   r{   r*   r   r}   r~   r   r   r   )r   _ListFileSearchStoresParametersrs   r   r   r^   r   r   r   r   r*   r   r
   r   r   r   r   r   r   re   ListFileSearchStoresResponser   r   r   r   s              r%   _listzFileSearchStores._list  s.    ;  O
   "4  
 >oNNl%))&11	 "!,,-=>>!##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''t\<PPH&mJBBHM1J1JM$ N>}MMm5DD ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! E  L& 	%%l333r'   rM   c                T   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }	|Bt!          |d	d           r1t          j        |	
          }
| j                            |
           |
S |	j        si nt)          j        |	j                  }| j        j        st-          |          }t           j                            |t!          |dd           rDdt!          |j
        dd           t!          |j
        dd           t!          |j
        dd           dini           }
| j                            |
           |
S NrM   r*   rz   r4   z>upload/v1beta/{file_search_store_name}:uploadToFileSearchStorer.   r{   r*   r|   should_return_http_response)rS   r}   r~   r   r   r   )r   "_UploadToFileSearchStoreParametersrs   r   r   rl   r   r   r   r   r*   r   r
   r   r   r   r   (UploadToFileSearchStoreResumableResponser   r   r   r   rn   r   ru   rM   r*   r   r   r   r   r   r   rI   r   r   s               r%   _upload_to_file_search_storez-FileSearchStores._upload_to_file_search_store`  s    >5  O   P4  
 A
 l &))&11	 PLZ()) 	
 P##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H g-t  C$  l ''555&mJBBHM1J1JM$ J
 m
 	6EE" $77'.'.0A4( ( -4'.0F- - +2'.0Dd+ +
 
  ! 	F 	
 	
 * 	%%l333r'   rN   c                   t          j        |||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}	|j
        |j
        j        |j
        j        }	t          j        |          }t          j        |          }| j                            d	|||	          }
|
j        si nt#          j        |
j                  }| j        j        st'          |          }t           j                            |t-          |dd          rDdt-          |j
        d
d          t-          |j
        dd          t-          |j
        dd          dini           }| 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.
    )rM   rN   r*   rz   r4   z#{file_search_store_name}:importFiler.   r{   r*   Nr|   r}   r~   r   r   r   )r   _ImportFileParametersrs   r   r   rP   r   r   r   r   r*   r   r
   r   r   r   r   r   r   rK   ImportFileOperationr   r   r   ru   rM   rN   r*   r   r   r   r   r   r   rI   r   r   s                r%   import_filezFileSearchStores.import_file  s@   , 15  O   54  
 4ODDl%))&11	 54??
 
 5##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM$ E5mDDm,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L& 	%%l333r'   filec                   | j         j        rt          d          |i }n;t          |t                    rt	          |          }n|                    d          }t          j        ||                    d          |                    d                    \  }}}i ||dd}| 	                    |t          j        di |	          }	|	j        (|	j        j        d
|	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                             ||
||          }n2t%          j        |          }| j                             ||
||          }t)          |j                  }t          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.NTexclude_unsetr   rg   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   r   r<   )rs   r   r   
isinstancedict
model_dumpr   prepare_resumable_uploadr   r   r   UploadToFileSearchStoreConfigrS   headersKeyErrorioIOBaseupload_fileosfspathr   r    UploadToFileSearchStoreOperationr   ru   rM   r   r*   user_config_dictr   
size_bytes_final_config_dictrI   
upload_urlupload_responsefs_pathr   s                 r%   upload_to_file_search_storez,FileSearchStores.upload_to_file_search_store  sE   &   
I   ~)+	FD	!	! ?f***>>"."G*..~>>'++K88# # #L*a

$'+  
 0052GG5FGG 1  H
 	"*%-5x'A'III#8+E+MMM /   
 : B	B	B-56IJjj-56IJj$	"" (44

J\ 5  oo 	$g(44
:z 5  o A M 1@@r A   r'   media_idc                |   | j         j        rt          d          |                    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         	                    ||	          }|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<   )
rs   r   r   lstripr   r   r   DownloadMediaConfigr   download_fileru   r   r*   clean_idr   config_modelr   datas           r%   download_mediazFileSearchStores.download_mediaa  s   *   
I   s##H  Fh F F F  
 """DL 	FD	!	! 0::6::L :\N+;<<H,(899l))! *  D Kr'   c                \    | j         }t          d||                      |          |          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}")
    rc   rw   )r   r   ru   r*   list_requests      r%   listzFileSearchStores.list  s7    , :L

&
!!	  r'   )%__name__
__module____qualname__r   r   rv   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%   rp   rp   E  s8       ' ' ' ' ?' LPK K K GHKK K K Kb @D	M M M M u;<	M
 M M M Mf CG	5I 5I 5I 5I u>?	5I
 5I 5I 5I 5Ip KO@ @ @ FG@)@ @ @ @L EI	X X X "X u@A	X
 5X X X X~ 8<Y Y Y "Y 	Y
 u34Y  Y Y Y Y@ EIJ J J "J #r{3'23	J
 u@AJ -J J J J` ;?	2 2 2 2 u67	2
 2 2 2 2j KO   FGU"#     r'   rp   c            	       Z   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j        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$dS )AsyncFileSearchStoresr   c                 *    t          | j                  S rr   )r   rs   rt   s    r%   rv   zAsyncFileSearchStores.documents  s    $*+++r'   Nrw   r*   c                  K   t          j        |          }| j        j        rt	          d          t          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||           d{V }|j        si nt#          j        |j                  }	t           j                            |	t+          |dd          rDdt+          |j
        d
d          t+          |j
        dd          t+          |j
        dd          dini           }
| j                            |
           |
S ry   )r   r   rs   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  sF      <  O
   "4  
 ?

O l &))&11	 "!,,-=>>!##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM(77 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 8  L& 	%%l333r'   r3   c                  K   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||           d{V }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d
d          t+          |j
        dd          t+          |j
        dd          dini           }| j                            |           |S r   )r   r   rs   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  O   4  
 <OLLl%))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33t\<       H 'mJBBHM1J1JM(77 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 8  L& 	%%l333r'   c                B  K   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d	|||           d{V  dS r   )r   r   rs   r   r   r5   r   r   r   r   r*   r   r
   r   r   r   r   s	            r%   r   zAsyncFileSearchStores.deleteX  so     $ <  O   4  
 ?OOl%))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL


(
($l          r'   c                  K   t          j        |          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d {V }|j        si nt#          j        |j                  }	| j        j        st'          |	          }	t           j                            |	t-          |dd           rDdt-          |j
        d	d           t-          |j
        d
d           t-          |j
        dd           dini           }
| j                            |
           |
S r   )r   r   rs   r   r   r^   r   r   r   r   r*   r   r
   r   r   r   r   r   r   re   r   r   r   r   r   s              r%   r   zAsyncFileSearchStores._list  sW      ;  O
   "4  
 >oNNl%))&11	 "!,,-=>>!##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33t\<       H 'mJBBHM1J1JM$ N>}MMm5DD ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! E  L& 	%%l333r'   rM   c                d  K   t          j        ||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d {V }	|Bt!          |d	d           r1t          j        |	
          }
| j                            |
           |
S |	j        si nt)          j        |	j                  }| j        j        st-          |          }t           j                            |t!          |dd           rDdt!          |j
        dd           t!          |j
        dd           t!          |j
        dd           dini           }
| j                            |
           |
S r   )r   r   rs   r   r   rl   r   r   r   r   r*   r   r
   r   r   r   r   r   r   r   r   r   rn   r   r   s               r%   r   z2AsyncFileSearchStores._upload_to_file_search_store  s      >5  O   P4  
 A
 l &))&11	 PLZ()) 	
 P##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H g-t  C$  l ''555&mJBBHM1J1JM$ J
 m
 	6EE" $77'.'.0A4( ( -4'.0F- - +2'.0Dd+ +
 
  ! 	F 	
 	
 * 	%%l333r'   rN   c                  K   t          j        |||          }| j        j        rt	          d          t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}	|j
        |j
        j        |j
        j        }	t          j        |          }t          j        |          }| j                            d	|||	           d{V }
|
j        si nt#          j        |
j                  }| j        j        st'          |          }t           j                            |t-          |dd          rDdt-          |j
        d
d          t-          |j
        dd          t-          |j
        dd          dini           }| j                            |           |S r   )r   r   rs   r   r   rP   r   r   r   r   r*   r   r
   r   r   r   r   r   r   rK   r   r   r   r   r   s                r%   r   z!AsyncFileSearchStores.import_file/  sb     , 15  O   54  
 4ODDl%))&11	 54??
 
 5##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM$ E5mDDm,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L& 	%%l333r'   r   c                  K   | j         j        rt          d          |i }n;t          |t                    rt	          |          }n|                    d          }t          j        ||                    d          |                    d                    \  }}}i ||dd}| 	                    |t          j        di |	           d{V }	|	j        (|	j        j        d
|	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                             ||
||           d{V }n8t%          j        |          }| j                             ||
||           d{V }t)          |j                  }t          j                            |i           S )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   rg   r   r   r   r   r   r   r   r   r<   )rs   r   r   r   r   r   r   r   r   r   r   r   rS   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*..~>>'++K88# # #L*a

$'+  
 6652GG5FGG 7        H
 	"*%-5x'A'III#8+E+MMM /   
 : B	B	B-56IJjj-56IJj$	"" ".@@

J\ A        oo 	$g".@@
:z A        o A M 1@@r A   r'   r   c                  K   | j         j        rt          d          |                    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         	                    ||	           d{V }|S r   )
rs   r   r   r   r   r   r   r   r   async_download_filer   s           r%   r   z$AsyncFileSearchStores.download_media  s:     *   
I   s##H  Fh F F F  
 """DL 	FD	!	! 0::6::L :\N+;<<H,(899l!55! 6        D Kr'   c                l   K   | j         }t          d||                      |           d{V |          S )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}")
    rc   rw   N)r   r   r   s      r%   r   zAsyncFileSearchStores.list
  sM      , :Ljjj''''''''	  r'   )%r   r   r   r   r   rv   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     s/       , , , , ?, LPK K K GHKK K K Kb @D	O O O O u;<	O
 O O O Oj CG	7 7 7 7 u>?	7
 7 7 7 7t KOB B B FGB)B B B BP EI	X X X "X u@A	X
 5X X X X~ 8<Y Y Y "Y 	Y
 u34Y  Y Y Y Y@ EIJ J J "J #r{3'23	J
 u@AJ -J J J J` ;?	2 2 2 2 u67	2
 2 2 2 2j KO   FG%'(     r'   r   rr   )8	functoolsr   r   r   loggingr   typingr   r   r   urllib.parser    r	   r
   r   r   r!   r   rs   r   r   r   r   r    _operations_convertersr   rv   r   r   pagersr   r   	getLoggerloggerr   r   objectr&   r+   r1   r5   r7   rD   rK   rP   rJ   r\   r^   re   rj   rl   rn   
BaseModulerp   r   r<   r'   r%   <module>r     sn  $ & % % % % % 				   				 ' ' ' ' ' ' ' ' ' ' " " " " " "                                     & & & & & & . . . . . . . . . . . . P P P P P P 0 0 0 0 0 0 0 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	 l	 l	 l	{- l	 l	 l	^r	 r	 r	 r	 r	K2 r	 r	 r	 r	 r	r'   