context.dev 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +9 -9
  4. data/lib/context_dev/client.rb +7 -2
  5. data/lib/context_dev/internal/type/base_model.rb +5 -5
  6. data/lib/context_dev/models/monitor_create_params.rb +28 -3
  7. data/lib/context_dev/models/monitor_create_response.rb +96 -4
  8. data/lib/context_dev/models/monitor_list_account_runs_response.rb +19 -98
  9. data/lib/context_dev/models/monitor_list_response.rb +100 -4
  10. data/lib/context_dev/models/monitor_list_runs_response.rb +19 -96
  11. data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
  12. data/lib/context_dev/models/monitor_retrieve_response.rb +97 -4
  13. data/lib/context_dev/models/monitor_update_params.rb +28 -3
  14. data/lib/context_dev/models/monitor_update_response.rb +96 -4
  15. data/lib/context_dev/models/parse_handle_params.rb +194 -0
  16. data/lib/context_dev/models/parse_handle_response.rb +132 -0
  17. data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
  18. data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
  19. data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
  20. data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
  21. data/lib/context_dev/models/webhook_delivery.rb +109 -0
  22. data/lib/context_dev/models.rb +4 -0
  23. data/lib/context_dev/resources/monitors.rb +3 -2
  24. data/lib/context_dev/resources/parse.rb +59 -0
  25. data/lib/context_dev/resources/web.rb +19 -4
  26. data/lib/context_dev/version.rb +1 -1
  27. data/lib/context_dev.rb +4 -0
  28. data/rbi/context_dev/client.rbi +6 -2
  29. data/rbi/context_dev/models/monitor_create_params.rbi +85 -5
  30. data/rbi/context_dev/models/monitor_create_response.rbi +234 -6
  31. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +27 -192
  32. data/rbi/context_dev/models/monitor_list_response.rbi +235 -5
  33. data/rbi/context_dev/models/monitor_list_runs_response.rbi +27 -192
  34. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
  35. data/rbi/context_dev/models/monitor_retrieve_response.rbi +234 -6
  36. data/rbi/context_dev/models/monitor_update_params.rbi +85 -5
  37. data/rbi/context_dev/models/monitor_update_response.rbi +234 -6
  38. data/rbi/context_dev/models/parse_handle_params.rbi +339 -0
  39. data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
  40. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
  41. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
  42. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
  43. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
  44. data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
  45. data/rbi/context_dev/models.rbi +4 -0
  46. data/rbi/context_dev/resources/monitors.rbi +3 -2
  47. data/rbi/context_dev/resources/parse.rbi +58 -0
  48. data/rbi/context_dev/resources/web.rbi +22 -7
  49. data/sig/context_dev/client.rbs +2 -0
  50. data/sig/context_dev/models/monitor_create_params.rbs +32 -3
  51. data/sig/context_dev/models/monitor_create_response.rbs +85 -6
  52. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +15 -68
  53. data/sig/context_dev/models/monitor_list_response.rbs +85 -6
  54. data/sig/context_dev/models/monitor_list_runs_response.rbs +15 -68
  55. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
  56. data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
  57. data/sig/context_dev/models/monitor_update_params.rbs +32 -3
  58. data/sig/context_dev/models/monitor_update_response.rbs +85 -6
  59. data/sig/context_dev/models/parse_handle_params.rbs +244 -0
  60. data/sig/context_dev/models/parse_handle_response.rbs +159 -0
  61. data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
  62. data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
  63. data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
  64. data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
  65. data/sig/context_dev/models/webhook_delivery.rbs +81 -0
  66. data/sig/context_dev/models.rbs +4 -0
  67. data/sig/context_dev/resources/parse.rbs +19 -0
  68. metadata +14 -2
@@ -106,15 +106,25 @@ module ContextDev
106
106
  # @return [Time, nil]
107
107
  optional :started_at, Time, nil?: true
108
108
 
109
+ # @!attribute webhook_deliveries
110
+ # All webhook deliveries attempted by this run — one per subscribed event that
111
+ # fired. Omitted when no webhook was attempted, including runs created before
112
+ # event selection was added.
113
+ #
114
+ # @return [Array<ContextDev::Models::WebhookDelivery>, nil]
115
+ optional :webhook_deliveries, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::WebhookDelivery] }
116
+
109
117
  # @!attribute webhook_delivery
110
- # The webhook delivery attempted for a change detected by this run. Omitted when
111
- # no webhook was attempted, including historical runs created before delivery
112
- # tracking was added.
118
+ # @deprecated
119
+ #
120
+ # Deprecated: use `webhook_deliveries`, which records every attempt now that a run
121
+ # can deliver multiple events. Omitted when no webhook was attempted, including
122
+ # historical runs created before delivery tracking was added.
113
123
  #
114
- # @return [ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery, nil]
115
- optional :webhook_delivery, -> { ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery }
124
+ # @return [ContextDev::Models::WebhookDelivery, nil]
125
+ optional :webhook_delivery, -> { ContextDev::WebhookDelivery }
116
126
 
117
- # @!method initialize(id:, baseline_created:, change_detected:, change_detection_type:, credits_charged:, monitor_id:, run_type:, status:, target_type:, change_id: nil, completed_at: nil, error: nil, skip_reason: nil, started_at: nil, webhook_delivery: nil)
127
+ # @!method initialize(id:, baseline_created:, change_detected:, change_detection_type:, credits_charged:, monitor_id:, run_type:, status:, target_type:, change_id: nil, completed_at: nil, error: nil, skip_reason: nil, started_at: nil, webhook_deliveries: nil, webhook_delivery: nil)
118
128
  # Some parameter documentations has been truncated, see
119
129
  # {ContextDev::Models::MonitorListRunsResponse::Data} for more details.
120
130
  #
@@ -146,7 +156,9 @@ module ContextDev
146
156
  #
147
157
  # @param started_at [Time, nil]
148
158
  #
149
- # @param webhook_delivery [ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery] The webhook delivery attempted for a change detected by this run. Omitted when n
159
+ # @param webhook_deliveries [Array<ContextDev::Models::WebhookDelivery>] All webhook deliveries attempted by this run — one per subscribed event that fir
160
+ #
161
+ # @param webhook_delivery [ContextDev::Models::WebhookDelivery] Deprecated: use `webhook_deliveries`, which records every attempt now that a run
150
162
 
151
163
  # @see ContextDev::Models::MonitorListRunsResponse::Data#change_detection_type
152
164
  module ChangeDetectionType
@@ -231,95 +243,6 @@ module ContextDev
231
243
  # @!method self.values
232
244
  # @return [Array<Symbol>]
233
245
  end
234
-
235
- # @see ContextDev::Models::MonitorListRunsResponse::Data#webhook_delivery
236
- class WebhookDelivery < ContextDev::Internal::Type::BaseModel
237
- # @!attribute attempted_at
238
- #
239
- # @return [Time]
240
- required :attempted_at, Time
241
-
242
- # @!attribute error
243
- #
244
- # @return [ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Error, nil]
245
- required :error,
246
- -> { ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Error },
247
- nil?: true
248
-
249
- # @!attribute event_id
250
- # Identifier sent in the X-Context-Id header.
251
- #
252
- # @return [String]
253
- required :event_id, String
254
-
255
- # @!attribute http_status
256
- # The endpoint's final HTTP response status, or null when no response was
257
- # received.
258
- #
259
- # @return [Integer, nil]
260
- required :http_status, Integer, nil?: true
261
-
262
- # @!attribute status
263
- # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
264
- # response; failed means no HTTP response was received; skipped_unsafe_url means
265
- # the URL failed the public-endpoint safety check.
266
- #
267
- # @return [Symbol, ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Status]
268
- required :status, enum: -> { ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Status }
269
-
270
- # @!method initialize(attempted_at:, error:, event_id:, http_status:, status:)
271
- # Some parameter documentations has been truncated, see
272
- # {ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery} for more
273
- # details.
274
- #
275
- # The webhook delivery attempted for a change detected by this run. Omitted when
276
- # no webhook was attempted, including historical runs created before delivery
277
- # tracking was added.
278
- #
279
- # @param attempted_at [Time]
280
- #
281
- # @param error [ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Error, nil]
282
- #
283
- # @param event_id [String] Identifier sent in the X-Context-Id header.
284
- #
285
- # @param http_status [Integer, nil] The endpoint's final HTTP response status, or null when no response was received
286
- #
287
- # @param status [Symbol, ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery::Status] Delivery outcome. delivered means any 2xx response; rejected means a non-2xx res
288
-
289
- # @see ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery#error
290
- class Error < ContextDev::Internal::Type::BaseModel
291
- # @!attribute code
292
- #
293
- # @return [String]
294
- required :code, String
295
-
296
- # @!attribute message
297
- #
298
- # @return [String]
299
- required :message, String
300
-
301
- # @!method initialize(code:, message:)
302
- # @param code [String]
303
- # @param message [String]
304
- end
305
-
306
- # Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
307
- # response; failed means no HTTP response was received; skipped_unsafe_url means
308
- # the URL failed the public-endpoint safety check.
309
- #
310
- # @see ContextDev::Models::MonitorListRunsResponse::Data::WebhookDelivery#status
311
- module Status
312
- extend ContextDev::Internal::Type::Enum
313
-
314
- DELIVERED = :delivered
315
- REJECTED = :rejected
316
- FAILED = :failed
317
- SKIPPED_UNSAFE_URL = :skipped_unsafe_url
318
-
319
- # @!method self.values
320
- # @return [Array<Symbol>]
321
- end
322
- end
323
246
  end
324
247
  end
325
248
  end
@@ -43,6 +43,12 @@ module ContextDev
43
43
  # @return [String]
44
44
  required :summary, String
45
45
 
46
+ # @!attribute tags
47
+ # User-defined tags for grouping and filtering monitors and their changes.
48
+ #
49
+ # @return [Array<String>]
50
+ required :tags, ContextDev::Internal::Type::ArrayOf[String]
51
+
46
52
  # @!attribute target_type
47
53
  #
48
54
  # @return [Symbol, ContextDev::Models::MonitorRetrieveChangeResponse::TargetType]
@@ -123,13 +129,7 @@ module ContextDev
123
129
  # @return [Array<String>, nil]
124
130
  optional :removed_urls, ContextDev::Internal::Type::ArrayOf[String]
125
131
 
126
- # @!attribute tags
127
- # User-defined tags for grouping and filtering monitors and their changes.
128
- #
129
- # @return [Array<String>, nil]
130
- optional :tags, ContextDev::Internal::Type::ArrayOf[String]
131
-
132
- # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, removed_url_count: nil, removed_urls: nil, tags: nil)
132
+ # @!method initialize(id:, change_detection_type:, detected_at:, mode:, monitor_id:, run_id:, summary:, tags:, target_type:, title:, url:, added_url_count: nil, added_urls: nil, after_text_excerpt: nil, before_text_excerpt: nil, confidence: nil, diff: nil, evidence: nil, importance: nil, matched_url_count: nil, matched_urls: nil, removed_url_count: nil, removed_urls: nil)
133
133
  # Some parameter documentations has been truncated, see
134
134
  # {ContextDev::Models::MonitorRetrieveChangeResponse} for more details.
135
135
  #
@@ -137,7 +137,7 @@ module ContextDev
137
137
  # `change_detection_type` describe the change, and which optional fields are
138
138
  # present depends on them (page: `diff` + excerpts; sitemap:
139
139
  # `added_urls`/`removed_urls`; semantic:
140
- # `query`/`confidence`/`importance`/`evidence`/`matched_urls`).
140
+ # `confidence`/`importance`/`evidence`/`matched_urls`).
141
141
  #
142
142
  # @param id [String]
143
143
  #
@@ -153,6 +153,8 @@ module ContextDev
153
153
  #
154
154
  # @param summary [String]
155
155
  #
156
+ # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
157
+ #
156
158
  # @param target_type [Symbol, ContextDev::Models::MonitorRetrieveChangeResponse::TargetType]
157
159
  #
158
160
  # @param title [String]
@@ -182,8 +184,6 @@ module ContextDev
182
184
  # @param removed_url_count [Integer]
183
185
  #
184
186
  # @param removed_urls [Array<String>] At most 500 URLs are included; the corresponding count field is always exact.
185
- #
186
- # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
187
187
 
188
188
  # @see ContextDev::Models::MonitorRetrieveChangeResponse#change_detection_type
189
189
  module ChangeDetectionType
@@ -103,7 +103,15 @@ module ContextDev
103
103
  # @return [ContextDev::Models::MonitorRetrieveResponse::Webhook, nil]
104
104
  optional :webhook, -> { ContextDev::Models::MonitorRetrieveResponse::Webhook }, nil?: true
105
105
 
106
- # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil)
106
+ # @!attribute webhook_failure
107
+ # Present while webhook deliveries are failing consecutively; null when deliveries
108
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
109
+ # and when the webhook URL changes.
110
+ #
111
+ # @return [ContextDev::Models::MonitorRetrieveResponse::WebhookFailure, nil]
112
+ optional :webhook_failure, -> { ContextDev::Models::MonitorRetrieveResponse::WebhookFailure }, nil?: true
113
+
114
+ # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil, webhook_failure: nil)
107
115
  # Some parameter documentations has been truncated, see
108
116
  # {ContextDev::Models::MonitorRetrieveResponse} for more details.
109
117
  #
@@ -141,6 +149,8 @@ module ContextDev
141
149
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
142
150
  #
143
151
  # @param webhook [ContextDev::Models::MonitorRetrieveResponse::Webhook, nil]
152
+ #
153
+ # @param webhook_failure [ContextDev::Models::MonitorRetrieveResponse::WebhookFailure, nil] Present while webhook deliveries are failing consecutively; null when deliveries
144
154
 
145
155
  # Discriminated union describing how changes are detected.
146
156
  #
@@ -583,11 +593,21 @@ module ContextDev
583
593
  # @see ContextDev::Models::MonitorRetrieveResponse#webhook
584
594
  class Webhook < ContextDev::Internal::Type::BaseModel
585
595
  # @!attribute url
586
- # Webhook URL called when a change is detected.
596
+ # Webhook URL events are delivered to.
587
597
  #
588
598
  # @return [String]
589
599
  required :url, String
590
600
 
601
+ # @!attribute events
602
+ # Events delivered to this endpoint. `change.detected` fires only when a run
603
+ # detects a change; `run.completed` fires on every completed run — including runs
604
+ # that detected no change — and embeds the change when one was detected. Defaults
605
+ # to `["change.detected"]` when omitted.
606
+ #
607
+ # @return [Array<Symbol, ContextDev::Models::MonitorRetrieveResponse::Webhook::Event>, nil]
608
+ optional :events,
609
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::MonitorRetrieveResponse::Webhook::Event] }
610
+
591
611
  response_only do
592
612
  # @!attribute secret
593
613
  # Signing secret used to verify webhook authenticity. Each delivery includes an
@@ -600,13 +620,86 @@ module ContextDev
600
620
  optional :secret, String
601
621
  end
602
622
 
603
- # @!method initialize(url:, secret: nil)
623
+ # @!method initialize(url:, events: nil, secret: nil)
604
624
  # Some parameter documentations has been truncated, see
605
625
  # {ContextDev::Models::MonitorRetrieveResponse::Webhook} for more details.
606
626
  #
607
- # @param url [String] Webhook URL called when a change is detected.
627
+ # @param url [String] Webhook URL events are delivered to.
628
+ #
629
+ # @param events [Array<Symbol, ContextDev::Models::MonitorRetrieveResponse::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
608
630
  #
609
631
  # @param secret [String] Signing secret used to verify webhook authenticity. Each delivery includes an `X
632
+
633
+ module Event
634
+ extend ContextDev::Internal::Type::Enum
635
+
636
+ CHANGE_DETECTED = :"change.detected"
637
+ RUN_COMPLETED = :"run.completed"
638
+
639
+ # @!method self.values
640
+ # @return [Array<Symbol>]
641
+ end
642
+ end
643
+
644
+ # @see ContextDev::Models::MonitorRetrieveResponse#webhook_failure
645
+ class WebhookFailure < ContextDev::Internal::Type::BaseModel
646
+ # @!attribute consecutive_failures
647
+ # Number of consecutive delivery attempts that did not succeed.
648
+ #
649
+ # @return [Integer]
650
+ required :consecutive_failures, Integer
651
+
652
+ # @!attribute last_failed_at
653
+ #
654
+ # @return [Time]
655
+ required :last_failed_at, Time
656
+
657
+ # @!attribute last_message
658
+ # Human-readable description of the most recent failure.
659
+ #
660
+ # @return [String]
661
+ required :last_message, String
662
+
663
+ # @!attribute last_status
664
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
665
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
666
+ # failed the public-endpoint safety check.
667
+ #
668
+ # @return [Symbol, ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus]
669
+ required :last_status,
670
+ enum: -> { ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus }
671
+
672
+ # @!method initialize(consecutive_failures:, last_failed_at:, last_message:, last_status:)
673
+ # Some parameter documentations has been truncated, see
674
+ # {ContextDev::Models::MonitorRetrieveResponse::WebhookFailure} for more details.
675
+ #
676
+ # Present while webhook deliveries are failing consecutively; null when deliveries
677
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
678
+ # and when the webhook URL changes.
679
+ #
680
+ # @param consecutive_failures [Integer] Number of consecutive delivery attempts that did not succeed.
681
+ #
682
+ # @param last_failed_at [Time]
683
+ #
684
+ # @param last_message [String] Human-readable description of the most recent failure.
685
+ #
686
+ # @param last_status [Symbol, ContextDev::Models::MonitorRetrieveResponse::WebhookFailure::LastStatus] Outcome of the most recent failed delivery. rejected means a non-2xx response; f
687
+
688
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
689
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
690
+ # failed the public-endpoint safety check.
691
+ #
692
+ # @see ContextDev::Models::MonitorRetrieveResponse::WebhookFailure#last_status
693
+ module LastStatus
694
+ extend ContextDev::Internal::Type::Enum
695
+
696
+ REJECTED = :rejected
697
+ FAILED = :failed
698
+ SKIPPED_UNSAFE_URL = :skipped_unsafe_url
699
+
700
+ # @!method self.values
701
+ # @return [Array<Symbol>]
702
+ end
610
703
  end
611
704
  end
612
705
  end
@@ -361,15 +361,40 @@ module ContextDev
361
361
 
362
362
  class Webhook < ContextDev::Internal::Type::BaseModel
363
363
  # @!attribute url
364
- # Webhook URL called when a change is detected.
364
+ # Webhook URL events are delivered to.
365
365
  #
366
366
  # @return [String]
367
367
  required :url, String
368
368
 
369
- # @!method initialize(url:)
369
+ # @!attribute events
370
+ # Events delivered to this endpoint. `change.detected` fires only when a run
371
+ # detects a change; `run.completed` fires on every completed run — including runs
372
+ # that detected no change — and embeds the change when one was detected. Defaults
373
+ # to `["change.detected"]` when omitted.
374
+ #
375
+ # @return [Array<Symbol, ContextDev::Models::MonitorUpdateParams::Webhook::Event>, nil]
376
+ optional :events,
377
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::MonitorUpdateParams::Webhook::Event] }
378
+
379
+ # @!method initialize(url:, events: nil)
380
+ # Some parameter documentations has been truncated, see
381
+ # {ContextDev::Models::MonitorUpdateParams::Webhook} for more details.
382
+ #
370
383
  # Set to null to remove the webhook.
371
384
  #
372
- # @param url [String] Webhook URL called when a change is detected.
385
+ # @param url [String] Webhook URL events are delivered to.
386
+ #
387
+ # @param events [Array<Symbol, ContextDev::Models::MonitorUpdateParams::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
388
+
389
+ module Event
390
+ extend ContextDev::Internal::Type::Enum
391
+
392
+ CHANGE_DETECTED = :"change.detected"
393
+ RUN_COMPLETED = :"run.completed"
394
+
395
+ # @!method self.values
396
+ # @return [Array<Symbol>]
397
+ end
373
398
  end
374
399
  end
375
400
  end
@@ -103,7 +103,15 @@ module ContextDev
103
103
  # @return [ContextDev::Models::MonitorUpdateResponse::Webhook, nil]
104
104
  optional :webhook, -> { ContextDev::Models::MonitorUpdateResponse::Webhook }, nil?: true
105
105
 
106
- # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil)
106
+ # @!attribute webhook_failure
107
+ # Present while webhook deliveries are failing consecutively; null when deliveries
108
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
109
+ # and when the webhook URL changes.
110
+ #
111
+ # @return [ContextDev::Models::MonitorUpdateResponse::WebhookFailure, nil]
112
+ optional :webhook_failure, -> { ContextDev::Models::MonitorUpdateResponse::WebhookFailure }, nil?: true
113
+
114
+ # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil, webhook_failure: nil)
107
115
  # Some parameter documentations has been truncated, see
108
116
  # {ContextDev::Models::MonitorUpdateResponse} for more details.
109
117
  #
@@ -141,6 +149,8 @@ module ContextDev
141
149
  # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
142
150
  #
143
151
  # @param webhook [ContextDev::Models::MonitorUpdateResponse::Webhook, nil]
152
+ #
153
+ # @param webhook_failure [ContextDev::Models::MonitorUpdateResponse::WebhookFailure, nil] Present while webhook deliveries are failing consecutively; null when deliveries
144
154
 
145
155
  # Discriminated union describing how changes are detected.
146
156
  #
@@ -583,11 +593,21 @@ module ContextDev
583
593
  # @see ContextDev::Models::MonitorUpdateResponse#webhook
584
594
  class Webhook < ContextDev::Internal::Type::BaseModel
585
595
  # @!attribute url
586
- # Webhook URL called when a change is detected.
596
+ # Webhook URL events are delivered to.
587
597
  #
588
598
  # @return [String]
589
599
  required :url, String
590
600
 
601
+ # @!attribute events
602
+ # Events delivered to this endpoint. `change.detected` fires only when a run
603
+ # detects a change; `run.completed` fires on every completed run — including runs
604
+ # that detected no change — and embeds the change when one was detected. Defaults
605
+ # to `["change.detected"]` when omitted.
606
+ #
607
+ # @return [Array<Symbol, ContextDev::Models::MonitorUpdateResponse::Webhook::Event>, nil]
608
+ optional :events,
609
+ -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::MonitorUpdateResponse::Webhook::Event] }
610
+
591
611
  response_only do
592
612
  # @!attribute secret
593
613
  # Signing secret used to verify webhook authenticity. Each delivery includes an
@@ -600,13 +620,85 @@ module ContextDev
600
620
  optional :secret, String
601
621
  end
602
622
 
603
- # @!method initialize(url:, secret: nil)
623
+ # @!method initialize(url:, events: nil, secret: nil)
604
624
  # Some parameter documentations has been truncated, see
605
625
  # {ContextDev::Models::MonitorUpdateResponse::Webhook} for more details.
606
626
  #
607
- # @param url [String] Webhook URL called when a change is detected.
627
+ # @param url [String] Webhook URL events are delivered to.
628
+ #
629
+ # @param events [Array<Symbol, ContextDev::Models::MonitorUpdateResponse::Webhook::Event>] Events delivered to this endpoint. `change.detected` fires only when a run detec
608
630
  #
609
631
  # @param secret [String] Signing secret used to verify webhook authenticity. Each delivery includes an `X
632
+
633
+ module Event
634
+ extend ContextDev::Internal::Type::Enum
635
+
636
+ CHANGE_DETECTED = :"change.detected"
637
+ RUN_COMPLETED = :"run.completed"
638
+
639
+ # @!method self.values
640
+ # @return [Array<Symbol>]
641
+ end
642
+ end
643
+
644
+ # @see ContextDev::Models::MonitorUpdateResponse#webhook_failure
645
+ class WebhookFailure < ContextDev::Internal::Type::BaseModel
646
+ # @!attribute consecutive_failures
647
+ # Number of consecutive delivery attempts that did not succeed.
648
+ #
649
+ # @return [Integer]
650
+ required :consecutive_failures, Integer
651
+
652
+ # @!attribute last_failed_at
653
+ #
654
+ # @return [Time]
655
+ required :last_failed_at, Time
656
+
657
+ # @!attribute last_message
658
+ # Human-readable description of the most recent failure.
659
+ #
660
+ # @return [String]
661
+ required :last_message, String
662
+
663
+ # @!attribute last_status
664
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
665
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
666
+ # failed the public-endpoint safety check.
667
+ #
668
+ # @return [Symbol, ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus]
669
+ required :last_status, enum: -> { ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus }
670
+
671
+ # @!method initialize(consecutive_failures:, last_failed_at:, last_message:, last_status:)
672
+ # Some parameter documentations has been truncated, see
673
+ # {ContextDev::Models::MonitorUpdateResponse::WebhookFailure} for more details.
674
+ #
675
+ # Present while webhook deliveries are failing consecutively; null when deliveries
676
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
677
+ # and when the webhook URL changes.
678
+ #
679
+ # @param consecutive_failures [Integer] Number of consecutive delivery attempts that did not succeed.
680
+ #
681
+ # @param last_failed_at [Time]
682
+ #
683
+ # @param last_message [String] Human-readable description of the most recent failure.
684
+ #
685
+ # @param last_status [Symbol, ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus] Outcome of the most recent failed delivery. rejected means a non-2xx response; f
686
+
687
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
688
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
689
+ # failed the public-endpoint safety check.
690
+ #
691
+ # @see ContextDev::Models::MonitorUpdateResponse::WebhookFailure#last_status
692
+ module LastStatus
693
+ extend ContextDev::Internal::Type::Enum
694
+
695
+ REJECTED = :rejected
696
+ FAILED = :failed
697
+ SKIPPED_UNSAFE_URL = :skipped_unsafe_url
698
+
699
+ # @!method self.values
700
+ # @return [Array<Symbol>]
701
+ end
610
702
  end
611
703
  end
612
704
  end