
    ij                       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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/m0Z0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z= ddgZ> G d de          Z? G d de           Z@ G d d          ZA G d d          ZB G d d          ZC G d d          ZDdS )    )annotations)ListMappingcast)chainN   )_legacy_response)BodyOmitQueryHeadersNotGiven	FileTypesomit	not_given)is_givenextract_filespath_template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dS ),r0   returnFilesWithRawResponsec                     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
        )r4   selfs    [/root/projects/qq-shell/venv/lib/python3.11/site-packages/anthropic/resources/beta/files.pywith_raw_responsezFiles.with_raw_response/   s     $D)))    FilesWithStreamingResponsec                     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
        )r<   r7   s    r9   with_streaming_responsezFiles.with_streaming_response9   s     *$///r;   Nafter_id	before_idlimitbetasextra_headersextra_query
extra_bodytimeoutrA   
str | OmitrB   rC   
int | OmitrD   List[AnthropicBetaParam] | OmitrE   Headers | NonerF   Query | NonerG   Body | NonerH   'float | httpx.Timeout | None | NotGivenSyncPage[FileMetadata]c               |   i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }|                     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  4   K   | ]}t          |          V  d S Nstr.0es     r9   	<genexpr>zFiles.list.<locals>.<genexpr>l   (      5L5Lc!ff5L5L5L5L5L5Lr;   files-api-2025-04-14/v1/files?beta=truerA   rB   rC   rE   rF   rG   rH   querypageoptionsmodel)r   r   joinr   r   _get_api_listr&   r.   r+   r   r(   FileListParams	r8   rA   rB   rC   rD   rE   rF   rG   rH   s	            r9   listz
Files.listB   s    N	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[!!!,'(+'%%$,%.!& 
 %3    # " 
 
 	
r;   rD   rE   rF   rG   rH   file_idrX   r-   c          
     f   |st          d|          i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          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 rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   zFiles.delete.<locals>.<genexpr>   r]   r;   r^   /v1/files/{file_id}?beta=truerm   rE   rF   rG   rH   re   cast_to

ValueErrorr   r   rg   r   r   _deleter   r+   r-   r8   rm   rD   rE   rF   rG   rH   s          r9   deletezFiles.delete   s    8  	caV]aabbb	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[||97KKK(+Q[el      
 
 	
r;   r   c          
     v   |st          d|          ddi|pi }i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          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
        rp   Acceptapplication/binaryrS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z!Files.download.<locals>.<genexpr>   r]   r;   r^   %/v1/files/{file_id}/content?beta=truers   rt   ru   )
rx   r   r   rg   r   r   _getr   r+   r   rz   s          r9   downloadzFiles.download   s   8  	caV]aabbb!#7QM<ORQ	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[yyA7SSS(+Q[el   &  
 
 	
r;   r.   c          
     f   |st          d|          i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          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
        rp   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z*Files.retrieve_metadata.<locals>.<genexpr>  r]   r;   r^   rr   rs   rt   ru   
rx   r   r   rg   r   r   r   r   r+   r.   rz   s          r9   retrieve_metadatazFiles.retrieve_metadata   s    8  	caV]aabbb	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[yy97KKK(+Q[el   !  
 
 	
r;   filer   c                  i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }i t          |          |}t          d|i          }t          t          t          t          t          f         |          dgg          }d|d<   |                     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
        rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   zFiles.upload.<locals>.<genexpr>;  r]   r;   r^   r   pathsmultipart/form-dataContent-Typer_   rt   bodyfilesre   rv   )r   r   rg   r   r   "_stainless_helper_header_from_filer   r   r   r   rX   object_postr   r)   FileUploadParamsr+   r.   	r8   r   rD   rE   rF   rG   rH   r   r   s	            r9   uploadzFiles.upload  s;   8	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[U=dCCU}U//d73;#7>>xjQQQ )>n%zz! '9'JKK(+Q[el   !  
 
 	
r;   )r3   r4   )r3   r<   )rA   rI   rB   rI   rC   rJ   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   rP   rm   rX   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r-   )rm   rX   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r   rm   rX   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r.   r   r   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r.   __name__
__module____qualname__r   r:   r?   r   r   rk   r{   r   r   r    r;   r9   r0   r0   .   sZ       * * * _* 0 0 0 _0  $ $ 15 )-$("&;DD
 D
 D
 D
 D
 D
T 26 )-$("&;D/
 /
 /
 /
 /
 /
j 26 )-$("&;D0
 0
 0
 0
 0
 0
l 26 )-$("&;D/
 /
 /
 /
 /
 /
j 26 )-$("&;D6
 6
 6
 6
 6
 6
 6
 6
r;   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dS ),r1   r3   AsyncFilesWithRawResponsec                     t          |           S r6   )r   r7   s    r9   r:   zAsyncFiles.with_raw_responseV  s     )...r;   AsyncFilesWithStreamingResponsec                     t          |           S r>   )r   r7   s    r9   r?   z"AsyncFiles.with_streaming_response`  s     /t444r;   Nr@   rA   rI   rB   rC   rJ   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]c               |   i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }|                     dt          t                   t          ||||t          |||dt          j                            t                    S )	rR   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z"AsyncFiles.list.<locals>.<genexpr>  r]   r;   r^   r_   r`   ra   rc   )r   r   rg   r   r   rh   r'   r.   r+   r   r(   ri   rj   s	            r9   rk   zAsyncFiles.listi  s    N	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[!!!<((+'%%$,%.!& 
 %3    # " 
 
 	
r;   rl   rm   rX   r-   c          
     v  K   |st          d|          i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          d|          t          ||||          t          	           d
{V S )ro   rp   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z$AsyncFiles.delete.<locals>.<genexpr>  r]   r;   r^   rr   rs   rt   ru   Nrw   rz   s          r9   r{   zAsyncFiles.delete  s     8  	caV]aabbb	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[\\97KKK(+Q[el     " 
 
 
 
 
 
 
 
 	
r;   r   c          
       K   |st          d|          ddi|pi }i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          d|	          t          ||||
          t                     d{V S )r}   rp   r~   r   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z&AsyncFiles.download.<locals>.<genexpr>  r]   r;   r^   r   rs   rt   ru   N)
rx   r   r   rg   r   r   r   r   r+   r   rz   s          r9   r   zAsyncFiles.download  s1     8  	caV]aabbb!#7QM<ORQ	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[YYA7SSS(+Q[el   +  
 
 
 
 
 
 
 
 	
r;   r.   c          
     v  K   |st          d|          i t          dt          |          r.d                    t	          d |D             dg                    nt
          i          |pi }ddi|pi }|                     t          d|          t          ||||          t          	           d
{V S )r   rp   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>3  r]   r;   r^   rr   rs   rt   ru   Nr   rz   s          r9   r   zAsyncFiles.retrieve_metadata  s     8  	caV]aabbb	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[YY97KKK(+Q[el   !  
 
 
 
 
 
 
 
 	
r;   r   r   c               2  K   i t          dt          |          r.d                    t          d |D             dg                    nt          i          |pi }ddi|pi }i t          |          |}t          d|i          }t          t          t          t          t          f         |          dgg          }d|d<   |                     d	t          |t          j                   d
{V |t!          ||||          t"                     d
{V S )r   rS   rT   c              3  4   K   | ]}t          |          V  d S rV   rW   rY   s     r9   r\   z$AsyncFiles.upload.<locals>.<genexpr>b  r]   r;   r^   r   r   r   r   r_   Nrt   r   )r   r   rg   r   r   r   r   r   r   r   rX   r   r   r   r)   r   r+   r.   r   s	            r9   r   zAsyncFiles.uploadC  so     8	
$'#chhu5L5Le5L5L5LOeNf/g/g&h&h&h" 	
 "	
 *+A[mFYWY[U=dCCU}U//d73;#7>>xjQQQ )>n%ZZ!,T3E3VWWWWWWWW(+Q[el   !   
 
 
 
 
 
 
 
 	
r;   )r3   r   )r3   r   )rA   rI   rB   rI   rC   rJ   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r   r   )rm   rX   rD   rK   rE   rL   rF   rM   rG   rN   rH   rO   r3   r   r   r   r   r   r;   r9   r1   r1   U  sZ       / / / _/ 5 5 5 _5  $ $ 15 )-$("&;DD
 D
 D
 D
 D
 D
T 26 )-$("&;D/
 /
 /
 /
 /
 /
j 26 )-$("&;D0
 0
 0
 0
 0
 0
l 26 )-$("&;D/
 /
 /
 /
 /
 /
j 26 )-$("&;D6
 6
 6
 6
 6
 6
 6
 6
r;   c                      e Zd ZddZdS )r4   r   r0   r3   Nonec                B   || _         t          j        |j                  | _        t          j        |j                  | _        t          |j        t                    | _        t          j        |j                  | _        t          j        |j	                  | _	        d S rV   )
_filesr	   to_raw_response_wrapperrk   r{   r!   r   r   r   r   r8   r   s     r9   __init__zFilesWithRawResponse.__init__}  s    $<J
 
	 '>L
 
 7N
 
 "2!I#"
 "
 '>L
 
r;   Nr   r0   r3   r   r   r   r   r   r   r;   r9   r4   r4   |  (        
 
 
 
 
 
r;   r4   c                      e Zd ZddZdS )r   r   r1   r3   r   c                B   || _         t          j        |j                  | _        t          j        |j                  | _        t          |j        t                    | _        t          j        |j                  | _        t          j        |j	                  | _	        d S rV   )
r   r	   async_to_raw_response_wrapperrk   r{   r$   r   r   r   r   r   s     r9   r   z"AsyncFilesWithRawResponse.__init__  s    $BJ
 
	 'DL
 
 =N"
 
 "2!O#"
 "
 'DL
 
r;   Nr   r1   r3   r   r   r   r;   r9   r   r     r   r;   r   c                      e Zd ZddZdS )r<   r   r0   r3   r   c                   || _         t          |j                  | _        t          |j                  | _        t	          |j        t                    | _        t          |j                  | _        t          |j                  | _        d S rV   )	r   r    rk   r{   r#   r   r   r   r   r   s     r9   r   z#FilesWithStreamingResponse.__init__  s    0J
 
	 3L
 
 <N%
 
 ">#"
 "
 3L
 
r;   Nr   r   r   r;   r9   r<   r<     r   r;   r<   c                      e Zd ZddZdS )r   r   r1   r3   r   c                   || _         t          |j                  | _        t          |j                  | _        t	          |j        t                    | _        t          |j                  | _        t          |j                  | _        d S rV   )	r   r"   rk   r{   r%   r   r   r   r   r   s     r9   r   z(AsyncFilesWithStreamingResponse.__init__  s    6J
 
	 9L
 
 BN*
 
 "D#"
 "
 9L
 
r;   Nr   r   r   r;   r9   r   r     r   r;   r   )E
__future__r   typingr   r   r   	itertoolsr   httpx r	   _typesr
   r   r   r   r   r   r   r   _utilsr   r   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__r0   r1   r4   r   r<   r   r   r;   r9   <module>r      sK   # " " " " " & & & & & & & & & &                    V V V V V V V V V V V V V V V V V V V V                  ' & & & & & : : : : : : : :                        . - - - - - - - > > > > > > > > @ @ @ @ @ @ @ @ m m m m m m 2 2 2 2 2 2 4 4 4 4 4 4 < < < < < <L
!d
 d
 d
 d
 d
O d
 d
 d
N	d
 d
 d
 d
 d
! d
 d
 d
N	
 
 
 
 
 
 
 
,
 
 
 
 
 
 
 
,
 
 
 
 
 
 
 
,
 
 
 
 
 
 
 
 
 
r;   