context.dev 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +5 -0
  5. data/lib/context_dev/models/batch_get_results_response.rb +33 -3
  6. data/lib/context_dev/models/batch_submit_params.rb +44 -316
  7. data/lib/context_dev/models/brand_search_params.rb +41 -3
  8. data/lib/context_dev/models/news_search_params.rb +467 -0
  9. data/lib/context_dev/models/news_search_response.rb +238 -0
  10. data/lib/context_dev/models/parse_handle_params.rb +15 -144
  11. data/lib/context_dev/models/person_enrich_response.rb +61 -1
  12. data/lib/context_dev/models/utility_prefetch_params.rb +19 -16
  13. data/lib/context_dev/models/utility_prefetch_response.rb +4 -5
  14. data/lib/context_dev/models/web_screenshot_params.rb +3 -30
  15. data/lib/context_dev/models/web_web_crawl_md_response.rb +30 -1
  16. data/lib/context_dev/models/web_web_scrape_html_params.rb +15 -153
  17. data/lib/context_dev/models/web_web_scrape_html_response.rb +30 -1
  18. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -124
  19. data/lib/context_dev/models/web_web_scrape_md_params.rb +35 -238
  20. data/lib/context_dev/models/web_web_scrape_md_response.rb +41 -2
  21. data/lib/context_dev/models.rb +2 -0
  22. data/lib/context_dev/resources/brand.rb +10 -11
  23. data/lib/context_dev/resources/news.rb +51 -0
  24. data/lib/context_dev/resources/parse.rb +5 -5
  25. data/lib/context_dev/resources/utility.rb +7 -6
  26. data/lib/context_dev/resources/web.rb +26 -23
  27. data/lib/context_dev/version.rb +1 -1
  28. data/lib/context_dev.rb +3 -0
  29. data/rbi/context_dev/client.rbi +4 -0
  30. data/rbi/context_dev/models/batch_get_results_response.rbi +71 -2
  31. data/rbi/context_dev/models/batch_submit_params.rbi +58 -592
  32. data/rbi/context_dev/models/brand_search_params.rbi +71 -2
  33. data/rbi/context_dev/models/news_search_params.rbi +1294 -0
  34. data/rbi/context_dev/models/news_search_response.rbi +423 -0
  35. data/rbi/context_dev/models/parse_handle_params.rbi +20 -316
  36. data/rbi/context_dev/models/person_enrich_response.rbi +87 -0
  37. data/rbi/context_dev/models/utility_prefetch_params.rbi +24 -16
  38. data/rbi/context_dev/models/utility_prefetch_response.rbi +8 -6
  39. data/rbi/context_dev/models/web_screenshot_params.rbi +4 -71
  40. data/rbi/context_dev/models/web_web_crawl_md_response.rbi +67 -0
  41. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +20 -356
  42. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +65 -0
  43. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +16 -287
  44. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +47 -551
  45. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +80 -0
  46. data/rbi/context_dev/models.rbi +2 -0
  47. data/rbi/context_dev/resources/brand.rbi +14 -9
  48. data/rbi/context_dev/resources/news.rbi +46 -0
  49. data/rbi/context_dev/resources/parse.rbi +5 -21
  50. data/rbi/context_dev/resources/utility.rbi +8 -6
  51. data/rbi/context_dev/resources/web.rbi +27 -66
  52. data/sig/context_dev/client.rbs +2 -0
  53. data/sig/context_dev/models/batch_get_results_response.rbs +21 -0
  54. data/sig/context_dev/models/batch_submit_params.rbs +54 -144
  55. data/sig/context_dev/models/brand_search_params.rbs +38 -1
  56. data/sig/context_dev/models/news_search_params.rbs +532 -0
  57. data/sig/context_dev/models/news_search_response.rbs +206 -0
  58. data/sig/context_dev/models/parse_handle_params.rbs +25 -90
  59. data/sig/context_dev/models/person_enrich_response.rbs +31 -0
  60. data/sig/context_dev/models/utility_prefetch_params.rbs +2 -1
  61. data/sig/context_dev/models/utility_prefetch_response.rbs +2 -1
  62. data/sig/context_dev/models/web_screenshot_params.rbs +5 -18
  63. data/sig/context_dev/models/web_web_crawl_md_response.rbs +21 -0
  64. data/sig/context_dev/models/web_web_scrape_html_params.rbs +24 -94
  65. data/sig/context_dev/models/web_web_scrape_html_response.rbs +21 -0
  66. data/sig/context_dev/models/web_web_scrape_images_params.rbs +20 -72
  67. data/sig/context_dev/models/web_web_scrape_md_params.rbs +46 -148
  68. data/sig/context_dev/models/web_web_scrape_md_response.rbs +28 -0
  69. data/sig/context_dev/models.rbs +2 -0
  70. data/sig/context_dev/resources/brand.rbs +3 -0
  71. data/sig/context_dev/resources/news.rbs +17 -0
  72. data/sig/context_dev/resources/parse.rbs +5 -5
  73. data/sig/context_dev/resources/web.rbs +12 -11
  74. metadata +11 -2
@@ -259,6 +259,29 @@ module ContextDev
259
259
  sig { params(favicon: String).void }
260
260
  attr_writer :favicon
261
261
 
262
+ # Page headings (h1–h6) in document order, extracted from the unfiltered document.
263
+ # Capped at the first 500 headings. Omitted when the page has none.
264
+ sig do
265
+ returns(
266
+ T.nilable(
267
+ T::Array[
268
+ ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading
269
+ ]
270
+ )
271
+ )
272
+ end
273
+ attr_reader :headings
274
+
275
+ sig do
276
+ params(
277
+ headings:
278
+ T::Array[
279
+ ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading::OrHash
280
+ ]
281
+ ).void
282
+ end
283
+ attr_writer :headings
284
+
262
285
  # Primary resolved preview image from Open Graph, Twitter, or image metadata.
263
286
  sig { returns(T.nilable(String)) }
264
287
  attr_reader :image
@@ -388,6 +411,10 @@ module ContextDev
388
411
  canonical_url: String,
389
412
  description: String,
390
413
  favicon: String,
414
+ headings:
415
+ T::Array[
416
+ ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading::OrHash
417
+ ],
391
418
  image: String,
392
419
  json_ld: T::Array[T::Hash[Symbol, T.anything]],
393
420
  keywords: T::Array[String],
@@ -427,6 +454,9 @@ module ContextDev
427
454
  description: nil,
428
455
  # Resolved favicon URL, when present.
429
456
  favicon: nil,
457
+ # Page headings (h1–h6) in document order, extracted from the unfiltered document.
458
+ # Capped at the first 500 headings. Omitted when the page has none.
459
+ headings: nil,
430
460
  # Primary resolved preview image from Open Graph, Twitter, or image metadata.
431
461
  image: nil,
432
462
  # JSON-LD structured data blocks parsed from the page.
@@ -470,6 +500,10 @@ module ContextDev
470
500
  canonical_url: String,
471
501
  description: String,
472
502
  favicon: String,
503
+ headings:
504
+ T::Array[
505
+ ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading
506
+ ],
473
507
  image: String,
474
508
  json_ld: T::Array[T::Hash[Symbol, T.anything]],
475
509
  keywords: T::Array[String],
@@ -580,6 +614,37 @@ module ContextDev
580
614
  end
581
615
  end
582
616
 
617
+ class Heading < ContextDev::Internal::Type::BaseModel
618
+ OrHash =
619
+ T.type_alias do
620
+ T.any(
621
+ ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading,
622
+ ContextDev::Internal::AnyHash
623
+ )
624
+ end
625
+
626
+ # Heading level, 1–6 (from h1–h6).
627
+ sig { returns(Integer) }
628
+ attr_accessor :level
629
+
630
+ # Heading text with whitespace collapsed, truncated to 1000 characters.
631
+ sig { returns(String) }
632
+ attr_accessor :text
633
+
634
+ sig { params(level: Integer, text: String).returns(T.attached_class) }
635
+ def self.new(
636
+ # Heading level, 1–6 (from h1–h6).
637
+ level:,
638
+ # Heading text with whitespace collapsed, truncated to 1000 characters.
639
+ text:
640
+ )
641
+ end
642
+
643
+ sig { override.returns({ level: Integer, text: String }) }
644
+ def to_hash
645
+ end
646
+ end
647
+
583
648
  module OpenGraph
584
649
  extend ContextDev::Internal::Type::Union
585
650
 
@@ -39,27 +39,10 @@ module ContextDev
39
39
  # perceptually hashed, and only the highest-resolution copy of each duplicate
40
40
  # group is kept. Images that cannot be downloaded or hashed are kept. Default:
41
41
  # false.
42
- sig do
43
- returns(
44
- T.nilable(
45
- T.any(
46
- T::Boolean,
47
- ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
48
- )
49
- )
50
- )
51
- end
42
+ sig { returns(T.nilable(T::Boolean)) }
52
43
  attr_reader :dedupe
53
44
 
54
- sig do
55
- params(
56
- dedupe:
57
- T.any(
58
- T::Boolean,
59
- ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
60
- )
61
- ).void
62
- end
45
+ sig { params(dedupe: T::Boolean).void }
63
46
  attr_writer :dedupe
64
47
 
65
48
  # Optional per-image processing, sent as deep-object query params such as
@@ -126,11 +109,7 @@ module ContextDev
126
109
  )
127
110
  ]
128
111
  ),
129
- dedupe:
130
- T.any(
131
- T::Boolean,
132
- ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
133
- ),
112
+ dedupe: T::Boolean,
134
113
  enrichment:
135
114
  T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash),
136
115
  headers: T::Hash[Symbol, String],
@@ -191,11 +170,7 @@ module ContextDev
191
170
  )
192
171
  ]
193
172
  ),
194
- dedupe:
195
- T.any(
196
- T::Boolean,
197
- ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
198
- ),
173
+ dedupe: T::Boolean,
199
174
  enrichment:
200
175
  T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment),
201
176
  headers: T::Hash[Symbol, String],
@@ -284,47 +259,6 @@ module ContextDev
284
259
  end
285
260
  end
286
261
 
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
-
328
262
  class Enrichment < ContextDev::Internal::Type::BaseModel
329
263
  OrHash =
330
264
  T.type_alias do
@@ -335,52 +269,18 @@ module ContextDev
335
269
  end
336
270
 
337
271
  # Classify each image by visual asset type.
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
272
+ sig { returns(T.nilable(T::Boolean)) }
348
273
  attr_reader :classification
349
274
 
350
- sig do
351
- params(
352
- classification:
353
- T.any(
354
- T::Boolean,
355
- ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol
356
- )
357
- ).void
358
- end
275
+ sig { params(classification: T::Boolean).void }
359
276
  attr_writer :classification
360
277
 
361
278
  # Host materializable images on the Brand.dev CDN and return their URL and MIME
362
279
  # type.
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
280
+ sig { returns(T.nilable(T::Boolean)) }
373
281
  attr_reader :hosted_url
374
282
 
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
283
+ sig { params(hosted_url: T::Boolean).void }
384
284
  attr_writer :hosted_url
385
285
 
386
286
  # Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
@@ -391,49 +291,20 @@ module ContextDev
391
291
  attr_writer :max_time_per_ms
392
292
 
393
293
  # Measure image width and height when possible.
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
294
+ sig { returns(T.nilable(T::Boolean)) }
404
295
  attr_reader :resolution
405
296
 
406
- sig do
407
- params(
408
- resolution:
409
- T.any(
410
- T::Boolean,
411
- ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
412
- )
413
- ).void
414
- end
297
+ sig { params(resolution: T::Boolean).void }
415
298
  attr_writer :resolution
416
299
 
417
300
  # Optional per-image processing, sent as deep-object query params such as
418
301
  # enrichment[resolution]=true.
419
302
  sig do
420
303
  params(
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
- ),
304
+ classification: T::Boolean,
305
+ hosted_url: T::Boolean,
431
306
  max_time_per_ms: Integer,
432
- resolution:
433
- T.any(
434
- T::Boolean,
435
- ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
436
- )
307
+ resolution: T::Boolean
437
308
  ).returns(T.attached_class)
438
309
  end
439
310
  def self.new(
@@ -452,157 +323,15 @@ module ContextDev
452
323
  sig do
453
324
  override.returns(
454
325
  {
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
- ),
326
+ classification: T::Boolean,
327
+ hosted_url: T::Boolean,
465
328
  max_time_per_ms: Integer,
466
- resolution:
467
- T.any(
468
- T::Boolean,
469
- ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol
470
- )
329
+ resolution: T::Boolean
471
330
  }
472
331
  )
473
332
  end
474
333
  def to_hash
475
334
  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
606
335
  end
607
336
  end
608
337
  end