
    pih                       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l4m5Z5 ddl6m7Z7 ddl8m9Z9 ddgZ: G d de      Z; G d de      Z< G d d      Z= G d d      Z> G d d      Z? G d d      Z@y)    )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)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    `/opt/services/ai/voice_agent/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
        )FilesWithStreamingResponser4   s    r6   with_streaming_responsezFiles.with_streaming_response0   s     *$//r8   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     r6   	<genexpr>zFiles.list.<locals>.<genexpr>c        5Lc!f5L   files-api-2025-04-14/v1/files?beta=truer>   r?   r@   rB   rC   rD   rE   querypageoptionsmodel)r   r   joinr   r   _get_api_listr%   r,   r*   r   r'   FileListParams	r5   r>   r?   r@   rA   rB   rC   rD   rE   s	            r6   listz
Files.list9   s    N	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!,'(+'%%$,%.!&
 %33 # " 
 	
r8   rA   rB   rC   rD   rE   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 rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   zFiles.delete.<locals>.<genexpr>   rR   rS   rT   
/v1/files/
?beta=truerB   rC   rD   rE   r[   cast_to	
ValueErrorr   r   r]   r   r   _deleter*   r+   r5   file_idrA   rB   rC   rD   rE   s          r6   deletezFiles.delete   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[||	,(+Q[el    
 	
r8   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
        re   Acceptapplication/binaryrH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z!Files.download.<locals>.<genexpr>   rR   rS   rT   rg   /content?beta=trueri   rj   )	rm   r   r   r]   r   r   _getr*   r   ro   s          r6   downloadzFiles.download   s    8 UV]U`abb!#7QM<ORQ	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yy	!34(+Q[el &  
 	
r8   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
        re   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z*Files.retrieve_metadata.<locals>.<genexpr>  rR   rS   rT   rg   rh   ri   rj   	rm   r   r   r]   r   r   rx   r*   r,   ro   s          r6   retrieve_metadatazFiles.retrieve_metadata   s    8 UV]U`abb	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[yy	,(+Q[el !  
 	
r8   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        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
        rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   zFiles.upload.<locals>.<genexpr>2  rR   rS   rT   filepathsmultipart/form-dataContent-TyperU   ri   bodyfilesr[   rk   )r   r   r]   r   r   r   r   r   r   rM   object_postr   r(   FileUploadParamsr*   r,   	r5   r   rA   rB   rC   rD   rE   r   r   s	            r6   uploadzFiles.upload  s    8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[/d73;#7>xjQ )>n%zz! '9'J'JK(+Q[el !  
 	
r8   )returnr3   )r   r;   )r>   
str | Omitr?   r   r@   
int | OmitrA   List[AnthropicBetaParam] | OmitrB   Headers | NonerC   Query | NonerD   Body | NonerE   'float | httpx.Timeout | None | NotGivenr   zSyncPage[FileMetadata]rp   rM   rA   r   rB   r   rC   r   rD   r   rE   r   r   r+   )rp   rM   rA   r   rB   r   rC   r   rD   r   rE   r   r   r   rp   rM   rA   r   rB   r   rC   r   rD   r   rE   r   r   r,   r   r   rA   r   rB   r   rC   r   rD   r   rE   r   r   r,   __name__
__module____qualname__r   r7   r<   r   r   ra   rq   ry   r~   r    r8   r6   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5
 5
 /	5
 &5
 "5
  5
 95
 
5
r8   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)r/   c                    t        |       S r2   )AsyncFilesWithRawResponser4   s    r6   r7   zAsyncFiles.with_raw_responseL  s     )..r8   c                    t        |       S r:   )AsyncFilesWithStreamingResponser4   s    r6   r<   z"AsyncFiles.with_streaming_responseV  s     /t44r8   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 )	rG   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z"AsyncFiles.list.<locals>.<genexpr>  rR   rS   rT   rU   rV   rW   rY   )r   r   r]   r   r   r^   r&   r,   r*   r   r'   r_   r`   s	            r6   ra   zAsyncFiles.list_  s    N	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[!!!<((+'%%$,%.!&
 %33 # " 
 	
r8   rb   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)rd   re   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z$AsyncFiles.delete.<locals>.<genexpr>  rR   rS   rT   rg   rh   ri   rj   Nrl   ro   s          r6   rq   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)rs   re   rt   ru   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z&AsyncFiles.download.<locals>.<genexpr>  rR   rS   rT   rg   rw   ri   rj   N)	rm   r   r   r]   r   r   rx   r*   r   ro   s          r6   ry   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{   re   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>)  rR   rS   rT   rg   rh   ri   rj   Nr}   ro   s          r6   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 }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   rH   rI   c              3  2   K   | ]  }t        |        y wrK   rL   rN   s     r6   rQ   z$AsyncFiles.upload.<locals>.<genexpr>X  rR   rS   rT   r   r   r   r   rU   Nri   r   )r   r   r]   r   r   r   r   r   r   rM   r   r   r   r(   r   r*   r,   r   s	            r6   r   zAsyncFiles.upload9  s    8	
$ '*hhu5Le5LOeNf/g&h"	
 "	
 *+A[mFYWY[/d73;#7>xjQ )>n%ZZ!,T3E3V3VWW(+Q[el !   
 
 	
W
s$   B7C#9C
: C#C!C#!C#)r   r   )r   r   )r>   r   r?   r   r@   r   rA   r   rB   r   rC   r   rD   r   rE   r   r   z5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]r   )rp   rM   rA   r   rB   r   rC   r   rD   r   rE   r   r   r   r   r   r   r   r8   r6   r/   r/   K  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5
 5
 /	5
 &5
 "5
  5
 95
 
5
r8   c                      e Zd ZddZy)r3   c                p   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        |j                  t              | _        t        j                  |j                        | _        t        j                  |j                        | _	        y rK   )
_filesr	   to_raw_response_wrapperra   rq   r    ry   r   r~   r   r5   r   s     r6   __init__zFilesWithRawResponse.__init__r  s    $<<JJ
	 '>>LL
 7NN
 "2!I!I##"
 '>>LL
r8   Nr   r.   r   Noner   r   r   r   r   r8   r6   r3   r3   q      
r8   r3   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 rK   )
r   r	   async_to_raw_response_wrapperra   rq   r#   ry   r   r~   r   r   s     r6   r   z"AsyncFilesWithRawResponse.__init__  s    $BBJJ
	 'DDLL
 =NN"
 "2!O!O##"
 'DDLL
r8   Nr   r/   r   r   r   r   r8   r6   r   r     r   r8   r   c                      e Zd ZddZy)r;   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rK   )	r   r   ra   rq   r"   ry   r   r~   r   r   s     r6   r   z#FilesWithStreamingResponse.__init__  sv    0JJ
	 3LL
 <NN%
 ">##"
 3LL
r8   Nr   r   r   r8   r6   r;   r;     r   r8   r;   c                      e Zd ZddZy)r   c                    || _         t        |j                        | _        t        |j                        | _        t	        |j
                  t              | _        t        |j                        | _        t        |j                        | _        y rK   )	r   r!   ra   rq   r$   ry   r   r~   r   r   s     r6   r   z(AsyncFilesWithStreamingResponse.__init__  sx    6JJ
	 9LL
 BNN*
 "D##"
 9LL
r8   Nr   r   r   r8   r6   r   r     r   r8   r   )A
__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*   types.beta.deleted_filer+   types.beta.file_metadatar,   types.anthropic_beta_paramr-   __all__r.   r/   r3   r   r;   r   r   r8   r6   <module>r      s    # & &     V V V x x & :   . > @ 2 4 <L
!c
O c
L	c
! c
L	
 
,
 
,
 
,
 
r8   