o
    $i2R                     @  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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/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddgZ7G dd de#Z8G dd de$Z9G 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)	BodyOmitQueryHeadersNoneTypeNotGiven	FileTypesomit	not_given)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 r3   g/var/www/html/flask_server/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
        )r7   r1   r3   r3   r4   with_raw_response'      zFiles.with_raw_responseFilesWithStreamingResponsec                 C  r8   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<   r1   r3   r3   r4   with_streaming_response1      zFiles.with_streaming_responseNfilefile_idextra_headersextra_query
extra_bodytimeoutcontainer_idstrrA   FileTypes | OmitrB   
str | OmitrC   Headers | NonerD   Query | NonerE   Body | NonerF   '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 rA   rB   rA   pathsContent-Typemultipart/form-data/containers//filesrC   rD   rE   rF   bodyfilesoptionscast_to)
ValueErrorr   r   r   r   rH   object_postr   r&   FileCreateParamsr$   r(   
r2   rG   rA   rB   rC   rD   rE   rF   rZ   r[   r3   r3   r4   create:   s$    

zFiles.createrX   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
        rP   6Expected a non-empty value for `file_id` but received rV   /files/rX   r\   r]   r^   _getr$   r)   r2   rB   rG   rC   rD   rE   rF   r3   r3   r4   retrieveq   s   zFiles.retrieveafterlimitorderrC   rD   rE   rF   rm   rn   
int | Omitro   Literal['asc', 'desc'] | Omit 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
        rP   rV   rW   )rm   rn   ro   )rC   rD   rE   rF   query)pager\   model)r^   _get_api_listr!   r'   r$   r   r%   FileListParams	r2   rG   rm   rn   ro   rC   rD   rE   rF   r3   r3   r4   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
        rP   re   Accept*/*rV   rf   rX   rg   r^   _deleter$   r   rj   r3   r3   r4   delete   s   zFiles.delete)r-   r	   )r-   r7   )r-   r<   rG   rH   rA   rI   rB   rJ   rC   rK   rD   rL   rE   rM   rF   rN   r-   r(   rB   rH   rG   rH   rC   rK   rD   rL   rE   rM   rF   rN   r-   r)   )rG   rH   rm   rJ   rn   rp   ro   rq   rC   rK   rD   rL   rE   rM   rF   rN   r-   rr   rB   rH   rG   rH   rC   rK   rD   rL   rE   rM   rF   rN   r-   r}   __name__
__module____qualname__r   r5   r:   r>   r   r   rc   rk   r{   r   r3   r3   r3   r4   r*   "   @    	>(Cc                   @  r,   )5r+   r-   r
   c                 C  r.   r/   )r
   r0   r1   r3   r3   r4   r5      r6   zAsyncFiles.contentAsyncFilesWithRawResponsec                 C  r8   r9   )r   r1   r3   r3   r4   r:      r;   zAsyncFiles.with_raw_responseAsyncFilesWithStreamingResponsec                 C  r8   r=   )r   r1   r3   r3   r4   r>     r?   z"AsyncFiles.with_streaming_responseNr@   rG   rH   rA   rI   rB   rJ   rC   rK   rD   rL   rE   rM   rF   rN   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 )rO   rP   rQ   rA   rR   rT   rU   rV   rW   NrX   rY   )r^   r   r   r   r   rH   r_   r`   r   r&   ra   r$   r(   rb   r3   r3   r4   rc     s&    
zAsyncFiles.createrX   r)   c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )rd   rP   re   rV   rf   rX   rg   Nrh   rj   r3   r3   r4   rk   F  s   zAsyncFiles.retrieverl   rm   rn   rp   ro   rq   CAsyncPaginator[FileListResponse, AsyncCursorPage[FileListResponse]]c          	      C  rs   rt   )r^   rx   r"   r'   r$   r   r%   ry   rz   r3   r3   r4   r{   j  r|   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~   rP   re   r   r   rV   rf   rX   rg   Nr   rj   r3   r3   r4   r     s   zAsyncFiles.delete)r-   r
   )r-   r   )r-   r   r   r   )rG   rH   rm   rJ   rn   rp   ro   rq   rC   rK   rD   rL   rE   rM   rF   rN   r-   r   r   r   r3   r3   r3   r4   r+      r   c                   @  $   e Zd ZdddZeddd	Zd
S )r7   r[   r*   r-   r}   c                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S r/   )_filesr   to_raw_response_wrapperrc   rk   r{   r   r2   r[   r3   r3   r4   __init__     
zFilesWithRawResponse.__init__r   c                 C     t | jjS r/   )r   r   r5   r1   r3   r3   r4   r5        zFilesWithRawResponse.contentNr[   r*   r-   r}   )r-   r   r   r   r   r   r   r5   r3   r3   r3   r4   r7         
r7   c                   @  r   )r   r[   r+   r-   r}   c                 C  r   r/   )r   r   async_to_raw_response_wrapperrc   rk   r{   r   r   r3   r3   r4   r     r   z"AsyncFilesWithRawResponse.__init__r   c                 C  r   r/   )r   r   r5   r1   r3   r3   r4   r5     r   z!AsyncFilesWithRawResponse.contentNr[   r+   r-   r}   )r-   r   r   r3   r3   r3   r4   r     r   r   c                   @  r   )r<   r[   r*   r-   r}   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r/   )r   r   rc   rk   r{   r   r   r3   r3   r4   r        
z#FilesWithStreamingResponse.__init__r   c                 C  r   r/   )r   r   r5   r1   r3   r3   r4   r5   	  r   z"FilesWithStreamingResponse.contentNr   )r-   r   r   r3   r3   r3   r4   r<     r   r<   c                   @  r   )r   r[   r+   r-   r}   c                 C  r   r/   )r   r    rc   rk   r{   r   r   r3   r3   r4   r     r   z(AsyncFilesWithStreamingResponse.__init__r   c                 C  r   r/   )r   r   r5   r1   r3   r3   r4   r5     r   z'AsyncFilesWithStreamingResponse.contentNr   )r-   r   r   r3   r3   r3   r4   r     r   r   )>
__future__r   typingr   r   typing_extensionsr   httpx r   r5   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+   r7   r   r<   r   r3   r3   r3   r4   <module>   s4    , V V