o
    iT                     @  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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/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddgZ8G dd de$Z9G 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)	BodyOmitQueryHeadersNoneTypeNotGiven	FileTypesomit	not_given)extract_filespath_template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 r4   a/home/kim/smarthome/.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_response1      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}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	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   rD   rE   rF   rG   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:   s&    

zFiles.createrY   r*   c                C  sJ   |s	t d||st d|| jt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
        rQ   6Expected a non-empty value for `file_id` but received */containers/{container_id}/files/{file_id}rH   rC   rY   r]   r^   r_   _getr   r%   r*   r3   rC   rH   rD   rE   rF   rG   r4   r4   r5   retriever   s   zFiles.retrieveafterlimitorderrD   rE   rF   rG   ro   rp   
int | Omitrq   Literal['asc', 'desc'] | Omit SyncCursorPage[FileListResponse]c          	      C  N   |s	t d|| jt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
        rQ   rW   rX   )ro   rp   rq   )rD   rE   rF   rG   query)pager]   model)	r_   _get_api_listr   r"   r(   r%   r   r&   FileListParams	r3   rH   ro   rp   rq   rD   rE   rF   rG   r4   r4   r5   list   (   &
z
Files.listNonec                C  sZ   |s	t d||st d|ddi|pi }| jt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
        rQ   rf   Accept*/*rg   rh   rY   ri   r_   _deleter   r%   r   rl   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   ro   rK   rp   rr   rq   rs   rD   rL   rE   rM   rF   rN   rG   rO   r.   rt   rC   rI   rH   rI   rD   rL   rE   rM   rF   rN   rG   rO   r.   r   __name__
__module____qualname__r   r6   r;   r?   r   r   rd   rm   r}   r   r4   r4   r4   r5   r+   "   @    	?(C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}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
tdI d	H S )rP   rQ   rR   rB   rS   rU   rV   rW   rX   NrY   rZ   )r_   r   r   r   r   rI   r`   ra   r   r   r'   rb   r%   r)   rc   r4   r4   r5   rd     s(    
zAsyncFiles.createrY   r*   c                  sR   |s
t d||st d|| jtd||dt||||dtdI dH S )re   rQ   rf   rg   rh   rY   ri   Nrj   rl   r4   r4   r5   rm   H  s   zAsyncFiles.retrievern   ro   rp   rr   rq   rs   CAsyncPaginator[FileListResponse, AsyncCursorPage[FileListResponse]]c          	      C  ru   rv   )	r_   rz   r   r#   r(   r%   r   r&   r{   r|   r4   r4   r5   r}   l  r~   zAsyncFiles.listr   c                  sb   |s
t d||st d|ddi|pi }| jtd||dt||||dtdI d	H S )
r   rQ   rf   r   r   rg   rh   rY   ri   Nr   rl   r4   r4   r5   r     s   zAsyncFiles.delete)r.   r
   )r.   r   )r.   r   r   r   )rH   rI   ro   rK   rp   rr   rq   rs   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   Zto_raw_response_wrapperrd   rm   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   Zasync_to_raw_response_wrapperrd   rm   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    rd   rm   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!   rd   rm   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   Ztyping_extensionsr   Zhttpx r   r6   r	   r
   r   r   r   r   _typesr   r   r   r   r   r   r   r   r   Z_utilsr   r   r   r   r   Z_compatr   Z	_resourcer   r   	_responser    r!   Z
paginationr"   r#   Z_base_clientr$   r%   Ztypes.containersr&   r'   Z#types.containers.file_list_responser(   Z%types.containers.file_create_responser)   Z'types.containers.file_retrieve_responser*   __all__r+   r,   r8   r   r=   r   r4   r4   r4   r5   <module>   s4    , W W