
    nϞii                       d dl mZ d dlmZmZmZ d dlmZ d dlZddl	m
Z
 ddlmZmZmZmZmZmZ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mZ ddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* ddl+m,Z,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddgZ= G d de      Z> G d de      Z? G d d      Z@ G d d      ZA G d d      ZB G d d      ZCy)    )annotations)ListMappingcast)chainN   )_legacy_response)BodyOmitQueryHeadersNotGiven	FileTypesomit	not_given)is_givenextract_filesmaybe_transformstrip_not_givendeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)
BinaryAPIResponseAsyncBinaryAPIResponseStreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_streamed_response_wrapperto_custom_raw_response_wrapper"async_to_streamed_response_wrapper#to_custom_streamed_response_wrapper$async_to_custom_raw_response_wrapper)async_to_custom_streamed_response_wrapper)SyncPage	AsyncPage)file_list_paramsfile_upload_params)AsyncPaginatormake_request_options)!stainless_helper_header_from_file)DeletedFile)FileMetadata)AnthropicBetaParamFiles
AsyncFilesc            	      .   e Zd Zedd       Zedd       Zeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eddded	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zy)r/   c                    t        |       S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        )FilesWithRawResponseselfs    `/var/www/html/jploft-chatbot/venv/lib/python3.12/site-packages/anthropic/resources/beta/files.pywith_raw_responsezFiles.with_raw_response'   s     $D))    c                    t        |       S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        )FilesWithStreamingResponser5   s    r7   with_streaming_responsezFiles.with_streaming_response1   s     *$//r9   Nafter_id	before_idlimitbetasextra_headersextra_query
extra_bodytimeoutc               @   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        t           t        ||||t        |||dt        j                              t              S )	F  List Files

        Args:
          after_id: ID of the object to use as a cursor for pagination.

        When provided, returns the
              page of results immediately after this object.

          before_id: ID of the object to use as a cursor for pagination. When provided, returns the
              page of results immediately before this object.

          limit: Number of items to return per page.

              Defaults to `20`. Ranges from `1` to `1000`.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        anthropic-beta,c              3  2   K   | ]  }t        |        y wNstr.0es     r7   	<genexpr>zFiles.list.<locals>.<genexpr>d        5Lc!f5L   files-api-2025-04-14/v1/files?beta=truer?   r@   rA   rC   rD   rE   rF   querypageoptionsmodel)r   r   joinr   r   _get_api_listr%   r-   r*   r   r'   FileListParams	r6   r?   r@   rA   rB   rC   rD   rE   rF   s	            r7   listz
Files.list:   s    N	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!,'(+'%%$,%.!&
 %33 # " 
 	
r9   rB   rC   rD   rE   rF   c          
        |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| dt        ||||      t        	      S )
  
        Delete File

        Args:
          file_id: ID of the File.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        6Expected a non-empty value for `file_id` but received rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   zFiles.delete.<locals>.<genexpr>   rS   rT   rU   
/v1/files/
?beta=truerC   rD   rE   rF   r\   cast_to	
ValueErrorr   r   r^   r   r   _deleter*   r,   r6   file_idrB   rC   rD   rE   rF   s          r7   deletezFiles.delete   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[||	,(+Q[el    
 	
r9   c          
     *   |st        d|      ddi|xs i }i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| d	t        ||||
      t              S )  
        Download File

        Args:
          file_id: ID of the File.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rf   Acceptapplication/binaryrI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z!Files.download.<locals>.<genexpr>   rS   rT   rU   rh   /content?beta=truerj   rk   )	rn   r   r   r^   r   r   _getr*   r   rp   s          r7   downloadzFiles.download   s    8 UV]U`abb!#7QM<ORQ	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yy	!34(+Q[el &  
 	
r9   c          
        |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| dt        ||||      t        	      S )
  
        Get File Metadata

        Args:
          file_id: ID of the File.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rf   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z*Files.retrieve_metadata.<locals>.<genexpr>  rS   rT   rU   rh   ri   rj   rk   	rn   r   r   r^   r   r   ry   r*   r-   rp   s          r7   retrieve_metadatazFiles.retrieve_metadata   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yy	,(+Q[el !  
 	
r9   c                  i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }i t        |      |}t        d|i      }t        t        t        t        t        f   |      dgg      }d|d<   | j                  d	t        |t        j                        |t!        ||||
      t"              S )  
        Upload File

        Args:
          file: The file to upload

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   zFiles.upload.<locals>.<genexpr>3  rS   rT   rU   filepathsmultipart/form-dataContent-TyperV   rj   bodyfilesr\   rl   )r   r   r^   r   r   "_stainless_helper_header_from_filer   r   r   r   rN   object_postr   r(   FileUploadParamsr*   r-   	r6   r   rB   rC   rD   rE   rF   r   r   s	            r7   uploadzFiles.upload  s   8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[U=dCU}U/d73;#7>xjQ )>n%zz! '9'J'JK(+Q[el !  
 	
r9   )returnr4   )r   r<   )r?   
str | Omitr@   r   rA   
int | OmitrB   List[AnthropicBetaParam] | OmitrC   Headers | NonerD   Query | NonerE   Body | NonerF   'float | httpx.Timeout | None | NotGivenr   zSyncPage[FileMetadata]rq   rN   rB   r   rC   r   rD   r   rE   r   rF   r   r   r,   )rq   rN   rB   r   rC   r   rD   r   rE   r   rF   r   r   r   rq   rN   rB   r   rC   r   rD   r   rE   r   rF   r   r   r-   r   r   rB   r   rC   r   rD   r   rE   r   rF   r   r   r-   __name__
__module____qualname__r   r8   r=   r   r   rb   rr   rz   r   r    r9   r7   r/   r/   &   s#   * * 0 0  $ $ 15 )-$("&;DD
 D
 	D

 D
 /D
 &D
 "D
  D
 9D
 
 D
T 26 )-$("&;D/
/
 /	/
 &/
 "/
  /
 9/
 
/
j 26 )-$("&;D0
0
 /	0
 &0
 "0
  0
 90
 
0
l 26 )-$("&;D/
/
 /	/
 &/
 "/
  /
 9/
 
/
j 26 )-$("&;D6
 6
 /	6
 &6
 "6
  6
 96
 
6
r9   c            	      .   e Zd Zedd       Zedd       Zeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eddded	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zy)r0   c                    t        |       S r3   )AsyncFilesWithRawResponser5   s    r7   r8   zAsyncFiles.with_raw_responseN  s     )..r9   c                    t        |       S r;   )AsyncFilesWithStreamingResponser5   s    r7   r=   z"AsyncFiles.with_streaming_responseX  s     /t44r9   Nr>   c               @   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        t           t        ||||t        |||dt        j                              t              S )	rH   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z"AsyncFiles.list.<locals>.<genexpr>  rS   rT   rU   rV   rW   rX   rZ   )r   r   r^   r   r   r_   r&   r-   r*   r   r'   r`   ra   s	            r7   rb   zAsyncFiles.lista  s    N	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!<((+'%%$,%.!&
 %33 # " 
 	
r9   rc   c          
     2  K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| dt        ||||      t        	       d
{   S 7 w)re   rf   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z$AsyncFiles.delete.<locals>.<genexpr>  rS   rT   rU   rh   ri   rj   rk   Nrm   rp   s          r7   rr   zAsyncFiles.delete  s     8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[\\	,(+Q[el   " 
 
 	
 
   BBBBc          
     F  K   |st        d|      ddi|xs i }i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| d	t        ||||
      t               d{   S 7 w)rt   rf   ru   rv   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z&AsyncFiles.download.<locals>.<genexpr>  rS   rT   rU   rh   rx   rj   rk   N)	rn   r   r   r^   r   r   ry   r*   r   rp   s          r7   rz   zAsyncFiles.download  s     8 UV]U`abb!#7QM<ORQ	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[YY	!34(+Q[el +  
 
 	
 
s   BB!BB!c          
     2  K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  d| dt        ||||      t        	       d
{   S 7 w)r|   rf   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>+  rS   rT   rU   rh   ri   rj   rk   Nr~   rp   s          r7   r   zAsyncFiles.retrieve_metadata
  s     8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[YY	,(+Q[el !  
 
 	
 
r   c                 K   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }i t        |      |}t        d|i      }t        t        t        t        t        f   |      dgg      }d|d<   | j                  d	t        |t        j                         d
{   |t!        ||||      t"               d
{   S 7 %7 w)r   rI   rJ   c              3  2   K   | ]  }t        |        y wrL   rM   rO   s     r7   rR   z$AsyncFiles.upload.<locals>.<genexpr>Z  rS   rT   rU   r   r   r   r   rV   Nrj   r   )r   r   r^   r   r   r   r   r   r   r   rN   r   r   r   r(   r   r*   r-   r   s	            r7   r   zAsyncFiles.upload;  s    8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[U=dCU}U/d73;#7>xjQ )>n%ZZ!,T3E3V3VWW(+Q[el !   
 
 	
W
s$   CC2C.
	 C2)C0*C20C2)r   r   )r   r   )r?   r   r@   r   rA   r   rB   r   rC   r   rD   r   rE   r   rF   r   r   z5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]r   )rq   rN   rB   r   rC   r   rD   r   rE   r   rF   r   r   r   r   r   r   r   r9   r7   r0   r0   M  s#   / / 5 5  $ $ 15 )-$("&;DD
 D
 	D

 D
 /D
 &D
 "D
  D
 9D
 
?D
T 26 )-$("&;D/
/
 /	/
 &/
 "/
  /
 9/
 
/
j 26 )-$("&;D0
0
 /	0
 &0
 "0
  0
 90
 
 0
l 26 )-$("&;D/
/
 /	/
 &/
 "/
  /
 9/
 
/
j 26 )-$("&;D6
 6
 /	6
 &6
 "6
  6
 96
 
6
r9   c                      e Zd ZddZy)r4   c                p   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        |j                  t              | _        t        j                  |j                        | _        t        j                  |j                        | _	        y rL   )
_filesr	   to_raw_response_wrapperrb   rr   r    rz   r   r   r   r6   r   s     r7   __init__zFilesWithRawResponse.__init__u  s    $<<JJ
	 '>>LL
 7NN
 "2!I!I##"
 '>>LL
r9   Nr   r/   r   Noner   r   r   r   r   r9   r7   r4   r4   t      
r9   r4   c                      e Zd ZddZy)r   c                p   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        |j                  t              | _        t        j                  |j                        | _        t        j                  |j                        | _	        y rL   )
r   r	   async_to_raw_response_wrapperrb   rr   r#   rz   r   r   r   r   s     r7   r   z"AsyncFilesWithRawResponse.__init__  s    $BBJJ
	 'DDLL
 =NN"
 "2!O!O##"
 'DDLL
r9   Nr   r0   r   r   r   r   r9   r7   r   r     r   r9   r   c                      e Zd ZddZy)r<   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rL   )	r   r   rb   rr   r"   rz   r   r   r   r   s     r7   r   z#FilesWithStreamingResponse.__init__  sv    0JJ
	 3LL
 <NN%
 ">##"
 3LL
r9   Nr   r   r   r9   r7   r<   r<     r   r9   r<   c                      e Zd ZddZy)r   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rL   )	r   r!   rb   rr   r$   rz   r   r   r   r   s     r7   r   z(AsyncFilesWithStreamingResponse.__init__  sx    6JJ
	 9LL
 BNN*
 "D##"
 9LL
r9   Nr   r   r   r9   r7   r   r     r   r9   r   )D
__future__r   typingr   r   r   	itertoolsr   httpx r	   _typesr
   r   r   r   r   r   r   r   _utilsr   r   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   r   r    r!   r"   r#   r$   
paginationr%   r&   
types.betar'   r(   _base_clientr)   r*   lib._stainless_helpersr+   r   types.beta.deleted_filer,   types.beta.file_metadatar-   types.anthropic_beta_paramr.   __all__r/   r0   r4   r   r<   r   r   r9   r7   <module>r      s    # & &     V V V x x & :   . > @ m 2 4 <L
!d
O d
N	d
! d
N	
 
,
 
,
 
,
 
r9   