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