context.dev 1.36.0 → 2.1.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +16 -9
  4. data/lib/context_dev/client.rb +7 -0
  5. data/lib/context_dev/models/brand_retrieve_params.rb +1079 -174
  6. data/lib/context_dev/models/monitor_create_params.rb +364 -0
  7. data/lib/context_dev/models/monitor_create_response.rb +608 -0
  8. data/lib/context_dev/models/monitor_delete_params.rb +20 -0
  9. data/lib/context_dev/models/monitor_delete_response.rb +22 -0
  10. data/lib/context_dev/models/monitor_list_account_changes_params.rb +93 -0
  11. data/lib/context_dev/models/monitor_list_account_changes_response.rb +199 -0
  12. data/lib/context_dev/models/monitor_list_account_runs_params.rb +55 -0
  13. data/lib/context_dev/models/monitor_list_account_runs_response.rb +227 -0
  14. data/lib/context_dev/models/monitor_list_changes_params.rb +57 -0
  15. data/lib/context_dev/models/monitor_list_changes_response.rb +198 -0
  16. data/lib/context_dev/models/monitor_list_params.rb +161 -0
  17. data/lib/context_dev/models/monitor_list_response.rb +631 -0
  18. data/lib/context_dev/models/monitor_list_runs_params.rb +62 -0
  19. data/lib/context_dev/models/monitor_list_runs_response.rb +227 -0
  20. data/lib/context_dev/models/monitor_retrieve_change_params.rb +20 -0
  21. data/lib/context_dev/models/monitor_retrieve_change_response.rb +264 -0
  22. data/lib/context_dev/models/monitor_retrieve_params.rb +20 -0
  23. data/lib/context_dev/models/monitor_retrieve_response.rb +608 -0
  24. data/lib/context_dev/models/monitor_run_params.rb +20 -0
  25. data/lib/context_dev/models/monitor_run_response.rb +35 -0
  26. data/lib/context_dev/models/monitor_update_params.rb +371 -0
  27. data/lib/context_dev/models/monitor_update_response.rb +608 -0
  28. data/lib/context_dev/models/utility_prefetch_params.rb +70 -6
  29. data/lib/context_dev/models/utility_prefetch_response.rb +23 -1
  30. data/lib/context_dev/models/web_extract_response.rb +17 -1
  31. data/lib/context_dev/models/web_web_crawl_md_params.rb +11 -1
  32. data/lib/context_dev/models/web_web_scrape_html_params.rb +11 -1
  33. data/lib/context_dev/models/web_web_scrape_html_response.rb +10 -2
  34. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -1
  35. data/lib/context_dev/models/web_web_scrape_md_params.rb +11 -1
  36. data/lib/context_dev/models.rb +20 -12
  37. data/lib/context_dev/resources/ai.rb +0 -33
  38. data/lib/context_dev/resources/brand.rb +9 -204
  39. data/lib/context_dev/resources/monitors.rb +352 -0
  40. data/lib/context_dev/resources/utility.rb +9 -35
  41. data/lib/context_dev/resources/web.rb +14 -4
  42. data/lib/context_dev/version.rb +1 -1
  43. data/lib/context_dev.rb +23 -14
  44. data/rbi/context_dev/client.rbi +6 -0
  45. data/rbi/context_dev/models/brand_retrieve_params.rbi +3858 -678
  46. data/rbi/context_dev/models/monitor_create_params.rbi +641 -0
  47. data/rbi/context_dev/models/monitor_create_response.rbi +1020 -0
  48. data/rbi/context_dev/models/monitor_delete_params.rbi +35 -0
  49. data/rbi/context_dev/models/monitor_delete_response.rbi +29 -0
  50. data/rbi/context_dev/models/monitor_list_account_changes_params.rbi +211 -0
  51. data/rbi/context_dev/models/monitor_list_account_changes_response.rbi +376 -0
  52. data/rbi/context_dev/models/monitor_list_account_runs_params.rbi +125 -0
  53. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +464 -0
  54. data/rbi/context_dev/models/monitor_list_changes_params.rbi +91 -0
  55. data/rbi/context_dev/models/monitor_list_changes_response.rbi +372 -0
  56. data/rbi/context_dev/models/monitor_list_params.rbi +335 -0
  57. data/rbi/context_dev/models/monitor_list_response.rbi +1089 -0
  58. data/rbi/context_dev/models/monitor_list_runs_params.rbi +125 -0
  59. data/rbi/context_dev/models/monitor_list_runs_response.rbi +455 -0
  60. data/rbi/context_dev/models/monitor_retrieve_change_params.rbi +38 -0
  61. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +469 -0
  62. data/rbi/context_dev/models/monitor_retrieve_params.rbi +38 -0
  63. data/rbi/context_dev/models/monitor_retrieve_response.rbi +1028 -0
  64. data/rbi/context_dev/models/monitor_run_params.rbi +35 -0
  65. data/rbi/context_dev/models/monitor_run_response.rbi +48 -0
  66. data/rbi/context_dev/models/monitor_update_params.rbi +681 -0
  67. data/rbi/context_dev/models/monitor_update_response.rbi +1020 -0
  68. data/rbi/context_dev/models/utility_prefetch_params.rbi +129 -7
  69. data/rbi/context_dev/models/utility_prefetch_response.rbi +55 -3
  70. data/rbi/context_dev/models/web_extract_response.rbi +10 -0
  71. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +15 -0
  72. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +15 -0
  73. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +29 -3
  74. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +17 -0
  75. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +15 -0
  76. data/rbi/context_dev/models.rbi +23 -15
  77. data/rbi/context_dev/resources/ai.rbi +0 -28
  78. data/rbi/context_dev/resources/brand.rbi +16 -228
  79. data/rbi/context_dev/resources/monitors.rbi +286 -0
  80. data/rbi/context_dev/resources/utility.rbi +14 -29
  81. data/rbi/context_dev/resources/web.rbi +21 -0
  82. data/sig/context_dev/client.rbs +2 -0
  83. data/sig/context_dev/models/brand_retrieve_params.rbs +1586 -281
  84. data/sig/context_dev/models/monitor_create_params.rbs +301 -0
  85. data/sig/context_dev/models/monitor_create_response.rbs +433 -0
  86. data/sig/context_dev/models/monitor_delete_params.rbs +23 -0
  87. data/sig/context_dev/models/monitor_delete_response.rbs +15 -0
  88. data/sig/context_dev/models/monitor_list_account_changes_params.rbs +104 -0
  89. data/sig/context_dev/models/monitor_list_account_changes_response.rbs +176 -0
  90. data/sig/context_dev/models/monitor_list_account_runs_params.rbs +58 -0
  91. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +184 -0
  92. data/sig/context_dev/models/monitor_list_changes_params.rbs +61 -0
  93. data/sig/context_dev/models/monitor_list_changes_response.rbs +176 -0
  94. data/sig/context_dev/models/monitor_list_params.rbs +160 -0
  95. data/sig/context_dev/models/monitor_list_response.rbs +460 -0
  96. data/sig/context_dev/models/monitor_list_runs_params.rbs +63 -0
  97. data/sig/context_dev/models/monitor_list_runs_response.rbs +184 -0
  98. data/sig/context_dev/models/monitor_retrieve_change_params.rbs +23 -0
  99. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +221 -0
  100. data/sig/context_dev/models/monitor_retrieve_params.rbs +23 -0
  101. data/sig/context_dev/models/monitor_retrieve_response.rbs +433 -0
  102. data/sig/context_dev/models/monitor_run_params.rbs +23 -0
  103. data/sig/context_dev/models/monitor_run_response.rbs +18 -0
  104. data/sig/context_dev/models/monitor_update_params.rbs +321 -0
  105. data/sig/context_dev/models/monitor_update_response.rbs +433 -0
  106. data/sig/context_dev/models/utility_prefetch_params.rbs +52 -4
  107. data/sig/context_dev/models/utility_prefetch_response.rbs +22 -3
  108. data/sig/context_dev/models/web_extract_response.rbs +5 -0
  109. data/sig/context_dev/models/web_web_crawl_md_params.rbs +7 -0
  110. data/sig/context_dev/models/web_web_scrape_html_params.rbs +7 -0
  111. data/sig/context_dev/models/web_web_scrape_html_response.rbs +8 -0
  112. data/sig/context_dev/models/web_web_scrape_images_params.rbs +7 -0
  113. data/sig/context_dev/models/web_web_scrape_md_params.rbs +7 -0
  114. data/sig/context_dev/models.rbs +20 -12
  115. data/sig/context_dev/resources/ai.rbs +0 -8
  116. data/sig/context_dev/resources/brand.rbs +1 -56
  117. data/sig/context_dev/resources/monitors.rbs +101 -0
  118. data/sig/context_dev/resources/utility.rbs +2 -7
  119. data/sig/context_dev/resources/web.rbs +4 -0
  120. metadata +71 -44
  121. data/lib/context_dev/models/ai_ai_query_params.rb +0 -235
  122. data/lib/context_dev/models/ai_ai_query_response.rb +0 -133
  123. data/lib/context_dev/models/brand_identify_from_transaction_params.rb +0 -474
  124. data/lib/context_dev/models/brand_identify_from_transaction_response.rb +0 -1074
  125. data/lib/context_dev/models/brand_retrieve_by_email_params.rb +0 -195
  126. data/lib/context_dev/models/brand_retrieve_by_email_response.rb +0 -1071
  127. data/lib/context_dev/models/brand_retrieve_by_isin_params.rb +0 -195
  128. data/lib/context_dev/models/brand_retrieve_by_isin_response.rb +0 -1070
  129. data/lib/context_dev/models/brand_retrieve_by_name_params.rb +0 -452
  130. data/lib/context_dev/models/brand_retrieve_by_name_response.rb +0 -1070
  131. data/lib/context_dev/models/brand_retrieve_by_ticker_params.rb +0 -283
  132. data/lib/context_dev/models/brand_retrieve_by_ticker_response.rb +0 -1072
  133. data/lib/context_dev/models/utility_prefetch_by_email_params.rb +0 -37
  134. data/lib/context_dev/models/utility_prefetch_by_email_response.rb +0 -68
  135. data/rbi/context_dev/models/ai_ai_query_params.rbi +0 -504
  136. data/rbi/context_dev/models/ai_ai_query_response.rbi +0 -267
  137. data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +0 -2020
  138. data/rbi/context_dev/models/brand_identify_from_transaction_response.rbi +0 -3515
  139. data/rbi/context_dev/models/brand_retrieve_by_email_params.rbi +0 -743
  140. data/rbi/context_dev/models/brand_retrieve_by_email_response.rbi +0 -3511
  141. data/rbi/context_dev/models/brand_retrieve_by_isin_params.rbi +0 -743
  142. data/rbi/context_dev/models/brand_retrieve_by_isin_response.rbi +0 -3510
  143. data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +0 -1982
  144. data/rbi/context_dev/models/brand_retrieve_by_name_response.rbi +0 -3510
  145. data/rbi/context_dev/models/brand_retrieve_by_ticker_params.rbi +0 -1153
  146. data/rbi/context_dev/models/brand_retrieve_by_ticker_response.rbi +0 -3512
  147. data/rbi/context_dev/models/utility_prefetch_by_email_params.rbi +0 -65
  148. data/rbi/context_dev/models/utility_prefetch_by_email_response.rbi +0 -132
  149. data/sig/context_dev/models/ai_ai_query_params.rbs +0 -218
  150. data/sig/context_dev/models/ai_ai_query_response.rbs +0 -121
  151. data/sig/context_dev/models/brand_identify_from_transaction_params.rbs +0 -822
  152. data/sig/context_dev/models/brand_identify_from_transaction_response.rbs +0 -1441
  153. data/sig/context_dev/models/brand_retrieve_by_email_params.rbs +0 -305
  154. data/sig/context_dev/models/brand_retrieve_by_email_response.rbs +0 -1441
  155. data/sig/context_dev/models/brand_retrieve_by_isin_params.rbs +0 -305
  156. data/sig/context_dev/models/brand_retrieve_by_isin_response.rbs +0 -1441
  157. data/sig/context_dev/models/brand_retrieve_by_name_params.rbs +0 -801
  158. data/sig/context_dev/models/brand_retrieve_by_name_response.rbs +0 -1441
  159. data/sig/context_dev/models/brand_retrieve_by_ticker_params.rbs +0 -467
  160. data/sig/context_dev/models/brand_retrieve_by_ticker_response.rbs +0 -1441
  161. data/sig/context_dev/models/utility_prefetch_by_email_params.rbs +0 -30
  162. data/sig/context_dev/models/utility_prefetch_by_email_response.rbs +0 -64
@@ -0,0 +1,631 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Monitors#list
6
+ class MonitorListResponse < ContextDev::Internal::Type::BaseModel
7
+ # @!attribute data
8
+ #
9
+ # @return [Array<ContextDev::Models::MonitorListResponse::Data>]
10
+ required :data, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::MonitorListResponse::Data] }
11
+
12
+ # @!attribute has_more
13
+ #
14
+ # @return [Boolean]
15
+ required :has_more, ContextDev::Internal::Type::Boolean
16
+
17
+ # @!attribute next_cursor
18
+ #
19
+ # @return [String, nil]
20
+ required :next_cursor, String, nil?: true
21
+
22
+ # @!method initialize(data:, has_more:, next_cursor:)
23
+ # @param data [Array<ContextDev::Models::MonitorListResponse::Data>]
24
+ # @param has_more [Boolean]
25
+ # @param next_cursor [String, nil]
26
+
27
+ class Data < ContextDev::Internal::Type::BaseModel
28
+ # @!attribute id
29
+ #
30
+ # @return [String]
31
+ required :id, String
32
+
33
+ # @!attribute change_detection
34
+ # Discriminated union describing how changes are detected.
35
+ #
36
+ # @return [ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact, ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic]
37
+ required :change_detection, union: -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection }
38
+
39
+ # @!attribute created_at
40
+ #
41
+ # @return [Time]
42
+ required :created_at, Time
43
+
44
+ # @!attribute mode
45
+ # Top-level monitor category. Always `web` today; the concrete behavior is
46
+ # described by `target` and `change_detection`.
47
+ #
48
+ # @return [Symbol, ContextDev::Models::MonitorListResponse::Data::Mode]
49
+ required :mode, enum: -> { ContextDev::Models::MonitorListResponse::Data::Mode }
50
+
51
+ # @!attribute name
52
+ #
53
+ # @return [String]
54
+ required :name, String
55
+
56
+ # @!attribute schedule
57
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
58
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
59
+ # between 10 minutes and 1 year.
60
+ #
61
+ # @return [ContextDev::Models::MonitorListResponse::Data::Schedule]
62
+ required :schedule, -> { ContextDev::Models::MonitorListResponse::Data::Schedule }
63
+
64
+ # @!attribute status
65
+ # Monitor lifecycle status. `failed` means the most recent run failed (see the
66
+ # monitor's `last_error`); failed monitors keep running on schedule and flip back
67
+ # to `active` on the next successful run. Monitors are auto-`paused` after
68
+ # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
69
+ # status to `active`.
70
+ #
71
+ # @return [Symbol, ContextDev::Models::MonitorListResponse::Data::Status]
72
+ required :status, enum: -> { ContextDev::Models::MonitorListResponse::Data::Status }
73
+
74
+ # @!attribute target
75
+ # Discriminated union describing what the monitor watches.
76
+ #
77
+ # @return [ContextDev::Models::MonitorListResponse::Data::Target::Page, ContextDev::Models::MonitorListResponse::Data::Target::Sitemap, ContextDev::Models::MonitorListResponse::Data::Target::Extract]
78
+ required :target, union: -> { ContextDev::Models::MonitorListResponse::Data::Target }
79
+
80
+ # @!attribute updated_at
81
+ #
82
+ # @return [Time]
83
+ required :updated_at, Time
84
+
85
+ # @!attribute baseline
86
+ # Current baseline: the last observed value the monitor compares new snapshots
87
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
88
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
89
+ # after a target or change_detection update, which resets the baseline).
90
+ #
91
+ # @return [ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline, nil]
92
+ optional :baseline, union: -> { ContextDev::Models::MonitorListResponse::Data::Baseline }, nil?: true
93
+
94
+ # @!attribute last_change_at
95
+ #
96
+ # @return [Time, nil]
97
+ optional :last_change_at, Time, nil?: true
98
+
99
+ # @!attribute last_error
100
+ # Error from the most recent failed run; null when the last run succeeded.
101
+ #
102
+ # @return [ContextDev::Models::MonitorListResponse::Data::LastError, nil]
103
+ optional :last_error, -> { ContextDev::Models::MonitorListResponse::Data::LastError }, nil?: true
104
+
105
+ # @!attribute last_run_at
106
+ #
107
+ # @return [Time, nil]
108
+ optional :last_run_at, Time, nil?: true
109
+
110
+ # @!attribute next_run_at
111
+ # When the next scheduled run is due.
112
+ #
113
+ # @return [Time, nil]
114
+ optional :next_run_at, Time, nil?: true
115
+
116
+ # @!attribute tags
117
+ # User-defined tags for grouping and filtering monitors and their changes.
118
+ #
119
+ # @return [Array<String>, nil]
120
+ optional :tags, ContextDev::Internal::Type::ArrayOf[String]
121
+
122
+ # @!attribute webhook
123
+ #
124
+ # @return [ContextDev::Models::MonitorListResponse::Data::Webhook, nil]
125
+ optional :webhook, -> { ContextDev::Models::MonitorListResponse::Data::Webhook }, nil?: true
126
+
127
+ # @!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)
128
+ # Some parameter documentations has been truncated, see
129
+ # {ContextDev::Models::MonitorListResponse::Data} for more details.
130
+ #
131
+ # A web monitor. `mode` is the constant `web`; behavior is described by `target`
132
+ # (page/sitemap/extract) and `change_detection` (exact/semantic).
133
+ #
134
+ # @param id [String]
135
+ #
136
+ # @param change_detection [ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact, ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic] Discriminated union describing how changes are detected.
137
+ #
138
+ # @param created_at [Time]
139
+ #
140
+ # @param mode [Symbol, ContextDev::Models::MonitorListResponse::Data::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ
141
+ #
142
+ # @param name [String]
143
+ #
144
+ # @param schedule [ContextDev::Models::MonitorListResponse::Data::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever
145
+ #
146
+ # @param status [Symbol, ContextDev::Models::MonitorListResponse::Data::Status] Monitor lifecycle status. `failed` means the most recent run failed (see the mon
147
+ #
148
+ # @param target [ContextDev::Models::MonitorListResponse::Data::Target::Page, ContextDev::Models::MonitorListResponse::Data::Target::Sitemap, ContextDev::Models::MonitorListResponse::Data::Target::Extract] Discriminated union describing what the monitor watches.
149
+ #
150
+ # @param updated_at [Time]
151
+ #
152
+ # @param baseline [ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline, nil] Current baseline: the last observed value the monitor compares new snapshots aga
153
+ #
154
+ # @param last_change_at [Time, nil]
155
+ #
156
+ # @param last_error [ContextDev::Models::MonitorListResponse::Data::LastError, nil] Error from the most recent failed run; null when the last run succeeded.
157
+ #
158
+ # @param last_run_at [Time, nil]
159
+ #
160
+ # @param next_run_at [Time, nil] When the next scheduled run is due.
161
+ #
162
+ # @param tags [Array<String>] User-defined tags for grouping and filtering monitors and their changes.
163
+ #
164
+ # @param webhook [ContextDev::Models::MonitorListResponse::Data::Webhook, nil]
165
+
166
+ # Discriminated union describing how changes are detected.
167
+ #
168
+ # @see ContextDev::Models::MonitorListResponse::Data#change_detection
169
+ module ChangeDetection
170
+ extend ContextDev::Internal::Type::Union
171
+
172
+ discriminator :type
173
+
174
+ # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
175
+ variant :exact, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact }
176
+
177
+ # Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`.
178
+ variant :semantic, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic }
179
+
180
+ class Exact < ContextDev::Internal::Type::BaseModel
181
+ # @!attribute type
182
+ #
183
+ # @return [Symbol, :exact]
184
+ required :type, const: :exact
185
+
186
+ # @!method initialize(type: :exact)
187
+ # Detect exact changes. For page targets, this means visible text diffs. For
188
+ # sitemap targets, this means URL additions and removals.
189
+ #
190
+ # @param type [Symbol, :exact]
191
+ end
192
+
193
+ class Semantic < ContextDev::Internal::Type::BaseModel
194
+ # @!attribute type
195
+ #
196
+ # @return [Symbol, :semantic]
197
+ required :type, const: :semantic
198
+
199
+ # @!attribute confidence_threshold
200
+ #
201
+ # @return [Float, nil]
202
+ optional :confidence_threshold, Float
203
+
204
+ # @!method initialize(confidence_threshold: nil, type: :semantic)
205
+ # Detect meaning-level changes to the extracted data, ignoring cosmetic or
206
+ # paraphrase-only differences. What is watched is determined by the extract
207
+ # target's `schema` and `instructions`.
208
+ #
209
+ # @param confidence_threshold [Float]
210
+ # @param type [Symbol, :semantic]
211
+ end
212
+
213
+ # @!method self.variants
214
+ # @return [Array(ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact, ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic)]
215
+ end
216
+
217
+ # Top-level monitor category. Always `web` today; the concrete behavior is
218
+ # described by `target` and `change_detection`.
219
+ #
220
+ # @see ContextDev::Models::MonitorListResponse::Data#mode
221
+ module Mode
222
+ extend ContextDev::Internal::Type::Enum
223
+
224
+ WEB = :web
225
+
226
+ # @!method self.values
227
+ # @return [Array<Symbol>]
228
+ end
229
+
230
+ # @see ContextDev::Models::MonitorListResponse::Data#schedule
231
+ class Schedule < ContextDev::Internal::Type::BaseModel
232
+ # @!attribute frequency
233
+ # Number of units between runs. The resulting interval (frequency × unit) must be
234
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
235
+ # maximum 365 when unit is days).
236
+ #
237
+ # @return [Integer]
238
+ required :frequency, Integer
239
+
240
+ # @!attribute type
241
+ #
242
+ # @return [Symbol, ContextDev::Models::MonitorListResponse::Data::Schedule::Type]
243
+ required :type, enum: -> { ContextDev::Models::MonitorListResponse::Data::Schedule::Type }
244
+
245
+ # @!attribute unit
246
+ #
247
+ # @return [Symbol, ContextDev::Models::MonitorListResponse::Data::Schedule::Unit]
248
+ required :unit, enum: -> { ContextDev::Models::MonitorListResponse::Data::Schedule::Unit }
249
+
250
+ # @!method initialize(frequency:, type:, unit:)
251
+ # Some parameter documentations has been truncated, see
252
+ # {ContextDev::Models::MonitorListResponse::Data::Schedule} for more details.
253
+ #
254
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
255
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
256
+ # between 10 minutes and 1 year.
257
+ #
258
+ # @param frequency [Integer] Number of units between runs. The resulting interval (frequency × unit) must be
259
+ #
260
+ # @param type [Symbol, ContextDev::Models::MonitorListResponse::Data::Schedule::Type]
261
+ #
262
+ # @param unit [Symbol, ContextDev::Models::MonitorListResponse::Data::Schedule::Unit]
263
+
264
+ # @see ContextDev::Models::MonitorListResponse::Data::Schedule#type
265
+ module Type
266
+ extend ContextDev::Internal::Type::Enum
267
+
268
+ INTERVAL = :interval
269
+
270
+ # @!method self.values
271
+ # @return [Array<Symbol>]
272
+ end
273
+
274
+ # @see ContextDev::Models::MonitorListResponse::Data::Schedule#unit
275
+ module Unit
276
+ extend ContextDev::Internal::Type::Enum
277
+
278
+ MINUTES = :minutes
279
+ HOURS = :hours
280
+ DAYS = :days
281
+
282
+ # @!method self.values
283
+ # @return [Array<Symbol>]
284
+ end
285
+ end
286
+
287
+ # Monitor lifecycle status. `failed` means the most recent run failed (see the
288
+ # monitor's `last_error`); failed monitors keep running on schedule and flip back
289
+ # to `active` on the next successful run. Monitors are auto-`paused` after
290
+ # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
291
+ # status to `active`.
292
+ #
293
+ # @see ContextDev::Models::MonitorListResponse::Data#status
294
+ module Status
295
+ extend ContextDev::Internal::Type::Enum
296
+
297
+ ACTIVE = :active
298
+ PAUSED = :paused
299
+ FAILED = :failed
300
+
301
+ # @!method self.values
302
+ # @return [Array<Symbol>]
303
+ end
304
+
305
+ # Discriminated union describing what the monitor watches.
306
+ #
307
+ # @see ContextDev::Models::MonitorListResponse::Data#target
308
+ module Target
309
+ extend ContextDev::Internal::Type::Union
310
+
311
+ discriminator :type
312
+
313
+ # Watch a single web page.
314
+ variant :page, -> { ContextDev::Models::MonitorListResponse::Data::Target::Page }
315
+
316
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
317
+ variant :sitemap, -> { ContextDev::Models::MonitorListResponse::Data::Target::Sitemap }
318
+
319
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl.
320
+ variant :extract, -> { ContextDev::Models::MonitorListResponse::Data::Target::Extract }
321
+
322
+ class Page < ContextDev::Internal::Type::BaseModel
323
+ # @!attribute type
324
+ #
325
+ # @return [Symbol, :page]
326
+ required :type, const: :page
327
+
328
+ # @!attribute url
329
+ #
330
+ # @return [String]
331
+ required :url, String
332
+
333
+ # @!attribute normalize_whitespace
334
+ # Normalize whitespace before comparing or analyzing text.
335
+ #
336
+ # @return [Boolean, nil]
337
+ optional :normalize_whitespace, ContextDev::Internal::Type::Boolean
338
+
339
+ # @!method initialize(url:, normalize_whitespace: nil, type: :page)
340
+ # Watch a single web page.
341
+ #
342
+ # @param url [String]
343
+ #
344
+ # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text.
345
+ #
346
+ # @param type [Symbol, :page]
347
+ end
348
+
349
+ class Sitemap < ContextDev::Internal::Type::BaseModel
350
+ # @!attribute type
351
+ #
352
+ # @return [Symbol, :sitemap]
353
+ required :type, const: :sitemap
354
+
355
+ # @!attribute url
356
+ # Sitemap URL to monitor.
357
+ #
358
+ # @return [String]
359
+ required :url, String
360
+
361
+ # @!attribute exclude
362
+ # URL path patterns to exclude.
363
+ #
364
+ # @return [Array<String>, nil]
365
+ optional :exclude, ContextDev::Internal::Type::ArrayOf[String]
366
+
367
+ # @!attribute include
368
+ # URL path patterns to include.
369
+ #
370
+ # @return [Array<String>, nil]
371
+ optional :include, ContextDev::Internal::Type::ArrayOf[String]
372
+
373
+ # @!attribute max_urls
374
+ # Maximum number of sitemap URLs to track (capped at 10,000).
375
+ #
376
+ # @return [Integer, nil]
377
+ optional :max_urls, Integer
378
+
379
+ # @!method initialize(url:, exclude: nil, include: nil, max_urls: nil, type: :sitemap)
380
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
381
+ # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
382
+ # and its subdomains before comparison. On a detected difference the sitemap is
383
+ # re-fetched within the same run and only URLs both observations agree on are
384
+ # reported, suppressing transient crawl flaps.
385
+ #
386
+ # @param url [String] Sitemap URL to monitor.
387
+ #
388
+ # @param exclude [Array<String>] URL path patterns to exclude.
389
+ #
390
+ # @param include [Array<String>] URL path patterns to include.
391
+ #
392
+ # @param max_urls [Integer] Maximum number of sitemap URLs to track (capped at 10,000).
393
+ #
394
+ # @param type [Symbol, :sitemap]
395
+ end
396
+
397
+ class Extract < ContextDev::Internal::Type::BaseModel
398
+ # @!attribute instructions
399
+ # Natural-language instructions guiding which pages and facts to track and which
400
+ # changes to report.
401
+ #
402
+ # @return [String]
403
+ required :instructions, String
404
+
405
+ # @!attribute type
406
+ #
407
+ # @return [Symbol, :extract]
408
+ required :type, const: :extract
409
+
410
+ # @!attribute url
411
+ # Root URL to extract structured data from.
412
+ #
413
+ # @return [String]
414
+ required :url, String
415
+
416
+ # @!attribute follow_subdomains
417
+ #
418
+ # @return [Boolean, nil]
419
+ optional :follow_subdomains, ContextDev::Internal::Type::Boolean
420
+
421
+ # @!attribute max_depth
422
+ # Optional maximum link depth from the starting URL (0 = only the starting page).
423
+ #
424
+ # @return [Integer, nil]
425
+ optional :max_depth, Integer
426
+
427
+ # @!attribute max_pages
428
+ # Maximum number of pages to track.
429
+ #
430
+ # @return [Integer, nil]
431
+ optional :max_pages, Integer
432
+
433
+ # @!attribute schema
434
+ # JSON Schema describing the data you care about. It guides which pages are
435
+ # selected for tracking and gives the change judge context on what matters. If
436
+ # omitted, a default summary + key-points schema is used.
437
+ #
438
+ # @return [Hash{Symbol=>Object}, nil]
439
+ optional :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
440
+
441
+ # @!method initialize(instructions:, url:, follow_subdomains: nil, max_depth: nil, max_pages: nil, schema: nil, type: :extract)
442
+ # Some parameter documentations has been truncated, see
443
+ # {ContextDev::Models::MonitorListResponse::Data::Target::Extract} for more
444
+ # details.
445
+ #
446
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
447
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
448
+ # track; each run re-checks exactly those pages, and confirmed content changes are
449
+ # judged against the monitor's instructions. The tracked page set is refreshed by
450
+ # a periodic re-discovery crawl.
451
+ #
452
+ # @param instructions [String] Natural-language instructions guiding which pages and facts to track and which c
453
+ #
454
+ # @param url [String] Root URL to extract structured data from.
455
+ #
456
+ # @param follow_subdomains [Boolean]
457
+ #
458
+ # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page).
459
+ #
460
+ # @param max_pages [Integer] Maximum number of pages to track.
461
+ #
462
+ # @param schema [Hash{Symbol=>Object}] JSON Schema describing the data you care about. It guides which pages are select
463
+ #
464
+ # @param type [Symbol, :extract]
465
+ end
466
+
467
+ # @!method self.variants
468
+ # @return [Array(ContextDev::Models::MonitorListResponse::Data::Target::Page, ContextDev::Models::MonitorListResponse::Data::Target::Sitemap, ContextDev::Models::MonitorListResponse::Data::Target::Extract)]
469
+ end
470
+
471
+ # Current baseline: the last observed value the monitor compares new snapshots
472
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
473
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
474
+ # after a target or change_detection update, which resets the baseline).
475
+ #
476
+ # @see ContextDev::Models::MonitorListResponse::Data#baseline
477
+ module Baseline
478
+ extend ContextDev::Internal::Type::Union
479
+
480
+ # Current baseline of a `page` monitor: the visible page text as last observed.
481
+ variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline }
482
+
483
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
484
+ variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline }
485
+
486
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
487
+ variant -> { ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline }
488
+
489
+ class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
490
+ # @!attribute captured_at
491
+ # When this baseline was last captured or replaced.
492
+ #
493
+ # @return [Time]
494
+ required :captured_at, Time
495
+
496
+ # @!attribute text
497
+ # The page's visible text as last observed.
498
+ #
499
+ # @return [String]
500
+ required :text, String
501
+
502
+ # @!method initialize(captured_at:, text:)
503
+ # Current baseline of a `page` monitor: the visible page text as last observed.
504
+ #
505
+ # @param captured_at [Time] When this baseline was last captured or replaced.
506
+ #
507
+ # @param text [String] The page's visible text as last observed.
508
+ end
509
+
510
+ class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
511
+ # @!attribute captured_at
512
+ # When this baseline was last captured or replaced.
513
+ #
514
+ # @return [Time]
515
+ required :captured_at, Time
516
+
517
+ # @!attribute url_count
518
+ # Number of URLs in the baseline.
519
+ #
520
+ # @return [Integer]
521
+ required :url_count, Integer
522
+
523
+ # @!attribute urls
524
+ # The sitemap URLs as last observed (sorted, normalized).
525
+ #
526
+ # @return [Array<String>]
527
+ required :urls, ContextDev::Internal::Type::ArrayOf[String]
528
+
529
+ # @!method initialize(captured_at:, url_count:, urls:)
530
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last
531
+ # observed.
532
+ #
533
+ # @param captured_at [Time] When this baseline was last captured or replaced.
534
+ #
535
+ # @param url_count [Integer] Number of URLs in the baseline.
536
+ #
537
+ # @param urls [Array<String>] The sitemap URLs as last observed (sorted, normalized).
538
+ end
539
+
540
+ class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
541
+ # @!attribute captured_at
542
+ # When this baseline was last captured or replaced.
543
+ #
544
+ # @return [Time]
545
+ required :captured_at, Time
546
+
547
+ # @!attribute data
548
+ # The extracted structured data, matching the monitor's extraction schema (same
549
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
550
+ # re-discovers its page set (at most about once a day); `null` when no extraction
551
+ # has been captured yet.
552
+ #
553
+ # @return [Object]
554
+ required :data, ContextDev::Internal::Type::Unknown
555
+
556
+ # @!attribute urls_analyzed
557
+ # The page URLs the monitor tracks and analyzes for changes.
558
+ #
559
+ # @return [Array<String>]
560
+ required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String]
561
+
562
+ # @!method initialize(captured_at:, data:, urls_analyzed:)
563
+ # Some parameter documentations has been truncated, see
564
+ # {ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline}
565
+ # for more details.
566
+ #
567
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured
568
+ # data as last extracted.
569
+ #
570
+ # @param captured_at [Time] When this baseline was last captured or replaced.
571
+ #
572
+ # @param data [Object] The extracted structured data, matching the monitor's extraction schema (same sh
573
+ #
574
+ # @param urls_analyzed [Array<String>] The page URLs the monitor tracks and analyzes for changes.
575
+ end
576
+
577
+ # @!method self.variants
578
+ # @return [Array(ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsPageBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsSitemapBaseline, ContextDev::Models::MonitorListResponse::Data::Baseline::MonitorsExtractBaseline)]
579
+ end
580
+
581
+ # @see ContextDev::Models::MonitorListResponse::Data#last_error
582
+ class LastError < ContextDev::Internal::Type::BaseModel
583
+ # @!attribute code
584
+ #
585
+ # @return [String]
586
+ required :code, String
587
+
588
+ # @!attribute message
589
+ #
590
+ # @return [String]
591
+ required :message, String
592
+
593
+ # @!method initialize(code:, message:)
594
+ # Error from the most recent failed run; null when the last run succeeded.
595
+ #
596
+ # @param code [String]
597
+ # @param message [String]
598
+ end
599
+
600
+ # @see ContextDev::Models::MonitorListResponse::Data#webhook
601
+ class Webhook < ContextDev::Internal::Type::BaseModel
602
+ # @!attribute url
603
+ # Webhook URL called when a change is detected.
604
+ #
605
+ # @return [String]
606
+ required :url, String
607
+
608
+ response_only do
609
+ # @!attribute secret
610
+ # Signing secret used to verify webhook authenticity. Each delivery includes an
611
+ # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
612
+ # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
613
+ # compare and reject stale timestamps to prevent replay. Generated by the API;
614
+ # cannot be set by clients.
615
+ #
616
+ # @return [String, nil]
617
+ optional :secret, String
618
+ end
619
+
620
+ # @!method initialize(url:, secret: nil)
621
+ # Some parameter documentations has been truncated, see
622
+ # {ContextDev::Models::MonitorListResponse::Data::Webhook} for more details.
623
+ #
624
+ # @param url [String] Webhook URL called when a change is detected.
625
+ #
626
+ # @param secret [String] Signing secret used to verify webhook authenticity. Each delivery includes an `X
627
+ end
628
+ end
629
+ end
630
+ end
631
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Monitors#list_runs
6
+ class MonitorListRunsParams < ContextDev::Internal::Type::BaseModel
7
+ extend ContextDev::Internal::Type::RequestParameters::Converter
8
+ include ContextDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute monitor_id
11
+ #
12
+ # @return [String]
13
+ required :monitor_id, String
14
+
15
+ # @!attribute cursor
16
+ #
17
+ # @return [String, nil]
18
+ optional :cursor, String
19
+
20
+ # @!attribute limit
21
+ #
22
+ # @return [Integer, nil]
23
+ optional :limit, Integer
24
+
25
+ # @!attribute status
26
+ # Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
27
+ # (insufficient credits, monitor paused, or superseded by a concurrent run).
28
+ #
29
+ # @return [Symbol, ContextDev::Models::MonitorListRunsParams::Status, nil]
30
+ optional :status, enum: -> { ContextDev::MonitorListRunsParams::Status }
31
+
32
+ # @!method initialize(monitor_id:, cursor: nil, limit: nil, status: nil, request_options: {})
33
+ # Some parameter documentations has been truncated, see
34
+ # {ContextDev::Models::MonitorListRunsParams} for more details.
35
+ #
36
+ # @param monitor_id [String]
37
+ #
38
+ # @param cursor [String]
39
+ #
40
+ # @param limit [Integer]
41
+ #
42
+ # @param status [Symbol, ContextDev::Models::MonitorListRunsParams::Status] Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (in
43
+ #
44
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
45
+
46
+ # Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
47
+ # (insufficient credits, monitor paused, or superseded by a concurrent run).
48
+ module Status
49
+ extend ContextDev::Internal::Type::Enum
50
+
51
+ QUEUED = :queued
52
+ RUNNING = :running
53
+ COMPLETED = :completed
54
+ FAILED = :failed
55
+ SKIPPED = :skipped
56
+
57
+ # @!method self.values
58
+ # @return [Array<Symbol>]
59
+ end
60
+ end
61
+ end
62
+ end