
    _j                       S SK Jr  S SKJrJrJr  S SKJr  S SKrSSK	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Jr  SSKJrJrJr  SS	KJr  SS
KJrJr  SSK J!r!J"r"J#r#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SS/r1 " S S\5      r2 " S S\5      r3 " S S5      r4 " S S5      r5 " S S5      r6 " S S5      r7g)    )annotations)DictListOptional)LiteralN   )monitor_list_paramsmonitor_create_paramsmonitor_events_paramsmonitor_update_params)BodyOmitQueryHeadersNoneTypeNotGivenomit	not_given)path_templatemaybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)make_request_options)Monitor)MonitorWebhookParam)PaginatedMonitorEvents)PaginatedMonitorResponse)%UpdateMonitorEventStreamSettingsParamMonitorResourceAsyncMonitorResourcec            
         \ rS rSrSr\SS j5       r\SS j5       r\\\SS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S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SS\	S.           SS jjrSrg)r%   $     The Monitor API watches the web for material changes on a fixed frequency.

Each monitor runs once on creation and then on its configured schedule, emitting events when meaningful changes are detected.
- `event_stream` monitors track a search query and emit an event for each new material change.
- `snapshot` monitors track a specific task run's output and emit an event when the output changes.

Results can be polled via the events endpoint or delivered via webhooks.
c                    [        U 5      $ z
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/parallel-web/parallel-sdk-python#accessing-raw-response-data-eg-headers
)MonitorResourceWithRawResponseselfs    O/home/rurouni/.local/lib/python3.13/site-packages/parallel/resources/monitor.pywith_raw_response!MonitorResource.with_raw_response.   s     .d33    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/parallel-web/parallel-sdk-python#with_streaming_response
)$MonitorResourceWithStreamingResponser-   s    r/   with_streaming_response'MonitorResource.with_streaming_response8   s     4D99r2   Nmetadata	processorwebhookextra_headersextra_query
extra_bodytimeoutc       
        |    U R                  S[        UUUUUUS.[        R                  5      [	        XxXS9[
        S9$ )M  
Create a monitor.

Monitors run on a fixed frequency to detect material changes in web content. Set
`type=event_stream` to monitor a search query, or `type=snapshot` to monitor a
specific task run's output. The monitor runs once immediately at creation, then
continues on the configured schedule.

Args:
  frequency: Frequency of the monitor. Format: '<number><unit>' where unit is 'h' (hours),
      'd' (days), or 'w' (weeks). Must be between 1h and 30d (inclusive).

  settings: Type-specific settings for the monitor. The expected shape is determined by the
      root `type` field: pass `MonitorEventStreamSettings` when `type` is
      `event_stream`, and `MonitorSnapshotSettings` when `type` is `snapshot`.

  type: Type of monitor to create. `event_stream` monitors a search query for material
      changes; `snapshot` monitors a specific task run's output. Determines the
      expected shape of `settings`.

  metadata: User-provided metadata stored with the monitor and echoed back in webhook
      notifications and GET responses, so you can map events to objects in your
      application. Keys: max 16 chars; values: max 512 chars.

  processor: Processor to use for the monitor. `lite` is faster and cheaper; `base` performs
      more thorough analysis at higher cost and latency. Defaults to `lite`.

  webhook: Webhook configuration for a monitor.

  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
/v1/monitors	frequencysettingstyper9   r:   r;   r<   r=   r>   r?   bodyoptionscast_to)_postr   r
   MonitorCreateParamsr   r    r.   rD   rE   rF   r9   r:   r;   r<   r=   r>   r?   s              r/   createMonitorResource.createA   s]    j zz !* (  (!*& &99
 )+Q[ !  
 	
r2   rG   c          
     x    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9$ )  Retrieve a monitor.

Retrieves a specific monitor by `monitor_id`.

Returns the monitor configuration
including status, frequency, query, and webhook settings.

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
9Expected a non-empty value for `monitor_id` but received /v1/monitors/{monitor_id}
monitor_idrG   rJ   rK   
ValueError_getr   r   r    r.   rV   r<   r=   r>   r?   s         r/   retrieveMonitorResource.retrieve   sP    6 XYcXfghhyy5*M(+Q[   
 	
r2   	rD   r9   rE   rF   r;   r<   r=   r>   r?   c       	            U(       d  [        SU< 35      eU R                  [        SUS9[        UUUUUS.[        R
                  5      [        XxXS9[        S9$ )  
Update a monitor.

Only fields explicitly included in the request body are changed. Pass `null` for
`webhook` or `metadata` to clear those fields. Pass `type` and `settings` to
update type-specific settings on an `event_stream` monitor. At least one field
must be provided. Cancelled monitors cannot be updated.

Args:
  frequency: Frequency of the monitor. Format: '<number><unit>' where unit is 'h' (hours),
      'd' (days), or 'w' (weeks). Must be between 1h and 30d (inclusive).

  metadata: User-provided metadata stored with the monitor and echoed back in webhook
      notifications and GET responses, so you can map events to objects in your
      application. Keys: max 16 chars; values: max 512 chars.

  settings: Type-specific update settings for an `event_stream` monitor.

  type: Type of the monitor being updated. Required when `settings` is provided; must be
      `event_stream` (snapshot monitors have no updatable type-specific settings).

  webhook: Webhook configuration for a monitor.

  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
rS    /v1/monitors/{monitor_id}/updaterU   rD   r9   rE   rF   r;   rG   rH   )rY   rL   r   r   r   MonitorUpdateParamsr   r    r.   rV   rD   r9   rE   rF   r;   r<   r=   r>   r?   s              r/   updateMonitorResource.update   sz    ^ XYcXfghhzz<T !* ( ( & &99	 )+Q[   
 	
r2   cursorlimitstatusrF   r<   r=   r>   r?   c               |    U R                  S[        UUUU[        UUUUS.[        R                  5      S9[
        S9$ )  
List monitors ordered by creation time, newest first.

Monitors are sorted by `created_at` descending. `limit` defaults to 100. Use
`next_cursor` from the response and pass it as `cursor` to fetch the next page.
Pagination ends when `next_cursor` is absent.

By default only `active` monitors are returned. Pass `status=cancelled` or both
values to include cancelled monitors.

The legacy Monitor API (`/v1alpha/monitors` endpoints) is documented under the
`Monitor (Alpha)` tag.

Args:
  cursor: Pagination token from `next_cursor` in a previous response. Omit to start from
      the most recently created monitor.

  limit: Maximum number of monitors to return. Defaults to 100. Between 1 and 10000.

  status: Filter by monitor status. Pass multiple times to filter by multiple values.
      Defaults to `active` only.

  type: Filter by monitor type. Pass multiple times to filter by multiple values. Omit
      to return all types.

  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
rB   rh   ri   rj   rF   r<   r=   r>   r?   queryrW   )rZ   r   r   r	   MonitorListParamsr#   	r.   rh   ri   rj   rF   r<   r=   r>   r?   s	            r/   listMonitorResource.list   s[    ^ yy(+'%%"(!&"( $	 (99 -#  
 	
r2   c          
     x    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9$ )  Cancel a monitor.

Permanently stops the monitor from running.

Cancellation is irreversible —
create a new monitor to resume monitoring. Cancelling an already-cancelled
monitor is a no-op.

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
rS    /v1/monitors/{monitor_id}/cancelrU   rG   rW   rY   rL   r   r   r    r[   s         r/   cancelMonitorResource.cancel4  sP    8 XYcXfghhzz<T(+Q[   
 	
r2   rh   event_group_idinclude_completionsri   r<   r=   r>   r?   c                   U(       d  [        SU< 35      eU R                  [        SUS9[        UUUU	[	        UUUUS.[
        R                  5      S9[        S9$ )  
List events for a monitor, newest first.

Pass `event_group_id` to narrow results to a single execution. Otherwise returns
all executions newest-first; use `next_cursor` to paginate. Set
`include_completions=true` to also include no-change executions.

Args:
  cursor: Pass `next_cursor` from a previous response to retrieve more events.

  event_group_id: Filter to a single execution. Values come from `event_group_id` in webhook
      events and listed events. Pagination params are ignored when set.

  include_completions: When true, include completion events for executions that ran but detected no
      material changes. Useful for auditing execution history.

  limit: Maximum number of events to return. Defaults to 20. Between 1 and 100.

  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
rS    /v1/monitors/{monitor_id}/eventsrU   rh   r{   r|   ri   rn   rW   )rY   rZ   r   r   r   r   MonitorEventsParamsr"   
r.   rV   rh   r{   r|   ri   r<   r=   r>   r?   s
             r/   eventsMonitorResource.eventsZ  s{    R XYcXfghhyy<T(+'%%"(*8/B!&	 *== +#  
 	
r2   c          
         U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        X#XES9[        S9$ )  
Trigger an immediate monitor run.

Enqueues a one-off execution of the monitor outside its normal schedule. The
monitor's regular schedule is not affected. An event is only emitted if the
execution detects a material change. Cancelled monitors cannot be triggered.

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
rS   Accept*/*!/v1/monitors/{monitor_id}/triggerrU   rG   rW   rY   rL   r   r   r   r[   s         r/   triggerMonitorResource.trigger  sd    6 XYcXfghh!5B]-@bBzz=*U(+Q[   
 	
r2    )returnr,   )r   r5   rD   strrE   zmonitor_create_params.SettingsrF   z#Literal['event_stream', 'snapshot']r9   Optional[Dict[str, str]] | Omitr:   zLiteral['lite', 'base'] | Omitr;   $Optional[MonitorWebhookParam] | Omitr<   Headers | Noner=   Query | Noner>   Body | Noner?   'float | httpx.Timeout | None | NotGivenr   r    rV   r   r<   r   r=   r   r>   r   r?   r   r   r    rV   r   rD   Optional[str] | Omitr9   r   rE   z6Optional[UpdateMonitorEventStreamSettingsParam] | OmitrF   z4Optional[Literal['event_stream', 'snapshot']] | Omitr;   r   r<   r   r=   r   r>   r   r?   r   r   r    rh   r   ri   Optional[int] | Omitrj   z5Optional[List[Literal['active', 'cancelled']]] | OmitrF   z:Optional[List[Literal['event_stream', 'snapshot']]] | Omitr<   r   r=   r   r>   r   r?   r   r   r#   rV   r   rh   r   r{   r   r|   zbool | Omitri   r   r<   r   r=   r   r>   r   r?   r   r   r"   rV   r   r<   r   r=   r   r>   r   r?   r   r   None__name__
__module____qualname____firstlineno____doc__r   r0   r6   r   r   rO   r\   re   rr   rx   r   r   __static_attributes__r   r2   r/   r%   r%   $   sa    4 4 : : 59488< )-$("&;DF
 F
 1	F

 2F
 2F
 2F
 6F
 &F
 "F
  F
 9F
 
F
\ )-$("&;D#
#
 &#
 "#
  #
 9#
 
#
R +/48KOEI8< )-$("&;DA
A
 (	A

 2A
 IA
 CA
 6A
 &A
 "A
  A
 9A
 
A
L (,&*HLKO )-$("&;DA
 %A
 $	A

 FA
 IA
 &A
 "A
  A
 9A
 
"A
R )-$("&;D$
$
 &$
 "$
  $
 9$
 
$
T (,/3+/&* )-$("&;D=
=
 %	=

 -=
 )=
 $=
 &=
 "=
  =
 9=
 
 =
J )-$("&;D$
$
 &$
 "$
  $
 9$
 
$
 $
r2   c            
         \ rS rSrSr\SS j5       r\SS j5       r\\\SS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S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SS\	S.           SS jjrSrg)r&   i  r)   c                    [        U 5      $ r+   )#AsyncMonitorResourceWithRawResponser-   s    r/   r0   &AsyncMonitorResource.with_raw_response  s     3488r2   c                    [        U 5      $ r4   ))AsyncMonitorResourceWithStreamingResponser-   s    r/   r6   ,AsyncMonitorResource.with_streaming_response  s     9>>r2   Nr8   c       
           #    U R                  S[        UUUUUUS.[        R                  5      I Sh  vN [	        XxXS9[
        S9I Sh  vN $  N N7f)rA   rB   rC   NrG   rH   )rL   r   r
   rM   r   r    rN   s              r/   rO   AsyncMonitorResource.create  st     j ZZ,!* (  (!*& &99
 
 )+Q[ !   
 
 	


s!   1AA
AAAArG   c          
        #    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)rR   rS   rT   rU   rG   rW   NrX   r[   s         r/   r\   AsyncMonitorResource.retrieve%  s]     6 XYcXfghhYY5*M(+Q[   
 
 	
 
   ?AAAr^   c       	           #    U(       d  [        SU< 35      eU R                  [        SUS9[        UUUUUS.[        R
                  5      I Sh  vN [        XxXS9[        S9I Sh  vN $  N N7f)r`   rS   ra   rU   rb   NrG   rH   )rY   rL   r   r   r   rc   r   r    rd   s              r/   re   AsyncMonitorResource.updateJ  s     ^ XYcXfghhZZ<T,!* ( ( & &99	 	 )+Q[    
 
 	
	
s$   AA1A-
A1(A/)A1/A1rg   c                  #    U R                  S[        UUUU[        UUUUS.[        R                  5      I Sh  vN S9[
        S9I Sh  vN $  N N7f)rl   rB   rm   Nrn   rW   )rZ   r   r   r	   rp   r#   rq   s	            r/   rr   AsyncMonitorResource.list  sr     ^ YY(+'%1"(!&"( $	 (99  -#  
 
 	

s!   8AAAAAAc          
        #    U(       d  [        SU< 35      eU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)ru   rS   rv   rU   rG   rW   Nrw   r[   s         r/   rx   AsyncMonitorResource.cancel  s]     8 XYcXfghhZZ<T(+Q[    
 
 	
 
r   rz   c                  #    U(       d  [        SU< 35      eU R                  [        SUS9[        UUUU	[	        UUUUS.[
        R                  5      I Sh  vN S9[        S9I Sh  vN $  N N7f)r~   rS   r   rU   r   Nrn   rW   )rY   rZ   r   r   r   r   r   r"   r   s
             r/   r   AsyncMonitorResource.events  s     R XYcXfghhYY<T(+'%1"(*8/B!&	 *==  +#  
 
 	

s$   AA2A.A2)A0*A20A2c          
        #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  [        SUS9[        X#XES9[        S9I Sh  vN $  N7f)	r   rS   r   r   r   rU   rG   rW   Nr   r[   s         r/   r   AsyncMonitorResource.trigger5  sq     6 XYcXfghh!5B]-@bBZZ=*U(+Q[    
 
 	
 
s   AAAAr   )r   r   )r   r   r   r   r   r   r   r   r   r   r2   r/   r&   r&     sa    9 9 ? ? 59488< )-$("&;DF
 F
 1	F

 2F
 2F
 2F
 6F
 &F
 "F
  F
 9F
 
F
\ )-$("&;D#
#
 &#
 "#
  #
 9#
 
#
R +/48KOEI8< )-$("&;DA
A
 (	A

 2A
 IA
 CA
 6A
 &A
 "A
  A
 9A
 
A
L (,&*HLKO )-$("&;DA
 %A
 $	A

 FA
 IA
 &A
 "A
  A
 9A
 
"A
R )-$("&;D$
$
 &$
 "$
  $
 9$
 
$
T (,/3+/&* )-$("&;D=
=
 %	=

 -=
 )=
 $=
 &=
 "=
  =
 9=
 
 =
J )-$("&;D$
$
 &$
 "$
  $
 9$
 
$
 $
r2   c                      \ rS rSrSS jrSrg)r,   i\  c                |   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g N)	_monitorr   rO   r\   re   rr   rx   r   r   r.   monitors     r/   __init__'MonitorResourceWithRawResponse.__init__]  s    -NN
 0
 .NN
 ,LL
	 .NN
 .NN
 /OO
r2   r   rx   rO   r   rr   r\   r   re   Nr   r%   r   r   r   r   r   r   r   r   r   r2   r/   r,   r,   \      
r2   r,   c                      \ rS rSrSS jrSrg)r   iw  c                |   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )	r   r   rO   r\   re   rr   rx   r   r   r   s     r/   r   ,AsyncMonitorResourceWithRawResponse.__init__x  s    3NN
 6
 4NN
 2LL
	 4NN
 4NN
 5OO
r2   r   Nr   r&   r   r   r   r   r2   r/   r   r   w  r   r2   r   c                      \ rS rSrSS jrSrg)r5   i  c                |   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )	r   r   rO   r\   re   rr   rx   r   r   r   s     r/   r   -MonitorResourceWithStreamingResponse.__init__  s    2NN
 5
 3NN
 1LL
	 3NN
 3NN
 4OO
r2   r   Nr   r   r   r2   r/   r5   r5     r   r2   r5   c                      \ rS rSrSS jrSrg)r   i  c                |   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )	r   r   rO   r\   re   rr   rx   r   r   r   s     r/   r   2AsyncMonitorResourceWithStreamingResponse.__init__  s    8NN
 ;
 9NN
 7LL
	 9NN
 9NN
 :OO
r2   r   Nr   r   r   r2   r/   r   r     r   r2   r   )8
__future__r   typingr   r   r   typing_extensionsr   httpxtypesr	   r
   r   r   _typesr   r   r   r   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   _base_clientr   types.monitorr    types.monitor_webhook_paramr!   types.paginated_monitor_eventsr"    types.paginated_monitor_responser#   0types.update_monitor_event_stream_settings_paramr$   __all__r%   r&   r,   r   r5   r   r   r2   r/   <module>r      s    # ' ' %   U T T J J % 9  0 # = C G d4
5Y
o Y
xY
+ Y
x
 
6
 
6
 
6
 
r2   