
    Ji6!                        d dl Z d dlZd dlmZ ddlmZ ddl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Zej.                  j1                  d      red dlmZ  G d d      Z G d d      Zy# e$ r d dlZY  w xY w)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)remove_none_from_dict)UnprocessableEntityError)FileStoreInfoResponse)HttpValidationError)LicenseInfoResponse)LlamaExtractFeatureAvailabilityz1.c                   `    e Zd ZdefdZdefdZdddej                  e	   de
fdZdefd	Zy)
AdminClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     t/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/llama_cloud/resources/admin/client.py__init__zAdminClient.__init__   
    -    returnc                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |	      # t        $ r" t!        |j                  |j"                  	      w xY w)
z
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.admin.get_file_store_info()
        GET/api/v1/admin/filestores/info<   headerstimeout   ,    status_codebodyr   httpx_clientrequesturllibparseurljoinget_base_urlget_headersr(   pydanticparse_obj_asr
   jsonr	   r   r   r   textr   	_response_response_jsons      r   get_file_store_infozAdminClient.get_file_store_info   s    ((55==LL  D$8$8$E$E$G#H!JLjk((446	 > 
	 )''-#-(()>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   <D# #+ENinclude_scopesr<   c                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        d|i      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |
      # t         $ r" t#        |j                  |j$                  
      w xY w)a*  
        Parameters:
            - include_scopes: typing.Optional[bool]. Whether to include scopes in the response
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.admin.get_license_info()
        r   r   api/v1/admin/license/infor<   r    paramsr"   r#   r$   r%   r&   r'   r   r+   r,   r-   r.   r/   r0   r   r1   r(   r2   r3   r   r4   r	   r   r   r   r5   r   r<   r7   r8   s       r   get_license_infozAdminClient.get_license_info6   s)    ((55==LL  D$8$8$E$E$G#H!JLgh(*:N)KL((446 > 
	 )''-#-(()<inn>NOO  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D/ /+Ec                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |	      # t        $ r" t!        |j                  |j"                  	      w xY w)
a
  
        Get LlamaExtract feature availability based on available models.

        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.admin.get_llamaextract_features()
        r   r   "api/v1/admin/llamaextract/featuresr    r!   r$   r%   r&   r'   r   r+   r,   r-   r.   r/   r0   r1   r(   r2   r3   r   r4   r	   r   r   r   r5   r6   s      r   get_llamaextract_featuresz%AdminClient.get_llamaextract_featuresS   s    ((55==LL  D$8$8$E$E$G#H!JLpq((446	 > 
	 )''-#-(()H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Sr:   )__name__
__module____qualname__r   r   r
   r9   typingOptionalboolr   rC   r   rG    r   r   r   r      sT    .*; .O%: O2 KO O&//$2G OSf O:O+J Or   r   c                   `    e Zd ZdefdZdefdZdddej                  e	   de
fdZdefd	Zy)
AsyncAdminClientr   c                    || _         y r   r   r   s     r   r   zAsyncAdminClient.__init__q   r   r   r   c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      7 # t        $ r" t!        |j                  |j"                  
      w xY ww)z
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.admin.get_file_store_info()
        r   r   r   r    r!   Nr$   r%   r&   r'   r*   r6   s      r   r9   z$AsyncAdminClient.get_file_store_infot   s)     ..;;CCLL  D$8$8$E$E$G#H!JLjk((446	 D 
 
	 )''-#-(()>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	S+   A>E D-BED/ E/+EENr;   r<   c                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        d|i      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a:  
        Parameters:
            - include_scopes: typing.Optional[bool]. Whether to include scopes in the response
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.admin.get_license_info()
        r   r   r>   r<   r    r?   Nr$   r%   r&   r'   rA   rB   s       r   rC   z!AsyncAdminClient.get_license_info   s7     ..;;CCLL  D$8$8$E$E$G#H!JLgh(*:N)KL((446 D 
 
	 )''-#-(()<inn>NOO  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   B
E)D9BE)D; "E);+E&&E)c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      7 # t        $ r" t!        |j                  |j"                  
      w xY ww)a  
        Get LlamaExtract feature availability based on available models.

        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.admin.get_llamaextract_features()
        r   r   rE   r    r!   Nr$   r%   r&   r'   rF   r6   s      r   rG   z*AsyncAdminClient.get_llamaextract_features   s)     ..;;CCLL  D$8$8$E$E$G#H!JLpq((446	 D 
 
	 )''-#-(()H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	SrS   )rH   rI   rJ   r   r   r
   r9   rK   rL   rM   r   rC   r   rG   rN   r   r   rP   rP   p   sT    .*< .O+@ O2 QU O8M OYl O:O1P Or   rP   )rK   urllib.parser-   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.remove_none_from_dictr   !errors.unprocessable_entity_errorr	   types.file_store_info_responser
   types.http_validation_errorr   types.license_info_responser   (types.llama_extract_feature_availabilityr   r2   __version__
startswithImportErrorpydantic.v1v1r   rP   rN   r   r   <module>re      s      ( & H ? I C > > W&&t,"
TO TOnTO TOw  s   'A> >	B
	B
