o
    "chR                     @  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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l,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddgZ5G dd de!Z6G dd de"Z7G dd dZ8G dd dZ9G dd dZ:G dd dZ;dS )     )annotations)Mappingcast)LiteralN   )_legacy_response   )ContentAsyncContentContentWithRawResponseAsyncContentWithRawResponseContentWithStreamingResponse!AsyncContentWithStreamingResponse)	NOT_GIVENBodyQueryHeadersNoneTypeNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimal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 r1   e/home/air/goalskill/back/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
        )r5   r/   r1   r1   r2   with_raw_response'      zFiles.with_raw_responseFilesWithStreamingResponsec                 C  r6   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:   r/   r1   r1   r2   with_streaming_response1      zFiles.with_streaming_responseNfilefile_idextra_headersextra_query
extra_bodytimeoutcontainer_idstrr?   FileTypes | NotGivenr@   str | NotGivenrA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenr&   c          
   
   C  s~   |s	t d|t||d}tttttf |dggd}	ddi|p%i }| jd| dt|t	j
|	t||||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 r?   r@   r?   pathsContent-Typemultipart/form-data/containers//filesrA   rB   rC   rD   bodyfilesoptionscast_to)
ValueErrorr   r   r   r   rF   object_postr   r$   FileCreateParamsr"   r&   
r0   rE   r?   r@   rA   rB   rC   rD   rX   rY   r1   r1   r2   create:   s$    

zFiles.createrV   r'   c                C  sL   |s	t d||st d|| jd| d| t||||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
        rN   6Expected a non-empty value for `file_id` but received rT   /files/rV   rZ   r[   r\   _getr"   r'   r0   r@   rE   rA   rB   rC   rD   r1   r1   r2   retrieveq   s   zFiles.retrieveafterlimitorderrA   rB   rC   rD   rk   rl   int | NotGivenrm   !Literal['asc', 'desc'] | NotGiven SyncCursorPage[FileListResponse]c          	      C  N   |s	t d|| jd| dtt t||||t|||dtj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
        rN   rT   rU   )rk   rl   rm   )rA   rB   rC   rD   query)pagerZ   model)r\   _get_api_listr   r%   r"   r   r#   FileListParams	r0   rE   rk   rl   rm   rA   rB   rC   rD   r1   r1   r2   list   (   &
z
Files.listNonec                C  s\   |s	t d||st d|ddi|pi }| jd| d| t||||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
        rN   rc   Accept*/*rT   rd   rV   re   r\   _deleter"   r   rh   r1   r1   r2   delete   s   zFiles.delete)r+   r	   )r+   r5   )r+   r:   rE   rF   r?   rG   r@   rH   rA   rI   rB   rJ   rC   rK   rD   rL   r+   r&   r@   rF   rE   rF   rA   rI   rB   rJ   rC   rK   rD   rL   r+   r'   )rE   rF   rk   rH   rl   rn   rm   ro   rA   rI   rB   rJ   rC   rK   rD   rL   r+   rp   r@   rF   rE   rF   rA   rI   rB   rJ   rC   rK   rD   rL   r+   r{   __name__
__module____qualname__r   r3   r8   r<   r   ra   ri   ry   r   r1   r1   r1   r2   r(   "   @    	>(Cc                   @  r*   )5r)   r+   r
   c                 C  r,   r-   )r
   r.   r/   r1   r1   r2   r3      r4   zAsyncFiles.contentAsyncFilesWithRawResponsec                 C  r6   r7   )r   r/   r1   r1   r2   r8      r9   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r6   r;   )r   r/   r1   r1   r2   r<     r=   z"AsyncFiles.with_streaming_responseNr>   rE   rF   r?   rG   r@   rH   rA   rI   rB   rJ   rC   rK   rD   rL   r&   c          
   
     s   |s
t d|t||d}tttttf |dggd}	ddi|p&i }| jd| dt|t	j
I d	H |	t||||d
tdI d	H S )rM   rN   rO   r?   rP   rR   rS   rT   rU   NrV   rW   )r\   r   r   r   r   rF   r]   r^   r   r$   r_   r"   r&   r`   r1   r1   r2   ra     s&    
zAsyncFiles.createrV   r'   c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )rb   rN   rc   rT   rd   rV   re   Nrf   rh   r1   r1   r2   ri   F  s   zAsyncFiles.retrieverj   rk   rl   rn   rm   ro   CAsyncPaginator[FileListResponse, AsyncCursorPage[FileListResponse]]c          	      C  rq   rr   )r\   rv   r    r%   r"   r   r#   rw   rx   r1   r1   r2   ry   j  rz   zAsyncFiles.listr{   c                  sd   |s
t d||st d|ddi|pi }| jd| d| t||||dtdI d	H S )
r|   rN   rc   r}   r~   rT   rd   rV   re   Nr   rh   r1   r1   r2   r     s   zAsyncFiles.delete)r+   r
   )r+   r   )r+   r   r   r   )rE   rF   rk   rH   rl   rn   rm   ro   rA   rI   rB   rJ   rC   rK   rD   rL   r+   r   r   r   r1   r1   r1   r2   r)      r   c                   @  $   e Zd ZdddZeddd	Zd
S )r5   rY   r(   r+   r{   c                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S r-   )_filesr   to_raw_response_wrapperra   ri   ry   r   r0   rY   r1   r1   r2   __init__     
zFilesWithRawResponse.__init__r   c                 C     t | jjS r-   )r   r   r3   r/   r1   r1   r2   r3        zFilesWithRawResponse.contentNrY   r(   r+   r{   )r+   r   r   r   r   r   r   r3   r1   r1   r1   r2   r5         
r5   c                   @  r   )r   rY   r)   r+   r{   c                 C  r   r-   )r   r   async_to_raw_response_wrapperra   ri   ry   r   r   r1   r1   r2   r     r   z"AsyncFilesWithRawResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3     r   z!AsyncFilesWithRawResponse.contentNrY   r)   r+   r{   )r+   r   r   r1   r1   r1   r2   r     r   r   c                   @  r   )r:   rY   r(   r+   r{   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r-   )r   r   ra   ri   ry   r   r   r1   r1   r2   r        
z#FilesWithStreamingResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3   	  r   z"FilesWithStreamingResponse.contentNr   )r+   r   r   r1   r1   r1   r2   r:     r   r:   c                   @  r   )r   rY   r)   r+   r{   c                 C  r   r-   )r   r   ra   ri   ry   r   r   r1   r1   r2   r     r   z(AsyncFilesWithStreamingResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3     r   z'AsyncFilesWithStreamingResponse.contentNr   )r+   r   r   r1   r1   r1   r2   r     r   r   )<
__future__r   typingr   r   typing_extensionsr   httpx r   r3   r	   r
   r   r   r   r   _typesr   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)   r5   r   r:   r   r1   r1   r1   r2   <module>   s4    $ V V