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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +0 -4
- data/lib/context_dev/models/monitor_retrieve_run_params.rb +26 -0
- data/lib/context_dev/models/monitor_retrieve_run_response.rb +232 -0
- data/lib/context_dev/models/monitor_rotate_webhook_secret_params.rb +20 -0
- data/lib/context_dev/models/monitor_rotate_webhook_secret_response.rb +765 -0
- data/lib/context_dev/models/{web_web_scrape_sitemap_params.rb → web_map_urls_params.rb} +14 -14
- data/lib/context_dev/models/web_map_urls_response.rb +123 -0
- data/lib/context_dev/models/web_scrape_params.rb +906 -0
- data/lib/context_dev/models/web_scrape_response.rb +659 -0
- data/lib/context_dev/models/web_screenshot_params.rb +15 -1
- data/lib/context_dev/models/web_screenshot_response.rb +3 -3
- data/lib/context_dev/models.rb +8 -22
- data/lib/context_dev/resources/brand.rb +0 -36
- data/lib/context_dev/resources/monitors.rb +47 -0
- data/lib/context_dev/resources/web.rb +106 -486
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +8 -23
- data/rbi/context_dev/client.rbi +0 -3
- data/rbi/context_dev/models/monitor_retrieve_run_params.rbi +46 -0
- data/rbi/context_dev/models/monitor_retrieve_run_response.rbi +452 -0
- data/rbi/context_dev/models/monitor_rotate_webhook_secret_params.rbi +38 -0
- data/rbi/context_dev/models/monitor_rotate_webhook_secret_response.rbi +1367 -0
- data/rbi/context_dev/models/{web_web_scrape_sitemap_params.rbi → web_map_urls_params.rbi} +23 -45
- data/rbi/context_dev/models/web_map_urls_response.rbi +226 -0
- data/rbi/context_dev/models/web_scrape_params.rbi +2000 -0
- data/rbi/context_dev/models/{web_web_scrape_html_response.rbi → web_scrape_response.rbi} +539 -510
- data/rbi/context_dev/models/web_screenshot_params.rbi +23 -0
- data/rbi/context_dev/models/web_screenshot_response.rbi +4 -4
- data/rbi/context_dev/models.rbi +9 -24
- data/rbi/context_dev/resources/brand.rbi +0 -35
- data/rbi/context_dev/resources/monitors.rbi +24 -0
- data/rbi/context_dev/resources/web.rbi +135 -654
- data/sig/context_dev/client.rbs +0 -2
- data/sig/context_dev/models/monitor_retrieve_run_params.rbs +28 -0
- data/sig/context_dev/models/monitor_retrieve_run_response.rbs +182 -0
- data/sig/context_dev/models/monitor_rotate_webhook_secret_params.rbs +23 -0
- data/sig/context_dev/models/monitor_rotate_webhook_secret_response.rbs +545 -0
- data/sig/context_dev/models/{web_web_scrape_sitemap_params.rbs → web_map_urls_params.rbs} +22 -22
- data/sig/context_dev/models/web_map_urls_response.rbs +125 -0
- data/sig/context_dev/models/web_scrape_params.rbs +834 -0
- data/sig/context_dev/models/web_scrape_response.rbs +552 -0
- data/sig/context_dev/models/web_screenshot_params.rbs +7 -0
- data/sig/context_dev/models.rbs +8 -22
- data/sig/context_dev/resources/brand.rbs +0 -9
- data/sig/context_dev/resources/monitors.rbs +11 -0
- data/sig/context_dev/resources/web.rbs +30 -128
- metadata +26 -71
- data/lib/context_dev/models/ai_extract_product_params.rb +0 -125
- data/lib/context_dev/models/ai_extract_product_response.rb +0 -402
- data/lib/context_dev/models/ai_extract_products_params.rb +0 -233
- data/lib/context_dev/models/ai_extract_products_response.rb +0 -370
- data/lib/context_dev/models/brand_retrieve_simplified_params.rb +0 -120
- data/lib/context_dev/models/brand_retrieve_simplified_response.rb +0 -441
- data/lib/context_dev/models/web_extract_fonts_params.rb +0 -114
- data/lib/context_dev/models/web_extract_fonts_response.rb +0 -291
- data/lib/context_dev/models/web_extract_params.rb +0 -419
- data/lib/context_dev/models/web_extract_response.rb +0 -287
- data/lib/context_dev/models/web_web_scrape_bytes_params.rb +0 -346
- data/lib/context_dev/models/web_web_scrape_bytes_response.rb +0 -135
- data/lib/context_dev/models/web_web_scrape_html_params.rb +0 -812
- data/lib/context_dev/models/web_web_scrape_html_response.rb +0 -628
- data/lib/context_dev/models/web_web_scrape_images_params.rb +0 -373
- data/lib/context_dev/models/web_web_scrape_images_response.rb +0 -409
- data/lib/context_dev/models/web_web_scrape_md_params.rb +0 -670
- data/lib/context_dev/models/web_web_scrape_md_response.rb +0 -567
- data/lib/context_dev/models/web_web_scrape_screenshot_params.rb +0 -471
- data/lib/context_dev/models/web_web_scrape_screenshot_response.rb +0 -169
- data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +0 -144
- data/lib/context_dev/resources/ai.rb +0 -71
- data/rbi/context_dev/models/ai_extract_product_params.rbi +0 -253
- data/rbi/context_dev/models/ai_extract_product_response.rbi +0 -791
- data/rbi/context_dev/models/ai_extract_products_params.rbi +0 -490
- data/rbi/context_dev/models/ai_extract_products_response.rbi +0 -718
- data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +0 -256
- data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +0 -1040
- data/rbi/context_dev/models/web_extract_fonts_params.rbi +0 -223
- data/rbi/context_dev/models/web_extract_fonts_response.rbi +0 -563
- data/rbi/context_dev/models/web_extract_params.rbi +0 -781
- data/rbi/context_dev/models/web_extract_response.rbi +0 -512
- data/rbi/context_dev/models/web_web_scrape_bytes_params.rbi +0 -702
- data/rbi/context_dev/models/web_web_scrape_bytes_response.rbi +0 -238
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +0 -1690
- data/rbi/context_dev/models/web_web_scrape_images_params.rbi +0 -728
- data/rbi/context_dev/models/web_web_scrape_images_response.rbi +0 -910
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +0 -1052
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +0 -1088
- data/rbi/context_dev/models/web_web_scrape_screenshot_params.rbi +0 -1580
- data/rbi/context_dev/models/web_web_scrape_screenshot_response.rbi +0 -332
- data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +0 -258
- data/rbi/context_dev/resources/ai.rbi +0 -63
- data/sig/context_dev/models/ai_extract_product_params.rbs +0 -106
- data/sig/context_dev/models/ai_extract_product_response.rbs +0 -314
- data/sig/context_dev/models/ai_extract_products_params.rbs +0 -202
- data/sig/context_dev/models/ai_extract_products_response.rbs +0 -293
- data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +0 -104
- data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +0 -413
- data/sig/context_dev/models/web_extract_fonts_params.rbs +0 -93
- data/sig/context_dev/models/web_extract_fonts_response.rbs +0 -230
- data/sig/context_dev/models/web_extract_params.rbs +0 -324
- data/sig/context_dev/models/web_extract_response.rbs +0 -239
- data/sig/context_dev/models/web_web_scrape_bytes_params.rbs +0 -531
- data/sig/context_dev/models/web_web_scrape_bytes_response.rbs +0 -108
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +0 -878
- data/sig/context_dev/models/web_web_scrape_html_response.rbs +0 -525
- data/sig/context_dev/models/web_web_scrape_images_params.rbs +0 -281
- data/sig/context_dev/models/web_web_scrape_images_response.rbs +0 -371
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +0 -758
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +0 -465
- data/sig/context_dev/models/web_web_scrape_screenshot_params.rbs +0 -619
- data/sig/context_dev/models/web_web_scrape_screenshot_response.rbs +0 -127
- data/sig/context_dev/models/web_web_scrape_sitemap_response.rbs +0 -117
- data/sig/context_dev/resources/ai.rbs +0 -21
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
# @see ContextDev::Resources::Web#scrape
|
|
6
|
+
class WebScrapeParams < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
extend ContextDev::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ContextDev::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute formats
|
|
11
|
+
# Outputs to return. Enable at least one; omitted formats are false.
|
|
12
|
+
#
|
|
13
|
+
# @return [ContextDev::Models::WebScrapeParams::Formats]
|
|
14
|
+
required :formats, -> { ContextDev::WebScrapeParams::Formats }
|
|
15
|
+
|
|
16
|
+
# @!attribute url
|
|
17
|
+
# The URL to scrape.
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :url, String
|
|
21
|
+
|
|
22
|
+
# @!attribute image_params
|
|
23
|
+
# Image options. Requires formats.images: true.
|
|
24
|
+
#
|
|
25
|
+
# @return [ContextDev::Models::WebScrapeParams::ImageParams, nil]
|
|
26
|
+
optional :image_params, -> { ContextDev::WebScrapeParams::ImageParams }, api_name: :imageParams
|
|
27
|
+
|
|
28
|
+
# @!attribute markdown_params
|
|
29
|
+
# Markdown options. Requires formats.markdown: true.
|
|
30
|
+
#
|
|
31
|
+
# @return [ContextDev::Models::WebScrapeParams::MarkdownParams, nil]
|
|
32
|
+
optional :markdown_params, -> { ContextDev::WebScrapeParams::MarkdownParams }, api_name: :markdownParams
|
|
33
|
+
|
|
34
|
+
# @!attribute max_age_ms
|
|
35
|
+
# Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and
|
|
36
|
+
# updates the requested outputs. Compatible outputs are shared with the individual
|
|
37
|
+
# scrape endpoints. Image results with hosted files refresh after 23 hours; other
|
|
38
|
+
# outputs retain their own freshness.
|
|
39
|
+
#
|
|
40
|
+
# @return [Integer, nil]
|
|
41
|
+
optional :max_age_ms, Integer, api_name: :maxAgeMs
|
|
42
|
+
|
|
43
|
+
# @!attribute parse_params
|
|
44
|
+
# Required when formats.parse is true.
|
|
45
|
+
#
|
|
46
|
+
# @return [ContextDev::Models::WebScrapeParams::ParseParams, nil]
|
|
47
|
+
optional :parse_params, -> { ContextDev::WebScrapeParams::ParseParams }, api_name: :parseParams
|
|
48
|
+
|
|
49
|
+
# @!attribute screenshot_params
|
|
50
|
+
# Screenshot options. Requires formats.screenshot: true.
|
|
51
|
+
#
|
|
52
|
+
# @return [ContextDev::Models::WebScrapeParams::ScreenshotParams, nil]
|
|
53
|
+
optional :screenshot_params,
|
|
54
|
+
-> { ContextDev::WebScrapeParams::ScreenshotParams },
|
|
55
|
+
api_name: :screenshotParams
|
|
56
|
+
|
|
57
|
+
# @!attribute shared_params
|
|
58
|
+
# Shared browser and content settings. Content filters leave screenshots and
|
|
59
|
+
# original bytes unchanged.
|
|
60
|
+
#
|
|
61
|
+
# @return [ContextDev::Models::WebScrapeParams::SharedParams, nil]
|
|
62
|
+
optional :shared_params, -> { ContextDev::WebScrapeParams::SharedParams }, api_name: :sharedParams
|
|
63
|
+
|
|
64
|
+
# @!attribute tags
|
|
65
|
+
# Labels for tracking request usage. Not retained when zdr is enabled.
|
|
66
|
+
#
|
|
67
|
+
# @return [Array<String>, nil]
|
|
68
|
+
optional :tags, ContextDev::Internal::Type::ArrayOf[String]
|
|
69
|
+
|
|
70
|
+
# @!attribute timeout_opts
|
|
71
|
+
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
72
|
+
# Defaults to 60000 milliseconds with behavior fail. Use return-partial to capture
|
|
73
|
+
# the current page state and return captured images if image processing cannot
|
|
74
|
+
# finish before the deadline; these responses set isPartial and are not cached.
|
|
75
|
+
# Every requested format must still be available. Fixed waits must fit before a
|
|
76
|
+
# response reserve of up to 5000 milliseconds (at most one quarter of the timeout)
|
|
77
|
+
# when using return-partial.
|
|
78
|
+
#
|
|
79
|
+
# @return [ContextDev::Models::WebScrapeParams::TimeoutOpts, nil]
|
|
80
|
+
optional :timeout_opts, -> { ContextDev::WebScrapeParams::TimeoutOpts }, api_name: :timeoutOpts
|
|
81
|
+
|
|
82
|
+
# @!attribute zdr
|
|
83
|
+
# Zero data retention. Bypasses caches and uploads; excludes request/response
|
|
84
|
+
# content and tags from logs. Must be enabled for your organization.
|
|
85
|
+
#
|
|
86
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::Zdr, nil]
|
|
87
|
+
optional :zdr, enum: -> { ContextDev::WebScrapeParams::Zdr }
|
|
88
|
+
|
|
89
|
+
# @!method initialize(formats:, url:, image_params: nil, markdown_params: nil, max_age_ms: nil, parse_params: nil, screenshot_params: nil, shared_params: nil, tags: nil, timeout_opts: nil, zdr: nil, request_options: {})
|
|
90
|
+
# Some parameter documentations has been truncated, see
|
|
91
|
+
# {ContextDev::Models::WebScrapeParams} for more details.
|
|
92
|
+
#
|
|
93
|
+
# @param formats [ContextDev::Models::WebScrapeParams::Formats] Outputs to return. Enable at least one; omitted formats are false.
|
|
94
|
+
#
|
|
95
|
+
# @param url [String] The URL to scrape.
|
|
96
|
+
#
|
|
97
|
+
# @param image_params [ContextDev::Models::WebScrapeParams::ImageParams] Image options. Requires formats.images: true.
|
|
98
|
+
#
|
|
99
|
+
# @param markdown_params [ContextDev::Models::WebScrapeParams::MarkdownParams] Markdown options. Requires formats.markdown: true.
|
|
100
|
+
#
|
|
101
|
+
# @param max_age_ms [Integer] Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and update
|
|
102
|
+
#
|
|
103
|
+
# @param parse_params [ContextDev::Models::WebScrapeParams::ParseParams] Required when formats.parse is true.
|
|
104
|
+
#
|
|
105
|
+
# @param screenshot_params [ContextDev::Models::WebScrapeParams::ScreenshotParams] Screenshot options. Requires formats.screenshot: true.
|
|
106
|
+
#
|
|
107
|
+
# @param shared_params [ContextDev::Models::WebScrapeParams::SharedParams] Shared browser and content settings. Content filters leave screenshots and origi
|
|
108
|
+
#
|
|
109
|
+
# @param tags [Array<String>] Labels for tracking request usage. Not retained when zdr is enabled.
|
|
110
|
+
#
|
|
111
|
+
# @param timeout_opts [ContextDev::Models::WebScrapeParams::TimeoutOpts] Total deadline, including navigation, actions, waiting, and all outputs. Default
|
|
112
|
+
#
|
|
113
|
+
# @param zdr [Symbol, ContextDev::Models::WebScrapeParams::Zdr] Zero data retention. Bypasses caches and uploads; excludes request/response cont
|
|
114
|
+
#
|
|
115
|
+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
|
116
|
+
|
|
117
|
+
class Formats < ContextDev::Internal::Type::BaseModel
|
|
118
|
+
# @!attribute bytes
|
|
119
|
+
# The original HTTP response body.
|
|
120
|
+
#
|
|
121
|
+
# @return [Boolean, nil]
|
|
122
|
+
optional :bytes, ContextDev::Internal::Type::Boolean
|
|
123
|
+
|
|
124
|
+
# @!attribute html
|
|
125
|
+
# Rendered HTML.
|
|
126
|
+
#
|
|
127
|
+
# @return [Boolean, nil]
|
|
128
|
+
optional :html, ContextDev::Internal::Type::Boolean
|
|
129
|
+
|
|
130
|
+
# @!attribute images
|
|
131
|
+
# Images found on the page.
|
|
132
|
+
#
|
|
133
|
+
# @return [Boolean, nil]
|
|
134
|
+
optional :images, ContextDev::Internal::Type::Boolean
|
|
135
|
+
|
|
136
|
+
# @!attribute markdown
|
|
137
|
+
# Page content as Markdown.
|
|
138
|
+
#
|
|
139
|
+
# @return [Boolean, nil]
|
|
140
|
+
optional :markdown, ContextDev::Internal::Type::Boolean
|
|
141
|
+
|
|
142
|
+
# @!attribute parse
|
|
143
|
+
# Fields selected by parseParams.rules.
|
|
144
|
+
#
|
|
145
|
+
# @return [Boolean, nil]
|
|
146
|
+
optional :parse, ContextDev::Internal::Type::Boolean
|
|
147
|
+
|
|
148
|
+
# @!attribute screenshot
|
|
149
|
+
# An inline image of the page.
|
|
150
|
+
#
|
|
151
|
+
# @return [Boolean, nil]
|
|
152
|
+
optional :screenshot, ContextDev::Internal::Type::Boolean
|
|
153
|
+
|
|
154
|
+
# @!method initialize(bytes: nil, html: nil, images: nil, markdown: nil, parse: nil, screenshot: nil)
|
|
155
|
+
# Outputs to return. Enable at least one; omitted formats are false.
|
|
156
|
+
#
|
|
157
|
+
# @param bytes [Boolean] The original HTTP response body.
|
|
158
|
+
#
|
|
159
|
+
# @param html [Boolean] Rendered HTML.
|
|
160
|
+
#
|
|
161
|
+
# @param images [Boolean] Images found on the page.
|
|
162
|
+
#
|
|
163
|
+
# @param markdown [Boolean] Page content as Markdown.
|
|
164
|
+
#
|
|
165
|
+
# @param parse [Boolean] Fields selected by parseParams.rules.
|
|
166
|
+
#
|
|
167
|
+
# @param screenshot [Boolean] An inline image of the page.
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
class ImageParams < ContextDev::Internal::Type::BaseModel
|
|
171
|
+
# @!attribute dedupe
|
|
172
|
+
# For visual duplicates, keep the largest image.
|
|
173
|
+
#
|
|
174
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::ImageParams::Dedupe, nil]
|
|
175
|
+
optional :dedupe, enum: -> { ContextDev::WebScrapeParams::ImageParams::Dedupe }
|
|
176
|
+
|
|
177
|
+
# @!attribute enrich
|
|
178
|
+
# Add dimensions, a visual category, or a hosted file URL. Each image has a
|
|
179
|
+
# maximum processing time of 30000 milliseconds, bounded by the remaining request
|
|
180
|
+
# deadline.
|
|
181
|
+
#
|
|
182
|
+
# @return [Array<Symbol, ContextDev::Models::WebScrapeParams::ImageParams::Enrich>, nil]
|
|
183
|
+
optional :enrich,
|
|
184
|
+
-> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::WebScrapeParams::ImageParams::Enrich] }
|
|
185
|
+
|
|
186
|
+
# @!method initialize(dedupe: nil, enrich: nil)
|
|
187
|
+
# Some parameter documentations has been truncated, see
|
|
188
|
+
# {ContextDev::Models::WebScrapeParams::ImageParams} for more details.
|
|
189
|
+
#
|
|
190
|
+
# Image options. Requires formats.images: true.
|
|
191
|
+
#
|
|
192
|
+
# @param dedupe [Symbol, ContextDev::Models::WebScrapeParams::ImageParams::Dedupe] For visual duplicates, keep the largest image.
|
|
193
|
+
#
|
|
194
|
+
# @param enrich [Array<Symbol, ContextDev::Models::WebScrapeParams::ImageParams::Enrich>] Add dimensions, a visual category, or a hosted file URL. Each image has a maximu
|
|
195
|
+
|
|
196
|
+
# For visual duplicates, keep the largest image.
|
|
197
|
+
#
|
|
198
|
+
# @see ContextDev::Models::WebScrapeParams::ImageParams#dedupe
|
|
199
|
+
module Dedupe
|
|
200
|
+
extend ContextDev::Internal::Type::Enum
|
|
201
|
+
|
|
202
|
+
NONE = :none
|
|
203
|
+
VISUAL = :visual
|
|
204
|
+
|
|
205
|
+
# @!method self.values
|
|
206
|
+
# @return [Array<Symbol>]
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
module Enrich
|
|
210
|
+
extend ContextDev::Internal::Type::Enum
|
|
211
|
+
|
|
212
|
+
DIMENSIONS = :dimensions
|
|
213
|
+
CLASSIFICATION = :classification
|
|
214
|
+
FILE = :file
|
|
215
|
+
|
|
216
|
+
# @!method self.values
|
|
217
|
+
# @return [Array<Symbol>]
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
class MarkdownParams < ContextDev::Internal::Type::BaseModel
|
|
222
|
+
# @!attribute include_images
|
|
223
|
+
#
|
|
224
|
+
# @return [Boolean, nil]
|
|
225
|
+
optional :include_images, ContextDev::Internal::Type::Boolean, api_name: :includeImages
|
|
226
|
+
|
|
227
|
+
# @!attribute include_links
|
|
228
|
+
#
|
|
229
|
+
# @return [Boolean, nil]
|
|
230
|
+
optional :include_links, ContextDev::Internal::Type::Boolean, api_name: :includeLinks
|
|
231
|
+
|
|
232
|
+
# @!attribute inline_images
|
|
233
|
+
# Base64 images use placeholders by default. Requires includeImages: true.
|
|
234
|
+
#
|
|
235
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::MarkdownParams::InlineImages, nil]
|
|
236
|
+
optional :inline_images,
|
|
237
|
+
enum: -> { ContextDev::WebScrapeParams::MarkdownParams::InlineImages },
|
|
238
|
+
api_name: :inlineImages
|
|
239
|
+
|
|
240
|
+
# @!method initialize(include_images: nil, include_links: nil, inline_images: nil)
|
|
241
|
+
# Markdown options. Requires formats.markdown: true.
|
|
242
|
+
#
|
|
243
|
+
# @param include_images [Boolean]
|
|
244
|
+
#
|
|
245
|
+
# @param include_links [Boolean]
|
|
246
|
+
#
|
|
247
|
+
# @param inline_images [Symbol, ContextDev::Models::WebScrapeParams::MarkdownParams::InlineImages] Base64 images use placeholders by default. Requires includeImages: true.
|
|
248
|
+
|
|
249
|
+
# Base64 images use placeholders by default. Requires includeImages: true.
|
|
250
|
+
#
|
|
251
|
+
# @see ContextDev::Models::WebScrapeParams::MarkdownParams#inline_images
|
|
252
|
+
module InlineImages
|
|
253
|
+
extend ContextDev::Internal::Type::Enum
|
|
254
|
+
|
|
255
|
+
PLACEHOLDER = :placeholder
|
|
256
|
+
PRESERVE = :preserve
|
|
257
|
+
|
|
258
|
+
# @!method self.values
|
|
259
|
+
# @return [Array<Symbol>]
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
class ParseParams < ContextDev::Internal::Type::BaseModel
|
|
264
|
+
# @!attribute rules
|
|
265
|
+
# Map field names to CSS selectors or rules. Missing items return null; missing
|
|
266
|
+
# lists return [].
|
|
267
|
+
#
|
|
268
|
+
# @return [Hash{Symbol=>String, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1}]
|
|
269
|
+
required :rules,
|
|
270
|
+
-> { ContextDev::Internal::Type::HashOf[union: ContextDev::WebScrapeParams::ParseParams::Rule] }
|
|
271
|
+
|
|
272
|
+
# @!method initialize(rules:)
|
|
273
|
+
# Some parameter documentations has been truncated, see
|
|
274
|
+
# {ContextDev::Models::WebScrapeParams::ParseParams} for more details.
|
|
275
|
+
#
|
|
276
|
+
# Required when formats.parse is true.
|
|
277
|
+
#
|
|
278
|
+
# @param rules [Hash{Symbol=>String, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1}] Map field names to CSS selectors or rules. Missing items return null; missing li
|
|
279
|
+
|
|
280
|
+
module Rule
|
|
281
|
+
extend ContextDev::Internal::Type::Union
|
|
282
|
+
|
|
283
|
+
variant String
|
|
284
|
+
|
|
285
|
+
variant -> { ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1 }
|
|
286
|
+
|
|
287
|
+
class UnionMember1 < ContextDev::Internal::Type::BaseModel
|
|
288
|
+
# @!attribute selector
|
|
289
|
+
#
|
|
290
|
+
# @return [String]
|
|
291
|
+
required :selector, String
|
|
292
|
+
|
|
293
|
+
# @!attribute output
|
|
294
|
+
#
|
|
295
|
+
# @return [Symbol, String, Object, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Output, nil]
|
|
296
|
+
optional :output, union: -> { ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output }
|
|
297
|
+
|
|
298
|
+
# @!attribute type
|
|
299
|
+
#
|
|
300
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Type, nil]
|
|
301
|
+
optional :type, enum: -> { ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Type }
|
|
302
|
+
|
|
303
|
+
# @!method initialize(selector:, output: nil, type: nil)
|
|
304
|
+
# @param selector [String]
|
|
305
|
+
# @param output [Symbol, String, Object, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Output]
|
|
306
|
+
# @param type [Symbol, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Type]
|
|
307
|
+
|
|
308
|
+
# @see ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1#output
|
|
309
|
+
module Output
|
|
310
|
+
extend ContextDev::Internal::Type::Union
|
|
311
|
+
|
|
312
|
+
variant const: -> { ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::TEXT }
|
|
313
|
+
|
|
314
|
+
variant const: -> { ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::HTML }
|
|
315
|
+
|
|
316
|
+
variant String
|
|
317
|
+
|
|
318
|
+
variant ContextDev::Internal::Type::Unknown
|
|
319
|
+
|
|
320
|
+
# @!method self.variants
|
|
321
|
+
# @return [Array(Symbol, String, Object)]
|
|
322
|
+
|
|
323
|
+
define_sorbet_constant!(:Variants) do
|
|
324
|
+
T.type_alias do
|
|
325
|
+
T.any(
|
|
326
|
+
ContextDev::WebScrapeParams::ParseParams::Rule::UnionMember1::Output::TaggedSymbol,
|
|
327
|
+
String,
|
|
328
|
+
T.anything
|
|
329
|
+
)
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# @!group
|
|
334
|
+
|
|
335
|
+
TEXT = :text
|
|
336
|
+
HTML = :html
|
|
337
|
+
|
|
338
|
+
# @!endgroup
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# @see ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1#type
|
|
342
|
+
module Type
|
|
343
|
+
extend ContextDev::Internal::Type::Enum
|
|
344
|
+
|
|
345
|
+
ITEM = :item
|
|
346
|
+
LIST = :list
|
|
347
|
+
|
|
348
|
+
# @!method self.values
|
|
349
|
+
# @return [Array<Symbol>]
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# @!method self.variants
|
|
354
|
+
# @return [Array(String, ContextDev::Models::WebScrapeParams::ParseParams::Rule::UnionMember1)]
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
class ScreenshotParams < ContextDev::Internal::Type::BaseModel
|
|
359
|
+
# @!attribute area
|
|
360
|
+
# Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
|
|
361
|
+
#
|
|
362
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Page, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Element, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Rectangle, nil]
|
|
363
|
+
optional :area, union: -> { ContextDev::WebScrapeParams::ScreenshotParams::Area }
|
|
364
|
+
|
|
365
|
+
# @!attribute format_
|
|
366
|
+
#
|
|
367
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::ScreenshotParams::Format, nil]
|
|
368
|
+
optional :format_,
|
|
369
|
+
enum: -> {
|
|
370
|
+
ContextDev::WebScrapeParams::ScreenshotParams::Format
|
|
371
|
+
},
|
|
372
|
+
api_name: :format
|
|
373
|
+
|
|
374
|
+
# @!method initialize(area: nil, format_: nil)
|
|
375
|
+
# Some parameter documentations has been truncated, see
|
|
376
|
+
# {ContextDev::Models::WebScrapeParams::ScreenshotParams} for more details.
|
|
377
|
+
#
|
|
378
|
+
# Screenshot options. Requires formats.screenshot: true.
|
|
379
|
+
#
|
|
380
|
+
# @param area [Symbol, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Page, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Element, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Rectangle] Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
|
|
381
|
+
#
|
|
382
|
+
# @param format_ [Symbol, ContextDev::Models::WebScrapeParams::ScreenshotParams::Format]
|
|
383
|
+
|
|
384
|
+
# Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
|
|
385
|
+
#
|
|
386
|
+
# @see ContextDev::Models::WebScrapeParams::ScreenshotParams#area
|
|
387
|
+
module Area
|
|
388
|
+
extend ContextDev::Internal::Type::Union
|
|
389
|
+
|
|
390
|
+
variant enum: -> { ContextDev::WebScrapeParams::ScreenshotParams::Area::Page }
|
|
391
|
+
|
|
392
|
+
variant -> { ContextDev::WebScrapeParams::ScreenshotParams::Area::Element }
|
|
393
|
+
|
|
394
|
+
# Pixels from the document origin.
|
|
395
|
+
variant -> { ContextDev::WebScrapeParams::ScreenshotParams::Area::Rectangle }
|
|
396
|
+
|
|
397
|
+
module Page
|
|
398
|
+
extend ContextDev::Internal::Type::Enum
|
|
399
|
+
|
|
400
|
+
VIEWPORT = :viewport
|
|
401
|
+
FULL_PAGE = :fullPage
|
|
402
|
+
|
|
403
|
+
# @!method self.values
|
|
404
|
+
# @return [Array<Symbol>]
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
class Element < ContextDev::Internal::Type::BaseModel
|
|
408
|
+
# @!attribute selector
|
|
409
|
+
# Must match one visible element.
|
|
410
|
+
#
|
|
411
|
+
# @return [String]
|
|
412
|
+
required :selector, String
|
|
413
|
+
|
|
414
|
+
# @!method initialize(selector:)
|
|
415
|
+
# @param selector [String] Must match one visible element.
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
class Rectangle < ContextDev::Internal::Type::BaseModel
|
|
419
|
+
# @!attribute height
|
|
420
|
+
#
|
|
421
|
+
# @return [Integer]
|
|
422
|
+
required :height, Integer
|
|
423
|
+
|
|
424
|
+
# @!attribute width
|
|
425
|
+
#
|
|
426
|
+
# @return [Integer]
|
|
427
|
+
required :width, Integer
|
|
428
|
+
|
|
429
|
+
# @!attribute x
|
|
430
|
+
#
|
|
431
|
+
# @return [Integer]
|
|
432
|
+
required :x, Integer
|
|
433
|
+
|
|
434
|
+
# @!attribute y_
|
|
435
|
+
#
|
|
436
|
+
# @return [Integer]
|
|
437
|
+
required :y_, Integer, api_name: :y
|
|
438
|
+
|
|
439
|
+
# @!method initialize(height:, width:, x:, y_:)
|
|
440
|
+
# Pixels from the document origin.
|
|
441
|
+
#
|
|
442
|
+
# @param height [Integer]
|
|
443
|
+
# @param width [Integer]
|
|
444
|
+
# @param x [Integer]
|
|
445
|
+
# @param y_ [Integer]
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# @!method self.variants
|
|
449
|
+
# @return [Array(Symbol, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Page, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Element, ContextDev::Models::WebScrapeParams::ScreenshotParams::Area::Rectangle)]
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
# @see ContextDev::Models::WebScrapeParams::ScreenshotParams#format_
|
|
453
|
+
module Format
|
|
454
|
+
extend ContextDev::Internal::Type::Enum
|
|
455
|
+
|
|
456
|
+
PNG = :png
|
|
457
|
+
JPEG = :jpeg
|
|
458
|
+
WEBP = :webp
|
|
459
|
+
|
|
460
|
+
# @!method self.values
|
|
461
|
+
# @return [Array<Symbol>]
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
class SharedParams < ContextDev::Internal::Type::BaseModel
|
|
466
|
+
# @!attribute actions
|
|
467
|
+
# Run in order before capture. A failed action fails the request. Bypasses
|
|
468
|
+
# caching.
|
|
469
|
+
#
|
|
470
|
+
# @return [Array<ContextDev::Models::WebScrapeParams::SharedParams::Action::Perform, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll, ContextDev::Models::WebScrapeParams::SharedParams::Action::Wait, ContextDev::Models::WebScrapeParams::SharedParams::Action::WaitFor>, nil]
|
|
471
|
+
optional :actions,
|
|
472
|
+
-> { ContextDev::Internal::Type::ArrayOf[union: ContextDev::WebScrapeParams::SharedParams::Action] }
|
|
473
|
+
|
|
474
|
+
# @!attribute country
|
|
475
|
+
# Supported two-letter country code, case-insensitive. Applies to every output,
|
|
476
|
+
# including image downloads.
|
|
477
|
+
#
|
|
478
|
+
# @return [String, nil]
|
|
479
|
+
optional :country, String
|
|
480
|
+
|
|
481
|
+
# @!attribute dismiss_cookies
|
|
482
|
+
# Dismiss cookie banners by accepting cookies before actions.
|
|
483
|
+
#
|
|
484
|
+
# @return [Boolean, nil]
|
|
485
|
+
optional :dismiss_cookies, ContextDev::Internal::Type::Boolean, api_name: :dismissCookies
|
|
486
|
+
|
|
487
|
+
# @!attribute dismiss_popups
|
|
488
|
+
# Dismiss other popups before actions.
|
|
489
|
+
#
|
|
490
|
+
# @return [Boolean, nil]
|
|
491
|
+
optional :dismiss_popups, ContextDev::Internal::Type::Boolean, api_name: :dismissPopups
|
|
492
|
+
|
|
493
|
+
# @!attribute exclude_selectors
|
|
494
|
+
# Remove matching content. Exclusions win.
|
|
495
|
+
#
|
|
496
|
+
# @return [Array<String>, nil]
|
|
497
|
+
optional :exclude_selectors, ContextDev::Internal::Type::ArrayOf[String], api_name: :excludeSelectors
|
|
498
|
+
|
|
499
|
+
# @!attribute headers
|
|
500
|
+
# Headers for the target origin. Requests with custom headers bypass caching.
|
|
501
|
+
#
|
|
502
|
+
# @return [Hash{Symbol=>String}, nil]
|
|
503
|
+
optional :headers, ContextDev::Internal::Type::HashOf[String]
|
|
504
|
+
|
|
505
|
+
# @!attribute include_frames
|
|
506
|
+
# Include iframe content in extraction. Screenshots show visible frames
|
|
507
|
+
# regardless.
|
|
508
|
+
#
|
|
509
|
+
# @return [Boolean, nil]
|
|
510
|
+
optional :include_frames, ContextDev::Internal::Type::Boolean, api_name: :includeFrames
|
|
511
|
+
|
|
512
|
+
# @!attribute include_selectors
|
|
513
|
+
# Keep matching content after mainContentOnly.
|
|
514
|
+
#
|
|
515
|
+
# @return [Array<String>, nil]
|
|
516
|
+
optional :include_selectors, ContextDev::Internal::Type::ArrayOf[String], api_name: :includeSelectors
|
|
517
|
+
|
|
518
|
+
# @!attribute main_content_only
|
|
519
|
+
# Keep only main content in HTML, Markdown, images, and parsed fields.
|
|
520
|
+
#
|
|
521
|
+
# @return [Boolean, nil]
|
|
522
|
+
optional :main_content_only, ContextDev::Internal::Type::Boolean, api_name: :mainContentOnly
|
|
523
|
+
|
|
524
|
+
# @!attribute parsers
|
|
525
|
+
# Document parsing options.
|
|
526
|
+
#
|
|
527
|
+
# @return [ContextDev::Models::WebScrapeParams::SharedParams::Parsers, nil]
|
|
528
|
+
optional :parsers, -> { ContextDev::WebScrapeParams::SharedParams::Parsers }
|
|
529
|
+
|
|
530
|
+
# @!attribute settle_animations
|
|
531
|
+
# Settle animations before capture. Defaults to true with screenshots, otherwise
|
|
532
|
+
# false.
|
|
533
|
+
#
|
|
534
|
+
# @return [Boolean, nil]
|
|
535
|
+
optional :settle_animations, ContextDev::Internal::Type::Boolean, api_name: :settleAnimations
|
|
536
|
+
|
|
537
|
+
# @!attribute theme
|
|
538
|
+
# Override the browser color scheme.
|
|
539
|
+
#
|
|
540
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Theme, nil]
|
|
541
|
+
optional :theme, enum: -> { ContextDev::WebScrapeParams::SharedParams::Theme }
|
|
542
|
+
|
|
543
|
+
# @!attribute viewport
|
|
544
|
+
# Browser dimensions in pixels.
|
|
545
|
+
#
|
|
546
|
+
# @return [ContextDev::Models::WebScrapeParams::SharedParams::Viewport, nil]
|
|
547
|
+
optional :viewport, -> { ContextDev::WebScrapeParams::SharedParams::Viewport }
|
|
548
|
+
|
|
549
|
+
# @!attribute wait_for
|
|
550
|
+
# After actions, wait this many milliseconds or until a CSS selector is visible.
|
|
551
|
+
# Defaults to 500 ms, or 2000 ms with frames or an XML URL. Set 0 to skip.
|
|
552
|
+
#
|
|
553
|
+
# @return [Integer, String, nil]
|
|
554
|
+
optional :wait_for,
|
|
555
|
+
union: -> {
|
|
556
|
+
ContextDev::WebScrapeParams::SharedParams::WaitFor
|
|
557
|
+
},
|
|
558
|
+
api_name: :waitFor
|
|
559
|
+
|
|
560
|
+
# @!method initialize(actions: nil, country: nil, dismiss_cookies: nil, dismiss_popups: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_selectors: nil, main_content_only: nil, parsers: nil, settle_animations: nil, theme: nil, viewport: nil, wait_for: nil)
|
|
561
|
+
# Some parameter documentations has been truncated, see
|
|
562
|
+
# {ContextDev::Models::WebScrapeParams::SharedParams} for more details.
|
|
563
|
+
#
|
|
564
|
+
# Shared browser and content settings. Content filters leave screenshots and
|
|
565
|
+
# original bytes unchanged.
|
|
566
|
+
#
|
|
567
|
+
# @param actions [Array<ContextDev::Models::WebScrapeParams::SharedParams::Action::Perform, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll, ContextDev::Models::WebScrapeParams::SharedParams::Action::Wait, ContextDev::Models::WebScrapeParams::SharedParams::Action::WaitFor>] Run in order before capture. A failed action fails the request. Bypasses caching
|
|
568
|
+
#
|
|
569
|
+
# @param country [String] Supported two-letter country code, case-insensitive. Applies to every output, in
|
|
570
|
+
#
|
|
571
|
+
# @param dismiss_cookies [Boolean] Dismiss cookie banners by accepting cookies before actions.
|
|
572
|
+
#
|
|
573
|
+
# @param dismiss_popups [Boolean] Dismiss other popups before actions.
|
|
574
|
+
#
|
|
575
|
+
# @param exclude_selectors [Array<String>] Remove matching content. Exclusions win.
|
|
576
|
+
#
|
|
577
|
+
# @param headers [Hash{Symbol=>String}] Headers for the target origin. Requests with custom headers bypass caching.
|
|
578
|
+
#
|
|
579
|
+
# @param include_frames [Boolean] Include iframe content in extraction. Screenshots show visible frames regardless
|
|
580
|
+
#
|
|
581
|
+
# @param include_selectors [Array<String>] Keep matching content after mainContentOnly.
|
|
582
|
+
#
|
|
583
|
+
# @param main_content_only [Boolean] Keep only main content in HTML, Markdown, images, and parsed fields.
|
|
584
|
+
#
|
|
585
|
+
# @param parsers [ContextDev::Models::WebScrapeParams::SharedParams::Parsers] Document parsing options.
|
|
586
|
+
#
|
|
587
|
+
# @param settle_animations [Boolean] Settle animations before capture. Defaults to true with screenshots, otherwise f
|
|
588
|
+
#
|
|
589
|
+
# @param theme [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Theme] Override the browser color scheme.
|
|
590
|
+
#
|
|
591
|
+
# @param viewport [ContextDev::Models::WebScrapeParams::SharedParams::Viewport] Browser dimensions in pixels.
|
|
592
|
+
#
|
|
593
|
+
# @param wait_for [Integer, String] After actions, wait this many milliseconds or until a CSS selector is visible. D
|
|
594
|
+
|
|
595
|
+
module Action
|
|
596
|
+
extend ContextDev::Internal::Type::Union
|
|
597
|
+
|
|
598
|
+
discriminator :type
|
|
599
|
+
|
|
600
|
+
variant :perform, -> { ContextDev::WebScrapeParams::SharedParams::Action::Perform }
|
|
601
|
+
|
|
602
|
+
variant :scroll, -> { ContextDev::WebScrapeParams::SharedParams::Action::Scroll }
|
|
603
|
+
|
|
604
|
+
variant :wait, -> { ContextDev::WebScrapeParams::SharedParams::Action::Wait }
|
|
605
|
+
|
|
606
|
+
variant :waitFor, -> { ContextDev::WebScrapeParams::SharedParams::Action::WaitFor }
|
|
607
|
+
|
|
608
|
+
class Perform < ContextDev::Internal::Type::BaseModel
|
|
609
|
+
# @!attribute action
|
|
610
|
+
#
|
|
611
|
+
# @return [String]
|
|
612
|
+
required :action, String
|
|
613
|
+
|
|
614
|
+
# @!attribute type
|
|
615
|
+
#
|
|
616
|
+
# @return [Symbol, :perform]
|
|
617
|
+
required :type, const: :perform
|
|
618
|
+
|
|
619
|
+
# @!method initialize(action:, type: :perform)
|
|
620
|
+
# @param action [String]
|
|
621
|
+
# @param type [Symbol, :perform]
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
625
|
+
# @!attribute type
|
|
626
|
+
#
|
|
627
|
+
# @return [Symbol, :scroll]
|
|
628
|
+
required :type, const: :scroll
|
|
629
|
+
|
|
630
|
+
# @!attribute amount
|
|
631
|
+
#
|
|
632
|
+
# @return [Integer, Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Amount, nil]
|
|
633
|
+
optional :amount, union: -> { ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount }
|
|
634
|
+
|
|
635
|
+
# @!attribute direction
|
|
636
|
+
#
|
|
637
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Direction, nil]
|
|
638
|
+
optional :direction, enum: -> { ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Direction }
|
|
639
|
+
|
|
640
|
+
# @!attribute max_scrolls
|
|
641
|
+
#
|
|
642
|
+
# @return [Integer, nil]
|
|
643
|
+
optional :max_scrolls, Integer, api_name: :maxScrolls
|
|
644
|
+
|
|
645
|
+
# @!attribute selector
|
|
646
|
+
# Scroll this container. Omit to scroll the page.
|
|
647
|
+
#
|
|
648
|
+
# @return [String, nil]
|
|
649
|
+
optional :selector, String
|
|
650
|
+
|
|
651
|
+
# @!method initialize(amount: nil, direction: nil, max_scrolls: nil, selector: nil, type: :scroll)
|
|
652
|
+
# @param amount [Integer, Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Amount]
|
|
653
|
+
#
|
|
654
|
+
# @param direction [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Direction]
|
|
655
|
+
#
|
|
656
|
+
# @param max_scrolls [Integer]
|
|
657
|
+
#
|
|
658
|
+
# @param selector [String] Scroll this container. Omit to scroll the page.
|
|
659
|
+
#
|
|
660
|
+
# @param type [Symbol, :scroll]
|
|
661
|
+
|
|
662
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll#amount
|
|
663
|
+
module Amount
|
|
664
|
+
extend ContextDev::Internal::Type::Union
|
|
665
|
+
|
|
666
|
+
variant Integer
|
|
667
|
+
|
|
668
|
+
variant const: -> { ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Amount::VIEWPORT }
|
|
669
|
+
|
|
670
|
+
variant const: -> { ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll::Amount::MAX }
|
|
671
|
+
|
|
672
|
+
# @!method self.variants
|
|
673
|
+
# @return [Array(Integer, Symbol)]
|
|
674
|
+
|
|
675
|
+
define_sorbet_constant!(:Variants) do
|
|
676
|
+
T.type_alias { T.any(Integer, ContextDev::WebScrapeParams::SharedParams::Action::Scroll::Amount::TaggedSymbol) }
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
# @!group
|
|
680
|
+
|
|
681
|
+
VIEWPORT = :viewport
|
|
682
|
+
MAX = :max
|
|
683
|
+
|
|
684
|
+
# @!endgroup
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll#direction
|
|
688
|
+
module Direction
|
|
689
|
+
extend ContextDev::Internal::Type::Enum
|
|
690
|
+
|
|
691
|
+
DOWN = :down
|
|
692
|
+
UP = :up
|
|
693
|
+
LEFT = :left
|
|
694
|
+
RIGHT = :right
|
|
695
|
+
|
|
696
|
+
# @!method self.values
|
|
697
|
+
# @return [Array<Symbol>]
|
|
698
|
+
end
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
class Wait < ContextDev::Internal::Type::BaseModel
|
|
702
|
+
# @!attribute milliseconds
|
|
703
|
+
#
|
|
704
|
+
# @return [Integer]
|
|
705
|
+
required :milliseconds, Integer
|
|
706
|
+
|
|
707
|
+
# @!attribute type
|
|
708
|
+
#
|
|
709
|
+
# @return [Symbol, :wait]
|
|
710
|
+
required :type, const: :wait
|
|
711
|
+
|
|
712
|
+
# @!method initialize(milliseconds:, type: :wait)
|
|
713
|
+
# @param milliseconds [Integer]
|
|
714
|
+
# @param type [Symbol, :wait]
|
|
715
|
+
end
|
|
716
|
+
|
|
717
|
+
class WaitFor < ContextDev::Internal::Type::BaseModel
|
|
718
|
+
# @!attribute selector
|
|
719
|
+
#
|
|
720
|
+
# @return [String]
|
|
721
|
+
required :selector, String
|
|
722
|
+
|
|
723
|
+
# @!attribute type
|
|
724
|
+
#
|
|
725
|
+
# @return [Symbol, :waitFor]
|
|
726
|
+
required :type, const: :waitFor
|
|
727
|
+
|
|
728
|
+
# @!method initialize(selector:, type: :waitFor)
|
|
729
|
+
# @param selector [String]
|
|
730
|
+
# @param type [Symbol, :waitFor]
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# @!method self.variants
|
|
734
|
+
# @return [Array(ContextDev::Models::WebScrapeParams::SharedParams::Action::Perform, ContextDev::Models::WebScrapeParams::SharedParams::Action::Scroll, ContextDev::Models::WebScrapeParams::SharedParams::Action::Wait, ContextDev::Models::WebScrapeParams::SharedParams::Action::WaitFor)]
|
|
735
|
+
end
|
|
736
|
+
|
|
737
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams#parsers
|
|
738
|
+
class Parsers < ContextDev::Internal::Type::BaseModel
|
|
739
|
+
# @!attribute pdf
|
|
740
|
+
# PDF text options for HTML, Markdown, and parsed fields.
|
|
741
|
+
#
|
|
742
|
+
# @return [ContextDev::Models::WebScrapeParams::SharedParams::Parsers::Pdf, nil]
|
|
743
|
+
optional :pdf, -> { ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf }
|
|
744
|
+
|
|
745
|
+
# @!method initialize(pdf: nil)
|
|
746
|
+
# Document parsing options.
|
|
747
|
+
#
|
|
748
|
+
# @param pdf [ContextDev::Models::WebScrapeParams::SharedParams::Parsers::Pdf] PDF text options for HTML, Markdown, and parsed fields.
|
|
749
|
+
|
|
750
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams::Parsers#pdf
|
|
751
|
+
class Pdf < ContextDev::Internal::Type::BaseModel
|
|
752
|
+
# @!attribute end_page
|
|
753
|
+
# Last page to parse. Must be at least startPage.
|
|
754
|
+
#
|
|
755
|
+
# @return [Integer, nil]
|
|
756
|
+
optional :end_page, Integer, api_name: :endPage
|
|
757
|
+
|
|
758
|
+
# @!attribute ocr
|
|
759
|
+
# Read text from scanned pages.
|
|
760
|
+
#
|
|
761
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr, nil]
|
|
762
|
+
optional :ocr, enum: -> { ContextDev::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr }
|
|
763
|
+
|
|
764
|
+
# @!attribute start_page
|
|
765
|
+
# First page to parse, starting at 1.
|
|
766
|
+
#
|
|
767
|
+
# @return [Integer, nil]
|
|
768
|
+
optional :start_page, Integer, api_name: :startPage
|
|
769
|
+
|
|
770
|
+
# @!method initialize(end_page: nil, ocr: nil, start_page: nil)
|
|
771
|
+
# PDF text options for HTML, Markdown, and parsed fields.
|
|
772
|
+
#
|
|
773
|
+
# @param end_page [Integer] Last page to parse. Must be at least startPage.
|
|
774
|
+
#
|
|
775
|
+
# @param ocr [Symbol, ContextDev::Models::WebScrapeParams::SharedParams::Parsers::Pdf::Ocr] Read text from scanned pages.
|
|
776
|
+
#
|
|
777
|
+
# @param start_page [Integer] First page to parse, starting at 1.
|
|
778
|
+
|
|
779
|
+
# Read text from scanned pages.
|
|
780
|
+
#
|
|
781
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams::Parsers::Pdf#ocr
|
|
782
|
+
module Ocr
|
|
783
|
+
extend ContextDev::Internal::Type::Enum
|
|
784
|
+
|
|
785
|
+
OFF = :off
|
|
786
|
+
AUTO = :auto
|
|
787
|
+
|
|
788
|
+
# @!method self.values
|
|
789
|
+
# @return [Array<Symbol>]
|
|
790
|
+
end
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
|
|
794
|
+
# Override the browser color scheme.
|
|
795
|
+
#
|
|
796
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams#theme
|
|
797
|
+
module Theme
|
|
798
|
+
extend ContextDev::Internal::Type::Enum
|
|
799
|
+
|
|
800
|
+
LIGHT = :light
|
|
801
|
+
DARK = :dark
|
|
802
|
+
|
|
803
|
+
# @!method self.values
|
|
804
|
+
# @return [Array<Symbol>]
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams#viewport
|
|
808
|
+
class Viewport < ContextDev::Internal::Type::BaseModel
|
|
809
|
+
# @!attribute height
|
|
810
|
+
#
|
|
811
|
+
# @return [Integer, nil]
|
|
812
|
+
optional :height, Integer
|
|
813
|
+
|
|
814
|
+
# @!attribute width
|
|
815
|
+
#
|
|
816
|
+
# @return [Integer, nil]
|
|
817
|
+
optional :width, Integer
|
|
818
|
+
|
|
819
|
+
# @!method initialize(height: nil, width: nil)
|
|
820
|
+
# Browser dimensions in pixels.
|
|
821
|
+
#
|
|
822
|
+
# @param height [Integer]
|
|
823
|
+
# @param width [Integer]
|
|
824
|
+
end
|
|
825
|
+
|
|
826
|
+
# After actions, wait this many milliseconds or until a CSS selector is visible.
|
|
827
|
+
# Defaults to 500 ms, or 2000 ms with frames or an XML URL. Set 0 to skip.
|
|
828
|
+
#
|
|
829
|
+
# @see ContextDev::Models::WebScrapeParams::SharedParams#wait_for
|
|
830
|
+
module WaitFor
|
|
831
|
+
extend ContextDev::Internal::Type::Union
|
|
832
|
+
|
|
833
|
+
variant Integer
|
|
834
|
+
|
|
835
|
+
variant String
|
|
836
|
+
|
|
837
|
+
# @!method self.variants
|
|
838
|
+
# @return [Array(Integer, String)]
|
|
839
|
+
end
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
class TimeoutOpts < ContextDev::Internal::Type::BaseModel
|
|
843
|
+
# @!attribute milliseconds
|
|
844
|
+
# Request deadline in milliseconds. Maximum: 300000 (5 minutes).
|
|
845
|
+
#
|
|
846
|
+
# @return [Integer]
|
|
847
|
+
required :milliseconds, Integer
|
|
848
|
+
|
|
849
|
+
# @!attribute behavior
|
|
850
|
+
# What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
|
|
851
|
+
# credits. "return-partial" returns usable results collected so far; if none are
|
|
852
|
+
# available, the request still fails without charging credits. Partial results are
|
|
853
|
+
# not cached as complete results. "return-partial" requires milliseconds of at
|
|
854
|
+
# least 5000.
|
|
855
|
+
#
|
|
856
|
+
# @return [Symbol, ContextDev::Models::WebScrapeParams::TimeoutOpts::Behavior, nil]
|
|
857
|
+
optional :behavior, enum: -> { ContextDev::WebScrapeParams::TimeoutOpts::Behavior }
|
|
858
|
+
|
|
859
|
+
# @!method initialize(milliseconds:, behavior: nil)
|
|
860
|
+
# Some parameter documentations has been truncated, see
|
|
861
|
+
# {ContextDev::Models::WebScrapeParams::TimeoutOpts} for more details.
|
|
862
|
+
#
|
|
863
|
+
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
864
|
+
# Defaults to 60000 milliseconds with behavior fail. Use return-partial to capture
|
|
865
|
+
# the current page state and return captured images if image processing cannot
|
|
866
|
+
# finish before the deadline; these responses set isPartial and are not cached.
|
|
867
|
+
# Every requested format must still be available. Fixed waits must fit before a
|
|
868
|
+
# response reserve of up to 5000 milliseconds (at most one quarter of the timeout)
|
|
869
|
+
# when using return-partial.
|
|
870
|
+
#
|
|
871
|
+
# @param milliseconds [Integer] Request deadline in milliseconds. Maximum: 300000 (5 minutes).
|
|
872
|
+
#
|
|
873
|
+
# @param behavior [Symbol, ContextDev::Models::WebScrapeParams::TimeoutOpts::Behavior] What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
|
|
874
|
+
|
|
875
|
+
# What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
|
|
876
|
+
# credits. "return-partial" returns usable results collected so far; if none are
|
|
877
|
+
# available, the request still fails without charging credits. Partial results are
|
|
878
|
+
# not cached as complete results. "return-partial" requires milliseconds of at
|
|
879
|
+
# least 5000.
|
|
880
|
+
#
|
|
881
|
+
# @see ContextDev::Models::WebScrapeParams::TimeoutOpts#behavior
|
|
882
|
+
module Behavior
|
|
883
|
+
extend ContextDev::Internal::Type::Enum
|
|
884
|
+
|
|
885
|
+
FAIL = :fail
|
|
886
|
+
RETURN_PARTIAL = :"return-partial"
|
|
887
|
+
|
|
888
|
+
# @!method self.values
|
|
889
|
+
# @return [Array<Symbol>]
|
|
890
|
+
end
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
# Zero data retention. Bypasses caches and uploads; excludes request/response
|
|
894
|
+
# content and tags from logs. Must be enabled for your organization.
|
|
895
|
+
module Zdr
|
|
896
|
+
extend ContextDev::Internal::Type::Enum
|
|
897
|
+
|
|
898
|
+
ENABLED = :enabled
|
|
899
|
+
DISABLED = :disabled
|
|
900
|
+
|
|
901
|
+
# @!method self.values
|
|
902
|
+
# @return [Array<Symbol>]
|
|
903
|
+
end
|
|
904
|
+
end
|
|
905
|
+
end
|
|
906
|
+
end
|