
    ]j                     2   d dl Zd dlZd dl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 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 ddlmZ ddlmZ ddlm Z  ddl!m"Z"  ejF                  ejH                  d      Z% G d d      Z& G d d      Z'y)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)BadRequestError)ForbiddenError)
Annotation)LastActionEnum)SelectedItemsRequest   )!CreateBulkAnnotationsResponseItem)DeleteBulkAnnotationsResponse.c            +       n   e Zd ZdefdZdddej                  e   dedej                  e	   de
e   fd	Zeeeeeeeeeeeeeeeeeedd
dej                  e   dej                  e   dej                  ej                      dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  ej                  e      dej                  e   dej                  e   dej                  e   dej                  e	   de
ej.                  e      f(dZdddedej                  e	   de
e   fdZdddedej                  e	   de
d   fdZeeeeeeeedd 	dedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  e   dej                  e	   de
e   fd!Zddd"ded#ej                  e   dej                  e	   de
ej.                  e      fd$Zeeeeeeeedd 	dedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  e   dej                  e	   de
e   fd%Zy)&RawAnnotationsClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     Q/root/env/lib/python3.12/site-packages/label_studio_sdk/annotations/raw_client.py__init__zRawAnnotationsClient.__init__   
    -    Nrequest_optionsidsprojectr$   returnc                   | j                   j                  j                  dd||dddi|t              }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         	                  |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         	                  |j                         }t#        |j                  t        |j                        |      # t         $ r6 t#        |j                  t        |j                        |j$                        w xY w)a  
        Delete multiple annotations by their IDs. The deletion is processed synchronously. Returns the count of deleted annotations in the response.

        Parameters
        ----------
        ids : typing.Sequence[int]
            List of annotation IDs to delete

        project : int

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

        Returns
        -------
        HttpResponse[DeleteBulkAnnotationsResponse]
            Annotations deleted successfully
        api/annotations/bulk-delete/POSTr%   r&   content-typeapplication/jsonmethodjsonheadersr$   omit   ,  type_object_responsedata  r1   body  status_coder1   r=   )r   httpx_clientrequestOMITr@   typingcastr   r   r0   r	   r   dictr1   Anyr   r   r   textr   r%   r&   r$   	_response_data_response_jsons          r   delete_bulkz RawAnnotationsClient.delete_bulk   s   * ((55==*"
  2 , > 
	"	ti++1c11"; ) 0 $YUCC$$+% !2!23

&"(**$-NN$4	 	 $$+$ !2!23

&"(**$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AF= D F= =?G<bulk_createdcompleted_bydraft_created_atground_truth	import_idlast_actionlast_created_by	lead_timeparent_annotationparent_predictionr&   resultselected_itemstasktasks	unique_id
updated_bywas_cancelledr$   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   c                   | j                   j                  j                  ddi d|d|d|d|d|d|d	|d
|d|	d|
d|d|dt        |t        j
                  t           d      d|d|d|d|d|iddi|t              }	 d|j                  cxk  rdk  rin nft	        j                  t        j                  t           t        t        j                  t           |j                                     }t        ||      S |j                         }t!        |j                  t#        |j$                        |      # t        $ r6 t!        |j                  t#        |j$                        |j&                        w xY w)a	  
        Create multiple annotations at once

        Parameters
        ----------
        bulk_created : typing.Optional[bool]
            Annotation was created in bulk mode

        completed_by : typing.Optional[int]

        draft_created_at : typing.Optional[dt.datetime]
            Draft creation time

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth (ground_truth)

        import_id : typing.Optional[int]
            Original annotation ID that was at the import step or NULL if this annotation wasn't imported

        last_action : typing.Optional[LastActionEnum]
            Action which was performed in the last annotation history item

            * `prediction` - Created from prediction
            * `propagated_annotation` - Created from another annotation
            * `imported` - Imported
            * `submitted` - Submitted
            * `updated` - Updated
            * `skipped` - Skipped
            * `accepted` - Accepted
            * `rejected` - Rejected
            * `fixed_and_accepted` - Fixed and accepted
            * `deleted_review` - Deleted review

        last_created_by : typing.Optional[int]
            User who created the last annotation history item

        lead_time : typing.Optional[float]
            How much time it took to annotate the task

        parent_annotation : typing.Optional[int]
            Points to the parent annotation from which this annotation was created

        parent_prediction : typing.Optional[int]
            Points to the prediction from which this annotation was created

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            List of annotation results for the task

        selected_items : typing.Optional[SelectedItemsRequest]

        task : typing.Optional[int]
            Corresponding task for this annotation

        tasks : typing.Optional[typing.Sequence[int]]

        unique_id : typing.Optional[str]

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        HttpResponse[typing.List[CreateBulkAnnotationsResponseItem]]
            Bulk annotations created successfully
        api/annotations/bulk/r*   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r&   rY   rZ   writer7   
annotation	directionr[   r\   r]   r^   r_   r,   r-   r.   r3   r4   r5   r8   r?   )r   rA   rB   r   rD   Optionalr   rC   r@   rE   Listr   r   r0   r	   r   r   rF   r1   rH   r   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r&   rY   rZ   r[   r\   r]   r^   r_   r$   rJ   rK   rL   s                          r   create_bulkz RawAnnotationsClient.create_bulke   s    B ((55==# #$4 	
 Y { "? Y $%6 $%6 7 & !"I*vG[7\ho#  !" #$ Y%& j'(  ).  2 ,; > 
	>	ti++1c1KK AB"$kk*KL ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   A=E 	E ?Fidc                    | j                   j                  j                  dt        |       dd|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                         }t        |j                  t        |j                        |	      # t        $ r6 t        |j                  t        |j                        |j                  	      w xY w)
a]  
        Retrieve a specific annotation for a task using the annotation result ID.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        HttpResponse[Annotation]
            Retrieved annotation
        api/annotations//GETr/   r$   r3   r4   r5   r8   r?   )r   rA   rB   r
   r@   rD   rE   r   r   r0   r	   r   r   rF   r1   rH   r   rj   r$   rJ   rK   rL   s         r   getzRawAnnotationsClient.get   s      ((55==/34A6+ > 
	
	ti++1c1"( ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AC C ?Dc                   | j                   j                  j                  dt        |       dd|      }	 d|j                  cxk  rdk  rn nt        |d      S |j                         }t        |j                  t        |j                        |	      # t        $ r6 t        |j                  t        |j                        |j                  	      w xY w)
a  
        Delete an annotation. This action can't be undone!

        Parameters
        ----------
        id : int

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

        Returns
        -------
        HttpResponse[None]
        rl   rm   DELETEro   r3   r4   Nr8   r?   )r   rA   rB   r
   r@   r	   r0   r   r   rF   r1   rH   r   rj   r$   rJ   rL   s        r   deletezRawAnnotationsClient.delete  s     ((55==/34A6+ > 
	
	ti++1c1#YTBB&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   $B B ?C	rP   rR   rV   r&   rY   r[   r^   r_   r$   c       	         D   | j                   j                  j                  dt        |       dd||||||||	dddi|
t              }	 d|j
                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                         }t        |j
                  t        |j                        |      # t        $ r6 t        |j
                  t        |j                        |j                         w xY w)a  
        Update existing attributes on an annotation.

        Parameters
        ----------
        id : int

        completed_by : typing.Optional[int]
            User ID of the person who created this annotation

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth

        lead_time : typing.Optional[float]
            How much time it took to annotate the task (in seconds)

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)

        task : typing.Optional[int]
            Corresponding task for this annotation

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        HttpResponse[Annotation]
            Updated annotation
        rl   rm   PATCHrP   rR   rV   r&   rY   r[   r^   r_   r,   r-   r.   r3   r4   r5   r8   r?   r   rA   rB   r
   rC   r@   rD   rE   r   r   r0   r	   r   r   rF   r1   rH   r   rj   rP   rR   rV   r&   rY   r[   r^   r_   r$   rJ   rK   rL   s                 r   updatezRawAnnotationsClient.update4  s%   j ((55==/34A6 , ,&" (!.	  2 ,# > 
	&	ti++1c1"( ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	t   	AC  %C   ?Dorderingr$   r   c                j   | j                   j                  j                  dt        |       ddd|i|      }	 d|j                  cxk  rdk  rin nft        j                  t
        j                  t           t        t
        j                  t           |j                                     }t        ||	      S |j                         }t        |j                  t        |j                        |
      # t        $ r6 t        |j                  t        |j                        |j                   
      w xY w)a  
        List all annotations for a task.

        Parameters
        ----------
        id : int
            Task ID

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        HttpResponse[typing.List[Annotation]]
            Annotation
        
api/tasks//annotations/rn   r   r/   paramsr$   r3   r4   r5   r8   r?   )r   rA   rB   r
   r@   rD   rE   rg   r   r   r0   r	   r   r   rF   r1   rH   r   rj   r   r$   rJ   rK   rL   s          r   listzRawAnnotationsClient.list  s   , ((55==)"-.m<H , > 
		ti++1c1KK
+"$kk*5 ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   A=C3 8C3 3?D2c       	         D   | j                   j                  j                  dt        |       dd||||||||	dddi|
t              }	 d|j
                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                         }t        |j
                  t        |j                        |      # t        $ r6 t        |j
                  t        |j                        |j                         w xY w)a  

                Add annotations to a task like an annotator does. The content of the result field depends on your
                labeling configuration. For example, send the following data as part of your POST
                request to send an empty annotation with the ID of the user who completed the task:

                ```json
                {
                "result": {},
                "was_cancelled": true,
                "ground_truth": true,
                "lead_time": 0,
                "task": 0
                "completed_by": 123
                }
                ```


        Parameters
        ----------
        id : int
            Task ID

        completed_by : typing.Optional[int]
            User ID of the person who created this annotation

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth

        lead_time : typing.Optional[float]
            How much time it took to annotate the task (in seconds)

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)

        task : typing.Optional[int]
            Corresponding task for this annotation

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        HttpResponse[Annotation]
            Created annotation
        r   r   r*   ry   r,   r-   r.   r3   r4   r5   r8   r?   rz   r{   s                 r   createzRawAnnotationsClient.create  s%   J ((55==)"-.m< , ,&" (!.	  2 ,# > 
	&	ti++1c1"( ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	tr}   ) __name__
__module____qualname__r   r    rD   Sequenceintrf   r   r	   r   rM   rC   booldtdatetimer   floatDictstrrG   r   rg   r   ri   r   rq   ru   r|   r   r    r"   r   r   r      sd   .*; . nrEpooc*Ep58EpKQ??[iKjEp	3	4EpT /3-19=.2*.7;04,02626(,QU@D%)7;*.+//3;?+Mp ood+Mp ooc*	Mp
 !//"++6Mp ood+Mp ??3'Mp __^4Mp  -Mp ??5)Mp "??3/Mp "??3/Mp %Mp CO0L MNMp (<=Mp  ooc"!Mp" vs34#Mp$ ??3'%Mp& OOC('Mp( t,)Mp*  8+Mp, 
fkk"CD	E-Mp^ RV "pc "pv~/N "pZfgqZr "pH UY p p&//.2Q p]ijn]o p@ .2.2,0(,QU%)+//3;?UpUp ooc*	Up
 ood+Up ??5)Up %Up CO0L MNUp ooc"Up OOC(Up t,Up  8Up 
j	!Upp <@tx+p+p$*OOC$8+pRXRaRabpRq+p	fkk*-	.+pb .2.2,0(,QU%)+//3;?epep ooc*	ep
 ood+ep ??5)ep %ep CO0L MNep ooc"ep OOC(ep t,ep  8ep 
j	!epr"   r   c            +       n   e Zd ZdefdZdddej                  e   dedej                  e	   de
e   fd	Zeeeeeeeeeeeeeeeeeedd
dej                  e   dej                  e   dej                  ej                      dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  ej                  e      dej                  e   dej                  e   dej                  e   dej                  e	   de
ej.                  e      f(dZdddedej                  e	   de
e   fdZdddedej                  e	   de
d   fdZeeeeeeeedd 	dedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  e   dej                  e	   de
e   fd!Zddd"ded#ej                  e   dej                  e	   de
ej.                  e      fd$Zeeeeeeeedd 	dedej                  e   dej                  e   dej                  e   dej                  e   dej                  ej                  ej&                  eej*                  f         dej                  e   dej                  e   dej                  e   dej                  e	   de
e   fd%Zy)&AsyncRawAnnotationsClientr   c                    || _         y r   r   r   s     r   r    z"AsyncRawAnnotationsClient.__init__!  r!   r"   Nr#   r%   r&   r$   r'   c                  K   | j                   j                  j                  dd||dddi|t               d{   }	 d|j                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         
                  |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         
                  |j                         }t#        |j                  t        |j                        |      7 # t         $ r6 t#        |j                  t        |j                        |j$                        w xY ww)a  
        Delete multiple annotations by their IDs. The deletion is processed synchronously. Returns the count of deleted annotations in the response.

        Parameters
        ----------
        ids : typing.Sequence[int]
            List of annotation IDs to delete

        project : int

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

        Returns
        -------
        AsyncHttpResponse[DeleteBulkAnnotationsResponse]
            Annotations deleted successfully
        r)   r*   r+   r,   r-   r.   Nr3   r4   r5   r8   r;   r<   r>   r?   )r   rA   rB   rC   r@   rD   rE   r   r   r0   r   r   rF   r1   rG   r   r   r   rH   rI   s          r   rM   z%AsyncRawAnnotationsClient.delete_bulk$  s    * ..;;CC*"
  2 , D 
 
	"	ti++1c11"; ) 0 ))%HH$$+% !2!23

&"(**$-NN$4	 	 $$+$ !2!23

&"(**$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooa
\  	ty'<'<d9K\K\F]dmdrdrss	ts5   8HGH AG
 HD G
 ,H
?H		HrN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   c                (  K   | j                   j                  j                  ddi d|d|d|d|d|d|d	|d
|d|	d|
d|d|dt        |t        j
                  t           d      d|d|d|d|d|iddi|t               d{   }	 d|j                  cxk  rdk  rin nft	        j                  t        j                  t           t        t        j                  t           |j                                     }t        ||      S |j                         }t!        |j                  t#        |j$                        |      7 # t        $ r6 t!        |j                  t#        |j$                        |j&                        w xY ww) a	  
        Create multiple annotations at once

        Parameters
        ----------
        bulk_created : typing.Optional[bool]
            Annotation was created in bulk mode

        completed_by : typing.Optional[int]

        draft_created_at : typing.Optional[dt.datetime]
            Draft creation time

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth (ground_truth)

        import_id : typing.Optional[int]
            Original annotation ID that was at the import step or NULL if this annotation wasn't imported

        last_action : typing.Optional[LastActionEnum]
            Action which was performed in the last annotation history item

            * `prediction` - Created from prediction
            * `propagated_annotation` - Created from another annotation
            * `imported` - Imported
            * `submitted` - Submitted
            * `updated` - Updated
            * `skipped` - Skipped
            * `accepted` - Accepted
            * `rejected` - Rejected
            * `fixed_and_accepted` - Fixed and accepted
            * `deleted_review` - Deleted review

        last_created_by : typing.Optional[int]
            User who created the last annotation history item

        lead_time : typing.Optional[float]
            How much time it took to annotate the task

        parent_annotation : typing.Optional[int]
            Points to the parent annotation from which this annotation was created

        parent_prediction : typing.Optional[int]
            Points to the prediction from which this annotation was created

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            List of annotation results for the task

        selected_items : typing.Optional[SelectedItemsRequest]

        task : typing.Optional[int]
            Corresponding task for this annotation

        tasks : typing.Optional[typing.Sequence[int]]

        unique_id : typing.Optional[str]

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        AsyncHttpResponse[typing.List[CreateBulkAnnotationsResponseItem]]
            Bulk annotations created successfully
        ra   r*   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r&   rY   rZ   rb   rc   r[   r\   r]   r^   r_   r,   r-   r.   Nr3   r4   r5   r8   r?   )r   rA   rB   r   rD   rf   r   rC   r@   rE   rg   r   r   r0   r   r   r   rF   r1   rH   rh   s                          r   ri   z%AsyncRawAnnotationsClient.create_bulkk  s    B ..;;CC# #$4 	
 Y { "? Y $%6 $%6 7 & !"I*vG[7\ho#  !" #$ Y%& j'(  ).  2 ,; D 
 
	>	ti++1c1KK AB"$kk*KL ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`nooY
T  	ty'<'<d9K\K\F]dmdrdrss	ts7   BFEFA=E FE #,F?FFrj   c                <  K   | j                   j                  j                  dt        |       dd|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||	      S |j                         }t        |j                  t        |j                        |
      7 # t        $ r6 t        |j                  t        |j                        |j                  
      w xY ww)ab  
        Retrieve a specific annotation for a task using the annotation result ID.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        AsyncHttpResponse[Annotation]
            Retrieved annotation
        rl   rm   rn   ro   Nr3   r4   r5   r8   r?   )r   rA   rB   r
   r@   rD   rE   r   r   r0   r   r   r   rF   r1   rH   rp   s         r   rq   zAsyncRawAnnotationsClient.get  s    $ ..;;CC/34A6+ D 
 
	
	ti++1c1"( ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo%
   	ty'<'<d9K\K\F]dmdrdrss	ts4   9DCDAC DC -,D?DDc                  K   | j                   j                  j                  dt        |       dd|       d{   }	 d|j                  cxk  rdk  rn nt        |d      S |j                         }t        |j                  t        |j                        |	      7 e# t        $ r6 t        |j                  t        |j                        |j                  	      w xY ww)
a$  
        Delete an annotation. This action can't be undone!

        Parameters
        ----------
        id : int

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

        Returns
        -------
        AsyncHttpResponse[None]
        rl   rm   rs   ro   Nr3   r4   r8   r?   )r   rA   rB   r
   r@   r   r0   r   r   rF   r1   rH   rt   s        r   ru   z AsyncRawAnnotationsClient.delete   s     " ..;;CC/34A6+ D 
 
	
	ti++1c1()$GG&^^-N 9#8#8$yGXGXBY`noo
  	ty'<'<d9K\K\F]dmdrdrss	ts3   9C%B!C%$B# %C%&B# 6,C%#?C""C%rv   c       	         `  K   | j                   j                  j                  dt        |       dd||||||||	dddi|
t               d{   }	 d	|j
                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                         }t        |j
                  t        |j                        |      7 # t        $ r6 t        |j
                  t        |j                        |j                         w xY ww)a  
        Update existing attributes on an annotation.

        Parameters
        ----------
        id : int

        completed_by : typing.Optional[int]
            User ID of the person who created this annotation

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth

        lead_time : typing.Optional[float]
            How much time it took to annotate the task (in seconds)

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)

        task : typing.Optional[int]
            Corresponding task for this annotation

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        AsyncHttpResponse[Annotation]
            Updated annotation
        rl   rm   rx   ry   r,   r-   r.   Nr3   r4   r5   r8   r?   r   rA   rB   r
   rC   r@   rD   rE   r   r   r0   r   r   r   rF   r1   rH   r{   s                 r   r|   z AsyncRawAnnotationsClient.update>  s4    j ..;;CC/34A6 , ,&" (!.	  2 ,# D 
 
	&	ti++1c1"( ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`nooA
<  	ty'<'<d9K\K\F]dmdrdrss	t7   AD.C*D.AC, .D./C, ?,D.,?D++D.r~   r   c                  K   | j                   j                  j                  dt        |       ddd|i|       d{   }	 d|j                  cxk  rdk  rin nft        j                  t
        j                  t           t        t
        j                  t           |j                         	            }t        ||
      S |j                         }t        |j                  t        |j                        |      7 # t        $ r6 t        |j                  t        |j                        |j                         w xY ww)a  
        List all annotations for a task.

        Parameters
        ----------
        id : int
            Task ID

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        AsyncHttpResponse[typing.List[Annotation]]
            Annotation
        r   r   rn   r   r   Nr3   r4   r5   r8   r?   )r   rA   rB   r
   r@   rD   rE   rg   r   r   r0   r   r   r   rF   r1   rH   r   s          r   r   zAsyncRawAnnotationsClient.list  s!    , ..;;CC)"-.m<H , D 
 
		ti++1c1KK
+"$kk*5 ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo+
&  	ty'<'<d9K\K\F]dmdrdrss	ts4   <EC=EA=C? EC? ,E??D>>Ec       	         `  K   | j                   j                  j                  dt        |       dd||||||||	dddi|
t               d{   }	 d	|j
                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                         }t        |j
                  t        |j                        |      7 # t        $ r6 t        |j
                  t        |j                        |j                         w xY ww)a  

                Add annotations to a task like an annotator does. The content of the result field depends on your
                labeling configuration. For example, send the following data as part of your POST
                request to send an empty annotation with the ID of the user who completed the task:

                ```json
                {
                "result": {},
                "was_cancelled": true,
                "ground_truth": true,
                "lead_time": 0,
                "task": 0
                "completed_by": 123
                }
                ```


        Parameters
        ----------
        id : int
            Task ID

        completed_by : typing.Optional[int]
            User ID of the person who created this annotation

        ground_truth : typing.Optional[bool]
            This annotation is a Ground Truth

        lead_time : typing.Optional[float]
            How much time it took to annotate the task (in seconds)

        project : typing.Optional[int]
            Project ID for this annotation

        result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Any]]]
            Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)

        task : typing.Optional[int]
            Corresponding task for this annotation

        updated_by : typing.Optional[int]
            Last user who updated this annotation

        was_cancelled : typing.Optional[bool]
            User skipped the task

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

        Returns
        -------
        AsyncHttpResponse[Annotation]
            Created annotation
        r   r   r*   ry   r,   r-   r.   Nr3   r4   r5   r8   r?   r   r{   s                 r   r   z AsyncRawAnnotationsClient.create  s4    J ..;;CC)"-.m< , ,&" (!.	  2 ,# D 
 
	&	ti++1c1"( ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`nooA
<  	ty'<'<d9K\K\F]dmdrdrss	tr   ) r   r   r   r   r    rD   r   r   rf   r   r   r   rM   rC   r   r   r   r   r   r   r   rG   r   rg   r   ri   r   rq   ru   r|   r   r   r   r"   r   r   r      sf   .*< . nrEpooc*Ep58EpKQ??[iKjEp	8	9EpT /3-19=.2*.7;04,02626(,QU@D%)7;*.+//3;?+Mp ood+Mp ooc*	Mp
 !//"++6Mp ood+Mp ??3'Mp __^4Mp  -Mp ??5)Mp "??3/Mp "??3/Mp %Mp CO0L MNMp (<=Mp  ooc"!Mp" vs34#Mp$ ??3'%Mp& OOC('Mp( t,)Mp*  8+Mp, 
6;;'HI	J-Mp` NR$p$p+1??>+J$p	:	&$pN NRpp+1??>+Jp	4	 pD .2.2,0(,QU%)+//3;?UpUp ooc*	Up
 ood+Up ??5)Up %Up CO0L MNUp ooc"Up OOC(Up t,Up  8Up 
:	&Upp <@tx+p+p$*OOC$8+pRXRaRabpRq+p	6;;z2	3+pb .2.2,0(,QU%)+//3;?epep ooc*	ep
 ood+ep ??5)ep %ep CO0L MNep ooc"ep OOC(ep t,ep  8ep 
:	&epr"   r   )(r   r   rD   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.serializationr   core.unchecked_base_modelr   errors.bad_request_errorr   errors.forbidden_errorr   types.annotationr   types.last_action_enumr   types.selected_items_requestr   +types.create_bulk_annotations_response_itemr   &types.delete_bulk_annotations_responser   rE   rG   rC   r   r   r   r"   r   <module>r      so      ( % G @ 4 1 H 6 6 3 ) 3 ? Z Q v{{6::s#Cp CpLGp Gpr"   