context.dev 2.18.0 → 2.19.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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +0 -4
  5. data/lib/context_dev/models/monitor_retrieve_run_params.rb +26 -0
  6. data/lib/context_dev/models/monitor_retrieve_run_response.rb +232 -0
  7. data/lib/context_dev/models/monitor_rotate_webhook_secret_params.rb +20 -0
  8. data/lib/context_dev/models/monitor_rotate_webhook_secret_response.rb +765 -0
  9. data/lib/context_dev/models/{web_web_scrape_sitemap_params.rb → web_map_urls_params.rb} +14 -14
  10. data/lib/context_dev/models/web_map_urls_response.rb +123 -0
  11. data/lib/context_dev/models/web_scrape_params.rb +906 -0
  12. data/lib/context_dev/models/web_scrape_response.rb +659 -0
  13. data/lib/context_dev/models/web_screenshot_params.rb +15 -1
  14. data/lib/context_dev/models/web_screenshot_response.rb +3 -3
  15. data/lib/context_dev/models.rb +8 -22
  16. data/lib/context_dev/resources/brand.rb +0 -36
  17. data/lib/context_dev/resources/monitors.rb +47 -0
  18. data/lib/context_dev/resources/web.rb +106 -486
  19. data/lib/context_dev/version.rb +1 -1
  20. data/lib/context_dev.rb +8 -23
  21. data/rbi/context_dev/client.rbi +0 -3
  22. data/rbi/context_dev/models/monitor_retrieve_run_params.rbi +46 -0
  23. data/rbi/context_dev/models/monitor_retrieve_run_response.rbi +452 -0
  24. data/rbi/context_dev/models/monitor_rotate_webhook_secret_params.rbi +38 -0
  25. data/rbi/context_dev/models/monitor_rotate_webhook_secret_response.rbi +1367 -0
  26. data/rbi/context_dev/models/{web_web_scrape_sitemap_params.rbi → web_map_urls_params.rbi} +23 -45
  27. data/rbi/context_dev/models/web_map_urls_response.rbi +226 -0
  28. data/rbi/context_dev/models/web_scrape_params.rbi +2000 -0
  29. data/rbi/context_dev/models/{web_web_scrape_html_response.rbi → web_scrape_response.rbi} +539 -510
  30. data/rbi/context_dev/models/web_screenshot_params.rbi +23 -0
  31. data/rbi/context_dev/models/web_screenshot_response.rbi +4 -4
  32. data/rbi/context_dev/models.rbi +9 -24
  33. data/rbi/context_dev/resources/brand.rbi +0 -35
  34. data/rbi/context_dev/resources/monitors.rbi +24 -0
  35. data/rbi/context_dev/resources/web.rbi +135 -654
  36. data/sig/context_dev/client.rbs +0 -2
  37. data/sig/context_dev/models/monitor_retrieve_run_params.rbs +28 -0
  38. data/sig/context_dev/models/monitor_retrieve_run_response.rbs +182 -0
  39. data/sig/context_dev/models/monitor_rotate_webhook_secret_params.rbs +23 -0
  40. data/sig/context_dev/models/monitor_rotate_webhook_secret_response.rbs +545 -0
  41. data/sig/context_dev/models/{web_web_scrape_sitemap_params.rbs → web_map_urls_params.rbs} +22 -22
  42. data/sig/context_dev/models/web_map_urls_response.rbs +125 -0
  43. data/sig/context_dev/models/web_scrape_params.rbs +834 -0
  44. data/sig/context_dev/models/web_scrape_response.rbs +552 -0
  45. data/sig/context_dev/models/web_screenshot_params.rbs +7 -0
  46. data/sig/context_dev/models.rbs +8 -22
  47. data/sig/context_dev/resources/brand.rbs +0 -9
  48. data/sig/context_dev/resources/monitors.rbs +11 -0
  49. data/sig/context_dev/resources/web.rbs +30 -128
  50. metadata +26 -71
  51. data/lib/context_dev/models/ai_extract_product_params.rb +0 -125
  52. data/lib/context_dev/models/ai_extract_product_response.rb +0 -402
  53. data/lib/context_dev/models/ai_extract_products_params.rb +0 -233
  54. data/lib/context_dev/models/ai_extract_products_response.rb +0 -370
  55. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +0 -120
  56. data/lib/context_dev/models/brand_retrieve_simplified_response.rb +0 -441
  57. data/lib/context_dev/models/web_extract_fonts_params.rb +0 -114
  58. data/lib/context_dev/models/web_extract_fonts_response.rb +0 -291
  59. data/lib/context_dev/models/web_extract_params.rb +0 -419
  60. data/lib/context_dev/models/web_extract_response.rb +0 -287
  61. data/lib/context_dev/models/web_web_scrape_bytes_params.rb +0 -346
  62. data/lib/context_dev/models/web_web_scrape_bytes_response.rb +0 -135
  63. data/lib/context_dev/models/web_web_scrape_html_params.rb +0 -812
  64. data/lib/context_dev/models/web_web_scrape_html_response.rb +0 -628
  65. data/lib/context_dev/models/web_web_scrape_images_params.rb +0 -373
  66. data/lib/context_dev/models/web_web_scrape_images_response.rb +0 -409
  67. data/lib/context_dev/models/web_web_scrape_md_params.rb +0 -670
  68. data/lib/context_dev/models/web_web_scrape_md_response.rb +0 -567
  69. data/lib/context_dev/models/web_web_scrape_screenshot_params.rb +0 -471
  70. data/lib/context_dev/models/web_web_scrape_screenshot_response.rb +0 -169
  71. data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +0 -144
  72. data/lib/context_dev/resources/ai.rb +0 -71
  73. data/rbi/context_dev/models/ai_extract_product_params.rbi +0 -253
  74. data/rbi/context_dev/models/ai_extract_product_response.rbi +0 -791
  75. data/rbi/context_dev/models/ai_extract_products_params.rbi +0 -490
  76. data/rbi/context_dev/models/ai_extract_products_response.rbi +0 -718
  77. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +0 -256
  78. data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +0 -1040
  79. data/rbi/context_dev/models/web_extract_fonts_params.rbi +0 -223
  80. data/rbi/context_dev/models/web_extract_fonts_response.rbi +0 -563
  81. data/rbi/context_dev/models/web_extract_params.rbi +0 -781
  82. data/rbi/context_dev/models/web_extract_response.rbi +0 -512
  83. data/rbi/context_dev/models/web_web_scrape_bytes_params.rbi +0 -702
  84. data/rbi/context_dev/models/web_web_scrape_bytes_response.rbi +0 -238
  85. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +0 -1690
  86. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +0 -728
  87. data/rbi/context_dev/models/web_web_scrape_images_response.rbi +0 -910
  88. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +0 -1052
  89. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +0 -1088
  90. data/rbi/context_dev/models/web_web_scrape_screenshot_params.rbi +0 -1580
  91. data/rbi/context_dev/models/web_web_scrape_screenshot_response.rbi +0 -332
  92. data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +0 -258
  93. data/rbi/context_dev/resources/ai.rbi +0 -63
  94. data/sig/context_dev/models/ai_extract_product_params.rbs +0 -106
  95. data/sig/context_dev/models/ai_extract_product_response.rbs +0 -314
  96. data/sig/context_dev/models/ai_extract_products_params.rbs +0 -202
  97. data/sig/context_dev/models/ai_extract_products_response.rbs +0 -293
  98. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +0 -104
  99. data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +0 -413
  100. data/sig/context_dev/models/web_extract_fonts_params.rbs +0 -93
  101. data/sig/context_dev/models/web_extract_fonts_response.rbs +0 -230
  102. data/sig/context_dev/models/web_extract_params.rbs +0 -324
  103. data/sig/context_dev/models/web_extract_response.rbs +0 -239
  104. data/sig/context_dev/models/web_web_scrape_bytes_params.rbs +0 -531
  105. data/sig/context_dev/models/web_web_scrape_bytes_response.rbs +0 -108
  106. data/sig/context_dev/models/web_web_scrape_html_params.rbs +0 -878
  107. data/sig/context_dev/models/web_web_scrape_html_response.rbs +0 -525
  108. data/sig/context_dev/models/web_web_scrape_images_params.rbs +0 -281
  109. data/sig/context_dev/models/web_web_scrape_images_response.rbs +0 -371
  110. data/sig/context_dev/models/web_web_scrape_md_params.rbs +0 -758
  111. data/sig/context_dev/models/web_web_scrape_md_response.rbs +0 -465
  112. data/sig/context_dev/models/web_web_scrape_screenshot_params.rbs +0 -619
  113. data/sig/context_dev/models/web_web_scrape_screenshot_response.rbs +0 -127
  114. data/sig/context_dev/models/web_web_scrape_sitemap_response.rbs +0 -117
  115. data/sig/context_dev/resources/ai.rbs +0 -21
@@ -0,0 +1,2000 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class WebScrapeParams < ContextDev::Internal::Type::BaseModel
6
+ extend ContextDev::Internal::Type::RequestParameters::Converter
7
+ include ContextDev::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(ContextDev::WebScrapeParams, ContextDev::Internal::AnyHash)
12
+ end
13
+
14
+ # Outputs to return. Enable at least one; omitted formats are false.
15
+ sig { returns(ContextDev::WebScrapeParams::Formats) }
16
+ attr_reader :formats
17
+
18
+ sig { params(formats: ContextDev::WebScrapeParams::Formats::OrHash).void }
19
+ attr_writer :formats
20
+
21
+ # The URL to scrape.
22
+ sig { returns(String) }
23
+ attr_accessor :url
24
+
25
+ # Image options. Requires formats.images: true.
26
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::ImageParams)) }
27
+ attr_reader :image_params
28
+
29
+ sig do
30
+ params(
31
+ image_params: ContextDev::WebScrapeParams::ImageParams::OrHash
32
+ ).void
33
+ end
34
+ attr_writer :image_params
35
+
36
+ # Markdown options. Requires formats.markdown: true.
37
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::MarkdownParams)) }
38
+ attr_reader :markdown_params
39
+
40
+ sig do
41
+ params(
42
+ markdown_params: ContextDev::WebScrapeParams::MarkdownParams::OrHash
43
+ ).void
44
+ end
45
+ attr_writer :markdown_params
46
+
47
+ # Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and
48
+ # updates the requested outputs. Compatible outputs are shared with the individual
49
+ # scrape endpoints. Image results with hosted files refresh after 23 hours; other
50
+ # outputs retain their own freshness.
51
+ sig { returns(T.nilable(Integer)) }
52
+ attr_reader :max_age_ms
53
+
54
+ sig { params(max_age_ms: Integer).void }
55
+ attr_writer :max_age_ms
56
+
57
+ # Required when formats.parse is true.
58
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::ParseParams)) }
59
+ attr_reader :parse_params
60
+
61
+ sig do
62
+ params(
63
+ parse_params: ContextDev::WebScrapeParams::ParseParams::OrHash
64
+ ).void
65
+ end
66
+ attr_writer :parse_params
67
+
68
+ # Screenshot options. Requires formats.screenshot: true.
69
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::ScreenshotParams)) }
70
+ attr_reader :screenshot_params
71
+
72
+ sig do
73
+ params(
74
+ screenshot_params:
75
+ ContextDev::WebScrapeParams::ScreenshotParams::OrHash
76
+ ).void
77
+ end
78
+ attr_writer :screenshot_params
79
+
80
+ # Shared browser and content settings. Content filters leave screenshots and
81
+ # original bytes unchanged.
82
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::SharedParams)) }
83
+ attr_reader :shared_params
84
+
85
+ sig do
86
+ params(
87
+ shared_params: ContextDev::WebScrapeParams::SharedParams::OrHash
88
+ ).void
89
+ end
90
+ attr_writer :shared_params
91
+
92
+ # Labels for tracking request usage. Not retained when zdr is enabled.
93
+ sig { returns(T.nilable(T::Array[String])) }
94
+ attr_reader :tags
95
+
96
+ sig { params(tags: T::Array[String]).void }
97
+ attr_writer :tags
98
+
99
+ # Total deadline, including navigation, actions, waiting, and all outputs.
100
+ # Defaults to 60000 milliseconds with behavior fail. Use return-partial to capture
101
+ # the current page state and return captured images if image processing cannot
102
+ # finish before the deadline; these responses set isPartial and are not cached.
103
+ # Every requested format must still be available. Fixed waits must fit before a
104
+ # response reserve of up to 5000 milliseconds (at most one quarter of the timeout)
105
+ # when using return-partial.
106
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::TimeoutOpts)) }
107
+ attr_reader :timeout_opts
108
+
109
+ sig do
110
+ params(
111
+ timeout_opts: ContextDev::WebScrapeParams::TimeoutOpts::OrHash
112
+ ).void
113
+ end
114
+ attr_writer :timeout_opts
115
+
116
+ # Zero data retention. Bypasses caches and uploads; excludes request/response
117
+ # content and tags from logs. Must be enabled for your organization.
118
+ sig { returns(T.nilable(ContextDev::WebScrapeParams::Zdr::OrSymbol)) }
119
+ attr_reader :zdr
120
+
121
+ sig { params(zdr: ContextDev::WebScrapeParams::Zdr::OrSymbol).void }
122
+ attr_writer :zdr
123
+
124
+ sig do
125
+ params(
126
+ formats: ContextDev::WebScrapeParams::Formats::OrHash,
127
+ url: String,
128
+ image_params: ContextDev::WebScrapeParams::ImageParams::OrHash,
129
+ markdown_params: ContextDev::WebScrapeParams::MarkdownParams::OrHash,
130
+ max_age_ms: Integer,
131
+ parse_params: ContextDev::WebScrapeParams::ParseParams::OrHash,
132
+ screenshot_params:
133
+ ContextDev::WebScrapeParams::ScreenshotParams::OrHash,
134
+ shared_params: ContextDev::WebScrapeParams::SharedParams::OrHash,
135
+ tags: T::Array[String],
136
+ timeout_opts: ContextDev::WebScrapeParams::TimeoutOpts::OrHash,
137
+ zdr: ContextDev::WebScrapeParams::Zdr::OrSymbol,
138
+ request_options: ContextDev::RequestOptions::OrHash
139
+ ).returns(T.attached_class)
140
+ end
141
+ def self.new(
142
+ # Outputs to return. Enable at least one; omitted formats are false.
143
+ formats:,
144
+ # The URL to scrape.
145
+ url:,
146
+ # Image options. Requires formats.images: true.
147
+ image_params: nil,
148
+ # Markdown options. Requires formats.markdown: true.
149
+ markdown_params: nil,
150
+ # Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and
151
+ # updates the requested outputs. Compatible outputs are shared with the individual
152
+ # scrape endpoints. Image results with hosted files refresh after 23 hours; other
153
+ # outputs retain their own freshness.
154
+ max_age_ms: nil,
155
+ # Required when formats.parse is true.
156
+ parse_params: nil,
157
+ # Screenshot options. Requires formats.screenshot: true.
158
+ screenshot_params: nil,
159
+ # Shared browser and content settings. Content filters leave screenshots and
160
+ # original bytes unchanged.
161
+ shared_params: nil,
162
+ # Labels for tracking request usage. Not retained when zdr is enabled.
163
+ tags: nil,
164
+ # Total deadline, including navigation, actions, waiting, and all outputs.
165
+ # Defaults to 60000 milliseconds with behavior fail. Use return-partial to capture
166
+ # the current page state and return captured images if image processing cannot
167
+ # finish before the deadline; these responses set isPartial and are not cached.
168
+ # Every requested format must still be available. Fixed waits must fit before a
169
+ # response reserve of up to 5000 milliseconds (at most one quarter of the timeout)
170
+ # when using return-partial.
171
+ timeout_opts: nil,
172
+ # Zero data retention. Bypasses caches and uploads; excludes request/response
173
+ # content and tags from logs. Must be enabled for your organization.
174
+ zdr: nil,
175
+ request_options: {}
176
+ )
177
+ end
178
+
179
+ sig do
180
+ override.returns(
181
+ {
182
+ formats: ContextDev::WebScrapeParams::Formats,
183
+ url: String,
184
+ image_params: ContextDev::WebScrapeParams::ImageParams,
185
+ markdown_params: ContextDev::WebScrapeParams::MarkdownParams,
186
+ max_age_ms: Integer,
187
+ parse_params: ContextDev::WebScrapeParams::ParseParams,
188
+ screenshot_params: ContextDev::WebScrapeParams::ScreenshotParams,
189
+ shared_params: ContextDev::WebScrapeParams::SharedParams,
190
+ tags: T::Array[String],
191
+ timeout_opts: ContextDev::WebScrapeParams::TimeoutOpts,
192
+ zdr: ContextDev::WebScrapeParams::Zdr::OrSymbol,
193
+ request_options: ContextDev::RequestOptions
194
+ }
195
+ )
196
+ end
197
+ def to_hash
198
+ end
199
+
200
+ class Formats < ContextDev::Internal::Type::BaseModel
201
+ OrHash =
202
+ T.type_alias do
203
+ T.any(
204
+ ContextDev::WebScrapeParams::Formats,
205
+ ContextDev::Internal::AnyHash
206
+ )
207
+ end
208
+
209
+ # The original HTTP response body.
210
+ sig { returns(T.nilable(T::Boolean)) }
211
+ attr_reader :bytes
212
+
213
+ sig { params(bytes: T::Boolean).void }
214
+ attr_writer :bytes
215
+
216
+ # Rendered HTML.
217
+ sig { returns(T.nilable(T::Boolean)) }
218
+ attr_reader :html
219
+
220
+ sig { params(html: T::Boolean).void }
221
+ attr_writer :html
222
+
223
+ # Images found on the page.
224
+ sig { returns(T.nilable(T::Boolean)) }
225
+ attr_reader :images
226
+
227
+ sig { params(images: T::Boolean).void }
228
+ attr_writer :images
229
+
230
+ # Page content as Markdown.
231
+ sig { returns(T.nilable(T::Boolean)) }
232
+ attr_reader :markdown
233
+
234
+ sig { params(markdown: T::Boolean).void }
235
+ attr_writer :markdown
236
+
237
+ # Fields selected by parseParams.rules.
238
+ sig { returns(T.nilable(T::Boolean)) }
239
+ attr_reader :parse
240
+
241
+ sig { params(parse: T::Boolean).void }
242
+ attr_writer :parse
243
+
244
+ # An inline image of the page.
245
+ sig { returns(T.nilable(T::Boolean)) }
246
+ attr_reader :screenshot
247
+
248
+ sig { params(screenshot: T::Boolean).void }
249
+ attr_writer :screenshot
250
+
251
+ # Outputs to return. Enable at least one; omitted formats are false.
252
+ sig do
253
+ params(
254
+ bytes: T::Boolean,
255
+ html: T::Boolean,
256
+ images: T::Boolean,
257
+ markdown: T::Boolean,
258
+ parse: T::Boolean,
259
+ screenshot: T::Boolean
260
+ ).returns(T.attached_class)
261
+ end
262
+ def self.new(
263
+ # The original HTTP response body.
264
+ bytes: nil,
265
+ # Rendered HTML.
266
+ html: nil,
267
+ # Images found on the page.
268
+ images: nil,
269
+ # Page content as Markdown.
270
+ markdown: nil,
271
+ # Fields selected by parseParams.rules.
272
+ parse: nil,
273
+ # An inline image of the page.
274
+ screenshot: nil
275
+ )
276
+ end
277
+
278
+ sig do
279
+ override.returns(
280
+ {
281
+ bytes: T::Boolean,
282
+ html: T::Boolean,
283
+ images: T::Boolean,
284
+ markdown: T::Boolean,
285
+ parse: T::Boolean,
286
+ screenshot: T::Boolean
287
+ }
288
+ )
289
+ end
290
+ def to_hash
291
+ end
292
+ end
293
+
294
+ class ImageParams < ContextDev::Internal::Type::BaseModel
295
+ OrHash =
296
+ T.type_alias do
297
+ T.any(
298
+ ContextDev::WebScrapeParams::ImageParams,
299
+ ContextDev::Internal::AnyHash
300
+ )
301
+ end
302
+
303
+ # For visual duplicates, keep the largest image.
304
+ sig do
305
+ returns(
306
+ T.nilable(
307
+ ContextDev::WebScrapeParams::ImageParams::Dedupe::OrSymbol
308
+ )
309
+ )
310
+ end
311
+ attr_reader :dedupe
312
+
313
+ sig do
314
+ params(
315
+ dedupe: ContextDev::WebScrapeParams::ImageParams::Dedupe::OrSymbol
316
+ ).void
317
+ end
318
+ attr_writer :dedupe
319
+
320
+ # Add dimensions, a visual category, or a hosted file URL. Each image has a
321
+ # maximum processing time of 30000 milliseconds, bounded by the remaining request
322
+ # deadline.
323
+ sig do
324
+ returns(
325
+ T.nilable(
326
+ T::Array[
327
+ ContextDev::WebScrapeParams::ImageParams::Enrich::OrSymbol
328
+ ]
329
+ )
330
+ )
331
+ end
332
+ attr_reader :enrich
333
+
334
+ sig do
335
+ params(
336
+ enrich:
337
+ T::Array[
338
+ ContextDev::WebScrapeParams::ImageParams::Enrich::OrSymbol
339
+ ]
340
+ ).void
341
+ end
342
+ attr_writer :enrich
343
+
344
+ # Image options. Requires formats.images: true.
345
+ sig do
346
+ params(
347
+ dedupe: ContextDev::WebScrapeParams::ImageParams::Dedupe::OrSymbol,
348
+ enrich:
349
+ T::Array[
350
+ ContextDev::WebScrapeParams::ImageParams::Enrich::OrSymbol
351
+ ]
352
+ ).returns(T.attached_class)
353
+ end
354
+ def self.new(
355
+ # For visual duplicates, keep the largest image.
356
+ dedupe: nil,
357
+ # Add dimensions, a visual category, or a hosted file URL. Each image has a
358
+ # maximum processing time of 30000 milliseconds, bounded by the remaining request
359
+ # deadline.
360
+ enrich: nil
361
+ )
362
+ end
363
+
364
+ sig do
365
+ override.returns(
366
+ {
367
+ dedupe:
368
+ ContextDev::WebScrapeParams::ImageParams::Dedupe::OrSymbol,
369
+ enrich:
370
+ T::Array[
371
+ ContextDev::WebScrapeParams::ImageParams::Enrich::OrSymbol
372
+ ]
373
+ }
374
+ )
375
+ end
376
+ def to_hash
377
+ end
378
+
379
+ # For visual duplicates, keep the largest image.
380
+ module Dedupe
381
+ extend ContextDev::Internal::Type::Enum
382
+
383
+ TaggedSymbol =
384
+ T.type_alias do
385
+ T.all(Symbol, ContextDev::WebScrapeParams::ImageParams::Dedupe)
386
+ end
387
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
388
+
389
+ NONE =
390
+ T.let(
391
+ :none,
392
+ ContextDev::WebScrapeParams::ImageParams::Dedupe::TaggedSymbol
393
+ )
394
+ VISUAL =
395
+ T.let(
396
+ :visual,
397
+ ContextDev::WebScrapeParams::ImageParams::Dedupe::TaggedSymbol
398
+ )
399
+
400
+ sig do
401
+ override.returns(
402
+ T::Array[
403
+ ContextDev::WebScrapeParams::ImageParams::Dedupe::TaggedSymbol
404
+ ]
405
+ )
406
+ end
407
+ def self.values
408
+ end
409
+ end
410
+
411
+ module Enrich
412
+ extend ContextDev::Internal::Type::Enum
413
+
414
+ TaggedSymbol =
415
+ T.type_alias do
416
+ T.all(Symbol, ContextDev::WebScrapeParams::ImageParams::Enrich)
417
+ end
418
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
419
+
420
+ DIMENSIONS =
421
+ T.let(
422
+ :dimensions,
423
+ ContextDev::WebScrapeParams::ImageParams::Enrich::TaggedSymbol
424
+ )
425
+ CLASSIFICATION =
426
+ T.let(
427
+ :classification,
428
+ ContextDev::WebScrapeParams::ImageParams::Enrich::TaggedSymbol
429
+ )
430
+ FILE =
431
+ T.let(
432
+ :file,
433
+ ContextDev::WebScrapeParams::ImageParams::Enrich::TaggedSymbol
434
+ )
435
+
436
+ sig do
437
+ override.returns(
438
+ T::Array[
439
+ ContextDev::WebScrapeParams::ImageParams::Enrich::TaggedSymbol
440
+ ]
441
+ )
442
+ end
443
+ def self.values
444
+ end
445
+ end
446
+ end
447
+
448
+ class MarkdownParams < ContextDev::Internal::Type::BaseModel
449
+ OrHash =
450
+ T.type_alias do
451
+ T.any(
452
+ ContextDev::WebScrapeParams::MarkdownParams,
453
+ ContextDev::Internal::AnyHash
454
+ )
455
+ end
456
+
457
+ sig { returns(T.nilable(T::Boolean)) }
458
+ attr_reader :include_images
459
+
460
+ sig { params(include_images: T::Boolean).void }
461
+ attr_writer :include_images
462
+
463
+ sig { returns(T.nilable(T::Boolean)) }
464
+ attr_reader :include_links
465
+
466
+ sig { params(include_links: T::Boolean).void }
467
+ attr_writer :include_links
468
+
469
+ # Base64 images use placeholders by default. Requires includeImages: true.
470
+ sig do
471
+ returns(
472
+ T.nilable(
473
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::OrSymbol
474
+ )
475
+ )
476
+ end
477
+ attr_reader :inline_images
478
+
479
+ sig do
480
+ params(
481
+ inline_images:
482
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::OrSymbol
483
+ ).void
484
+ end
485
+ attr_writer :inline_images
486
+
487
+ # Markdown options. Requires formats.markdown: true.
488
+ sig do
489
+ params(
490
+ include_images: T::Boolean,
491
+ include_links: T::Boolean,
492
+ inline_images:
493
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::OrSymbol
494
+ ).returns(T.attached_class)
495
+ end
496
+ def self.new(
497
+ include_images: nil,
498
+ include_links: nil,
499
+ # Base64 images use placeholders by default. Requires includeImages: true.
500
+ inline_images: nil
501
+ )
502
+ end
503
+
504
+ sig do
505
+ override.returns(
506
+ {
507
+ include_images: T::Boolean,
508
+ include_links: T::Boolean,
509
+ inline_images:
510
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::OrSymbol
511
+ }
512
+ )
513
+ end
514
+ def to_hash
515
+ end
516
+
517
+ # Base64 images use placeholders by default. Requires includeImages: true.
518
+ module InlineImages
519
+ extend ContextDev::Internal::Type::Enum
520
+
521
+ TaggedSymbol =
522
+ T.type_alias do
523
+ T.all(
524
+ Symbol,
525
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages
526
+ )
527
+ end
528
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
529
+
530
+ PLACEHOLDER =
531
+ T.let(
532
+ :placeholder,
533
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::TaggedSymbol
534
+ )
535
+ PRESERVE =
536
+ T.let(
537
+ :preserve,
538
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::TaggedSymbol
539
+ )
540
+
541
+ sig do
542
+ override.returns(
543
+ T::Array[
544
+ ContextDev::WebScrapeParams::MarkdownParams::InlineImages::TaggedSymbol
545
+ ]
546
+ )
547
+ end
548
+ def self.values
549
+ end
550
+ end
551
+ end
552
+
553
+ class ParseParams < ContextDev::Internal::Type::BaseModel
554
+ OrHash =
555
+ T.type_alias do
556
+ T.any(
557
+ ContextDev::WebScrapeParams::ParseParams,
558
+ ContextDev::Internal::AnyHash
559
+ )
560
+ end
561
+
562
+ # Map field names to CSS selectors or rules. Missing items return null; missing
563
+ # lists return [].
564
+ sig do
565
+ returns(
566
+ T::Hash[
567
+ Symbol,
568
+ T.any(
569
+ String,
570
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1
571
+ )
572
+ ]
573
+ )
574
+ end
575
+ attr_accessor :rules
576
+
577
+ # Required when formats.parse is true.
578
+ sig do
579
+ params(
580
+ rules:
581
+ T::Hash[
582
+ Symbol,
583
+ T.any(
584
+ String,
585
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::OrHash
586
+ )
587
+ ]
588
+ ).returns(T.attached_class)
589
+ end
590
+ def self.new(
591
+ # Map field names to CSS selectors or rules. Missing items return null; missing
592
+ # lists return [].
593
+ rules:
594
+ )
595
+ end
596
+
597
+ sig do
598
+ override.returns(
599
+ {
600
+ rules:
601
+ T::Hash[
602
+ Symbol,
603
+ T.any(
604
+ String,
605
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1
606
+ )
607
+ ]
608
+ }
609
+ )
610
+ end
611
+ def to_hash
612
+ end
613
+
614
+ module Rule
615
+ extend ContextDev::Internal::Type::Union
616
+
617
+ Variants =
618
+ T.type_alias do
619
+ T.any(
620
+ String,
621
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1
622
+ )
623
+ end
624
+
625
+ class UnionMember1 < ContextDev::Internal::Type::BaseModel
626
+ OrHash =
627
+ T.type_alias do
628
+ T.any(
629
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1,
630
+ ContextDev::Internal::AnyHash
631
+ )
632
+ end
633
+
634
+ sig { returns(String) }
635
+ attr_accessor :selector
636
+
637
+ sig do
638
+ returns(
639
+ T.nilable(
640
+ T.any(
641
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::OrSymbol,
642
+ String,
643
+ T.anything
644
+ )
645
+ )
646
+ )
647
+ end
648
+ attr_reader :output
649
+
650
+ sig do
651
+ params(
652
+ output:
653
+ T.any(
654
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::OrSymbol,
655
+ String,
656
+ T.anything
657
+ )
658
+ ).void
659
+ end
660
+ attr_writer :output
661
+
662
+ sig do
663
+ returns(
664
+ T.nilable(
665
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::OrSymbol
666
+ )
667
+ )
668
+ end
669
+ attr_reader :type
670
+
671
+ sig do
672
+ params(
673
+ type:
674
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::OrSymbol
675
+ ).void
676
+ end
677
+ attr_writer :type
678
+
679
+ sig do
680
+ params(
681
+ selector: String,
682
+ output:
683
+ T.any(
684
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::OrSymbol,
685
+ String,
686
+ T.anything
687
+ ),
688
+ type:
689
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::OrSymbol
690
+ ).returns(T.attached_class)
691
+ end
692
+ def self.new(selector:, output: nil, type: nil)
693
+ end
694
+
695
+ sig do
696
+ override.returns(
697
+ {
698
+ selector: String,
699
+ output:
700
+ T.any(
701
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::OrSymbol,
702
+ String,
703
+ T.anything
704
+ ),
705
+ type:
706
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::OrSymbol
707
+ }
708
+ )
709
+ end
710
+ def to_hash
711
+ end
712
+
713
+ module Output
714
+ extend ContextDev::Internal::Type::Union
715
+
716
+ Variants =
717
+ T.type_alias do
718
+ T.any(
719
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::TaggedSymbol,
720
+ String,
721
+ T.anything
722
+ )
723
+ end
724
+
725
+ sig do
726
+ override.returns(
727
+ T::Array[
728
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::Variants
729
+ ]
730
+ )
731
+ end
732
+ def self.variants
733
+ end
734
+
735
+ TaggedSymbol =
736
+ T.type_alias do
737
+ T.all(
738
+ Symbol,
739
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output
740
+ )
741
+ end
742
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
743
+
744
+ TEXT =
745
+ T.let(
746
+ :text,
747
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::TaggedSymbol
748
+ )
749
+ HTML =
750
+ T.let(
751
+ :html,
752
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::TaggedSymbol
753
+ )
754
+ end
755
+
756
+ module Type
757
+ extend ContextDev::Internal::Type::Enum
758
+
759
+ TaggedSymbol =
760
+ T.type_alias do
761
+ T.all(
762
+ Symbol,
763
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type
764
+ )
765
+ end
766
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
767
+
768
+ ITEM =
769
+ T.let(
770
+ :item,
771
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::TaggedSymbol
772
+ )
773
+ LIST =
774
+ T.let(
775
+ :list,
776
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::TaggedSymbol
777
+ )
778
+
779
+ sig do
780
+ override.returns(
781
+ T::Array[
782
+ ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type::TaggedSymbol
783
+ ]
784
+ )
785
+ end
786
+ def self.values
787
+ end
788
+ end
789
+ end
790
+
791
+ sig do
792
+ override.returns(
793
+ T::Array[ContextDev::WebScrapeParams::ParseParams::Rule::Variants]
794
+ )
795
+ end
796
+ def self.variants
797
+ end
798
+ end
799
+ end
800
+
801
+ class ScreenshotParams < ContextDev::Internal::Type::BaseModel
802
+ OrHash =
803
+ T.type_alias do
804
+ T.any(
805
+ ContextDev::WebScrapeParams::ScreenshotParams,
806
+ ContextDev::Internal::AnyHash
807
+ )
808
+ end
809
+
810
+ # Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
811
+ sig do
812
+ returns(
813
+ T.nilable(
814
+ T.any(
815
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::OrSymbol,
816
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element,
817
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle
818
+ )
819
+ )
820
+ )
821
+ end
822
+ attr_reader :area
823
+
824
+ sig do
825
+ params(
826
+ area:
827
+ T.any(
828
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::OrSymbol,
829
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element::OrHash,
830
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle::OrHash
831
+ )
832
+ ).void
833
+ end
834
+ attr_writer :area
835
+
836
+ sig do
837
+ returns(
838
+ T.nilable(
839
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::OrSymbol
840
+ )
841
+ )
842
+ end
843
+ attr_reader :format_
844
+
845
+ sig do
846
+ params(
847
+ format_:
848
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::OrSymbol
849
+ ).void
850
+ end
851
+ attr_writer :format_
852
+
853
+ # Screenshot options. Requires formats.screenshot: true.
854
+ sig do
855
+ params(
856
+ area:
857
+ T.any(
858
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::OrSymbol,
859
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element::OrHash,
860
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle::OrHash
861
+ ),
862
+ format_:
863
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::OrSymbol
864
+ ).returns(T.attached_class)
865
+ end
866
+ def self.new(
867
+ # Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
868
+ area: nil,
869
+ format_: nil
870
+ )
871
+ end
872
+
873
+ sig do
874
+ override.returns(
875
+ {
876
+ area:
877
+ T.any(
878
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::OrSymbol,
879
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element,
880
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle
881
+ ),
882
+ format_:
883
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::OrSymbol
884
+ }
885
+ )
886
+ end
887
+ def to_hash
888
+ end
889
+
890
+ # Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
891
+ module Area
892
+ extend ContextDev::Internal::Type::Union
893
+
894
+ Variants =
895
+ T.type_alias do
896
+ T.any(
897
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::TaggedSymbol,
898
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element,
899
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle
900
+ )
901
+ end
902
+
903
+ module Page
904
+ extend ContextDev::Internal::Type::Enum
905
+
906
+ TaggedSymbol =
907
+ T.type_alias do
908
+ T.all(
909
+ Symbol,
910
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page
911
+ )
912
+ end
913
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
914
+
915
+ VIEWPORT =
916
+ T.let(
917
+ :viewport,
918
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::TaggedSymbol
919
+ )
920
+ FULL_PAGE =
921
+ T.let(
922
+ :fullPage,
923
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::TaggedSymbol
924
+ )
925
+
926
+ sig do
927
+ override.returns(
928
+ T::Array[
929
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Page::TaggedSymbol
930
+ ]
931
+ )
932
+ end
933
+ def self.values
934
+ end
935
+ end
936
+
937
+ class Element < ContextDev::Internal::Type::BaseModel
938
+ OrHash =
939
+ T.type_alias do
940
+ T.any(
941
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Element,
942
+ ContextDev::Internal::AnyHash
943
+ )
944
+ end
945
+
946
+ # Must match one visible element.
947
+ sig { returns(String) }
948
+ attr_accessor :selector
949
+
950
+ sig { params(selector: String).returns(T.attached_class) }
951
+ def self.new(
952
+ # Must match one visible element.
953
+ selector:
954
+ )
955
+ end
956
+
957
+ sig { override.returns({ selector: String }) }
958
+ def to_hash
959
+ end
960
+ end
961
+
962
+ class Rectangle < ContextDev::Internal::Type::BaseModel
963
+ OrHash =
964
+ T.type_alias do
965
+ T.any(
966
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle,
967
+ ContextDev::Internal::AnyHash
968
+ )
969
+ end
970
+
971
+ sig { returns(Integer) }
972
+ attr_accessor :height
973
+
974
+ sig { returns(Integer) }
975
+ attr_accessor :width
976
+
977
+ sig { returns(Integer) }
978
+ attr_accessor :x
979
+
980
+ sig { returns(Integer) }
981
+ attr_accessor :y_
982
+
983
+ # Pixels from the document origin.
984
+ sig do
985
+ params(
986
+ height: Integer,
987
+ width: Integer,
988
+ x: Integer,
989
+ y_: Integer
990
+ ).returns(T.attached_class)
991
+ end
992
+ def self.new(height:, width:, x:, y_:)
993
+ end
994
+
995
+ sig do
996
+ override.returns(
997
+ { height: Integer, width: Integer, x: Integer, y_: Integer }
998
+ )
999
+ end
1000
+ def to_hash
1001
+ end
1002
+ end
1003
+
1004
+ sig do
1005
+ override.returns(
1006
+ T::Array[
1007
+ ContextDev::WebScrapeParams::ScreenshotParams::Area::Variants
1008
+ ]
1009
+ )
1010
+ end
1011
+ def self.variants
1012
+ end
1013
+ end
1014
+
1015
+ module Format
1016
+ extend ContextDev::Internal::Type::Enum
1017
+
1018
+ TaggedSymbol =
1019
+ T.type_alias do
1020
+ T.all(
1021
+ Symbol,
1022
+ ContextDev::WebScrapeParams::ScreenshotParams::Format
1023
+ )
1024
+ end
1025
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1026
+
1027
+ PNG =
1028
+ T.let(
1029
+ :png,
1030
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::TaggedSymbol
1031
+ )
1032
+ JPEG =
1033
+ T.let(
1034
+ :jpeg,
1035
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::TaggedSymbol
1036
+ )
1037
+ WEBP =
1038
+ T.let(
1039
+ :webp,
1040
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::TaggedSymbol
1041
+ )
1042
+
1043
+ sig do
1044
+ override.returns(
1045
+ T::Array[
1046
+ ContextDev::WebScrapeParams::ScreenshotParams::Format::TaggedSymbol
1047
+ ]
1048
+ )
1049
+ end
1050
+ def self.values
1051
+ end
1052
+ end
1053
+ end
1054
+
1055
+ class SharedParams < ContextDev::Internal::Type::BaseModel
1056
+ OrHash =
1057
+ T.type_alias do
1058
+ T.any(
1059
+ ContextDev::WebScrapeParams::SharedParams,
1060
+ ContextDev::Internal::AnyHash
1061
+ )
1062
+ end
1063
+
1064
+ # Run in order before capture. A failed action fails the request. Bypasses
1065
+ # caching.
1066
+ sig do
1067
+ returns(
1068
+ T.nilable(
1069
+ T::Array[
1070
+ T.any(
1071
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform,
1072
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll,
1073
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait,
1074
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor
1075
+ )
1076
+ ]
1077
+ )
1078
+ )
1079
+ end
1080
+ attr_reader :actions
1081
+
1082
+ sig do
1083
+ params(
1084
+ actions:
1085
+ T::Array[
1086
+ T.any(
1087
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform::OrHash,
1088
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::OrHash,
1089
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait::OrHash,
1090
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor::OrHash
1091
+ )
1092
+ ]
1093
+ ).void
1094
+ end
1095
+ attr_writer :actions
1096
+
1097
+ # Supported two-letter country code, case-insensitive. Applies to every output,
1098
+ # including image downloads.
1099
+ sig { returns(T.nilable(String)) }
1100
+ attr_reader :country
1101
+
1102
+ sig { params(country: String).void }
1103
+ attr_writer :country
1104
+
1105
+ # Dismiss cookie banners by accepting cookies before actions.
1106
+ sig { returns(T.nilable(T::Boolean)) }
1107
+ attr_reader :dismiss_cookies
1108
+
1109
+ sig { params(dismiss_cookies: T::Boolean).void }
1110
+ attr_writer :dismiss_cookies
1111
+
1112
+ # Dismiss other popups before actions.
1113
+ sig { returns(T.nilable(T::Boolean)) }
1114
+ attr_reader :dismiss_popups
1115
+
1116
+ sig { params(dismiss_popups: T::Boolean).void }
1117
+ attr_writer :dismiss_popups
1118
+
1119
+ # Remove matching content. Exclusions win.
1120
+ sig { returns(T.nilable(T::Array[String])) }
1121
+ attr_reader :exclude_selectors
1122
+
1123
+ sig { params(exclude_selectors: T::Array[String]).void }
1124
+ attr_writer :exclude_selectors
1125
+
1126
+ # Headers for the target origin. Requests with custom headers bypass caching.
1127
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
1128
+ attr_reader :headers
1129
+
1130
+ sig { params(headers: T::Hash[Symbol, String]).void }
1131
+ attr_writer :headers
1132
+
1133
+ # Include iframe content in extraction. Screenshots show visible frames
1134
+ # regardless.
1135
+ sig { returns(T.nilable(T::Boolean)) }
1136
+ attr_reader :include_frames
1137
+
1138
+ sig { params(include_frames: T::Boolean).void }
1139
+ attr_writer :include_frames
1140
+
1141
+ # Keep matching content after mainContentOnly.
1142
+ sig { returns(T.nilable(T::Array[String])) }
1143
+ attr_reader :include_selectors
1144
+
1145
+ sig { params(include_selectors: T::Array[String]).void }
1146
+ attr_writer :include_selectors
1147
+
1148
+ # Keep only main content in HTML, Markdown, images, and parsed fields.
1149
+ sig { returns(T.nilable(T::Boolean)) }
1150
+ attr_reader :main_content_only
1151
+
1152
+ sig { params(main_content_only: T::Boolean).void }
1153
+ attr_writer :main_content_only
1154
+
1155
+ # Document parsing options.
1156
+ sig do
1157
+ returns(T.nilable(ContextDev::WebScrapeParams::SharedParams::Parsers))
1158
+ end
1159
+ attr_reader :parsers
1160
+
1161
+ sig do
1162
+ params(
1163
+ parsers: ContextDev::WebScrapeParams::SharedParams::Parsers::OrHash
1164
+ ).void
1165
+ end
1166
+ attr_writer :parsers
1167
+
1168
+ # Settle animations before capture. Defaults to true with screenshots, otherwise
1169
+ # false.
1170
+ sig { returns(T.nilable(T::Boolean)) }
1171
+ attr_reader :settle_animations
1172
+
1173
+ sig { params(settle_animations: T::Boolean).void }
1174
+ attr_writer :settle_animations
1175
+
1176
+ # Override the browser color scheme.
1177
+ sig do
1178
+ returns(
1179
+ T.nilable(
1180
+ ContextDev::WebScrapeParams::SharedParams::Theme::OrSymbol
1181
+ )
1182
+ )
1183
+ end
1184
+ attr_reader :theme
1185
+
1186
+ sig do
1187
+ params(
1188
+ theme: ContextDev::WebScrapeParams::SharedParams::Theme::OrSymbol
1189
+ ).void
1190
+ end
1191
+ attr_writer :theme
1192
+
1193
+ # Browser dimensions in pixels.
1194
+ sig do
1195
+ returns(
1196
+ T.nilable(ContextDev::WebScrapeParams::SharedParams::Viewport)
1197
+ )
1198
+ end
1199
+ attr_reader :viewport
1200
+
1201
+ sig do
1202
+ params(
1203
+ viewport:
1204
+ ContextDev::WebScrapeParams::SharedParams::Viewport::OrHash
1205
+ ).void
1206
+ end
1207
+ attr_writer :viewport
1208
+
1209
+ # After actions, wait this many milliseconds or until a CSS selector is visible.
1210
+ # Defaults to 500 ms, or 2000 ms with frames or an XML URL. Set 0 to skip.
1211
+ sig do
1212
+ returns(
1213
+ T.nilable(
1214
+ ContextDev::WebScrapeParams::SharedParams::WaitFor::Variants
1215
+ )
1216
+ )
1217
+ end
1218
+ attr_reader :wait_for
1219
+
1220
+ sig do
1221
+ params(
1222
+ wait_for:
1223
+ ContextDev::WebScrapeParams::SharedParams::WaitFor::Variants
1224
+ ).void
1225
+ end
1226
+ attr_writer :wait_for
1227
+
1228
+ # Shared browser and content settings. Content filters leave screenshots and
1229
+ # original bytes unchanged.
1230
+ sig do
1231
+ params(
1232
+ actions:
1233
+ T::Array[
1234
+ T.any(
1235
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform::OrHash,
1236
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::OrHash,
1237
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait::OrHash,
1238
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor::OrHash
1239
+ )
1240
+ ],
1241
+ country: String,
1242
+ dismiss_cookies: T::Boolean,
1243
+ dismiss_popups: T::Boolean,
1244
+ exclude_selectors: T::Array[String],
1245
+ headers: T::Hash[Symbol, String],
1246
+ include_frames: T::Boolean,
1247
+ include_selectors: T::Array[String],
1248
+ main_content_only: T::Boolean,
1249
+ parsers: ContextDev::WebScrapeParams::SharedParams::Parsers::OrHash,
1250
+ settle_animations: T::Boolean,
1251
+ theme: ContextDev::WebScrapeParams::SharedParams::Theme::OrSymbol,
1252
+ viewport:
1253
+ ContextDev::WebScrapeParams::SharedParams::Viewport::OrHash,
1254
+ wait_for:
1255
+ ContextDev::WebScrapeParams::SharedParams::WaitFor::Variants
1256
+ ).returns(T.attached_class)
1257
+ end
1258
+ def self.new(
1259
+ # Run in order before capture. A failed action fails the request. Bypasses
1260
+ # caching.
1261
+ actions: nil,
1262
+ # Supported two-letter country code, case-insensitive. Applies to every output,
1263
+ # including image downloads.
1264
+ country: nil,
1265
+ # Dismiss cookie banners by accepting cookies before actions.
1266
+ dismiss_cookies: nil,
1267
+ # Dismiss other popups before actions.
1268
+ dismiss_popups: nil,
1269
+ # Remove matching content. Exclusions win.
1270
+ exclude_selectors: nil,
1271
+ # Headers for the target origin. Requests with custom headers bypass caching.
1272
+ headers: nil,
1273
+ # Include iframe content in extraction. Screenshots show visible frames
1274
+ # regardless.
1275
+ include_frames: nil,
1276
+ # Keep matching content after mainContentOnly.
1277
+ include_selectors: nil,
1278
+ # Keep only main content in HTML, Markdown, images, and parsed fields.
1279
+ main_content_only: nil,
1280
+ # Document parsing options.
1281
+ parsers: nil,
1282
+ # Settle animations before capture. Defaults to true with screenshots, otherwise
1283
+ # false.
1284
+ settle_animations: nil,
1285
+ # Override the browser color scheme.
1286
+ theme: nil,
1287
+ # Browser dimensions in pixels.
1288
+ viewport: nil,
1289
+ # After actions, wait this many milliseconds or until a CSS selector is visible.
1290
+ # Defaults to 500 ms, or 2000 ms with frames or an XML URL. Set 0 to skip.
1291
+ wait_for: nil
1292
+ )
1293
+ end
1294
+
1295
+ sig do
1296
+ override.returns(
1297
+ {
1298
+ actions:
1299
+ T::Array[
1300
+ T.any(
1301
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform,
1302
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll,
1303
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait,
1304
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor
1305
+ )
1306
+ ],
1307
+ country: String,
1308
+ dismiss_cookies: T::Boolean,
1309
+ dismiss_popups: T::Boolean,
1310
+ exclude_selectors: T::Array[String],
1311
+ headers: T::Hash[Symbol, String],
1312
+ include_frames: T::Boolean,
1313
+ include_selectors: T::Array[String],
1314
+ main_content_only: T::Boolean,
1315
+ parsers: ContextDev::WebScrapeParams::SharedParams::Parsers,
1316
+ settle_animations: T::Boolean,
1317
+ theme: ContextDev::WebScrapeParams::SharedParams::Theme::OrSymbol,
1318
+ viewport: ContextDev::WebScrapeParams::SharedParams::Viewport,
1319
+ wait_for:
1320
+ ContextDev::WebScrapeParams::SharedParams::WaitFor::Variants
1321
+ }
1322
+ )
1323
+ end
1324
+ def to_hash
1325
+ end
1326
+
1327
+ module Action
1328
+ extend ContextDev::Internal::Type::Union
1329
+
1330
+ Variants =
1331
+ T.type_alias do
1332
+ T.any(
1333
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform,
1334
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll,
1335
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait,
1336
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor
1337
+ )
1338
+ end
1339
+
1340
+ class Perform < ContextDev::Internal::Type::BaseModel
1341
+ OrHash =
1342
+ T.type_alias do
1343
+ T.any(
1344
+ ContextDev::WebScrapeParams::SharedParams::Action::Perform,
1345
+ ContextDev::Internal::AnyHash
1346
+ )
1347
+ end
1348
+
1349
+ sig { returns(String) }
1350
+ attr_accessor :action
1351
+
1352
+ sig { returns(Symbol) }
1353
+ attr_accessor :type
1354
+
1355
+ sig do
1356
+ params(action: String, type: Symbol).returns(T.attached_class)
1357
+ end
1358
+ def self.new(action:, type: :perform)
1359
+ end
1360
+
1361
+ sig { override.returns({ action: String, type: Symbol }) }
1362
+ def to_hash
1363
+ end
1364
+ end
1365
+
1366
+ class Scroll < ContextDev::Internal::Type::BaseModel
1367
+ OrHash =
1368
+ T.type_alias do
1369
+ T.any(
1370
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll,
1371
+ ContextDev::Internal::AnyHash
1372
+ )
1373
+ end
1374
+
1375
+ sig { returns(Symbol) }
1376
+ attr_accessor :type
1377
+
1378
+ sig do
1379
+ returns(
1380
+ T.nilable(
1381
+ T.any(
1382
+ Integer,
1383
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::OrSymbol
1384
+ )
1385
+ )
1386
+ )
1387
+ end
1388
+ attr_reader :amount
1389
+
1390
+ sig do
1391
+ params(
1392
+ amount:
1393
+ T.any(
1394
+ Integer,
1395
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::OrSymbol
1396
+ )
1397
+ ).void
1398
+ end
1399
+ attr_writer :amount
1400
+
1401
+ sig do
1402
+ returns(
1403
+ T.nilable(
1404
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::OrSymbol
1405
+ )
1406
+ )
1407
+ end
1408
+ attr_reader :direction
1409
+
1410
+ sig do
1411
+ params(
1412
+ direction:
1413
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::OrSymbol
1414
+ ).void
1415
+ end
1416
+ attr_writer :direction
1417
+
1418
+ sig { returns(T.nilable(Integer)) }
1419
+ attr_reader :max_scrolls
1420
+
1421
+ sig { params(max_scrolls: Integer).void }
1422
+ attr_writer :max_scrolls
1423
+
1424
+ # Scroll this container. Omit to scroll the page.
1425
+ sig { returns(T.nilable(String)) }
1426
+ attr_reader :selector
1427
+
1428
+ sig { params(selector: String).void }
1429
+ attr_writer :selector
1430
+
1431
+ sig do
1432
+ params(
1433
+ amount:
1434
+ T.any(
1435
+ Integer,
1436
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::OrSymbol
1437
+ ),
1438
+ direction:
1439
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::OrSymbol,
1440
+ max_scrolls: Integer,
1441
+ selector: String,
1442
+ type: Symbol
1443
+ ).returns(T.attached_class)
1444
+ end
1445
+ def self.new(
1446
+ amount: nil,
1447
+ direction: nil,
1448
+ max_scrolls: nil,
1449
+ # Scroll this container. Omit to scroll the page.
1450
+ selector: nil,
1451
+ type: :scroll
1452
+ )
1453
+ end
1454
+
1455
+ sig do
1456
+ override.returns(
1457
+ {
1458
+ type: Symbol,
1459
+ amount:
1460
+ T.any(
1461
+ Integer,
1462
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::OrSymbol
1463
+ ),
1464
+ direction:
1465
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::OrSymbol,
1466
+ max_scrolls: Integer,
1467
+ selector: String
1468
+ }
1469
+ )
1470
+ end
1471
+ def to_hash
1472
+ end
1473
+
1474
+ module Amount
1475
+ extend ContextDev::Internal::Type::Union
1476
+
1477
+ Variants =
1478
+ T.type_alias do
1479
+ T.any(
1480
+ Integer,
1481
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::TaggedSymbol
1482
+ )
1483
+ end
1484
+
1485
+ sig do
1486
+ override.returns(
1487
+ T::Array[
1488
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::Variants
1489
+ ]
1490
+ )
1491
+ end
1492
+ def self.variants
1493
+ end
1494
+
1495
+ TaggedSymbol =
1496
+ T.type_alias do
1497
+ T.all(
1498
+ Symbol,
1499
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount
1500
+ )
1501
+ end
1502
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1503
+
1504
+ VIEWPORT =
1505
+ T.let(
1506
+ :viewport,
1507
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::TaggedSymbol
1508
+ )
1509
+ MAX =
1510
+ T.let(
1511
+ :max,
1512
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::TaggedSymbol
1513
+ )
1514
+ end
1515
+
1516
+ module Direction
1517
+ extend ContextDev::Internal::Type::Enum
1518
+
1519
+ TaggedSymbol =
1520
+ T.type_alias do
1521
+ T.all(
1522
+ Symbol,
1523
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction
1524
+ )
1525
+ end
1526
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1527
+
1528
+ DOWN =
1529
+ T.let(
1530
+ :down,
1531
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::TaggedSymbol
1532
+ )
1533
+ UP =
1534
+ T.let(
1535
+ :up,
1536
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::TaggedSymbol
1537
+ )
1538
+ LEFT =
1539
+ T.let(
1540
+ :left,
1541
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::TaggedSymbol
1542
+ )
1543
+ RIGHT =
1544
+ T.let(
1545
+ :right,
1546
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::TaggedSymbol
1547
+ )
1548
+
1549
+ sig do
1550
+ override.returns(
1551
+ T::Array[
1552
+ ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction::TaggedSymbol
1553
+ ]
1554
+ )
1555
+ end
1556
+ def self.values
1557
+ end
1558
+ end
1559
+ end
1560
+
1561
+ class Wait < ContextDev::Internal::Type::BaseModel
1562
+ OrHash =
1563
+ T.type_alias do
1564
+ T.any(
1565
+ ContextDev::WebScrapeParams::SharedParams::Action::Wait,
1566
+ ContextDev::Internal::AnyHash
1567
+ )
1568
+ end
1569
+
1570
+ sig { returns(Integer) }
1571
+ attr_accessor :milliseconds
1572
+
1573
+ sig { returns(Symbol) }
1574
+ attr_accessor :type
1575
+
1576
+ sig do
1577
+ params(milliseconds: Integer, type: Symbol).returns(
1578
+ T.attached_class
1579
+ )
1580
+ end
1581
+ def self.new(milliseconds:, type: :wait)
1582
+ end
1583
+
1584
+ sig { override.returns({ milliseconds: Integer, type: Symbol }) }
1585
+ def to_hash
1586
+ end
1587
+ end
1588
+
1589
+ class WaitFor < ContextDev::Internal::Type::BaseModel
1590
+ OrHash =
1591
+ T.type_alias do
1592
+ T.any(
1593
+ ContextDev::WebScrapeParams::SharedParams::Action::WaitFor,
1594
+ ContextDev::Internal::AnyHash
1595
+ )
1596
+ end
1597
+
1598
+ sig { returns(String) }
1599
+ attr_accessor :selector
1600
+
1601
+ sig { returns(Symbol) }
1602
+ attr_accessor :type
1603
+
1604
+ sig do
1605
+ params(selector: String, type: Symbol).returns(T.attached_class)
1606
+ end
1607
+ def self.new(selector:, type: :waitFor)
1608
+ end
1609
+
1610
+ sig { override.returns({ selector: String, type: Symbol }) }
1611
+ def to_hash
1612
+ end
1613
+ end
1614
+
1615
+ sig do
1616
+ override.returns(
1617
+ T::Array[
1618
+ ContextDev::WebScrapeParams::SharedParams::Action::Variants
1619
+ ]
1620
+ )
1621
+ end
1622
+ def self.variants
1623
+ end
1624
+ end
1625
+
1626
+ class Parsers < ContextDev::Internal::Type::BaseModel
1627
+ OrHash =
1628
+ T.type_alias do
1629
+ T.any(
1630
+ ContextDev::WebScrapeParams::SharedParams::Parsers,
1631
+ ContextDev::Internal::AnyHash
1632
+ )
1633
+ end
1634
+
1635
+ # PDF text options for HTML, Markdown, and parsed fields.
1636
+ sig do
1637
+ returns(
1638
+ T.nilable(ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf)
1639
+ )
1640
+ end
1641
+ attr_reader :pdf
1642
+
1643
+ sig do
1644
+ params(
1645
+ pdf:
1646
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::OrHash
1647
+ ).void
1648
+ end
1649
+ attr_writer :pdf
1650
+
1651
+ # Document parsing options.
1652
+ sig do
1653
+ params(
1654
+ pdf:
1655
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::OrHash
1656
+ ).returns(T.attached_class)
1657
+ end
1658
+ def self.new(
1659
+ # PDF text options for HTML, Markdown, and parsed fields.
1660
+ pdf: nil
1661
+ )
1662
+ end
1663
+
1664
+ sig do
1665
+ override.returns(
1666
+ { pdf: ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf }
1667
+ )
1668
+ end
1669
+ def to_hash
1670
+ end
1671
+
1672
+ class Pdf < ContextDev::Internal::Type::BaseModel
1673
+ OrHash =
1674
+ T.type_alias do
1675
+ T.any(
1676
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf,
1677
+ ContextDev::Internal::AnyHash
1678
+ )
1679
+ end
1680
+
1681
+ # Last page to parse. Must be at least startPage.
1682
+ sig { returns(T.nilable(Integer)) }
1683
+ attr_reader :end_page
1684
+
1685
+ sig { params(end_page: Integer).void }
1686
+ attr_writer :end_page
1687
+
1688
+ # Read text from scanned pages.
1689
+ sig do
1690
+ returns(
1691
+ T.nilable(
1692
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::OrSymbol
1693
+ )
1694
+ )
1695
+ end
1696
+ attr_reader :ocr
1697
+
1698
+ sig do
1699
+ params(
1700
+ ocr:
1701
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::OrSymbol
1702
+ ).void
1703
+ end
1704
+ attr_writer :ocr
1705
+
1706
+ # First page to parse, starting at 1.
1707
+ sig { returns(T.nilable(Integer)) }
1708
+ attr_reader :start_page
1709
+
1710
+ sig { params(start_page: Integer).void }
1711
+ attr_writer :start_page
1712
+
1713
+ # PDF text options for HTML, Markdown, and parsed fields.
1714
+ sig do
1715
+ params(
1716
+ end_page: Integer,
1717
+ ocr:
1718
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::OrSymbol,
1719
+ start_page: Integer
1720
+ ).returns(T.attached_class)
1721
+ end
1722
+ def self.new(
1723
+ # Last page to parse. Must be at least startPage.
1724
+ end_page: nil,
1725
+ # Read text from scanned pages.
1726
+ ocr: nil,
1727
+ # First page to parse, starting at 1.
1728
+ start_page: nil
1729
+ )
1730
+ end
1731
+
1732
+ sig do
1733
+ override.returns(
1734
+ {
1735
+ end_page: Integer,
1736
+ ocr:
1737
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::OrSymbol,
1738
+ start_page: Integer
1739
+ }
1740
+ )
1741
+ end
1742
+ def to_hash
1743
+ end
1744
+
1745
+ # Read text from scanned pages.
1746
+ module Ocr
1747
+ extend ContextDev::Internal::Type::Enum
1748
+
1749
+ TaggedSymbol =
1750
+ T.type_alias do
1751
+ T.all(
1752
+ Symbol,
1753
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr
1754
+ )
1755
+ end
1756
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1757
+
1758
+ OFF =
1759
+ T.let(
1760
+ :off,
1761
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::TaggedSymbol
1762
+ )
1763
+ AUTO =
1764
+ T.let(
1765
+ :auto,
1766
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::TaggedSymbol
1767
+ )
1768
+
1769
+ sig do
1770
+ override.returns(
1771
+ T::Array[
1772
+ ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr::TaggedSymbol
1773
+ ]
1774
+ )
1775
+ end
1776
+ def self.values
1777
+ end
1778
+ end
1779
+ end
1780
+ end
1781
+
1782
+ # Override the browser color scheme.
1783
+ module Theme
1784
+ extend ContextDev::Internal::Type::Enum
1785
+
1786
+ TaggedSymbol =
1787
+ T.type_alias do
1788
+ T.all(Symbol, ContextDev::WebScrapeParams::SharedParams::Theme)
1789
+ end
1790
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1791
+
1792
+ LIGHT =
1793
+ T.let(
1794
+ :light,
1795
+ ContextDev::WebScrapeParams::SharedParams::Theme::TaggedSymbol
1796
+ )
1797
+ DARK =
1798
+ T.let(
1799
+ :dark,
1800
+ ContextDev::WebScrapeParams::SharedParams::Theme::TaggedSymbol
1801
+ )
1802
+
1803
+ sig do
1804
+ override.returns(
1805
+ T::Array[
1806
+ ContextDev::WebScrapeParams::SharedParams::Theme::TaggedSymbol
1807
+ ]
1808
+ )
1809
+ end
1810
+ def self.values
1811
+ end
1812
+ end
1813
+
1814
+ class Viewport < ContextDev::Internal::Type::BaseModel
1815
+ OrHash =
1816
+ T.type_alias do
1817
+ T.any(
1818
+ ContextDev::WebScrapeParams::SharedParams::Viewport,
1819
+ ContextDev::Internal::AnyHash
1820
+ )
1821
+ end
1822
+
1823
+ sig { returns(T.nilable(Integer)) }
1824
+ attr_reader :height
1825
+
1826
+ sig { params(height: Integer).void }
1827
+ attr_writer :height
1828
+
1829
+ sig { returns(T.nilable(Integer)) }
1830
+ attr_reader :width
1831
+
1832
+ sig { params(width: Integer).void }
1833
+ attr_writer :width
1834
+
1835
+ # Browser dimensions in pixels.
1836
+ sig do
1837
+ params(height: Integer, width: Integer).returns(T.attached_class)
1838
+ end
1839
+ def self.new(height: nil, width: nil)
1840
+ end
1841
+
1842
+ sig { override.returns({ height: Integer, width: Integer }) }
1843
+ def to_hash
1844
+ end
1845
+ end
1846
+
1847
+ # After actions, wait this many milliseconds or until a CSS selector is visible.
1848
+ # Defaults to 500 ms, or 2000 ms with frames or an XML URL. Set 0 to skip.
1849
+ module WaitFor
1850
+ extend ContextDev::Internal::Type::Union
1851
+
1852
+ Variants = T.type_alias { T.any(Integer, String) }
1853
+
1854
+ sig do
1855
+ override.returns(
1856
+ T::Array[
1857
+ ContextDev::WebScrapeParams::SharedParams::WaitFor::Variants
1858
+ ]
1859
+ )
1860
+ end
1861
+ def self.variants
1862
+ end
1863
+ end
1864
+ end
1865
+
1866
+ class TimeoutOpts < ContextDev::Internal::Type::BaseModel
1867
+ OrHash =
1868
+ T.type_alias do
1869
+ T.any(
1870
+ ContextDev::WebScrapeParams::TimeoutOpts,
1871
+ ContextDev::Internal::AnyHash
1872
+ )
1873
+ end
1874
+
1875
+ # Request deadline in milliseconds. Maximum: 300000 (5 minutes).
1876
+ sig { returns(Integer) }
1877
+ attr_accessor :milliseconds
1878
+
1879
+ # What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
1880
+ # credits. "return-partial" returns usable results collected so far; if none are
1881
+ # available, the request still fails without charging credits. Partial results are
1882
+ # not cached as complete results. "return-partial" requires milliseconds of at
1883
+ # least 5000.
1884
+ sig do
1885
+ returns(
1886
+ T.nilable(
1887
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::OrSymbol
1888
+ )
1889
+ )
1890
+ end
1891
+ attr_reader :behavior
1892
+
1893
+ sig do
1894
+ params(
1895
+ behavior:
1896
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::OrSymbol
1897
+ ).void
1898
+ end
1899
+ attr_writer :behavior
1900
+
1901
+ # Total deadline, including navigation, actions, waiting, and all outputs.
1902
+ # Defaults to 60000 milliseconds with behavior fail. Use return-partial to capture
1903
+ # the current page state and return captured images if image processing cannot
1904
+ # finish before the deadline; these responses set isPartial and are not cached.
1905
+ # Every requested format must still be available. Fixed waits must fit before a
1906
+ # response reserve of up to 5000 milliseconds (at most one quarter of the timeout)
1907
+ # when using return-partial.
1908
+ sig do
1909
+ params(
1910
+ milliseconds: Integer,
1911
+ behavior:
1912
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::OrSymbol
1913
+ ).returns(T.attached_class)
1914
+ end
1915
+ def self.new(
1916
+ # Request deadline in milliseconds. Maximum: 300000 (5 minutes).
1917
+ milliseconds:,
1918
+ # What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
1919
+ # credits. "return-partial" returns usable results collected so far; if none are
1920
+ # available, the request still fails without charging credits. Partial results are
1921
+ # not cached as complete results. "return-partial" requires milliseconds of at
1922
+ # least 5000.
1923
+ behavior: nil
1924
+ )
1925
+ end
1926
+
1927
+ sig do
1928
+ override.returns(
1929
+ {
1930
+ milliseconds: Integer,
1931
+ behavior:
1932
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::OrSymbol
1933
+ }
1934
+ )
1935
+ end
1936
+ def to_hash
1937
+ end
1938
+
1939
+ # What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
1940
+ # credits. "return-partial" returns usable results collected so far; if none are
1941
+ # available, the request still fails without charging credits. Partial results are
1942
+ # not cached as complete results. "return-partial" requires milliseconds of at
1943
+ # least 5000.
1944
+ module Behavior
1945
+ extend ContextDev::Internal::Type::Enum
1946
+
1947
+ TaggedSymbol =
1948
+ T.type_alias do
1949
+ T.all(Symbol, ContextDev::WebScrapeParams::TimeoutOpts::Behavior)
1950
+ end
1951
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1952
+
1953
+ FAIL =
1954
+ T.let(
1955
+ :fail,
1956
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::TaggedSymbol
1957
+ )
1958
+ RETURN_PARTIAL =
1959
+ T.let(
1960
+ :"return-partial",
1961
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::TaggedSymbol
1962
+ )
1963
+
1964
+ sig do
1965
+ override.returns(
1966
+ T::Array[
1967
+ ContextDev::WebScrapeParams::TimeoutOpts::Behavior::TaggedSymbol
1968
+ ]
1969
+ )
1970
+ end
1971
+ def self.values
1972
+ end
1973
+ end
1974
+ end
1975
+
1976
+ # Zero data retention. Bypasses caches and uploads; excludes request/response
1977
+ # content and tags from logs. Must be enabled for your organization.
1978
+ module Zdr
1979
+ extend ContextDev::Internal::Type::Enum
1980
+
1981
+ TaggedSymbol =
1982
+ T.type_alias { T.all(Symbol, ContextDev::WebScrapeParams::Zdr) }
1983
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1984
+
1985
+ ENABLED =
1986
+ T.let(:enabled, ContextDev::WebScrapeParams::Zdr::TaggedSymbol)
1987
+ DISABLED =
1988
+ T.let(:disabled, ContextDev::WebScrapeParams::Zdr::TaggedSymbol)
1989
+
1990
+ sig do
1991
+ override.returns(
1992
+ T::Array[ContextDev::WebScrapeParams::Zdr::TaggedSymbol]
1993
+ )
1994
+ end
1995
+ def self.values
1996
+ end
1997
+ end
1998
+ end
1999
+ end
2000
+ end