o
    niHP                     @  sT  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mZ ddl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&m'Z' ddl(m)Z) ddl*m+Z+ ddgZ,G dd deZ-G dd deZ.G dd dZ/G dd dZ0G dd dZ1G dd dZ2dS )    )annotations)Anycast)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)path_templatemaybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncConversationCursorPageAsyncConversationCursorPage)AsyncPaginatormake_request_options)thread_list_paramsthread_list_items_params)ChatKitThread)ThreadDeleteResponse)DataThreadsAsyncThreadsc                
   @     e Zd Zed*ddZed+ddZddded	d,ddZeeeeeddded	d-d!d"Z	ddded	d.d$d%Z
eeeeddded&d/d(d)ZdS )0r   returnThreadsWithRawResponsec                 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
        )r#   self r(   e/var/www/html/arapca_proje/venv/lib/python3.10/site-packages/openai/resources/beta/chatkit/threads.pywith_raw_response      zThreads.with_raw_responseThreadsWithStreamingResponsec                 C  r$   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&   r(   r(   r)   with_streaming_response%      zThreads.with_streaming_responseNextra_headersextra_query
extra_bodytimeout	thread_idstrr1   Headers | Noner2   Query | Noner3   Body | Noner4   'float | httpx.Timeout | None | NotGivenr   c                C  F   |s	t d|ddi|pi }| jtd|dt||||dtdS )`  
        Retrieve a ChatKit thread by its identifier.

        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
        8Expected a non-empty value for `thread_id` but received OpenAI-Betachatkit_beta=v1/chatkit/threads/{thread_id}r5   r0   optionscast_to
ValueError_getr   r   r   r'   r5   r1   r2   r3   r4   r(   r(   r)   retrieve.      
zThreads.retrieve	afterbeforelimitorderuserr1   r2   r3   r4   rL   
str | OmitrM   rN   
int | OmitrO   Literal['asc', 'desc'] | OmitrP   )SyncConversationCursorPage[ChatKitThread]c       	   
      C  H   ddi|pi }| j dtt t||||	t|||||dtjdtdS as  
        List ChatKit threads with optional pagination and user filters.

        Args:
          after: List items created after this thread item ID. Defaults to null for the first
              page.

          before: List items created before this thread item ID. Defaults to null for the newest
              results.

          limit: Maximum number of thread items to return. Defaults to 20.

          order: Sort order for results by creation time. Defaults to `desc`.

          user: Filter threads that belong to this user identifier. Defaults to null to return
              all users.

          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
        r>   r?   z/chatkit/threads)rL   rM   rN   rO   rP   r1   r2   r3   r4   querypagerC   model)_get_api_listr   r   r   r   r   ThreadListParams
r'   rL   rM   rN   rO   rP   r1   r2   r3   r4   r(   r(   r)   listP   *   (zThreads.listr   c                C  r;   )x  
        Delete a ChatKit thread along with its items and stored attachments.

        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
        r=   r>   r?   r@   rA   r0   rB   rF   _deleter   r   r   rH   r(   r(   r)   delete   rJ   zThreads.deleterL   rM   rN   rO   r1   r2   r3   r4    SyncConversationCursorPage[Data]c          
      C  f   |s	t d|ddi|pi }| jtd|dtt t||||	t||||dtjdt	t
tdS 	a  
        List items that belong to a ChatKit thread.

        Args:
          after: List items created after this thread item ID. Defaults to null for the first
              page.

          before: List items created before this thread item ID. Defaults to null for the newest
              results.

          limit: Maximum number of thread items to return. Defaults to 20.

          order: Sort order for results by creation time. Defaults to `desc`.

          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
        r=   r>   r?   z"/chatkit/threads/{thread_id}/itemsrA   )rL   rM   rN   rO   rW   rY   )rF   r\   r   r   r   r   r   r   ThreadListItemsParamsr   r   
r'   r5   rL   rM   rN   rO   r1   r2   r3   r4   r(   r(   r)   
list_items   ,   %
zThreads.list_items)r"   r#   )r"   r,   r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r"   r   )rL   rQ   rM   rQ   rN   rR   rO   rS   rP   rQ   r1   r7   r2   r8   r3   r9   r4   r:   r"   rT   r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r"   r   )r5   r6   rL   rQ   rM   rQ   rN   rR   rO   rS   r1   r7   r2   r8   r3   r9   r4   r:   r"   rf   __name__
__module____qualname__r   r*   r.   r   rI   r   r_   rd   rk   r(   r(   r(   r)   r      D    	%E&c                
   @  r!   )0r    r"   AsyncThreadsWithRawResponsec                 C  r$   r%   )rt   r&   r(   r(   r)   r*      r+   zAsyncThreads.with_raw_response!AsyncThreadsWithStreamingResponsec                 C  r$   r-   )ru   r&   r(   r(   r)   r.      r/   z$AsyncThreads.with_streaming_responseNr0   r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r   c                  N   |s
t d|ddi|pi }| jtd|dt||||dtdI dH S )	r<   r=   r>   r?   r@   rA   r0   rB   NrE   rH   r(   r(   r)   rI        
zAsyncThreads.retrieverK   rL   rQ   rM   rN   rR   rO   rS   rP   IAsyncPaginator[ChatKitThread, AsyncConversationCursorPage[ChatKitThread]]c       	   
      C  rU   rV   )r\   r   r   r   r   r   r]   r^   r(   r(   r)   r_   %  r`   zAsyncThreads.listr   c                  rv   )	ra   r=   r>   r?   r@   rA   r0   rB   Nrb   rH   r(   r(   r)   rd   d  rw   zAsyncThreads.deletere   7AsyncPaginator[Data, AsyncConversationCursorPage[Data]]c          
      C  rg   rh   )rF   r\   r   r   r   r   r   r   ri   r   r   rj   r(   r(   r)   rk     rl   zAsyncThreads.list_items)r"   rt   )r"   ru   rm   )rL   rQ   rM   rQ   rN   rR   rO   rS   rP   rQ   r1   r7   r2   r8   r3   r9   r4   r:   r"   rx   rn   )r5   r6   rL   rQ   rM   rQ   rN   rR   rO   rS   r1   r7   r2   r8   r3   r9   r4   r:   r"   ry   ro   r(   r(   r(   r)   r       rs   c                   @     e Zd ZdddZdS )	r#   threadsr   r"   Nonec                 C  B   || _ t|j| _t|j| _t|j| _t|j| _d S N)_threadsr   to_raw_response_wrapperrI   r_   rd   rk   r'   r{   r(   r(   r)   __init__     
zThreadsWithRawResponse.__init__Nr{   r   r"   r|   rp   rq   rr   r   r(   r(   r(   r)   r#         r#   c                   @  rz   )	rt   r{   r    r"   r|   c                 C  r}   r~   )r   r   async_to_raw_response_wrapperrI   r_   rd   rk   r   r(   r(   r)   r     r   z$AsyncThreadsWithRawResponse.__init__Nr{   r    r"   r|   r   r(   r(   r(   r)   rt     r   rt   c                   @  rz   )	r,   r{   r   r"   r|   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r~   )r   r   rI   r_   rd   rk   r   r(   r(   r)   r        
z%ThreadsWithStreamingResponse.__init__Nr   r   r(   r(   r(   r)   r,     r   r,   c                   @  rz   )	ru   r{   r    r"   r|   c                 C  r   r~   )r   r   rI   r_   rd   rk   r   r(   r(   r)   r     r   z*AsyncThreadsWithStreamingResponse.__init__Nr   r   r(   r(   r(   r)   ru     r   ru   )3
__future__r   typingr   r   typing_extensionsr   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.chatkitr   r   !types.beta.chatkit.chatkit_threadr   )types.beta.chatkit.thread_delete_responser   +types.beta.chatkit.chatkit_thread_item_listr   __all__r   r    r#   rt   r,   ru   r(   r(   r(   r)   <module>   s2   $ V V