o
    î6Wj”l  ã                   @  s¨  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„ de ƒZAG dd„ de!ƒZBG dd„ dƒZCG dd„ dƒZDG dd„ dƒZEG dd„ dƒZFdS ) é    )Ú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                
   @  ó¨   e Zd Zed-dd„ƒZed.dd„ƒZeeeeeddded	œ	d/dd„Zedddedœd0d!d"„Z	edddedœd1d$d%„Z
edddedœd2d'd(„Zedddedœd3d+d,„ZdS )4r0   ÚreturnÚFilesWithRawResponsec                 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
        )r4   ©Úself© r9   úm/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/anthropic/resources/beta/files.pyÚwith_raw_response,   ó   zFiles.with_raw_responseÚFilesWithStreamingResponsec                 C  r5   ©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   r9   r9   r:   Úwith_streaming_response6   ó   zFiles.with_streaming_responseN©	Úafter_idÚ	before_idÚlimitÚscope_idÚbetasÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutrB   ú
str | OmitrC   rD   ú
int | OmitrE   rF   úList[AnthropicBetaParam] | OmitrG   úHeaders | NonerH   úQuery | NonerI   úBody | NonerJ   ú'float | httpx.Timeout | None | NotGivenúSyncPage[FileMetadata]c       	   
      C  ó‚   i t dt|ƒrd tdd„ |D ƒdgƒ¡ntiƒ¥|pi ¥}ddi|p$i ¥}| jdtt t||||	t	||||dœt
jƒd�td	�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                 s  ó   � | ]}t |ƒV  qd S ©N©Ústr©Ú.0Úer9   r9   r:   Ú	<genexpr>m   ó   € zFiles.list.<locals>.<genexpr>úfiles-api-2025-04-14ú/v1/files?beta=true©rB   rC   rD   rE   ©rG   rH   rI   rJ   Úquery©ÚpageÚoptionsÚmodel)r   r   Újoinr   r   Ú_get_api_listr%   r.   r+   r   r'   ÚFileListParams©
r8   rB   rC   rD   rE   rF   rG   rH   rI   rJ   r9   r9   r:   Úlist?   ó>   +ÿýÿÿø
üùûîz
Files.list©rF   rG   rH   rI   rJ   Úfile_idrZ   r-   c                C  ó‚   |s	t d|›�ƒ‚i tdt|ƒrd tdd„ |D ƒdgƒ¡ntiƒ¥|p%i ¥}ddi|p-i ¥}| jtd|d�t||||d	�t	d
�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 rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   «   r_   zFiles.delete.<locals>.<genexpr>r`   ú/v1/files/{file_id}?beta=true©rp   ©rG   rH   rI   rJ   ©rg   Úcast_to©
Ú
ValueErrorr   r   ri   r   r   Ú_deleter   r+   r-   ©r8   rp   rF   rG   rH   rI   rJ   r9   r9   r:   ÚdeleteŠ   ó*   ÿýÿÿø

ÿûzFiles.deleter   c                C  s’   |s	t d|›�ƒ‚ddi|pi ¥}i tdt|ƒr&d tdd„ |D ƒdgƒ¡ntiƒ¥|p-i ¥}ddi|p5i ¥}| jtd	|d
�t||||d�t	d�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
        rs   ÚAcceptúapplication/binaryrU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   Ý   r_   z!Files.download.<locals>.<genexpr>r`   ú%/v1/files/{file_id}/content?beta=trueru   rv   rw   )
rz   r   r   ri   r   r   Ú_getr   r+   r   r|   r9   r9   r:   Údownload»   s,   ÿýÿÿø

ÿûzFiles.downloadr.   c                C  rq   )á»  
        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
        rs   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^     r_   z*Files.retrieve_metadata.<locals>.<genexpr>r`   rt   ru   rv   rw   ©
rz   r   r   ri   r   r   rƒ   r   r+   r.   r|   r9   r9   r:   Úretrieve_metadataí   r~   zFiles.retrieve_metadataÚfiler   c          	   
   C  sº   i t dt|ƒrd tdd„ |D ƒdgƒ¡ntiƒ¥|pi ¥}ddi|p$i ¥}tt|ƒ|ƒ}td|idggƒ}tt	t
ttf |ƒdggd�}d|d	< | jd
t|tjƒ|t||||d�td�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
        rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   =  r_   zFiles.upload.<locals>.<genexpr>r`   rˆ   ©Úpathsúmultipart/form-dataúContent-Typera   rv   ©ÚbodyÚfilesrg   rx   )r   r   ri   r   r   r*   Ú"_stainless_helper_header_from_filer	   r   r   r   rZ   ÚobjectÚ_postr   r(   ÚFileUploadParamsr+   r.   ©	r8   rˆ   rF   rG   rH   rI   rJ   r�   r�   r9   r9   r:   Úupload  s2   ÿýÿÿø

ÿùzFiles.upload)r3   r4   )r3   r=   )rB   rK   rC   rK   rD   rL   rE   rK   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   rR   ©rp   rZ   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r-   )rp   rZ   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r   ©rp   rZ   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r.   ©rˆ   r   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r.   ©Ú__name__Ú
__module__Ú__qualname__r   r;   r?   r   r   rm   r}   r„   r‡   r–   r9   r9   r9   r:   r0   +   óN    	óOö5ö6ö5öc                
   @  r2   )4r1   r3   ÚAsyncFilesWithRawResponsec                 C  r5   r6   )rŸ   r7   r9   r9   r:   r;   X  r<   zAsyncFiles.with_raw_responseÚAsyncFilesWithStreamingResponsec                 C  r5   r>   )r    r7   r9   r9   r:   r?   b  r@   z"AsyncFiles.with_streaming_responseNrA   rB   rK   rC   rD   rL   rE   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   ú5AsyncPaginator[FileMetadata, AsyncPage[FileMetadata]]c       	   
      C  rS   )
rT   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   ™  r_   z"AsyncFiles.list.<locals>.<genexpr>r`   ra   rb   rc   re   )r   r   ri   r   r   rj   r&   r.   r+   r   r'   rk   rl   r9   r9   r:   rm   k  rn   zAsyncFiles.listro   rp   rZ   r-   c                Ã  óŠ   �|s
t d|›�ƒ‚i tdt|ƒrd tdd„ |D ƒdgƒ¡ntiƒ¥|p&i ¥}ddi|p.i ¥}| jtd|d�t||||d	�t	d
�I dH S )rr   rs   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   ×  r_   z$AsyncFiles.delete.<locals>.<genexpr>r`   rt   ru   rv   rw   Nry   r|   r9   r9   r:   r}   ¶  ó,   €ÿýÿÿø

ÿûzAsyncFiles.deleter   c                Ã  sš   �|s
t d|›�ƒ‚ddi|pi ¥}i tdt|ƒr'd tdd„ |D ƒdgƒ¡ntiƒ¥|p.i ¥}ddi|p6i ¥}| jtd	|d
�t||||d�t	d�I dH S )r   rs   r€   r�   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   	  r_   z&AsyncFiles.download.<locals>.<genexpr>r`   r‚   ru   rv   rw   N)
rz   r   r   ri   r   r   rƒ   r   r+   r   r|   r9   r9   r:   r„   ç  s.   €ÿýÿÿø

ÿûzAsyncFiles.downloadr.   c                Ã  r¢   )r…   rs   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   :  r_   z/AsyncFiles.retrieve_metadata.<locals>.<genexpr>r`   rt   ru   rv   rw   Nr†   r|   r9   r9   r:   r‡     r£   zAsyncFiles.retrieve_metadatarˆ   r   c          	   
   Ã  sÈ   �i t dt|ƒrd tdd„ |D ƒdgƒ¡ntiƒ¥|pi ¥}ddi|p%i ¥}tt|ƒ|ƒ}td|idggƒ}tt	t
ttf |ƒdggd�}d|d	< | jd
t|tjƒI dH |t||||d�td�I dH S )r‰   rU   rV   c                 s  rW   rX   rY   r[   r9   r9   r:   r^   i  r_   z$AsyncFiles.upload.<locals>.<genexpr>r`   rˆ   rŠ   rŒ   r�   ra   Nrv   rŽ   )r   r   ri   r   r   r*   r‘   r	   r   r   r   rZ   r’   r“   r   r(   r”   r+   r.   r•   r9   r9   r:   r–   J  s4   €ÿýÿÿø
ÿùzAsyncFiles.upload)r3   rŸ   )r3   r    )rB   rK   rC   rK   rD   rL   rE   rK   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r¡   r—   )rp   rZ   rF   rM   rG   rN   rH   rO   rI   rP   rJ   rQ   r3   r   r˜   r™   rš   r9   r9   r9   r:   r1   W  rž   c                   @  ó   e Zd Zddd„ZdS )	r4   r�   r0   r3   ÚNonec                 C  óP   || _ t |j¡| _t |j¡| _t|jtƒ| _t |j¡| _t |j	¡| _	d S rX   )
Ú_filesr   Úto_raw_response_wrapperrm   r}   r    r„   r   r‡   r–   ©r8   r�   r9   r9   r:   Ú__init__„  ó"   ÿÿþÿ
ÿzFilesWithRawResponse.__init__N©r�   r0   r3   r¥   ©r›   rœ   r�   rª   r9   r9   r9   r:   r4   ƒ  ó    r4   c                   @  r¤   )	rŸ   r�   r1   r3   r¥   c                 C  r¦   rX   )
r§   r   Úasync_to_raw_response_wrapperrm   r}   r#   r„   r   r‡   r–   r©   r9   r9   r:   rª   š  r«   z"AsyncFilesWithRawResponse.__init__N©r�   r1   r3   r¥   r­   r9   r9   r9   r:   rŸ   ™  r®   rŸ   c                   @  r¤   )	r=   r�   r0   r3   r¥   c                 C  óH   || _ t|jƒ| _t|jƒ| _t|jtƒ| _t|jƒ| _t|jƒ| _d S rX   )	r§   r   rm   r}   r"   r„   r   r‡   r–   r©   r9   r9   r:   rª   °  ó"   ÿÿþÿ
ÿz#FilesWithStreamingResponse.__init__Nr¬   r­   r9   r9   r9   r:   r=   ¯  r®   r=   c                   @  r¤   )	r    r�   r1   r3   r¥   c                 C  r±   rX   )	r§   r!   rm   r}   r$   r„   r   r‡   r–   r©   r9   r9   r:   rª   Æ  r²   z(AsyncFilesWithStreamingResponse.__init__Nr°   r­   r9   r9   r9   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_paramr/   Ú__all__r0   r1   r4   rŸ   r=   r    r9   r9   r9   r:   Ú<module>   s:   ( 0  .  .