context.dev 2.3.0 → 2.5.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 (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +9 -9
  4. data/lib/context_dev/models/ai_extract_product_params.rb +9 -1
  5. data/lib/context_dev/models/ai_extract_products_params.rb +18 -2
  6. data/lib/context_dev/models/brand_retrieve_params.rb +109 -22
  7. data/lib/context_dev/models/brand_retrieve_response.rb +4 -6
  8. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +32 -3
  9. data/lib/context_dev/models/industry_retrieve_naics_params.rb +11 -1
  10. data/lib/context_dev/models/industry_retrieve_sic_params.rb +11 -1
  11. data/lib/context_dev/models/monitor_create_params.rb +6 -5
  12. data/lib/context_dev/models/monitor_create_response.rb +6 -5
  13. data/lib/context_dev/models/monitor_get_credit_usage_params.rb +30 -0
  14. data/lib/context_dev/models/monitor_get_credit_usage_response.rb +59 -0
  15. data/lib/context_dev/models/monitor_get_limits_params.rb +14 -0
  16. data/lib/context_dev/models/monitor_get_limits_response.rb +52 -0
  17. data/lib/context_dev/models/monitor_list_account_changes_params.rb +16 -7
  18. data/lib/context_dev/models/monitor_list_account_changes_response.rb +2 -1
  19. data/lib/context_dev/models/monitor_list_account_runs_params.rb +7 -10
  20. data/lib/context_dev/models/monitor_list_changes_params.rb +8 -4
  21. data/lib/context_dev/models/monitor_list_changes_response.rb +2 -1
  22. data/lib/context_dev/models/monitor_list_params.rb +18 -19
  23. data/lib/context_dev/models/monitor_list_response.rb +6 -5
  24. data/lib/context_dev/models/monitor_list_runs_params.rb +7 -10
  25. data/lib/context_dev/models/monitor_retrieve_change_response.rb +2 -1
  26. data/lib/context_dev/models/monitor_retrieve_response.rb +6 -5
  27. data/lib/context_dev/models/monitor_update_params.rb +6 -5
  28. data/lib/context_dev/models/monitor_update_response.rb +6 -5
  29. data/lib/context_dev/models/parse_handle_params.rb +296 -46
  30. data/lib/context_dev/models/utility_prefetch_params.rb +9 -1
  31. data/lib/context_dev/models/web_extract_competitors_params.rb +11 -1
  32. data/lib/context_dev/models/web_extract_fonts_params.rb +14 -4
  33. data/lib/context_dev/models/web_extract_params.rb +19 -1
  34. data/lib/context_dev/models/web_extract_styleguide_params.rb +14 -4
  35. data/lib/context_dev/models/web_screenshot_params.rb +69 -18
  36. data/lib/context_dev/models/web_screenshot_response.rb +3 -2
  37. data/lib/context_dev/models/web_search_params.rb +9 -1
  38. data/lib/context_dev/models/web_web_crawl_md_params.rb +34 -1
  39. data/lib/context_dev/models/web_web_scrape_html_params.rb +268 -29
  40. data/lib/context_dev/models/web_web_scrape_images_params.rb +208 -19
  41. data/lib/context_dev/models/web_web_scrape_md_params.rb +352 -38
  42. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +45 -1
  43. data/lib/context_dev/models.rb +4 -0
  44. data/lib/context_dev/resources/ai.rb +3 -1
  45. data/lib/context_dev/resources/brand.rb +6 -2
  46. data/lib/context_dev/resources/industry.rb +6 -2
  47. data/lib/context_dev/resources/monitors.rb +70 -32
  48. data/lib/context_dev/resources/parse.rb +11 -11
  49. data/lib/context_dev/resources/utility.rb +3 -1
  50. data/lib/context_dev/resources/web.rb +104 -55
  51. data/lib/context_dev/version.rb +1 -1
  52. data/lib/context_dev.rb +4 -0
  53. data/rbi/context_dev/models/ai_extract_product_params.rbi +11 -0
  54. data/rbi/context_dev/models/ai_extract_products_params.rbi +22 -0
  55. data/rbi/context_dev/models/brand_retrieve_params.rbi +175 -64
  56. data/rbi/context_dev/models/brand_retrieve_response.rbi +8 -11
  57. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +68 -5
  58. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +15 -0
  59. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +15 -0
  60. data/rbi/context_dev/models/monitor_create_params.rbi +6 -4
  61. data/rbi/context_dev/models/monitor_create_response.rbi +6 -4
  62. data/rbi/context_dev/models/monitor_get_credit_usage_params.rbi +60 -0
  63. data/rbi/context_dev/models/monitor_get_credit_usage_response.rbi +111 -0
  64. data/rbi/context_dev/models/monitor_get_limits_params.rbi +30 -0
  65. data/rbi/context_dev/models/monitor_get_limits_response.rbi +105 -0
  66. data/rbi/context_dev/models/monitor_list_account_changes_params.rbi +16 -0
  67. data/rbi/context_dev/models/monitor_list_account_changes_response.rbi +2 -0
  68. data/rbi/context_dev/models/monitor_list_account_runs_params.rbi +7 -6
  69. data/rbi/context_dev/models/monitor_list_changes_params.rbi +8 -0
  70. data/rbi/context_dev/models/monitor_list_changes_response.rbi +2 -0
  71. data/rbi/context_dev/models/monitor_list_params.rbi +23 -31
  72. data/rbi/context_dev/models/monitor_list_response.rbi +6 -4
  73. data/rbi/context_dev/models/monitor_list_runs_params.rbi +7 -6
  74. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +2 -0
  75. data/rbi/context_dev/models/monitor_retrieve_response.rbi +6 -4
  76. data/rbi/context_dev/models/monitor_update_params.rbi +6 -4
  77. data/rbi/context_dev/models/monitor_update_response.rbi +6 -4
  78. data/rbi/context_dev/models/parse_handle_params.rbi +601 -71
  79. data/rbi/context_dev/models/utility_prefetch_params.rbi +11 -0
  80. data/rbi/context_dev/models/web_extract_competitors_params.rbi +15 -0
  81. data/rbi/context_dev/models/web_extract_fonts_params.rbi +19 -7
  82. data/rbi/context_dev/models/web_extract_params.rbi +26 -0
  83. data/rbi/context_dev/models/web_extract_styleguide_params.rbi +19 -7
  84. data/rbi/context_dev/models/web_screenshot_params.rbi +108 -37
  85. data/rbi/context_dev/models/web_screenshot_response.rbi +4 -2
  86. data/rbi/context_dev/models/web_search_params.rbi +11 -0
  87. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +53 -0
  88. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +554 -49
  89. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +426 -30
  90. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +742 -61
  91. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +82 -0
  92. data/rbi/context_dev/models.rbi +4 -0
  93. data/rbi/context_dev/resources/ai.rbi +3 -0
  94. data/rbi/context_dev/resources/brand.rbi +9 -1
  95. data/rbi/context_dev/resources/industry.rbi +10 -0
  96. data/rbi/context_dev/resources/monitors.rbi +55 -11
  97. data/rbi/context_dev/resources/parse.rbi +44 -24
  98. data/rbi/context_dev/resources/utility.rbi +3 -0
  99. data/rbi/context_dev/resources/web.rbi +224 -48
  100. data/sig/context_dev/models/ai_extract_product_params.rbs +12 -1
  101. data/sig/context_dev/models/ai_extract_products_params.rbs +14 -0
  102. data/sig/context_dev/models/brand_retrieve_params.rbs +97 -51
  103. data/sig/context_dev/models/brand_retrieve_response.rbs +2 -2
  104. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +34 -5
  105. data/sig/context_dev/models/industry_retrieve_naics_params.rbs +7 -0
  106. data/sig/context_dev/models/industry_retrieve_sic_params.rbs +7 -0
  107. data/sig/context_dev/models/monitor_get_credit_usage_params.rbs +32 -0
  108. data/sig/context_dev/models/monitor_get_credit_usage_response.rbs +52 -0
  109. data/sig/context_dev/models/monitor_get_limits_params.rbs +15 -0
  110. data/sig/context_dev/models/monitor_get_limits_response.rbs +43 -0
  111. data/sig/context_dev/models/monitor_list_params.rbs +8 -14
  112. data/sig/context_dev/models/parse_handle_params.rbs +297 -50
  113. data/sig/context_dev/models/utility_prefetch_params.rbs +7 -0
  114. data/sig/context_dev/models/web_extract_competitors_params.rbs +12 -1
  115. data/sig/context_dev/models/web_extract_fonts_params.rbs +10 -5
  116. data/sig/context_dev/models/web_extract_params.rbs +14 -0
  117. data/sig/context_dev/models/web_extract_styleguide_params.rbs +10 -5
  118. data/sig/context_dev/models/web_screenshot_params.rbs +41 -20
  119. data/sig/context_dev/models/web_search_params.rbs +7 -0
  120. data/sig/context_dev/models/web_web_crawl_md_params.rbs +28 -1
  121. data/sig/context_dev/models/web_web_scrape_html_params.rbs +175 -47
  122. data/sig/context_dev/models/web_web_scrape_images_params.rbs +128 -38
  123. data/sig/context_dev/models/web_web_scrape_md_params.rbs +229 -62
  124. data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +35 -1
  125. data/sig/context_dev/models.rbs +4 -0
  126. data/sig/context_dev/resources/ai.rbs +1 -0
  127. data/sig/context_dev/resources/brand.rbs +3 -1
  128. data/sig/context_dev/resources/industry.rbs +2 -0
  129. data/sig/context_dev/resources/monitors.rbs +12 -2
  130. data/sig/context_dev/resources/parse.rbs +10 -10
  131. data/sig/context_dev/resources/utility.rbs +1 -0
  132. data/sig/context_dev/resources/web.rbs +47 -26
  133. metadata +14 -2
@@ -18,14 +18,48 @@ module ContextDev
18
18
  sig { returns(String) }
19
19
  attr_accessor :url
20
20
 
21
+ # Optional browser actions executed in array order after the page loads and before
22
+ # content is captured. Requires a paid plan. Send a JSON array in the query
23
+ # parameter. Maximum: 5 actions.
24
+ sig do
25
+ returns(
26
+ T.nilable(
27
+ T::Array[
28
+ T.any(
29
+ ContextDev::WebWebScrapeImagesParams::Action::Wait,
30
+ ContextDev::WebWebScrapeImagesParams::Action::Perform
31
+ )
32
+ ]
33
+ )
34
+ )
35
+ end
36
+ attr_accessor :actions
37
+
21
38
  # When true, visually duplicate images are removed: every image is loaded and
22
39
  # perceptually hashed, and only the highest-resolution copy of each duplicate
23
40
  # group is kept. Images that cannot be downloaded or hashed are kept. Default:
24
41
  # false.
25
- sig { returns(T.nilable(T::Boolean)) }
42
+ sig do
43
+ returns(
44
+ T.nilable(
45
+ T.any(
46
+ T::Boolean,
47
+ ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
48
+ )
49
+ )
50
+ )
51
+ end
26
52
  attr_reader :dedupe
27
53
 
28
- sig { params(dedupe: T::Boolean).void }
54
+ sig do
55
+ params(
56
+ dedupe:
57
+ T.any(
58
+ T::Boolean,
59
+ ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
60
+ )
61
+ ).void
62
+ end
29
63
  attr_writer :dedupe
30
64
 
31
65
  # Optional per-image processing, sent as deep-object query params such as
@@ -37,7 +71,8 @@ module ContextDev
37
71
 
38
72
  sig do
39
73
  params(
40
- enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash
74
+ enrichment:
75
+ T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash)
41
76
  ).void
42
77
  end
43
78
  attr_writer :enrichment
@@ -54,10 +89,16 @@ module ContextDev
54
89
  # Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1
55
90
  # day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).
56
91
  sig { returns(T.nilable(Integer)) }
57
- attr_reader :max_age_ms
92
+ attr_accessor :max_age_ms
58
93
 
59
- sig { params(max_age_ms: Integer).void }
60
- attr_writer :max_age_ms
94
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
95
+ # recorded on the request's usage log and can be used to filter usage on the
96
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
97
+ sig { returns(T.nilable(T::Array[String])) }
98
+ attr_reader :tags
99
+
100
+ sig { params(tags: T::Array[String]).void }
101
+ attr_writer :tags
61
102
 
62
103
  # Optional timeout in milliseconds for the request. If the request takes longer
63
104
  # than this value, it will be aborted with a 408 status code. Maximum allowed
@@ -71,26 +112,42 @@ module ContextDev
71
112
  # Optional browser wait time in milliseconds after initial page load before
72
113
  # collecting images. Min: 0. Max: 30000 (30 seconds).
73
114
  sig { returns(T.nilable(Integer)) }
74
- attr_reader :wait_for_ms
75
-
76
- sig { params(wait_for_ms: Integer).void }
77
- attr_writer :wait_for_ms
115
+ attr_accessor :wait_for_ms
78
116
 
79
117
  sig do
80
118
  params(
81
119
  url: String,
82
- dedupe: T::Boolean,
83
- enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash,
120
+ actions:
121
+ T.nilable(
122
+ T::Array[
123
+ T.any(
124
+ ContextDev::WebWebScrapeImagesParams::Action::Wait::OrHash,
125
+ ContextDev::WebWebScrapeImagesParams::Action::Perform::OrHash
126
+ )
127
+ ]
128
+ ),
129
+ dedupe:
130
+ T.any(
131
+ T::Boolean,
132
+ ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
133
+ ),
134
+ enrichment:
135
+ T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash),
84
136
  headers: T::Hash[Symbol, String],
85
- max_age_ms: Integer,
137
+ max_age_ms: T.nilable(Integer),
138
+ tags: T::Array[String],
86
139
  timeout_ms: Integer,
87
- wait_for_ms: Integer,
140
+ wait_for_ms: T.nilable(Integer),
88
141
  request_options: ContextDev::RequestOptions::OrHash
89
142
  ).returns(T.attached_class)
90
143
  end
91
144
  def self.new(
92
145
  # Page URL to inspect. Must include http:// or https://.
93
146
  url:,
147
+ # Optional browser actions executed in array order after the page loads and before
148
+ # content is captured. Requires a paid plan. Send a JSON array in the query
149
+ # parameter. Maximum: 5 actions.
150
+ actions: nil,
94
151
  # When true, visually duplicate images are removed: every image is loaded and
95
152
  # perceptually hashed, and only the highest-resolution copy of each duplicate
96
153
  # group is kept. Images that cannot be downloaded or hashed are kept. Default:
@@ -106,6 +163,10 @@ module ContextDev
106
163
  # Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1
107
164
  # day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).
108
165
  max_age_ms: nil,
166
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
167
+ # recorded on the request's usage log and can be used to filter usage on the
168
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
169
+ tags: nil,
109
170
  # Optional timeout in milliseconds for the request. If the request takes longer
110
171
  # than this value, it will be aborted with a 408 status code. Maximum allowed
111
172
  # value is 300000ms (5 minutes).
@@ -121,12 +182,27 @@ module ContextDev
121
182
  override.returns(
122
183
  {
123
184
  url: String,
124
- dedupe: T::Boolean,
125
- enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment,
185
+ actions:
186
+ T.nilable(
187
+ T::Array[
188
+ T.any(
189
+ ContextDev::WebWebScrapeImagesParams::Action::Wait,
190
+ ContextDev::WebWebScrapeImagesParams::Action::Perform
191
+ )
192
+ ]
193
+ ),
194
+ dedupe:
195
+ T.any(
196
+ T::Boolean,
197
+ ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
198
+ ),
199
+ enrichment:
200
+ T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment),
126
201
  headers: T::Hash[Symbol, String],
127
- max_age_ms: Integer,
202
+ max_age_ms: T.nilable(Integer),
203
+ tags: T::Array[String],
128
204
  timeout_ms: Integer,
129
- wait_for_ms: Integer,
205
+ wait_for_ms: T.nilable(Integer),
130
206
  request_options: ContextDev::RequestOptions
131
207
  }
132
208
  )
@@ -134,6 +210,121 @@ module ContextDev
134
210
  def to_hash
135
211
  end
136
212
 
213
+ # Browser action discriminated by `do`. Each variant exposes only its applicable
214
+ # fields.
215
+ module Action
216
+ extend ContextDev::Internal::Type::Union
217
+
218
+ Variants =
219
+ T.type_alias do
220
+ T.any(
221
+ ContextDev::WebWebScrapeImagesParams::Action::Wait,
222
+ ContextDev::WebWebScrapeImagesParams::Action::Perform
223
+ )
224
+ end
225
+
226
+ class Wait < ContextDev::Internal::Type::BaseModel
227
+ OrHash =
228
+ T.type_alias do
229
+ T.any(
230
+ ContextDev::WebWebScrapeImagesParams::Action::Wait,
231
+ ContextDev::Internal::AnyHash
232
+ )
233
+ end
234
+
235
+ sig { returns(Symbol) }
236
+ attr_accessor :do_
237
+
238
+ sig { returns(Integer) }
239
+ attr_accessor :time_ms
240
+
241
+ # Pause for a fixed number of milliseconds before continuing to the next action.
242
+ sig do
243
+ params(time_ms: Integer, do_: Symbol).returns(T.attached_class)
244
+ end
245
+ def self.new(time_ms:, do_: :wait)
246
+ end
247
+
248
+ sig { override.returns({ do_: Symbol, time_ms: Integer }) }
249
+ def to_hash
250
+ end
251
+ end
252
+
253
+ class Perform < ContextDev::Internal::Type::BaseModel
254
+ OrHash =
255
+ T.type_alias do
256
+ T.any(
257
+ ContextDev::WebWebScrapeImagesParams::Action::Perform,
258
+ ContextDev::Internal::AnyHash
259
+ )
260
+ end
261
+
262
+ sig { returns(String) }
263
+ attr_accessor :action
264
+
265
+ sig { returns(Symbol) }
266
+ attr_accessor :do_
267
+
268
+ # Resolve and perform one natural-language browser action.
269
+ sig { params(action: String, do_: Symbol).returns(T.attached_class) }
270
+ def self.new(action:, do_: :perform)
271
+ end
272
+
273
+ sig { override.returns({ action: String, do_: Symbol }) }
274
+ def to_hash
275
+ end
276
+ end
277
+
278
+ sig do
279
+ override.returns(
280
+ T::Array[ContextDev::WebWebScrapeImagesParams::Action::Variants]
281
+ )
282
+ end
283
+ def self.variants
284
+ end
285
+ end
286
+
287
+ # When true, visually duplicate images are removed: every image is loaded and
288
+ # perceptually hashed, and only the highest-resolution copy of each duplicate
289
+ # group is kept. Images that cannot be downloaded or hashed are kept. Default:
290
+ # false.
291
+ module Dedupe
292
+ extend ContextDev::Internal::Type::Union
293
+
294
+ Variants =
295
+ T.type_alias do
296
+ T.any(
297
+ T::Boolean,
298
+ ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol
299
+ )
300
+ end
301
+
302
+ sig do
303
+ override.returns(
304
+ T::Array[ContextDev::WebWebScrapeImagesParams::Dedupe::Variants]
305
+ )
306
+ end
307
+ def self.variants
308
+ end
309
+
310
+ TaggedSymbol =
311
+ T.type_alias do
312
+ T.all(Symbol, ContextDev::WebWebScrapeImagesParams::Dedupe)
313
+ end
314
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
315
+
316
+ TRUE =
317
+ T.let(
318
+ :true,
319
+ ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol
320
+ )
321
+ FALSE =
322
+ T.let(
323
+ :false,
324
+ ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol
325
+ )
326
+ end
327
+
137
328
  class Enrichment < ContextDev::Internal::Type::BaseModel
138
329
  OrHash =
139
330
  T.type_alias do
@@ -144,18 +335,52 @@ module ContextDev
144
335
  end
145
336
 
146
337
  # Classify each image by visual asset type.
147
- sig { returns(T.nilable(T::Boolean)) }
338
+ sig do
339
+ returns(
340
+ T.nilable(
341
+ T.any(
342
+ T::Boolean,
343
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol
344
+ )
345
+ )
346
+ )
347
+ end
148
348
  attr_reader :classification
149
349
 
150
- sig { params(classification: T::Boolean).void }
350
+ sig do
351
+ params(
352
+ classification:
353
+ T.any(
354
+ T::Boolean,
355
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol
356
+ )
357
+ ).void
358
+ end
151
359
  attr_writer :classification
152
360
 
153
361
  # Host materializable images on the Brand.dev CDN and return their URL and MIME
154
362
  # type.
155
- sig { returns(T.nilable(T::Boolean)) }
363
+ sig do
364
+ returns(
365
+ T.nilable(
366
+ T.any(
367
+ T::Boolean,
368
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol
369
+ )
370
+ )
371
+ )
372
+ end
156
373
  attr_reader :hosted_url
157
374
 
158
- sig { params(hosted_url: T::Boolean).void }
375
+ sig do
376
+ params(
377
+ hosted_url:
378
+ T.any(
379
+ T::Boolean,
380
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol
381
+ )
382
+ ).void
383
+ end
159
384
  attr_writer :hosted_url
160
385
 
161
386
  # Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
@@ -166,20 +391,49 @@ module ContextDev
166
391
  attr_writer :max_time_per_ms
167
392
 
168
393
  # Measure image width and height when possible.
169
- sig { returns(T.nilable(T::Boolean)) }
394
+ sig do
395
+ returns(
396
+ T.nilable(
397
+ T.any(
398
+ T::Boolean,
399
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
400
+ )
401
+ )
402
+ )
403
+ end
170
404
  attr_reader :resolution
171
405
 
172
- sig { params(resolution: T::Boolean).void }
406
+ sig do
407
+ params(
408
+ resolution:
409
+ T.any(
410
+ T::Boolean,
411
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
412
+ )
413
+ ).void
414
+ end
173
415
  attr_writer :resolution
174
416
 
175
417
  # Optional per-image processing, sent as deep-object query params such as
176
418
  # enrichment[resolution]=true.
177
419
  sig do
178
420
  params(
179
- classification: T::Boolean,
180
- hosted_url: T::Boolean,
421
+ classification:
422
+ T.any(
423
+ T::Boolean,
424
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol
425
+ ),
426
+ hosted_url:
427
+ T.any(
428
+ T::Boolean,
429
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol
430
+ ),
181
431
  max_time_per_ms: Integer,
182
- resolution: T::Boolean
432
+ resolution:
433
+ T.any(
434
+ T::Boolean,
435
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
436
+ )
183
437
  ).returns(T.attached_class)
184
438
  end
185
439
  def self.new(
@@ -198,15 +452,157 @@ module ContextDev
198
452
  sig do
199
453
  override.returns(
200
454
  {
201
- classification: T::Boolean,
202
- hosted_url: T::Boolean,
455
+ classification:
456
+ T.any(
457
+ T::Boolean,
458
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol
459
+ ),
460
+ hosted_url:
461
+ T.any(
462
+ T::Boolean,
463
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol
464
+ ),
203
465
  max_time_per_ms: Integer,
204
- resolution: T::Boolean
466
+ resolution:
467
+ T.any(
468
+ T::Boolean,
469
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
470
+ )
205
471
  }
206
472
  )
207
473
  end
208
474
  def to_hash
209
475
  end
476
+
477
+ # Classify each image by visual asset type.
478
+ module Classification
479
+ extend ContextDev::Internal::Type::Union
480
+
481
+ Variants =
482
+ T.type_alias do
483
+ T.any(
484
+ T::Boolean,
485
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol
486
+ )
487
+ end
488
+
489
+ sig do
490
+ override.returns(
491
+ T::Array[
492
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::Variants
493
+ ]
494
+ )
495
+ end
496
+ def self.variants
497
+ end
498
+
499
+ TaggedSymbol =
500
+ T.type_alias do
501
+ T.all(
502
+ Symbol,
503
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification
504
+ )
505
+ end
506
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
507
+
508
+ TRUE =
509
+ T.let(
510
+ :true,
511
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol
512
+ )
513
+ FALSE =
514
+ T.let(
515
+ :false,
516
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol
517
+ )
518
+ end
519
+
520
+ # Host materializable images on the Brand.dev CDN and return their URL and MIME
521
+ # type.
522
+ module HostedURL
523
+ extend ContextDev::Internal::Type::Union
524
+
525
+ Variants =
526
+ T.type_alias do
527
+ T.any(
528
+ T::Boolean,
529
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol
530
+ )
531
+ end
532
+
533
+ sig do
534
+ override.returns(
535
+ T::Array[
536
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::Variants
537
+ ]
538
+ )
539
+ end
540
+ def self.variants
541
+ end
542
+
543
+ TaggedSymbol =
544
+ T.type_alias do
545
+ T.all(
546
+ Symbol,
547
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL
548
+ )
549
+ end
550
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
551
+
552
+ TRUE =
553
+ T.let(
554
+ :true,
555
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol
556
+ )
557
+ FALSE =
558
+ T.let(
559
+ :false,
560
+ ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol
561
+ )
562
+ end
563
+
564
+ # Measure image width and height when possible.
565
+ module Resolution
566
+ extend ContextDev::Internal::Type::Union
567
+
568
+ Variants =
569
+ T.type_alias do
570
+ T.any(
571
+ T::Boolean,
572
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol
573
+ )
574
+ end
575
+
576
+ sig do
577
+ override.returns(
578
+ T::Array[
579
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::Variants
580
+ ]
581
+ )
582
+ end
583
+ def self.variants
584
+ end
585
+
586
+ TaggedSymbol =
587
+ T.type_alias do
588
+ T.all(
589
+ Symbol,
590
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution
591
+ )
592
+ end
593
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
594
+
595
+ TRUE =
596
+ T.let(
597
+ :true,
598
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol
599
+ )
600
+ FALSE =
601
+ T.let(
602
+ :false,
603
+ ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol
604
+ )
605
+ end
210
606
  end
211
607
  end
212
608
  end