context.dev 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +10 -0
  5. data/lib/context_dev/models/batch_delete_params.rb +22 -0
  6. data/lib/context_dev/models/batch_delete_response.rb +60 -0
  7. data/lib/context_dev/models/batch_get_results_response.rb +46 -4
  8. data/lib/context_dev/models/batch_list_response.rb +13 -4
  9. data/lib/context_dev/models/batch_retrieve_response.rb +13 -4
  10. data/lib/context_dev/models/batch_submit_params.rb +2080 -26
  11. data/lib/context_dev/models/batch_submit_response.rb +125 -531
  12. data/lib/context_dev/models/brand_retrieve_response.rb +50 -1
  13. data/lib/context_dev/models/brand_search_params.rb +41 -3
  14. data/lib/context_dev/models/brand_search_response.rb +3 -2
  15. data/lib/context_dev/models/crawl_controls.rb +21 -15
  16. data/lib/context_dev/models/news_search_params.rb +467 -0
  17. data/lib/context_dev/models/news_search_response.rb +238 -0
  18. data/lib/context_dev/models/parse_handle_params.rb +20 -147
  19. data/lib/context_dev/models/person_enrich_params.rb +176 -0
  20. data/lib/context_dev/models/person_enrich_response.rb +641 -0
  21. data/lib/context_dev/models/utility_prefetch_params.rb +19 -16
  22. data/lib/context_dev/models/utility_prefetch_response.rb +4 -5
  23. data/lib/context_dev/models/web_screenshot_params.rb +3 -30
  24. data/lib/context_dev/models/web_search_response.rb +1 -0
  25. data/lib/context_dev/models/web_web_crawl_md_params.rb +5 -4
  26. data/lib/context_dev/models/web_web_crawl_md_response.rb +30 -1
  27. data/lib/context_dev/models/web_web_scrape_html_params.rb +20 -156
  28. data/lib/context_dev/models/web_web_scrape_html_response.rb +30 -1
  29. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -124
  30. data/lib/context_dev/models/web_web_scrape_md_params.rb +40 -241
  31. data/lib/context_dev/models/web_web_scrape_md_response.rb +41 -2
  32. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +11 -1
  33. data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +3 -2
  34. data/lib/context_dev/models.rb +6 -0
  35. data/lib/context_dev/resources/batch.rb +33 -7
  36. data/lib/context_dev/resources/brand.rb +10 -10
  37. data/lib/context_dev/resources/news.rb +51 -0
  38. data/lib/context_dev/resources/parse.rb +5 -5
  39. data/lib/context_dev/resources/people.rb +56 -0
  40. data/lib/context_dev/resources/utility.rb +7 -6
  41. data/lib/context_dev/resources/web.rb +46 -24
  42. data/lib/context_dev/version.rb +1 -1
  43. data/lib/context_dev.rb +8 -0
  44. data/rbi/context_dev/client.rbi +8 -0
  45. data/rbi/context_dev/models/batch_delete_params.rbi +40 -0
  46. data/rbi/context_dev/models/batch_delete_response.rbi +116 -0
  47. data/rbi/context_dev/models/batch_get_results_response.rbi +85 -3
  48. data/rbi/context_dev/models/batch_list_response.rbi +24 -8
  49. data/rbi/context_dev/models/batch_retrieve_response.rbi +24 -8
  50. data/rbi/context_dev/models/batch_submit_params.rbi +6421 -44
  51. data/rbi/context_dev/models/batch_submit_response.rbi +184 -1151
  52. data/rbi/context_dev/models/brand_retrieve_response.rbi +152 -0
  53. data/rbi/context_dev/models/brand_search_params.rbi +71 -2
  54. data/rbi/context_dev/models/brand_search_response.rbi +4 -2
  55. data/rbi/context_dev/models/crawl_controls.rbi +22 -28
  56. data/rbi/context_dev/models/news_search_params.rbi +1294 -0
  57. data/rbi/context_dev/models/news_search_response.rbi +423 -0
  58. data/rbi/context_dev/models/parse_handle_params.rbi +30 -323
  59. data/rbi/context_dev/models/person_enrich_params.rbi +332 -0
  60. data/rbi/context_dev/models/person_enrich_response.rbi +1295 -0
  61. data/rbi/context_dev/models/utility_prefetch_params.rbi +24 -16
  62. data/rbi/context_dev/models/utility_prefetch_response.rbi +8 -6
  63. data/rbi/context_dev/models/web_screenshot_params.rbi +4 -71
  64. data/rbi/context_dev/models/web_search_response.rbi +5 -0
  65. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +8 -6
  66. data/rbi/context_dev/models/web_web_crawl_md_response.rbi +67 -0
  67. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +30 -363
  68. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +65 -0
  69. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +16 -287
  70. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +57 -558
  71. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +80 -0
  72. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +15 -0
  73. data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +4 -2
  74. data/rbi/context_dev/models.rbi +6 -0
  75. data/rbi/context_dev/resources/batch.rbi +32 -10
  76. data/rbi/context_dev/resources/brand.rbi +14 -8
  77. data/rbi/context_dev/resources/news.rbi +46 -0
  78. data/rbi/context_dev/resources/parse.rbi +10 -26
  79. data/rbi/context_dev/resources/people.rbi +47 -0
  80. data/rbi/context_dev/resources/utility.rbi +8 -6
  81. data/rbi/context_dev/resources/web.rbi +49 -66
  82. data/sig/context_dev/client.rbs +4 -0
  83. data/sig/context_dev/models/batch_delete_params.rbs +23 -0
  84. data/sig/context_dev/models/batch_delete_response.rbs +57 -0
  85. data/sig/context_dev/models/batch_get_results_response.rbs +30 -2
  86. data/sig/context_dev/models/batch_list_response.rbs +16 -2
  87. data/sig/context_dev/models/batch_retrieve_response.rbs +16 -2
  88. data/sig/context_dev/models/batch_submit_params.rbs +2666 -15
  89. data/sig/context_dev/models/batch_submit_response.rbs +78 -466
  90. data/sig/context_dev/models/brand_retrieve_response.rbs +62 -0
  91. data/sig/context_dev/models/brand_search_params.rbs +38 -1
  92. data/sig/context_dev/models/crawl_controls.rbs +16 -16
  93. data/sig/context_dev/models/news_search_params.rbs +532 -0
  94. data/sig/context_dev/models/news_search_response.rbs +206 -0
  95. data/sig/context_dev/models/parse_handle_params.rbs +25 -90
  96. data/sig/context_dev/models/person_enrich_params.rbs +199 -0
  97. data/sig/context_dev/models/person_enrich_response.rbs +638 -0
  98. data/sig/context_dev/models/utility_prefetch_params.rbs +2 -1
  99. data/sig/context_dev/models/utility_prefetch_response.rbs +2 -1
  100. data/sig/context_dev/models/web_screenshot_params.rbs +5 -18
  101. data/sig/context_dev/models/web_search_response.rbs +2 -0
  102. data/sig/context_dev/models/web_web_crawl_md_response.rbs +21 -0
  103. data/sig/context_dev/models/web_web_scrape_html_params.rbs +24 -94
  104. data/sig/context_dev/models/web_web_scrape_html_response.rbs +21 -0
  105. data/sig/context_dev/models/web_web_scrape_images_params.rbs +20 -72
  106. data/sig/context_dev/models/web_web_scrape_md_params.rbs +46 -148
  107. data/sig/context_dev/models/web_web_scrape_md_response.rbs +28 -0
  108. data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +7 -0
  109. data/sig/context_dev/models.rbs +6 -0
  110. data/sig/context_dev/resources/batch.rbs +8 -2
  111. data/sig/context_dev/resources/brand.rbs +3 -0
  112. data/sig/context_dev/resources/news.rbs +17 -0
  113. data/sig/context_dev/resources/parse.rbs +5 -5
  114. data/sig/context_dev/resources/people.rbs +19 -0
  115. data/sig/context_dev/resources/web.rbs +13 -11
  116. metadata +26 -2
@@ -67,27 +67,10 @@ module ContextDev
67
67
  attr_writer :headers
68
68
 
69
69
  # When true, iframes are rendered inline into the returned HTML.
70
- sig do
71
- returns(
72
- T.nilable(
73
- T.any(
74
- T::Boolean,
75
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol
76
- )
77
- )
78
- )
79
- end
70
+ sig { returns(T.nilable(T::Boolean)) }
80
71
  attr_reader :include_frames
81
72
 
82
- sig do
83
- params(
84
- include_frames:
85
- T.any(
86
- T::Boolean,
87
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol
88
- )
89
- ).void
90
- end
73
+ sig { params(include_frames: T::Boolean).void }
91
74
  attr_writer :include_frames
92
75
 
93
76
  # CSS selectors. When provided, only matching subtrees (and their descendants) are
@@ -113,27 +96,10 @@ module ContextDev
113
96
  # When true, waits briefly for CSS and transition animations to settle before
114
97
  # extracting HTML. Defaults to false. This adds a bit of latency in exchange for
115
98
  # more stable output on animated pages.
116
- sig do
117
- returns(
118
- T.nilable(
119
- T.any(
120
- T::Boolean,
121
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol
122
- )
123
- )
124
- )
125
- end
99
+ sig { returns(T.nilable(T::Boolean)) }
126
100
  attr_reader :settle_animations
127
101
 
128
- sig do
129
- params(
130
- settle_animations:
131
- T.any(
132
- T::Boolean,
133
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol
134
- )
135
- ).void
136
- end
102
+ sig { params(settle_animations: T::Boolean).void }
137
103
  attr_writer :settle_animations
138
104
 
139
105
  # Optional comma-separated caller-defined tags for tracking this request. Tags are
@@ -156,27 +122,10 @@ module ContextDev
156
122
 
157
123
  # When true, return only the page's main content in the HTML response, excluding
158
124
  # headers, footers, sidebars, and navigation when detectable.
159
- sig do
160
- returns(
161
- T.nilable(
162
- T.any(
163
- T::Boolean,
164
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol
165
- )
166
- )
167
- )
168
- end
125
+ sig { returns(T.nilable(T::Boolean)) }
169
126
  attr_reader :use_main_content_only
170
127
 
171
- sig do
172
- params(
173
- use_main_content_only:
174
- T.any(
175
- T::Boolean,
176
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol
177
- )
178
- ).void
179
- end
128
+ sig { params(use_main_content_only: T::Boolean).void }
180
129
  attr_writer :use_main_content_only
181
130
 
182
131
  # Optional browser wait time in milliseconds after initial page load. Min: 0. Max:
@@ -213,26 +162,14 @@ module ContextDev
213
162
  country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol,
214
163
  exclude_selectors: T.nilable(T::Array[String]),
215
164
  headers: T::Hash[Symbol, String],
216
- include_frames:
217
- T.any(
218
- T::Boolean,
219
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol
220
- ),
165
+ include_frames: T::Boolean,
221
166
  include_selectors: T.nilable(T::Array[String]),
222
167
  max_age_ms: T.nilable(Integer),
223
168
  pdf: ContextDev::WebWebScrapeHTMLParams::Pdf::OrHash,
224
- settle_animations:
225
- T.any(
226
- T::Boolean,
227
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol
228
- ),
169
+ settle_animations: T::Boolean,
229
170
  tags: T::Array[String],
230
171
  timeout_ms: Integer,
231
- use_main_content_only:
232
- T.any(
233
- T::Boolean,
234
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol
235
- ),
172
+ use_main_content_only: T::Boolean,
236
173
  wait_for_ms: T.nilable(Integer),
237
174
  zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol,
238
175
  request_options: ContextDev::RequestOptions::OrHash
@@ -312,26 +249,14 @@ module ContextDev
312
249
  country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol,
313
250
  exclude_selectors: T.nilable(T::Array[String]),
314
251
  headers: T::Hash[Symbol, String],
315
- include_frames:
316
- T.any(
317
- T::Boolean,
318
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol
319
- ),
252
+ include_frames: T::Boolean,
320
253
  include_selectors: T.nilable(T::Array[String]),
321
254
  max_age_ms: T.nilable(Integer),
322
255
  pdf: ContextDev::WebWebScrapeHTMLParams::Pdf,
323
- settle_animations:
324
- T.any(
325
- T::Boolean,
326
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol
327
- ),
256
+ settle_animations: T::Boolean,
328
257
  tags: T::Array[String],
329
258
  timeout_ms: Integer,
330
- use_main_content_only:
331
- T.any(
332
- T::Boolean,
333
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol
334
- ),
259
+ use_main_content_only: T::Boolean,
335
260
  wait_for_ms: T.nilable(Integer),
336
261
  zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol,
337
262
  request_options: ContextDev::RequestOptions
@@ -844,46 +769,6 @@ module ContextDev
844
769
  end
845
770
  end
846
771
 
847
- # When true, iframes are rendered inline into the returned HTML.
848
- module IncludeFrames
849
- extend ContextDev::Internal::Type::Union
850
-
851
- Variants =
852
- T.type_alias do
853
- T.any(
854
- T::Boolean,
855
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol
856
- )
857
- end
858
-
859
- sig do
860
- override.returns(
861
- T::Array[
862
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::Variants
863
- ]
864
- )
865
- end
866
- def self.variants
867
- end
868
-
869
- TaggedSymbol =
870
- T.type_alias do
871
- T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::IncludeFrames)
872
- end
873
- OrSymbol = T.type_alias { T.any(Symbol, String) }
874
-
875
- TRUE =
876
- T.let(
877
- :true,
878
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol
879
- )
880
- FALSE =
881
- T.let(
882
- :false,
883
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol
884
- )
885
- end
886
-
887
772
  class Pdf < ContextDev::Internal::Type::BaseModel
888
773
  OrHash =
889
774
  T.type_alias do
@@ -901,55 +786,22 @@ module ContextDev
901
786
  sig { params(end_: Integer).void }
902
787
  attr_writer :end_
903
788
 
904
- # When true, detect and OCR images embedded in the selected PDF pages, inserting
905
- # recognized text at each image's position in page reading order while preserving
906
- # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
907
- sig do
908
- returns(
909
- T.nilable(
910
- T.any(
911
- T::Boolean,
912
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol
913
- )
914
- )
915
- )
916
- end
789
+ # When true, OCR the selected PDF pages that have no usable text layer (scans),
790
+ # replacing each recovered page's text with the OCR result while pages with a real
791
+ # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
792
+ # of the base request cost. When false, no OCR runs.
793
+ sig { returns(T.nilable(T::Boolean)) }
917
794
  attr_reader :ocr
918
795
 
919
- sig do
920
- params(
921
- ocr:
922
- T.any(
923
- T::Boolean,
924
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol
925
- )
926
- ).void
927
- end
796
+ sig { params(ocr: T::Boolean).void }
928
797
  attr_writer :ocr
929
798
 
930
799
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
931
- # a 400 WEBSITE_ACCESS_ERROR is returned.
932
- sig do
933
- returns(
934
- T.nilable(
935
- T.any(
936
- T::Boolean,
937
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol
938
- )
939
- )
940
- )
941
- end
800
+ # a 400 PDF_SKIPPED is returned.
801
+ sig { returns(T.nilable(T::Boolean)) }
942
802
  attr_reader :should_parse
943
803
 
944
- sig do
945
- params(
946
- should_parse:
947
- T.any(
948
- T::Boolean,
949
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol
950
- )
951
- ).void
952
- end
804
+ sig { params(should_parse: T::Boolean).void }
953
805
  attr_writer :should_parse
954
806
 
955
807
  # First 1-based PDF page to parse. When omitted, parsing starts at the first page.
@@ -964,16 +816,8 @@ module ContextDev
964
816
  sig do
965
817
  params(
966
818
  end_: Integer,
967
- ocr:
968
- T.any(
969
- T::Boolean,
970
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol
971
- ),
972
- should_parse:
973
- T.any(
974
- T::Boolean,
975
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol
976
- ),
819
+ ocr: T::Boolean,
820
+ should_parse: T::Boolean,
977
821
  start: Integer
978
822
  ).returns(T.attached_class)
979
823
  end
@@ -981,12 +825,13 @@ module ContextDev
981
825
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
982
826
  # Must be greater than or equal to start when both are provided.
983
827
  end_: nil,
984
- # When true, detect and OCR images embedded in the selected PDF pages, inserting
985
- # recognized text at each image's position in page reading order while preserving
986
- # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
828
+ # When true, OCR the selected PDF pages that have no usable text layer (scans),
829
+ # replacing each recovered page's text with the OCR result while pages with a real
830
+ # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
831
+ # of the base request cost. When false, no OCR runs.
987
832
  ocr: nil,
988
833
  # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
989
- # a 400 WEBSITE_ACCESS_ERROR is returned.
834
+ # a 400 PDF_SKIPPED is returned.
990
835
  should_parse: nil,
991
836
  # First 1-based PDF page to parse. When omitted, parsing starts at the first page.
992
837
  start: nil
@@ -997,192 +842,14 @@ module ContextDev
997
842
  override.returns(
998
843
  {
999
844
  end_: Integer,
1000
- ocr:
1001
- T.any(
1002
- T::Boolean,
1003
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol
1004
- ),
1005
- should_parse:
1006
- T.any(
1007
- T::Boolean,
1008
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol
1009
- ),
845
+ ocr: T::Boolean,
846
+ should_parse: T::Boolean,
1010
847
  start: Integer
1011
848
  }
1012
849
  )
1013
850
  end
1014
851
  def to_hash
1015
852
  end
1016
-
1017
- # When true, detect and OCR images embedded in the selected PDF pages, inserting
1018
- # recognized text at each image's position in page reading order while preserving
1019
- # the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
1020
- module Ocr
1021
- extend ContextDev::Internal::Type::Union
1022
-
1023
- Variants =
1024
- T.type_alias do
1025
- T.any(
1026
- T::Boolean,
1027
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol
1028
- )
1029
- end
1030
-
1031
- sig do
1032
- override.returns(
1033
- T::Array[ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::Variants]
1034
- )
1035
- end
1036
- def self.variants
1037
- end
1038
-
1039
- TaggedSymbol =
1040
- T.type_alias do
1041
- T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr)
1042
- end
1043
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1044
-
1045
- TRUE =
1046
- T.let(
1047
- :true,
1048
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol
1049
- )
1050
- FALSE =
1051
- T.let(
1052
- :false,
1053
- ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol
1054
- )
1055
- end
1056
-
1057
- # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
1058
- # a 400 WEBSITE_ACCESS_ERROR is returned.
1059
- module ShouldParse
1060
- extend ContextDev::Internal::Type::Union
1061
-
1062
- Variants =
1063
- T.type_alias do
1064
- T.any(
1065
- T::Boolean,
1066
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol
1067
- )
1068
- end
1069
-
1070
- sig do
1071
- override.returns(
1072
- T::Array[
1073
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::Variants
1074
- ]
1075
- )
1076
- end
1077
- def self.variants
1078
- end
1079
-
1080
- TaggedSymbol =
1081
- T.type_alias do
1082
- T.all(
1083
- Symbol,
1084
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse
1085
- )
1086
- end
1087
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1088
-
1089
- TRUE =
1090
- T.let(
1091
- :true,
1092
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol
1093
- )
1094
- FALSE =
1095
- T.let(
1096
- :false,
1097
- ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol
1098
- )
1099
- end
1100
- end
1101
-
1102
- # When true, waits briefly for CSS and transition animations to settle before
1103
- # extracting HTML. Defaults to false. This adds a bit of latency in exchange for
1104
- # more stable output on animated pages.
1105
- module SettleAnimations
1106
- extend ContextDev::Internal::Type::Union
1107
-
1108
- Variants =
1109
- T.type_alias do
1110
- T.any(
1111
- T::Boolean,
1112
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol
1113
- )
1114
- end
1115
-
1116
- sig do
1117
- override.returns(
1118
- T::Array[
1119
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::Variants
1120
- ]
1121
- )
1122
- end
1123
- def self.variants
1124
- end
1125
-
1126
- TaggedSymbol =
1127
- T.type_alias do
1128
- T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::SettleAnimations)
1129
- end
1130
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1131
-
1132
- TRUE =
1133
- T.let(
1134
- :true,
1135
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol
1136
- )
1137
- FALSE =
1138
- T.let(
1139
- :false,
1140
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol
1141
- )
1142
- end
1143
-
1144
- # When true, return only the page's main content in the HTML response, excluding
1145
- # headers, footers, sidebars, and navigation when detectable.
1146
- module UseMainContentOnly
1147
- extend ContextDev::Internal::Type::Union
1148
-
1149
- Variants =
1150
- T.type_alias do
1151
- T.any(
1152
- T::Boolean,
1153
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol
1154
- )
1155
- end
1156
-
1157
- sig do
1158
- override.returns(
1159
- T::Array[
1160
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::Variants
1161
- ]
1162
- )
1163
- end
1164
- def self.variants
1165
- end
1166
-
1167
- TaggedSymbol =
1168
- T.type_alias do
1169
- T.all(
1170
- Symbol,
1171
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly
1172
- )
1173
- end
1174
- OrSymbol = T.type_alias { T.any(Symbol, String) }
1175
-
1176
- TRUE =
1177
- T.let(
1178
- :true,
1179
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol
1180
- )
1181
- FALSE =
1182
- T.let(
1183
- :false,
1184
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol
1185
- )
1186
853
  end
1187
854
 
1188
855
  # Set to enabled to bypass shared caches and omit request and response content
@@ -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