context.dev 2.8.0 → 2.10.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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +10 -0
  5. data/lib/context_dev/models/batch_delete_params.rb +22 -0
  6. data/lib/context_dev/models/batch_delete_response.rb +60 -0
  7. data/lib/context_dev/models/batch_get_results_response.rb +46 -4
  8. data/lib/context_dev/models/batch_list_response.rb +13 -4
  9. data/lib/context_dev/models/batch_retrieve_response.rb +13 -4
  10. data/lib/context_dev/models/batch_submit_params.rb +2080 -26
  11. data/lib/context_dev/models/batch_submit_response.rb +125 -531
  12. data/lib/context_dev/models/brand_retrieve_response.rb +50 -1
  13. data/lib/context_dev/models/brand_search_params.rb +41 -3
  14. data/lib/context_dev/models/brand_search_response.rb +3 -2
  15. data/lib/context_dev/models/crawl_controls.rb +21 -15
  16. data/lib/context_dev/models/news_search_params.rb +467 -0
  17. data/lib/context_dev/models/news_search_response.rb +238 -0
  18. data/lib/context_dev/models/parse_handle_params.rb +20 -147
  19. data/lib/context_dev/models/person_enrich_params.rb +176 -0
  20. data/lib/context_dev/models/person_enrich_response.rb +641 -0
  21. data/lib/context_dev/models/utility_prefetch_params.rb +19 -16
  22. data/lib/context_dev/models/utility_prefetch_response.rb +4 -5
  23. data/lib/context_dev/models/web_screenshot_params.rb +3 -30
  24. data/lib/context_dev/models/web_search_response.rb +1 -0
  25. data/lib/context_dev/models/web_web_crawl_md_params.rb +5 -4
  26. data/lib/context_dev/models/web_web_crawl_md_response.rb +30 -1
  27. data/lib/context_dev/models/web_web_scrape_html_params.rb +20 -156
  28. data/lib/context_dev/models/web_web_scrape_html_response.rb +30 -1
  29. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -124
  30. data/lib/context_dev/models/web_web_scrape_md_params.rb +40 -241
  31. data/lib/context_dev/models/web_web_scrape_md_response.rb +41 -2
  32. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +11 -1
  33. data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +3 -2
  34. data/lib/context_dev/models.rb +6 -0
  35. data/lib/context_dev/resources/batch.rb +33 -7
  36. data/lib/context_dev/resources/brand.rb +10 -10
  37. data/lib/context_dev/resources/news.rb +51 -0
  38. data/lib/context_dev/resources/parse.rb +5 -5
  39. data/lib/context_dev/resources/people.rb +56 -0
  40. data/lib/context_dev/resources/utility.rb +7 -6
  41. data/lib/context_dev/resources/web.rb +46 -24
  42. data/lib/context_dev/version.rb +1 -1
  43. data/lib/context_dev.rb +8 -0
  44. data/rbi/context_dev/client.rbi +8 -0
  45. data/rbi/context_dev/models/batch_delete_params.rbi +40 -0
  46. data/rbi/context_dev/models/batch_delete_response.rbi +116 -0
  47. data/rbi/context_dev/models/batch_get_results_response.rbi +85 -3
  48. data/rbi/context_dev/models/batch_list_response.rbi +24 -8
  49. data/rbi/context_dev/models/batch_retrieve_response.rbi +24 -8
  50. data/rbi/context_dev/models/batch_submit_params.rbi +6421 -44
  51. data/rbi/context_dev/models/batch_submit_response.rbi +184 -1151
  52. data/rbi/context_dev/models/brand_retrieve_response.rbi +152 -0
  53. data/rbi/context_dev/models/brand_search_params.rbi +71 -2
  54. data/rbi/context_dev/models/brand_search_response.rbi +4 -2
  55. data/rbi/context_dev/models/crawl_controls.rbi +22 -28
  56. data/rbi/context_dev/models/news_search_params.rbi +1294 -0
  57. data/rbi/context_dev/models/news_search_response.rbi +423 -0
  58. data/rbi/context_dev/models/parse_handle_params.rbi +30 -323
  59. data/rbi/context_dev/models/person_enrich_params.rbi +332 -0
  60. data/rbi/context_dev/models/person_enrich_response.rbi +1295 -0
  61. data/rbi/context_dev/models/utility_prefetch_params.rbi +24 -16
  62. data/rbi/context_dev/models/utility_prefetch_response.rbi +8 -6
  63. data/rbi/context_dev/models/web_screenshot_params.rbi +4 -71
  64. data/rbi/context_dev/models/web_search_response.rbi +5 -0
  65. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +8 -6
  66. data/rbi/context_dev/models/web_web_crawl_md_response.rbi +67 -0
  67. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +30 -363
  68. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +65 -0
  69. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +16 -287
  70. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +57 -558
  71. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +80 -0
  72. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +15 -0
  73. data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +4 -2
  74. data/rbi/context_dev/models.rbi +6 -0
  75. data/rbi/context_dev/resources/batch.rbi +32 -10
  76. data/rbi/context_dev/resources/brand.rbi +14 -8
  77. data/rbi/context_dev/resources/news.rbi +46 -0
  78. data/rbi/context_dev/resources/parse.rbi +10 -26
  79. data/rbi/context_dev/resources/people.rbi +47 -0
  80. data/rbi/context_dev/resources/utility.rbi +8 -6
  81. data/rbi/context_dev/resources/web.rbi +49 -66
  82. data/sig/context_dev/client.rbs +4 -0
  83. data/sig/context_dev/models/batch_delete_params.rbs +23 -0
  84. data/sig/context_dev/models/batch_delete_response.rbs +57 -0
  85. data/sig/context_dev/models/batch_get_results_response.rbs +30 -2
  86. data/sig/context_dev/models/batch_list_response.rbs +16 -2
  87. data/sig/context_dev/models/batch_retrieve_response.rbs +16 -2
  88. data/sig/context_dev/models/batch_submit_params.rbs +2666 -15
  89. data/sig/context_dev/models/batch_submit_response.rbs +78 -466
  90. data/sig/context_dev/models/brand_retrieve_response.rbs +62 -0
  91. data/sig/context_dev/models/brand_search_params.rbs +38 -1
  92. data/sig/context_dev/models/crawl_controls.rbs +16 -16
  93. data/sig/context_dev/models/news_search_params.rbs +532 -0
  94. data/sig/context_dev/models/news_search_response.rbs +206 -0
  95. data/sig/context_dev/models/parse_handle_params.rbs +25 -90
  96. data/sig/context_dev/models/person_enrich_params.rbs +199 -0
  97. data/sig/context_dev/models/person_enrich_response.rbs +638 -0
  98. data/sig/context_dev/models/utility_prefetch_params.rbs +2 -1
  99. data/sig/context_dev/models/utility_prefetch_response.rbs +2 -1
  100. data/sig/context_dev/models/web_screenshot_params.rbs +5 -18
  101. data/sig/context_dev/models/web_search_response.rbs +2 -0
  102. data/sig/context_dev/models/web_web_crawl_md_response.rbs +21 -0
  103. data/sig/context_dev/models/web_web_scrape_html_params.rbs +24 -94
  104. data/sig/context_dev/models/web_web_scrape_html_response.rbs +21 -0
  105. data/sig/context_dev/models/web_web_scrape_images_params.rbs +20 -72
  106. data/sig/context_dev/models/web_web_scrape_md_params.rbs +46 -148
  107. data/sig/context_dev/models/web_web_scrape_md_response.rbs +28 -0
  108. data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +7 -0
  109. data/sig/context_dev/models.rbs +6 -0
  110. data/sig/context_dev/resources/batch.rbs +8 -2
  111. data/sig/context_dev/resources/brand.rbs +3 -0
  112. data/sig/context_dev/resources/news.rbs +17 -0
  113. data/sig/context_dev/resources/parse.rbs +5 -5
  114. data/sig/context_dev/resources/people.rbs +19 -0
  115. data/sig/context_dev/resources/web.rbs +13 -11
  116. metadata +26 -2
@@ -31,8 +31,8 @@ module ContextDev
31
31
  # group is kept. Images that cannot be downloaded or hashed are kept. Default:
32
32
  # false.
33
33
  #
34
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Dedupe, nil]
35
- optional :dedupe, union: -> { ContextDev::WebWebScrapeImagesParams::Dedupe }
34
+ # @return [Boolean, nil]
35
+ optional :dedupe, ContextDev::Internal::Type::Boolean
36
36
 
37
37
  # @!attribute enrichment
38
38
  # Optional per-image processing, sent as deep-object query params such as
@@ -87,7 +87,7 @@ module ContextDev
87
87
  #
88
88
  # @param actions [Array<ContextDev::Models::WebWebScrapeImagesParams::Action::Wait, ContextDev::Models::WebWebScrapeImagesParams::Action::Perform>, nil] Optional browser actions executed in array order after the page loads and before
89
89
  #
90
- # @param dedupe [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Dedupe] When true, visually duplicate images are removed: every image is loaded and perc
90
+ # @param dedupe [Boolean] When true, visually duplicate images are removed: every image is loaded and perc
91
91
  #
92
92
  # @param enrichment [ContextDev::Models::WebWebScrapeImagesParams::Enrichment, nil] Optional per-image processing, sent as deep-object query params such as enrichme
93
93
  #
@@ -156,49 +156,19 @@ module ContextDev
156
156
  # @return [Array(ContextDev::Models::WebWebScrapeImagesParams::Action::Wait, ContextDev::Models::WebWebScrapeImagesParams::Action::Perform)]
157
157
  end
158
158
 
159
- # When true, visually duplicate images are removed: every image is loaded and
160
- # perceptually hashed, and only the highest-resolution copy of each duplicate
161
- # group is kept. Images that cannot be downloaded or hashed are kept. Default:
162
- # false.
163
- module Dedupe
164
- extend ContextDev::Internal::Type::Union
165
-
166
- variant ContextDev::Internal::Type::Boolean
167
-
168
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Dedupe::TRUE }
169
-
170
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Dedupe::FALSE }
171
-
172
- # @!method self.variants
173
- # @return [Array(Boolean, Symbol)]
174
-
175
- define_sorbet_constant!(:Variants) do
176
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol) }
177
- end
178
-
179
- # @!group
180
-
181
- TRUE = :true
182
- FALSE = :false
183
-
184
- # @!endgroup
185
- end
186
-
187
159
  class Enrichment < ContextDev::Internal::Type::BaseModel
188
160
  # @!attribute classification
189
161
  # Classify each image by visual asset type.
190
162
  #
191
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification, nil]
192
- optional :classification, union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::Classification }
163
+ # @return [Boolean, nil]
164
+ optional :classification, ContextDev::Internal::Type::Boolean
193
165
 
194
166
  # @!attribute hosted_url
195
167
  # Host materializable images on the Brand.dev CDN and return their URL and MIME
196
168
  # type.
197
169
  #
198
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL, nil]
199
- optional :hosted_url,
200
- union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL },
201
- api_name: :hostedUrl
170
+ # @return [Boolean, nil]
171
+ optional :hosted_url, ContextDev::Internal::Type::Boolean, api_name: :hostedUrl
202
172
 
203
173
  # @!attribute max_time_per_ms
204
174
  # Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
@@ -209,8 +179,8 @@ module ContextDev
209
179
  # @!attribute resolution
210
180
  # Measure image width and height when possible.
211
181
  #
212
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution, nil]
213
- optional :resolution, union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution }
182
+ # @return [Boolean, nil]
183
+ optional :resolution, ContextDev::Internal::Type::Boolean
214
184
 
215
185
  # @!method initialize(classification: nil, hosted_url: nil, max_time_per_ms: nil, resolution: nil)
216
186
  # Some parameter documentations has been truncated, see
@@ -219,95 +189,13 @@ module ContextDev
219
189
  # Optional per-image processing, sent as deep-object query params such as
220
190
  # enrichment[resolution]=true.
221
191
  #
222
- # @param classification [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification] Classify each image by visual asset type.
192
+ # @param classification [Boolean] Classify each image by visual asset type.
223
193
  #
224
- # @param hosted_url [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL] Host materializable images on the Brand.dev CDN and return their URL and MIME ty
194
+ # @param hosted_url [Boolean] Host materializable images on the Brand.dev CDN and return their URL and MIME ty
225
195
  #
226
196
  # @param max_time_per_ms [Integer] Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
227
197
  #
228
- # @param resolution [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution] Measure image width and height when possible.
229
-
230
- # Classify each image by visual asset type.
231
- #
232
- # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#classification
233
- module Classification
234
- extend ContextDev::Internal::Type::Union
235
-
236
- variant ContextDev::Internal::Type::Boolean
237
-
238
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification::TRUE }
239
-
240
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification::FALSE }
241
-
242
- # @!method self.variants
243
- # @return [Array(Boolean, Symbol)]
244
-
245
- define_sorbet_constant!(:Variants) do
246
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol) }
247
- end
248
-
249
- # @!group
250
-
251
- TRUE = :true
252
- FALSE = :false
253
-
254
- # @!endgroup
255
- end
256
-
257
- # Host materializable images on the Brand.dev CDN and return their URL and MIME
258
- # type.
259
- #
260
- # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#hosted_url
261
- module HostedURL
262
- extend ContextDev::Internal::Type::Union
263
-
264
- variant ContextDev::Internal::Type::Boolean
265
-
266
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL::TRUE }
267
-
268
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL::FALSE }
269
-
270
- # @!method self.variants
271
- # @return [Array(Boolean, Symbol)]
272
-
273
- define_sorbet_constant!(:Variants) do
274
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol) }
275
- end
276
-
277
- # @!group
278
-
279
- TRUE = :true
280
- FALSE = :false
281
-
282
- # @!endgroup
283
- end
284
-
285
- # Measure image width and height when possible.
286
- #
287
- # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#resolution
288
- module Resolution
289
- extend ContextDev::Internal::Type::Union
290
-
291
- variant ContextDev::Internal::Type::Boolean
292
-
293
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution::TRUE }
294
-
295
- variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution::FALSE }
296
-
297
- # @!method self.variants
298
- # @return [Array(Boolean, Symbol)]
299
-
300
- define_sorbet_constant!(:Variants) do
301
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol) }
302
- end
303
-
304
- # @!group
305
-
306
- TRUE = :true
307
- FALSE = :false
308
-
309
- # @!endgroup
310
- end
198
+ # @param resolution [Boolean] Measure image width and height when possible.
311
199
  end
312
200
  end
313
201
  end
@@ -50,20 +50,28 @@ module ContextDev
50
50
  # @!attribute include_frames
51
51
  # When true, the contents of iframes are rendered to Markdown.
52
52
  #
53
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeFrames, nil]
54
- optional :include_frames, union: -> { ContextDev::WebWebScrapeMdParams::IncludeFrames }
53
+ # @return [Boolean, nil]
54
+ optional :include_frames, ContextDev::Internal::Type::Boolean
55
+
56
+ # @!attribute include_html
57
+ # When true, the response also includes an `html` field with the page HTML the
58
+ # Markdown was converted from — the same body the Scrape HTML endpoint returns for
59
+ # the equivalent request.
60
+ #
61
+ # @return [Boolean, nil]
62
+ optional :include_html, ContextDev::Internal::Type::Boolean
55
63
 
56
64
  # @!attribute include_images
57
65
  # Include image references in Markdown output
58
66
  #
59
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeImages, nil]
60
- optional :include_images, union: -> { ContextDev::WebWebScrapeMdParams::IncludeImages }
67
+ # @return [Boolean, nil]
68
+ optional :include_images, ContextDev::Internal::Type::Boolean
61
69
 
62
70
  # @!attribute include_links
63
71
  # Preserve hyperlinks in Markdown output
64
72
  #
65
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeLinks, nil]
66
- optional :include_links, union: -> { ContextDev::WebWebScrapeMdParams::IncludeLinks }
73
+ # @return [Boolean, nil]
74
+ optional :include_links, ContextDev::Internal::Type::Boolean
67
75
 
68
76
  # @!attribute include_selectors
69
77
  # CSS selectors. When provided, only matching HTML subtrees (and their
@@ -93,14 +101,14 @@ module ContextDev
93
101
  # converting to Markdown. Defaults to false. This adds a bit of latency in
94
102
  # exchange for more stable output on animated pages.
95
103
  #
96
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::SettleAnimations, nil]
97
- optional :settle_animations, union: -> { ContextDev::WebWebScrapeMdParams::SettleAnimations }
104
+ # @return [Boolean, nil]
105
+ optional :settle_animations, ContextDev::Internal::Type::Boolean
98
106
 
99
107
  # @!attribute shorten_base64_images
100
108
  # Shorten base64-encoded image data in the Markdown output
101
109
  #
102
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images, nil]
103
- optional :shorten_base64_images, union: -> { ContextDev::WebWebScrapeMdParams::ShortenBase64Images }
110
+ # @return [Boolean, nil]
111
+ optional :shorten_base64_images, ContextDev::Internal::Type::Boolean
104
112
 
105
113
  # @!attribute tags
106
114
  # Optional comma-separated caller-defined tags for tracking this request. Tags are
@@ -122,8 +130,8 @@ module ContextDev
122
130
  # Extract only the main content of the page, excluding headers, footers, sidebars,
123
131
  # and navigation
124
132
  #
125
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly, nil]
126
- optional :use_main_content_only, union: -> { ContextDev::WebWebScrapeMdParams::UseMainContentOnly }
133
+ # @return [Boolean, nil]
134
+ optional :use_main_content_only, ContextDev::Internal::Type::Boolean
127
135
 
128
136
  # @!attribute wait_for_ms
129
137
  # Optional browser wait time in milliseconds after initial page load before
@@ -141,7 +149,7 @@ module ContextDev
141
149
  # @return [Symbol, ContextDev::Models::WebWebScrapeMdParams::Zdr, nil]
142
150
  optional :zdr, enum: -> { ContextDev::WebWebScrapeMdParams::Zdr }
143
151
 
144
- # @!method initialize(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {})
152
+ # @!method initialize(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_html: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {})
145
153
  # Some parameter documentations has been truncated, see
146
154
  # {ContextDev::Models::WebWebScrapeMdParams} for more details.
147
155
  #
@@ -155,11 +163,13 @@ module ContextDev
155
163
  #
156
164
  # @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob
157
165
  #
158
- # @param include_frames [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeFrames] When true, the contents of iframes are rendered to Markdown.
166
+ # @param include_frames [Boolean] When true, the contents of iframes are rendered to Markdown.
159
167
  #
160
- # @param include_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeImages] Include image references in Markdown output
168
+ # @param include_html [Boolean] When true, the response also includes an `html` field with the page HTML the Mar
161
169
  #
162
- # @param include_links [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeLinks] Preserve hyperlinks in Markdown output
170
+ # @param include_images [Boolean] Include image references in Markdown output
171
+ #
172
+ # @param include_links [Boolean] Preserve hyperlinks in Markdown output
163
173
  #
164
174
  # @param include_selectors [Array<String>, nil] CSS selectors. When provided, only matching HTML subtrees (and their descendants
165
175
  #
@@ -167,15 +177,15 @@ module ContextDev
167
177
  #
168
178
  # @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image
169
179
  #
170
- # @param settle_animations [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::SettleAnimations] When true, waits briefly for CSS and transition animations to settle before conv
180
+ # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv
171
181
  #
172
- # @param shorten_base64_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images] Shorten base64-encoded image data in the Markdown output
182
+ # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output
173
183
  #
174
184
  # @param tags [Array<String>] Optional comma-separated caller-defined tags for tracking this request. Tags are
175
185
  #
176
186
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
177
187
  #
178
- # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly] Extract only the main content of the page, excluding headers, footers, sidebars,
188
+ # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars,
179
189
  #
180
190
  # @param wait_for_ms [Integer, nil] Optional browser wait time in milliseconds after initial page load before conver
181
191
  #
@@ -450,81 +460,6 @@ module ContextDev
450
460
  # @return [Array<Symbol>]
451
461
  end
452
462
 
453
- # When true, the contents of iframes are rendered to Markdown.
454
- module IncludeFrames
455
- extend ContextDev::Internal::Type::Union
456
-
457
- variant ContextDev::Internal::Type::Boolean
458
-
459
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeFrames::TRUE }
460
-
461
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeFrames::FALSE }
462
-
463
- # @!method self.variants
464
- # @return [Array(Boolean, Symbol)]
465
-
466
- define_sorbet_constant!(:Variants) do
467
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeFrames::TaggedSymbol) }
468
- end
469
-
470
- # @!group
471
-
472
- TRUE = :true
473
- FALSE = :false
474
-
475
- # @!endgroup
476
- end
477
-
478
- # Include image references in Markdown output
479
- module IncludeImages
480
- extend ContextDev::Internal::Type::Union
481
-
482
- variant ContextDev::Internal::Type::Boolean
483
-
484
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeImages::TRUE }
485
-
486
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeImages::FALSE }
487
-
488
- # @!method self.variants
489
- # @return [Array(Boolean, Symbol)]
490
-
491
- define_sorbet_constant!(:Variants) do
492
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeImages::TaggedSymbol) }
493
- end
494
-
495
- # @!group
496
-
497
- TRUE = :true
498
- FALSE = :false
499
-
500
- # @!endgroup
501
- end
502
-
503
- # Preserve hyperlinks in Markdown output
504
- module IncludeLinks
505
- extend ContextDev::Internal::Type::Union
506
-
507
- variant ContextDev::Internal::Type::Boolean
508
-
509
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeLinks::TRUE }
510
-
511
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeLinks::FALSE }
512
-
513
- # @!method self.variants
514
- # @return [Array(Boolean, Symbol)]
515
-
516
- define_sorbet_constant!(:Variants) do
517
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeLinks::TaggedSymbol) }
518
- end
519
-
520
- # @!group
521
-
522
- TRUE = :true
523
- FALSE = :false
524
-
525
- # @!endgroup
526
- end
527
-
528
463
  class Pdf < ContextDev::Internal::Type::BaseModel
529
464
  # @!attribute end_
530
465
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
@@ -534,21 +469,20 @@ module ContextDev
534
469
  optional :end_, Integer, api_name: :end
535
470
 
536
471
  # @!attribute ocr
537
- # When true, detect and OCR images embedded in the selected PDF pages, inserting
538
- # recognized text at each image's position in page reading order while preserving
539
- # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
472
+ # When true, OCR the selected PDF pages that have no usable text layer (scans),
473
+ # replacing each recovered page's text with the OCR result while pages with a real
474
+ # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
475
+ # of the base request cost. When false, no OCR runs.
540
476
  #
541
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr, nil]
542
- optional :ocr, union: -> { ContextDev::WebWebScrapeMdParams::Pdf::Ocr }
477
+ # @return [Boolean, nil]
478
+ optional :ocr, ContextDev::Internal::Type::Boolean
543
479
 
544
480
  # @!attribute should_parse
545
481
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
546
- # a 400 WEBSITE_ACCESS_ERROR is returned.
482
+ # a 400 PDF_SKIPPED is returned.
547
483
  #
548
- # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse, nil]
549
- optional :should_parse,
550
- union: -> { ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse },
551
- api_name: :shouldParse
484
+ # @return [Boolean, nil]
485
+ optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse
552
486
 
553
487
  # @!attribute start
554
488
  # First 1-based PDF page to parse. When omitted, parsing starts at the first page.
@@ -565,146 +499,11 @@ module ContextDev
565
499
  #
566
500
  # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus
567
501
  #
568
- # @param ocr [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr] When true, detect and OCR images embedded in the selected PDF pages, inserting r
502
+ # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re
569
503
  #
570
- # @param should_parse [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
504
+ # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
571
505
  #
572
506
  # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page.
573
-
574
- # When true, detect and OCR images embedded in the selected PDF pages, inserting
575
- # recognized text at each image's position in page reading order while preserving
576
- # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
577
- #
578
- # @see ContextDev::Models::WebWebScrapeMdParams::Pdf#ocr
579
- module Ocr
580
- extend ContextDev::Internal::Type::Union
581
-
582
- variant ContextDev::Internal::Type::Boolean
583
-
584
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr::TRUE }
585
-
586
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr::FALSE }
587
-
588
- # @!method self.variants
589
- # @return [Array(Boolean, Symbol)]
590
-
591
- define_sorbet_constant!(:Variants) do
592
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::Pdf::Ocr::TaggedSymbol) }
593
- end
594
-
595
- # @!group
596
-
597
- TRUE = :true
598
- FALSE = :false
599
-
600
- # @!endgroup
601
- end
602
-
603
- # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
604
- # a 400 WEBSITE_ACCESS_ERROR is returned.
605
- #
606
- # @see ContextDev::Models::WebWebScrapeMdParams::Pdf#should_parse
607
- module ShouldParse
608
- extend ContextDev::Internal::Type::Union
609
-
610
- variant ContextDev::Internal::Type::Boolean
611
-
612
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse::TRUE }
613
-
614
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse::FALSE }
615
-
616
- # @!method self.variants
617
- # @return [Array(Boolean, Symbol)]
618
-
619
- define_sorbet_constant!(:Variants) do
620
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::TaggedSymbol) }
621
- end
622
-
623
- # @!group
624
-
625
- TRUE = :true
626
- FALSE = :false
627
-
628
- # @!endgroup
629
- end
630
- end
631
-
632
- # When true, waits briefly for CSS and transition animations to settle before
633
- # converting to Markdown. Defaults to false. This adds a bit of latency in
634
- # exchange for more stable output on animated pages.
635
- module SettleAnimations
636
- extend ContextDev::Internal::Type::Union
637
-
638
- variant ContextDev::Internal::Type::Boolean
639
-
640
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::SettleAnimations::TRUE }
641
-
642
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::SettleAnimations::FALSE }
643
-
644
- # @!method self.variants
645
- # @return [Array(Boolean, Symbol)]
646
-
647
- define_sorbet_constant!(:Variants) do
648
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::SettleAnimations::TaggedSymbol) }
649
- end
650
-
651
- # @!group
652
-
653
- TRUE = :true
654
- FALSE = :false
655
-
656
- # @!endgroup
657
- end
658
-
659
- # Shorten base64-encoded image data in the Markdown output
660
- module ShortenBase64Images
661
- extend ContextDev::Internal::Type::Union
662
-
663
- variant ContextDev::Internal::Type::Boolean
664
-
665
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images::TRUE }
666
-
667
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images::FALSE }
668
-
669
- # @!method self.variants
670
- # @return [Array(Boolean, Symbol)]
671
-
672
- define_sorbet_constant!(:Variants) do
673
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::ShortenBase64Images::TaggedSymbol) }
674
- end
675
-
676
- # @!group
677
-
678
- TRUE = :true
679
- FALSE = :false
680
-
681
- # @!endgroup
682
- end
683
-
684
- # Extract only the main content of the page, excluding headers, footers, sidebars,
685
- # and navigation
686
- module UseMainContentOnly
687
- extend ContextDev::Internal::Type::Union
688
-
689
- variant ContextDev::Internal::Type::Boolean
690
-
691
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly::TRUE }
692
-
693
- variant const: -> { ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly::FALSE }
694
-
695
- # @!method self.variants
696
- # @return [Array(Boolean, Symbol)]
697
-
698
- define_sorbet_constant!(:Variants) do
699
- T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::UseMainContentOnly::TaggedSymbol) }
700
- end
701
-
702
- # @!group
703
-
704
- TRUE = :true
705
- FALSE = :false
706
-
707
- # @!endgroup
708
507
  end
709
508
 
710
509
  # Set to enabled to bypass shared caches and omit request and response content
@@ -51,6 +51,14 @@ module ContextDev
51
51
  # @return [Boolean, nil]
52
52
  optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale
53
53
 
54
+ # @!attribute html
55
+ # Only present when includeHTML=true: the page HTML the Markdown was converted
56
+ # from — the same body the Scrape HTML endpoint returns for the equivalent
57
+ # request.
58
+ #
59
+ # @return [String, nil]
60
+ optional :html, String
61
+
54
62
  # @!attribute key_metadata
55
63
  # Metadata about the API key used for the request. Included in every response
56
64
  # whenever a valid API key is provided, even when the response status is not 200.
@@ -58,7 +66,7 @@ module ContextDev
58
66
  # @return [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata, nil]
59
67
  optional :key_metadata, -> { ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata }
60
68
 
61
- # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil)
69
+ # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, html: nil, key_metadata: nil)
62
70
  # Some parameter documentations has been truncated, see
63
71
  # {ContextDev::Models::WebWebScrapeMdResponse} for more details.
64
72
  #
@@ -76,6 +84,8 @@ module ContextDev
76
84
  #
77
85
  # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed
78
86
  #
87
+ # @param html [String] Only present when includeHTML=true: the page HTML the Markdown was converted fro
88
+ #
79
89
  # @param key_metadata [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
80
90
 
81
91
  # @see ContextDev::Models::WebWebScrapeMdResponse#metadata
@@ -132,6 +142,14 @@ module ContextDev
132
142
  # @return [String, nil]
133
143
  optional :favicon, String
134
144
 
145
+ # @!attribute headings
146
+ # Page headings (h1–h6) in document order, extracted from the unfiltered document.
147
+ # Capped at the first 500 headings. Omitted when the page has none.
148
+ #
149
+ # @return [Array<ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading>, nil]
150
+ optional :headings,
151
+ -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading] }
152
+
135
153
  # @!attribute image
136
154
  # Primary resolved preview image from Open Graph, Twitter, or image metadata.
137
155
  #
@@ -203,7 +221,7 @@ module ContextDev
203
221
  optional :twitter,
204
222
  -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::WebWebScrapeMdResponse::Metadata::Twitter] }
205
223
 
206
- # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil)
224
+ # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, headings: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil)
207
225
  # Some parameter documentations has been truncated, see
208
226
  # {ContextDev::Models::WebWebScrapeMdResponse::Metadata} for more details.
209
227
  #
@@ -225,6 +243,8 @@ module ContextDev
225
243
  #
226
244
  # @param favicon [String] Resolved favicon URL, when present.
227
245
  #
246
+ # @param headings [Array<ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading>] Page headings (h1–h6) in document order, extracted from the unfiltered document.
247
+ #
228
248
  # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata.
229
249
  #
230
250
  # @param json_ld [Array<Hash{Symbol=>Object}>] JSON-LD structured data blocks parsed from the page.
@@ -296,6 +316,25 @@ module ContextDev
296
316
  # @param type [String] Alternate resource MIME type, when present.
297
317
  end
298
318
 
319
+ class Heading < ContextDev::Internal::Type::BaseModel
320
+ # @!attribute level
321
+ # Heading level, 1–6 (from h1–h6).
322
+ #
323
+ # @return [Integer]
324
+ required :level, Integer
325
+
326
+ # @!attribute text
327
+ # Heading text with whitespace collapsed, truncated to 1000 characters.
328
+ #
329
+ # @return [String]
330
+ required :text, String
331
+
332
+ # @!method initialize(level:, text:)
333
+ # @param level [Integer] Heading level, 1–6 (from h1–h6).
334
+ #
335
+ # @param text [String] Heading text with whitespace collapsed, truncated to 1000 characters.
336
+ end
337
+
299
338
  module OpenGraph
300
339
  extend ContextDev::Internal::Type::Union
301
340
 
@@ -28,6 +28,14 @@ module ContextDev
28
28
  # @return [Integer, nil]
29
29
  optional :max_links, Integer
30
30
 
31
+ # @!attribute search
32
+ # Optional search phrase. When provided, the crawled sitemap is filtered to the
33
+ # pages whose URLs are about that phrase, most relevant first, and the request
34
+ # costs 2 credits instead of 1.
35
+ #
36
+ # @return [String, nil]
37
+ optional :search, String
38
+
31
39
  # @!attribute sitemap_url
32
40
  # Optional explicit sitemap URL. When provided, exactly this sitemap is crawled
33
41
  # instead of discovering the domain's sitemaps.
@@ -67,7 +75,7 @@ module ContextDev
67
75
  # @return [Symbol, ContextDev::Models::WebWebScrapeSitemapParams::Zdr, nil]
68
76
  optional :zdr, enum: -> { ContextDev::WebWebScrapeSitemapParams::Zdr }
69
77
 
70
- # @!method initialize(domain:, headers: nil, max_links: nil, sitemap_url: nil, tags: nil, timeout_ms: nil, url_regex: nil, zdr: nil, request_options: {})
78
+ # @!method initialize(domain:, headers: nil, max_links: nil, search: nil, sitemap_url: nil, tags: nil, timeout_ms: nil, url_regex: nil, zdr: nil, request_options: {})
71
79
  # Some parameter documentations has been truncated, see
72
80
  # {ContextDev::Models::WebWebScrapeSitemapParams} for more details.
73
81
  #
@@ -77,6 +85,8 @@ module ContextDev
77
85
  #
78
86
  # @param max_links [Integer] Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Mi
79
87
  #
88
+ # @param search [String] Optional search phrase. When provided, the crawled sitemap is filtered to the pa
89
+ #
80
90
  # @param sitemap_url [String] Optional explicit sitemap URL. When provided, exactly this sitemap is crawled in
81
91
  #
82
92
  # @param tags [Array<String>] Optional comma-separated caller-defined tags for tracking this request. Tags are