
    Iibl                       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 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l0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddgZ? G d de       Z@ G d de!      ZA G d d      ZB G d d      ZC G d d      ZD G d d      ZEy)     )annotations)ListMappingcast)chainN   )_legacy_response)deepcopy_with_paths)BodyOmitQueryHeadersNotGiven	FileTypesomit	not_given)is_givenextract_filespath_templatemaybe_transformstrip_not_given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            
      4   e Zd Zedd       Zedd       Ze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 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    e/volume1/homes/robertsu/coba/app/.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
        )FilesWithStreamingResponser6   s    r8   with_streaming_responsezFiles.with_streaming_response2   s     *$//r:   N	after_id	before_idlimitscope_idbetasextra_headersextra_query
extra_bodytimeoutc       	        B   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 )	  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`.

          scope_id: Filter by scope ID. Only returns files associated with the specified scope
              (e.g., a session ID).

          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     r8   	<genexpr>zFiles.list.<locals>.<genexpr>i        5Lec!fe   files-api-2025-04-14/v1/files?beta=truer@   rA   rB   rC   rE   rF   rG   rH   querypageoptionsmodel)r   r   joinr   r   _get_api_listr&   r.   r+   r   r(   FileListParams
r7   r@   rA   rB   rC   rD   rE   rF   rG   rH   s
             r8   listz
Files.list;   s    V	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!,'(+'%%$,%.!&$,	 %33 % " 
 	
r:   rD   rE   rF   rG   rH   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                  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 rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   zFiles.delete.<locals>.<genexpr>   rU   rV   rW   /v1/files/{file_id}?beta=truefile_idrE   rF   rG   rH   r^   cast_to

ValueErrorr   r   r`   r   r   _deleter   r+   r-   r7   rl   rD   rE   rF   rG   rH   s          r8   deletezFiles.delete   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[||97K(+Q[el    
 	
r:   c          
     8   |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                  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
        rh   Acceptapplication/binaryrK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z!Files.download.<locals>.<genexpr>   rU   rV   rW   %/v1/files/{file_id}/content?beta=truerk   rm   rn   )
rq   r   r   r`   r   r   _getr   r+   r   rs   s          r8   downloadzFiles.download   s    8 UV]U`abb!#7QM<ORQ	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yyA7S(+Q[el &  
 	
r:   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                  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
        rh   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z*Files.retrieve_metadata.<locals>.<genexpr>
  rU   rV   rW   rj   rk   rm   rn   
rq   r   r   r`   r   r   r{   r   r+   r.   rs   s          r8   retrieve_metadatazFiles.retrieve_metadata   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yy97K(+Q[el !  
 	
r:   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dgg      }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
        rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   zFiles.upload.<locals>.<genexpr>9  rU   rV   rW   filepathsmultipart/form-dataContent-TyperX   rm   bodyfilesr^   ro   )r   r   r`   r   r   "_stainless_helper_header_from_filer
   r   r   r   rP   object_postr   r)   FileUploadParamsr+   r.   	r7   r   rD   rE   rF   rG   rH   r   r   s	            r8   uploadzFiles.upload  s   8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[U=dCU}U"FD>VH:>d73;#7>xjQ )>n%zz! '9'J'JK(+Q[el !  
 	
r:   )returnr5   )r   r=   )r@   
str | OmitrA   r   rB   
int | OmitrC   r   rD   List[AnthropicBetaParam] | OmitrE   Headers | NonerF   Query | NonerG   Body | NonerH   'float | httpx.Timeout | None | NotGivenr   zSyncPage[FileMetadata]rl   rP   rD   r   rE   r   rF   r   rG   r   rH   r   r   r-   )rl   rP   rD   r   rE   r   rF   r   rG   r   rH   r   r   r   rl   rP   rD   r   rE   r   rF   r   rG   r   rH   r   r   r.   r   r   rD   r   rE   r   rF   r   rG   r   rH   r   r   r.   __name__
__module____qualname__r   r9   r>   r   r   rd   rt   r|   r   r    r:   r8   r0   r0   '   s1   * * 0 0  $ $ #15 )-$("&;DI
 I
 	I

 I
 I
 /I
 &I
 "I
  I
 9I
 
 I
^ 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
r:   c            
      4   e Zd Zedd       Zedd       Ze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)r1   c                    t        |       S r4   )AsyncFilesWithRawResponser6   s    r8   r9   zAsyncFiles.with_raw_responseT  s     )..r:   c                    t        |       S r<   )AsyncFilesWithStreamingResponser6   s    r8   r>   z"AsyncFiles.with_streaming_response^  s     /t44r:   Nr?   c       	        B   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 )	rJ   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z"AsyncFiles.list.<locals>.<genexpr>  rU   rV   rW   rX   rY   rZ   r\   )r   r   r`   r   r   ra   r'   r.   r+   r   r(   rb   rc   s
             r8   rd   zAsyncFiles.listg  s    V	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!<((+'%%$,%.!&$,	 %33 % " 
 	
r:   re   c          
     @  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                  t        d|      t        ||||      t        	       d
{   S 7 w)rg   rh   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z$AsyncFiles.delete.<locals>.<genexpr>  rU   rV   rW   rj   rk   rm   rn   Nrp   rs   s          r8   rt   zAsyncFiles.delete  s     8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[\\97K(+Q[el   " 
 
 	
 
   BBBBc          
     T  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                  t        d|	      t        ||||
      t               d{   S 7 w)rv   rh   rw   rx   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z&AsyncFiles.download.<locals>.<genexpr>  rU   rV   rW   rz   rk   rm   rn   N)
rq   r   r   r`   r   r   r{   r   r+   r   rs   s          r8   r|   zAsyncFiles.download  s     8 UV]U`abb!#7QM<ORQ	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[YYA7S(+Q[el +  
 
 	
 
s   BB(!B&"B(c          
     @  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                  t        d|      t        ||||      t        	       d
{   S 7 w)r~   rh   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>6  rU   rV   rW   rj   rk   rm   rn   Nr   rs   s          r8   r   zAsyncFiles.retrieve_metadata  s     8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[YY97K(+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dgg      }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   rK   rL   c              3  2   K   | ]  }t        |        y wrN   rO   rQ   s     r8   rT   z$AsyncFiles.upload.<locals>.<genexpr>e  rU   rV   rW   r   r   r   r   rX   Nrm   r   )r   r   r`   r   r   r   r
   r   r   r   rP   r   r   r   r)   r   r+   r.   r   s	            r8   r   zAsyncFiles.uploadF  s    8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[U=dCU}U"FD>VH:>d73;#7>xjQ )>n%ZZ!,T3E3V3VWW(+Q[el !   
 
 	
W
s$   C	C5C1
 C5,C3-C53C5)r   r   )r   r   )r@   r   rA   r   rB   r   rC   r   rD   r   rE   r   rF   r   rG   r   rH   r   r   z5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]r   )rl   rP   rD   r   rE   r   rF   r   rG   r   rH   r   r   r   r   r   r   r   r:   r8   r1   r1   S  s1   / / 5 5  $ $ #15 )-$("&;DI
 I
 	I

 I
 I
 /I
 &I
 "I
  I
 9I
 
?I
^ 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
r:   c                      e Zd ZddZy)r5   c                p   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        |j                  t              | _        t        j                  |j                        | _        t        j                  |j                        | _	        y rN   )
_filesr	   to_raw_response_wrapperrd   rt   r!   r|   r   r   r   r7   r   s     r8   __init__zFilesWithRawResponse.__init__  s    $<<JJ
	 '>>LL
 7NN
 "2!I!I##"
 '>>LL
r:   Nr   r0   r   Noner   r   r   r   r   r:   r8   r5   r5         
r:   r5   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 rN   )
r   r	   async_to_raw_response_wrapperrd   rt   r$   r|   r   r   r   r   s     r8   r   z"AsyncFilesWithRawResponse.__init__  s    $BBJJ
	 'DDLL
 =NN"
 "2!O!O##"
 'DDLL
r:   Nr   r1   r   r   r   r   r:   r8   r   r     r   r:   r   c                      e Zd ZddZy)r=   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rN   )	r   r    rd   rt   r#   r|   r   r   r   r   s     r8   r   z#FilesWithStreamingResponse.__init__  sv    0JJ
	 3LL
 <NN%
 ">##"
 3LL
r:   Nr   r   r   r:   r8   r=   r=     r   r:   r=   c                      e Zd ZddZy)r   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rN   )	r   r"   rd   rt   r%   r|   r   r   r   r   s     r8   r   z(AsyncFilesWithStreamingResponse.__init__  sx    6JJ
	 9LL
 BNN*
 "D##"
 9LL
r:   Nr   r   r   r:   r8   r   r     r   r:   r   )F
__future__r   typingr   r   r   	itertoolsr   httpx r	   r   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__r0   r1   r5   r   r=   r   r   r:   r8   <module>r      s    # & &     ) V V V u u & :   . > @ m 2 4 <L
!i
O i
X	i
! i
X	
 
,
 
,
 
,
 
r:   