context.dev 2.19.0 → 2.21.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +219 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +6 -0
  5. data/lib/context_dev/models/feedback_submit_params.rb +73 -0
  6. data/lib/context_dev/models/feedback_submit_response.rb +68 -0
  7. data/lib/context_dev/models/news_search_params.rb +13 -6
  8. data/lib/context_dev/models/web_scrape_params.rb +149 -14
  9. data/lib/context_dev/models/web_scrape_response.rb +404 -12
  10. data/lib/context_dev/models.rb +2 -0
  11. data/lib/context_dev/resources/feedback.rb +50 -0
  12. data/lib/context_dev/resources/news.rb +8 -4
  13. data/lib/context_dev/resources/web.rb +26 -8
  14. data/lib/context_dev/version.rb +1 -1
  15. data/lib/context_dev.rb +3 -0
  16. data/rbi/context_dev/client.rbi +5 -0
  17. data/rbi/context_dev/models/feedback_submit_params.rbi +133 -0
  18. data/rbi/context_dev/models/feedback_submit_response.rbi +122 -0
  19. data/rbi/context_dev/models/news_search_params.rbi +12 -6
  20. data/rbi/context_dev/models/web_scrape_params.rbi +248 -18
  21. data/rbi/context_dev/models/web_scrape_response.rbi +702 -30
  22. data/rbi/context_dev/models.rbi +2 -0
  23. data/rbi/context_dev/resources/feedback.rbi +42 -0
  24. data/rbi/context_dev/resources/news.rbi +7 -4
  25. data/rbi/context_dev/resources/web.rbi +38 -12
  26. data/sig/context_dev/client.rbs +2 -0
  27. data/sig/context_dev/models/feedback_submit_params.rbs +73 -0
  28. data/sig/context_dev/models/feedback_submit_response.rbs +58 -0
  29. data/sig/context_dev/models/web_scrape_params.rbs +91 -0
  30. data/sig/context_dev/models/web_scrape_response.rbs +302 -18
  31. data/sig/context_dev/models.rbs +2 -0
  32. data/sig/context_dev/resources/feedback.rbs +16 -0
  33. data/sig/context_dev/resources/web.rbs +3 -0
  34. metadata +11 -2
@@ -35,6 +35,19 @@ module ContextDev
35
35
  end
36
36
  attr_writer :cache_metadata
37
37
 
38
+ # Relevant Markdown excerpts for your question or topic, in page order. Headings
39
+ # in square brackets supply necessary context; ellipses mark omitted portions.
40
+ # Empty when the page has no text.
41
+ sig { returns(ContextDev::Models::WebScrapeResponse::Highlights) }
42
+ attr_reader :highlights
43
+
44
+ sig do
45
+ params(
46
+ highlights: ContextDev::Models::WebScrapeResponse::Highlights::OrHash
47
+ ).void
48
+ end
49
+ attr_writer :highlights
50
+
38
51
  # Rendered HTML after content filters.
39
52
  sig { returns(ContextDev::Models::WebScrapeResponse::HTML) }
40
53
  attr_reader :html
@@ -55,6 +68,15 @@ module ContextDev
55
68
  end
56
69
  attr_writer :images
57
70
 
71
+ # Page data extracted using your schema.
72
+ sig { returns(ContextDev::Models::WebScrapeResponse::Json) }
73
+ attr_reader :json
74
+
75
+ sig do
76
+ params(json: ContextDev::Models::WebScrapeResponse::Json::OrHash).void
77
+ end
78
+ attr_writer :json
79
+
58
80
  # Markdown after content filters.
59
81
  sig { returns(ContextDev::Models::WebScrapeResponse::Markdown) }
60
82
  attr_reader :markdown
@@ -88,6 +110,17 @@ module ContextDev
88
110
  end
89
111
  attr_writer :parsed
90
112
 
113
+ # Product details found on the page.
114
+ sig { returns(ContextDev::Models::WebScrapeResponse::Product) }
115
+ attr_reader :product
116
+
117
+ sig do
118
+ params(
119
+ product: ContextDev::Models::WebScrapeResponse::Product::OrHash
120
+ ).void
121
+ end
122
+ attr_writer :product
123
+
91
124
  # Unique id of this API call, also sent in the X-Request-Id response header. Quote
92
125
  # it when contacting support about a failed request.
93
126
  sig { returns(String) }
@@ -108,8 +141,11 @@ module ContextDev
108
141
  sig { returns(String) }
109
142
  attr_accessor :url
110
143
 
111
- # Present when return-partial captures a page that is still loading or returns
112
- # images before image processing finishes. Partial responses are not cached.
144
+ # Present when at least one requested output succeeds while another fails, or when
145
+ # successful outputs come from a page that is still loading or images returned
146
+ # before processing finished. Absent when every requested output fails. Check each
147
+ # output's success field for its result. Valid captured pieces may be cached
148
+ # independently; failed retrievals and incomplete captures are not cached.
113
149
  sig do
114
150
  returns(
115
151
  T.nilable(
@@ -146,11 +182,14 @@ module ContextDev
146
182
  bytes: ContextDev::Models::WebScrapeResponse::Bytes::OrHash,
147
183
  cache_metadata:
148
184
  ContextDev::Models::WebScrapeResponse::CacheMetadata::OrHash,
185
+ highlights: ContextDev::Models::WebScrapeResponse::Highlights::OrHash,
149
186
  html: ContextDev::Models::WebScrapeResponse::HTML::OrHash,
150
187
  images: ContextDev::Models::WebScrapeResponse::Images::OrHash,
188
+ json: ContextDev::Models::WebScrapeResponse::Json::OrHash,
151
189
  markdown: ContextDev::Models::WebScrapeResponse::Markdown::OrHash,
152
190
  metadata: ContextDev::Models::WebScrapeResponse::Metadata::OrHash,
153
191
  parsed: ContextDev::Models::WebScrapeResponse::Parsed::OrHash,
192
+ product: ContextDev::Models::WebScrapeResponse::Product::OrHash,
154
193
  request_id: String,
155
194
  screenshot: ContextDev::Models::WebScrapeResponse::Screenshot::OrHash,
156
195
  url: String,
@@ -168,16 +207,24 @@ module ContextDev
168
207
  # cache-controlled fetch contributing to the output was a hit; age_ms is the
169
208
  # oldest contributing hit.
170
209
  cache_metadata:,
210
+ # Relevant Markdown excerpts for your question or topic, in page order. Headings
211
+ # in square brackets supply necessary context; ellipses mark omitted portions.
212
+ # Empty when the page has no text.
213
+ highlights:,
171
214
  # Rendered HTML after content filters.
172
215
  html:,
173
216
  # Images after content filters. Empty when none are found.
174
217
  images:,
218
+ # Page data extracted using your schema.
219
+ json:,
175
220
  # Markdown after content filters.
176
221
  markdown:,
177
222
  # Page details, when available.
178
223
  metadata:,
179
224
  # Fields produced by parseParams.rules, after shared content filters.
180
225
  parsed:,
226
+ # Product details found on the page.
227
+ product:,
181
228
  # Unique id of this API call, also sent in the X-Request-Id response header. Quote
182
229
  # it when contacting support about a failed request.
183
230
  request_id:,
@@ -185,8 +232,11 @@ module ContextDev
185
232
  screenshot:,
186
233
  # Final URL after redirects and browser actions.
187
234
  url:,
188
- # Present when return-partial captures a page that is still loading or returns
189
- # images before image processing finishes. Partial responses are not cached.
235
+ # Present when at least one requested output succeeds while another fails, or when
236
+ # successful outputs come from a page that is still loading or images returned
237
+ # before processing finished. Absent when every requested output fails. Check each
238
+ # output's success field for its result. Valid captured pieces may be cached
239
+ # independently; failed retrievals and incomplete captures are not cached.
190
240
  is_partial: nil,
191
241
  # Credit usage, included whenever a valid API key is provided.
192
242
  key_metadata: nil
@@ -199,11 +249,14 @@ module ContextDev
199
249
  bytes: ContextDev::Models::WebScrapeResponse::Bytes,
200
250
  cache_metadata:
201
251
  ContextDev::Models::WebScrapeResponse::CacheMetadata,
252
+ highlights: ContextDev::Models::WebScrapeResponse::Highlights,
202
253
  html: ContextDev::Models::WebScrapeResponse::HTML,
203
254
  images: ContextDev::Models::WebScrapeResponse::Images,
255
+ json: ContextDev::Models::WebScrapeResponse::Json,
204
256
  markdown: ContextDev::Models::WebScrapeResponse::Markdown,
205
257
  metadata: ContextDev::Models::WebScrapeResponse::Metadata,
206
258
  parsed: ContextDev::Models::WebScrapeResponse::Parsed,
259
+ product: ContextDev::Models::WebScrapeResponse::Product,
207
260
  request_id: String,
208
261
  screenshot: ContextDev::Models::WebScrapeResponse::Screenshot,
209
262
  url: String,
@@ -243,6 +296,10 @@ module ContextDev
243
296
  sig { returns(T::Boolean) }
244
297
  attr_accessor :requested
245
298
 
299
+ # True when retrieved, false when retrieval failed, and null when not requested.
300
+ sig { returns(T.nilable(T::Boolean)) }
301
+ attr_accessor :success
302
+
246
303
  # Original HTTP response body. Waiting, actions, and content filters never change
247
304
  # it.
248
305
  sig do
@@ -251,10 +308,16 @@ module ContextDev
251
308
  T.nilable(
252
309
  ContextDev::Models::WebScrapeResponse::Bytes::Data::OrHash
253
310
  ),
254
- requested: T::Boolean
311
+ requested: T::Boolean,
312
+ success: T.nilable(T::Boolean)
255
313
  ).returns(T.attached_class)
256
314
  end
257
- def self.new(data:, requested:)
315
+ def self.new(
316
+ data:,
317
+ requested:,
318
+ # True when retrieved, false when retrieval failed, and null when not requested.
319
+ success:
320
+ )
258
321
  end
259
322
 
260
323
  sig do
@@ -262,7 +325,8 @@ module ContextDev
262
325
  {
263
326
  data:
264
327
  T.nilable(ContextDev::Models::WebScrapeResponse::Bytes::Data),
265
- requested: T::Boolean
328
+ requested: T::Boolean,
329
+ success: T.nilable(T::Boolean)
266
330
  }
267
331
  )
268
332
  end
@@ -400,6 +464,56 @@ module ContextDev
400
464
  end
401
465
  end
402
466
 
467
+ class Highlights < ContextDev::Internal::Type::BaseModel
468
+ OrHash =
469
+ T.type_alias do
470
+ T.any(
471
+ ContextDev::Models::WebScrapeResponse::Highlights,
472
+ ContextDev::Internal::AnyHash
473
+ )
474
+ end
475
+
476
+ sig { returns(T.nilable(T::Array[String])) }
477
+ attr_accessor :data
478
+
479
+ sig { returns(T::Boolean) }
480
+ attr_accessor :requested
481
+
482
+ # True when retrieved, false when retrieval failed, and null when not requested.
483
+ sig { returns(T.nilable(T::Boolean)) }
484
+ attr_accessor :success
485
+
486
+ # Relevant Markdown excerpts for your question or topic, in page order. Headings
487
+ # in square brackets supply necessary context; ellipses mark omitted portions.
488
+ # Empty when the page has no text.
489
+ sig do
490
+ params(
491
+ data: T.nilable(T::Array[String]),
492
+ requested: T::Boolean,
493
+ success: T.nilable(T::Boolean)
494
+ ).returns(T.attached_class)
495
+ end
496
+ def self.new(
497
+ data:,
498
+ requested:,
499
+ # True when retrieved, false when retrieval failed, and null when not requested.
500
+ success:
501
+ )
502
+ end
503
+
504
+ sig do
505
+ override.returns(
506
+ {
507
+ data: T.nilable(T::Array[String]),
508
+ requested: T::Boolean,
509
+ success: T.nilable(T::Boolean)
510
+ }
511
+ )
512
+ end
513
+ def to_hash
514
+ end
515
+ end
516
+
403
517
  class HTML < ContextDev::Internal::Type::BaseModel
404
518
  OrHash =
405
519
  T.type_alias do
@@ -415,17 +529,34 @@ module ContextDev
415
529
  sig { returns(T::Boolean) }
416
530
  attr_accessor :requested
417
531
 
532
+ # True when retrieved, false when retrieval failed, and null when not requested.
533
+ sig { returns(T.nilable(T::Boolean)) }
534
+ attr_accessor :success
535
+
418
536
  # Rendered HTML after content filters.
419
537
  sig do
420
- params(data: T.nilable(String), requested: T::Boolean).returns(
421
- T.attached_class
422
- )
538
+ params(
539
+ data: T.nilable(String),
540
+ requested: T::Boolean,
541
+ success: T.nilable(T::Boolean)
542
+ ).returns(T.attached_class)
423
543
  end
424
- def self.new(data:, requested:)
544
+ def self.new(
545
+ data:,
546
+ requested:,
547
+ # True when retrieved, false when retrieval failed, and null when not requested.
548
+ success:
549
+ )
425
550
  end
426
551
 
427
552
  sig do
428
- override.returns({ data: T.nilable(String), requested: T::Boolean })
553
+ override.returns(
554
+ {
555
+ data: T.nilable(String),
556
+ requested: T::Boolean,
557
+ success: T.nilable(T::Boolean)
558
+ }
559
+ )
429
560
  end
430
561
  def to_hash
431
562
  end
@@ -452,6 +583,10 @@ module ContextDev
452
583
  sig { returns(T::Boolean) }
453
584
  attr_accessor :requested
454
585
 
586
+ # True when retrieved, false when retrieval failed, and null when not requested.
587
+ sig { returns(T.nilable(T::Boolean)) }
588
+ attr_accessor :success
589
+
455
590
  # Images after content filters. Empty when none are found.
456
591
  sig do
457
592
  params(
@@ -461,10 +596,16 @@ module ContextDev
461
596
  ContextDev::Models::WebScrapeResponse::Images::Data::OrHash
462
597
  ]
463
598
  ),
464
- requested: T::Boolean
599
+ requested: T::Boolean,
600
+ success: T.nilable(T::Boolean)
465
601
  ).returns(T.attached_class)
466
602
  end
467
- def self.new(data:, requested:)
603
+ def self.new(
604
+ data:,
605
+ requested:,
606
+ # True when retrieved, false when retrieval failed, and null when not requested.
607
+ success:
608
+ )
468
609
  end
469
610
 
470
611
  sig do
@@ -474,7 +615,8 @@ module ContextDev
474
615
  T.nilable(
475
616
  T::Array[ContextDev::Models::WebScrapeResponse::Images::Data]
476
617
  ),
477
- requested: T::Boolean
618
+ requested: T::Boolean,
619
+ success: T.nilable(T::Boolean)
478
620
  }
479
621
  )
480
622
  end
@@ -642,6 +784,54 @@ module ContextDev
642
784
  end
643
785
  end
644
786
 
787
+ class Json < ContextDev::Internal::Type::BaseModel
788
+ OrHash =
789
+ T.type_alias do
790
+ T.any(
791
+ ContextDev::Models::WebScrapeResponse::Json,
792
+ ContextDev::Internal::AnyHash
793
+ )
794
+ end
795
+
796
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
797
+ attr_accessor :data
798
+
799
+ sig { returns(T::Boolean) }
800
+ attr_accessor :requested
801
+
802
+ # True when retrieved, false when retrieval failed, and null when not requested.
803
+ sig { returns(T.nilable(T::Boolean)) }
804
+ attr_accessor :success
805
+
806
+ # Page data extracted using your schema.
807
+ sig do
808
+ params(
809
+ data: T.nilable(T::Hash[Symbol, T.anything]),
810
+ requested: T::Boolean,
811
+ success: T.nilable(T::Boolean)
812
+ ).returns(T.attached_class)
813
+ end
814
+ def self.new(
815
+ data:,
816
+ requested:,
817
+ # True when retrieved, false when retrieval failed, and null when not requested.
818
+ success:
819
+ )
820
+ end
821
+
822
+ sig do
823
+ override.returns(
824
+ {
825
+ data: T.nilable(T::Hash[Symbol, T.anything]),
826
+ requested: T::Boolean,
827
+ success: T.nilable(T::Boolean)
828
+ }
829
+ )
830
+ end
831
+ def to_hash
832
+ end
833
+ end
834
+
645
835
  class Markdown < ContextDev::Internal::Type::BaseModel
646
836
  OrHash =
647
837
  T.type_alias do
@@ -657,17 +847,34 @@ module ContextDev
657
847
  sig { returns(T::Boolean) }
658
848
  attr_accessor :requested
659
849
 
850
+ # True when retrieved, false when retrieval failed, and null when not requested.
851
+ sig { returns(T.nilable(T::Boolean)) }
852
+ attr_accessor :success
853
+
660
854
  # Markdown after content filters.
661
855
  sig do
662
- params(data: T.nilable(String), requested: T::Boolean).returns(
663
- T.attached_class
664
- )
856
+ params(
857
+ data: T.nilable(String),
858
+ requested: T::Boolean,
859
+ success: T.nilable(T::Boolean)
860
+ ).returns(T.attached_class)
665
861
  end
666
- def self.new(data:, requested:)
862
+ def self.new(
863
+ data:,
864
+ requested:,
865
+ # True when retrieved, false when retrieval failed, and null when not requested.
866
+ success:
867
+ )
667
868
  end
668
869
 
669
870
  sig do
670
- override.returns({ data: T.nilable(String), requested: T::Boolean })
871
+ override.returns(
872
+ {
873
+ data: T.nilable(String),
874
+ requested: T::Boolean,
875
+ success: T.nilable(T::Boolean)
876
+ }
877
+ )
671
878
  end
672
879
  def to_hash
673
880
  end
@@ -1191,21 +1398,32 @@ module ContextDev
1191
1398
  sig { returns(T::Boolean) }
1192
1399
  attr_accessor :requested
1193
1400
 
1401
+ # True when retrieved, false when retrieval failed, and null when not requested.
1402
+ sig { returns(T.nilable(T::Boolean)) }
1403
+ attr_accessor :success
1404
+
1194
1405
  # Fields produced by parseParams.rules, after shared content filters.
1195
1406
  sig do
1196
1407
  params(
1197
1408
  data: T.nilable(T::Hash[Symbol, T.anything]),
1198
- requested: T::Boolean
1409
+ requested: T::Boolean,
1410
+ success: T.nilable(T::Boolean)
1199
1411
  ).returns(T.attached_class)
1200
1412
  end
1201
- def self.new(data:, requested:)
1413
+ def self.new(
1414
+ data:,
1415
+ requested:,
1416
+ # True when retrieved, false when retrieval failed, and null when not requested.
1417
+ success:
1418
+ )
1202
1419
  end
1203
1420
 
1204
1421
  sig do
1205
1422
  override.returns(
1206
1423
  {
1207
1424
  data: T.nilable(T::Hash[Symbol, T.anything]),
1208
- requested: T::Boolean
1425
+ requested: T::Boolean,
1426
+ success: T.nilable(T::Boolean)
1209
1427
  }
1210
1428
  )
1211
1429
  end
@@ -1213,6 +1431,440 @@ module ContextDev
1213
1431
  end
1214
1432
  end
1215
1433
 
1434
+ class Product < ContextDev::Internal::Type::BaseModel
1435
+ OrHash =
1436
+ T.type_alias do
1437
+ T.any(
1438
+ ContextDev::Models::WebScrapeResponse::Product,
1439
+ ContextDev::Internal::AnyHash
1440
+ )
1441
+ end
1442
+
1443
+ sig do
1444
+ returns(
1445
+ T.nilable(ContextDev::Models::WebScrapeResponse::Product::Data)
1446
+ )
1447
+ end
1448
+ attr_reader :data
1449
+
1450
+ sig do
1451
+ params(
1452
+ data:
1453
+ T.nilable(
1454
+ ContextDev::Models::WebScrapeResponse::Product::Data::OrHash
1455
+ )
1456
+ ).void
1457
+ end
1458
+ attr_writer :data
1459
+
1460
+ sig { returns(T::Boolean) }
1461
+ attr_accessor :requested
1462
+
1463
+ # True when retrieved, false when retrieval failed, and null when not requested.
1464
+ sig { returns(T.nilable(T::Boolean)) }
1465
+ attr_accessor :success
1466
+
1467
+ # Product details found on the page.
1468
+ sig do
1469
+ params(
1470
+ data:
1471
+ T.nilable(
1472
+ ContextDev::Models::WebScrapeResponse::Product::Data::OrHash
1473
+ ),
1474
+ requested: T::Boolean,
1475
+ success: T.nilable(T::Boolean)
1476
+ ).returns(T.attached_class)
1477
+ end
1478
+ def self.new(
1479
+ data:,
1480
+ requested:,
1481
+ # True when retrieved, false when retrieval failed, and null when not requested.
1482
+ success:
1483
+ )
1484
+ end
1485
+
1486
+ sig do
1487
+ override.returns(
1488
+ {
1489
+ data:
1490
+ T.nilable(ContextDev::Models::WebScrapeResponse::Product::Data),
1491
+ requested: T::Boolean,
1492
+ success: T.nilable(T::Boolean)
1493
+ }
1494
+ )
1495
+ end
1496
+ def to_hash
1497
+ end
1498
+
1499
+ class Data < ContextDev::Internal::Type::BaseModel
1500
+ OrHash =
1501
+ T.type_alias do
1502
+ T.any(
1503
+ ContextDev::Models::WebScrapeResponse::Product::Data,
1504
+ ContextDev::Internal::AnyHash
1505
+ )
1506
+ end
1507
+
1508
+ # Whether the page is a product detail page.
1509
+ sig { returns(T::Boolean) }
1510
+ attr_accessor :is_product_page
1511
+
1512
+ # The extracted product, or null when the page is not a product detail page.
1513
+ sig do
1514
+ returns(
1515
+ T.nilable(
1516
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product
1517
+ )
1518
+ )
1519
+ end
1520
+ attr_reader :product
1521
+
1522
+ sig do
1523
+ params(
1524
+ product:
1525
+ T.nilable(
1526
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::OrHash
1527
+ )
1528
+ ).void
1529
+ end
1530
+ attr_writer :product
1531
+
1532
+ sig do
1533
+ params(
1534
+ is_product_page: T::Boolean,
1535
+ product:
1536
+ T.nilable(
1537
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::OrHash
1538
+ )
1539
+ ).returns(T.attached_class)
1540
+ end
1541
+ def self.new(
1542
+ # Whether the page is a product detail page.
1543
+ is_product_page:,
1544
+ # The extracted product, or null when the page is not a product detail page.
1545
+ product:
1546
+ )
1547
+ end
1548
+
1549
+ sig do
1550
+ override.returns(
1551
+ {
1552
+ is_product_page: T::Boolean,
1553
+ product:
1554
+ T.nilable(
1555
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product
1556
+ )
1557
+ }
1558
+ )
1559
+ end
1560
+ def to_hash
1561
+ end
1562
+
1563
+ class Product < ContextDev::Internal::Type::BaseModel
1564
+ OrHash =
1565
+ T.type_alias do
1566
+ T.any(
1567
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product,
1568
+ ContextDev::Internal::AnyHash
1569
+ )
1570
+ end
1571
+
1572
+ # Stock or ordering availability.
1573
+ sig do
1574
+ returns(
1575
+ T.nilable(
1576
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1577
+ )
1578
+ )
1579
+ end
1580
+ attr_accessor :availability
1581
+
1582
+ # Brand or vendor.
1583
+ sig { returns(T.nilable(String)) }
1584
+ attr_accessor :brand
1585
+
1586
+ # Product category.
1587
+ sig { returns(T.nilable(String)) }
1588
+ attr_accessor :category
1589
+
1590
+ # ISO 4217 currency code.
1591
+ sig { returns(T.nilable(String)) }
1592
+ attr_accessor :currency
1593
+
1594
+ # Product description.
1595
+ sig { returns(T.nilable(String)) }
1596
+ attr_accessor :description
1597
+
1598
+ # Product dimensions as shown on the page.
1599
+ sig { returns(T::Array[String]) }
1600
+ attr_accessor :dimensions
1601
+
1602
+ # Key features and specifications.
1603
+ sig { returns(T::Array[String]) }
1604
+ attr_accessor :features
1605
+
1606
+ # Product image URLs, main image first.
1607
+ sig { returns(T::Array[String]) }
1608
+ attr_accessor :images
1609
+
1610
+ # Main product image URL.
1611
+ sig { returns(T.nilable(String)) }
1612
+ attr_accessor :image_url
1613
+
1614
+ # Product name.
1615
+ sig { returns(String) }
1616
+ attr_accessor :name
1617
+
1618
+ # Current price.
1619
+ sig { returns(T.nilable(Float)) }
1620
+ attr_accessor :price
1621
+
1622
+ # List price before any discount.
1623
+ sig { returns(T.nilable(Float)) }
1624
+ attr_accessor :regular_price
1625
+
1626
+ # Product identifier such as a SKU or model number.
1627
+ sig { returns(T.nilable(String)) }
1628
+ attr_accessor :sku
1629
+
1630
+ # Product tags.
1631
+ sig { returns(T::Array[String]) }
1632
+ attr_accessor :tags
1633
+
1634
+ # Intended audience.
1635
+ sig { returns(T::Array[String]) }
1636
+ attr_accessor :target_audience
1637
+
1638
+ # Product variations, such as different colors or sizes, with their attributes and
1639
+ # images. Empty if none are found. May not include every variation offered by the
1640
+ # store.
1641
+ sig do
1642
+ returns(
1643
+ T::Array[
1644
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Variant
1645
+ ]
1646
+ )
1647
+ end
1648
+ attr_accessor :variants
1649
+
1650
+ # The extracted product, or null when the page is not a product detail page.
1651
+ sig do
1652
+ params(
1653
+ availability:
1654
+ T.nilable(
1655
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::OrSymbol
1656
+ ),
1657
+ brand: T.nilable(String),
1658
+ category: T.nilable(String),
1659
+ currency: T.nilable(String),
1660
+ description: T.nilable(String),
1661
+ dimensions: T::Array[String],
1662
+ features: T::Array[String],
1663
+ images: T::Array[String],
1664
+ image_url: T.nilable(String),
1665
+ name: String,
1666
+ price: T.nilable(Float),
1667
+ regular_price: T.nilable(Float),
1668
+ sku: T.nilable(String),
1669
+ tags: T::Array[String],
1670
+ target_audience: T::Array[String],
1671
+ variants:
1672
+ T::Array[
1673
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Variant::OrHash
1674
+ ]
1675
+ ).returns(T.attached_class)
1676
+ end
1677
+ def self.new(
1678
+ # Stock or ordering availability.
1679
+ availability:,
1680
+ # Brand or vendor.
1681
+ brand:,
1682
+ # Product category.
1683
+ category:,
1684
+ # ISO 4217 currency code.
1685
+ currency:,
1686
+ # Product description.
1687
+ description:,
1688
+ # Product dimensions as shown on the page.
1689
+ dimensions:,
1690
+ # Key features and specifications.
1691
+ features:,
1692
+ # Product image URLs, main image first.
1693
+ images:,
1694
+ # Main product image URL.
1695
+ image_url:,
1696
+ # Product name.
1697
+ name:,
1698
+ # Current price.
1699
+ price:,
1700
+ # List price before any discount.
1701
+ regular_price:,
1702
+ # Product identifier such as a SKU or model number.
1703
+ sku:,
1704
+ # Product tags.
1705
+ tags:,
1706
+ # Intended audience.
1707
+ target_audience:,
1708
+ # Product variations, such as different colors or sizes, with their attributes and
1709
+ # images. Empty if none are found. May not include every variation offered by the
1710
+ # store.
1711
+ variants:
1712
+ )
1713
+ end
1714
+
1715
+ sig do
1716
+ override.returns(
1717
+ {
1718
+ availability:
1719
+ T.nilable(
1720
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1721
+ ),
1722
+ brand: T.nilable(String),
1723
+ category: T.nilable(String),
1724
+ currency: T.nilable(String),
1725
+ description: T.nilable(String),
1726
+ dimensions: T::Array[String],
1727
+ features: T::Array[String],
1728
+ images: T::Array[String],
1729
+ image_url: T.nilable(String),
1730
+ name: String,
1731
+ price: T.nilable(Float),
1732
+ regular_price: T.nilable(Float),
1733
+ sku: T.nilable(String),
1734
+ tags: T::Array[String],
1735
+ target_audience: T::Array[String],
1736
+ variants:
1737
+ T::Array[
1738
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Variant
1739
+ ]
1740
+ }
1741
+ )
1742
+ end
1743
+ def to_hash
1744
+ end
1745
+
1746
+ # Stock or ordering availability.
1747
+ module Availability
1748
+ extend ContextDev::Internal::Type::Enum
1749
+
1750
+ TaggedSymbol =
1751
+ T.type_alias do
1752
+ T.all(
1753
+ Symbol,
1754
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability
1755
+ )
1756
+ end
1757
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1758
+
1759
+ IN_STOCK =
1760
+ T.let(
1761
+ :in_stock,
1762
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1763
+ )
1764
+ OUT_OF_STOCK =
1765
+ T.let(
1766
+ :out_of_stock,
1767
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1768
+ )
1769
+ LIMITED_AVAILABILITY =
1770
+ T.let(
1771
+ :limited_availability,
1772
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1773
+ )
1774
+ PREORDER =
1775
+ T.let(
1776
+ :preorder,
1777
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1778
+ )
1779
+ BACKORDER =
1780
+ T.let(
1781
+ :backorder,
1782
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1783
+ )
1784
+ MADE_TO_ORDER =
1785
+ T.let(
1786
+ :made_to_order,
1787
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1788
+ )
1789
+ DISCONTINUED =
1790
+ T.let(
1791
+ :discontinued,
1792
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1793
+ )
1794
+
1795
+ sig do
1796
+ override.returns(
1797
+ T::Array[
1798
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Availability::TaggedSymbol
1799
+ ]
1800
+ )
1801
+ end
1802
+ def self.values
1803
+ end
1804
+ end
1805
+
1806
+ class Variant < ContextDev::Internal::Type::BaseModel
1807
+ OrHash =
1808
+ T.type_alias do
1809
+ T.any(
1810
+ ContextDev::Models::WebScrapeResponse::Product::Data::Product::Variant,
1811
+ ContextDev::Internal::AnyHash
1812
+ )
1813
+ end
1814
+
1815
+ # Explicit variant attributes such as color, size, material, pattern and
1816
+ # properties declared by page.
1817
+ sig { returns(T::Hash[Symbol, String]) }
1818
+ attr_accessor :attributes
1819
+
1820
+ # Original source image URLs explicitly attached to this variant.
1821
+ sig { returns(T::Array[String]) }
1822
+ attr_accessor :images
1823
+
1824
+ sig { returns(T.nilable(String)) }
1825
+ attr_accessor :sku
1826
+
1827
+ # Variant or offer URL when provided by the source. May be shared by variants.
1828
+ sig { returns(T.nilable(String)) }
1829
+ attr_accessor :url
1830
+
1831
+ sig do
1832
+ params(
1833
+ attributes: T::Hash[Symbol, String],
1834
+ images: T::Array[String],
1835
+ sku: T.nilable(String),
1836
+ url: T.nilable(String)
1837
+ ).returns(T.attached_class)
1838
+ end
1839
+ def self.new(
1840
+ # Explicit variant attributes such as color, size, material, pattern and
1841
+ # properties declared by page.
1842
+ attributes:,
1843
+ # Original source image URLs explicitly attached to this variant.
1844
+ images:,
1845
+ sku:,
1846
+ # Variant or offer URL when provided by the source. May be shared by variants.
1847
+ url:
1848
+ )
1849
+ end
1850
+
1851
+ sig do
1852
+ override.returns(
1853
+ {
1854
+ attributes: T::Hash[Symbol, String],
1855
+ images: T::Array[String],
1856
+ sku: T.nilable(String),
1857
+ url: T.nilable(String)
1858
+ }
1859
+ )
1860
+ end
1861
+ def to_hash
1862
+ end
1863
+ end
1864
+ end
1865
+ end
1866
+ end
1867
+
1216
1868
  class Screenshot < ContextDev::Internal::Type::BaseModel
1217
1869
  OrHash =
1218
1870
  T.type_alias do
@@ -1228,24 +1880,44 @@ module ContextDev
1228
1880
  sig { returns(T::Boolean) }
1229
1881
  attr_accessor :requested
1230
1882
 
1883
+ # True when retrieved, false when retrieval failed, and null when not requested.
1884
+ sig { returns(T.nilable(T::Boolean)) }
1885
+ attr_accessor :success
1886
+
1231
1887
  # An image data URL. Use directly as an image src.
1232
1888
  sig do
1233
- params(data: T.nilable(String), requested: T::Boolean).returns(
1234
- T.attached_class
1235
- )
1889
+ params(
1890
+ data: T.nilable(String),
1891
+ requested: T::Boolean,
1892
+ success: T.nilable(T::Boolean)
1893
+ ).returns(T.attached_class)
1236
1894
  end
1237
- def self.new(data:, requested:)
1895
+ def self.new(
1896
+ data:,
1897
+ requested:,
1898
+ # True when retrieved, false when retrieval failed, and null when not requested.
1899
+ success:
1900
+ )
1238
1901
  end
1239
1902
 
1240
1903
  sig do
1241
- override.returns({ data: T.nilable(String), requested: T::Boolean })
1904
+ override.returns(
1905
+ {
1906
+ data: T.nilable(String),
1907
+ requested: T::Boolean,
1908
+ success: T.nilable(T::Boolean)
1909
+ }
1910
+ )
1242
1911
  end
1243
1912
  def to_hash
1244
1913
  end
1245
1914
  end
1246
1915
 
1247
- # Present when return-partial captures a page that is still loading or returns
1248
- # images before image processing finishes. Partial responses are not cached.
1916
+ # Present when at least one requested output succeeds while another fails, or when
1917
+ # successful outputs come from a page that is still loading or images returned
1918
+ # before processing finished. Absent when every requested output fails. Check each
1919
+ # output's success field for its result. Valid captured pieces may be cached
1920
+ # independently; failed retrievals and incomplete captures are not cached.
1249
1921
  module IsPartial
1250
1922
  extend ContextDev::Internal::Type::Enum
1251
1923