
    >'h                        d dl Z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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"jF                  jI                  d      re%d dl&m'Z"  ejP                  ejR                  d      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)jsonable_encoder)remove_none_from_dict)UnprocessableEntityError)File)HttpValidationError)PageFigureMetadata)PageScreenshotMetadata)PresignedUrl   )"FileCreateFromUrlResourceInfoValue)FileCreatePermissionInfoValue)FileCreateResourceInfoValuez1..c                      e Zd ZdefdZddddedej                  e   dej                  e   defd	Z	ddddedej                  e   dej                  e   ddfd
Z
ddddej                  e   dej                  e   dej                  e   fdZdddddej                  e   dej                  e   dej                  e   dej                  def
dZdddeeeeeed	dej                  e   dej                  e   dej                  e   dedej                  e   dej                  e   dej                  ej$                     dej                  ej&                  eej                  e   f      dej                  ej&                  eej                  e   f      dej                  e   defdZddddej                  e   dej                  e   dej                  e   fdZddeeeeeeddej                  e   dej                  e   dej                  e   dedej                  e   dej                  ej&                  eej                  e   f      dej                  e   dej                  e   dej                  ej&                  eej                  e   f      defd Zdddd!dedej                  e   dej                  e   dej                  e   def
d"Zddddedej                  e   dej                  e   dej                  e   fd#Zdddded$edej                  e   dej                  e   dej>                  f
d%Z ddddedej                  e   dej                  e   dej                  e!   fd&Z"dddded$edej                  e   dej                  e   dej                  e!   f
d'Z#dddded$ed(edej                  e   dej                  e   dej>                  fd)Z$y)*FilesClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     i/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/llama_cloud/resources/files/client.py__init__zFilesClient.__init__#   
    -    N
project_idorganization_ididr"   r#   returnc          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       t        ||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  
        Read File metadata objects.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.get_file(
            id="string",
        )
        GET/api/v1/files/r!   <   paramsheaderstimeout   ,    status_codebodyr   httpx_clientrequesturllibparseurljoinget_base_urlr	   get_headersr3   pydanticparse_obj_asr   jsonr
   r   r   r   textr   r$   r"   r#   	_response_response_jsons         r   get_filezFilesClient.get_file&   s0   , ((55==LL  D$8$8$E$E$G#H!Jm\^[_L`a(
Wf)gh((446 > 
	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D3 3+Ec          	      p   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       t        ||d      | j                   j                         d      }d|j                  cxk  rdk  ry	 |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      # t        $ r" t!        |j                  |j"                        w xY w)a  
        Delete the file from S3.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.delete_file(
            id="string",
        )
        DELETEr(   r)   r!   r*   r+   r/   r0   Nr1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r
   r=   r>   r   r?   r   r   r@   rA   s         r   delete_filezFilesClient.delete_fileM   s   , ((55==LL  D$8$8$E$E$G#H!Jm\^[_L`a(
Wf)gh((446 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   #D
 
+D5c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  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)aP  
        Read File metadata objects.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.list_files()
        r'   r(   api/v1/filesr!   r*   r+   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r=   r>   typingListr   r?   r
   r   r   r   r@   r   r"   r#   rB   rC   s        r   
list_fileszFilesClient.list_filest   s0   $ ((55==LL  D$8$8$E$E$G#H!JN[(
Wf)gh((446 > 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   E +E,external_file_idr"   r#   rR   upload_filec          
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |||d      t        i       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)
        Upload a file to S3.

        Parameters:
            - external_file_id: typing.Optional[str].

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - upload_file: typing.IO.
        POSTr(   rJ   rQ   rS   r*   r,   datafilesr-   r.   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r   r<   r3   r=   r>   r   r?   r
   r   r   r   r@   r   rR   r"   r#   rS   rB   rC   s          r   rS   zFilesClient.upload_file   s>   ( ((55==LL  D$8$8$E$E$G#H!JN[(%5Zdst ""% +.((446 > 

	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D> >+E)	expires_at_secondsr"   r#   rR   	file_sizelast_modified_atresource_infopermission_infodata_source_idr]   namer^   r_   r`   ra   rb   c       
   
      v   d|i}|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |
t         ur|
|d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          d	d
      t        |||d      t        |      | 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  
        Create a presigned url for uploading a file.

        Parameters:
            - expires_at_seconds: typing.Optional[int].

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - name: str.

            - external_file_id: typing.Optional[str].

            - file_size: typing.Optional[int].

            - last_modified_at: typing.Optional[dt.datetime].

            - resource_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreateResourceInfoValue]]].

            - permission_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreatePermissionInfoValue]]].

            - data_source_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.generate_presigned_url(
            name="string",
        )
        rc   rR   r^   r_   r`   ra   rb   PUTr(   rJ   r]   r"   r#   r*   r,   r?   r-   r.   r/   r0   r1   r2   OMITr   r6   r7   r8   r9   r:   r;   r	   r   r<   r3   r=   r>   r   r?   r
   r   r   r   r@   r   r]   r"   r#   rc   rR   r^   r_   r`   ra   rb   _requestrB   rC   s                 r   generate_presigned_urlz"FilesClient.generate_presigned_url   s   ^ 39$4'+;H'(D $-H[!4'+;H'($(5H_%$&*9H&'%)7H%&((55==LL  D$8$8$E$E$G#H!JN[('9hwx "(+((446 > 	
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   &F +F8c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  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)ay  
        Sync Files API against file contents uploaded via S3 presigned urls.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.sync_files()
        re   r(   api/v1/files/syncr!   r*   r+   r/   r0   r1   r2   rK   rN   s        r   
sync_fileszFilesClient.sync_files  s1   $ ((55==LL  D$8$8$E$E$G#H!JL_`(
Wf)gh((446 > 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	SrP   r"   r#   rc   	proxy_urlrequest_headers
verify_sslfollow_redirectsr`   urlrq   rr   rs   rt   c       	   	      t   d|i}
|t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |	t         ur|	|
d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          d	d
      t        ||d      t        |
      | 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  
        Upload a file to S3 from a URL.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - name: typing.Optional[str].

            - url: str. URL of the file to download

            - proxy_url: typing.Optional[str].

            - request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]].

            - verify_ssl: typing.Optional[bool]. Whether to verify the SSL certificate when downloading the file

            - follow_redirects: typing.Optional[bool]. Whether to follow redirects when downloading the file

            - resource_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreateFromUrlResourceInfoValue]]].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.upload_file_from_url(
            url="string",
        )
        ru   rc   rq   rr   rs   rt   r`   re   r(   api/v1/files/upload_from_urlr!   r*   rg   r/   r0   r1   r2   ri   r   r6   r7   r8   r9   r:   r;   r	   r   r<   r3   r=   r>   r   r?   r
   r   r   r   r@   r   r"   r#   rc   ru   rq   rr   rs   rt   r`   rk   rB   rC   s                r   upload_file_from_urlz FilesClient.upload_file_from_url3  s   X 38t#HVD $-H[!$&*9H&'T!%/H\"4'+;H'($(5H_%((55==LL  D$8$8$E$E$G#H!JLjk(
Wf)gh!(+((446 > 
	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   %F +F7rf   c          
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |||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  
        Returns a presigned url to read the file content.

        Parameters:
            - id: str.

            - expires_at_seconds: typing.Optional[int].

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.read_file_content(
            id="string",
        )
        r'   r(   r)   /contentrf   r*   r+   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r=   r>   r   r?   r
   r   r   r   r@   r   r$   r]   r"   r#   rB   rC   s          r   read_file_contentzFilesClient.read_file_content~  s:   : ((55==LL  D$8$8$E$E$G#H!Jm\^[__gLhi('9hwx ((446 > 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D5 5+E c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  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  
        List metadata for all screenshots of pages from a file.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.list_file_page_screenshots(
            id="string",
        )
        r'   r(   r)   /page_screenshotsr!   r*   r+   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r=   r>   rL   rM   r   r?   r
   r   r   r   r@   rA   s         r   list_file_page_screenshotsz&FilesClient.list_file_page_screenshots  s=   , ((55==LL  D$8$8$E$E$G#H!Jm\^[__pLqr(
Wf)gh((446 > 
	 )''-#-((5K)LinnN^__  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   E +E0
page_indexc          
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  r5n n2t        j                  t        j                  |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Get screenshot of a page from a file.

        Parameters:
            - id: str.

            - page_index: int.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.get_file_page_screenshot(
            id="string",
            page_index=1,
        )
        r'   r(   r)   /page_screenshots/r!   r*   r+   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r=   r>   rL   Anyr?   r
   r   r   r   r@   r   r$   r   r"   r#   rB   rC   s          r   get_file_page_screenshotz$FilesClient.get_file_page_screenshot  s@   < ((55==LL  ''4467q9]2$N`ak`l;m )
Wf)gh((446 > 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E   +E+c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  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)ar  
        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.list_file_pages_figures(
            id="string",
        )
        r'   r(   r)   /page-figuresr!   r*   r+   r/   r0   r1   r2   r   r6   r7   r8   r9   r:   r;   r	   r<   r3   r=   r>   rL   rM   r   r?   r
   r   r   r   r@   rA   s         r   list_file_pages_figuresz#FilesClient.list_file_pages_figures  s=   ( ((55==LL  D$8$8$E$E$G#H!Jm\^[__lLmn(
Wf)gh((446 > 
	 )''-#-((5G)H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Sr   c          
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  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:
            - id: str.

            - page_index: int.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.list_file_page_figures(
            id="string",
            page_index=1,
        )
        r'   r(   r)   /page-figures/r!   r*   r+   r/   r0   r1   r2   r   r   s          r   list_file_page_figuresz"FilesClient.list_file_page_figures+  sE   8 ((55==LL  ''4467q9]2$n]g\h;i )
Wf)gh((446 > 
	 )''-#-((5G)H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss    E +E2figure_namec                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d|       t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  r5n n2t        j                  t        j                  |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Parameters:
            - id: str.

            - page_index: int.

            - figure_name: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.files.get_file_page_figure(
            id="string",
            page_index=1,
            figure_name="string",
        )
        r'   r(   r)   r   r!   r*   r+   r/   r0   r1   r2   r   r   r$   r   r   r"   r#   rB   rC   s           r   get_file_page_figurez FilesClient.get_file_page_figureZ  sI   @ ((55==LL  ''4467q9]2$n]g\hhijuiv;w )
Wf)gh((446 > 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E +E.)%__name__
__module____qualname__r   r   strrL   Optionalr   rD   rH   rM   rO   IOrS   ri   intdtdatetimeDictr   r   r   rl   ro   boolr   rz   r   r   r   r   r   r   r   r   r    r    r   r   r   "   s   .*; . >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	%OP >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	%OP 59bf!O#__S1!OKQ??[^K_!O	T	!OL 26+/04'O !//#.'O OOC(	'O
  -'O YY'O 
'OX 48+/0415*.9=immq/3NO #OOC0NO OOC(	NO
  -NO NO !//#.NO ??3'NO !//"++6NO v{{3Hc8d3d'efNO  S&//Jg:h5h)ijNO ,NO 
NOb 59bf!O#__S1!OKQ??[^K_!O	T	!OL ,004%)*.SW,026ptIO OOC(IO  -	IO
 ooc"IO IO ??3'IO  S&//#:N5N)OPIO OOD)IO !//$/IO v{{3Hj8k3k'lmIO 
IO^ 48+/04.O.O #OOC0	.O
 OOC(.O  -.O 
.Ob >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	+	,%OX ,004/O/O /O
 OOC(/O  -/O 
/Od >Bko#O#O&,ooc&:#OTZTcTcdgTh#O	'	(#OT ,004-O-O -O
 OOC(-O  --O 
'	(-Oj ,0041O1O 1O 	1O OOC(1O  -1O 
1Or    r   c                      e Zd ZdefdZddddedej                  e   dej                  e   defd	Z	ddddedej                  e   dej                  e   ddfd
Z
ddddej                  e   dej                  e   dej                  e   fdZdddddej                  e   dej                  e   dej                  e   dej                  def
dZdddeeeeeed	dej                  e   dej                  e   dej                  e   dedej                  e   dej                  e   dej                  ej$                     dej                  ej&                  eej                  e   f      dej                  ej&                  eej                  e   f      dej                  e   defdZddddej                  e   dej                  e   dej                  e   fdZddeeeeeeddej                  e   dej                  e   dej                  e   dedej                  e   dej                  ej&                  eej                  e   f      dej                  e   dej                  e   dej                  ej&                  eej                  e   f      defd Zdddd!dedej                  e   dej                  e   dej                  e   def
d"Zddddedej                  e   dej                  e   dej                  e   fd#Zdddded$edej                  e   dej                  e   dej>                  f
d%Z ddddedej                  e   dej                  e   dej                  e!   fd&Z"dddded$edej                  e   dej                  e   dej                  e!   f
d'Z#dddded$ed(edej                  e   dej                  e   dej>                  fd)Z$y)*AsyncFilesClientr   c                    || _         y r   r   r   s     r   r   zAsyncFilesClient.__init__  r   r    Nr!   r$   r"   r#   r%   c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       t        ||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  
        Read File metadata objects.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.get_file(
            id="string",
        )
        r'   r(   r)   r!   r*   r+   Nr/   r0   r1   r2   r5   rA   s         r   rD   zAsyncFilesClient.get_file  s>    , ..;;CCLL  D$8$8$E$E$G#H!Jm\^[_L`a(
Wf)gh((446 D 
 
	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE-D=BE-D? &E-?+E**E-c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       t        ||d      | j                   j                         d       d{   }d|j                  cxk  rd	k  ry |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)a  
        Delete the file from S3.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.delete_file(
            id="string",
        )
        rF   r(   r)   r!   r*   r+   Nr/   r0   r1   r2   rG   rA   s         r   rH   zAsyncFilesClient.delete_file  s,    , ..;;CCLL  D$8$8$E$E$G#H!Jm\^[_L`a(
Wf)gh((446 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BEDAE-D =E+EEc          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  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`  
        Read File metadata objects.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.list_files()
        r'   r(   rJ   r!   r*   r+   Nr/   r0   r1   r2   rK   rN   s        r   rO   zAsyncFilesClient.list_files  s>    $ ..;;CCLL  D$8$8$E$E$G#H!JN[(
Wf)gh((446 D 
 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	S+   BE;EBE;$E 4E;+E88E;rQ   rR   rS   c          
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |||d      t        i       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)rU   rV   r(   rJ   rQ   rS   r*   rW   Nr/   r0   r1   r2   rZ   r[   s          r   rS   zAsyncFilesClient.upload_file  sL    ( ..;;CCLL  D$8$8$E$E$G#H!JN[(%5Zdst ""% +.((446 D 

 

	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN'

"  	Sy'<'<9>>RR	Ss+   BE8EBE8!E
 1E8
+E55E8r\   r]   rc   r^   r_   r`   ra   rb   c       
   
        K   d|i}|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |
t         ur|
|d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          d	d
      t        |||d      t        |      | 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  
        Create a presigned url for uploading a file.

        Parameters:
            - expires_at_seconds: typing.Optional[int].

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - name: str.

            - external_file_id: typing.Optional[str].

            - file_size: typing.Optional[int].

            - last_modified_at: typing.Optional[dt.datetime].

            - resource_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreateResourceInfoValue]]].

            - permission_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreatePermissionInfoValue]]].

            - data_source_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.generate_presigned_url(
            name="string",
        )
        rc   rR   r^   r_   r`   ra   rb   re   r(   rJ   rf   r*   rg   Nr/   r0   r1   r2   rh   rj   s                 r   rl   z'AsyncFilesClient.generate_presigned_url,  s    ^ 39$4'+;H'(D $-H[!4'+;H'($(5H_%$&*9H&'%)7H%&..;;CCLL  D$8$8$E$E$G#H!JN[('9hwx "(+((446 D 	
 	
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN%	
   	Sy'<'<9>>RR	Ss+   C(G*F+BG0F  G+GGc          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  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  
        Sync Files API against file contents uploaded via S3 presigned urls.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.sync_files()
        re   r(   rn   r!   r*   r+   Nr/   r0   r1   r2   rK   rN   s        r   ro   zAsyncFilesClient.sync_files|  s?    $ ..;;CCLL  D$8$8$E$E$G#H!JL_`(
Wf)gh((446 D 
 
	 )''-#-((T):INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Sr   rp   ru   rq   rr   rs   rt   c       	   	        K   d|i}
|t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |t         ur||
d<   |	t         ur|	|
d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          d	d
      t        ||d      t        |
      | 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  
        Upload a file to S3 from a URL.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - name: typing.Optional[str].

            - url: str. URL of the file to download

            - proxy_url: typing.Optional[str].

            - request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]].

            - verify_ssl: typing.Optional[bool]. Whether to verify the SSL certificate when downloading the file

            - follow_redirects: typing.Optional[bool]. Whether to follow redirects when downloading the file

            - resource_info: typing.Optional[typing.Dict[str, typing.Optional[FileCreateFromUrlResourceInfoValue]]].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.upload_file_from_url(
            url="string",
        )
        ru   rc   rq   rr   rs   rt   r`   re   r(   rw   r!   r*   rg   Nr/   r0   r1   r2   rx   ry   s                r   rz   z%AsyncFilesClient.upload_file_from_url  s    X 38t#HVD $-H[!$&*9H&'T!%/H\"4'+;H'($(5H_%..;;CCLL  D$8$8$E$E$G#H!JLjk(
Wf)gh!(+((446 D 
 
	 )''-#-((y~~/?@@  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   C'G)F*BG/F ?G+GGrf   c          
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |||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  
        Returns a presigned url to read the file content.

        Parameters:
            - id: str.

            - expires_at_seconds: typing.Optional[int].

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.read_file_content(
            id="string",
        )
        r'   r(   r)   r|   rf   r*   r+   Nr/   r0   r1   r2   r}   r~   s          r   r   z"AsyncFilesClient.read_file_content  sH    : ..;;CCLL  D$8$8$E$E$G#H!Jm\^[__gLhi('9hwx ((446 D 
 
	 )''-#-((y~~7GHH  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE/D?BE/E (E/+E,,E/c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  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  
        List metadata for all screenshots of pages from a file.

        Parameters:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.list_file_page_screenshots(
            id="string",
        )
        r'   r(   r)   r   r!   r*   r+   Nr/   r0   r1   r2   r   rA   s         r   r   z+AsyncFilesClient.list_file_page_screenshots  sK    , ..;;CCLL  D$8$8$E$E$G#H!Jm\^[__pLqr(
Wf)gh((446 D 
 
	 )''-#-((5K)LinnN^__  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	S+   BE?EBE?(E 8E?+E<<E?r   c          
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r5n n2t        j                  t        j                  |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 screenshot of a page from a file.

        Parameters:
            - id: str.

            - page_index: int.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.get_file_page_screenshot(
            id="string",
            page_index=1,
        )
        r'   r(   r)   r   r!   r*   r+   Nr/   r0   r1   r2   r   r   s          r   r   z)AsyncFilesClient.get_file_page_screenshotA  sN    < ..;;CCLL  ''4467q9]2$N`ak`l;m )
Wf)gh((446 D 
 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE:E
BE:#E 3E:+E77E:c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  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:
            - id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.list_file_pages_figures(
            id="string",
        )
        r'   r(   r)   r   r!   r*   r+   Nr/   r0   r1   r2   r   rA   s         r   r   z(AsyncFilesClient.list_file_pages_figuresr  sK    ( ..;;CCLL  D$8$8$E$E$G#H!Jm\^[__lLmn(
Wf)gh((446 D 
 
	 )''-#-((5G)H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Sr   c          
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  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:
            - id: str.

            - page_index: int.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.list_file_page_figures(
            id="string",
            page_index=1,
        )
        r'   r(   r)   r   r!   r*   r+   Nr/   r0   r1   r2   r   r   s          r   r   z'AsyncFilesClient.list_file_page_figures  sS    8 ..;;CCLL  ''4467q9]2$n]g\h;i )
Wf)gh((446 D 
 
	 )''-#-((5G)H)..JZ[[  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BFEBF*E :F+E>>Fr   c                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d|       t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r5n n2t        j                  t        j                  |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:
            - id: str.

            - page_index: int.

            - figure_name: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.files.get_file_page_figure(
            id="string",
            page_index=1,
            figure_name="string",
        )
        r'   r(   r)   r   r!   r*   r+   Nr/   r0   r1   r2   r   r   s           r   r   z%AsyncFilesClient.get_file_page_figure  sW    @ ..;;CCLL  ''4467q9]2$n]g\hhijuiv;w )
Wf)gh((446 D 
 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE=EBE=&E 6E=+E::E=)%r   r   r   r   r   r   rL   r   r   rD   rH   rM   rO   r   rS   ri   r   r   r   r   r   r   r   rl   ro   r   r   rz   r   r   r   r   r   r   r   r   r   r   r    r   r   r     s   .*< . >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	%OP >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	%OP 59bf!O#__S1!OKQ??[^K_!O	T	!OL 26+/04'O !//#.'O OOC(	'O
  -'O YY'O 
'OX 48+/0415*.9=immq/3NO #OOC0NO OOC(	NO
  -NO NO !//#.NO ??3'NO !//"++6NO v{{3Hc8d3d'efNO  S&//Jg:h5h)ijNO ,NO 
NOb 59bf!O#__S1!OKQ??[^K_!O	T	!OL ,004%)*.SW,026ptIO OOC(IO  -	IO
 ooc"IO IO ??3'IO  S&//#:N5N)OPIO OOD)IO !//$/IO v{{3Hj8k3k'lmIO 
IO^ 48+/04.O.O #OOC0	.O
 OOC(.O  -.O 
.Ob >Bko%O%O&,ooc&:%OTZTcTcdgTh%O	+	,%OX ,004/O/O /O
 OOC(/O  -/O 
/Od >Bko#O#O&,ooc&:#OTZTcTcdgTh#O	'	(#OT ,004-O-O -O
 OOC(-O  --O 
'	(-Oj ,0041O1O 1O 	1O OOC(1O  -1O 
1Or    r   )-r   r   rL   urllib.parser8   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.jsonable_encoderr   core.remove_none_from_dictr	   !errors.unprocessable_entity_errorr
   
types.filer   types.http_validation_errorr   types.page_figure_metadatar   types.page_screenshot_metadatar   types.presigned_urlr   .types.file_create_from_url_resource_info_valuer   'types.file_create_permission_info_valuer   %types.file_create_resource_info_valuer   r=   __version__
startswithImportErrorpydantic.v1v1castr   ri   r   r   r   r    r   <module>r      s       ( & H 5 ? I  > < D / ^ R N&&t,"
 v{{6::s#i	O i	OXi	O i	Og  s   $'B= =	C	C	