o
    ØRWjW  ã                   @  s�  d dl mZ d dl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 dd	lmZ dd
l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m Z m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddgZ9G dd„ de%ƒZ:G dd„ de&ƒZ;G dd„ dƒZ<G dd„ dƒZ=G dd„ dƒZ>G dd „ d ƒZ?dS )!é    )Úannotations)ÚMappingÚcast)ÚLiteralNé   )Ú_legacy_responseé   )ÚContentÚAsyncContentÚContentWithRawResponseÚAsyncContentWithRawResponseÚContentWithStreamingResponseÚ!AsyncContentWithStreamingResponse)Údeepcopy_with_paths)	ÚBodyÚOmitÚQueryÚHeadersÚNoneTypeÚNotGivenÚ	FileTypesÚomitÚ	not_given)Úextract_filesÚpath_templateÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚAsyncPaginatorÚmake_request_options)Úfile_list_paramsÚfile_create_params)ÚFileListResponse)ÚFileCreateResponse)ÚFileRetrieveResponseÚFilesÚ
AsyncFilesc                   @  ó˜   e Zd Zed.dd„ƒZed/dd„ƒZed0d	d
„ƒZeedddedœd1dd„Z	dddedœd2d d!„Z
eeeddded"œd3d)d*„Zdddedœd4d,d-„ZdS )5r+   Úreturnr	   c                 C  ó
   t | jƒS ©N)r	   Ú_client©Úself© r4   úv/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/openai/resources/containers/files/files.pyÚcontent$   ó   
zFiles.contentÚ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/openai/openai-python#accessing-raw-response-data-eg-headers
        )r8   r2   r4   r4   r5   Úwith_raw_response(   ó   zFiles.with_raw_responseÚFilesWithStreamingResponsec                 C  r9   ©zÌ
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r=   r2   r4   r4   r5   Úwith_streaming_response2   ó   zFiles.with_streaming_responseN©ÚfileÚfile_idÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚcontainer_idÚstrrB   úFileTypes | OmitrC   ú
str | OmitrD   úHeaders | NonerE   úQuery | NonerF   úBody | NonerG   ú'float | httpx.Timeout | None | NotGivenr)   c          
      C  sŽ   |s	t d|›�ƒ‚t||dœdggƒ}tttttf |ƒdggd�}	|	r,ddi|p*i ¥}| jtd|d�t	|t
jƒ|	t||||d	d
id�td�S )á<  
        Create a Container File

        You can send either a multipart/form-data request with the raw file content, or
        a JSON request with a file ID.

        Args:
          file: The File object (not file name) to be uploaded.

          file_id: Name of the file to create.

          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
        ú;Expected a non-empty value for `container_id` but received ©rB   rC   rB   ©ÚpathsúContent-Typeúmultipart/form-dataú /containers/{container_id}/files©rH   Úbearer_authT©rD   rE   rF   rG   Úsecurity©ÚbodyÚfilesÚoptionsÚcast_to)Ú
ValueErrorr   r   r   r   rI   ÚobjectÚ_postr   r   r'   ÚFileCreateParamsr%   r)   ©
r3   rH   rB   rC   rD   rE   rF   rG   r]   r^   r4   r4   r5   Úcreate;   s0    þû

ûõzFiles.create©rD   rE   rF   rG   r*   c             	   C  sP   |s	t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�S )	áK  
        Retrieve Container File

        Args:
          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
        rQ   ú6Expected a non-empty value for `file_id` but received ú*/containers/{container_id}/files/{file_id}©rH   rC   rY   TrZ   ©r_   r`   ©ra   Ú_getr   r%   r*   ©r3   rC   rH   rD   rE   rF   rG   r4   r4   r5   Úretrievex   s   û÷zFiles.retrieve©ÚafterÚlimitÚorderrD   rE   rF   rG   rr   rs   ú
int | Omitrt   úLiteral['asc', 'desc'] | Omitú SyncCursorPage[FileListResponse]c          	      C  óT   |s	t d|›�ƒ‚| jtd|d�tt t||||t|||dœtjƒddid�td�S ©	a³  List Container files

        Args:
          after: A cursor for use in pagination.

        `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
              order and `desc` for descending order.

          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
        rQ   rW   rX   )rr   rs   rt   rY   T)rD   rE   rF   rG   Úqueryr[   )Úpager_   Úmodel)	ra   Ú_get_api_listr   r"   r(   r%   r   r&   ÚFileListParams©	r3   rH   rr   rs   rt   rD   rE   rF   rG   r4   r4   r5   Úlist    ó*   &
ýúóîz
Files.listÚNonec             	   C  s`   |s	t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}| jtd||d�t||||ddid	�td
�S )áI  
        Delete Container File

        Args:
          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
        rQ   ri   ÚAcceptú*/*rj   rk   rY   TrZ   rl   ©ra   Ú_deleter   r%   r   ro   r4   r4   r5   ÚdeleteÝ   s    û÷zFiles.delete)r.   r	   )r.   r8   )r.   r=   ©rH   rI   rB   rJ   rC   rK   rD   rL   rE   rM   rF   rN   rG   rO   r.   r)   ©rC   rI   rH   rI   rD   rL   rE   rM   rF   rN   rG   rO   r.   r*   )rH   rI   rr   rK   rs   ru   rt   rv   rD   rL   rE   rM   rF   rN   rG   rO   r.   rw   ©rC   rI   rH   rI   rD   rL   rE   rM   rF   rN   rG   rO   r.   r‚   ©Ú__name__Ú
__module__Ú__qualname__r   r6   r;   r?   r   r   rf   rp   r€   rˆ   r4   r4   r4   r5   r+   #   ó@    	õDö,ôDöc                   @  r-   )5r,   r.   r
   c                 C  r/   r0   )r
   r1   r2   r4   r4   r5   r6     r7   zAsyncFiles.contentÚAsyncFilesWithRawResponsec                 C  r9   r:   )r‘   r2   r4   r4   r5   r;     r<   zAsyncFiles.with_raw_responseÚAsyncFilesWithStreamingResponsec                 C  r9   r>   )r’   r2   r4   r4   r5   r?     r@   z"AsyncFiles.with_streaming_responseNrA   rH   rI   rB   rJ   rC   rK   rD   rL   rE   rM   rF   rN   rG   rO   r)   c          
      Ã  sœ   �|s
t d|›�ƒ‚t||dœdggƒ}tttttf |ƒdggd�}	|	r-ddi|p+i ¥}| jtd|d�t	|t
jƒI d	H |	t||||d
did�td�I d	H S )rP   rQ   rR   rB   rS   rU   rV   rW   rX   NrY   TrZ   r\   )ra   r   r   r   r   rI   rb   rc   r   r   r'   rd   r%   r)   re   r4   r4   r5   rf     s2   € þû
ûõzAsyncFiles.createrg   r*   c             	   Ã  sX   �|s
t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�I d	H S )
rh   rQ   ri   rj   rk   rY   TrZ   rl   Nrm   ro   r4   r4   r5   rp   \  s    €û÷zAsyncFiles.retrieverq   rr   rs   ru   rt   rv   úCAsyncPaginator[FileListResponse, AsyncCursorPage[FileListResponse]]c          	      C  rx   ry   )	ra   r}   r   r#   r(   r%   r   r&   r~   r   r4   r4   r5   r€   „  r�   zAsyncFiles.listr‚   c             	   Ã  sh   �|s
t d|›�ƒ‚|st d|›�ƒ‚ddi|pi ¥}| jtd||d�t||||ddid	�td
�I dH S )rƒ   rQ   ri   r„   r…   rj   rk   rY   TrZ   rl   Nr†   ro   r4   r4   r5   rˆ   Á  s"   €û÷zAsyncFiles.delete)r.   r
   )r.   r‘   )r.   r’   r‰   rŠ   )rH   rI   rr   rK   rs   ru   rt   rv   rD   rL   rE   rM   rF   rN   rG   rO   r.   r“   r‹   rŒ   r4   r4   r4   r5   r,     r�   c                   @  ó$   e Zd Zddd„Zeddd	„ƒZd
S )r8   r^   r+   r.   r‚   c                 C  óB   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S r0   )Ú_filesr   Úto_raw_response_wrapperrf   rp   r€   rˆ   ©r3   r^   r4   r4   r5   Ú__init__ì  ó   ÿÿÿ
ÿzFilesWithRawResponse.__init__r   c                 C  ó   t | jjƒS r0   )r   r–   r6   r2   r4   r4   r5   r6   ü  ó   zFilesWithRawResponse.contentN©r^   r+   r.   r‚   )r.   r   ©r�   rŽ   r�   r™   r   r6   r4   r4   r4   r5   r8   ë  ó    
r8   c                   @  r”   )r‘   r^   r,   r.   r‚   c                 C  r•   r0   )r–   r   Úasync_to_raw_response_wrapperrf   rp   r€   rˆ   r˜   r4   r4   r5   r™     rš   z"AsyncFilesWithRawResponse.__init__r   c                 C  r›   r0   )r   r–   r6   r2   r4   r4   r5   r6     rœ   z!AsyncFilesWithRawResponse.contentN©r^   r,   r.   r‚   )r.   r   rž   r4   r4   r4   r5   r‘     rŸ   r‘   c                   @  r”   )r=   r^   r+   r.   r‚   c                 C  ó:   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S r0   )r–   r    rf   rp   r€   rˆ   r˜   r4   r4   r5   r™     ó   ÿÿÿ
ÿz#FilesWithStreamingResponse.__init__r   c                 C  r›   r0   )r   r–   r6   r2   r4   r4   r5   r6   (  rœ   z"FilesWithStreamingResponse.contentNr�   )r.   r   rž   r4   r4   r4   r5   r=     rŸ   r=   c                   @  r”   )r’   r^   r,   r.   r‚   c                 C  r¢   r0   )r–   r!   rf   rp   r€   rˆ   r˜   r4   r4   r5   r™   .  r£   z(AsyncFilesWithStreamingResponse.__init__r   c                 C  r›   r0   )r   r–   r6   r2   r4   r4   r5   r6   >  rœ   z'AsyncFilesWithStreamingResponse.contentNr¡   )r.   r   rž   r4   r4   r4   r5   r’   -  rŸ   r’   )@Ú
__future__r   Útypingr   r   Útyping_extensionsr   ÚhttpxÚ r   r6   r	   r
   r   r   r   r   r–   r   Ú_typesr   r   r   r   r   r   r   r   r   Ú_utilsr   r   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser    r!   Ú
paginationr"   r#   Ú_base_clientr$   r%   Útypes.containersr&   r'   Ú#types.containers.file_list_responser(   Ú%types.containers.file_create_responser)   Ú'types.containers.file_retrieve_responser*   Ú__all__r+   r,   r8   r‘   r=   r’   r4   r4   r4   r5   Ú<module>   s6    , e e