context.dev 2.17.1 → 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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +0 -4
  5. data/lib/context_dev/models/industry_retrieve_naics_params.rb +28 -1
  6. data/lib/context_dev/models/industry_retrieve_sic_params.rb +28 -1
  7. data/lib/context_dev/models/monitor_retrieve_run_params.rb +26 -0
  8. data/lib/context_dev/models/monitor_retrieve_run_response.rb +232 -0
  9. data/lib/context_dev/models/monitor_rotate_webhook_secret_params.rb +20 -0
  10. data/lib/context_dev/models/monitor_rotate_webhook_secret_response.rb +765 -0
  11. data/lib/context_dev/models/parse_handle_params.rb +8 -6
  12. data/lib/context_dev/models/person_enrich_params.rb +28 -1
  13. data/lib/context_dev/models/web_answers_params.rb +28 -1
  14. data/lib/context_dev/models/web_extract_competitors_params.rb +28 -1
  15. data/lib/context_dev/models/web_extract_styleguide_params.rb +30 -3
  16. data/lib/context_dev/models/{web_web_scrape_sitemap_params.rb → web_map_urls_params.rb} +22 -20
  17. data/lib/context_dev/models/web_map_urls_response.rb +123 -0
  18. data/lib/context_dev/models/web_scrape_params.rb +906 -0
  19. data/lib/context_dev/models/web_scrape_response.rb +659 -0
  20. data/lib/context_dev/models/web_screenshot_params.rb +25 -9
  21. data/lib/context_dev/models/web_screenshot_response.rb +3 -3
  22. data/lib/context_dev/models/web_search_params.rb +30 -3
  23. data/lib/context_dev/models.rb +8 -20
  24. data/lib/context_dev/resources/brand.rb +0 -36
  25. data/lib/context_dev/resources/industry.rb +6 -2
  26. data/lib/context_dev/resources/monitors.rb +47 -0
  27. data/lib/context_dev/resources/people.rb +3 -1
  28. data/lib/context_dev/resources/web.rb +116 -413
  29. data/lib/context_dev/version.rb +1 -1
  30. data/lib/context_dev.rb +8 -21
  31. data/rbi/context_dev/client.rbi +0 -3
  32. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +59 -0
  33. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +57 -0
  34. data/rbi/context_dev/models/monitor_retrieve_run_params.rbi +46 -0
  35. data/rbi/context_dev/models/monitor_retrieve_run_response.rbi +452 -0
  36. data/rbi/context_dev/models/monitor_rotate_webhook_secret_params.rbi +38 -0
  37. data/rbi/context_dev/models/monitor_rotate_webhook_secret_response.rbi +1367 -0
  38. data/rbi/context_dev/models/parse_handle_params.rbi +12 -9
  39. data/rbi/context_dev/models/person_enrich_params.rbi +45 -0
  40. data/rbi/context_dev/models/web_answers_params.rbi +45 -0
  41. data/rbi/context_dev/models/web_extract_competitors_params.rbi +59 -0
  42. data/rbi/context_dev/models/web_extract_styleguide_params.rbi +62 -3
  43. data/rbi/context_dev/models/{web_web_scrape_sitemap_params.rbi → web_map_urls_params.rbi} +35 -54
  44. data/rbi/context_dev/models/web_map_urls_response.rbi +226 -0
  45. data/rbi/context_dev/models/web_scrape_params.rbi +2000 -0
  46. data/rbi/context_dev/models/{web_web_scrape_html_response.rbi → web_scrape_response.rbi} +550 -418
  47. data/rbi/context_dev/models/web_screenshot_params.rbi +38 -12
  48. data/rbi/context_dev/models/web_screenshot_response.rbi +4 -4
  49. data/rbi/context_dev/models/web_search_params.rbi +48 -3
  50. data/rbi/context_dev/models.rbi +9 -21
  51. data/rbi/context_dev/resources/brand.rbi +0 -35
  52. data/rbi/context_dev/resources/industry.rbi +14 -0
  53. data/rbi/context_dev/resources/monitors.rbi +24 -0
  54. data/rbi/context_dev/resources/parse.rbi +4 -4
  55. data/rbi/context_dev/resources/people.rbi +7 -0
  56. data/rbi/context_dev/resources/web.rbi +166 -533
  57. data/sig/context_dev/client.rbs +0 -2
  58. data/sig/context_dev/models/industry_retrieve_naics_params.rbs +21 -1
  59. data/sig/context_dev/models/industry_retrieve_sic_params.rbs +21 -1
  60. data/sig/context_dev/models/monitor_retrieve_run_params.rbs +28 -0
  61. data/sig/context_dev/models/monitor_retrieve_run_response.rbs +182 -0
  62. data/sig/context_dev/models/monitor_rotate_webhook_secret_params.rbs +23 -0
  63. data/sig/context_dev/models/monitor_rotate_webhook_secret_response.rbs +545 -0
  64. data/sig/context_dev/models/person_enrich_params.rbs +21 -1
  65. data/sig/context_dev/models/web_answers_params.rbs +21 -1
  66. data/sig/context_dev/models/web_extract_competitors_params.rbs +21 -1
  67. data/sig/context_dev/models/web_extract_styleguide_params.rbs +21 -1
  68. data/sig/context_dev/models/{web_web_scrape_sitemap_params.rbs → web_map_urls_params.rbs} +22 -22
  69. data/sig/context_dev/models/web_map_urls_response.rbs +125 -0
  70. data/sig/context_dev/models/web_scrape_params.rbs +834 -0
  71. data/sig/context_dev/models/web_scrape_response.rbs +552 -0
  72. data/sig/context_dev/models/web_screenshot_params.rbs +7 -0
  73. data/sig/context_dev/models/web_search_params.rbs +21 -1
  74. data/sig/context_dev/models.rbs +8 -20
  75. data/sig/context_dev/resources/brand.rbs +0 -9
  76. data/sig/context_dev/resources/industry.rbs +2 -0
  77. data/sig/context_dev/resources/monitors.rbs +11 -0
  78. data/sig/context_dev/resources/people.rbs +1 -0
  79. data/sig/context_dev/resources/web.rbs +34 -108
  80. metadata +26 -65
  81. data/lib/context_dev/models/ai_extract_product_params.rb +0 -98
  82. data/lib/context_dev/models/ai_extract_product_response.rb +0 -352
  83. data/lib/context_dev/models/ai_extract_products_params.rb +0 -233
  84. data/lib/context_dev/models/ai_extract_products_response.rb +0 -320
  85. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +0 -120
  86. data/lib/context_dev/models/brand_retrieve_simplified_response.rb +0 -441
  87. data/lib/context_dev/models/web_extract_fonts_params.rb +0 -114
  88. data/lib/context_dev/models/web_extract_fonts_response.rb +0 -291
  89. data/lib/context_dev/models/web_extract_params.rb +0 -392
  90. data/lib/context_dev/models/web_extract_response.rb +0 -287
  91. data/lib/context_dev/models/web_web_scrape_bytes_params.rb +0 -344
  92. data/lib/context_dev/models/web_web_scrape_bytes_response.rb +0 -135
  93. data/lib/context_dev/models/web_web_scrape_html_params.rb +0 -633
  94. data/lib/context_dev/models/web_web_scrape_html_response.rb +0 -588
  95. data/lib/context_dev/models/web_web_scrape_images_params.rb +0 -346
  96. data/lib/context_dev/models/web_web_scrape_images_response.rb +0 -409
  97. data/lib/context_dev/models/web_web_scrape_md_params.rb +0 -668
  98. data/lib/context_dev/models/web_web_scrape_md_response.rb +0 -567
  99. data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +0 -144
  100. data/lib/context_dev/resources/ai.rb +0 -69
  101. data/rbi/context_dev/models/ai_extract_product_params.rbi +0 -199
  102. data/rbi/context_dev/models/ai_extract_product_response.rbi +0 -696
  103. data/rbi/context_dev/models/ai_extract_products_params.rbi +0 -490
  104. data/rbi/context_dev/models/ai_extract_products_response.rbi +0 -623
  105. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +0 -256
  106. data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +0 -1040
  107. data/rbi/context_dev/models/web_extract_fonts_params.rbi +0 -223
  108. data/rbi/context_dev/models/web_extract_fonts_response.rbi +0 -563
  109. data/rbi/context_dev/models/web_extract_params.rbi +0 -736
  110. data/rbi/context_dev/models/web_extract_response.rbi +0 -512
  111. data/rbi/context_dev/models/web_web_scrape_bytes_params.rbi +0 -699
  112. data/rbi/context_dev/models/web_web_scrape_bytes_response.rbi +0 -238
  113. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +0 -1217
  114. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +0 -671
  115. data/rbi/context_dev/models/web_web_scrape_images_response.rbi +0 -910
  116. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +0 -1049
  117. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +0 -1088
  118. data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +0 -258
  119. data/rbi/context_dev/resources/ai.rbi +0 -56
  120. data/sig/context_dev/models/ai_extract_product_params.rbs +0 -86
  121. data/sig/context_dev/models/ai_extract_product_response.rbs +0 -273
  122. data/sig/context_dev/models/ai_extract_products_params.rbs +0 -202
  123. data/sig/context_dev/models/ai_extract_products_response.rbs +0 -252
  124. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +0 -104
  125. data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +0 -413
  126. data/sig/context_dev/models/web_extract_fonts_params.rbs +0 -93
  127. data/sig/context_dev/models/web_extract_fonts_response.rbs +0 -230
  128. data/sig/context_dev/models/web_extract_params.rbs +0 -304
  129. data/sig/context_dev/models/web_extract_response.rbs +0 -239
  130. data/sig/context_dev/models/web_web_scrape_bytes_params.rbs +0 -531
  131. data/sig/context_dev/models/web_web_scrape_bytes_response.rbs +0 -108
  132. data/sig/context_dev/models/web_web_scrape_html_params.rbs +0 -730
  133. data/sig/context_dev/models/web_web_scrape_html_response.rbs +0 -495
  134. data/sig/context_dev/models/web_web_scrape_images_params.rbs +0 -261
  135. data/sig/context_dev/models/web_web_scrape_images_response.rbs +0 -371
  136. data/sig/context_dev/models/web_web_scrape_md_params.rbs +0 -758
  137. data/sig/context_dev/models/web_web_scrape_md_response.rbs +0 -465
  138. data/sig/context_dev/models/web_web_scrape_sitemap_response.rbs +0 -117
  139. data/sig/context_dev/resources/ai.rbs +0 -20
@@ -1,291 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ContextDev
4
- module Models
5
- # @see ContextDev::Resources::Web#extract_fonts
6
- class WebExtractFontsResponse < ContextDev::Internal::Type::BaseModel
7
- # @!attribute cache_metadata
8
- # Cache outcome for this response. Composite responses are hits only when every
9
- # cache-controlled fetch contributing to the output was a hit; age_ms is the
10
- # oldest contributing hit.
11
- #
12
- # @return [ContextDev::Models::WebExtractFontsResponse::CacheMetadata]
13
- required :cache_metadata, -> { ContextDev::Models::WebExtractFontsResponse::CacheMetadata }
14
-
15
- # @!attribute code
16
- # HTTP status code, e.g., 200
17
- #
18
- # @return [Integer]
19
- required :code, Integer
20
-
21
- # @!attribute domain
22
- # The normalized domain that was processed
23
- #
24
- # @return [String]
25
- required :domain, String
26
-
27
- # @!attribute fonts
28
- # Array of font usage information
29
- #
30
- # @return [Array<ContextDev::Models::WebExtractFontsResponse::Font>]
31
- required :fonts,
32
- -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebExtractFontsResponse::Font] }
33
-
34
- # @!attribute request_id
35
- # Unique id of this API call, also sent in the X-Request-Id response header. Quote
36
- # it when contacting support about a failed request.
37
- #
38
- # @return [String]
39
- required :request_id, String
40
-
41
- # @!attribute status
42
- # Status of the response, e.g., 'ok'
43
- #
44
- # @return [String]
45
- required :status, String
46
-
47
- # @!attribute final_dom_state
48
- # How complete the returned content is. `loaded` means the page finished the waits
49
- # the request asked for. `still-loading` only occurs with
50
- # timeoutOpts.behavior=return-partial: the timeoutOpts.milliseconds deadline was
51
- # reached first, so the content reflects the DOM at that moment and late-rendering
52
- # parts may be missing. Partial results are billed at the base request cost.
53
- #
54
- # @return [Symbol, ContextDev::Models::WebExtractFontsResponse::FinalDomState, nil]
55
- optional :final_dom_state,
56
- enum: -> { ContextDev::Models::WebExtractFontsResponse::FinalDomState },
57
- api_name: :finalDOMState
58
-
59
- # @!attribute font_links
60
- # Font assets keyed by family name as it appears in the fonts array (non-generic
61
- # names only). Clients match entries in fonts to pick a file URL from files.
62
- # Omitted when no families resolve to Google or custom @font-face URLs.
63
- #
64
- # @return [Hash{Symbol=>ContextDev::Models::WebExtractFontsResponse::FontLink}, nil]
65
- optional :font_links,
66
- -> { ContextDev::Internal::Type::HashOf[ContextDev::Models::WebExtractFontsResponse::FontLink] },
67
- api_name: :fontLinks
68
-
69
- # @!attribute key_metadata
70
- # Credit usage, included whenever a valid API key is provided.
71
- #
72
- # @return [ContextDev::Models::WebExtractFontsResponse::KeyMetadata, nil]
73
- optional :key_metadata, -> { ContextDev::Models::WebExtractFontsResponse::KeyMetadata }
74
-
75
- # @!method initialize(cache_metadata:, code:, domain:, fonts:, request_id:, status:, final_dom_state: nil, font_links: nil, key_metadata: nil)
76
- # Some parameter documentations has been truncated, see
77
- # {ContextDev::Models::WebExtractFontsResponse} for more details.
78
- #
79
- # @param cache_metadata [ContextDev::Models::WebExtractFontsResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
80
- #
81
- # @param code [Integer] HTTP status code, e.g., 200
82
- #
83
- # @param domain [String] The normalized domain that was processed
84
- #
85
- # @param fonts [Array<ContextDev::Models::WebExtractFontsResponse::Font>] Array of font usage information
86
- #
87
- # @param request_id [String] Unique id of this API call, also sent in the X-Request-Id response header. Quote
88
- #
89
- # @param status [String] Status of the response, e.g., 'ok'
90
- #
91
- # @param final_dom_state [Symbol, ContextDev::Models::WebExtractFontsResponse::FinalDomState] How complete the returned content is. `loaded` means the page finished the waits
92
- #
93
- # @param font_links [Hash{Symbol=>ContextDev::Models::WebExtractFontsResponse::FontLink}] Font assets keyed by family name as it appears in the fonts array (non-generic n
94
- #
95
- # @param key_metadata [ContextDev::Models::WebExtractFontsResponse::KeyMetadata] Credit usage, included whenever a valid API key is provided.
96
-
97
- # @see ContextDev::Models::WebExtractFontsResponse#cache_metadata
98
- class CacheMetadata < ContextDev::Internal::Type::BaseModel
99
- # @!attribute age_ms
100
- # Age of the cached data in milliseconds. Zero for miss and zdr responses.
101
- #
102
- # @return [Integer]
103
- required :age_ms, Integer
104
-
105
- # @!attribute status
106
- # Whether the response was served from cache, required fresh work, or honored
107
- # zero-data-retention cache bypass.
108
- #
109
- # @return [Symbol, ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status]
110
- required :status, enum: -> { ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status }
111
-
112
- # @!method initialize(age_ms:, status:)
113
- # Some parameter documentations has been truncated, see
114
- # {ContextDev::Models::WebExtractFontsResponse::CacheMetadata} for more details.
115
- #
116
- # Cache outcome for this response. Composite responses are hits only when every
117
- # cache-controlled fetch contributing to the output was a hit; age_ms is the
118
- # oldest contributing hit.
119
- #
120
- # @param age_ms [Integer] Age of the cached data in milliseconds. Zero for miss and zdr responses.
121
- #
122
- # @param status [Symbol, ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status] Whether the response was served from cache, required fresh work, or honored zero
123
-
124
- # Whether the response was served from cache, required fresh work, or honored
125
- # zero-data-retention cache bypass.
126
- #
127
- # @see ContextDev::Models::WebExtractFontsResponse::CacheMetadata#status
128
- module Status
129
- extend ContextDev::Internal::Type::Enum
130
-
131
- HIT = :hit
132
- MISS = :miss
133
- ZDR = :zdr
134
-
135
- # @!method self.values
136
- # @return [Array<Symbol>]
137
- end
138
- end
139
-
140
- class Font < ContextDev::Internal::Type::BaseModel
141
- # @!attribute fallbacks
142
- # Array of fallback font families
143
- #
144
- # @return [Array<String>]
145
- required :fallbacks, ContextDev::Internal::Type::ArrayOf[String]
146
-
147
- # @!attribute font
148
- # Font family name
149
- #
150
- # @return [String]
151
- required :font, String
152
-
153
- # @!attribute num_elements
154
- # Number of elements using this font
155
- #
156
- # @return [Float]
157
- required :num_elements, Float
158
-
159
- # @!attribute num_words
160
- # Number of words using this font
161
- #
162
- # @return [Float]
163
- required :num_words, Float
164
-
165
- # @!attribute percent_elements
166
- # Percentage of elements using this font
167
- #
168
- # @return [Float]
169
- required :percent_elements, Float
170
-
171
- # @!attribute percent_words
172
- # Percentage of words using this font
173
- #
174
- # @return [Float]
175
- required :percent_words, Float
176
-
177
- # @!attribute uses
178
- # Array of CSS selectors or element types where this font is used
179
- #
180
- # @return [Array<String>]
181
- required :uses, ContextDev::Internal::Type::ArrayOf[String]
182
-
183
- # @!method initialize(fallbacks:, font:, num_elements:, num_words:, percent_elements:, percent_words:, uses:)
184
- # @param fallbacks [Array<String>] Array of fallback font families
185
- #
186
- # @param font [String] Font family name
187
- #
188
- # @param num_elements [Float] Number of elements using this font
189
- #
190
- # @param num_words [Float] Number of words using this font
191
- #
192
- # @param percent_elements [Float] Percentage of elements using this font
193
- #
194
- # @param percent_words [Float] Percentage of words using this font
195
- #
196
- # @param uses [Array<String>] Array of CSS selectors or element types where this font is used
197
- end
198
-
199
- # How complete the returned content is. `loaded` means the page finished the waits
200
- # the request asked for. `still-loading` only occurs with
201
- # timeoutOpts.behavior=return-partial: the timeoutOpts.milliseconds deadline was
202
- # reached first, so the content reflects the DOM at that moment and late-rendering
203
- # parts may be missing. Partial results are billed at the base request cost.
204
- #
205
- # @see ContextDev::Models::WebExtractFontsResponse#final_dom_state
206
- module FinalDomState
207
- extend ContextDev::Internal::Type::Enum
208
-
209
- LOADED = :loaded
210
- STILL_LOADING = :"still-loading"
211
-
212
- # @!method self.values
213
- # @return [Array<Symbol>]
214
- end
215
-
216
- class FontLink < ContextDev::Internal::Type::BaseModel
217
- # @!attribute files
218
- # Upright font files keyed by weight string (e.g. "400" for regular, "500",
219
- # "700"). Values are absolute URLs.
220
- #
221
- # @return [Hash{Symbol=>String}]
222
- required :files, ContextDev::Internal::Type::HashOf[String]
223
-
224
- # @!attribute type
225
- #
226
- # @return [Symbol, ContextDev::Models::WebExtractFontsResponse::FontLink::Type]
227
- required :type, enum: -> { ContextDev::Models::WebExtractFontsResponse::FontLink::Type }
228
-
229
- # @!attribute category
230
- # Google Fonts category when type is google (e.g. sans-serif, serif, monospace,
231
- # display, handwriting). Omitted for custom fonts when unknown.
232
- #
233
- # @return [String, nil]
234
- optional :category, String
235
-
236
- # @!attribute display_name
237
- # Present when type is custom: human-readable name derived from the fontLinks key
238
- # (strip build/hash suffixes, split camelCase / PascalCase, normalize separators).
239
- # Google entries omit this.
240
- #
241
- # @return [String, nil]
242
- optional :display_name, String, api_name: :displayName
243
-
244
- # @!method initialize(files:, type:, category: nil, display_name: nil)
245
- # Some parameter documentations has been truncated, see
246
- # {ContextDev::Models::WebExtractFontsResponse::FontLink} for more details.
247
- #
248
- # @param files [Hash{Symbol=>String}] Upright font files keyed by weight string (e.g. "400" for regular, "500", "700")
249
- #
250
- # @param type [Symbol, ContextDev::Models::WebExtractFontsResponse::FontLink::Type]
251
- #
252
- # @param category [String] Google Fonts category when type is google (e.g. sans-serif, serif, monospace, di
253
- #
254
- # @param display_name [String] Present when type is custom: human-readable name derived from the fontLinks key
255
-
256
- # @see ContextDev::Models::WebExtractFontsResponse::FontLink#type
257
- module Type
258
- extend ContextDev::Internal::Type::Enum
259
-
260
- GOOGLE = :google
261
- CUSTOM = :custom
262
-
263
- # @!method self.values
264
- # @return [Array<Symbol>]
265
- end
266
- end
267
-
268
- # @see ContextDev::Models::WebExtractFontsResponse#key_metadata
269
- class KeyMetadata < ContextDev::Internal::Type::BaseModel
270
- # @!attribute credits_consumed
271
- # Credits used by this request.
272
- #
273
- # @return [Integer]
274
- required :credits_consumed, Integer
275
-
276
- # @!attribute credits_remaining
277
- # Credits remaining for your organization.
278
- #
279
- # @return [Integer]
280
- required :credits_remaining, Integer
281
-
282
- # @!method initialize(credits_consumed:, credits_remaining:)
283
- # Credit usage, included whenever a valid API key is provided.
284
- #
285
- # @param credits_consumed [Integer] Credits used by this request.
286
- #
287
- # @param credits_remaining [Integer] Credits remaining for your organization.
288
- end
289
- end
290
- end
291
- end
@@ -1,392 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ContextDev
4
- module Models
5
- # @see ContextDev::Resources::Web#extract
6
- class WebExtractParams < ContextDev::Internal::Type::BaseModel
7
- extend ContextDev::Internal::Type::RequestParameters::Converter
8
- include ContextDev::Internal::Type::RequestParameters
9
-
10
- # @!attribute schema
11
- # JSON Schema for the returned data object. Image fields such as `image_urls` or
12
- # `product_photos` automatically make page image references available to
13
- # extraction, so product data and photos can be returned in one call. TypeScript
14
- # Zod users can pass a JSON Schema generated from a Zod object; Python users can
15
- # pass the equivalent JSON Schema object.
16
- #
17
- # @return [Hash{Symbol=>Object}]
18
- required :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
19
-
20
- # @!attribute url
21
- # The starting website URL to crawl and extract from. Must include http:// or
22
- # https://.
23
- #
24
- # @return [String]
25
- required :url, String
26
-
27
- # @!attribute actions
28
- # Optional browser actions executed in order on the requested page after it loads,
29
- # before links are discovered or additional pages are crawled. Requires a paid
30
- # plan. When actions are provided and stopAfterMs is omitted, the crawl budget
31
- # defaults to 110000 ms.
32
- #
33
- # @return [Array<ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll>, nil]
34
- optional :actions, -> { ContextDev::Internal::Type::ArrayOf[union: ContextDev::WebExtractParams::Action] }
35
-
36
- # @!attribute fact_check
37
- # When true, every returned value must be grounded in facts stated on the page;
38
- # fields that cannot be supported by the page are returned as null/empty. When
39
- # false (default), the model may make reasonable inferences and derivations from
40
- # the page content (e.g. ideal customer, competitor analysis, recommendations)
41
- # while keeping verifiable specifics (names, quotes, URLs, dates, metrics)
42
- # faithful to the source.
43
- #
44
- # @return [Boolean, nil]
45
- optional :fact_check, ContextDev::Internal::Type::Boolean, api_name: :factCheck
46
-
47
- # @!attribute follow_subdomains
48
- # When true, follow links on subdomains of the starting URL's domain.
49
- #
50
- # @return [Boolean, nil]
51
- optional :follow_subdomains, ContextDev::Internal::Type::Boolean, api_name: :followSubdomains
52
-
53
- # @!attribute include_frames
54
- # When true, iframe contents are included in Markdown before extraction.
55
- #
56
- # @return [Boolean, nil]
57
- optional :include_frames, ContextDev::Internal::Type::Boolean, api_name: :includeFrames
58
-
59
- # @!attribute instructions
60
- # Optional extraction guidance, such as which facts to prioritize or how to
61
- # interpret fields in the schema.
62
- #
63
- # @return [String, nil]
64
- optional :instructions, String
65
-
66
- # @!attribute max_age_ms
67
- # Return cached scrape results if a prior scrape for the same parameters is
68
- # younger than this many milliseconds. Defaults to 7 days (604800000 ms).
69
- #
70
- # @return [Integer, nil]
71
- optional :max_age_ms, Integer, api_name: :maxAgeMs
72
-
73
- # @!attribute max_depth
74
- # Optional maximum link depth from the starting URL (0 = only the starting page).
75
- # If omitted, there is no crawl depth limit.
76
- #
77
- # @return [Integer, nil]
78
- optional :max_depth, Integer, api_name: :maxDepth
79
-
80
- # @!attribute max_pages
81
- # Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
82
- #
83
- # @return [Integer, nil]
84
- optional :max_pages, Integer, api_name: :maxPages
85
-
86
- # @!attribute pdf
87
- #
88
- # @return [ContextDev::Models::WebExtractParams::Pdf, nil]
89
- optional :pdf, -> { ContextDev::WebExtractParams::Pdf }
90
-
91
- # @!attribute settle_animations
92
- # When true, waits briefly for CSS and transition animations to settle before
93
- # extracting each crawled page. Defaults to false. This adds a bit of latency in
94
- # exchange for more stable output on animated pages.
95
- #
96
- # @return [Boolean, nil]
97
- optional :settle_animations, ContextDev::Internal::Type::Boolean, api_name: :settleAnimations
98
-
99
- # @!attribute stop_after_ms
100
- # Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
101
- # (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are
102
- # provided.
103
- #
104
- # @return [Integer, nil]
105
- optional :stop_after_ms, Integer, api_name: :stopAfterMs
106
-
107
- # @!attribute tags
108
- # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
109
- #
110
- # @return [Array<String>, nil]
111
- optional :tags, ContextDev::Internal::Type::ArrayOf[String]
112
-
113
- # @!attribute timeout_opts
114
- # Optional request deadline and behavior on timeout. For GET requests, use
115
- # timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
116
- # timeoutOpts object.
117
- #
118
- # @return [ContextDev::Models::WebExtractParams::TimeoutOpts, nil]
119
- optional :timeout_opts, -> { ContextDev::WebExtractParams::TimeoutOpts }, api_name: :timeoutOpts
120
-
121
- # @!attribute wait_for_ms
122
- # Optional browser wait time in milliseconds after initial page load for each
123
- # crawled page.
124
- #
125
- # @return [Integer, nil]
126
- optional :wait_for_ms, Integer, api_name: :waitForMs
127
-
128
- # @!method initialize(schema:, url:, actions: nil, fact_check: nil, follow_subdomains: nil, include_frames: nil, instructions: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, pdf: nil, settle_animations: nil, stop_after_ms: nil, tags: nil, timeout_opts: nil, wait_for_ms: nil, request_options: {})
129
- # Some parameter documentations has been truncated, see
130
- # {ContextDev::Models::WebExtractParams} for more details.
131
- #
132
- # @param schema [Hash{Symbol=>Object}] JSON Schema for the returned data object. Image fields such as `image_urls` or `
133
- #
134
- # @param url [String] The starting website URL to crawl and extract from. Must include http:// or http
135
- #
136
- # @param actions [Array<ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll>] Optional browser actions executed in order on the requested page after it loads,
137
- #
138
- # @param fact_check [Boolean] When true, every returned value must be grounded in facts stated on the page; fi
139
- #
140
- # @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain.
141
- #
142
- # @param include_frames [Boolean] When true, iframe contents are included in Markdown before extraction.
143
- #
144
- # @param instructions [String] Optional extraction guidance, such as which facts to prioritize or how to interp
145
- #
146
- # @param max_age_ms [Integer] Return cached scrape results if a prior scrape for the same parameters is younge
147
- #
148
- # @param max_depth [Integer] Optional maximum link depth from the starting URL (0 = only the starting page).
149
- #
150
- # @param max_pages [Integer] Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
151
- #
152
- # @param pdf [ContextDev::Models::WebExtractParams::Pdf]
153
- #
154
- # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr
155
- #
156
- # @param stop_after_ms [Integer] Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (1
157
- #
158
- # @param tags [Array<String>] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
159
- #
160
- # @param timeout_opts [ContextDev::Models::WebExtractParams::TimeoutOpts] Optional request deadline and behavior on timeout. For GET requests, use timeout
161
- #
162
- # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load for each craw
163
- #
164
- # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
165
-
166
- # Browser action discriminated by `do`. Each variant exposes only its applicable
167
- # fields.
168
- module Action
169
- extend ContextDev::Internal::Type::Union
170
-
171
- discriminator :do
172
-
173
- # Pause for a fixed number of milliseconds before continuing to the next action.
174
- variant :wait, -> { ContextDev::WebExtractParams::Action::Wait }
175
-
176
- # Resolve and perform one natural-language browser action.
177
- variant :perform, -> { ContextDev::WebExtractParams::Action::Perform }
178
-
179
- # Scroll the page or a selected scrollable container, waiting adaptively for content and dimensions to settle after each iteration.
180
- variant :scroll, -> { ContextDev::WebExtractParams::Action::Scroll }
181
-
182
- class Wait < ContextDev::Internal::Type::BaseModel
183
- # @!attribute do_
184
- #
185
- # @return [Symbol, :wait]
186
- required :do_, const: :wait, api_name: :do
187
-
188
- # @!attribute time_ms
189
- #
190
- # @return [Integer]
191
- required :time_ms, Integer, api_name: :timeMs
192
-
193
- # @!method initialize(time_ms:, do_: :wait)
194
- # Pause for a fixed number of milliseconds before continuing to the next action.
195
- #
196
- # @param time_ms [Integer]
197
- # @param do_ [Symbol, :wait]
198
- end
199
-
200
- class Perform < ContextDev::Internal::Type::BaseModel
201
- # @!attribute action
202
- #
203
- # @return [String]
204
- required :action, String
205
-
206
- # @!attribute do_
207
- #
208
- # @return [Symbol, :perform]
209
- required :do_, const: :perform, api_name: :do
210
-
211
- # @!method initialize(action:, do_: :perform)
212
- # Resolve and perform one natural-language browser action.
213
- #
214
- # @param action [String]
215
- # @param do_ [Symbol, :perform]
216
- end
217
-
218
- class Scroll < ContextDev::Internal::Type::BaseModel
219
- # @!attribute do_
220
- #
221
- # @return [Symbol, :scroll]
222
- required :do_, const: :scroll, api_name: :do
223
-
224
- # @!attribute amount
225
- # Pixels per scroll, one visible viewport, or the current scroll boundary.
226
- # Defaults to viewport.
227
- #
228
- # @return [Integer, Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Amount, nil]
229
- optional :amount, union: -> { ContextDev::WebExtractParams::Action::Scroll::Amount }
230
-
231
- # @!attribute container
232
- # CSS selector for the first matching scroll container. Defaults to the page.
233
- #
234
- # @return [String, nil]
235
- optional :container, String
236
-
237
- # @!attribute direction
238
- # Direction to scroll. Defaults to down.
239
- #
240
- # @return [Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Direction, nil]
241
- optional :direction, enum: -> { ContextDev::WebExtractParams::Action::Scroll::Direction }
242
-
243
- # @!attribute max_scrolls
244
- # Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
245
- # changing. Defaults to 1.
246
- #
247
- # @return [Integer, nil]
248
- optional :max_scrolls, Integer, api_name: :maxScrolls
249
-
250
- # @!method initialize(amount: nil, container: nil, direction: nil, max_scrolls: nil, do_: :scroll)
251
- # Some parameter documentations has been truncated, see
252
- # {ContextDev::Models::WebExtractParams::Action::Scroll} for more details.
253
- #
254
- # Scroll the page or a selected scrollable container, waiting adaptively for
255
- # content and dimensions to settle after each iteration.
256
- #
257
- # @param amount [Integer, Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Amount] Pixels per scroll, one visible viewport, or the current scroll boundary. Default
258
- #
259
- # @param container [String] CSS selector for the first matching scroll container. Defaults to the page.
260
- #
261
- # @param direction [Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Direction] Direction to scroll. Defaults to down.
262
- #
263
- # @param max_scrolls [Integer] Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
264
- #
265
- # @param do_ [Symbol, :scroll]
266
-
267
- # Pixels per scroll, one visible viewport, or the current scroll boundary.
268
- # Defaults to viewport.
269
- #
270
- # @see ContextDev::Models::WebExtractParams::Action::Scroll#amount
271
- module Amount
272
- extend ContextDev::Internal::Type::Union
273
-
274
- variant Integer
275
-
276
- variant const: -> { ContextDev::Models::WebExtractParams::Action::Scroll::Amount::VIEWPORT }
277
-
278
- variant const: -> { ContextDev::Models::WebExtractParams::Action::Scroll::Amount::MAX }
279
-
280
- # @!method self.variants
281
- # @return [Array(Integer, Symbol)]
282
-
283
- define_sorbet_constant!(:Variants) do
284
- T.type_alias { T.any(Integer, ContextDev::WebExtractParams::Action::Scroll::Amount::TaggedSymbol) }
285
- end
286
-
287
- # @!group
288
-
289
- VIEWPORT = :viewport
290
- MAX = :max
291
-
292
- # @!endgroup
293
- end
294
-
295
- # Direction to scroll. Defaults to down.
296
- #
297
- # @see ContextDev::Models::WebExtractParams::Action::Scroll#direction
298
- module Direction
299
- extend ContextDev::Internal::Type::Enum
300
-
301
- UP = :up
302
- DOWN = :down
303
- LEFT = :left
304
- RIGHT = :right
305
-
306
- # @!method self.values
307
- # @return [Array<Symbol>]
308
- end
309
- end
310
-
311
- # @!method self.variants
312
- # @return [Array(ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll)]
313
- end
314
-
315
- class Pdf < ContextDev::Internal::Type::BaseModel
316
- # @!attribute end_
317
- # Last 1-based PDF page to parse. Must be greater than or equal to start when both
318
- # are provided.
319
- #
320
- # @return [Integer, nil]
321
- optional :end_, Integer, api_name: :end
322
-
323
- # @!attribute should_parse
324
- # When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.
325
- #
326
- # @return [Boolean, nil]
327
- optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse
328
-
329
- # @!attribute start
330
- # First 1-based PDF page to parse.
331
- #
332
- # @return [Integer, nil]
333
- optional :start, Integer
334
-
335
- # @!method initialize(end_: nil, should_parse: nil, start: nil)
336
- # Some parameter documentations has been truncated, see
337
- # {ContextDev::Models::WebExtractParams::Pdf} for more details.
338
- #
339
- # @param end_ [Integer] Last 1-based PDF page to parse. Must be greater than or equal to start when both
340
- #
341
- # @param should_parse [Boolean] When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.
342
- #
343
- # @param start [Integer] First 1-based PDF page to parse.
344
- end
345
-
346
- class TimeoutOpts < ContextDev::Internal::Type::BaseModel
347
- # @!attribute milliseconds
348
- # Request deadline in milliseconds. Maximum: 300000 (5 minutes).
349
- #
350
- # @return [Integer]
351
- required :milliseconds, Integer
352
-
353
- # @!attribute behavior
354
- # What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
355
- # credits. "return-partial" returns usable results collected so far; if none are
356
- # available, the request still fails without charging credits. Partial results are
357
- # not cached as complete results.
358
- #
359
- # @return [Symbol, ContextDev::Models::WebExtractParams::TimeoutOpts::Behavior, nil]
360
- optional :behavior, enum: -> { ContextDev::WebExtractParams::TimeoutOpts::Behavior }
361
-
362
- # @!method initialize(milliseconds:, behavior: nil)
363
- # Some parameter documentations has been truncated, see
364
- # {ContextDev::Models::WebExtractParams::TimeoutOpts} for more details.
365
- #
366
- # Optional request deadline and behavior on timeout. For GET requests, use
367
- # timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
368
- # timeoutOpts object.
369
- #
370
- # @param milliseconds [Integer] Request deadline in milliseconds. Maximum: 300000 (5 minutes).
371
- #
372
- # @param behavior [Symbol, ContextDev::Models::WebExtractParams::TimeoutOpts::Behavior] What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
373
-
374
- # What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
375
- # credits. "return-partial" returns usable results collected so far; if none are
376
- # available, the request still fails without charging credits. Partial results are
377
- # not cached as complete results.
378
- #
379
- # @see ContextDev::Models::WebExtractParams::TimeoutOpts#behavior
380
- module Behavior
381
- extend ContextDev::Internal::Type::Enum
382
-
383
- FAIL = :fail
384
- RETURN_PARTIAL = :"return-partial"
385
-
386
- # @!method self.values
387
- # @return [Array<Symbol>]
388
- end
389
- end
390
- end
391
- end
392
- end