
    i;                         d dl Z d dlZd dlmZmZmZmZmZmZm	Z	 e	r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mZmZmZmZ ddlmZ ddlmZ  G d de       Z!y)    N)OptionalListTupleDictAnyUnionTYPE_CHECKING
ThreadPoolThreadPoolExecutor   )Urllib3RestClient   )Configuration)PineconeApiValueErrorPineconeApiException)parameters_to_tuplesfiles_parametersparameters_to_multipartprocess_paramsprocess_query_paramsbuild_request_url)AuthUtil)
Serializerc            &       V   e Zd ZU dZdZed   ed<   dZed   ed<   	 d(dee   dee	   d	dfd
Z
d Zd Zd Zed)d       Zed*d       Zed        Zej$                  d        Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+dededeeeef      deeeeef         deeeef      dee   deeeeef         deeeeej4                     f      deee      deee      dee   deeeef      ded eee	eef      d!ee   d"ee   f d#Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d,dededeeeef      deeeeef         deeeef      dee   deeeeef         deeeeej4                     f      deee      deee      d$ee   d%ee   dee   deeeef      ded eee	eef      d!ee   d"ee   f$d&Z	 	 	 	 	 	 d-d'Z y).	ApiClienta	  Generic API client for OpenAPI client library builds.

    :param configuration: .Configuration object for this client
    :param pool_threads: The number of threads to use for async requests
        to the API. More threads means more concurrent API requests.
    Nr   _poolr   _threadpool_executorconfigurationpool_threadsreturnc                     |t        j                         }|| _        || _        t	        |      | _        i | _        d| _        y )NzOpenAPI-Generator/1.0.0/python)r   get_default_copyr    r!   r   rest_clientdefault_headers
user_agent)selfr    r!   s      u/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/pinecone/openapi_support/api_client.py__init__zApiClient.__init__$   sD      )::<M*(,];/1:    c                     | S N r(   s    r)   	__enter__zApiClient.__enter__1   s    r+   c                 $    | j                          y r-   )close)r(   exc_type	exc_value	tracebacks       r)   __exit__zApiClient.__exit__4   s    

r+   c                 N   | j                   r!| j                   j                          d | _         | j                  rl| j                  j                          | j                  j	                          d | _        t        t        d      r t        j                  | j                         y y y )N
unregister)r   shutdownr   r2   joinhasattratexitr8   r/   s    r)   r2   zApiClient.close7   sw    $$%%..0(,D%::JJJJOODJv|,!!$**- -	 r+   c                     | j                   <ddlm} t        j                  | j
                          || j                        | _         | j                   S )zqCreate thread pool on first request
        avoids instantiating unused threadpool for blocking clients.
        r   r
   )r   multiprocessing.poolr   r<   registerr2   r!   )r(   r   s     r)   poolzApiClient.poolB   s=    
 ::7OODJJ'#D$5$56DJzzr+   c                 n    | j                   ddlm}  || j                        | _         | j                   S )Nr   r   )max_workers)r   concurrent.futuresr   r!   )r(   r   s     r)   threadpool_executorzApiClient.threadpool_executorN   s0    $$,=(:tGXGX(YD%(((r+   c                      | j                   d   S )zUser agent for this API client
User-Agentr&   r/   s    r)   r'   zApiClient.user_agentV   s     ##L11r+   c                 "    || j                   d<   y )NrF   rG   )r(   values     r)   r'   zApiClient.user_agent[   s    -2\*r+   c                 "    || j                   |<   y r-   rG   )r(   header_nameheader_values      r)   set_default_headerzApiClient.set_default_header_   s    ,8[)r+   resource_pathmethodpath_paramsquery_paramsheader_paramsbodypost_paramsfilesresponse_typeauth_settings_return_http_data_onlycollection_formats_preload_content_request_timeout_host_check_typec           
      ~   | j                   }|xs i }|xs g }|xs i }|xs g }|xs i }|xs i }t        | j                  |||      \  }}}t        ||      }|s|rh|r|ng }t	        j
                  |      }|r&t        ||      }|j                  t        |             |d   j                  d      rt        |t              }nd }|rt	        j
                  |      }t        j                  ||
||       t        ||||      }	 | j                  |||||||      }|| _        |}|s|S |	r9dd	lm} |j-                  |	|
       |j/                  ||	| j                   |      }nd }|r|S ||j0                  |j3                         fS # t         $ r'}|j"                  j%                  d      |_        |d }~ww xY w)N)r&   rR   rP   rY   zContent-Type	multipart)r    endpoint_auth_settingsheadersquerys)configprocessed_path_paramsrN   r\   )rQ   ra   rT   rS   rZ   r[   zutf-8r   )Deserializer)rV   response)rf   rV   rc   r]   )r    r   r&   r   r   sanitize_for_serializationr   extendr   
startswithr   dictr   update_params_for_authr   requestr   rS   decodelast_responsedeserializerre   decode_responsedeserializestatus
getheaders)r(   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   rc   headers_tuplepath_params_tuplesanitized_path_paramsprocessed_query_paramssanitized_post_paramsprocessed_post_paramsurlresponse_dataereturn_datare   s                                r)   
__call_apizApiClient.__call_apib   s   & ##!'R#)r%+!'R/52BP 00'#1	C
?(*? "6lDV!W %)4+"K$.$I$I+$V!$(<)+=)% &,,-=e-DE^,77D(?@UX\(^%$(! 88>D 	'' #0!)		
  "3'	
	 LL3%1!1!1 ) 	M +# 2((}}(]&22&+))'	 3 K K!!5!5}7O7O7QRR9 $ 	VV]]7+AFG	s   F 	F<"F77F<	async_reqasync_threadpool_executorc                     |r5| j                   j                  | j                  |||||||||	|
||||||      S |s | j                  |||||||||	|
||||||      S | j                  j	                  | j                  |||||||||	|
||||||f      S )a
  Makes the HTTP request (synchronous) and returns deserialized data.

        To make an async_req request, set the async_req parameter.

        :param resource_path: Path to method endpoint.
        :param method: Method to call.
        :param path_params: Path parameters in the url.
        :param query_params: Query parameters in the url.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param auth_settings list: Auth Settings names for the request.
        :param response_type: For the response, a tuple containing:
            valid classes
            a list containing valid classes (for list schemas)
            a dict containing a tuple of valid classes as the value
            Example values:
            (str,)
            (Pet,)
            (float, none_type)
            ([int, none_type],)
            ({str: (bool, str, int, float, date, datetime, str, none_type)},)
        :param files: key -> field name, value -> a list of open file
            objects for `multipart/form-data`.
        :type files: dict
        :param async_req bool: execute request asynchronously
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param collection_formats: dict of collection formats for path, query,
            header, and post parameters.
        :type collection_formats: dict, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _check_type: boolean describing if the data back from the server
            should have its type checked.
        :type _check_type: bool, optional
        :return:
            If async_req parameter is True,
            the request will be called asynchronously.
            The method will return the request thread.
            If parameter async_req is False or missing,
            then the method will return the response directly.
        )rD   submit_ApiClient__call_apir@   apply_async)r(   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   r   r   rX   rY   rZ   r[   r\   r]   s                      r)   call_apizApiClient.call_api   s    T %++22&"  # ( ??&"  ! & yy$$OO&"  !
 	
r+   c	           	      0   |dk(  r | j                   j                  |||||      S |dk(  r | j                   j                  |||||      S |dk(  r"| j                   j                  |||||||      S |dk(  r"| j                   j	                  |||||||      S |dk(  r"| j                   j                  |||||||      S |dk(  r"| j                   j                  |||||||      S |d	k(  r!| j                   j                  ||||||
      S t        d      )z(Makes the HTTP request using RESTClient.GET)rQ   rZ   r[   ra   HEADOPTIONS)rQ   ra   rT   rZ   r[   rS   POSTPUTPATCHDELETE)rQ   ra   rZ   r[   rS   zQhttp method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.)	r%   r   r   r   r   r   r   r   r   )	r(   rO   rz   rQ   ra   rT   rS   rZ   r[   s	            r)   rl   zApiClient.request[  s    U?##'')!1!1 (   v##(()!1!1 )   y ##++)'!1!1 ,   v##(()'!1!1 )   u_##'')'!1!1 (   w##)))'!1!1 *   x##**)!1!1 +   (c r+   )Nr   )r"   r   )r"   r   )NNNNNNNNTNTNNN)NNNNNNNNNNNNTNNN)NNNNTN)!__name__
__module____qualname____doc__r   r   __annotations__r   r   intr*   r0   r6   r2   propertyr@   rD   r'   setterrM   strr   r   r   r   ioIOBaseboolr   floatr   r   rl   r.   r+   r)   r   r      s    %)E8L!(;?(#78? \];%m4;KSTW=;	;	. 	 	 ) ) 2 2 3 39 158<26"7;6:.2-1157;!%?C#&*#nSnS nS d38n-	nS
 tE#s(O45nS  S#X/nS smnS d5c?34nS S$ryy/123nS  c
+nS  S	*nS !)nS %T#s(^4nS nS #5eU):#;<nS  }!nS" d^#nSh 158<26"7;6:.2-1$(48157;!%?C#&*'G
G
 G
 d38n-	G

 tE#s(O45G
  S#X/G
 smG
 d5c?34G
 S$ryy/123G
  c
+G
  S	*G
 D>G
 $,D>G
 !)G
 %T#s(^4G
  !G
" #5eU):#;<#G
$ }%G
& d^'G
Z Pr+   r   )"r<   r   typingr   r   r   r   r   r   r	   r>   r   rC   r   rest_urllib3r   config.openapi_configurationr   
exceptionsr   r   api_client_utilsr   r   r   r   r   r   	auth_utilr   
serializerr   objectr   r.   r+   r)   <module>r      sF     	 I I I/5 + 8 C    "R Rr+   