
    4Rjl                       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l3m4Z4m5Z5m6Z6 ddl7m8Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z? ddgZ@ G d de       ZA G d de!      ZB G d d      ZC G d d      ZD G d d      ZE G d d      ZFy)     )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merge_headers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)r1   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    f/var/www/html/meridian/meridian-ai/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
        )FilesWithStreamingResponser7   s    r9   with_streaming_responsezFiles.with_streaming_response6   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     r9   	<genexpr>zFiles.list.<locals>.<genexpr>m        5Lc!f5L   files-api-2025-04-14/v1/files?beta=truerA   rB   rC   rD   rF   rG   rH   rI   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   rI   s
             r9   listz
Files.list?   s    V	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!,'(+'%%$,%.!&$,	 %33 % " 
 	
r;   rE   rF   rG   rH   rI   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 rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   zFiles.delete.<locals>.<genexpr>   rV   rW   rX   /v1/files/{file_id}?beta=truefile_idrF   rG   rH   rI   r_   cast_to

ValueErrorr   r   ra   r   r   _deleter   r,   r.   r8   rm   rE   rF   rG   rH   rI   s          r9   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
        ri   Acceptapplication/binaryrL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z!Files.download.<locals>.<genexpr>   rV   rW   rX   %/v1/files/{file_id}/content?beta=truerl   rn   ro   )
rr   r   r   ra   r   r   _getr   r,   r   rt   s          r9   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
        ri   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z*Files.retrieve_metadata.<locals>.<genexpr>  rV   rW   rX   rk   rl   rn   ro   
rr   r   r   ra   r   r   r|   r   r,   r/   rt   s          r9   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 }t        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
        rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   zFiles.upload.<locals>.<genexpr>=  rV   rW   rX   filepathsmultipart/form-dataContent-TyperY   rn   bodyfilesr_   rp   )r   r   ra   r   r   r+   "_stainless_helper_header_from_filer
   r   r   r   rQ   object_postr   r)   FileUploadParamsr,   r/   	r8   r   rE   rF   rG   rH   rI   r   r   s	            r9   uploadzFiles.upload  s   8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[%&H&NP]^"FD>VH:>d73;#7>xjQ )>n%zz! '9'J'JK(+Q[el !  
 	
r;   )returnr6   )r   r>   )rA   
str | OmitrB   r   rC   
int | OmitrD   r   rE   List[AnthropicBetaParam] | OmitrF   Headers | NonerG   Query | NonerH   Body | NonerI   'float | httpx.Timeout | None | NotGivenr   zSyncPage[FileMetadata]rm   rQ   rE   r   rF   r   rG   r   rH   r   rI   r   r   r.   )rm   rQ   rE   r   rF   r   rG   r   rH   r   rI   r   r   r   rm   rQ   rE   r   rF   r   rG   r   rH   r   rI   r   r   r/   r   r   rE   r   rF   r   rG   r   rH   r   rI   r   r   r/   __name__
__module____qualname__r   r:   r?   r   r   re   ru   r}   r   r    r;   r9   r1   r1   +   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)r2   c                    t        |       S r5   )AsyncFilesWithRawResponser7   s    r9   r:   zAsyncFiles.with_raw_responseX  s     )..r;   c                    t        |       S r=   )AsyncFilesWithStreamingResponser7   s    r9   r?   z"AsyncFiles.with_streaming_responseb  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 )	rK   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z"AsyncFiles.list.<locals>.<genexpr>  rV   rW   rX   rY   rZ   r[   r]   )r   r   ra   r   r   rb   r'   r/   r,   r   r(   rc   rd   s
             r9   re   zAsyncFiles.listk  s    V	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!<((+'%%$,%.!&$,	 %33 % " 
 	
r;   rf   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)rh   ri   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z$AsyncFiles.delete.<locals>.<genexpr>  rV   rW   rX   rk   rl   rn   ro   Nrq   rt   s          r9   ru   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)rw   ri   rx   ry   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z&AsyncFiles.download.<locals>.<genexpr>	  rV   rW   rX   r{   rl   rn   ro   N)
rr   r   r   ra   r   r   r|   r   r,   r   rt   s          r9   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   ri   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>:  rV   rW   rX   rk   rl   rn   ro   Nr   rt   s          r9   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 }t        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   rL   rM   c              3  2   K   | ]  }t        |        y wrO   rP   rR   s     r9   rU   z$AsyncFiles.upload.<locals>.<genexpr>i  rV   rW   rX   r   r   r   r   rY   Nrn   r   )r   r   ra   r   r   r+   r   r
   r   r   r   rQ   r   r   r   r)   r   r,   r/   r   s	            r9   r   zAsyncFiles.uploadJ  s    8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[%&H&NP]^"FD>VH:>d73;#7>xjQ )>n%ZZ!,T3E3V3VWW(+Q[el !   
 
 	
W
s$   CC;C7
 C;2C93C;9C;)r   r   )r   r   )rA   r   rB   r   rC   r   rD   r   rE   r   rF   r   rG   r   rH   r   rI   r   r   z5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]r   )rm   rQ   rE   r   rF   r   rG   r   rH   r   rI   r   r   r   r   r   r   r   r;   r9   r2   r2   W  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)r6   c                p   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        |j                  t              | _        t        j                  |j                        | _        t        j                  |j                        | _	        y rO   )
_filesr	   to_raw_response_wrapperre   ru   r!   r}   r   r   r   r8   r   s     r9   __init__zFilesWithRawResponse.__init__  s    $<<JJ
	 '>>LL
 7NN
 "2!I!I##"
 '>>LL
r;   Nr   r1   r   Noner   r   r   r   r   r;   r9   r6   r6         
r;   r6   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 rO   )
r   r	   async_to_raw_response_wrapperre   ru   r$   r}   r   r   r   r   s     r9   r   z"AsyncFilesWithRawResponse.__init__  s    $BBJJ
	 'DDLL
 =NN"
 "2!O!O##"
 'DDLL
r;   Nr   r2   r   r   r   r   r;   r9   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 rO   )	r   r    re   ru   r#   r}   r   r   r   r   s     r9   r   z#FilesWithStreamingResponse.__init__  sv    0JJ
	 3LL
 <NN%
 ">##"
 3LL
r;   Nr   r   r   r;   r9   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 rO   )	r   r"   re   ru   r%   r}   r   r   r   r   s     r9   r   z(AsyncFilesWithStreamingResponse.__init__  sx    6JJ
	 9LL
 BNN*
 "D##"
 9LL
r;   Nr   r   r   r;   r9   r   r     r   r;   r   )G
__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+   r,   lib._stainless_helpersr-   r   types.beta.deleted_filer.   types.beta.file_metadatar/   types.anthropic_beta_paramr0   __all__r1   r2   r6   r   r>   r   r   r;   r9   <module>r      s    # & &     ) V V V u u & :   . > 
 n 2 4 <L
!i
O i
X	i
! i
X	
 
,
 
,
 
,
 
r;   