
    _j6                        S SK Jr  S SKJrJrJrJrJrJrJ	r	  SSK
JrJrJrJrJrJrJr  SSKJr  SSKJr   " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      rg)    )annotations)OptionalDictAnyUnionIteratorAsyncIteratorList   )CreateWebhookParametersWebhookListWebhooksResponseUpdateWebhookParametersListWebhookAttemptsResponseWebhookAttempt	EventType)WebsetsBaseClient)WebsetsAsyncBaseClientc                  R   ^  \ rS rSrSrU 4S jrSSSSS.       SS jjrSrU =r$ )	WebhookAttemptsClient   z%Client for managing Webhook Attempts.c                $   > [         TU ]  U5        g Nsuper__init__selfclient	__class__s     S/home/rurouni/.local/lib/python3.13/site-packages/exa_py/websets/webhooks/client.pyr   WebhookAttemptsClient.__init__            Ncursorlimit
event_type
successfulc                  SnUb$  [        U[        5      (       a  UR                  nOUnUUUUS.R                  5        VVs0 s H  u  pxUc  M
  Xx_M     n	nnU R	                  SU S3U	SS9n
[
        R                  " U
5      $ s  snnf )a  List all attempts made by a Webhook ordered in descending order.

Args:
    webhook_id (str): The ID of the webhook.
    cursor (str, optional): The cursor to paginate through the results.
    limit (int, optional): The number of results to return (max 200).
    event_type (Union[EventType, str], optional): The type of event to filter by.
    successful (bool, optional): Filter attempts by success status.

Returns:
    ListWebhookAttemptsResponse: List of webhook attempts.
Nr&   r'   	eventTyper)   /v0/webhooks/	/attemptsGETparamsmethod
isinstancer   valueitemsrequestr   model_validater   
webhook_idr&   r'   r(   r)   event_type_valuekvr1   responses              r!   listWebhookAttemptsClient.list   s      !*i00#-#3#3 #-  )$	$

 %'$ $ $41
  !$ $ $ <<-
|9 Ef]b<c*99(CC$s   	BB r:   strr&   Optional[str]r'   Optional[int]r(   Optional[Union[EventType, str]]r)   Optional[bool]returnr   	__name__
__module____qualname____firstlineno____doc__r   r?   __static_attributes____classcell__r    s   @r!   r   r      sK    /! @D$(X\*.D!D6UD'D3ND Dr$   r   c                     ^  \ rS rSrSrU 4S jrSS jrSS jrSSS.SS jjrSS	 jr	SS
 jr
SS.SS jjrSS.SS jjrSSSS.         SS jjrSSSS.         SS jjrSrU =r$ )WebsetWebhooksClient7   z$Client for managing Webset Webhooks.c                D   > [         TU ]  U5        [        U5      U l        g r   )r   r   r   attemptsr   s     r!   r   WebsetWebhooksClient.__init__:   s     -f5r$   c                N    U R                  SUS9n[        R                  " U5      $ )zCreate a Webhook.

Args:
    params (CreateWebhookParameters): The parameters for creating a webhook.

Returns:
    Webhook: The created webhook.
/v0/webhooksdatar7   r   r8   r   r1   r>   s      r!   createWebsetWebhooksClient.create>   s'     <<V<<%%h//r$   c                T    U R                  SU 3SS9n[        R                  " U5      $ )zoGet a Webhook by ID.

Args:
    id (str): The id of the webhook.

Returns:
    Webhook: The retrieved webhook.
r-   r/   r2   r\   r   idr>   s      r!   getWebsetWebhooksClient.getJ   s.     <<-t 4U<C%%h//r$   Nr&   r'   c                   XS.R                  5        VVs0 s H  u  p4Uc  M
  X4_M     nnnU R                  SUSS9n[        R                  " U5      $ s  snnf )zList all Webhooks.

Args:
    cursor (str, optional): The cursor to paginate through the results.
    limit (int, optional): The number of results to return (max 200).

Returns:
    ListWebhooksResponse: List of webhooks.
rf   rY   r/   r0   r6   r7   r   r8   r   r&   r'   r<   r=   r1   r>   s          r!   r?   WebsetWebhooksClient.listV   sZ     /5#E#K#K#M_#M41QR$!$#M_<<ve<L#228<< `s
   	AAc                V    U R                  SU 3USS9n[        R                  " U5      $ )zUpdate a Webhook.

Args:
    id (str): The id of the webhook.
    params (UpdateWebhookParameters): The parameters for updating a webhook.

Returns:
    Webhook: The updated webhook.
r-   PATCHr[   r2   r\   r   rc   r1   r>   s       r!   updateWebsetWebhooksClient.updated   s0     <<-t 46'<R%%h//r$   c                T    U R                  SU 3SS9n[        R                  " U5      $ )zjDelete a Webhook.

Args:
    id (str): The id of the webhook.

Returns:
    Webhook: The deleted webhook.
r-   DELETEra   r\   rb   s      r!   deleteWebsetWebhooksClient.deleteq   s.     <<-t 4X<F%%h//r$   r'   c             #     #    Sn U R                  X!S9nUR                   H  nUv   M	     UR                  (       a  UR                  (       d  gUR                  nMW  7fzIterate through all Webhooks, handling pagination automatically.

Args:
    limit (int, optional): The number of results to return per page (max 200).
    
Yields:
    Webhook: Each webhook.
Nrf   r?   r[   has_morenext_cursorr   r'   r&   r>   webhooks        r!   list_allWebsetWebhooksClient.list_all}   sX      yyy<H#== ) $$H,@,@))F s   AAc               2    [        U R                  US95      $ )Collect all Webhooks into a list.

Args:
    limit (int, optional): The number of results to return per page (max 200).
    
Returns:
    List[Webhook]: All webhooks.
ru   )r?   r}   )r   r'   s     r!   get_allWebsetWebhooksClient.get_all   s     DMMM.//r$   r'   r(   r)   c             #     #    Sn U R                   R                  UUUUUS9nUR                   H  nUv   M	     UR                  (       a  UR                  (       d  gUR                  nMe  7fa  Iterate through all attempts for a Webhook, handling pagination automatically.

Args:
    webhook_id (str): The ID of the webhook.
    limit (int, optional): The number of results to return per page (max 200).
    event_type (Union[EventType, str], optional): The type of event to filter by.
    successful (bool, optional): Filter attempts by success status.
    
Yields:
    WebhookAttempt: Each webhook attempt.
Nr%   rV   r?   r[   ry   rz   r   r:   r'   r(   r)   r&   r>   attempts           r!   list_all_attempts&WebsetWebhooksClient.list_all_attempts   sr     & }}))%% * H $== ) $$H,@,@))F s   A)A+c          	     8    [        U R                  UUUUS95      $ )  Collect all attempts for a Webhook into a list.

Args:
    webhook_id (str): The ID of the webhook.
    limit (int, optional): The number of results to return per page (max 200).
    event_type (Union[EventType, str], optional): The type of event to filter by.
    successful (bool, optional): Filter attempts by success status.
    
Returns:
    List[WebhookAttempt]: All webhook attempts.
r   )r?   r   )r   r:   r'   r(   r)   s        r!   get_all_attempts%WebsetWebhooksClient.get_all_attempts   s/    & D**!!	 + 
  	r$   rV   r1   z.Union[Dict[str, Any], CreateWebhookParameters]rH   r   rc   rC   rH   r   r&   rD   r'   rE   rH   r   rc   rC   r1   z.Union[Dict[str, Any], UpdateWebhookParameters]rH   r   )r'   rE   rH   zIterator[Webhook]r'   rE   rH   zList[Webhook])
r:   rC   r'   rE   r(   rF   r)   rG   rH   zIterator[WebhookAttempt]
r:   rC   r'   rE   r(   rF   r)   rG   rH   zList[WebhookAttempt]rJ   rK   rL   rM   rN   r   r^   rd   r?   ro   rs   r}   r   r   r   rO   rP   rQ   s   @r!   rS   rS   7   s    .6
0
0 /34 =0
0 26 *( 15 	0  $6:%)"*"* 	"*
 4"* #"* 
""*P  $6:%) 	
 4 # 
 r$   rS   c                  R   ^  \ rS rSrSrU 4S jrSSSSS.       SS jjrSrU =r$ )	AsyncWebhookAttemptsClient   z+Async client for managing Webhook Attempts.c                $   > [         TU ]  U5        g r   r   r   s     r!   r   #AsyncWebhookAttemptsClient.__init__   r#   r$   Nr%   c               .  #    SnUb$  [        U[        5      (       a  UR                  nOUnUUUUS.R                  5        VVs0 s H  u  pxUc  M
  Xx_M     n	nnU R	                  SU S3U	SS9I Sh  vN n
[
        R                  " U
5      $ s  snnf  N 7f)z@List all attempts made by a Webhook ordered in descending order.Nr+   r-   r.   r/   r0   r3   r9   s              r!   r?   AsyncWebhookAttemptsClient.list   s       !*i00#-#3#3 #-  )$	$

 %'$ $ $41
  !$ $ $ j\&KTZchii*99(CC$ js$   AB	BBB2B3!BrA   rB   rI   rQ   s   @r!   r   r      sK    5! FJ$(X\*.D!D6UD'D3ND Dr$   r   c                     ^  \ rS rSrSrU 4S jrSS jrSS jrSSS.SS jjrSS	 jr	SS
 jr
SS.SS jjrSS.SS jjrSSSS.         SS jjrSSSS.         SS jjrSrU =r$ )AsyncWebsetWebhooksClient   z*Async client for managing Webset Webhooks.c                D   > [         TU ]  U5        [        U5      U l        g r   )r   r   r   rV   r   s     r!   r   "AsyncWebsetWebhooksClient.__init__   s     26:r$   c                j   #    U R                  SUS9I Sh  vN n[        R                  " U5      $  N7f)zCreate a Webhook.rY   rZ   Nr\   r]   s      r!   r^    AsyncWebsetWebhooksClient.create   s1     n6BB%%h// Cs   313c                p   #    U R                  SU 3SS9I Sh  vN n[        R                  " U5      $  N7f)zGet a Webhook by ID.r-   r/   ra   Nr\   rb   s      r!   rd   AsyncWebsetWebhooksClient.get  s8     bT&:5II%%h// J   646Nrf   c                  #    XS.R                  5        VVs0 s H  u  p4Uc  M
  X4_M     nnnU R                  SUSS9I Sh  vN n[        R                  " U5      $ s  snnf  N 7f)zList all Webhooks.rf   NrY   r/   r0   rh   ri   s          r!   r?   AsyncWebsetWebhooksClient.list  sa     .4#E#K#K#M_#M41QR$!$#M_nVERR#228<< `Rs    A%	AAA%A#!A%c                r   #    U R                  SU 3USS9I Sh  vN n[        R                  " U5      $  N7f)zUpdate a Webhook.r-   rl   rm   Nr\   rn   s       r!   ro    AsyncWebsetWebhooksClient.update  s;     bT&:PWXX%%h// Ys   757c                p   #    U R                  SU 3SS9I Sh  vN n[        R                  " U5      $  N7f)zDelete a Webhook.r-   rr   ra   Nr\   rb   s      r!   rs    AsyncWebsetWebhooksClient.delete  s8     bT&:8LL%%h// Mr   ru   c                 #    Sn U R                  X!S9I Sh  vN nUR                   H  nU7v   M
     UR                  (       a  UR                  (       d  gUR                  nM`   NM7frw   rx   r{   s        r!   r}   "AsyncWebsetWebhooksClient.list_all  s^      !YYfYBBH#== ) $$H,@,@))F Bs   A(A&AA(c               n   #    / nU R                  US9  Sh  vN nUR                  U5        M   N
 U$ 7f)r   ru   N)r}   append)r   r'   webhooksr|   s       r!   r   !AsyncWebsetWebhooksClient.get_all+  s:      !]]]7 	%'OOG$	%7s   5202525r   c                 #    Sn U R                   R                  UUUUUS9I Sh  vN nUR                   H  nU7v   M
     UR                  (       a  UR                  (       d  gUR                  nMn   NM7fr   r   r   s           r!   r   +AsyncWebsetWebhooksClient.list_all_attempts9  s|     & !]]//%% 0  H $== ) $$H,@,@))F s   $A6A4AA6c               t   #    / nU R                  UUUUS9  Sh  vN nUR                  U5        M   N
 U$ 7f)r   r   N)r   r   )r   r:   r'   r(   r)   rV   r   s          r!   r   *AsyncWebsetWebhooksClient.get_all_attempts]  sQ     & !33!!	 4 
 	%' OOG$	% 
 s   8535858r   r   r   r   r   )r'   rE   rH   zAsyncIterator[Webhook]r   )
r:   rC   r'   rE   r(   rF   r)   rG   rH   zAsyncIterator[WebhookAttempt]r   r   rQ   s   @r!   r   r      s    4;0
0
 59QU =0
0
 8< *( 7; $  $6:%)"*"* 	"*
 4"* #"* 
'"*P  $6:%) 	
 4 # 
 r$   r   N)
__future__r   typingr   r   r   r   r   r	   r
   typesr   r   r   r   r   r   r   	core.baser   core.async_baser   r   rS   r   r   rA   r$   r!   <module>r      sf    " L L L   * 4$D- $DLa, aHD!7 D6B 6 Br$   