
    j\                         d dl 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l
mZ ddl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lmZ  e j2                  e j4                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)AttachmentPage)(CompleteMultipartUploadRequestEntityType)MultipartUploadPart)StartMultipartUploadResponse   )AsyncRawAttachmentsClientRawAttachmentsClient)AttachmentListRequestEntityType)#DownloadAttachmentRequestEntityType)%StartMultipartUploadRequestEntityType)!UploadAttachmentRequestEntityType.c                       e Zd ZdefdZedefd       Zdddddede	d	ed
ede
j                  e   de
j                  e   de
j                  e   defdZeeedddeded	ededede
j$                  e   de
j                  e   de
j                  e   de
j                  e   de
j                  e   ddfdZeeedddeded	ededede
j$                  e   de
j                  e   de
j                  e   de
j                  e   de
j                  e   ddfdZddddeded	ededede
j                  e   de
j                  e   de
j.                  e   fdZeedddededed	ed
ede
j                  e   de
j                  e   de
j                  e   defdZdddddeded	ed e
j<                  ee
j                  e
j>                     f   de
j                  e   de
j                  e   de
j                  e   ddfd!Z y)"AttachmentsClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     y/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/attachments/client.py__init__zAttachmentsClient.__init__   s    /~N    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAttachmentsClient
        r   r   s    r   with_raw_responsez#AttachmentsClient.with_raw_response        r   Npagesizerequest_options
project_identity_type	entity_idpathr$   r%   r&   c          	      ^    | j                   j                  |||||||      }|j                  S )a  
        Attachments list for entity

        Parameters
        ----------
        project_id : str

        entity_type : AttachmentListRequestEntityType

        entity_id : str

        path : str

        page : typing.Optional[int]

        size : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AttachmentPage
            Attachment Resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.attachment_list(project_id='project_id', entity_type="trace", entity_id='entity_id', path='path', )
        r'   r(   r)   r*   r$   r%   r&   r   attachment_listdata	r   r'   r(   r)   r*   r$   r%   r&   	_responses	            r   r.   z!AttachmentsClient.attachment_list$   sA    T $$44!#+ 5 
	 ~~r   project_namecontainer_id	mime_typer&   	file_name	file_size	upload_iduploaded_file_partsr3   r4   r5   c       
         d    | j                   j                  |||||||||	|

      }|j                  S )aH  
        Complete multipart attachment upload

        Parameters
        ----------
        file_name : str

        entity_type : CompleteMultipartUploadRequestEntityType

        entity_id : str

        file_size : int

        upload_id : str

        uploaded_file_parts : typing.Sequence[MultipartUploadPart]

        project_name : typing.Optional[str]
            If null, the default project is used

        container_id : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import MultipartUploadPart
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.complete_multi_part_upload(file_name='file_name', entity_type="trace", entity_id='entity_id', file_size=1000000, upload_id='upload_id', uploaded_file_parts=[MultipartUploadPart(e_tag='e_tag', part_number=1, )], )
        
r6   r(   r)   r7   r8   r9   r3   r4   r5   r&   r   complete_multi_part_uploadr/   r   r6   r(   r)   r7   r8   r9   r3   r4   r5   r&   r1   s               r   r=   z,AttachmentsClient.complete_multi_part_uploadY   sK    h $$??# 3%%+ @ 
	 ~~r   c       
         d    | j                   j                  |||||||||	|

      }|j                  S )a.  
        Delete attachments

        Parameters
        ----------
        file_name : str

        entity_type : CompleteMultipartUploadRequestEntityType

        entity_id : str

        file_size : int

        upload_id : str

        uploaded_file_parts : typing.Sequence[MultipartUploadPart]

        project_name : typing.Optional[str]
            If null, the default project is used

        container_id : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import MultipartUploadPart
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.delete_attachments(file_name='file_name', entity_type="trace", entity_id='entity_id', file_size=1000000, upload_id='upload_id', uploaded_file_parts=[MultipartUploadPart(e_tag='e_tag', part_number=1, )], )
        r;   r   delete_attachmentsr/   r>   s               r   rA   z$AttachmentsClient.delete_attachments   sJ    h $$77# 3%%+ 8 
	 ~~r   workspace_namer&   rC   c          	   #      K   | j                   j                  |||||||      5 }|j                  E d{    ddd       y7 # 1 sw Y   yxY ww)a  
        Download attachment from MinIO

        Parameters
        ----------
        container_id : str

        entity_type : DownloadAttachmentRequestEntityType

        entity_id : str

        file_name : str

        mime_type : str

        workspace_name : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            Attachment Resource

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.download_attachment(container_id='container_id', entity_type="trace", entity_id='entity_id', file_name='x', mime_type='x', )
        r4   r(   r)   r6   r5   rC   r&   Nr   download_attachmentr/   )	r   r4   r(   r)   r6   r5   rC   r&   rs	            r   rG   z%AttachmentsClient.download_attachment   sc     T 11%#)+ 2 
 vv
 
 
 
s+   #AAAA	AAA
Ar5   r3   r&   num_of_file_partsc          
      `    | j                   j                  ||||||||      }	|	j                  S )a  
        Start multipart attachment upload

        Parameters
        ----------
        file_name : str

        num_of_file_parts : int

        entity_type : StartMultipartUploadRequestEntityType

        entity_id : str

        path : str

        mime_type : typing.Optional[str]

        project_name : typing.Optional[str]
            If null, the default project is used

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        StartMultipartUploadResponse
            MultipartUploadResponse

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.start_multi_part_upload(file_name='file_name', num_of_file_parts=1, entity_type="trace", entity_id='entity_id', path='path', )
        r6   rJ   r(   r)   r*   r5   r3   r&   r   start_multi_part_uploadr/   
r   r6   rJ   r(   r)   r*   r5   r3   r&   r1   s
             r   rN   z)AttachmentsClient.start_multi_part_upload  sD    \ $$<</#%+ = 	
	 ~~r   r3   r5   r&   requestc          	      ^    | j                   j                  |||||||      }|j                  S )a  
        Upload attachment to MinIO

        Parameters
        ----------
        file_name : str

        entity_type : UploadAttachmentRequestEntityType

        entity_id : str

        request : typing.Dict[str, typing.Optional[typing.Any]]

        project_name : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.attachments.upload_attachment(file_name='file_name', entity_type="trace", entity_id='entity_id', request={'key': 'value'
        }, )
        r6   r(   r)   rQ   r3   r5   r&   r   upload_attachmentr/   	r   r6   r(   r)   rQ   r3   r5   r&   r1   s	            r   rU   z#AttachmentsClient.upload_attachmentL  sA    T $$66#%+ 7 
	 ~~r   )!__name__
__module____qualname__r   r   propertyr   r!   strr   typingOptionalintr   r   r.   OMITr   Sequencer	   r=   rA   r   IteratorbytesrG   r   r
   rN   r   DictAnyrU    r   r   r   r      s   O*; O  #7    " &*%);?3 3 5	3
 3 3 ooc"3 ooc"3  83 
3| .2-1*.;?@ @ >	@
 @ @ @ $__-@A@ ooc*@ ooc*@ ??3'@  8@ 
@V .2-1*.;?@ @ >	@
 @ @ @ $__-@A@ ooc*@ ooc*@ ??3'@  8@ 
@T 04;?3 3 9	3
 3 3 3 ,3  83 
	3z +/-1;?8 8 	8
 ;8 8 8 ??3'8 ooc*8  88 
&8B .2*.;?3 3 7	3
 3 S&//&**"==>3 ooc*3 ??3'3  83 
3r   r   c                       e Zd ZdefdZedefd       Zdddddede	d	ed
ede
j                  e   de
j                  e   de
j                  e   defdZeeedddeded	ededede
j$                  e   de
j                  e   de
j                  e   de
j                  e   de
j                  e   ddfdZeeedddeded	ededede
j$                  e   de
j                  e   de
j                  e   de
j                  e   de
j                  e   ddfdZddddeded	ededede
j                  e   de
j                  e   de
j.                  e   fdZeedddededed	ed
ede
j                  e   de
j                  e   de
j                  e   defdZdddddeded	ed e
j<                  ee
j                  e
j>                     f   de
j                  e   de
j                  e   de
j                  e   ddfd!Z y)"AsyncAttachmentsClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   zAsyncAttachmentsClient.__init__  s    4NSr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAttachmentsClient
        r   r    s    r   r!   z(AsyncAttachmentsClient.with_raw_response  r"   r   Nr#   r'   r(   r)   r*   r$   r%   r&   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a_  
        Attachments list for entity

        Parameters
        ----------
        project_id : str

        entity_type : AttachmentListRequestEntityType

        entity_id : str

        path : str

        page : typing.Optional[int]

        size : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AttachmentPage
            Attachment Resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.attachment_list(project_id='project_id', entity_type="trace", entity_id='entity_id', path='path', )
        asyncio.run(main())
        r,   Nr-   r0   s	            r   r.   z&AsyncAttachmentsClient.attachment_list  sO     Z **::!#+ ; 
 
	 ~~
   &;9;r2   r6   r7   r8   r9   r3   r4   r5   c       
            K   | j                   j                  |||||||||	|

       d{   }|j                  S 7 w)a  
        Complete multipart attachment upload

        Parameters
        ----------
        file_name : str

        entity_type : CompleteMultipartUploadRequestEntityType

        entity_id : str

        file_size : int

        upload_id : str

        uploaded_file_parts : typing.Sequence[MultipartUploadPart]

        project_name : typing.Optional[str]
            If null, the default project is used

        container_id : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import MultipartUploadPart
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.complete_multi_part_upload(file_name='file_name', entity_type="trace", entity_id='entity_id', file_size=1000000, upload_id='upload_id', uploaded_file_parts=[MultipartUploadPart(e_tag='e_tag', part_number=1, )], )
        asyncio.run(main())
        r;   Nr<   r>   s               r   r=   z1AsyncAttachmentsClient.complete_multi_part_upload  sY     n **EE# 3%%+ F 
 
	 ~~
   )><>c       
            K   | j                   j                  |||||||||	|

       d{   }|j                  S 7 w)a  
        Delete attachments

        Parameters
        ----------
        file_name : str

        entity_type : CompleteMultipartUploadRequestEntityType

        entity_id : str

        file_size : int

        upload_id : str

        uploaded_file_parts : typing.Sequence[MultipartUploadPart]

        project_name : typing.Optional[str]
            If null, the default project is used

        container_id : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import MultipartUploadPart
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.delete_attachments(file_name='file_name', entity_type="trace", entity_id='entity_id', file_size=1000000, upload_id='upload_id', uploaded_file_parts=[MultipartUploadPart(e_tag='e_tag', part_number=1, )], )
        asyncio.run(main())
        r;   Nr@   r>   s               r   rA   z)AsyncAttachmentsClient.delete_attachments  sX     n **==# 3%%+ > 
 
	 ~~
rm   rB   rC   c          	        K   | j                   j                  |||||||      4 d{   }|j                  2 3 d{   }	|	 7 7 6 ddd      d{  7   y# 1 d{  7  sw Y   yxY ww)a  
        Download attachment from MinIO

        Parameters
        ----------
        container_id : str

        entity_type : DownloadAttachmentRequestEntityType

        entity_id : str

        file_name : str

        mime_type : str

        workspace_name : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            Attachment Resource

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.download_attachment(container_id='container_id', entity_type="trace", entity_id='entity_id', file_name='x', mime_type='x', )
        asyncio.run(main())
        rE   NrF   )
r   r4   r(   r)   r6   r5   rC   r&   rH   r/   s
             r   rG   z*AsyncAttachmentsClient.download_attachmentS  s{     Z ##77%#)+ 8 
 
 ff d

f
 
 
 
 
se   'A5A	A5A AAAA 	A5AA A5AA5 A2&A)'A2.A5rI   rJ   c          
      |   K   | j                   j                  ||||||||       d{   }	|	j                  S 7 w)a  
        Start multipart attachment upload

        Parameters
        ----------
        file_name : str

        num_of_file_parts : int

        entity_type : StartMultipartUploadRequestEntityType

        entity_id : str

        path : str

        mime_type : typing.Optional[str]

        project_name : typing.Optional[str]
            If null, the default project is used

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        StartMultipartUploadResponse
            MultipartUploadResponse

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.start_multi_part_upload(file_name='file_name', num_of_file_parts=1, entity_type="trace", entity_id='entity_id', path='path', )
        asyncio.run(main())
        rL   NrM   rO   s
             r   rN   z.AsyncAttachmentsClient.start_multi_part_upload  sS     b **BB/#%+ C 	
 	
	 ~~	
s   '<:<rP   rQ   c          	      z   K   | j                   j                  |||||||       d{   }|j                  S 7 w)a  
        Upload attachment to MinIO

        Parameters
        ----------
        file_name : str

        entity_type : UploadAttachmentRequestEntityType

        entity_id : str

        request : typing.Dict[str, typing.Optional[typing.Any]]

        project_name : typing.Optional[str]

        mime_type : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.attachments.upload_attachment(file_name='file_name', entity_type="trace", entity_id='entity_id', request={'key': 'value'
            }, )
        asyncio.run(main())
        rS   NrT   rV   s	            r   rU   z(AsyncAttachmentsClient.upload_attachment  sO     Z **<<#%+ = 
 
	 ~~
rk   )!rW   rX   rY   r   r   rZ   r   r!   r[   r   r\   r]   r^   r   r   r.   r_   r   r`   r	   r=   rA   r   AsyncIteratorrb   rG   r   r
   rN   r   rc   rd   rU   re   r   r   rg   rg     s   T*< T  #<    " &*%);?6 6 5	6
 6 6 ooc"6 ooc"6  86 
6B .2-1*.;?C C >	C
 C C C $__-@AC ooc*C ooc*C ??3'C  8C 
C\ .2-1*.;?C C >	C
 C C C $__-@AC ooc*C ooc*C ??3'C  8C 
CZ 04;?7 7 9	7
 7 7 7 ,7  87 
		e	$7B +/-1;?; ; 	;
 ;; ; ; ??3'; ooc*;  8; 
&;H .2*.;?6 6 7	6
 6 S&//&**"==>6 ooc*6 ??3'6  86 
6r   rg   )r\   core.client_wrapperr   r   core.request_optionsr   types.attachment_pager   3types.complete_multipart_upload_request_entity_typer   types.multipart_upload_partr	   %types.start_multipart_upload_responser
   
raw_clientr   r   )types.attachment_list_request_entity_typer   -types.download_attachment_request_entity_typer   0types.start_multipart_upload_request_entity_typer   +types.upload_attachment_request_entity_typer   castrd   r_   r   rg   re   r   r   <module>r      s\     G 1 2 j = P G V ^ c Z v{{6::s#j jZ} }r   