diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 427b8ec4..21f60560 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.9.0" + ".": "2.10.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 97db86d5..4b9b1cb6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml -openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7 -config_hash: 920678668dd2da6f8966fbf1b8fde4e2 +configured_endpoints: 41 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5dbe631ce516ca688273053ddcb58870561bd6dc76fa75df354c954d7af65a3c.yml +openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 +config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a4a196..90d61047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 2.10.0 (2026-08-17) + +Full Changelog: [v2.9.0...v2.10.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.9.0...v2.10.0) + +### Features + +* **api:** api update ([6f90ebf](https://github.com/context-dot-dev/context-ruby-sdk/commit/6f90ebff6164a8daf2f6c4bf8d1492ade1ad2779)) +* **api:** api update ([95cbdde](https://github.com/context-dot-dev/context-ruby-sdk/commit/95cbddeb3a3351a03c394709dfeaf3fb5c98be92)) +* **api:** api update ([97520df](https://github.com/context-dot-dev/context-ruby-sdk/commit/97520df52a798122460e2f219d7b582d2f6830da)) +* **api:** api update ([2b73772](https://github.com/context-dot-dev/context-ruby-sdk/commit/2b737722e962cf7a5aba20a2b596d379f7f2bce0)) +* **api:** api update ([630b415](https://github.com/context-dot-dev/context-ruby-sdk/commit/630b4156f12004d2da154e26003271cd143ccbb8)) +* **api:** manual updates ([54ad450](https://github.com/context-dot-dev/context-ruby-sdk/commit/54ad450f892542378cec0ce5430d1436e1437a4d)) + ## 2.9.0 (2026-08-07) Full Changelog: [v2.8.0...v2.9.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.8.0...v2.9.0) diff --git a/Gemfile.lock b/Gemfile.lock index b2f0af62..972db589 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - context.dev (2.9.0) + context.dev (2.10.0) cgi connection_pool diff --git a/README.md b/README.md index 9d5a3231..c99d02dc 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "context.dev", "~> 2.9.0" +gem "context.dev", "~> 2.10.0" ``` diff --git a/lib/context_dev.rb b/lib/context_dev.rb index 6cf448d3..be6297f1 100644 --- a/lib/context_dev.rb +++ b/lib/context_dev.rb @@ -107,6 +107,8 @@ require_relative "context_dev/models/monitor_run_response" require_relative "context_dev/models/monitor_update_params" require_relative "context_dev/models/monitor_update_response" +require_relative "context_dev/models/news_search_params" +require_relative "context_dev/models/news_search_response" require_relative "context_dev/models/page_error_count" require_relative "context_dev/models/parse_handle_params" require_relative "context_dev/models/parse_handle_response" @@ -143,6 +145,7 @@ require_relative "context_dev/resources/brand" require_relative "context_dev/resources/industry" require_relative "context_dev/resources/monitors" +require_relative "context_dev/resources/news" require_relative "context_dev/resources/parse" require_relative "context_dev/resources/people" require_relative "context_dev/resources/utility" diff --git a/lib/context_dev/client.rb b/lib/context_dev/client.rb index 081517ab..05e4d834 100644 --- a/lib/context_dev/client.rb +++ b/lib/context_dev/client.rb @@ -50,6 +50,10 @@ class Client < ContextDev::Internal::Transport::BaseClient # @return [ContextDev::Resources::People] attr_reader :people + # Search live first-party RSS and free historical news data by company identity. + # @return [ContextDev::Resources::News] + attr_reader :news + # @api private # # @return [Hash{String=>String}] @@ -120,6 +124,7 @@ def initialize( @monitors = ContextDev::Resources::Monitors.new(client: self) @batch = ContextDev::Resources::Batch.new(client: self) @people = ContextDev::Resources::People.new(client: self) + @news = ContextDev::Resources::News.new(client: self) end end end diff --git a/lib/context_dev/models.rb b/lib/context_dev/models.rb index b5162325..0323acda 100644 --- a/lib/context_dev/models.rb +++ b/lib/context_dev/models.rb @@ -97,6 +97,8 @@ module ContextDev MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams + NewsSearchParams = ContextDev::Models::NewsSearchParams + PageErrorCount = ContextDev::Models::PageErrorCount ParseHandleParams = ContextDev::Models::ParseHandleParams diff --git a/lib/context_dev/models/batch_get_results_response.rb b/lib/context_dev/models/batch_get_results_response.rb index fffb4d9d..8e24062b 100644 --- a/lib/context_dev/models/batch_get_results_response.rb +++ b/lib/context_dev/models/batch_get_results_response.rb @@ -86,7 +86,8 @@ class Ok < ContextDev::Internal::Type::BaseModel required :url, String # @!attribute html - # Raw page HTML. Present on html batches. + # Page HTML. Present on html batches, and on markdown batches submitted with + # `options.includeHTML`. # # @return [String, nil] optional :html, String @@ -130,7 +131,7 @@ class Ok < ContextDev::Internal::Type::BaseModel # # @param url [String] URL as submitted, or as discovered by the crawl. # - # @param html [String] Raw page HTML. Present on html batches. + # @param html [String] Page HTML. Present on html batches, and on markdown batches submitted with `opti # # @param item_id [String] Caller-supplied identifier echoed from submission. # @@ -196,6 +197,14 @@ class Metadata < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :favicon, String + # @!attribute headings + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + # + # @return [Array, nil] + optional :headings, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading] } + # @!attribute image # Primary resolved preview image from Open Graph, Twitter, or image metadata. # @@ -267,7 +276,7 @@ class Metadata < ContextDev::Internal::Type::BaseModel optional :twitter, -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter] } - # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) + # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, headings: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata} for more # details. @@ -290,6 +299,8 @@ class Metadata < ContextDev::Internal::Type::BaseModel # # @param favicon [String] Resolved favicon URL, when present. # + # @param headings [Array] Page headings (h1–h6) in document order, extracted from the unfiltered document. + # # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata. # # @param json_ld [ArrayObject}>] JSON-LD structured data blocks parsed from the page. @@ -361,6 +372,25 @@ class Alternate < ContextDev::Internal::Type::BaseModel # @param type [String] Alternate resource MIME type, when present. end + class Heading < ContextDev::Internal::Type::BaseModel + # @!attribute level + # Heading level, 1–6 (from h1–h6). + # + # @return [Integer] + required :level, Integer + + # @!attribute text + # Heading text with whitespace collapsed, truncated to 1000 characters. + # + # @return [String] + required :text, String + + # @!method initialize(level:, text:) + # @param level [Integer] Heading level, 1–6 (from h1–h6). + # + # @param text [String] Heading text with whitespace collapsed, truncated to 1000 characters. + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/lib/context_dev/models/batch_submit_params.rb b/lib/context_dev/models/batch_submit_params.rb index 5e25f252..78457cda 100644 --- a/lib/context_dev/models/batch_submit_params.rb +++ b/lib/context_dev/models/batch_submit_params.rb @@ -175,6 +175,13 @@ class Options < ContextDev::Internal::Type::BaseModel api_name: :excludeSelectors, nil?: true + # @!attribute include_html + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + # + # @return [Boolean, nil] + optional :include_html, ContextDev::Internal::Type::Boolean, api_name: :includeHTML + # @!attribute include_images # Include image references in the Markdown. # @@ -241,7 +248,7 @@ class Options < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :wait_for_ms, Integer, api_name: :waitForMs - # @!method initialize(country: nil, exclude_selectors: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, use_main_content_only: nil, wait_for_ms: nil) + # @!method initialize(country: nil, exclude_selectors: nil, include_html: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, use_main_content_only: nil, wait_for_ms: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options} # for more details. @@ -252,6 +259,8 @@ class Options < ContextDev::Internal::Type::BaseModel # # @param exclude_selectors [Array, nil] Remove elements matching these CSS selectors. Applied after `includeSelectors`, # + # @param include_html [Boolean] Also include each page's HTML in its result record, as an `html` field alongside + # # @param include_images [Boolean] Include image references in the Markdown. # # @param include_links [Boolean] Include links in the Markdown. @@ -501,20 +510,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr, nil] - optional :ocr, - union: -> { ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse - }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -532,79 +536,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end end end end @@ -991,19 +927,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr, nil] - optional :ocr, union: -> { ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse - }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -1021,79 +953,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end end end end @@ -1333,6 +1197,13 @@ class Options < ContextDev::Internal::Type::BaseModel api_name: :excludeSelectors, nil?: true + # @!attribute include_html + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + # + # @return [Boolean, nil] + optional :include_html, ContextDev::Internal::Type::Boolean, api_name: :includeHTML + # @!attribute include_images # Include image references in the Markdown. # @@ -1399,7 +1270,7 @@ class Options < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :wait_for_ms, Integer, api_name: :waitForMs - # @!method initialize(country: nil, exclude_selectors: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, use_main_content_only: nil, wait_for_ms: nil) + # @!method initialize(country: nil, exclude_selectors: nil, include_html: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, use_main_content_only: nil, wait_for_ms: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options} # for more details. @@ -1410,6 +1281,8 @@ class Options < ContextDev::Internal::Type::BaseModel # # @param exclude_selectors [Array, nil] Remove elements matching these CSS selectors. Applied after `includeSelectors`, # + # @param include_html [Boolean] Also include each page's HTML in its result record, as an `html` field alongside + # # @param include_images [Boolean] Include image references in the Markdown. # # @param include_links [Boolean] Include links in the Markdown. @@ -1659,20 +1532,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr, nil] - optional :ocr, - union: -> { ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse - }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -1690,79 +1558,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end end end end @@ -2262,19 +2062,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr, nil] - optional :ocr, union: -> { ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse - }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -2292,79 +2088,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end end end end diff --git a/lib/context_dev/models/brand_search_params.rb b/lib/context_dev/models/brand_search_params.rb index 11842a54..f211e926 100644 --- a/lib/context_dev/models/brand_search_params.rb +++ b/lib/context_dev/models/brand_search_params.rb @@ -8,12 +8,27 @@ class BrandSearchParams < ContextDev::Internal::Type::BaseModel include ContextDev::Internal::Type::RequestParameters # @!attribute query - # Search term, matched against brand names and domains by prefix (e.g. 'nike', + # Search term, matched against the fields selected by queryBy (e.g. 'nike', # 'nike.com', 'nik'). # # @return [String] required :query, String + # @!attribute autocomplete + # Whether the search term matches by prefix, so partial words match as they are + # typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + # + # @return [Boolean, nil] + optional :autocomplete, ContextDev::Internal::Type::Boolean + + # @!attribute query_by + # Fields to match the search term against, as a comma-separated list or repeated + # parameter: 'name', 'domain', or both. Defaults to both. + # + # @return [Array, nil] + optional :query_by, + -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::BrandSearchParams::QueryBy] } + # @!attribute tags # Optional comma-separated caller-defined tags for tracking this request. Tags are # recorded on the request's usage log and can be used to filter usage on the @@ -22,15 +37,38 @@ class BrandSearchParams < ContextDev::Internal::Type::BaseModel # @return [Array, nil] optional :tags, ContextDev::Internal::Type::ArrayOf[String] - # @!method initialize(query:, tags: nil, request_options: {}) + # @!attribute typo_tolerance + # Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # typo tolerance). + # + # @return [Integer, nil] + optional :typo_tolerance, Integer + + # @!method initialize(query:, autocomplete: nil, query_by: nil, tags: nil, typo_tolerance: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::BrandSearchParams} for more details. # - # @param query [String] Search term, matched against brand names and domains by prefix (e.g. 'nike', 'ni + # @param query [String] Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike. + # + # @param autocomplete [Boolean] Whether the search term matches by prefix, so partial words match as they are ty + # + # @param query_by [Array] Fields to match the search term against, as a comma-separated list or repeated p # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # + # @param typo_tolerance [Integer] Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + + module QueryBy + extend ContextDev::Internal::Type::Enum + + NAME = :name + DOMAIN = :domain + + # @!method self.values + # @return [Array] + end end end end diff --git a/lib/context_dev/models/news_search_params.rb b/lib/context_dev/models/news_search_params.rb new file mode 100644 index 00000000..43636c24 --- /dev/null +++ b/lib/context_dev/models/news_search_params.rb @@ -0,0 +1,467 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::News#search + class NewsSearchParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute search_by + # What to search for. + # + # @return [ContextDev::Models::NewsSearchParams::SearchBy] + required :search_by, -> { ContextDev::NewsSearchParams::SearchBy }, api_name: :searchBy + + # @!attribute cursor + # Opaque next_cursor from the previous response, or null for the first page. + # + # @return [String, nil] + optional :cursor, String, nil?: true + + # @!attribute filter_by + # Optional result filters. + # + # @return [ContextDev::Models::NewsSearchParams::FilterBy, nil] + optional :filter_by, -> { ContextDev::NewsSearchParams::FilterBy }, api_name: :filterBy + + # @!attribute limit + # Maximum results to return. Defaults to 10. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute sort_by + # Result ordering. Defaults to newest. + # + # @return [ContextDev::Models::NewsSearchParams::SortBy, nil] + optional :sort_by, -> { ContextDev::NewsSearchParams::SortBy }, api_name: :sortBy + + # @!attribute tags + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(search_by:, cursor: nil, filter_by: nil, limit: nil, sort_by: nil, tags: nil, request_options: {}) + # @param search_by [ContextDev::Models::NewsSearchParams::SearchBy] What to search for. + # + # @param cursor [String, nil] Opaque next_cursor from the previous response, or null for the first page. + # + # @param filter_by [ContextDev::Models::NewsSearchParams::FilterBy] Optional result filters. + # + # @param limit [Integer] Maximum results to return. Defaults to 10. + # + # @param sort_by [ContextDev::Models::NewsSearchParams::SortBy] Result ordering. Defaults to newest. + # + # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + + class SearchBy < ContextDev::Internal::Type::BaseModel + # @!attribute entity + # The company to search news for, identified by name, domain, ticker, or ISIN. + # + # @return [ContextDev::Models::NewsSearchParams::SearchBy::Entity::Name, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Domain, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Isin] + required :entity, union: -> { ContextDev::NewsSearchParams::SearchBy::Entity } + + # @!attribute type + # How to search. Only entity search is supported. + # + # @return [Symbol, ContextDev::Models::NewsSearchParams::SearchBy::Type] + required :type, enum: -> { ContextDev::NewsSearchParams::SearchBy::Type } + + # @!method initialize(entity:, type:) + # What to search for. + # + # @param entity [ContextDev::Models::NewsSearchParams::SearchBy::Entity::Name, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Domain, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Isin] The company to search news for, identified by name, domain, ticker, or ISIN. + # + # @param type [Symbol, ContextDev::Models::NewsSearchParams::SearchBy::Type] How to search. Only entity search is supported. + + # The company to search news for, identified by name, domain, ticker, or ISIN. + # + # @see ContextDev::Models::NewsSearchParams::SearchBy#entity + module Entity + extend ContextDev::Internal::Type::Union + + discriminator :type + + # Identify the company by name. + variant :name, -> { ContextDev::NewsSearchParams::SearchBy::Entity::Name } + + # Identify the company by website domain. + variant :domain, -> { ContextDev::NewsSearchParams::SearchBy::Entity::Domain } + + # Identify the company by stock ticker, optionally scoped to an exchange. + variant :ticker, -> { ContextDev::NewsSearchParams::SearchBy::Entity::Ticker } + + # Identify the company by International Securities Identification Number. + variant :isin, -> { ContextDev::NewsSearchParams::SearchBy::Entity::Isin } + + class Name < ContextDev::Internal::Type::BaseModel + # @!attribute name + # Company name. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :name] + required :type, const: :name + + # @!method initialize(name:, type: :name) + # Identify the company by name. + # + # @param name [String] Company name. + # + # @param type [Symbol, :name] + end + + class Domain < ContextDev::Internal::Type::BaseModel + # @!attribute domain + # Company website domain, such as apple.com. + # + # @return [String] + required :domain, String + + # @!attribute type + # + # @return [Symbol, :domain] + required :type, const: :domain + + # @!method initialize(domain:, type: :domain) + # Identify the company by website domain. + # + # @param domain [String] Company website domain, such as apple.com. + # + # @param type [Symbol, :domain] + end + + class Ticker < ContextDev::Internal::Type::BaseModel + # @!attribute ticker + # Public-company ticker. + # + # @return [String] + required :ticker, String + + # @!attribute type + # + # @return [Symbol, :ticker] + required :type, const: :ticker + + # @!attribute exchange + # Stock exchange the ticker trades on, used to disambiguate tickers listed on + # multiple exchanges. + # + # @return [Symbol, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::Exchange, nil] + optional :exchange, enum: -> { ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange } + + # @!method initialize(ticker:, exchange: nil, type: :ticker) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker} for more + # details. + # + # Identify the company by stock ticker, optionally scoped to an exchange. + # + # @param ticker [String] Public-company ticker. + # + # @param exchange [Symbol, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::Exchange] Stock exchange the ticker trades on, used to disambiguate tickers listed on mult + # + # @param type [Symbol, :ticker] + + # Stock exchange the ticker trades on, used to disambiguate tickers listed on + # multiple exchanges. + # + # @see ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker#exchange + module Exchange + extend ContextDev::Internal::Type::Enum + + AMEX = :AMEX + AMS = :AMS + AQS = :AQS + ASX = :ASX + ATH = :ATH + BER = :BER + BME = :BME + BRU = :BRU + BSE = :BSE + BUD = :BUD + BUE = :BUE + BVC = :BVC + CBOE = :CBOE + CNQ = :CNQ + CPH = :CPH + DFM = :DFM + DOH = :DOH + DUB = :DUB + DUS = :DUS + DXE = :DXE + EGX = :EGX + FSX = :FSX + HAM = :HAM + HEL = :HEL + HKSE = :HKSE + HOSE = :HOSE + ICE = :ICE + IOB = :IOB + IST = :IST + JKT = :JKT + JNB = :JNB + JPX = :JPX + KLS = :KLS + KOE = :KOE + KSC = :KSC + KUW = :KUW + LIS = :LIS + LSE = :LSE + MCX = :MCX + MEX = :MEX + MIL = :MIL + MUN = :MUN + NASDAQ = :NASDAQ + NEO = :NEO + NSE = :NSE + NYSE = :NYSE + NZE = :NZE + OSL = :OSL + OTC = :OTC + PAR = :PAR + PNK = :PNK + PRA = :PRA + RIS = :RIS + SAO = :SAO + SAU = :SAU + SES = :SES + SET = :SET + SGO = :SGO + SHH = :SHH + SHZ = :SHZ + SIX = :SIX + STO = :STO + STU = :STU + TAI = :TAI + TAL = :TAL + TLV = :TLV + TSX = :TSX + TSXV = :TSXV + TWO = :TWO + VIE = :VIE + WSE = :WSE + XETRA = :XETRA + + # @!method self.values + # @return [Array] + end + end + + class Isin < ContextDev::Internal::Type::BaseModel + # @!attribute isin + # International Securities Identification Number. + # + # @return [String] + required :isin, String + + # @!attribute type + # + # @return [Symbol, :isin] + required :type, const: :isin + + # @!method initialize(isin:, type: :isin) + # Identify the company by International Securities Identification Number. + # + # @param isin [String] International Securities Identification Number. + # + # @param type [Symbol, :isin] + end + + # @!method self.variants + # @return [Array(ContextDev::Models::NewsSearchParams::SearchBy::Entity::Name, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Domain, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker, ContextDev::Models::NewsSearchParams::SearchBy::Entity::Isin)] + end + + # How to search. Only entity search is supported. + # + # @see ContextDev::Models::NewsSearchParams::SearchBy#type + module Type + extend ContextDev::Internal::Type::Enum + + ENTITY = :entity + + # @!method self.values + # @return [Array] + end + end + + class FilterBy < ContextDev::Internal::Type::BaseModel + # @!attribute article_language + # Article languages to include. Up to 3. + # + # @return [Array, nil] + optional :article_language, + -> { + ContextDev::Internal::Type::ArrayOf[enum: ContextDev::NewsSearchParams::FilterBy::ArticleLanguage] + }, + api_name: :articleLanguage + + # @!attribute article_type + # Article types to include. Up to 3. + # + # @return [Array, nil] + optional :article_type, + -> { + ContextDev::Internal::Type::ArrayOf[enum: ContextDev::NewsSearchParams::FilterBy::ArticleType] + }, + api_name: :articleType + + # @!attribute date + # Published-at window in epoch milliseconds. + # + # @return [ContextDev::Models::NewsSearchParams::FilterBy::Date, nil] + optional :date, -> { ContextDev::NewsSearchParams::FilterBy::Date } + + # @!attribute source_country + # Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + # + # @return [Array, nil] + optional :source_country, + -> { + ContextDev::Internal::Type::ArrayOf[enum: ContextDev::NewsSearchParams::FilterBy::SourceCountry] + }, + api_name: :sourceCountry + + # @!attribute source_domain + # Publisher domains to include. Up to 3. + # + # @return [Array, nil] + optional :source_domain, ContextDev::Internal::Type::ArrayOf[String], api_name: :sourceDomain + + # @!method initialize(article_language: nil, article_type: nil, date: nil, source_country: nil, source_domain: nil) + # Optional result filters. + # + # @param article_language [Array] Article languages to include. Up to 3. + # + # @param article_type [Array] Article types to include. Up to 3. + # + # @param date [ContextDev::Models::NewsSearchParams::FilterBy::Date] Published-at window in epoch milliseconds. + # + # @param source_country [Array] Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + # + # @param source_domain [Array] Publisher domains to include. Up to 3. + + module ArticleLanguage + extend ContextDev::Internal::Type::Enum + + AR = :ar + DE = :de + EN = :en + ES = :es + FR = :fr + HI = :hi + IT = :it + JA = :ja + KO = :ko + NL = :nl + PT = :pt + RU = :ru + ZH = :zh + + # @!method self.values + # @return [Array] + end + + module ArticleType + extend ContextDev::Internal::Type::Enum + + EDITORIAL = :editorial + PRESS_RELEASE = :press_release + REGULATORY_FILING = :regulatory_filing + ADVISORY = :advisory + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::NewsSearchParams::FilterBy#date + class Date < ContextDev::Internal::Type::BaseModel + # @!attribute from + # Inclusive start of the published-at window, in epoch milliseconds. + # + # @return [Integer, nil] + optional :from, Integer + + # @!attribute to + # Inclusive end of the published-at window, in epoch milliseconds. + # + # @return [Integer, nil] + optional :to, Integer + + # @!method initialize(from: nil, to: nil) + # Published-at window in epoch milliseconds. + # + # @param from [Integer] Inclusive start of the published-at window, in epoch milliseconds. + # + # @param to [Integer] Inclusive end of the published-at window, in epoch milliseconds. + end + + module SourceCountry + extend ContextDev::Internal::Type::Enum + + AE = :ae + AR = :ar + AU = :au + CA = :ca + CG = :cg + CH = :ch + CL = :cl + DE = :de + FI = :fi + FR = :fr + GB = :gb + HK = :hk + IL = :il + IN = :in + JP = :jp + KR = :kr + MX = :mx + NG = :ng + NL = :nl + QA = :qa + SA = :sa + SE = :se + SG = :sg + US = :us + ZA = :za + + # @!method self.values + # @return [Array] + end + end + + class SortBy < ContextDev::Internal::Type::BaseModel + # @!attribute type + # Result ordering. + # + # @return [Symbol, ContextDev::Models::NewsSearchParams::SortBy::Type] + required :type, enum: -> { ContextDev::NewsSearchParams::SortBy::Type } + + # @!method initialize(type:) + # Result ordering. Defaults to newest. + # + # @param type [Symbol, ContextDev::Models::NewsSearchParams::SortBy::Type] Result ordering. + + # Result ordering. + # + # @see ContextDev::Models::NewsSearchParams::SortBy#type + module Type + extend ContextDev::Internal::Type::Enum + + RELEVANCE = :relevance + NEWEST = :newest + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/context_dev/models/news_search_response.rb b/lib/context_dev/models/news_search_response.rb new file mode 100644 index 00000000..0c4ee02b --- /dev/null +++ b/lib/context_dev/models/news_search_response.rb @@ -0,0 +1,238 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::News#search + class NewsSearchResponse < ContextDev::Internal::Type::BaseModel + # @!attribute data + # + # @return [Array] + required :data, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::NewsSearchResponse::Data] } + + # @!attribute has_more + # + # @return [Boolean] + required :has_more, ContextDev::Internal::Type::Boolean + + # @!attribute meta + # + # @return [ContextDev::Models::NewsSearchResponse::Meta] + required :meta, -> { ContextDev::Models::NewsSearchResponse::Meta } + + # @!attribute next_cursor + # + # @return [String, nil] + required :next_cursor, String, nil?: true + + # @!attribute key_metadata + # Metadata about the API key used for the request. Included in every response + # whenever a valid API key is provided, even when the response status is not 200. + # + # @return [ContextDev::Models::NewsSearchResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::NewsSearchResponse::KeyMetadata } + + # @!method initialize(data:, has_more:, meta:, next_cursor:, key_metadata: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::NewsSearchResponse} for more details. + # + # @param data [Array] + # + # @param has_more [Boolean] + # + # @param meta [ContextDev::Models::NewsSearchResponse::Meta] + # + # @param next_cursor [String, nil] + # + # @param key_metadata [ContextDev::Models::NewsSearchResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when + + class Data < ContextDev::Internal::Type::BaseModel + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute authors + # + # @return [Array] + required :authors, ContextDev::Internal::Type::ArrayOf[String] + + # @!attribute description + # + # @return [String, nil] + required :description, String, nil?: true + + # @!attribute image_url + # + # @return [String, nil] + required :image_url, String, nil?: true + + # @!attribute language + # + # @return [String, nil] + required :language, String, nil?: true + + # @!attribute match + # + # @return [ContextDev::Models::NewsSearchResponse::Data::Match] + required :match, -> { ContextDev::Models::NewsSearchResponse::Data::Match } + + # @!attribute published_at + # + # @return [Time, nil] + required :published_at, Time, nil?: true + + # @!attribute source + # + # @return [ContextDev::Models::NewsSearchResponse::Data::Source] + required :source, -> { ContextDev::Models::NewsSearchResponse::Data::Source } + + # @!attribute story_id + # Groups matching normalized headlines published on the same UTC day. + # + # @return [String] + required :story_id, String + + # @!attribute title + # + # @return [String] + required :title, String + + # @!attribute type + # + # @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type] + required :type, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Type } + + # @!attribute url + # + # @return [String] + required :url, String + + # @!method initialize(id:, authors:, description:, image_url:, language:, match:, published_at:, source:, story_id:, title:, type:, url:) + # @param id [String] + # + # @param authors [Array] + # + # @param description [String, nil] + # + # @param image_url [String, nil] + # + # @param language [String, nil] + # + # @param match [ContextDev::Models::NewsSearchResponse::Data::Match] + # + # @param published_at [Time, nil] + # + # @param source [ContextDev::Models::NewsSearchResponse::Data::Source] + # + # @param story_id [String] Groups matching normalized headlines published on the same UTC day. + # + # @param title [String] + # + # @param type [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type] + # + # @param url [String] + + # @see ContextDev::Models::NewsSearchResponse::Data#match + class Match < ContextDev::Internal::Type::BaseModel + # @!attribute confidence + # + # @return [Float, nil] + required :confidence, Float, nil?: true + + # @!attribute level + # + # @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level] + required :level, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Match::Level } + + # @!method initialize(confidence:, level:) + # @param confidence [Float, nil] + # @param level [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level] + + # @see ContextDev::Models::NewsSearchResponse::Data::Match#level + module Level + extend ContextDev::Internal::Type::Enum + + PRIMARY = :primary + SECONDARY = :secondary + + # @!method self.values + # @return [Array] + end + end + + # @see ContextDev::Models::NewsSearchResponse::Data#source + class Source < ContextDev::Internal::Type::BaseModel + # @!attribute direct + # True when Context observed this article in the publisher-owned feed. + # + # @return [Boolean] + required :direct, ContextDev::Internal::Type::Boolean + + # @!attribute domain + # + # @return [String] + required :domain, String + + # @!attribute name + # + # @return [String] + required :name, String + + # @!method initialize(direct:, domain:, name:) + # @param direct [Boolean] True when Context observed this article in the publisher-owned feed. + # + # @param domain [String] + # + # @param name [String] + end + + # @see ContextDev::Models::NewsSearchResponse::Data#type + module Type + extend ContextDev::Internal::Type::Enum + + EDITORIAL = :editorial + PRESS_RELEASE = :press_release + REGULATORY_FILING = :regulatory_filing + ADVISORY = :advisory + + # @!method self.values + # @return [Array] + end + end + + # @see ContextDev::Models::NewsSearchResponse#meta + class Meta < ContextDev::Internal::Type::BaseModel + # @!attribute count + # + # @return [Integer] + required :count, Integer + + # @!method initialize(count:) + # @param count [Integer] + end + + # @see ContextDev::Models::NewsSearchResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # Metadata about the API key used for the request. Included in every response + # whenever a valid API key is provided, even when the response status is not 200. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/models/parse_handle_params.rb b/lib/context_dev/models/parse_handle_params.rb index 564bebcd..e3fec98f 100644 --- a/lib/context_dev/models/parse_handle_params.rb +++ b/lib/context_dev/models/parse_handle_params.rb @@ -28,14 +28,14 @@ class ParseHandleParams < ContextDev::Internal::Type::BaseModel # @!attribute include_images # Include image references in Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeImages, nil] - optional :include_images, union: -> { ContextDev::ParseHandleParams::IncludeImages } + # @return [Boolean, nil] + optional :include_images, ContextDev::Internal::Type::Boolean # @!attribute include_links # Preserve hyperlinks in Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeLinks, nil] - optional :include_links, union: -> { ContextDev::ParseHandleParams::IncludeLinks } + # @return [Boolean, nil] + optional :include_links, ContextDev::Internal::Type::Boolean # @!attribute ocr # When true for PDF inputs, OCR the selected pages that have no usable text layer @@ -44,8 +44,8 @@ class ParseHandleParams < ContextDev::Internal::Type::BaseModel # range. Billed at 1 credit per page OCR actually recovered, on top of the base # request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::ParseHandleParams::Ocr, nil] - optional :ocr, union: -> { ContextDev::ParseHandleParams::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute pdf # PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. @@ -56,8 +56,8 @@ class ParseHandleParams < ContextDev::Internal::Type::BaseModel # @!attribute shorten_base64_images # Shorten base64-encoded image data in the Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::ParseHandleParams::ShortenBase64Images, nil] - optional :shorten_base64_images, union: -> { ContextDev::ParseHandleParams::ShortenBase64Images } + # @return [Boolean, nil] + optional :shorten_base64_images, ContextDev::Internal::Type::Boolean # @!attribute tags # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -70,8 +70,8 @@ class ParseHandleParams < ContextDev::Internal::Type::BaseModel # @!attribute use_main_content_only # Extract only the main content from HTML-like inputs # - # @return [Boolean, Symbol, ContextDev::Models::ParseHandleParams::UseMainContentOnly, nil] - optional :use_main_content_only, union: -> { ContextDev::ParseHandleParams::UseMainContentOnly } + # @return [Boolean, nil] + optional :use_main_content_only, ContextDev::Internal::Type::Boolean # @!attribute zdr # Set to enabled to bypass shared caches and omit request and response content @@ -92,19 +92,19 @@ class ParseHandleParams < ContextDev::Internal::Type::BaseModel # # @param extension [Symbol, ContextDev::Models::ParseHandleParams::Extension] Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md # - # @param include_images [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeImages] Include image references in Markdown output + # @param include_images [Boolean] Include image references in Markdown output # - # @param include_links [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeLinks] Preserve hyperlinks in Markdown output + # @param include_links [Boolean] Preserve hyperlinks in Markdown output # - # @param ocr [Boolean, Symbol, ContextDev::Models::ParseHandleParams::Ocr] When true for PDF inputs, OCR the selected pages that have no usable text layer + # @param ocr [Boolean] When true for PDF inputs, OCR the selected pages that have no usable text layer # # @param pdf [ContextDev::Models::ParseHandleParams::Pdf] PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. # - # @param shorten_base64_images [Boolean, Symbol, ContextDev::Models::ParseHandleParams::ShortenBase64Images] Shorten base64-encoded image data in the Markdown output + # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::ParseHandleParams::UseMainContentOnly] Extract only the main content from HTML-like inputs + # @param use_main_content_only [Boolean] Extract only the main content from HTML-like inputs # # @param zdr [Symbol, ContextDev::Models::ParseHandleParams::Zdr] Set to enabled to bypass shared caches and omit request and response content fro # @@ -190,85 +190,6 @@ module Extension # @return [Array] end - # Include image references in Markdown output - module IncludeImages - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::ParseHandleParams::IncludeImages::TRUE } - - variant const: -> { ContextDev::Models::ParseHandleParams::IncludeImages::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Preserve hyperlinks in Markdown output - module IncludeLinks - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::ParseHandleParams::IncludeLinks::TRUE } - - variant const: -> { ContextDev::Models::ParseHandleParams::IncludeLinks::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true for PDF inputs, OCR the selected pages that have no usable text layer - # (scans), replacing each recovered page's text with the OCR result while pages - # with a real text layer keep it. pdf.start/pdf.end limit the inclusive page - # range. Billed at 1 credit per page OCR actually recovered, on top of the base - # request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::ParseHandleParams::Ocr::TRUE } - - variant const: -> { ContextDev::Models::ParseHandleParams::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - class Pdf < ContextDev::Internal::Type::BaseModel # @!attribute end_ # Last 1-based PDF page to parse. When omitted, parsing ends at the last page. @@ -294,56 +215,6 @@ class Pdf < ContextDev::Internal::Type::BaseModel # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. end - # Shorten base64-encoded image data in the Markdown output - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::ParseHandleParams::ShortenBase64Images::TRUE } - - variant const: -> { ContextDev::Models::ParseHandleParams::ShortenBase64Images::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Extract only the main content from HTML-like inputs - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::ParseHandleParams::UseMainContentOnly::TRUE } - - variant const: -> { ContextDev::Models::ParseHandleParams::UseMainContentOnly::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - # Set to enabled to bypass shared caches and omit request and response content # from retained usage logs. Requires zero data retention to be enabled for your # organization (contact support@context.dev), otherwise the request fails with diff --git a/lib/context_dev/models/person_enrich_response.rb b/lib/context_dev/models/person_enrich_response.rb index 5cf03e91..d204addc 100644 --- a/lib/context_dev/models/person_enrich_response.rb +++ b/lib/context_dev/models/person_enrich_response.rb @@ -64,6 +64,16 @@ class Candidate < ContextDev::Internal::Type::BaseModel # @see ContextDev::Models::PersonEnrichResponse::Match::Candidate#person class Person < ContextDev::Internal::Type::BaseModel + # @!attribute current_role_status + # Whether the person's current role is known. `present` — current_role is + # populated. `none` — the work history explicitly shows every role has ended. + # `unknown` — our data sources could not confirm either way; treat a missing + # current_role as unverified rather than vacant. + # + # @return [Symbol, ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus] + required :current_role_status, + enum: -> { ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus } + # @!attribute education # # @return [Array] @@ -101,6 +111,12 @@ class Person < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :bio, String + # @!attribute checked_at + # When we last refreshed this profile from our data sources (ISO 8601). + # + # @return [String, nil] + optional :checked_at, String + # @!attribute current_role # # @return [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole, nil] @@ -112,6 +128,13 @@ class Person < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :email, String + # @!attribute last_updated + # When the underlying profile data last changed in our data sources (ISO 8601). + # Omitted when unknown. + # + # @return [String, nil] + optional :last_updated, String + # @!attribute location # # @return [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location, nil] @@ -122,19 +145,56 @@ class Person < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name, nil] optional :name, -> { ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name } - # @!method initialize(education:, experience:, skills:, social_urls:, website_urls:, avatar_url: nil, bio: nil, current_role: nil, email: nil, location: nil, name: nil) + # @!method initialize(current_role_status:, education:, experience:, skills:, social_urls:, website_urls:, avatar_url: nil, bio: nil, checked_at: nil, current_role: nil, email: nil, last_updated: nil, location: nil, name: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person} for more + # details. + # + # @param current_role_status [Symbol, ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus] Whether the person's current role is known. `present` — current_role is populate + # # @param education [Array] + # # @param experience [Array] + # # @param skills [Array] + # # @param social_urls [Array] + # # @param website_urls [Array] + # # @param avatar_url [String] + # # @param bio [String] + # + # @param checked_at [String] When we last refreshed this profile from our data sources (ISO 8601). + # # @param current_role [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole] + # # @param email [String] + # + # @param last_updated [String] When the underlying profile data last changed in our data sources (ISO 8601). Om + # # @param location [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location] + # # @param name [ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name] + # Whether the person's current role is known. `present` — current_role is + # populated. `none` — the work history explicitly shows every role has ended. + # `unknown` — our data sources could not confirm either way; treat a missing + # current_role as unverified rather than vacant. + # + # @see ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person#current_role_status + module CurrentRoleStatus + extend ContextDev::Internal::Type::Enum + + PRESENT = :present + NONE = :none + UNKNOWN = :unknown + + # @!method self.values + # @return [Array] + end + class Education < ContextDev::Internal::Type::BaseModel # @!attribute institution # diff --git a/lib/context_dev/models/utility_prefetch_params.rb b/lib/context_dev/models/utility_prefetch_params.rb index e9aad7cb..36e0f2df 100644 --- a/lib/context_dev/models/utility_prefetch_params.rb +++ b/lib/context_dev/models/utility_prefetch_params.rb @@ -8,13 +8,14 @@ class UtilityPrefetchParams < ContextDev::Internal::Type::BaseModel include ContextDev::Internal::Type::RequestParameters # @!attribute identifier - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. # # @return [ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier] required :identifier, union: -> { ContextDev::UtilityPrefetchParams::Identifier } # @!attribute type - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. # # @return [Symbol, ContextDev::Models::UtilityPrefetchParams::Type] required :type, enum: -> { ContextDev::UtilityPrefetchParams::Type } @@ -37,9 +38,9 @@ class UtilityPrefetchParams < ContextDev::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {ContextDev::Models::UtilityPrefetchParams} for more details. # - # @param identifier [ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier] Identifier of the brand to prefetch. Provide exactly one of domain or email. + # @param identifier [ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier] Identifier of the target to prefetch. Provide exactly one of domain or email. # - # @param type [Symbol, ContextDev::Models::UtilityPrefetchParams::Type] What to prefetch. Currently only 'brand' is supported. + # @param type [Symbol, ContextDev::Models::UtilityPrefetchParams::Type] What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the sty # # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. # @@ -47,34 +48,34 @@ class UtilityPrefetchParams < ContextDev::Internal::Type::BaseModel # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. module Identifier extend ContextDev::Internal::Type::Union - # Prefetch brand data by domain. + # Prefetch by domain. variant -> { ContextDev::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier } - # Prefetch brand data by email. The domain will be extracted and validated. + # Prefetch by email. The domain will be extracted and validated. variant -> { ContextDev::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier } class UtilityPrefetchDomainIdentifier < ContextDev::Internal::Type::BaseModel # @!attribute domain - # Domain name to prefetch brand data for + # Domain name to prefetch data for # # @return [String] required :domain, String # @!method initialize(domain:) - # Prefetch brand data by domain. + # Prefetch by domain. # - # @param domain [String] Domain name to prefetch brand data for + # @param domain [String] Domain name to prefetch data for end class UtilityPrefetchEmailIdentifier < ContextDev::Internal::Type::BaseModel # @!attribute email - # Email address to prefetch brand data for. The domain will be extracted from the - # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email - # addresses are not allowed. + # Email address to prefetch data for. The domain will be extracted from the email. + # Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses + # are not allowed. # # @return [String] required :email, String @@ -84,20 +85,22 @@ class UtilityPrefetchEmailIdentifier < ContextDev::Internal::Type::BaseModel # {ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier} # for more details. # - # Prefetch brand data by email. The domain will be extracted and validated. + # Prefetch by email. The domain will be extracted and validated. # - # @param email [String] Email address to prefetch brand data for. The domain will be extracted from the + # @param email [String] Email address to prefetch data for. The domain will be extracted from the email. end # @!method self.variants # @return [Array(ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier)] end - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. module Type extend ContextDev::Internal::Type::Enum BRAND = :brand + STYLEGUIDE = :styleguide # @!method self.values # @return [Array] diff --git a/lib/context_dev/models/utility_prefetch_response.rb b/lib/context_dev/models/utility_prefetch_response.rb index da00765a..c57bbd0b 100644 --- a/lib/context_dev/models/utility_prefetch_response.rb +++ b/lib/context_dev/models/utility_prefetch_response.rb @@ -30,8 +30,7 @@ class UtilityPrefetchResponse < ContextDev::Internal::Type::BaseModel optional :status, String # @!attribute type - # The type of prefetch that was queued, echoed from the request (currently always - # 'brand') + # The type of prefetch that was queued, echoed from the request # # @return [Symbol, ContextDev::Models::UtilityPrefetchResponse::Type, nil] optional :type, enum: -> { ContextDev::Models::UtilityPrefetchResponse::Type } @@ -48,7 +47,7 @@ class UtilityPrefetchResponse < ContextDev::Internal::Type::BaseModel # # @param status [String] Status of the response, e.g., 'ok' # - # @param type [Symbol, ContextDev::Models::UtilityPrefetchResponse::Type] The type of prefetch that was queued, echoed from the request (currently always + # @param type [Symbol, ContextDev::Models::UtilityPrefetchResponse::Type] The type of prefetch that was queued, echoed from the request # @see ContextDev::Models::UtilityPrefetchResponse#key_metadata class KeyMetadata < ContextDev::Internal::Type::BaseModel @@ -73,14 +72,14 @@ class KeyMetadata < ContextDev::Internal::Type::BaseModel # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. end - # The type of prefetch that was queued, echoed from the request (currently always - # 'brand') + # The type of prefetch that was queued, echoed from the request # # @see ContextDev::Models::UtilityPrefetchResponse#type module Type extend ContextDev::Internal::Type::Enum BRAND = :brand + STYLEGUIDE = :styleguide # @!method self.values # @return [Array] diff --git a/lib/context_dev/models/web_screenshot_params.rb b/lib/context_dev/models/web_screenshot_params.rb index ece6dd95..1f9ac021 100644 --- a/lib/context_dev/models/web_screenshot_params.rb +++ b/lib/context_dev/models/web_screenshot_params.rb @@ -50,8 +50,8 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel # dismiss cookie banner before capture. If 'false' or not provided, captures the # page without that step. # - # @return [Boolean, Symbol, ContextDev::Models::WebScreenshotParams::HandleCookiePopup, nil] - optional :handle_cookie_popup, union: -> { ContextDev::WebScreenshotParams::HandleCookiePopup } + # @return [Boolean, nil] + optional :handle_cookie_popup, ContextDev::Internal::Type::Boolean # @!attribute max_age_ms # Return a cached screenshot if a prior screenshot for the same parameters exists @@ -135,7 +135,7 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel # # @param full_screenshot [Symbol, ContextDev::Models::WebScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc # - # @param handle_cookie_popup [Boolean, Symbol, ContextDev::Models::WebScreenshotParams::HandleCookiePopup] Optional parameter to control cookie/consent popup handling. If 'true', we dismi + # @param handle_cookie_popup [Boolean] Optional parameter to control cookie/consent popup handling. If 'true', we dismi # # @param max_age_ms [Integer, nil] Return a cached screenshot if a prior screenshot for the same parameters exists # @@ -394,33 +394,6 @@ module FullScreenshot # @return [Array] end - # Optional parameter to control cookie/consent popup handling. If 'true', we - # dismiss cookie banner before capture. If 'false' or not provided, captures the - # page without that step. - module HandleCookiePopup - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebScreenshotParams::HandleCookiePopup::TRUE } - - variant const: -> { ContextDev::Models::WebScreenshotParams::HandleCookiePopup::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebScreenshotParams::HandleCookiePopup::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - # Optional parameter to specify which page type to screenshot. If provided, the # system will scrape the domain's links and use heuristics to find the most # appropriate URL for the specified page type (30 supported languages). If not diff --git a/lib/context_dev/models/web_web_crawl_md_response.rb b/lib/context_dev/models/web_web_crawl_md_response.rb index 32821bc5..54ab0e16 100644 --- a/lib/context_dev/models/web_web_crawl_md_response.rb +++ b/lib/context_dev/models/web_web_crawl_md_response.rb @@ -181,6 +181,14 @@ class Metadata < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :favicon, String + # @!attribute headings + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + # + # @return [Array, nil] + optional :headings, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading] } + # @!attribute image # Primary resolved preview image from Open Graph, Twitter, or image metadata. # @@ -246,7 +254,7 @@ class Metadata < ContextDev::Internal::Type::BaseModel optional :twitter, -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Twitter] } - # @!method initialize(crawl_depth:, final_url:, source_url:, status_code:, success:, title:, url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, twitter: nil) + # @!method initialize(crawl_depth:, final_url:, source_url:, status_code:, success:, title:, url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, headings: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, twitter: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata} for more details. # @@ -276,6 +284,8 @@ class Metadata < ContextDev::Internal::Type::BaseModel # # @param favicon [String] Resolved favicon URL, when present. # + # @param headings [Array] Page headings (h1–h6) in document order, extracted from the unfiltered document. + # # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata. # # @param json_ld [ArrayObject}>] JSON-LD structured data blocks parsed from the page. @@ -345,6 +355,25 @@ class Alternate < ContextDev::Internal::Type::BaseModel # @param type [String] Alternate resource MIME type, when present. end + class Heading < ContextDev::Internal::Type::BaseModel + # @!attribute level + # Heading level, 1–6 (from h1–h6). + # + # @return [Integer] + required :level, Integer + + # @!attribute text + # Heading text with whitespace collapsed, truncated to 1000 characters. + # + # @return [String] + required :text, String + + # @!method initialize(level:, text:) + # @param level [Integer] Heading level, 1–6 (from h1–h6). + # + # @param text [String] Heading text with whitespace collapsed, truncated to 1000 characters. + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/lib/context_dev/models/web_web_scrape_html_params.rb b/lib/context_dev/models/web_web_scrape_html_params.rb index d9934996..a3b89e71 100644 --- a/lib/context_dev/models/web_web_scrape_html_params.rb +++ b/lib/context_dev/models/web_web_scrape_html_params.rb @@ -49,8 +49,8 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # @!attribute include_frames # When true, iframes are rendered inline into the returned HTML. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::IncludeFrames, nil] - optional :include_frames, union: -> { ContextDev::WebWebScrapeHTMLParams::IncludeFrames } + # @return [Boolean, nil] + optional :include_frames, ContextDev::Internal::Type::Boolean # @!attribute include_selectors # CSS selectors. When provided, only matching subtrees (and their descendants) are @@ -80,8 +80,8 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # extracting HTML. Defaults to false. This adds a bit of latency in exchange for # more stable output on animated pages. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::SettleAnimations, nil] - optional :settle_animations, union: -> { ContextDev::WebWebScrapeHTMLParams::SettleAnimations } + # @return [Boolean, nil] + optional :settle_animations, ContextDev::Internal::Type::Boolean # @!attribute tags # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -103,8 +103,8 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # When true, return only the page's main content in the HTML response, excluding # headers, footers, sidebars, and navigation when detectable. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::UseMainContentOnly, nil] - optional :use_main_content_only, union: -> { ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly } + # @return [Boolean, nil] + optional :use_main_content_only, ContextDev::Internal::Type::Boolean # @!attribute wait_for_ms # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: @@ -136,7 +136,7 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # # @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob # - # @param include_frames [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::IncludeFrames] When true, iframes are rendered inline into the returned HTML. + # @param include_frames [Boolean] When true, iframes are rendered inline into the returned HTML. # # @param include_selectors [Array, nil] CSS selectors. When provided, only matching subtrees (and their descendants) are # @@ -144,13 +144,13 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # # @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image # - # @param settle_animations [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::SettleAnimations] When true, waits briefly for CSS and transition animations to settle before extr + # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::UseMainContentOnly] When true, return only the page's main content in the HTML response, excluding h + # @param use_main_content_only [Boolean] When true, return only the page's main content in the HTML response, excluding h # # @param wait_for_ms [Integer, nil] Optional browser wait time in milliseconds after initial page load. Min: 0. Max: # @@ -425,31 +425,6 @@ module Country # @return [Array] end - # When true, iframes are rendered inline into the returned HTML. - module IncludeFrames - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::IncludeFrames::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::IncludeFrames::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - class Pdf < ContextDev::Internal::Type::BaseModel # @!attribute end_ # Last 1-based PDF page to parse. When omitted, parsing ends at the last page. @@ -464,17 +439,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::Pdf::Ocr, nil] - optional :ocr, union: -> { ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -491,122 +464,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::WebWebScrapeHTMLParams::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::WebWebScrapeHTMLParams::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - end - - # When true, waits briefly for CSS and transition animations to settle before - # extracting HTML. Defaults to false. This adds a bit of latency in exchange for - # more stable output on animated pages. - module SettleAnimations - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::SettleAnimations::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::SettleAnimations::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, return only the page's main content in the HTML response, excluding - # headers, footers, sidebars, and navigation when detectable. - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::UseMainContentOnly::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeHTMLParams::UseMainContentOnly::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup end # Set to enabled to bypass shared caches and omit request and response content diff --git a/lib/context_dev/models/web_web_scrape_html_response.rb b/lib/context_dev/models/web_web_scrape_html_response.rb index 95361fb6..bd6823de 100644 --- a/lib/context_dev/models/web_web_scrape_html_response.rb +++ b/lib/context_dev/models/web_web_scrape_html_response.rb @@ -135,6 +135,14 @@ class Metadata < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :favicon, String + # @!attribute headings + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + # + # @return [Array, nil] + optional :headings, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading] } + # @!attribute image # Primary resolved preview image from Open Graph, Twitter, or image metadata. # @@ -206,7 +214,7 @@ class Metadata < ContextDev::Internal::Type::BaseModel optional :twitter, -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Twitter] } - # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) + # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, headings: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeHTMLResponse::Metadata} for more details. # @@ -228,6 +236,8 @@ class Metadata < ContextDev::Internal::Type::BaseModel # # @param favicon [String] Resolved favicon URL, when present. # + # @param headings [Array] Page headings (h1–h6) in document order, extracted from the unfiltered document. + # # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata. # # @param json_ld [ArrayObject}>] JSON-LD structured data blocks parsed from the page. @@ -299,6 +309,25 @@ class Alternate < ContextDev::Internal::Type::BaseModel # @param type [String] Alternate resource MIME type, when present. end + class Heading < ContextDev::Internal::Type::BaseModel + # @!attribute level + # Heading level, 1–6 (from h1–h6). + # + # @return [Integer] + required :level, Integer + + # @!attribute text + # Heading text with whitespace collapsed, truncated to 1000 characters. + # + # @return [String] + required :text, String + + # @!method initialize(level:, text:) + # @param level [Integer] Heading level, 1–6 (from h1–h6). + # + # @param text [String] Heading text with whitespace collapsed, truncated to 1000 characters. + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/lib/context_dev/models/web_web_scrape_images_params.rb b/lib/context_dev/models/web_web_scrape_images_params.rb index 95df9651..548d30a6 100644 --- a/lib/context_dev/models/web_web_scrape_images_params.rb +++ b/lib/context_dev/models/web_web_scrape_images_params.rb @@ -31,8 +31,8 @@ class WebWebScrapeImagesParams < ContextDev::Internal::Type::BaseModel # group is kept. Images that cannot be downloaded or hashed are kept. Default: # false. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Dedupe, nil] - optional :dedupe, union: -> { ContextDev::WebWebScrapeImagesParams::Dedupe } + # @return [Boolean, nil] + optional :dedupe, ContextDev::Internal::Type::Boolean # @!attribute enrichment # Optional per-image processing, sent as deep-object query params such as @@ -87,7 +87,7 @@ class WebWebScrapeImagesParams < ContextDev::Internal::Type::BaseModel # # @param actions [Array, nil] Optional browser actions executed in array order after the page loads and before # - # @param dedupe [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Dedupe] When true, visually duplicate images are removed: every image is loaded and perc + # @param dedupe [Boolean] When true, visually duplicate images are removed: every image is loaded and perc # # @param enrichment [ContextDev::Models::WebWebScrapeImagesParams::Enrichment, nil] Optional per-image processing, sent as deep-object query params such as enrichme # @@ -156,49 +156,19 @@ class Perform < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::WebWebScrapeImagesParams::Action::Wait, ContextDev::Models::WebWebScrapeImagesParams::Action::Perform)] end - # When true, visually duplicate images are removed: every image is loaded and - # perceptually hashed, and only the highest-resolution copy of each duplicate - # group is kept. Images that cannot be downloaded or hashed are kept. Default: - # false. - module Dedupe - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Dedupe::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Dedupe::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - class Enrichment < ContextDev::Internal::Type::BaseModel # @!attribute classification # Classify each image by visual asset type. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification, nil] - optional :classification, union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::Classification } + # @return [Boolean, nil] + optional :classification, ContextDev::Internal::Type::Boolean # @!attribute hosted_url # Host materializable images on the Brand.dev CDN and return their URL and MIME # type. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL, nil] - optional :hosted_url, - union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL }, - api_name: :hostedUrl + # @return [Boolean, nil] + optional :hosted_url, ContextDev::Internal::Type::Boolean, api_name: :hostedUrl # @!attribute max_time_per_ms # Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000. @@ -209,8 +179,8 @@ class Enrichment < ContextDev::Internal::Type::BaseModel # @!attribute resolution # Measure image width and height when possible. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution, nil] - optional :resolution, union: -> { ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution } + # @return [Boolean, nil] + optional :resolution, ContextDev::Internal::Type::Boolean # @!method initialize(classification: nil, hosted_url: nil, max_time_per_ms: nil, resolution: nil) # Some parameter documentations has been truncated, see @@ -219,95 +189,13 @@ class Enrichment < ContextDev::Internal::Type::BaseModel # Optional per-image processing, sent as deep-object query params such as # enrichment[resolution]=true. # - # @param classification [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification] Classify each image by visual asset type. + # @param classification [Boolean] Classify each image by visual asset type. # - # @param hosted_url [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL] Host materializable images on the Brand.dev CDN and return their URL and MIME ty + # @param hosted_url [Boolean] Host materializable images on the Brand.dev CDN and return their URL and MIME ty # # @param max_time_per_ms [Integer] Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000. # - # @param resolution [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution] Measure image width and height when possible. - - # Classify each image by visual asset type. - # - # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#classification - module Classification - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Classification::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Host materializable images on the Brand.dev CDN and return their URL and MIME - # type. - # - # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#hosted_url - module HostedURL - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::HostedURL::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Measure image width and height when possible. - # - # @see ContextDev::Models::WebWebScrapeImagesParams::Enrichment#resolution - module Resolution - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeImagesParams::Enrichment::Resolution::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end + # @param resolution [Boolean] Measure image width and height when possible. end end end diff --git a/lib/context_dev/models/web_web_scrape_md_params.rb b/lib/context_dev/models/web_web_scrape_md_params.rb index 9ca9792a..fd1b46ec 100644 --- a/lib/context_dev/models/web_web_scrape_md_params.rb +++ b/lib/context_dev/models/web_web_scrape_md_params.rb @@ -50,20 +50,28 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # @!attribute include_frames # When true, the contents of iframes are rendered to Markdown. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeFrames, nil] - optional :include_frames, union: -> { ContextDev::WebWebScrapeMdParams::IncludeFrames } + # @return [Boolean, nil] + optional :include_frames, ContextDev::Internal::Type::Boolean + + # @!attribute include_html + # When true, the response also includes an `html` field with the page HTML the + # Markdown was converted from — the same body the Scrape HTML endpoint returns for + # the equivalent request. + # + # @return [Boolean, nil] + optional :include_html, ContextDev::Internal::Type::Boolean # @!attribute include_images # Include image references in Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeImages, nil] - optional :include_images, union: -> { ContextDev::WebWebScrapeMdParams::IncludeImages } + # @return [Boolean, nil] + optional :include_images, ContextDev::Internal::Type::Boolean # @!attribute include_links # Preserve hyperlinks in Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeLinks, nil] - optional :include_links, union: -> { ContextDev::WebWebScrapeMdParams::IncludeLinks } + # @return [Boolean, nil] + optional :include_links, ContextDev::Internal::Type::Boolean # @!attribute include_selectors # CSS selectors. When provided, only matching HTML subtrees (and their @@ -93,14 +101,14 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # converting to Markdown. Defaults to false. This adds a bit of latency in # exchange for more stable output on animated pages. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::SettleAnimations, nil] - optional :settle_animations, union: -> { ContextDev::WebWebScrapeMdParams::SettleAnimations } + # @return [Boolean, nil] + optional :settle_animations, ContextDev::Internal::Type::Boolean # @!attribute shorten_base64_images # Shorten base64-encoded image data in the Markdown output # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images, nil] - optional :shorten_base64_images, union: -> { ContextDev::WebWebScrapeMdParams::ShortenBase64Images } + # @return [Boolean, nil] + optional :shorten_base64_images, ContextDev::Internal::Type::Boolean # @!attribute tags # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -122,8 +130,8 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly, nil] - optional :use_main_content_only, union: -> { ContextDev::WebWebScrapeMdParams::UseMainContentOnly } + # @return [Boolean, nil] + optional :use_main_content_only, ContextDev::Internal::Type::Boolean # @!attribute wait_for_ms # Optional browser wait time in milliseconds after initial page load before @@ -141,7 +149,7 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::WebWebScrapeMdParams::Zdr, nil] optional :zdr, enum: -> { ContextDev::WebWebScrapeMdParams::Zdr } - # @!method initialize(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {}) + # @!method initialize(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_html: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeMdParams} for more details. # @@ -155,11 +163,13 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # # @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob # - # @param include_frames [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeFrames] When true, the contents of iframes are rendered to Markdown. + # @param include_frames [Boolean] When true, the contents of iframes are rendered to Markdown. # - # @param include_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeImages] Include image references in Markdown output + # @param include_html [Boolean] When true, the response also includes an `html` field with the page HTML the Mar # - # @param include_links [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeLinks] Preserve hyperlinks in Markdown output + # @param include_images [Boolean] Include image references in Markdown output + # + # @param include_links [Boolean] Preserve hyperlinks in Markdown output # # @param include_selectors [Array, nil] CSS selectors. When provided, only matching HTML subtrees (and their descendants # @@ -167,15 +177,15 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # # @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image # - # @param settle_animations [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::SettleAnimations] When true, waits briefly for CSS and transition animations to settle before conv + # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv # - # @param shorten_base64_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images] Shorten base64-encoded image data in the Markdown output + # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly] Extract only the main content of the page, excluding headers, footers, sidebars, + # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars, # # @param wait_for_ms [Integer, nil] Optional browser wait time in milliseconds after initial page load before conver # @@ -450,81 +460,6 @@ module Country # @return [Array] end - # When true, the contents of iframes are rendered to Markdown. - module IncludeFrames - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeFrames::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeFrames::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeFrames::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Include image references in Markdown output - module IncludeImages - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeImages::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeImages::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeImages::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Preserve hyperlinks in Markdown output - module IncludeLinks - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeLinks::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::IncludeLinks::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::IncludeLinks::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - class Pdf < ContextDev::Internal::Type::BaseModel # @!attribute end_ # Last 1-based PDF page to parse. When omitted, parsing ends at the last page. @@ -539,17 +474,15 @@ class Pdf < ContextDev::Internal::Type::BaseModel # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr, nil] - optional :ocr, union: -> { ContextDev::WebWebScrapeMdParams::Pdf::Ocr } + # @return [Boolean, nil] + optional :ocr, ContextDev::Internal::Type::Boolean # @!attribute should_parse # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. # - # @return [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse, nil] - optional :should_parse, - union: -> { ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse }, - api_name: :shouldParse + # @return [Boolean, nil] + optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse # @!attribute start # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -566,147 +499,11 @@ class Pdf < ContextDev::Internal::Type::BaseModel # # @param end_ [Integer] Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Mus # - # @param ocr [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr] When true, OCR the selected PDF pages that have no usable text layer (scans), re + # @param ocr [Boolean] When true, OCR the selected PDF pages that have no usable text layer (scans), re # - # @param should_parse [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and + # @param should_parse [Boolean] When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # # @param start [Integer] First 1-based PDF page to parse. When omitted, parsing starts at the first page. - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - # - # @see ContextDev::Models::WebWebScrapeMdParams::Pdf#ocr - module Ocr - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::Ocr::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::Pdf::Ocr::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - # - # @see ContextDev::Models::WebWebScrapeMdParams::Pdf#should_parse - module ShouldParse - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::Pdf::ShouldParse::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - end - - # When true, waits briefly for CSS and transition animations to settle before - # converting to Markdown. Defaults to false. This adds a bit of latency in - # exchange for more stable output on animated pages. - module SettleAnimations - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::SettleAnimations::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::SettleAnimations::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::SettleAnimations::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Shorten base64-encoded image data in the Markdown output - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::ShortenBase64Images::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup - end - - # Extract only the main content of the page, excluding headers, footers, sidebars, - # and navigation - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - variant ContextDev::Internal::Type::Boolean - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly::TRUE } - - variant const: -> { ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly::FALSE } - - # @!method self.variants - # @return [Array(Boolean, Symbol)] - - define_sorbet_constant!(:Variants) do - T.type_alias { T.any(T::Boolean, ContextDev::WebWebScrapeMdParams::UseMainContentOnly::TaggedSymbol) } - end - - # @!group - - TRUE = :true - FALSE = :false - - # @!endgroup end # Set to enabled to bypass shared caches and omit request and response content diff --git a/lib/context_dev/models/web_web_scrape_md_response.rb b/lib/context_dev/models/web_web_scrape_md_response.rb index 03a86a1c..99339e86 100644 --- a/lib/context_dev/models/web_web_scrape_md_response.rb +++ b/lib/context_dev/models/web_web_scrape_md_response.rb @@ -51,6 +51,14 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale + # @!attribute html + # Only present when includeHTML=true: the page HTML the Markdown was converted + # from — the same body the Scrape HTML endpoint returns for the equivalent + # request. + # + # @return [String, nil] + optional :html, String + # @!attribute key_metadata # Metadata about the API key used for the request. Included in every response # whenever a valid API key is provided, even when the response status is not 200. @@ -58,7 +66,7 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata, nil] optional :key_metadata, -> { ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } - # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil) + # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, html: nil, key_metadata: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeMdResponse} for more details. # @@ -76,6 +84,8 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed # + # @param html [String] Only present when includeHTML=true: the page HTML the Markdown was converted fro + # # @param key_metadata [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when # @see ContextDev::Models::WebWebScrapeMdResponse#metadata @@ -132,6 +142,14 @@ class Metadata < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :favicon, String + # @!attribute headings + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + # + # @return [Array, nil] + optional :headings, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading] } + # @!attribute image # Primary resolved preview image from Open Graph, Twitter, or image metadata. # @@ -203,7 +221,7 @@ class Metadata < ContextDev::Internal::Type::BaseModel optional :twitter, -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::WebWebScrapeMdResponse::Metadata::Twitter] } - # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) + # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, headings: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeMdResponse::Metadata} for more details. # @@ -225,6 +243,8 @@ class Metadata < ContextDev::Internal::Type::BaseModel # # @param favicon [String] Resolved favicon URL, when present. # + # @param headings [Array] Page headings (h1–h6) in document order, extracted from the unfiltered document. + # # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata. # # @param json_ld [ArrayObject}>] JSON-LD structured data blocks parsed from the page. @@ -296,6 +316,25 @@ class Alternate < ContextDev::Internal::Type::BaseModel # @param type [String] Alternate resource MIME type, when present. end + class Heading < ContextDev::Internal::Type::BaseModel + # @!attribute level + # Heading level, 1–6 (from h1–h6). + # + # @return [Integer] + required :level, Integer + + # @!attribute text + # Heading text with whitespace collapsed, truncated to 1000 characters. + # + # @return [String] + required :text, String + + # @!method initialize(level:, text:) + # @param level [Integer] Heading level, 1–6 (from h1–h6). + # + # @param text [String] Heading text with whitespace collapsed, truncated to 1000 characters. + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/lib/context_dev/resources/brand.rb b/lib/context_dev/resources/brand.rb index 51f79094..323e247b 100644 --- a/lib/context_dev/resources/brand.rb +++ b/lib/context_dev/resources/brand.rb @@ -68,21 +68,20 @@ def retrieve_simplified(params) # Some parameter documentations has been truncated, see # {ContextDev::Models::BrandSearchParams} for more details. # - # Search brands by name or domain and get back up to 10 lightweight matches - # (domain, name, logo). Name matches rank ahead of domain matches; within each - # group the most popular brands come first: by Tranco rank, then market cap for - # brands outside the Tranco list, with text relevance breaking ties. Matching is - # prefix-based with no typo tolerance, so it is suited to autocomplete. Only - # brands already in the Context.dev index are returned — use /brand/retrieve to - # fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit - # per request on the Free and Starter plans. + # Search indexed brands by name or domain # - # @overload search(query:, tags: nil, request_options: {}) + # @overload search(query:, autocomplete: nil, query_by: nil, tags: nil, typo_tolerance: nil, request_options: {}) # - # @param query [String] Search term, matched against brand names and domains by prefix (e.g. 'nike', 'ni + # @param query [String] Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike. + # + # @param autocomplete [Boolean] Whether the search term matches by prefix, so partial words match as they are ty + # + # @param query_by [Array] Fields to match the search term against, as a comma-separated list or repeated p # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # + # @param typo_tolerance [Integer] Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::BrandSearchResponse] @@ -94,7 +93,7 @@ def search(params) @client.request( method: :get, path: "brand/search", - query: query, + query: query.transform_keys(query_by: "queryBy", typo_tolerance: "typoTolerance"), model: ContextDev::Models::BrandSearchResponse, options: options ) diff --git a/lib/context_dev/resources/news.rb b/lib/context_dev/resources/news.rb new file mode 100644 index 00000000..f5f86370 --- /dev/null +++ b/lib/context_dev/resources/news.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module ContextDev + module Resources + # Search live first-party RSS and free historical news data by company identity. + class News + # Searches live and historical company news for one company, identified in + # searchBy by name, domain, ticker (optionally disambiguated by exchange), or + # ISIN. Results can be filtered by publisher domain, publisher country, article + # language, article type, and published-at date, and include stable story IDs, + # source metadata, verified entity relevance, and cursor pagination. + # + # @overload search(search_by:, cursor: nil, filter_by: nil, limit: nil, sort_by: nil, tags: nil, request_options: {}) + # + # @param search_by [ContextDev::Models::NewsSearchParams::SearchBy] What to search for. + # + # @param cursor [String, nil] Opaque next_cursor from the previous response, or null for the first page. + # + # @param filter_by [ContextDev::Models::NewsSearchParams::FilterBy] Optional result filters. + # + # @param limit [Integer] Maximum results to return. Defaults to 10. + # + # @param sort_by [ContextDev::Models::NewsSearchParams::SortBy] Result ordering. Defaults to newest. + # + # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::NewsSearchResponse] + # + # @see ContextDev::Models::NewsSearchParams + def search(params) + parsed, options = ContextDev::NewsSearchParams.dump_request(params) + @client.request( + method: :post, + path: "news/search", + body: parsed, + model: ContextDev::Models::NewsSearchResponse, + options: options + ) + end + + # @api private + # + # @param client [ContextDev::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/context_dev/resources/parse.rb b/lib/context_dev/resources/parse.rb index a7dfa4dc..4558acad 100644 --- a/lib/context_dev/resources/parse.rb +++ b/lib/context_dev/resources/parse.rb @@ -17,19 +17,19 @@ class Parse # # @param extension [Symbol, ContextDev::Models::ParseHandleParams::Extension] Query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, # - # @param include_images [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeImages] Query param: Include image references in Markdown output + # @param include_images [Boolean] Query param: Include image references in Markdown output # - # @param include_links [Boolean, Symbol, ContextDev::Models::ParseHandleParams::IncludeLinks] Query param: Preserve hyperlinks in Markdown output + # @param include_links [Boolean] Query param: Preserve hyperlinks in Markdown output # - # @param ocr [Boolean, Symbol, ContextDev::Models::ParseHandleParams::Ocr] Query param: When true for PDF inputs, OCR the selected pages that have no usabl + # @param ocr [Boolean] Query param: When true for PDF inputs, OCR the selected pages that have no usabl # # @param pdf [ContextDev::Models::ParseHandleParams::Pdf] Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5 # - # @param shorten_base64_images [Boolean, Symbol, ContextDev::Models::ParseHandleParams::ShortenBase64Images] Query param: Shorten base64-encoded image data in the Markdown output + # @param shorten_base64_images [Boolean] Query param: Shorten base64-encoded image data in the Markdown output # # @param tags [Array] Query param: Optional comma-separated caller-defined tags for tracking this requ # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::ParseHandleParams::UseMainContentOnly] Query param: Extract only the main content from HTML-like inputs + # @param use_main_content_only [Boolean] Query param: Extract only the main content from HTML-like inputs # # @param zdr [Symbol, ContextDev::Models::ParseHandleParams::Zdr] Query param: Set to enabled to bypass shared caches and omit request and respons # diff --git a/lib/context_dev/resources/utility.rb b/lib/context_dev/resources/utility.rb index 9e50987f..7d1657e8 100644 --- a/lib/context_dev/resources/utility.rb +++ b/lib/context_dev/resources/utility.rb @@ -6,16 +6,17 @@ class Utility # Some parameter documentations has been truncated, see # {ContextDev::Models::UtilityPrefetchParams} for more details. # - # Signal that you may fetch brand data soon to improve latency. The type field - # selects what to prefetch (currently only 'brand') and identifier carries exactly - # one lookup key: a domain, or an email whose domain is extracted and validated - # (free email providers and disposable email addresses are not allowed). + # Signal that you may fetch data soon to improve latency. The type field selects + # what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a + # styleguide extraction) and identifier carries exactly one lookup key: a domain, + # or an email whose domain is extracted and validated (free email providers and + # disposable email addresses are not allowed). # # @overload prefetch(identifier:, type:, tags: nil, timeout_ms: nil, request_options: {}) # - # @param identifier [ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier] Identifier of the brand to prefetch. Provide exactly one of domain or email. + # @param identifier [ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchDomainIdentifier, ContextDev::Models::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier] Identifier of the target to prefetch. Provide exactly one of domain or email. # - # @param type [Symbol, ContextDev::Models::UtilityPrefetchParams::Type] What to prefetch. Currently only 'brand' is supported. + # @param type [Symbol, ContextDev::Models::UtilityPrefetchParams::Type] What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the sty # # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. # diff --git a/lib/context_dev/resources/web.rb b/lib/context_dev/resources/web.rb index 00169af5..eb811ba7 100644 --- a/lib/context_dev/resources/web.rb +++ b/lib/context_dev/resources/web.rb @@ -188,7 +188,7 @@ def extract_styleguide(params = {}) # # @param full_screenshot [Symbol, ContextDev::Models::WebScreenshotParams::FullScreenshot] Optional parameter to determine screenshot type. If 'true', takes a full page sc # - # @param handle_cookie_popup [Boolean, Symbol, ContextDev::Models::WebScreenshotParams::HandleCookiePopup] Optional parameter to control cookie/consent popup handling. If 'true', we dismi + # @param handle_cookie_popup [Boolean] Optional parameter to control cookie/consent popup handling. If 'true', we dismi # # @param max_age_ms [Integer, nil] Return a cached screenshot if a prior screenshot for the same parameters exists # @@ -359,7 +359,7 @@ def web_crawl_md(params) # # @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob # - # @param include_frames [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::IncludeFrames] When true, iframes are rendered inline into the returned HTML. + # @param include_frames [Boolean] When true, iframes are rendered inline into the returned HTML. # # @param include_selectors [Array, nil] CSS selectors. When provided, only matching subtrees (and their descendants) are # @@ -367,13 +367,13 @@ def web_crawl_md(params) # # @param pdf [ContextDev::Models::WebWebScrapeHTMLParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image # - # @param settle_animations [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::SettleAnimations] When true, waits briefly for CSS and transition animations to settle before extr + # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before extr # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::WebWebScrapeHTMLParams::UseMainContentOnly] When true, return only the page's main content in the HTML response, excluding h + # @param use_main_content_only [Boolean] When true, return only the page's main content in the HTML response, excluding h # # @param wait_for_ms [Integer, nil] Optional browser wait time in milliseconds after initial page load. Min: 0. Max: # @@ -420,7 +420,7 @@ def web_scrape_html(params) # # @param actions [Array, nil] Optional browser actions executed in array order after the page loads and before # - # @param dedupe [Boolean, Symbol, ContextDev::Models::WebWebScrapeImagesParams::Dedupe] When true, visually duplicate images are removed: every image is loaded and perc + # @param dedupe [Boolean] When true, visually duplicate images are removed: every image is loaded and perc # # @param enrichment [ContextDev::Models::WebWebScrapeImagesParams::Enrichment, nil] Optional per-image processing, sent as deep-object query params such as enrichme # @@ -476,19 +476,19 @@ def web_scrape_images(params) # # ### Billing & errors # - # | HTTP status | Billed? | Meaning | - # | ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- | - # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | - # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | - # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | - # | 404 | No | Target page returned or fingerprinted as not found | - # | 408 | No | Request timed out | - # | 413 | No | Target content exceeds the maximum supported size (20 MB) | - # | 415 | No | Unsupported content type | - # | 429 | No | Per-minute rate limit exceeded; honor Retry-After | - # | 500 | No | Internal error | + # | HTTP status | Billed? | Meaning | + # | ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | + # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | + # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | + # | 404 | No | Target page returned or fingerprinted as not found | + # | 408 | No | Request timed out | + # | 413 | No | Target content exceeds the maximum supported size (20 MB) | + # | 415 | No | Unsupported content type | + # | 429 | No | Per-minute rate limit exceeded; honor Retry-After | + # | 500 | No | Internal error | # - # @overload web_scrape_md(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {}) + # @overload web_scrape_md(url:, actions: nil, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_html: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, settle_animations: nil, shorten_base64_images: nil, tags: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, zdr: nil, request_options: {}) # # @param url [String] Full URL to scrape into LLM usable Markdown (must include http:// or https:// pr # @@ -500,11 +500,13 @@ def web_scrape_images(params) # # @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob # - # @param include_frames [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeFrames] When true, the contents of iframes are rendered to Markdown. + # @param include_frames [Boolean] When true, the contents of iframes are rendered to Markdown. + # + # @param include_html [Boolean] When true, the response also includes an `html` field with the page HTML the Mar # - # @param include_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeImages] Include image references in Markdown output + # @param include_images [Boolean] Include image references in Markdown output # - # @param include_links [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::IncludeLinks] Preserve hyperlinks in Markdown output + # @param include_links [Boolean] Preserve hyperlinks in Markdown output # # @param include_selectors [Array, nil] CSS selectors. When provided, only matching HTML subtrees (and their descendants # @@ -512,15 +514,15 @@ def web_scrape_images(params) # # @param pdf [ContextDev::Models::WebWebScrapeMdParams::Pdf] PDF parsing controls. Use start/end to limit text extraction and embedded-image # - # @param settle_animations [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::SettleAnimations] When true, waits briefly for CSS and transition animations to settle before conv + # @param settle_animations [Boolean] When true, waits briefly for CSS and transition animations to settle before conv # - # @param shorten_base64_images [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::ShortenBase64Images] Shorten base64-encoded image data in the Markdown output + # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output # # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are # # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # - # @param use_main_content_only [Boolean, Symbol, ContextDev::Models::WebWebScrapeMdParams::UseMainContentOnly] Extract only the main content of the page, excluding headers, footers, sidebars, + # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars, # # @param wait_for_ms [Integer, nil] Optional browser wait time in milliseconds after initial page load before conver # @@ -540,6 +542,7 @@ def web_scrape_md(params) query: query.transform_keys( exclude_selectors: "excludeSelectors", include_frames: "includeFrames", + include_html: "includeHTML", include_images: "includeImages", include_links: "includeLinks", include_selectors: "includeSelectors", diff --git a/lib/context_dev/version.rb b/lib/context_dev/version.rb index c0dbdad4..bb2a6730 100644 --- a/lib/context_dev/version.rb +++ b/lib/context_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ContextDev - VERSION = "2.9.0" + VERSION = "2.10.0" end diff --git a/rbi/context_dev/client.rbi b/rbi/context_dev/client.rbi index 2fa520e9..3ce5a152 100644 --- a/rbi/context_dev/client.rbi +++ b/rbi/context_dev/client.rbi @@ -45,6 +45,10 @@ module ContextDev sig { returns(ContextDev::Resources::People) } attr_reader :people + # Search live first-party RSS and free historical news data by company identity. + sig { returns(ContextDev::Resources::News) } + attr_reader :news + # @api private sig { override.returns(T::Hash[String, String]) } private def auth_headers diff --git a/rbi/context_dev/models.rbi b/rbi/context_dev/models.rbi index 9181504d..76da7d2d 100644 --- a/rbi/context_dev/models.rbi +++ b/rbi/context_dev/models.rbi @@ -62,6 +62,8 @@ module ContextDev MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams + NewsSearchParams = ContextDev::Models::NewsSearchParams + PageErrorCount = ContextDev::Models::PageErrorCount ParseHandleParams = ContextDev::Models::ParseHandleParams diff --git a/rbi/context_dev/models/batch_get_results_response.rbi b/rbi/context_dev/models/batch_get_results_response.rbi index 5e22862d..86782247 100644 --- a/rbi/context_dev/models/batch_get_results_response.rbi +++ b/rbi/context_dev/models/batch_get_results_response.rbi @@ -162,7 +162,8 @@ module ContextDev sig { returns(String) } attr_accessor :url - # Raw page HTML. Present on html batches. + # Page HTML. Present on html batches, and on markdown batches submitted with + # `options.includeHTML`. sig { returns(T.nilable(String)) } attr_reader :html @@ -223,7 +224,8 @@ module ContextDev metadata:, # URL as submitted, or as discovered by the crawl. url:, - # Raw page HTML. Present on html batches. + # Page HTML. Present on html batches, and on markdown batches submitted with + # `options.includeHTML`. html: nil, # Caller-supplied identifier echoed from submission. item_id: nil, @@ -351,6 +353,29 @@ module ContextDev sig { params(favicon: String).void } attr_writer :favicon + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading + ] + ) + ) + end + attr_reader :headings + + sig do + params( + headings: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading::OrHash + ] + ).void + end + attr_writer :headings + # Primary resolved preview image from Open Graph, Twitter, or image metadata. sig { returns(T.nilable(String)) } attr_reader :image @@ -480,6 +505,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading::OrHash + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -519,6 +548,9 @@ module ContextDev description: nil, # Resolved favicon URL, when present. favicon: nil, + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + headings: nil, # Primary resolved preview image from Open Graph, Twitter, or image metadata. image: nil, # JSON-LD structured data blocks parsed from the page. @@ -562,6 +594,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -677,6 +713,39 @@ module ContextDev end end + class Heading < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading, + ContextDev::Internal::AnyHash + ) + end + + # Heading level, 1–6 (from h1–h6). + sig { returns(Integer) } + attr_accessor :level + + # Heading text with whitespace collapsed, truncated to 1000 characters. + sig { returns(String) } + attr_accessor :text + + sig do + params(level: Integer, text: String).returns(T.attached_class) + end + def self.new( + # Heading level, 1–6 (from h1–h6). + level:, + # Heading text with whitespace collapsed, truncated to 1000 characters. + text: + ) + end + + sig { override.returns({ level: Integer, text: String }) } + def to_hash + end + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/rbi/context_dev/models/batch_submit_params.rbi b/rbi/context_dev/models/batch_submit_params.rbi index 89f6dc0b..2a7c1a10 100644 --- a/rbi/context_dev/models/batch_submit_params.rbi +++ b/rbi/context_dev/models/batch_submit_params.rbi @@ -343,6 +343,14 @@ module ContextDev sig { returns(T.nilable(T::Array[String])) } attr_accessor :exclude_selectors + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_html + + sig { params(include_html: T::Boolean).void } + attr_writer :include_html + # Include image references in the Markdown. sig { returns(T.nilable(T::Boolean)) } attr_reader :include_images @@ -422,6 +430,7 @@ module ContextDev country: ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), + include_html: T::Boolean, include_images: T::Boolean, include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), @@ -441,6 +450,9 @@ module ContextDev # Remove elements matching these CSS selectors. Applied after `includeSelectors`, # so an element matching both is removed. exclude_selectors: nil, + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + include_html: nil, # Include image references in the Markdown. include_images: nil, # Include links in the Markdown. @@ -473,6 +485,7 @@ module ContextDev country: ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), + include_html: T::Boolean, include_images: T::Boolean, include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), @@ -1556,52 +1569,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -1616,16 +1595,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -1650,112 +1621,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end end end end @@ -3112,52 +2985,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -3172,16 +3011,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -3206,112 +3037,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end end end end @@ -3794,6 +3527,14 @@ module ContextDev sig { returns(T.nilable(T::Array[String])) } attr_accessor :exclude_selectors + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_html + + sig { params(include_html: T::Boolean).void } + attr_writer :include_html + # Include image references in the Markdown. sig { returns(T.nilable(T::Boolean)) } attr_reader :include_images @@ -3873,6 +3614,7 @@ module ContextDev country: ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), + include_html: T::Boolean, include_images: T::Boolean, include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), @@ -3892,6 +3634,9 @@ module ContextDev # Remove elements matching these CSS selectors. Applied after `includeSelectors`, # so an element matching both is removed. exclude_selectors: nil, + # Also include each page's HTML in its result record, as an `html` field alongside + # the Markdown. + include_html: nil, # Include image references in the Markdown. include_images: nil, # Include links in the Markdown. @@ -3924,6 +3669,7 @@ module ContextDev country: ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), + include_html: T::Boolean, include_images: T::Boolean, include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), @@ -5007,52 +4753,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -5067,16 +4779,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -5101,112 +4805,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ShouldParse::TaggedSymbol - ) - end end end end @@ -6787,52 +6393,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -6847,16 +6419,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -6881,112 +6445,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ShouldParse::TaggedSymbol - ) - end end end end diff --git a/rbi/context_dev/models/brand_search_params.rbi b/rbi/context_dev/models/brand_search_params.rbi index a545bac4..604970ce 100644 --- a/rbi/context_dev/models/brand_search_params.rbi +++ b/rbi/context_dev/models/brand_search_params.rbi @@ -11,11 +11,35 @@ module ContextDev T.any(ContextDev::BrandSearchParams, ContextDev::Internal::AnyHash) end - # Search term, matched against brand names and domains by prefix (e.g. 'nike', + # Search term, matched against the fields selected by queryBy (e.g. 'nike', # 'nike.com', 'nik'). sig { returns(String) } attr_accessor :query + # Whether the search term matches by prefix, so partial words match as they are + # typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :autocomplete + + sig { params(autocomplete: T::Boolean).void } + attr_writer :autocomplete + + # Fields to match the search term against, as a comma-separated list or repeated + # parameter: 'name', 'domain', or both. Defaults to both. + sig do + returns( + T.nilable(T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol]) + ) + end + attr_reader :query_by + + sig do + params( + query_by: T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol] + ).void + end + attr_writer :query_by + # Optional comma-separated caller-defined tags for tracking this request. Tags are # recorded on the request's usage log and can be used to filter usage on the # dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -25,21 +49,41 @@ module ContextDev sig { params(tags: T::Array[String]).void } attr_writer :tags + # Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # typo tolerance). + sig { returns(T.nilable(Integer)) } + attr_reader :typo_tolerance + + sig { params(typo_tolerance: Integer).void } + attr_writer :typo_tolerance + sig do params( query: String, + autocomplete: T::Boolean, + query_by: T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol], tags: T::Array[String], + typo_tolerance: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end def self.new( - # Search term, matched against brand names and domains by prefix (e.g. 'nike', + # Search term, matched against the fields selected by queryBy (e.g. 'nike', # 'nike.com', 'nik'). query:, + # Whether the search term matches by prefix, so partial words match as they are + # typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + autocomplete: nil, + # Fields to match the search term against, as a comma-separated list or repeated + # parameter: 'name', 'domain', or both. Defaults to both. + query_by: nil, # Optional comma-separated caller-defined tags for tracking this request. Tags are # recorded on the request's usage log and can be used to filter usage on the # dashboard usage page. Up to 20 tags, each 1-50 characters. tags: nil, + # Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # typo tolerance). + typo_tolerance: nil, request_options: {} ) end @@ -48,13 +92,38 @@ module ContextDev override.returns( { query: String, + autocomplete: T::Boolean, + query_by: + T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol], tags: T::Array[String], + typo_tolerance: Integer, request_options: ContextDev::RequestOptions } ) end def to_hash end + + module QueryBy + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, ContextDev::BrandSearchParams::QueryBy) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NAME = + T.let(:name, ContextDev::BrandSearchParams::QueryBy::TaggedSymbol) + DOMAIN = + T.let(:domain, ContextDev::BrandSearchParams::QueryBy::TaggedSymbol) + + sig do + override.returns( + T::Array[ContextDev::BrandSearchParams::QueryBy::TaggedSymbol] + ) + end + def self.values + end + end end end end diff --git a/rbi/context_dev/models/news_search_params.rbi b/rbi/context_dev/models/news_search_params.rbi new file mode 100644 index 00000000..9329ff76 --- /dev/null +++ b/rbi/context_dev/models/news_search_params.rbi @@ -0,0 +1,1294 @@ +# typed: strong + +module ContextDev + module Models + class NewsSearchParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(ContextDev::NewsSearchParams, ContextDev::Internal::AnyHash) + end + + # What to search for. + sig { returns(ContextDev::NewsSearchParams::SearchBy) } + attr_reader :search_by + + sig do + params(search_by: ContextDev::NewsSearchParams::SearchBy::OrHash).void + end + attr_writer :search_by + + # Opaque next_cursor from the previous response, or null for the first page. + sig { returns(T.nilable(String)) } + attr_accessor :cursor + + # Optional result filters. + sig { returns(T.nilable(ContextDev::NewsSearchParams::FilterBy)) } + attr_reader :filter_by + + sig do + params(filter_by: ContextDev::NewsSearchParams::FilterBy::OrHash).void + end + attr_writer :filter_by + + # Maximum results to return. Defaults to 10. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # Result ordering. Defaults to newest. + sig { returns(T.nilable(ContextDev::NewsSearchParams::SortBy)) } + attr_reader :sort_by + + sig { params(sort_by: ContextDev::NewsSearchParams::SortBy::OrHash).void } + attr_writer :sort_by + + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + sig do + params( + search_by: ContextDev::NewsSearchParams::SearchBy::OrHash, + cursor: T.nilable(String), + filter_by: ContextDev::NewsSearchParams::FilterBy::OrHash, + limit: Integer, + sort_by: ContextDev::NewsSearchParams::SortBy::OrHash, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # What to search for. + search_by:, + # Opaque next_cursor from the previous response, or null for the first page. + cursor: nil, + # Optional result filters. + filter_by: nil, + # Maximum results to return. Defaults to 10. + limit: nil, + # Result ordering. Defaults to newest. + sort_by: nil, + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + tags: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + search_by: ContextDev::NewsSearchParams::SearchBy, + cursor: T.nilable(String), + filter_by: ContextDev::NewsSearchParams::FilterBy, + limit: Integer, + sort_by: ContextDev::NewsSearchParams::SortBy, + tags: T::Array[String], + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + + class SearchBy < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy, + ContextDev::Internal::AnyHash + ) + end + + # The company to search news for, identified by name, domain, ticker, or ISIN. + sig do + returns( + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Name, + ContextDev::NewsSearchParams::SearchBy::Entity::Domain, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker, + ContextDev::NewsSearchParams::SearchBy::Entity::Isin + ) + ) + end + attr_accessor :entity + + # How to search. Only entity search is supported. + sig { returns(ContextDev::NewsSearchParams::SearchBy::Type::OrSymbol) } + attr_accessor :type + + # What to search for. + sig do + params( + entity: + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Name::OrHash, + ContextDev::NewsSearchParams::SearchBy::Entity::Domain::OrHash, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::OrHash, + ContextDev::NewsSearchParams::SearchBy::Entity::Isin::OrHash + ), + type: ContextDev::NewsSearchParams::SearchBy::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # The company to search news for, identified by name, domain, ticker, or ISIN. + entity:, + # How to search. Only entity search is supported. + type: + ) + end + + sig do + override.returns( + { + entity: + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Name, + ContextDev::NewsSearchParams::SearchBy::Entity::Domain, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker, + ContextDev::NewsSearchParams::SearchBy::Entity::Isin + ), + type: ContextDev::NewsSearchParams::SearchBy::Type::OrSymbol + } + ) + end + def to_hash + end + + # The company to search news for, identified by name, domain, ticker, or ISIN. + module Entity + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Name, + ContextDev::NewsSearchParams::SearchBy::Entity::Domain, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker, + ContextDev::NewsSearchParams::SearchBy::Entity::Isin + ) + end + + class Name < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Name, + ContextDev::Internal::AnyHash + ) + end + + # Company name. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # Identify the company by name. + sig { params(name: String, type: Symbol).returns(T.attached_class) } + def self.new( + # Company name. + name:, + type: :name + ) + end + + sig { override.returns({ name: String, type: Symbol }) } + def to_hash + end + end + + class Domain < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Domain, + ContextDev::Internal::AnyHash + ) + end + + # Company website domain, such as apple.com. + sig { returns(String) } + attr_accessor :domain + + sig { returns(Symbol) } + attr_accessor :type + + # Identify the company by website domain. + sig do + params(domain: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Company website domain, such as apple.com. + domain:, + type: :domain + ) + end + + sig { override.returns({ domain: String, type: Symbol }) } + def to_hash + end + end + + class Ticker < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker, + ContextDev::Internal::AnyHash + ) + end + + # Public-company ticker. + sig { returns(String) } + attr_accessor :ticker + + sig { returns(Symbol) } + attr_accessor :type + + # Stock exchange the ticker trades on, used to disambiguate tickers listed on + # multiple exchanges. + sig do + returns( + T.nilable( + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::OrSymbol + ) + ) + end + attr_reader :exchange + + sig do + params( + exchange: + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::OrSymbol + ).void + end + attr_writer :exchange + + # Identify the company by stock ticker, optionally scoped to an exchange. + sig do + params( + ticker: String, + exchange: + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::OrSymbol, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Public-company ticker. + ticker:, + # Stock exchange the ticker trades on, used to disambiguate tickers listed on + # multiple exchanges. + exchange: nil, + type: :ticker + ) + end + + sig do + override.returns( + { + ticker: String, + type: Symbol, + exchange: + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::OrSymbol + } + ) + end + def to_hash + end + + # Stock exchange the ticker trades on, used to disambiguate tickers listed on + # multiple exchanges. + module Exchange + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AMEX = + T.let( + :AMEX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + AMS = + T.let( + :AMS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + AQS = + T.let( + :AQS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + ASX = + T.let( + :ASX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + ATH = + T.let( + :ATH, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BER = + T.let( + :BER, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BME = + T.let( + :BME, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BRU = + T.let( + :BRU, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BSE = + T.let( + :BSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BUD = + T.let( + :BUD, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BUE = + T.let( + :BUE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + BVC = + T.let( + :BVC, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + CBOE = + T.let( + :CBOE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + CNQ = + T.let( + :CNQ, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + CPH = + T.let( + :CPH, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + DFM = + T.let( + :DFM, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + DOH = + T.let( + :DOH, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + DUB = + T.let( + :DUB, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + DUS = + T.let( + :DUS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + DXE = + T.let( + :DXE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + EGX = + T.let( + :EGX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + FSX = + T.let( + :FSX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + HAM = + T.let( + :HAM, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + HEL = + T.let( + :HEL, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + HKSE = + T.let( + :HKSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + HOSE = + T.let( + :HOSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + ICE = + T.let( + :ICE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + IOB = + T.let( + :IOB, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + IST = + T.let( + :IST, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + JKT = + T.let( + :JKT, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + JNB = + T.let( + :JNB, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + JPX = + T.let( + :JPX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + KLS = + T.let( + :KLS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + KOE = + T.let( + :KOE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + KSC = + T.let( + :KSC, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + KUW = + T.let( + :KUW, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + LIS = + T.let( + :LIS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + LSE = + T.let( + :LSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + MCX = + T.let( + :MCX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + MEX = + T.let( + :MEX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + MIL = + T.let( + :MIL, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + MUN = + T.let( + :MUN, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + NASDAQ = + T.let( + :NASDAQ, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + NEO = + T.let( + :NEO, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + NSE = + T.let( + :NSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + NYSE = + T.let( + :NYSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + NZE = + T.let( + :NZE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + OSL = + T.let( + :OSL, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + OTC = + T.let( + :OTC, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + PAR = + T.let( + :PAR, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + PNK = + T.let( + :PNK, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + PRA = + T.let( + :PRA, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + RIS = + T.let( + :RIS, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SAO = + T.let( + :SAO, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SAU = + T.let( + :SAU, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SES = + T.let( + :SES, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SET = + T.let( + :SET, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SGO = + T.let( + :SGO, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SHH = + T.let( + :SHH, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SHZ = + T.let( + :SHZ, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + SIX = + T.let( + :SIX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + STO = + T.let( + :STO, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + STU = + T.let( + :STU, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TAI = + T.let( + :TAI, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TAL = + T.let( + :TAL, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TLV = + T.let( + :TLV, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TSX = + T.let( + :TSX, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TSXV = + T.let( + :TSXV, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + TWO = + T.let( + :TWO, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + VIE = + T.let( + :VIE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + WSE = + T.let( + :WSE, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + XETRA = + T.let( + :XETRA, + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::NewsSearchParams::SearchBy::Entity::Ticker::Exchange::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Isin < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SearchBy::Entity::Isin, + ContextDev::Internal::AnyHash + ) + end + + # International Securities Identification Number. + sig { returns(String) } + attr_accessor :isin + + sig { returns(Symbol) } + attr_accessor :type + + # Identify the company by International Securities Identification Number. + sig { params(isin: String, type: Symbol).returns(T.attached_class) } + def self.new( + # International Securities Identification Number. + isin:, + type: :isin + ) + end + + sig { override.returns({ isin: String, type: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[ContextDev::NewsSearchParams::SearchBy::Entity::Variants] + ) + end + def self.variants + end + end + + # How to search. Only entity search is supported. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::NewsSearchParams::SearchBy::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ENTITY = + T.let( + :entity, + ContextDev::NewsSearchParams::SearchBy::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::NewsSearchParams::SearchBy::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class FilterBy < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::FilterBy, + ContextDev::Internal::AnyHash + ) + end + + # Article languages to include. Up to 3. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::OrSymbol + ] + ) + ) + end + attr_reader :article_language + + sig do + params( + article_language: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::OrSymbol + ] + ).void + end + attr_writer :article_language + + # Article types to include. Up to 3. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleType::OrSymbol + ] + ) + ) + end + attr_reader :article_type + + sig do + params( + article_type: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleType::OrSymbol + ] + ).void + end + attr_writer :article_type + + # Published-at window in epoch milliseconds. + sig { returns(T.nilable(ContextDev::NewsSearchParams::FilterBy::Date)) } + attr_reader :date + + sig do + params( + date: ContextDev::NewsSearchParams::FilterBy::Date::OrHash + ).void + end + attr_writer :date + + # Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::SourceCountry::OrSymbol + ] + ) + ) + end + attr_reader :source_country + + sig do + params( + source_country: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::SourceCountry::OrSymbol + ] + ).void + end + attr_writer :source_country + + # Publisher domains to include. Up to 3. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :source_domain + + sig { params(source_domain: T::Array[String]).void } + attr_writer :source_domain + + # Optional result filters. + sig do + params( + article_language: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::OrSymbol + ], + article_type: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleType::OrSymbol + ], + date: ContextDev::NewsSearchParams::FilterBy::Date::OrHash, + source_country: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::SourceCountry::OrSymbol + ], + source_domain: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # Article languages to include. Up to 3. + article_language: nil, + # Article types to include. Up to 3. + article_type: nil, + # Published-at window in epoch milliseconds. + date: nil, + # Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + source_country: nil, + # Publisher domains to include. Up to 3. + source_domain: nil + ) + end + + sig do + override.returns( + { + article_language: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::OrSymbol + ], + article_type: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleType::OrSymbol + ], + date: ContextDev::NewsSearchParams::FilterBy::Date, + source_country: + T::Array[ + ContextDev::NewsSearchParams::FilterBy::SourceCountry::OrSymbol + ], + source_domain: T::Array[String] + } + ) + end + def to_hash + end + + module ArticleLanguage + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AR = + T.let( + :ar, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + DE = + T.let( + :de, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + EN = + T.let( + :en, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + ES = + T.let( + :es, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + FR = + T.let( + :fr, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + HI = + T.let( + :hi, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + IT = + T.let( + :it, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + JA = + T.let( + :ja, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + KO = + T.let( + :ko, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + NL = + T.let( + :nl, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + PT = + T.let( + :pt, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + RU = + T.let( + :ru, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + ZH = + T.let( + :zh, + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleLanguage::TaggedSymbol + ] + ) + end + def self.values + end + end + + module ArticleType + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::NewsSearchParams::FilterBy::ArticleType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EDITORIAL = + T.let( + :editorial, + ContextDev::NewsSearchParams::FilterBy::ArticleType::TaggedSymbol + ) + PRESS_RELEASE = + T.let( + :press_release, + ContextDev::NewsSearchParams::FilterBy::ArticleType::TaggedSymbol + ) + REGULATORY_FILING = + T.let( + :regulatory_filing, + ContextDev::NewsSearchParams::FilterBy::ArticleType::TaggedSymbol + ) + ADVISORY = + T.let( + :advisory, + ContextDev::NewsSearchParams::FilterBy::ArticleType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::ArticleType::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Date < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::FilterBy::Date, + ContextDev::Internal::AnyHash + ) + end + + # Inclusive start of the published-at window, in epoch milliseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :from + + sig { params(from: Integer).void } + attr_writer :from + + # Inclusive end of the published-at window, in epoch milliseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :to + + sig { params(to: Integer).void } + attr_writer :to + + # Published-at window in epoch milliseconds. + sig { params(from: Integer, to: Integer).returns(T.attached_class) } + def self.new( + # Inclusive start of the published-at window, in epoch milliseconds. + from: nil, + # Inclusive end of the published-at window, in epoch milliseconds. + to: nil + ) + end + + sig { override.returns({ from: Integer, to: Integer }) } + def to_hash + end + end + + module SourceCountry + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::NewsSearchParams::FilterBy::SourceCountry + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AE = + T.let( + :ae, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + AR = + T.let( + :ar, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + AU = + T.let( + :au, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + CA = + T.let( + :ca, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + CG = + T.let( + :cg, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + CH = + T.let( + :ch, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + CL = + T.let( + :cl, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + DE = + T.let( + :de, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + FI = + T.let( + :fi, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + FR = + T.let( + :fr, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + GB = + T.let( + :gb, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + HK = + T.let( + :hk, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + IL = + T.let( + :il, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + IN = + T.let( + :in, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + JP = + T.let( + :jp, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + KR = + T.let( + :kr, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + MX = + T.let( + :mx, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + NG = + T.let( + :ng, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + NL = + T.let( + :nl, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + QA = + T.let( + :qa, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + SA = + T.let( + :sa, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + SE = + T.let( + :se, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + SG = + T.let( + :sg, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + US = + T.let( + :us, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + ZA = + T.let( + :za, + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::NewsSearchParams::FilterBy::SourceCountry::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class SortBy < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::NewsSearchParams::SortBy, + ContextDev::Internal::AnyHash + ) + end + + # Result ordering. + sig { returns(ContextDev::NewsSearchParams::SortBy::Type::OrSymbol) } + attr_accessor :type + + # Result ordering. Defaults to newest. + sig do + params( + type: ContextDev::NewsSearchParams::SortBy::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Result ordering. + type: + ) + end + + sig do + override.returns( + { type: ContextDev::NewsSearchParams::SortBy::Type::OrSymbol } + ) + end + def to_hash + end + + # Result ordering. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::NewsSearchParams::SortBy::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + RELEVANCE = + T.let( + :relevance, + ContextDev::NewsSearchParams::SortBy::Type::TaggedSymbol + ) + NEWEST = + T.let( + :newest, + ContextDev::NewsSearchParams::SortBy::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ContextDev::NewsSearchParams::SortBy::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/context_dev/models/news_search_response.rbi b/rbi/context_dev/models/news_search_response.rbi new file mode 100644 index 00000000..76051bbf --- /dev/null +++ b/rbi/context_dev/models/news_search_response.rbi @@ -0,0 +1,423 @@ +# typed: strong + +module ContextDev + module Models + class NewsSearchResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(T::Array[ContextDev::Models::NewsSearchResponse::Data]) } + attr_accessor :data + + sig { returns(T::Boolean) } + attr_accessor :has_more + + sig { returns(ContextDev::Models::NewsSearchResponse::Meta) } + attr_reader :meta + + sig do + params(meta: ContextDev::Models::NewsSearchResponse::Meta::OrHash).void + end + attr_writer :meta + + sig { returns(T.nilable(String)) } + attr_accessor :next_cursor + + # Metadata about the API key used for the request. Included in every response + # whenever a valid API key is provided, even when the response status is not 200. + sig do + returns(T.nilable(ContextDev::Models::NewsSearchResponse::KeyMetadata)) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::NewsSearchResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + sig do + params( + data: T::Array[ContextDev::Models::NewsSearchResponse::Data::OrHash], + has_more: T::Boolean, + meta: ContextDev::Models::NewsSearchResponse::Meta::OrHash, + next_cursor: T.nilable(String), + key_metadata: + ContextDev::Models::NewsSearchResponse::KeyMetadata::OrHash + ).returns(T.attached_class) + end + def self.new( + data:, + has_more:, + meta:, + next_cursor:, + # Metadata about the API key used for the request. Included in every response + # whenever a valid API key is provided, even when the response status is not 200. + key_metadata: nil + ) + end + + sig do + override.returns( + { + data: T::Array[ContextDev::Models::NewsSearchResponse::Data], + has_more: T::Boolean, + meta: ContextDev::Models::NewsSearchResponse::Meta, + next_cursor: T.nilable(String), + key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata + } + ) + end + def to_hash + end + + class Data < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse::Data, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig { returns(T::Array[String]) } + attr_accessor :authors + + sig { returns(T.nilable(String)) } + attr_accessor :description + + sig { returns(T.nilable(String)) } + attr_accessor :image_url + + sig { returns(T.nilable(String)) } + attr_accessor :language + + sig { returns(ContextDev::Models::NewsSearchResponse::Data::Match) } + attr_reader :match + + sig do + params( + match: ContextDev::Models::NewsSearchResponse::Data::Match::OrHash + ).void + end + attr_writer :match + + sig { returns(T.nilable(Time)) } + attr_accessor :published_at + + sig { returns(ContextDev::Models::NewsSearchResponse::Data::Source) } + attr_reader :source + + sig do + params( + source: ContextDev::Models::NewsSearchResponse::Data::Source::OrHash + ).void + end + attr_writer :source + + # Groups matching normalized headlines published on the same UTC day. + sig { returns(String) } + attr_accessor :story_id + + sig { returns(String) } + attr_accessor :title + + sig do + returns( + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ) + end + attr_accessor :type + + sig { returns(String) } + attr_accessor :url + + sig do + params( + id: String, + authors: T::Array[String], + description: T.nilable(String), + image_url: T.nilable(String), + language: T.nilable(String), + match: ContextDev::Models::NewsSearchResponse::Data::Match::OrHash, + published_at: T.nilable(Time), + source: + ContextDev::Models::NewsSearchResponse::Data::Source::OrHash, + story_id: String, + title: String, + type: ContextDev::Models::NewsSearchResponse::Data::Type::OrSymbol, + url: String + ).returns(T.attached_class) + end + def self.new( + id:, + authors:, + description:, + image_url:, + language:, + match:, + published_at:, + source:, + # Groups matching normalized headlines published on the same UTC day. + story_id:, + title:, + type:, + url: + ) + end + + sig do + override.returns( + { + id: String, + authors: T::Array[String], + description: T.nilable(String), + image_url: T.nilable(String), + language: T.nilable(String), + match: ContextDev::Models::NewsSearchResponse::Data::Match, + published_at: T.nilable(Time), + source: ContextDev::Models::NewsSearchResponse::Data::Source, + story_id: String, + title: String, + type: + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol, + url: String + } + ) + end + def to_hash + end + + class Match < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse::Data::Match, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Float)) } + attr_accessor :confidence + + sig do + returns( + ContextDev::Models::NewsSearchResponse::Data::Match::Level::TaggedSymbol + ) + end + attr_accessor :level + + sig do + params( + confidence: T.nilable(Float), + level: + ContextDev::Models::NewsSearchResponse::Data::Match::Level::OrSymbol + ).returns(T.attached_class) + end + def self.new(confidence:, level:) + end + + sig do + override.returns( + { + confidence: T.nilable(Float), + level: + ContextDev::Models::NewsSearchResponse::Data::Match::Level::TaggedSymbol + } + ) + end + def to_hash + end + + module Level + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::NewsSearchResponse::Data::Match::Level + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIMARY = + T.let( + :primary, + ContextDev::Models::NewsSearchResponse::Data::Match::Level::TaggedSymbol + ) + SECONDARY = + T.let( + :secondary, + ContextDev::Models::NewsSearchResponse::Data::Match::Level::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::NewsSearchResponse::Data::Match::Level::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Source < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse::Data::Source, + ContextDev::Internal::AnyHash + ) + end + + # True when Context observed this article in the publisher-owned feed. + sig { returns(T::Boolean) } + attr_accessor :direct + + sig { returns(String) } + attr_accessor :domain + + sig { returns(String) } + attr_accessor :name + + sig do + params(direct: T::Boolean, domain: String, name: String).returns( + T.attached_class + ) + end + def self.new( + # True when Context observed this article in the publisher-owned feed. + direct:, + domain:, + name: + ) + end + + sig do + override.returns( + { direct: T::Boolean, domain: String, name: String } + ) + end + def to_hash + end + end + + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::NewsSearchResponse::Data::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EDITORIAL = + T.let( + :editorial, + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ) + PRESS_RELEASE = + T.let( + :press_release, + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ) + REGULATORY_FILING = + T.let( + :regulatory_filing, + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ) + ADVISORY = + T.let( + :advisory, + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::NewsSearchResponse::Data::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Meta < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse::Meta, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(Integer) } + attr_accessor :count + + sig { params(count: Integer).returns(T.attached_class) } + def self.new(count:) + end + + sig { override.returns({ count: Integer }) } + def to_hash + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::NewsSearchResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # Metadata about the API key used for the request. Included in every response + # whenever a valid API key is provided, even when the response status is not 200. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/parse_handle_params.rbi b/rbi/context_dev/models/parse_handle_params.rbi index effe0182..20c984c6 100644 --- a/rbi/context_dev/models/parse_handle_params.rbi +++ b/rbi/context_dev/models/parse_handle_params.rbi @@ -36,51 +36,17 @@ module ContextDev attr_writer :extension # Include image references in Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_images - sig do - params( - include_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::OrSymbol - ) - ).void - end + sig { params(include_images: T::Boolean).void } attr_writer :include_images # Preserve hyperlinks in Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_links - sig do - params( - include_links: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::OrSymbol - ) - ).void - end + sig { params(include_links: T::Boolean).void } attr_writer :include_links # When true for PDF inputs, OCR the selected pages that have no usable text layer @@ -88,20 +54,10 @@ module ContextDev # with a real text layer keep it. pdf.start/pdf.end limit the inclusive page # range. Billed at 1 credit per page OCR actually recovered, on top of the base # request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. @@ -112,27 +68,10 @@ module ContextDev attr_writer :pdf # Shorten base64-encoded image data in the Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :shorten_base64_images - sig do - params( - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol - ) - ).void - end + sig { params(shorten_base64_images: T::Boolean).void } attr_writer :shorten_base64_images # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -145,27 +84,10 @@ module ContextDev attr_writer :tags # Extract only the main content from HTML-like inputs - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :use_main_content_only - sig do - params( - use_main_content_only: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol - ) - ).void - end + sig { params(use_main_content_only: T::Boolean).void } attr_writer :use_main_content_only # Set to enabled to bypass shared caches and omit request and response content @@ -183,29 +105,13 @@ module ContextDev body: ContextDev::Internal::FileInput, client: String, extension: ContextDev::ParseHandleParams::Extension::OrSymbol, - include_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::OrSymbol - ), - ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol), + include_images: T::Boolean, + include_links: T::Boolean, + ocr: T::Boolean, pdf: ContextDev::ParseHandleParams::Pdf::OrHash, - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol - ), + shorten_base64_images: T::Boolean, tags: T::Array[String], - use_main_content_only: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) @@ -252,30 +158,13 @@ module ContextDev body: ContextDev::Internal::FileInput, client: String, extension: ContextDev::ParseHandleParams::Extension::OrSymbol, - include_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::OrSymbol - ), - ocr: - T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol), + include_images: T::Boolean, + include_links: T::Boolean, + ocr: T::Boolean, pdf: ContextDev::ParseHandleParams::Pdf, - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol - ), + shorten_base64_images: T::Boolean, tags: T::Array[String], - use_main_content_only: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions } @@ -442,111 +331,6 @@ module ContextDev end end - # Include image references in Markdown output - module IncludeImages - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::ParseHandleParams::IncludeImages::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::ParseHandleParams::IncludeImages) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol - ) - end - - # Preserve hyperlinks in Markdown output - module IncludeLinks - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::ParseHandleParams::IncludeLinks::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::ParseHandleParams::IncludeLinks) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol - ) - end - - # When true for PDF inputs, OCR the selected pages that have no usable text layer - # (scans), replacing each recovered page's text with the OCR result while pages - # with a real text layer keep it. pdf.start/pdf.end limit the inclusive page - # range. Billed at 1 credit per page OCR actually recovered, on top of the base - # request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::TaggedSymbol) - end - - sig do - override.returns( - T::Array[ContextDev::ParseHandleParams::Ocr::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias { T.all(Symbol, ContextDev::ParseHandleParams::Ocr) } - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = T.let(:true, ContextDev::ParseHandleParams::Ocr::TaggedSymbol) - FALSE = T.let(:false, ContextDev::ParseHandleParams::Ocr::TaggedSymbol) - end - class Pdf < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do @@ -587,86 +371,6 @@ module ContextDev end end - # Shorten base64-encoded image data in the Markdown output - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::ParseHandleParams::ShortenBase64Images::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::ParseHandleParams::ShortenBase64Images) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol - ) - end - - # Extract only the main content from HTML-like inputs - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::ParseHandleParams::UseMainContentOnly::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::ParseHandleParams::UseMainContentOnly) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol - ) - end - # Set to enabled to bypass shared caches and omit request and response content # from retained usage logs. Requires zero data retention to be enabled for your # organization (contact support@context.dev), otherwise the request fails with diff --git a/rbi/context_dev/models/person_enrich_response.rbi b/rbi/context_dev/models/person_enrich_response.rbi index 0581a48f..5430de73 100644 --- a/rbi/context_dev/models/person_enrich_response.rbi +++ b/rbi/context_dev/models/person_enrich_response.rbi @@ -139,6 +139,17 @@ module ContextDev ) end + # Whether the person's current role is known. `present` — current_role is + # populated. `none` — the work history explicitly shows every role has ended. + # `unknown` — our data sources could not confirm either way; treat a missing + # current_role as unverified rather than vacant. + sig do + returns( + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol + ) + end + attr_accessor :current_role_status + sig do returns( T::Array[ @@ -178,6 +189,13 @@ module ContextDev sig { params(bio: String).void } attr_writer :bio + # When we last refreshed this profile from our data sources (ISO 8601). + sig { returns(T.nilable(String)) } + attr_reader :checked_at + + sig { params(checked_at: String).void } + attr_writer :checked_at + sig do returns( T.nilable( @@ -201,6 +219,14 @@ module ContextDev sig { params(email: String).void } attr_writer :email + # When the underlying profile data last changed in our data sources (ISO 8601). + # Omitted when unknown. + sig { returns(T.nilable(String)) } + attr_reader :last_updated + + sig { params(last_updated: String).void } + attr_writer :last_updated + sig do returns( T.nilable( @@ -237,6 +263,8 @@ module ContextDev sig do params( + current_role_status: + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::OrSymbol, education: T::Array[ ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education::OrHash @@ -250,9 +278,11 @@ module ContextDev website_urls: T::Array[String], avatar_url: String, bio: String, + checked_at: String, current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole::OrHash, email: String, + last_updated: String, location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location::OrHash, name: @@ -260,6 +290,11 @@ module ContextDev ).returns(T.attached_class) end def self.new( + # Whether the person's current role is known. `present` — current_role is + # populated. `none` — the work history explicitly shows every role has ended. + # `unknown` — our data sources could not confirm either way; treat a missing + # current_role as unverified rather than vacant. + current_role_status:, education:, experience:, skills:, @@ -267,8 +302,13 @@ module ContextDev website_urls:, avatar_url: nil, bio: nil, + # When we last refreshed this profile from our data sources (ISO 8601). + checked_at: nil, current_role: nil, email: nil, + # When the underlying profile data last changed in our data sources (ISO 8601). + # Omitted when unknown. + last_updated: nil, location: nil, name: nil ) @@ -277,6 +317,8 @@ module ContextDev sig do override.returns( { + current_role_status: + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol, education: T::Array[ ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education @@ -290,9 +332,11 @@ module ContextDev website_urls: T::Array[String], avatar_url: String, bio: String, + checked_at: String, current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole, email: String, + last_updated: String, location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location, name: @@ -303,6 +347,49 @@ module ContextDev def to_hash end + # Whether the person's current role is known. `present` — current_role is + # populated. `none` — the work history explicitly shows every role has ended. + # `unknown` — our data sources could not confirm either way; treat a missing + # current_role as unverified rather than vacant. + module CurrentRoleStatus + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRESENT = + T.let( + :present, + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol + ) + NONE = + T.let( + :none, + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol + ) + UNKNOWN = + T.let( + :unknown, + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRoleStatus::TaggedSymbol + ] + ) + end + def self.values + end + end + class Education < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/utility_prefetch_params.rbi b/rbi/context_dev/models/utility_prefetch_params.rbi index fd5ed61f..a91dc175 100644 --- a/rbi/context_dev/models/utility_prefetch_params.rbi +++ b/rbi/context_dev/models/utility_prefetch_params.rbi @@ -14,7 +14,7 @@ module ContextDev ) end - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. sig do returns( T.any( @@ -25,7 +25,8 @@ module ContextDev end attr_accessor :identifier - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. sig { returns(ContextDev::UtilityPrefetchParams::Type::OrSymbol) } attr_accessor :type @@ -59,9 +60,10 @@ module ContextDev ).returns(T.attached_class) end def self.new( - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. identifier:, - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. type:, # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. tags: nil, @@ -91,7 +93,7 @@ module ContextDev def to_hash end - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. module Identifier extend ContextDev::Internal::Type::Union @@ -112,14 +114,14 @@ module ContextDev ) end - # Domain name to prefetch brand data for + # Domain name to prefetch data for sig { returns(String) } attr_accessor :domain - # Prefetch brand data by domain. + # Prefetch by domain. sig { params(domain: String).returns(T.attached_class) } def self.new( - # Domain name to prefetch brand data for + # Domain name to prefetch data for domain: ) end @@ -138,18 +140,18 @@ module ContextDev ) end - # Email address to prefetch brand data for. The domain will be extracted from the - # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email - # addresses are not allowed. + # Email address to prefetch data for. The domain will be extracted from the email. + # Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses + # are not allowed. sig { returns(String) } attr_accessor :email - # Prefetch brand data by email. The domain will be extracted and validated. + # Prefetch by email. The domain will be extracted and validated. sig { params(email: String).returns(T.attached_class) } def self.new( - # Email address to prefetch brand data for. The domain will be extracted from the - # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email - # addresses are not allowed. + # Email address to prefetch data for. The domain will be extracted from the email. + # Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses + # are not allowed. email: ) end @@ -168,7 +170,8 @@ module ContextDev end end - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. module Type extend ContextDev::Internal::Type::Enum @@ -180,6 +183,11 @@ module ContextDev BRAND = T.let(:brand, ContextDev::UtilityPrefetchParams::Type::TaggedSymbol) + STYLEGUIDE = + T.let( + :styleguide, + ContextDev::UtilityPrefetchParams::Type::TaggedSymbol + ) sig do override.returns( diff --git a/rbi/context_dev/models/utility_prefetch_response.rbi b/rbi/context_dev/models/utility_prefetch_response.rbi index 964c1064..ad57cde1 100644 --- a/rbi/context_dev/models/utility_prefetch_response.rbi +++ b/rbi/context_dev/models/utility_prefetch_response.rbi @@ -49,8 +49,7 @@ module ContextDev sig { params(status: String).void } attr_writer :status - # The type of prefetch that was queued, echoed from the request (currently always - # 'brand') + # The type of prefetch that was queued, echoed from the request sig do returns( T.nilable( @@ -87,8 +86,7 @@ module ContextDev message: nil, # Status of the response, e.g., 'ok' status: nil, - # The type of prefetch that was queued, echoed from the request (currently always - # 'brand') + # The type of prefetch that was queued, echoed from the request type: nil ) end @@ -150,8 +148,7 @@ module ContextDev end end - # The type of prefetch that was queued, echoed from the request (currently always - # 'brand') + # The type of prefetch that was queued, echoed from the request module Type extend ContextDev::Internal::Type::Enum @@ -166,6 +163,11 @@ module ContextDev :brand, ContextDev::Models::UtilityPrefetchResponse::Type::TaggedSymbol ) + STYLEGUIDE = + T.let( + :styleguide, + ContextDev::Models::UtilityPrefetchResponse::Type::TaggedSymbol + ) sig do override.returns( diff --git a/rbi/context_dev/models/web_screenshot_params.rbi b/rbi/context_dev/models/web_screenshot_params.rbi index 1cd42779..45c117be 100644 --- a/rbi/context_dev/models/web_screenshot_params.rbi +++ b/rbi/context_dev/models/web_screenshot_params.rbi @@ -78,27 +78,10 @@ module ContextDev # Optional parameter to control cookie/consent popup handling. If 'true', we # dismiss cookie banner before capture. If 'false' or not provided, captures the # page without that step. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :handle_cookie_popup - sig do - params( - handle_cookie_popup: - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol - ) - ).void - end + sig { params(handle_cookie_popup: T::Boolean).void } attr_writer :handle_cookie_popup # Return a cached screenshot if a prior screenshot for the same parameters exists @@ -180,11 +163,7 @@ module ContextDev domain: String, full_screenshot: ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, - handle_cookie_popup: - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol - ), + handle_cookie_popup: T::Boolean, max_age_ms: T.nilable(Integer), page: ContextDev::WebScreenshotParams::Page::OrSymbol, scroll_offset: T.nilable(Integer), @@ -269,11 +248,7 @@ module ContextDev domain: String, full_screenshot: ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, - handle_cookie_popup: - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol - ), + handle_cookie_popup: T::Boolean, max_age_ms: T.nilable(Integer), page: ContextDev::WebScreenshotParams::Page::OrSymbol, scroll_offset: T.nilable(Integer), @@ -579,48 +554,6 @@ module ContextDev end end - # Optional parameter to control cookie/consent popup handling. If 'true', we - # dismiss cookie banner before capture. If 'false' or not provided, captures the - # page without that step. - module HandleCookiePopup - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebScreenshotParams::HandleCookiePopup::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebScreenshotParams::HandleCookiePopup) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebScreenshotParams::HandleCookiePopup::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebScreenshotParams::HandleCookiePopup::TaggedSymbol - ) - end - # Optional parameter to specify which page type to screenshot. If provided, the # system will scrape the domain's links and use heuristics to find the most # appropriate URL for the specified page type (30 supported languages). If not diff --git a/rbi/context_dev/models/web_web_crawl_md_response.rbi b/rbi/context_dev/models/web_web_crawl_md_response.rbi index 91d63215..804d3c35 100644 --- a/rbi/context_dev/models/web_web_crawl_md_response.rbi +++ b/rbi/context_dev/models/web_web_crawl_md_response.rbi @@ -307,6 +307,29 @@ module ContextDev sig { params(favicon: String).void } attr_writer :favicon + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading + ] + ) + ) + end + attr_reader :headings + + sig do + params( + headings: + T::Array[ + ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading::OrHash + ] + ).void + end + attr_writer :headings + # Primary resolved preview image from Open Graph, Twitter, or image metadata. sig { returns(T.nilable(String)) } attr_reader :image @@ -433,6 +456,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading::OrHash + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -481,6 +508,9 @@ module ContextDev description: nil, # Resolved favicon URL, when present. favicon: nil, + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + headings: nil, # Primary resolved preview image from Open Graph, Twitter, or image metadata. image: nil, # JSON-LD structured data blocks parsed from the page. @@ -527,6 +557,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -636,6 +670,39 @@ module ContextDev end end + class Heading < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading, + ContextDev::Internal::AnyHash + ) + end + + # Heading level, 1–6 (from h1–h6). + sig { returns(Integer) } + attr_accessor :level + + # Heading text with whitespace collapsed, truncated to 1000 characters. + sig { returns(String) } + attr_accessor :text + + sig do + params(level: Integer, text: String).returns(T.attached_class) + end + def self.new( + # Heading level, 1–6 (from h1–h6). + level:, + # Heading text with whitespace collapsed, truncated to 1000 characters. + text: + ) + end + + sig { override.returns({ level: Integer, text: String }) } + def to_hash + end + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/rbi/context_dev/models/web_web_scrape_html_params.rbi b/rbi/context_dev/models/web_web_scrape_html_params.rbi index e322e905..32aff419 100644 --- a/rbi/context_dev/models/web_web_scrape_html_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_html_params.rbi @@ -67,27 +67,10 @@ module ContextDev attr_writer :headers # When true, iframes are rendered inline into the returned HTML. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_frames - sig do - params( - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol - ) - ).void - end + sig { params(include_frames: T::Boolean).void } attr_writer :include_frames # CSS selectors. When provided, only matching subtrees (and their descendants) are @@ -113,27 +96,10 @@ module ContextDev # When true, waits briefly for CSS and transition animations to settle before # extracting HTML. Defaults to false. This adds a bit of latency in exchange for # more stable output on animated pages. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :settle_animations - sig do - params( - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol - ) - ).void - end + sig { params(settle_animations: T::Boolean).void } attr_writer :settle_animations # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -156,27 +122,10 @@ module ContextDev # When true, return only the page's main content in the HTML response, excluding # headers, footers, sidebars, and navigation when detectable. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :use_main_content_only - sig do - params( - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol - ) - ).void - end + sig { params(use_main_content_only: T::Boolean).void } attr_writer :use_main_content_only # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: @@ -213,26 +162,14 @@ module ContextDev country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol - ), + include_frames: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeHTMLParams::Pdf::OrHash, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol - ), + settle_animations: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash @@ -312,26 +249,14 @@ module ContextDev country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol - ), + include_frames: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeHTMLParams::Pdf, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol - ), + settle_animations: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions @@ -844,46 +769,6 @@ module ContextDev end end - # When true, iframes are rendered inline into the returned HTML. - module IncludeFrames - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::IncludeFrames) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::TaggedSymbol - ) - end - class Pdf < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do @@ -905,52 +790,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -965,16 +816,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -999,193 +842,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeHTMLParams::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeHTMLParams::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # When true, waits briefly for CSS and transition animations to settle before - # extracting HTML. Defaults to false. This adds a bit of latency in exchange for - # more stable output on animated pages. - module SettleAnimations - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeHTMLParams::SettleAnimations) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::TaggedSymbol - ) - end - - # When true, return only the page's main content in the HTML response, excluding - # headers, footers, sidebars, and navigation when detectable. - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::TaggedSymbol - ) end # Set to enabled to bypass shared caches and omit request and response content diff --git a/rbi/context_dev/models/web_web_scrape_html_response.rbi b/rbi/context_dev/models/web_web_scrape_html_response.rbi index 2ccd098d..f45d6659 100644 --- a/rbi/context_dev/models/web_web_scrape_html_response.rbi +++ b/rbi/context_dev/models/web_web_scrape_html_response.rbi @@ -259,6 +259,29 @@ module ContextDev sig { params(favicon: String).void } attr_writer :favicon + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading + ] + ) + ) + end + attr_reader :headings + + sig do + params( + headings: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading::OrHash + ] + ).void + end + attr_writer :headings + # Primary resolved preview image from Open Graph, Twitter, or image metadata. sig { returns(T.nilable(String)) } attr_reader :image @@ -388,6 +411,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading::OrHash + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -427,6 +454,9 @@ module ContextDev description: nil, # Resolved favicon URL, when present. favicon: nil, + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + headings: nil, # Primary resolved preview image from Open Graph, Twitter, or image metadata. image: nil, # JSON-LD structured data blocks parsed from the page. @@ -470,6 +500,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -580,6 +614,37 @@ module ContextDev end end + class Heading < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading, + ContextDev::Internal::AnyHash + ) + end + + # Heading level, 1–6 (from h1–h6). + sig { returns(Integer) } + attr_accessor :level + + # Heading text with whitespace collapsed, truncated to 1000 characters. + sig { returns(String) } + attr_accessor :text + + sig { params(level: Integer, text: String).returns(T.attached_class) } + def self.new( + # Heading level, 1–6 (from h1–h6). + level:, + # Heading text with whitespace collapsed, truncated to 1000 characters. + text: + ) + end + + sig { override.returns({ level: Integer, text: String }) } + def to_hash + end + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/rbi/context_dev/models/web_web_scrape_images_params.rbi b/rbi/context_dev/models/web_web_scrape_images_params.rbi index 8ca13d87..0fa5f0a6 100644 --- a/rbi/context_dev/models/web_web_scrape_images_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_images_params.rbi @@ -39,27 +39,10 @@ module ContextDev # perceptually hashed, and only the highest-resolution copy of each duplicate # group is kept. Images that cannot be downloaded or hashed are kept. Default: # false. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :dedupe - sig do - params( - dedupe: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol - ) - ).void - end + sig { params(dedupe: T::Boolean).void } attr_writer :dedupe # Optional per-image processing, sent as deep-object query params such as @@ -126,11 +109,7 @@ module ContextDev ) ] ), - dedupe: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol - ), + dedupe: T::Boolean, enrichment: T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash), headers: T::Hash[Symbol, String], @@ -191,11 +170,7 @@ module ContextDev ) ] ), - dedupe: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol - ), + dedupe: T::Boolean, enrichment: T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment), headers: T::Hash[Symbol, String], @@ -284,47 +259,6 @@ module ContextDev end end - # When true, visually duplicate images are removed: every image is loaded and - # perceptually hashed, and only the highest-resolution copy of each duplicate - # group is kept. Images that cannot be downloaded or hashed are kept. Default: - # false. - module Dedupe - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeImagesParams::Dedupe::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeImagesParams::Dedupe) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeImagesParams::Dedupe::TaggedSymbol - ) - end - class Enrichment < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do @@ -335,52 +269,18 @@ module ContextDev end # Classify each image by visual asset type. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :classification - sig do - params( - classification: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol - ) - ).void - end + sig { params(classification: T::Boolean).void } attr_writer :classification # Host materializable images on the Brand.dev CDN and return their URL and MIME # type. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :hosted_url - sig do - params( - hosted_url: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol - ) - ).void - end + sig { params(hosted_url: T::Boolean).void } attr_writer :hosted_url # Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000. @@ -391,49 +291,20 @@ module ContextDev attr_writer :max_time_per_ms # Measure image width and height when possible. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :resolution - sig do - params( - resolution: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol - ) - ).void - end + sig { params(resolution: T::Boolean).void } attr_writer :resolution # Optional per-image processing, sent as deep-object query params such as # enrichment[resolution]=true. sig do params( - classification: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol - ), - hosted_url: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol - ), + classification: T::Boolean, + hosted_url: T::Boolean, max_time_per_ms: Integer, - resolution: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol - ) + resolution: T::Boolean ).returns(T.attached_class) end def self.new( @@ -452,157 +323,15 @@ module ContextDev sig do override.returns( { - classification: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::OrSymbol - ), - hosted_url: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::OrSymbol - ), + classification: T::Boolean, + hosted_url: T::Boolean, max_time_per_ms: Integer, - resolution: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::OrSymbol - ) + resolution: T::Boolean } ) end def to_hash end - - # Classify each image by visual asset type. - module Classification - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeImagesParams::Enrichment::Classification::TaggedSymbol - ) - end - - # Host materializable images on the Brand.dev CDN and return their URL and MIME - # type. - module HostedURL - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeImagesParams::Enrichment::HostedURL::TaggedSymbol - ) - end - - # Measure image width and height when possible. - module Resolution - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeImagesParams::Enrichment::Resolution::TaggedSymbol - ) - end end end end diff --git a/rbi/context_dev/models/web_web_scrape_md_params.rbi b/rbi/context_dev/models/web_web_scrape_md_params.rbi index cca31afc..0ff34b7a 100644 --- a/rbi/context_dev/models/web_web_scrape_md_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_md_params.rbi @@ -63,75 +63,33 @@ module ContextDev attr_writer :headers # When true, the contents of iframes are rendered to Markdown. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_frames - sig do - params( - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol - ) - ).void - end + sig { params(include_frames: T::Boolean).void } attr_writer :include_frames + # When true, the response also includes an `html` field with the page HTML the + # Markdown was converted from — the same body the Scrape HTML endpoint returns for + # the equivalent request. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_html + + sig { params(include_html: T::Boolean).void } + attr_writer :include_html + # Include image references in Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_images - sig do - params( - include_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol - ) - ).void - end + sig { params(include_images: T::Boolean).void } attr_writer :include_images # Preserve hyperlinks in Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :include_links - sig do - params( - include_links: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol - ) - ).void - end + sig { params(include_links: T::Boolean).void } attr_writer :include_links # CSS selectors. When provided, only matching HTML subtrees (and their @@ -157,51 +115,17 @@ module ContextDev # When true, waits briefly for CSS and transition animations to settle before # converting to Markdown. Defaults to false. This adds a bit of latency in # exchange for more stable output on animated pages. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :settle_animations - sig do - params( - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol - ) - ).void - end + sig { params(settle_animations: T::Boolean).void } attr_writer :settle_animations # Shorten base64-encoded image data in the Markdown output - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :shorten_base64_images - sig do - params( - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol - ) - ).void - end + sig { params(shorten_base64_images: T::Boolean).void } attr_writer :shorten_base64_images # Optional comma-separated caller-defined tags for tracking this request. Tags are @@ -224,27 +148,10 @@ module ContextDev # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :use_main_content_only - sig do - params( - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol - ) - ).void - end + sig { params(use_main_content_only: T::Boolean).void } attr_writer :use_main_content_only # Optional browser wait time in milliseconds after initial page load before @@ -279,41 +186,18 @@ module ContextDev country: ContextDev::WebWebScrapeMdParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol - ), - include_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol - ), + include_frames: T::Boolean, + include_html: T::Boolean, + include_images: T::Boolean, + include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeMdParams::Pdf::OrHash, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol - ), - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol - ), + settle_animations: T::Boolean, + shorten_base64_images: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeMdParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash @@ -340,6 +224,10 @@ module ContextDev headers: nil, # When true, the contents of iframes are rendered to Markdown. include_frames: nil, + # When true, the response also includes an `html` field with the page HTML the + # Markdown was converted from — the same body the Scrape HTML endpoint returns for + # the equivalent request. + include_html: nil, # Include image references in Markdown output include_images: nil, # Preserve hyperlinks in Markdown output @@ -400,41 +288,18 @@ module ContextDev country: ContextDev::WebWebScrapeMdParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol - ), - include_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol - ), + include_frames: T::Boolean, + include_html: T::Boolean, + include_images: T::Boolean, + include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeMdParams::Pdf, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol - ), - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol - ), + settle_animations: T::Boolean, + shorten_base64_images: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeMdParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions @@ -743,120 +608,6 @@ module ContextDev end end - # When true, the contents of iframes are rendered to Markdown. - module IncludeFrames - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeMdParams::IncludeFrames::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::IncludeFrames) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::IncludeFrames::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::IncludeFrames::TaggedSymbol - ) - end - - # Include image references in Markdown output - module IncludeImages - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeMdParams::IncludeImages::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::IncludeImages) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::IncludeImages::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::IncludeImages::TaggedSymbol - ) - end - - # Preserve hyperlinks in Markdown output - module IncludeLinks - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeMdParams::IncludeLinks::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::IncludeLinks) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::IncludeLinks::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::IncludeLinks::TaggedSymbol - ) - end - class Pdf < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do @@ -878,52 +629,18 @@ module ContextDev # replacing each recovered page's text with the OCR result while pages with a real # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top # of the base request cost. When false, no OCR runs. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :ocr - sig do - params( - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::OrSymbol - ) - ).void - end + sig { params(ocr: T::Boolean).void } attr_writer :ocr # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and # a 400 PDF_SKIPPED is returned. - sig do - returns( - T.nilable( - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::OrSymbol - ) - ) - ) - end + sig { returns(T.nilable(T::Boolean)) } attr_reader :should_parse - sig do - params( - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::OrSymbol - ) - ).void - end + sig { params(should_parse: T::Boolean).void } attr_writer :should_parse # First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -938,16 +655,8 @@ module ContextDev sig do params( end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer ).returns(T.attached_class) end @@ -972,227 +681,14 @@ module ContextDev override.returns( { end_: Integer, - ocr: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::OrSymbol - ), - should_parse: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::OrSymbol - ), + ocr: T::Boolean, + should_parse: T::Boolean, start: Integer } ) end def to_hash end - - # When true, OCR the selected PDF pages that have no usable text layer (scans), - # replacing each recovered page's text with the OCR result while pages with a real - # text layer keep it. Billed at 1 credit per page OCR actually recovered, on top - # of the base request cost. When false, no OCR runs. - module Ocr - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ContextDev::WebWebScrapeMdParams::Pdf::Ocr::Variants] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::Pdf::Ocr) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::Pdf::Ocr::TaggedSymbol - ) - end - - # When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and - # a 400 PDF_SKIPPED is returned. - module ShouldParse - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::Pdf::ShouldParse::TaggedSymbol - ) - end - end - - # When true, waits briefly for CSS and transition animations to settle before - # converting to Markdown. Defaults to false. This adds a bit of latency in - # exchange for more stable output on animated pages. - module SettleAnimations - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeMdParams::SettleAnimations::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::SettleAnimations) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::SettleAnimations::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::SettleAnimations::TaggedSymbol - ) - end - - # Shorten base64-encoded image data in the Markdown output - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::ShortenBase64Images) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::TaggedSymbol - ) - end - - # Extract only the main content of the page, excluding headers, footers, sidebars, - # and navigation - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::TaggedSymbol - ) - end - - sig do - override.returns( - T::Array[ - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::Variants - ] - ) - end - def self.variants - end - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebWebScrapeMdParams::UseMainContentOnly) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TRUE = - T.let( - :true, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::TaggedSymbol - ) - FALSE = - T.let( - :false, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::TaggedSymbol - ) end # Set to enabled to bypass shared caches and omit request and response content diff --git a/rbi/context_dev/models/web_web_scrape_md_response.rbi b/rbi/context_dev/models/web_web_scrape_md_response.rbi index c6816a2a..371c3a21 100644 --- a/rbi/context_dev/models/web_web_scrape_md_response.rbi +++ b/rbi/context_dev/models/web_web_scrape_md_response.rbi @@ -72,6 +72,15 @@ module ContextDev sig { params(actions_html_stale: T::Boolean).void } attr_writer :actions_html_stale + # Only present when includeHTML=true: the page HTML the Markdown was converted + # from — the same body the Scrape HTML endpoint returns for the equivalent + # request. + sig { returns(T.nilable(String)) } + attr_reader :html + + sig { params(html: String).void } + attr_writer :html + # Metadata about the API key used for the request. Included in every response # whenever a valid API key is provided, even when the response status is not 200. sig do @@ -103,6 +112,7 @@ module ContextDev ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash ], actions_html_stale: T::Boolean, + html: String, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata::OrHash ).returns(T.attached_class) @@ -125,6 +135,10 @@ module ContextDev # True when an action was applied but the returned content could not be refreshed # afterward. actions_html_stale: nil, + # Only present when includeHTML=true: the page HTML the Markdown was converted + # from — the same body the Scrape HTML endpoint returns for the equivalent + # request. + html: nil, # Metadata about the API key used for the request. Included in every response # whenever a valid API key is provided, even when the response status is not 200. key_metadata: nil @@ -145,6 +159,7 @@ module ContextDev ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied ], actions_html_stale: T::Boolean, + html: String, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -245,6 +260,29 @@ module ContextDev sig { params(favicon: String).void } attr_writer :favicon + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading + ] + ) + ) + end + attr_reader :headings + + sig do + params( + headings: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading::OrHash + ] + ).void + end + attr_writer :headings + # Primary resolved preview image from Open Graph, Twitter, or image metadata. sig { returns(T.nilable(String)) } attr_reader :image @@ -374,6 +412,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading::OrHash + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -413,6 +455,9 @@ module ContextDev description: nil, # Resolved favicon URL, when present. favicon: nil, + # Page headings (h1–h6) in document order, extracted from the unfiltered document. + # Capped at the first 500 headings. Omitted when the page has none. + headings: nil, # Primary resolved preview image from Open Graph, Twitter, or image metadata. image: nil, # JSON-LD structured data blocks parsed from the page. @@ -456,6 +501,10 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading + ], image: String, json_ld: T::Array[T::Hash[Symbol, T.anything]], keywords: T::Array[String], @@ -566,6 +615,37 @@ module ContextDev end end + class Heading < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading, + ContextDev::Internal::AnyHash + ) + end + + # Heading level, 1–6 (from h1–h6). + sig { returns(Integer) } + attr_accessor :level + + # Heading text with whitespace collapsed, truncated to 1000 characters. + sig { returns(String) } + attr_accessor :text + + sig { params(level: Integer, text: String).returns(T.attached_class) } + def self.new( + # Heading level, 1–6 (from h1–h6). + level:, + # Heading text with whitespace collapsed, truncated to 1000 characters. + text: + ) + end + + sig { override.returns({ level: Integer, text: String }) } + def to_hash + end + end + module OpenGraph extend ContextDev::Internal::Type::Union diff --git a/rbi/context_dev/resources/brand.rbi b/rbi/context_dev/resources/brand.rbi index 9fbb7ee7..e3978afb 100644 --- a/rbi/context_dev/resources/brand.rbi +++ b/rbi/context_dev/resources/brand.rbi @@ -64,29 +64,34 @@ module ContextDev ) end - # Search brands by name or domain and get back up to 10 lightweight matches - # (domain, name, logo). Name matches rank ahead of domain matches; within each - # group the most popular brands come first: by Tranco rank, then market cap for - # brands outside the Tranco list, with text relevance breaking ties. Matching is - # prefix-based with no typo tolerance, so it is suited to autocomplete. Only - # brands already in the Context.dev index are returned — use /brand/retrieve to - # fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit - # per request on the Free and Starter plans. + # Search indexed brands by name or domain sig do params( query: String, + autocomplete: T::Boolean, + query_by: T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol], tags: T::Array[String], + typo_tolerance: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::BrandSearchResponse) end def search( - # Search term, matched against brand names and domains by prefix (e.g. 'nike', + # Search term, matched against the fields selected by queryBy (e.g. 'nike', # 'nike.com', 'nik'). query:, + # Whether the search term matches by prefix, so partial words match as they are + # typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + autocomplete: nil, + # Fields to match the search term against, as a comma-separated list or repeated + # parameter: 'name', 'domain', or both. Defaults to both. + query_by: nil, # Optional comma-separated caller-defined tags for tracking this request. Tags are # recorded on the request's usage log and can be used to filter usage on the # dashboard usage page. Up to 20 tags, each 1-50 characters. tags: nil, + # Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no + # typo tolerance). + typo_tolerance: nil, request_options: {} ) end diff --git a/rbi/context_dev/resources/news.rbi b/rbi/context_dev/resources/news.rbi new file mode 100644 index 00000000..9d87c8bc --- /dev/null +++ b/rbi/context_dev/resources/news.rbi @@ -0,0 +1,46 @@ +# typed: strong + +module ContextDev + module Resources + # Search live first-party RSS and free historical news data by company identity. + class News + # Searches live and historical company news for one company, identified in + # searchBy by name, domain, ticker (optionally disambiguated by exchange), or + # ISIN. Results can be filtered by publisher domain, publisher country, article + # language, article type, and published-at date, and include stable story IDs, + # source metadata, verified entity relevance, and cursor pagination. + sig do + params( + search_by: ContextDev::NewsSearchParams::SearchBy::OrHash, + cursor: T.nilable(String), + filter_by: ContextDev::NewsSearchParams::FilterBy::OrHash, + limit: Integer, + sort_by: ContextDev::NewsSearchParams::SortBy::OrHash, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::NewsSearchResponse) + end + def search( + # What to search for. + search_by:, + # Opaque next_cursor from the previous response, or null for the first page. + cursor: nil, + # Optional result filters. + filter_by: nil, + # Maximum results to return. Defaults to 10. + limit: nil, + # Result ordering. Defaults to newest. + sort_by: nil, + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + tags: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: ContextDev::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/context_dev/resources/parse.rbi b/rbi/context_dev/resources/parse.rbi index 265a3907..e21142d9 100644 --- a/rbi/context_dev/resources/parse.rbi +++ b/rbi/context_dev/resources/parse.rbi @@ -10,29 +10,13 @@ module ContextDev body: ContextDev::Internal::FileInput, client: String, extension: ContextDev::ParseHandleParams::Extension::OrSymbol, - include_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::IncludeLinks::OrSymbol - ), - ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol), + include_images: T::Boolean, + include_links: T::Boolean, + ocr: T::Boolean, pdf: ContextDev::ParseHandleParams::Pdf::OrHash, - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol - ), + shorten_base64_images: T::Boolean, tags: T::Array[String], - use_main_content_only: - T.any( - T::Boolean, - ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::ParseHandleResponse) diff --git a/rbi/context_dev/resources/utility.rbi b/rbi/context_dev/resources/utility.rbi index a9937a5f..30f6e7f0 100644 --- a/rbi/context_dev/resources/utility.rbi +++ b/rbi/context_dev/resources/utility.rbi @@ -3,10 +3,11 @@ module ContextDev module Resources class Utility - # Signal that you may fetch brand data soon to improve latency. The type field - # selects what to prefetch (currently only 'brand') and identifier carries exactly - # one lookup key: a domain, or an email whose domain is extracted and validated - # (free email providers and disposable email addresses are not allowed). + # Signal that you may fetch data soon to improve latency. The type field selects + # what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a + # styleguide extraction) and identifier carries exactly one lookup key: a domain, + # or an email whose domain is extracted and validated (free email providers and + # disposable email addresses are not allowed). sig do params( identifier: @@ -21,9 +22,10 @@ module ContextDev ).returns(ContextDev::Models::UtilityPrefetchResponse) end def prefetch( - # Identifier of the brand to prefetch. Provide exactly one of domain or email. + # Identifier of the target to prefetch. Provide exactly one of domain or email. identifier:, - # What to prefetch. Currently only 'brand' is supported. + # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the + # styleguide cache. type:, # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. tags: nil, diff --git a/rbi/context_dev/resources/web.rbi b/rbi/context_dev/resources/web.rbi index 28f319b6..6c9088a1 100644 --- a/rbi/context_dev/resources/web.rbi +++ b/rbi/context_dev/resources/web.rbi @@ -196,11 +196,7 @@ module ContextDev domain: String, full_screenshot: ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, - handle_cookie_popup: - T.any( - T::Boolean, - ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol - ), + handle_cookie_popup: T::Boolean, max_age_ms: T.nilable(Integer), page: ContextDev::WebScreenshotParams::Page::OrSymbol, scroll_offset: T.nilable(Integer), @@ -439,26 +435,14 @@ module ContextDev country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol - ), + include_frames: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeHTMLParams::Pdf::OrHash, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol - ), + settle_animations: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash @@ -539,11 +523,7 @@ module ContextDev ) ] ), - dedupe: - T.any( - T::Boolean, - ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol - ), + dedupe: T::Boolean, enrichment: T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash), headers: T::Hash[Symbol, String], @@ -609,17 +589,17 @@ module ContextDev # # ### Billing & errors # - # | HTTP status | Billed? | Meaning | - # | ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- | - # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | - # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | - # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | - # | 404 | No | Target page returned or fingerprinted as not found | - # | 408 | No | Request timed out | - # | 413 | No | Target content exceeds the maximum supported size (20 MB) | - # | 415 | No | Unsupported content type | - # | 429 | No | Per-minute rate limit exceeded; honor Retry-After | - # | 500 | No | Internal error | + # | HTTP status | Billed? | Meaning | + # | ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | + # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | + # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | + # | 404 | No | Target page returned or fingerprinted as not found | + # | 408 | No | Request timed out | + # | 413 | No | Target content exceeds the maximum supported size (20 MB) | + # | 415 | No | Unsupported content type | + # | 429 | No | Per-minute rate limit exceeded; honor Retry-After | + # | 500 | No | Internal error | sig do params( url: String, @@ -635,41 +615,18 @@ module ContextDev country: ContextDev::WebWebScrapeMdParams::Country::OrSymbol, exclude_selectors: T.nilable(T::Array[String]), headers: T::Hash[Symbol, String], - include_frames: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol - ), - include_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol - ), - include_links: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol - ), + include_frames: T::Boolean, + include_html: T::Boolean, + include_images: T::Boolean, + include_links: T::Boolean, include_selectors: T.nilable(T::Array[String]), max_age_ms: T.nilable(Integer), pdf: ContextDev::WebWebScrapeMdParams::Pdf::OrHash, - settle_animations: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol - ), - shorten_base64_images: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol - ), + settle_animations: T::Boolean, + shorten_base64_images: T::Boolean, tags: T::Array[String], timeout_ms: Integer, - use_main_content_only: - T.any( - T::Boolean, - ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol - ), + use_main_content_only: T::Boolean, wait_for_ms: T.nilable(Integer), zdr: ContextDev::WebWebScrapeMdParams::Zdr::OrSymbol, request_options: ContextDev::RequestOptions::OrHash @@ -696,6 +653,10 @@ module ContextDev headers: nil, # When true, the contents of iframes are rendered to Markdown. include_frames: nil, + # When true, the response also includes an `html` field with the page HTML the + # Markdown was converted from — the same body the Scrape HTML endpoint returns for + # the equivalent request. + include_html: nil, # Include image references in Markdown output include_images: nil, # Preserve hyperlinks in Markdown output diff --git a/sig/context_dev/client.rbs b/sig/context_dev/client.rbs index 16447acb..8d8498d8 100644 --- a/sig/context_dev/client.rbs +++ b/sig/context_dev/client.rbs @@ -28,6 +28,8 @@ module ContextDev attr_reader people: ContextDev::Resources::People + attr_reader news: ContextDev::Resources::News + private def auth_headers: -> ::Hash[String, String] def initialize: ( diff --git a/sig/context_dev/models.rbs b/sig/context_dev/models.rbs index d98a1175..20e945c5 100644 --- a/sig/context_dev/models.rbs +++ b/sig/context_dev/models.rbs @@ -57,6 +57,8 @@ module ContextDev class MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams + class NewsSearchParams = ContextDev::Models::NewsSearchParams + class PageErrorCount = ContextDev::Models::PageErrorCount class ParseHandleParams = ContextDev::Models::ParseHandleParams diff --git a/sig/context_dev/models/batch_get_results_response.rbs b/sig/context_dev/models/batch_get_results_response.rbs index ad76bbbc..a9e30000 100644 --- a/sig/context_dev/models/batch_get_results_response.rbs +++ b/sig/context_dev/models/batch_get_results_response.rbs @@ -129,6 +129,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -175,6 +176,12 @@ module ContextDev def favicon=: (String) -> String + attr_reader headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading]? + + def headings=: ( + ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading] + ) -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading] + attr_reader image: String? def image=: (String) -> String @@ -234,6 +241,7 @@ module ContextDev ?canonical_url: String, ?description: String, ?favicon: String, + ?headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading], ?image: String, ?json_ld: ::Array[::Hash[Symbol, top]], ?keywords: ::Array[String], @@ -256,6 +264,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -312,6 +321,18 @@ module ContextDev } end + type heading = { level: Integer, text: String } + + class Heading < ContextDev::Internal::Type::BaseModel + attr_accessor level: Integer + + attr_accessor text: String + + def initialize: (level: Integer, text: String) -> void + + def to_hash: -> { level: Integer, text: String } + end + type open_graph = String | ::Array[String] module OpenGraph diff --git a/sig/context_dev/models/batch_submit_params.rbs b/sig/context_dev/models/batch_submit_params.rbs index ff026c2c..3ded5e39 100644 --- a/sig/context_dev/models/batch_submit_params.rbs +++ b/sig/context_dev/models/batch_submit_params.rbs @@ -139,6 +139,7 @@ module ContextDev { country: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::country, exclude_selectors: ::Array[String]?, + include_html: bool, include_images: bool, include_links: bool, include_selectors: ::Array[String]?, @@ -159,6 +160,10 @@ module ContextDev attr_accessor exclude_selectors: ::Array[String]? + attr_reader include_html: bool? + + def include_html=: (bool) -> bool + attr_reader include_images: bool? def include_images=: (bool) -> bool @@ -196,6 +201,7 @@ module ContextDev def initialize: ( ?country: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::country, ?exclude_selectors: ::Array[String]?, + ?include_html: bool, ?include_images: bool, ?include_links: bool, ?include_selectors: ::Array[String]?, @@ -210,6 +216,7 @@ module ContextDev def to_hash: -> { country: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::country, exclude_selectors: ::Array[String]?, + include_html: bool, include_images: bool, include_links: bool, include_selectors: ::Array[String]?, @@ -641,8 +648,8 @@ module ContextDev type pdf = { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } @@ -651,17 +658,13 @@ module ContextDev def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr - ) -> ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse - ) -> ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -669,39 +672,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr, - ?should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::Markdown::Options::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end end end end @@ -1248,8 +1229,8 @@ module ContextDev type pdf = { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } @@ -1258,17 +1239,13 @@ module ContextDev def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr - ) -> ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse - ) -> ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -1276,39 +1253,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr, - ?should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::HTML::Options::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end end end end @@ -1507,6 +1462,7 @@ module ContextDev { country: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::country, exclude_selectors: ::Array[String]?, + include_html: bool, include_images: bool, include_links: bool, include_selectors: ::Array[String]?, @@ -1527,6 +1483,10 @@ module ContextDev attr_accessor exclude_selectors: ::Array[String]? + attr_reader include_html: bool? + + def include_html=: (bool) -> bool + attr_reader include_images: bool? def include_images=: (bool) -> bool @@ -1564,6 +1524,7 @@ module ContextDev def initialize: ( ?country: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::country, ?exclude_selectors: ::Array[String]?, + ?include_html: bool, ?include_images: bool, ?include_links: bool, ?include_selectors: ::Array[String]?, @@ -1578,6 +1539,7 @@ module ContextDev def to_hash: -> { country: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::country, exclude_selectors: ::Array[String]?, + include_html: bool, include_images: bool, include_links: bool, include_selectors: ::Array[String]?, @@ -2009,8 +1971,8 @@ module ContextDev type pdf = { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } @@ -2019,17 +1981,13 @@ module ContextDev def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr - ) -> ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse - ) -> ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -2037,39 +1995,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr, - ?should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::Markdown::Options::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end end end end @@ -2717,8 +2653,8 @@ module ContextDev type pdf = { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } @@ -2727,17 +2663,13 @@ module ContextDev def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr - ) -> ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse - ) -> ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -2745,39 +2677,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr, - ?should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr, - should_parse: ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::HTML::Options::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end end end end diff --git a/sig/context_dev/models/brand_search_params.rbs b/sig/context_dev/models/brand_search_params.rbs index 881fb7c8..c9e45725 100644 --- a/sig/context_dev/models/brand_search_params.rbs +++ b/sig/context_dev/models/brand_search_params.rbs @@ -1,7 +1,13 @@ module ContextDev module Models type brand_search_params = - { query: String, tags: ::Array[String] } + { + query: String, + autocomplete: bool, + query_by: ::Array[ContextDev::Models::BrandSearchParams::query_by], + tags: ::Array[String], + typo_tolerance: Integer + } & ContextDev::Internal::Type::request_parameters class BrandSearchParams < ContextDev::Internal::Type::BaseModel @@ -10,21 +16,52 @@ module ContextDev attr_accessor query: String + attr_reader autocomplete: bool? + + def autocomplete=: (bool) -> bool + + attr_reader query_by: ::Array[ContextDev::Models::BrandSearchParams::query_by]? + + def query_by=: ( + ::Array[ContextDev::Models::BrandSearchParams::query_by] + ) -> ::Array[ContextDev::Models::BrandSearchParams::query_by] + attr_reader tags: ::Array[String]? def tags=: (::Array[String]) -> ::Array[String] + attr_reader typo_tolerance: Integer? + + def typo_tolerance=: (Integer) -> Integer + def initialize: ( query: String, + ?autocomplete: bool, + ?query_by: ::Array[ContextDev::Models::BrandSearchParams::query_by], ?tags: ::Array[String], + ?typo_tolerance: Integer, ?request_options: ContextDev::request_opts ) -> void def to_hash: -> { query: String, + autocomplete: bool, + query_by: ::Array[ContextDev::Models::BrandSearchParams::query_by], tags: ::Array[String], + typo_tolerance: Integer, request_options: ContextDev::RequestOptions } + + type query_by = :name | :domain + + module QueryBy + extend ContextDev::Internal::Type::Enum + + NAME: :name + DOMAIN: :domain + + def self?.values: -> ::Array[ContextDev::Models::BrandSearchParams::query_by] + end end end end diff --git a/sig/context_dev/models/news_search_params.rbs b/sig/context_dev/models/news_search_params.rbs new file mode 100644 index 00000000..dfa0b2d6 --- /dev/null +++ b/sig/context_dev/models/news_search_params.rbs @@ -0,0 +1,532 @@ +module ContextDev + module Models + type news_search_params = + { + search_by: ContextDev::NewsSearchParams::SearchBy, + cursor: String?, + filter_by: ContextDev::NewsSearchParams::FilterBy, + limit: Integer, + sort_by: ContextDev::NewsSearchParams::SortBy, + tags: ::Array[String] + } + & ContextDev::Internal::Type::request_parameters + + class NewsSearchParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor search_by: ContextDev::NewsSearchParams::SearchBy + + attr_accessor cursor: String? + + attr_reader filter_by: ContextDev::NewsSearchParams::FilterBy? + + def filter_by=: ( + ContextDev::NewsSearchParams::FilterBy + ) -> ContextDev::NewsSearchParams::FilterBy + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader sort_by: ContextDev::NewsSearchParams::SortBy? + + def sort_by=: ( + ContextDev::NewsSearchParams::SortBy + ) -> ContextDev::NewsSearchParams::SortBy + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + def initialize: ( + search_by: ContextDev::NewsSearchParams::SearchBy, + ?cursor: String?, + ?filter_by: ContextDev::NewsSearchParams::FilterBy, + ?limit: Integer, + ?sort_by: ContextDev::NewsSearchParams::SortBy, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + search_by: ContextDev::NewsSearchParams::SearchBy, + cursor: String?, + filter_by: ContextDev::NewsSearchParams::FilterBy, + limit: Integer, + sort_by: ContextDev::NewsSearchParams::SortBy, + tags: ::Array[String], + request_options: ContextDev::RequestOptions + } + + type search_by = + { + entity: ContextDev::Models::NewsSearchParams::SearchBy::entity, + type: ContextDev::Models::NewsSearchParams::SearchBy::type_ + } + + class SearchBy < ContextDev::Internal::Type::BaseModel + attr_accessor entity: ContextDev::Models::NewsSearchParams::SearchBy::entity + + attr_accessor type: ContextDev::Models::NewsSearchParams::SearchBy::type_ + + def initialize: ( + entity: ContextDev::Models::NewsSearchParams::SearchBy::entity, + type: ContextDev::Models::NewsSearchParams::SearchBy::type_ + ) -> void + + def to_hash: -> { + entity: ContextDev::Models::NewsSearchParams::SearchBy::entity, + type: ContextDev::Models::NewsSearchParams::SearchBy::type_ + } + + type entity = + ContextDev::NewsSearchParams::SearchBy::Entity::Name + | ContextDev::NewsSearchParams::SearchBy::Entity::Domain + | ContextDev::NewsSearchParams::SearchBy::Entity::Ticker + | ContextDev::NewsSearchParams::SearchBy::Entity::Isin + + module Entity + extend ContextDev::Internal::Type::Union + + type name_ = { name: String, type: :name } + + class Name < ContextDev::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor type: :name + + def initialize: (name: String, ?type: :name) -> void + + def to_hash: -> { name: String, type: :name } + end + + type domain = { domain: String, type: :domain } + + class Domain < ContextDev::Internal::Type::BaseModel + attr_accessor domain: String + + attr_accessor type: :domain + + def initialize: (domain: String, ?type: :domain) -> void + + def to_hash: -> { domain: String, type: :domain } + end + + type ticker = + { + ticker: String, + type: :ticker, + exchange: ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange + } + + class Ticker < ContextDev::Internal::Type::BaseModel + attr_accessor ticker: String + + attr_accessor type: :ticker + + attr_reader exchange: ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange? + + def exchange=: ( + ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange + ) -> ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange + + def initialize: ( + ticker: String, + ?exchange: ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange, + ?type: :ticker + ) -> void + + def to_hash: -> { + ticker: String, + type: :ticker, + exchange: ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange + } + + type exchange = + :AMEX + | :AMS + | :AQS + | :ASX + | :ATH + | :BER + | :BME + | :BRU + | :BSE + | :BUD + | :BUE + | :BVC + | :CBOE + | :CNQ + | :CPH + | :DFM + | :DOH + | :DUB + | :DUS + | :DXE + | :EGX + | :FSX + | :HAM + | :HEL + | :HKSE + | :HOSE + | :ICE + | :IOB + | :IST + | :JKT + | :JNB + | :JPX + | :KLS + | :KOE + | :KSC + | :KUW + | :LIS + | :LSE + | :MCX + | :MEX + | :MIL + | :MUN + | :NASDAQ + | :NEO + | :NSE + | :NYSE + | :NZE + | :OSL + | :OTC + | :PAR + | :PNK + | :PRA + | :RIS + | :SAO + | :SAU + | :SES + | :SET + | :SGO + | :SHH + | :SHZ + | :SIX + | :STO + | :STU + | :TAI + | :TAL + | :TLV + | :TSX + | :TSXV + | :TWO + | :VIE + | :WSE + | :XETRA + + module Exchange + extend ContextDev::Internal::Type::Enum + + AMEX: :AMEX + AMS: :AMS + AQS: :AQS + ASX: :ASX + ATH: :ATH + BER: :BER + BME: :BME + BRU: :BRU + BSE: :BSE + BUD: :BUD + BUE: :BUE + BVC: :BVC + CBOE: :CBOE + CNQ: :CNQ + CPH: :CPH + DFM: :DFM + DOH: :DOH + DUB: :DUB + DUS: :DUS + DXE: :DXE + EGX: :EGX + FSX: :FSX + HAM: :HAM + HEL: :HEL + HKSE: :HKSE + HOSE: :HOSE + ICE: :ICE + IOB: :IOB + IST: :IST + JKT: :JKT + JNB: :JNB + JPX: :JPX + KLS: :KLS + KOE: :KOE + KSC: :KSC + KUW: :KUW + LIS: :LIS + LSE: :LSE + MCX: :MCX + MEX: :MEX + MIL: :MIL + MUN: :MUN + NASDAQ: :NASDAQ + NEO: :NEO + NSE: :NSE + NYSE: :NYSE + NZE: :NZE + OSL: :OSL + OTC: :OTC + PAR: :PAR + PNK: :PNK + PRA: :PRA + RIS: :RIS + SAO: :SAO + SAU: :SAU + SES: :SES + SET: :SET + SGO: :SGO + SHH: :SHH + SHZ: :SHZ + SIX: :SIX + STO: :STO + STU: :STU + TAI: :TAI + TAL: :TAL + TLV: :TLV + TSX: :TSX + TSXV: :TSXV + TWO: :TWO + VIE: :VIE + WSE: :WSE + XETRA: :XETRA + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::SearchBy::Entity::Ticker::exchange] + end + end + + type isin = { isin: String, type: :isin } + + class Isin < ContextDev::Internal::Type::BaseModel + attr_accessor isin: String + + attr_accessor type: :isin + + def initialize: (isin: String, ?type: :isin) -> void + + def to_hash: -> { isin: String, type: :isin } + end + + def self?.variants: -> ::Array[ContextDev::Models::NewsSearchParams::SearchBy::entity] + end + + type type_ = :entity + + module Type + extend ContextDev::Internal::Type::Enum + + ENTITY: :entity + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::SearchBy::type_] + end + end + + type filter_by = + { + article_language: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language], + article_type: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type], + date: ContextDev::NewsSearchParams::FilterBy::Date, + source_country: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country], + source_domain: ::Array[String] + } + + class FilterBy < ContextDev::Internal::Type::BaseModel + attr_reader article_language: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language]? + + def article_language=: ( + ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language] + ) -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language] + + attr_reader article_type: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type]? + + def article_type=: ( + ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type] + ) -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type] + + attr_reader date: ContextDev::NewsSearchParams::FilterBy::Date? + + def date=: ( + ContextDev::NewsSearchParams::FilterBy::Date + ) -> ContextDev::NewsSearchParams::FilterBy::Date + + attr_reader source_country: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country]? + + def source_country=: ( + ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country] + ) -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country] + + attr_reader source_domain: ::Array[String]? + + def source_domain=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?article_language: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language], + ?article_type: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type], + ?date: ContextDev::NewsSearchParams::FilterBy::Date, + ?source_country: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country], + ?source_domain: ::Array[String] + ) -> void + + def to_hash: -> { + article_language: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language], + article_type: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type], + date: ContextDev::NewsSearchParams::FilterBy::Date, + source_country: ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country], + source_domain: ::Array[String] + } + + type article_language = + :ar + | :de + | :en + | :es + | :fr + | :hi + | :it + | :ja + | :ko + | :nl + | :pt + | :ru + | :zh + + module ArticleLanguage + extend ContextDev::Internal::Type::Enum + + AR: :ar + DE: :de + EN: :en + ES: :es + FR: :fr + HI: :hi + IT: :it + JA: :ja + KO: :ko + NL: :nl + PT: :pt + RU: :ru + ZH: :zh + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_language] + end + + type article_type = + :editorial | :press_release | :regulatory_filing | :advisory + + module ArticleType + extend ContextDev::Internal::Type::Enum + + EDITORIAL: :editorial + PRESS_RELEASE: :press_release + REGULATORY_FILING: :regulatory_filing + ADVISORY: :advisory + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::article_type] + end + + type date = { from: Integer, to: Integer } + + class Date < ContextDev::Internal::Type::BaseModel + attr_reader from: Integer? + + def from=: (Integer) -> Integer + + attr_reader to: Integer? + + def to=: (Integer) -> Integer + + def initialize: (?from: Integer, ?to: Integer) -> void + + def to_hash: -> { from: Integer, to: Integer } + end + + type source_country = + :ae + | :ar + | :au + | :ca + | :cg + | :ch + | :cl + | :de + | :fi + | :fr + | :gb + | :hk + | :il + | :in + | :jp + | :kr + | :mx + | :ng + | :nl + | :qa + | :sa + | :se + | :sg + | :us + | :za + + module SourceCountry + extend ContextDev::Internal::Type::Enum + + AE: :ae + AR: :ar + AU: :au + CA: :ca + CG: :cg + CH: :ch + CL: :cl + DE: :de + FI: :fi + FR: :fr + GB: :gb + HK: :hk + IL: :il + IN: :in + JP: :jp + KR: :kr + MX: :mx + NG: :ng + NL: :nl + QA: :qa + SA: :sa + SE: :se + SG: :sg + US: :us + ZA: :za + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::FilterBy::source_country] + end + end + + type sort_by = + { type: ContextDev::Models::NewsSearchParams::SortBy::type_ } + + class SortBy < ContextDev::Internal::Type::BaseModel + attr_accessor type: ContextDev::Models::NewsSearchParams::SortBy::type_ + + def initialize: ( + type: ContextDev::Models::NewsSearchParams::SortBy::type_ + ) -> void + + def to_hash: -> { + type: ContextDev::Models::NewsSearchParams::SortBy::type_ + } + + type type_ = :relevance | :newest + + module Type + extend ContextDev::Internal::Type::Enum + + RELEVANCE: :relevance + NEWEST: :newest + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchParams::SortBy::type_] + end + end + end + end +end diff --git a/sig/context_dev/models/news_search_response.rbs b/sig/context_dev/models/news_search_response.rbs new file mode 100644 index 00000000..455ba593 --- /dev/null +++ b/sig/context_dev/models/news_search_response.rbs @@ -0,0 +1,206 @@ +module ContextDev + module Models + type news_search_response = + { + data: ::Array[ContextDev::Models::NewsSearchResponse::Data], + has_more: bool, + meta: ContextDev::Models::NewsSearchResponse::Meta, + next_cursor: String?, + key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata + } + + class NewsSearchResponse < ContextDev::Internal::Type::BaseModel + attr_accessor data: ::Array[ContextDev::Models::NewsSearchResponse::Data] + + attr_accessor has_more: bool + + attr_accessor meta: ContextDev::Models::NewsSearchResponse::Meta + + attr_accessor next_cursor: String? + + attr_reader key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::NewsSearchResponse::KeyMetadata + ) -> ContextDev::Models::NewsSearchResponse::KeyMetadata + + def initialize: ( + data: ::Array[ContextDev::Models::NewsSearchResponse::Data], + has_more: bool, + meta: ContextDev::Models::NewsSearchResponse::Meta, + next_cursor: String?, + ?key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata + ) -> void + + def to_hash: -> { + data: ::Array[ContextDev::Models::NewsSearchResponse::Data], + has_more: bool, + meta: ContextDev::Models::NewsSearchResponse::Meta, + next_cursor: String?, + key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata + } + + type data = + { + id: String, + authors: ::Array[String], + description: String?, + image_url: String?, + language: String?, + match: ContextDev::Models::NewsSearchResponse::Data::Match, + published_at: Time?, + source: ContextDev::Models::NewsSearchResponse::Data::Source, + story_id: String, + title: String, + type: ContextDev::Models::NewsSearchResponse::Data::type_, + url: String + } + + class Data < ContextDev::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor authors: ::Array[String] + + attr_accessor description: String? + + attr_accessor image_url: String? + + attr_accessor language: String? + + attr_accessor match: ContextDev::Models::NewsSearchResponse::Data::Match + + attr_accessor published_at: Time? + + attr_accessor source: ContextDev::Models::NewsSearchResponse::Data::Source + + attr_accessor story_id: String + + attr_accessor title: String + + attr_accessor type: ContextDev::Models::NewsSearchResponse::Data::type_ + + attr_accessor url: String + + def initialize: ( + id: String, + authors: ::Array[String], + description: String?, + image_url: String?, + language: String?, + match: ContextDev::Models::NewsSearchResponse::Data::Match, + published_at: Time?, + source: ContextDev::Models::NewsSearchResponse::Data::Source, + story_id: String, + title: String, + type: ContextDev::Models::NewsSearchResponse::Data::type_, + url: String + ) -> void + + def to_hash: -> { + id: String, + authors: ::Array[String], + description: String?, + image_url: String?, + language: String?, + match: ContextDev::Models::NewsSearchResponse::Data::Match, + published_at: Time?, + source: ContextDev::Models::NewsSearchResponse::Data::Source, + story_id: String, + title: String, + type: ContextDev::Models::NewsSearchResponse::Data::type_, + url: String + } + + type match = + { + confidence: Float?, + level: ContextDev::Models::NewsSearchResponse::Data::Match::level + } + + class Match < ContextDev::Internal::Type::BaseModel + attr_accessor confidence: Float? + + attr_accessor level: ContextDev::Models::NewsSearchResponse::Data::Match::level + + def initialize: ( + confidence: Float?, + level: ContextDev::Models::NewsSearchResponse::Data::Match::level + ) -> void + + def to_hash: -> { + confidence: Float?, + level: ContextDev::Models::NewsSearchResponse::Data::Match::level + } + + type level = :primary | :secondary + + module Level + extend ContextDev::Internal::Type::Enum + + PRIMARY: :primary + SECONDARY: :secondary + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchResponse::Data::Match::level] + end + end + + type source = { direct: bool, domain: String, name: String } + + class Source < ContextDev::Internal::Type::BaseModel + attr_accessor direct: bool + + attr_accessor domain: String + + attr_accessor name: String + + def initialize: (direct: bool, domain: String, name: String) -> void + + def to_hash: -> { direct: bool, domain: String, name: String } + end + + type type_ = + :editorial | :press_release | :regulatory_filing | :advisory + + module Type + extend ContextDev::Internal::Type::Enum + + EDITORIAL: :editorial + PRESS_RELEASE: :press_release + REGULATORY_FILING: :regulatory_filing + ADVISORY: :advisory + + def self?.values: -> ::Array[ContextDev::Models::NewsSearchResponse::Data::type_] + end + end + + type meta = { count: Integer } + + class Meta < ContextDev::Internal::Type::BaseModel + attr_accessor count: Integer + + def initialize: (count: Integer) -> void + + def to_hash: -> { count: Integer } + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/models/parse_handle_params.rbs b/sig/context_dev/models/parse_handle_params.rbs index e754d54b..2c24757e 100644 --- a/sig/context_dev/models/parse_handle_params.rbs +++ b/sig/context_dev/models/parse_handle_params.rbs @@ -5,13 +5,13 @@ module ContextDev body: ContextDev::Internal::file_input, client: String, extension: ContextDev::Models::ParseHandleParams::extension, - include_images: ContextDev::Models::ParseHandleParams::include_images, - include_links: ContextDev::Models::ParseHandleParams::include_links, - ocr: ContextDev::Models::ParseHandleParams::ocr, + include_images: bool, + include_links: bool, + ocr: bool, pdf: ContextDev::ParseHandleParams::Pdf, - :shorten_base64_images => ContextDev::Models::ParseHandleParams::shorten_base64_images, + :shorten_base64_images => bool, tags: ::Array[String], - use_main_content_only: ContextDev::Models::ParseHandleParams::use_main_content_only, + use_main_content_only: bool, zdr: ContextDev::Models::ParseHandleParams::zdr } & ContextDev::Internal::Type::request_parameters @@ -32,23 +32,17 @@ module ContextDev ContextDev::Models::ParseHandleParams::extension ) -> ContextDev::Models::ParseHandleParams::extension - attr_reader include_images: ContextDev::Models::ParseHandleParams::include_images? + attr_reader include_images: bool? - def include_images=: ( - ContextDev::Models::ParseHandleParams::include_images - ) -> ContextDev::Models::ParseHandleParams::include_images + def include_images=: (bool) -> bool - attr_reader include_links: ContextDev::Models::ParseHandleParams::include_links? + attr_reader include_links: bool? - def include_links=: ( - ContextDev::Models::ParseHandleParams::include_links - ) -> ContextDev::Models::ParseHandleParams::include_links + def include_links=: (bool) -> bool - attr_reader ocr: ContextDev::Models::ParseHandleParams::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::ParseHandleParams::ocr - ) -> ContextDev::Models::ParseHandleParams::ocr + def ocr=: (bool) -> bool attr_reader pdf: ContextDev::ParseHandleParams::Pdf? @@ -56,21 +50,17 @@ module ContextDev ContextDev::ParseHandleParams::Pdf ) -> ContextDev::ParseHandleParams::Pdf - attr_reader shorten_base64_images: ContextDev::Models::ParseHandleParams::shorten_base64_images? + attr_reader shorten_base64_images: bool? - def shorten_base64_images=: ( - ContextDev::Models::ParseHandleParams::shorten_base64_images - ) -> ContextDev::Models::ParseHandleParams::shorten_base64_images + def shorten_base64_images=: (bool) -> bool attr_reader tags: ::Array[String]? def tags=: (::Array[String]) -> ::Array[String] - attr_reader use_main_content_only: ContextDev::Models::ParseHandleParams::use_main_content_only? + attr_reader use_main_content_only: bool? - def use_main_content_only=: ( - ContextDev::Models::ParseHandleParams::use_main_content_only - ) -> ContextDev::Models::ParseHandleParams::use_main_content_only + def use_main_content_only=: (bool) -> bool attr_reader zdr: ContextDev::Models::ParseHandleParams::zdr? @@ -82,13 +72,13 @@ module ContextDev body: ContextDev::Internal::file_input, ?client: String, ?extension: ContextDev::Models::ParseHandleParams::extension, - ?include_images: ContextDev::Models::ParseHandleParams::include_images, - ?include_links: ContextDev::Models::ParseHandleParams::include_links, - ?ocr: ContextDev::Models::ParseHandleParams::ocr, + ?include_images: bool, + ?include_links: bool, + ?ocr: bool, ?pdf: ContextDev::ParseHandleParams::Pdf, - ?shorten_base64_images: ContextDev::Models::ParseHandleParams::shorten_base64_images, + ?shorten_base64_images: bool, ?tags: ::Array[String], - ?use_main_content_only: ContextDev::Models::ParseHandleParams::use_main_content_only, + ?use_main_content_only: bool, ?zdr: ContextDev::Models::ParseHandleParams::zdr, ?request_options: ContextDev::request_opts ) -> void @@ -97,13 +87,13 @@ module ContextDev body: ContextDev::Internal::file_input, client: String, extension: ContextDev::Models::ParseHandleParams::extension, - include_images: ContextDev::Models::ParseHandleParams::include_images, - include_links: ContextDev::Models::ParseHandleParams::include_links, - ocr: ContextDev::Models::ParseHandleParams::ocr, + include_images: bool, + include_links: bool, + ocr: bool, pdf: ContextDev::ParseHandleParams::Pdf, - :shorten_base64_images => ContextDev::Models::ParseHandleParams::shorten_base64_images, + :shorten_base64_images => bool, tags: ::Array[String], - use_main_content_only: ContextDev::Models::ParseHandleParams::use_main_content_only, + use_main_content_only: bool, zdr: ContextDev::Models::ParseHandleParams::zdr, request_options: ContextDev::RequestOptions } @@ -257,39 +247,6 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::ParseHandleParams::extension] end - type include_images = bool | :true | :false - - module IncludeImages - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::ParseHandleParams::include_images] - - TRUE: :true - FALSE: :false - end - - type include_links = bool | :true | :false - - module IncludeLinks - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::ParseHandleParams::include_links] - - TRUE: :true - FALSE: :false - end - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::ParseHandleParams::ocr] - - TRUE: :true - FALSE: :false - end - type pdf = { end_: Integer, start: Integer } class Pdf < ContextDev::Internal::Type::BaseModel @@ -306,28 +263,6 @@ module ContextDev def to_hash: -> { end_: Integer, start: Integer } end - type shorten_base64_images = bool | :true | :false - - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::ParseHandleParams::shorten_base64_images] - - TRUE: :true - FALSE: :false - end - - type use_main_content_only = bool | :true | :false - - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::ParseHandleParams::use_main_content_only] - - TRUE: :true - FALSE: :false - end - type zdr = :enabled | :disabled module Zdr diff --git a/sig/context_dev/models/person_enrich_response.rbs b/sig/context_dev/models/person_enrich_response.rbs index 7b257db9..c491a488 100644 --- a/sig/context_dev/models/person_enrich_response.rbs +++ b/sig/context_dev/models/person_enrich_response.rbs @@ -60,6 +60,7 @@ module ContextDev type person = { + current_role_status: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::current_role_status, education: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education], experience: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Experience], skills: ::Array[String], @@ -67,13 +68,17 @@ module ContextDev website_urls: ::Array[String], avatar_url: String, bio: String, + checked_at: String, current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole, email: String, + last_updated: String, location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location, name: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name } class Person < ContextDev::Internal::Type::BaseModel + attr_accessor current_role_status: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::current_role_status + attr_accessor education: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education] attr_accessor experience: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Experience] @@ -92,6 +97,10 @@ module ContextDev def bio=: (String) -> String + attr_reader checked_at: String? + + def checked_at=: (String) -> String + attr_reader current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole? def current_role=: ( @@ -102,6 +111,10 @@ module ContextDev def email=: (String) -> String + attr_reader last_updated: String? + + def last_updated=: (String) -> String + attr_reader location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location? def location=: ( @@ -115,6 +128,7 @@ module ContextDev ) -> ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name def initialize: ( + current_role_status: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::current_role_status, education: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education], experience: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Experience], skills: ::Array[String], @@ -122,13 +136,16 @@ module ContextDev website_urls: ::Array[String], ?avatar_url: String, ?bio: String, + ?checked_at: String, ?current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole, ?email: String, + ?last_updated: String, ?location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location, ?name: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name ) -> void def to_hash: -> { + current_role_status: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::current_role_status, education: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education], experience: ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Experience], skills: ::Array[String], @@ -136,12 +153,26 @@ module ContextDev website_urls: ::Array[String], avatar_url: String, bio: String, + checked_at: String, current_role: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::CurrentRole, email: String, + last_updated: String, location: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Location, name: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Name } + type current_role_status = :present | :none | :unknown + + module CurrentRoleStatus + extend ContextDev::Internal::Type::Enum + + PRESENT: :present + NONE: :none + UNKNOWN: :unknown + + def self?.values: -> ::Array[ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::current_role_status] + end + type education = { institution: ContextDev::Models::PersonEnrichResponse::Match::Candidate::Person::Education::Institution, diff --git a/sig/context_dev/models/utility_prefetch_params.rbs b/sig/context_dev/models/utility_prefetch_params.rbs index 6b398dea..8d643a99 100644 --- a/sig/context_dev/models/utility_prefetch_params.rbs +++ b/sig/context_dev/models/utility_prefetch_params.rbs @@ -71,12 +71,13 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::UtilityPrefetchParams::identifier] end - type type_ = :brand + type type_ = :brand | :styleguide module Type extend ContextDev::Internal::Type::Enum BRAND: :brand + STYLEGUIDE: :styleguide def self?.values: -> ::Array[ContextDev::Models::UtilityPrefetchParams::type_] end diff --git a/sig/context_dev/models/utility_prefetch_response.rbs b/sig/context_dev/models/utility_prefetch_response.rbs index d197a259..70944760 100644 --- a/sig/context_dev/models/utility_prefetch_response.rbs +++ b/sig/context_dev/models/utility_prefetch_response.rbs @@ -69,12 +69,13 @@ module ContextDev } end - type type_ = :brand + type type_ = :brand | :styleguide module Type extend ContextDev::Internal::Type::Enum BRAND: :brand + STYLEGUIDE: :styleguide def self?.values: -> ::Array[ContextDev::Models::UtilityPrefetchResponse::type_] end diff --git a/sig/context_dev/models/web_screenshot_params.rbs b/sig/context_dev/models/web_screenshot_params.rbs index e6e0538c..0a33af7f 100644 --- a/sig/context_dev/models/web_screenshot_params.rbs +++ b/sig/context_dev/models/web_screenshot_params.rbs @@ -7,7 +7,7 @@ module ContextDev direct_url: String, domain: String, full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, - handle_cookie_popup: ContextDev::Models::WebScreenshotParams::handle_cookie_popup, + handle_cookie_popup: bool, max_age_ms: Integer?, page: ContextDev::Models::WebScreenshotParams::page, scroll_offset: Integer?, @@ -49,11 +49,9 @@ module ContextDev ContextDev::Models::WebScreenshotParams::full_screenshot ) -> ContextDev::Models::WebScreenshotParams::full_screenshot - attr_reader handle_cookie_popup: ContextDev::Models::WebScreenshotParams::handle_cookie_popup? + attr_reader handle_cookie_popup: bool? - def handle_cookie_popup=: ( - ContextDev::Models::WebScreenshotParams::handle_cookie_popup - ) -> ContextDev::Models::WebScreenshotParams::handle_cookie_popup + def handle_cookie_popup=: (bool) -> bool attr_accessor max_age_ms: Integer? @@ -93,7 +91,7 @@ module ContextDev ?direct_url: String, ?domain: String, ?full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, - ?handle_cookie_popup: ContextDev::Models::WebScreenshotParams::handle_cookie_popup, + ?handle_cookie_popup: bool, ?max_age_ms: Integer?, ?page: ContextDev::Models::WebScreenshotParams::page, ?scroll_offset: Integer?, @@ -111,7 +109,7 @@ module ContextDev direct_url: String, domain: String, full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, - handle_cookie_popup: ContextDev::Models::WebScreenshotParams::handle_cookie_popup, + handle_cookie_popup: bool, max_age_ms: Integer?, page: ContextDev::Models::WebScreenshotParams::page, scroll_offset: Integer?, @@ -562,17 +560,6 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebScreenshotParams::full_screenshot] end - type handle_cookie_popup = bool | :true | :false - - module HandleCookiePopup - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebScreenshotParams::handle_cookie_popup] - - TRUE: :true - FALSE: :false - end - type page = :login | :signup diff --git a/sig/context_dev/models/web_web_crawl_md_response.rbs b/sig/context_dev/models/web_web_crawl_md_response.rbs index 81e1ec24..45e931ad 100644 --- a/sig/context_dev/models/web_web_crawl_md_response.rbs +++ b/sig/context_dev/models/web_web_crawl_md_response.rbs @@ -103,6 +103,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -158,6 +159,12 @@ module ContextDev def favicon=: (String) -> String + attr_reader headings: ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading]? + + def headings=: ( + ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading] + ) -> ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading] + attr_reader image: String? def image=: (String) -> String @@ -218,6 +225,7 @@ module ContextDev ?canonical_url: String, ?description: String, ?favicon: String, + ?headings: ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading], ?image: String, ?json_ld: ::Array[::Hash[Symbol, top]], ?keywords: ::Array[String], @@ -244,6 +252,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -299,6 +308,18 @@ module ContextDev } end + type heading = { level: Integer, text: String } + + class Heading < ContextDev::Internal::Type::BaseModel + attr_accessor level: Integer + + attr_accessor text: String + + def initialize: (level: Integer, text: String) -> void + + def to_hash: -> { level: Integer, text: String } + end + type open_graph = String | ::Array[String] module OpenGraph diff --git a/sig/context_dev/models/web_web_scrape_html_params.rbs b/sig/context_dev/models/web_web_scrape_html_params.rbs index 0eec60ff..e5b2264c 100644 --- a/sig/context_dev/models/web_web_scrape_html_params.rbs +++ b/sig/context_dev/models/web_web_scrape_html_params.rbs @@ -7,14 +7,14 @@ module ContextDev country: ContextDev::Models::WebWebScrapeHTMLParams::country, exclude_selectors: ::Array[String]?, headers: ::Hash[Symbol, String], - include_frames: ContextDev::Models::WebWebScrapeHTMLParams::include_frames, + include_frames: bool, include_selectors: ::Array[String]?, max_age_ms: Integer?, pdf: ContextDev::WebWebScrapeHTMLParams::Pdf, - settle_animations: ContextDev::Models::WebWebScrapeHTMLParams::settle_animations, + settle_animations: bool, tags: ::Array[String], timeout_ms: Integer, - use_main_content_only: ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only, + use_main_content_only: bool, wait_for_ms: Integer?, zdr: ContextDev::Models::WebWebScrapeHTMLParams::zdr } @@ -40,11 +40,9 @@ module ContextDev def headers=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] - attr_reader include_frames: ContextDev::Models::WebWebScrapeHTMLParams::include_frames? + attr_reader include_frames: bool? - def include_frames=: ( - ContextDev::Models::WebWebScrapeHTMLParams::include_frames - ) -> ContextDev::Models::WebWebScrapeHTMLParams::include_frames + def include_frames=: (bool) -> bool attr_accessor include_selectors: ::Array[String]? @@ -56,11 +54,9 @@ module ContextDev ContextDev::WebWebScrapeHTMLParams::Pdf ) -> ContextDev::WebWebScrapeHTMLParams::Pdf - attr_reader settle_animations: ContextDev::Models::WebWebScrapeHTMLParams::settle_animations? + attr_reader settle_animations: bool? - def settle_animations=: ( - ContextDev::Models::WebWebScrapeHTMLParams::settle_animations - ) -> ContextDev::Models::WebWebScrapeHTMLParams::settle_animations + def settle_animations=: (bool) -> bool attr_reader tags: ::Array[String]? @@ -70,11 +66,9 @@ module ContextDev def timeout_ms=: (Integer) -> Integer - attr_reader use_main_content_only: ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only? + attr_reader use_main_content_only: bool? - def use_main_content_only=: ( - ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only - ) -> ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only + def use_main_content_only=: (bool) -> bool attr_accessor wait_for_ms: Integer? @@ -90,14 +84,14 @@ module ContextDev ?country: ContextDev::Models::WebWebScrapeHTMLParams::country, ?exclude_selectors: ::Array[String]?, ?headers: ::Hash[Symbol, String], - ?include_frames: ContextDev::Models::WebWebScrapeHTMLParams::include_frames, + ?include_frames: bool, ?include_selectors: ::Array[String]?, ?max_age_ms: Integer?, ?pdf: ContextDev::WebWebScrapeHTMLParams::Pdf, - ?settle_animations: ContextDev::Models::WebWebScrapeHTMLParams::settle_animations, + ?settle_animations: bool, ?tags: ::Array[String], ?timeout_ms: Integer, - ?use_main_content_only: ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only, + ?use_main_content_only: bool, ?wait_for_ms: Integer?, ?zdr: ContextDev::Models::WebWebScrapeHTMLParams::zdr, ?request_options: ContextDev::request_opts @@ -109,14 +103,14 @@ module ContextDev country: ContextDev::Models::WebWebScrapeHTMLParams::country, exclude_selectors: ::Array[String]?, headers: ::Hash[Symbol, String], - include_frames: ContextDev::Models::WebWebScrapeHTMLParams::include_frames, + include_frames: bool, include_selectors: ::Array[String]?, max_age_ms: Integer?, pdf: ContextDev::WebWebScrapeHTMLParams::Pdf, - settle_animations: ContextDev::Models::WebWebScrapeHTMLParams::settle_animations, + settle_animations: bool, tags: ::Array[String], timeout_ms: Integer, - use_main_content_only: ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only, + use_main_content_only: bool, wait_for_ms: Integer?, zdr: ContextDev::Models::WebWebScrapeHTMLParams::zdr, request_options: ContextDev::RequestOptions @@ -573,41 +567,21 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::country] end - type include_frames = bool | :true | :false - - module IncludeFrames - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::include_frames] - - TRUE: :true - FALSE: :false - end - type pdf = - { - end_: Integer, - ocr: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr, - should_parse: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse, - start: Integer - } + { end_: Integer, ocr: bool, should_parse: bool, start: Integer } class Pdf < ContextDev::Internal::Type::BaseModel attr_reader end_: Integer? def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr - ) -> ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse - ) -> ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -615,61 +589,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr, - ?should_parse: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr, - should_parse: ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end - end - - type settle_animations = bool | :true | :false - - module SettleAnimations - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::settle_animations] - - TRUE: :true - FALSE: :false - end - - type use_main_content_only = bool | :true | :false - - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only] - - TRUE: :true - FALSE: :false end type zdr = :enabled | :disabled diff --git a/sig/context_dev/models/web_web_scrape_html_response.rbs b/sig/context_dev/models/web_web_scrape_html_response.rbs index 1fb2b185..6b219eb1 100644 --- a/sig/context_dev/models/web_web_scrape_html_response.rbs +++ b/sig/context_dev/models/web_web_scrape_html_response.rbs @@ -71,6 +71,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -117,6 +118,12 @@ module ContextDev def favicon=: (String) -> String + attr_reader headings: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading]? + + def headings=: ( + ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading] + ) -> ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading] + attr_reader image: String? def image=: (String) -> String @@ -176,6 +183,7 @@ module ContextDev ?canonical_url: String, ?description: String, ?favicon: String, + ?headings: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading], ?image: String, ?json_ld: ::Array[::Hash[Symbol, top]], ?keywords: ::Array[String], @@ -198,6 +206,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -254,6 +263,18 @@ module ContextDev } end + type heading = { level: Integer, text: String } + + class Heading < ContextDev::Internal::Type::BaseModel + attr_accessor level: Integer + + attr_accessor text: String + + def initialize: (level: Integer, text: String) -> void + + def to_hash: -> { level: Integer, text: String } + end + type open_graph = String | ::Array[String] module OpenGraph diff --git a/sig/context_dev/models/web_web_scrape_images_params.rbs b/sig/context_dev/models/web_web_scrape_images_params.rbs index 4995f382..d9a027c2 100644 --- a/sig/context_dev/models/web_web_scrape_images_params.rbs +++ b/sig/context_dev/models/web_web_scrape_images_params.rbs @@ -4,7 +4,7 @@ module ContextDev { url: String, actions: ::Array[ContextDev::Models::WebWebScrapeImagesParams::action]?, - dedupe: ContextDev::Models::WebWebScrapeImagesParams::dedupe, + dedupe: bool, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment?, headers: ::Hash[Symbol, String], max_age_ms: Integer?, @@ -22,11 +22,9 @@ module ContextDev attr_accessor actions: ::Array[ContextDev::Models::WebWebScrapeImagesParams::action]? - attr_reader dedupe: ContextDev::Models::WebWebScrapeImagesParams::dedupe? + attr_reader dedupe: bool? - def dedupe=: ( - ContextDev::Models::WebWebScrapeImagesParams::dedupe - ) -> ContextDev::Models::WebWebScrapeImagesParams::dedupe + def dedupe=: (bool) -> bool attr_accessor enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment? @@ -49,7 +47,7 @@ module ContextDev def initialize: ( url: String, ?actions: ::Array[ContextDev::Models::WebWebScrapeImagesParams::action]?, - ?dedupe: ContextDev::Models::WebWebScrapeImagesParams::dedupe, + ?dedupe: bool, ?enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment?, ?headers: ::Hash[Symbol, String], ?max_age_ms: Integer?, @@ -62,7 +60,7 @@ module ContextDev def to_hash: -> { url: String, actions: ::Array[ContextDev::Models::WebWebScrapeImagesParams::action]?, - dedupe: ContextDev::Models::WebWebScrapeImagesParams::dedupe, + dedupe: bool, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment?, headers: ::Hash[Symbol, String], max_age_ms: Integer?, @@ -106,94 +104,44 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeImagesParams::action] end - type dedupe = bool | :true | :false - - module Dedupe - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeImagesParams::dedupe] - - TRUE: :true - FALSE: :false - end - type enrichment = { - classification: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification, - hosted_url: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url, + classification: bool, + hosted_url: bool, max_time_per_ms: Integer, - resolution: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution + resolution: bool } class Enrichment < ContextDev::Internal::Type::BaseModel - attr_reader classification: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification? + attr_reader classification: bool? - def classification=: ( - ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification - ) -> ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification + def classification=: (bool) -> bool - attr_reader hosted_url: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url? + attr_reader hosted_url: bool? - def hosted_url=: ( - ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url - ) -> ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url + def hosted_url=: (bool) -> bool attr_reader max_time_per_ms: Integer? def max_time_per_ms=: (Integer) -> Integer - attr_reader resolution: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution? + attr_reader resolution: bool? - def resolution=: ( - ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution - ) -> ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution + def resolution=: (bool) -> bool def initialize: ( - ?classification: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification, - ?hosted_url: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url, + ?classification: bool, + ?hosted_url: bool, ?max_time_per_ms: Integer, - ?resolution: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution + ?resolution: bool ) -> void def to_hash: -> { - classification: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification, - hosted_url: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url, + classification: bool, + hosted_url: bool, max_time_per_ms: Integer, - resolution: ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution + resolution: bool } - - type classification = bool | :true | :false - - module Classification - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeImagesParams::Enrichment::classification] - - TRUE: :true - FALSE: :false - end - - type hosted_url = bool | :true | :false - - module HostedURL - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeImagesParams::Enrichment::hosted_url] - - TRUE: :true - FALSE: :false - end - - type resolution = bool | :true | :false - - module Resolution - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeImagesParams::Enrichment::resolution] - - TRUE: :true - FALSE: :false - end end end end diff --git a/sig/context_dev/models/web_web_scrape_md_params.rbs b/sig/context_dev/models/web_web_scrape_md_params.rbs index ba54f9af..9f8a3aec 100644 --- a/sig/context_dev/models/web_web_scrape_md_params.rbs +++ b/sig/context_dev/models/web_web_scrape_md_params.rbs @@ -7,17 +7,18 @@ module ContextDev country: ContextDev::Models::WebWebScrapeMdParams::country, exclude_selectors: ::Array[String]?, headers: ::Hash[Symbol, String], - include_frames: ContextDev::Models::WebWebScrapeMdParams::include_frames, - include_images: ContextDev::Models::WebWebScrapeMdParams::include_images, - include_links: ContextDev::Models::WebWebScrapeMdParams::include_links, + include_frames: bool, + include_html: bool, + include_images: bool, + include_links: bool, include_selectors: ::Array[String]?, max_age_ms: Integer?, pdf: ContextDev::WebWebScrapeMdParams::Pdf, - settle_animations: ContextDev::Models::WebWebScrapeMdParams::settle_animations, - :shorten_base64_images => ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images, + settle_animations: bool, + :shorten_base64_images => bool, tags: ::Array[String], timeout_ms: Integer, - use_main_content_only: ContextDev::Models::WebWebScrapeMdParams::use_main_content_only, + use_main_content_only: bool, wait_for_ms: Integer?, zdr: ContextDev::Models::WebWebScrapeMdParams::zdr } @@ -43,23 +44,21 @@ module ContextDev def headers=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] - attr_reader include_frames: ContextDev::Models::WebWebScrapeMdParams::include_frames? + attr_reader include_frames: bool? - def include_frames=: ( - ContextDev::Models::WebWebScrapeMdParams::include_frames - ) -> ContextDev::Models::WebWebScrapeMdParams::include_frames + def include_frames=: (bool) -> bool - attr_reader include_images: ContextDev::Models::WebWebScrapeMdParams::include_images? + attr_reader include_html: bool? - def include_images=: ( - ContextDev::Models::WebWebScrapeMdParams::include_images - ) -> ContextDev::Models::WebWebScrapeMdParams::include_images + def include_html=: (bool) -> bool - attr_reader include_links: ContextDev::Models::WebWebScrapeMdParams::include_links? + attr_reader include_images: bool? - def include_links=: ( - ContextDev::Models::WebWebScrapeMdParams::include_links - ) -> ContextDev::Models::WebWebScrapeMdParams::include_links + def include_images=: (bool) -> bool + + attr_reader include_links: bool? + + def include_links=: (bool) -> bool attr_accessor include_selectors: ::Array[String]? @@ -71,17 +70,13 @@ module ContextDev ContextDev::WebWebScrapeMdParams::Pdf ) -> ContextDev::WebWebScrapeMdParams::Pdf - attr_reader settle_animations: ContextDev::Models::WebWebScrapeMdParams::settle_animations? + attr_reader settle_animations: bool? - def settle_animations=: ( - ContextDev::Models::WebWebScrapeMdParams::settle_animations - ) -> ContextDev::Models::WebWebScrapeMdParams::settle_animations + def settle_animations=: (bool) -> bool - attr_reader shorten_base64_images: ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images? + attr_reader shorten_base64_images: bool? - def shorten_base64_images=: ( - ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images - ) -> ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images + def shorten_base64_images=: (bool) -> bool attr_reader tags: ::Array[String]? @@ -91,11 +86,9 @@ module ContextDev def timeout_ms=: (Integer) -> Integer - attr_reader use_main_content_only: ContextDev::Models::WebWebScrapeMdParams::use_main_content_only? + attr_reader use_main_content_only: bool? - def use_main_content_only=: ( - ContextDev::Models::WebWebScrapeMdParams::use_main_content_only - ) -> ContextDev::Models::WebWebScrapeMdParams::use_main_content_only + def use_main_content_only=: (bool) -> bool attr_accessor wait_for_ms: Integer? @@ -111,17 +104,18 @@ module ContextDev ?country: ContextDev::Models::WebWebScrapeMdParams::country, ?exclude_selectors: ::Array[String]?, ?headers: ::Hash[Symbol, String], - ?include_frames: ContextDev::Models::WebWebScrapeMdParams::include_frames, - ?include_images: ContextDev::Models::WebWebScrapeMdParams::include_images, - ?include_links: ContextDev::Models::WebWebScrapeMdParams::include_links, + ?include_frames: bool, + ?include_html: bool, + ?include_images: bool, + ?include_links: bool, ?include_selectors: ::Array[String]?, ?max_age_ms: Integer?, ?pdf: ContextDev::WebWebScrapeMdParams::Pdf, - ?settle_animations: ContextDev::Models::WebWebScrapeMdParams::settle_animations, - ?shorten_base64_images: ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images, + ?settle_animations: bool, + ?shorten_base64_images: bool, ?tags: ::Array[String], ?timeout_ms: Integer, - ?use_main_content_only: ContextDev::Models::WebWebScrapeMdParams::use_main_content_only, + ?use_main_content_only: bool, ?wait_for_ms: Integer?, ?zdr: ContextDev::Models::WebWebScrapeMdParams::zdr, ?request_options: ContextDev::request_opts @@ -133,17 +127,18 @@ module ContextDev country: ContextDev::Models::WebWebScrapeMdParams::country, exclude_selectors: ::Array[String]?, headers: ::Hash[Symbol, String], - include_frames: ContextDev::Models::WebWebScrapeMdParams::include_frames, - include_images: ContextDev::Models::WebWebScrapeMdParams::include_images, - include_links: ContextDev::Models::WebWebScrapeMdParams::include_links, + include_frames: bool, + include_html: bool, + include_images: bool, + include_links: bool, include_selectors: ::Array[String]?, max_age_ms: Integer?, pdf: ContextDev::WebWebScrapeMdParams::Pdf, - settle_animations: ContextDev::Models::WebWebScrapeMdParams::settle_animations, - :shorten_base64_images => ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images, + settle_animations: bool, + :shorten_base64_images => bool, tags: ::Array[String], timeout_ms: Integer, - use_main_content_only: ContextDev::Models::WebWebScrapeMdParams::use_main_content_only, + use_main_content_only: bool, wait_for_ms: Integer?, zdr: ContextDev::Models::WebWebScrapeMdParams::zdr, request_options: ContextDev::RequestOptions @@ -600,63 +595,21 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::country] end - type include_frames = bool | :true | :false - - module IncludeFrames - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::include_frames] - - TRUE: :true - FALSE: :false - end - - type include_images = bool | :true | :false - - module IncludeImages - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::include_images] - - TRUE: :true - FALSE: :false - end - - type include_links = bool | :true | :false - - module IncludeLinks - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::include_links] - - TRUE: :true - FALSE: :false - end - type pdf = - { - end_: Integer, - ocr: ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr, - should_parse: ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse, - start: Integer - } + { end_: Integer, ocr: bool, should_parse: bool, start: Integer } class Pdf < ContextDev::Internal::Type::BaseModel attr_reader end_: Integer? def end_=: (Integer) -> Integer - attr_reader ocr: ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr? + attr_reader ocr: bool? - def ocr=: ( - ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr - ) -> ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr + def ocr=: (bool) -> bool - attr_reader should_parse: ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse? + attr_reader should_parse: bool? - def should_parse=: ( - ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse - ) -> ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse + def should_parse=: (bool) -> bool attr_reader start: Integer? @@ -664,72 +617,17 @@ module ContextDev def initialize: ( ?end_: Integer, - ?ocr: ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr, - ?should_parse: ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse, + ?ocr: bool, + ?should_parse: bool, ?start: Integer ) -> void def to_hash: -> { end_: Integer, - ocr: ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr, - should_parse: ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse, + ocr: bool, + should_parse: bool, start: Integer } - - type ocr = bool | :true | :false - - module Ocr - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::Pdf::ocr] - - TRUE: :true - FALSE: :false - end - - type should_parse = bool | :true | :false - - module ShouldParse - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::Pdf::should_parse] - - TRUE: :true - FALSE: :false - end - end - - type settle_animations = bool | :true | :false - - module SettleAnimations - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::settle_animations] - - TRUE: :true - FALSE: :false - end - - type shorten_base64_images = bool | :true | :false - - module ShortenBase64Images - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images] - - TRUE: :true - FALSE: :false - end - - type use_main_content_only = bool | :true | :false - - module UseMainContentOnly - extend ContextDev::Internal::Type::Union - - def self?.variants: -> ::Array[ContextDev::Models::WebWebScrapeMdParams::use_main_content_only] - - TRUE: :true - FALSE: :false end type zdr = :enabled | :disabled diff --git a/sig/context_dev/models/web_web_scrape_md_response.rbs b/sig/context_dev/models/web_web_scrape_md_response.rbs index 4a6ca937..58f4a72e 100644 --- a/sig/context_dev/models/web_web_scrape_md_response.rbs +++ b/sig/context_dev/models/web_web_scrape_md_response.rbs @@ -9,6 +9,7 @@ module ContextDev url: String, actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], actions_html_stale: bool, + html: String, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -33,6 +34,10 @@ module ContextDev def actions_html_stale=: (bool) -> bool + attr_reader html: String? + + def html=: (String) -> String + attr_reader key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata? def key_metadata=: ( @@ -47,6 +52,7 @@ module ContextDev url: String, ?actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], ?actions_html_stale: bool, + ?html: String, ?key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata ) -> void @@ -58,6 +64,7 @@ module ContextDev url: String, actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], actions_html_stale: bool, + html: String, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -71,6 +78,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -117,6 +125,12 @@ module ContextDev def favicon=: (String) -> String + attr_reader headings: ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading]? + + def headings=: ( + ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading] + ) -> ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading] + attr_reader image: String? def image=: (String) -> String @@ -176,6 +190,7 @@ module ContextDev ?canonical_url: String, ?description: String, ?favicon: String, + ?headings: ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading], ?image: String, ?json_ld: ::Array[::Hash[Symbol, top]], ?keywords: ::Array[String], @@ -198,6 +213,7 @@ module ContextDev canonical_url: String, description: String, favicon: String, + headings: ::Array[ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading], image: String, json_ld: ::Array[::Hash[Symbol, top]], keywords: ::Array[String], @@ -254,6 +270,18 @@ module ContextDev } end + type heading = { level: Integer, text: String } + + class Heading < ContextDev::Internal::Type::BaseModel + attr_accessor level: Integer + + attr_accessor text: String + + def initialize: (level: Integer, text: String) -> void + + def to_hash: -> { level: Integer, text: String } + end + type open_graph = String | ::Array[String] module OpenGraph diff --git a/sig/context_dev/resources/brand.rbs b/sig/context_dev/resources/brand.rbs index fc5e79b6..a5fc43e9 100644 --- a/sig/context_dev/resources/brand.rbs +++ b/sig/context_dev/resources/brand.rbs @@ -17,7 +17,10 @@ module ContextDev def search: ( query: String, + ?autocomplete: bool, + ?query_by: ::Array[ContextDev::Models::BrandSearchParams::query_by], ?tags: ::Array[String], + ?typo_tolerance: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::BrandSearchResponse diff --git a/sig/context_dev/resources/news.rbs b/sig/context_dev/resources/news.rbs new file mode 100644 index 00000000..6da33681 --- /dev/null +++ b/sig/context_dev/resources/news.rbs @@ -0,0 +1,17 @@ +module ContextDev + module Resources + class News + def search: ( + search_by: ContextDev::NewsSearchParams::SearchBy, + ?cursor: String?, + ?filter_by: ContextDev::NewsSearchParams::FilterBy, + ?limit: Integer, + ?sort_by: ContextDev::NewsSearchParams::SortBy, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::NewsSearchResponse + + def initialize: (client: ContextDev::Client) -> void + end + end +end diff --git a/sig/context_dev/resources/parse.rbs b/sig/context_dev/resources/parse.rbs index 38e6deeb..a556df87 100644 --- a/sig/context_dev/resources/parse.rbs +++ b/sig/context_dev/resources/parse.rbs @@ -5,13 +5,13 @@ module ContextDev body: ContextDev::Internal::file_input, ?client: String, ?extension: ContextDev::Models::ParseHandleParams::extension, - ?include_images: ContextDev::Models::ParseHandleParams::include_images, - ?include_links: ContextDev::Models::ParseHandleParams::include_links, - ?ocr: ContextDev::Models::ParseHandleParams::ocr, + ?include_images: bool, + ?include_links: bool, + ?ocr: bool, ?pdf: ContextDev::ParseHandleParams::Pdf, - ?shorten_base64_images: ContextDev::Models::ParseHandleParams::shorten_base64_images, + ?shorten_base64_images: bool, ?tags: ::Array[String], - ?use_main_content_only: ContextDev::Models::ParseHandleParams::use_main_content_only, + ?use_main_content_only: bool, ?zdr: ContextDev::Models::ParseHandleParams::zdr, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::ParseHandleResponse diff --git a/sig/context_dev/resources/web.rbs b/sig/context_dev/resources/web.rbs index 256162ed..8500cc1c 100644 --- a/sig/context_dev/resources/web.rbs +++ b/sig/context_dev/resources/web.rbs @@ -53,7 +53,7 @@ module ContextDev ?direct_url: String, ?domain: String, ?full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, - ?handle_cookie_popup: ContextDev::Models::WebScreenshotParams::handle_cookie_popup, + ?handle_cookie_popup: bool, ?max_age_ms: Integer?, ?page: ContextDev::Models::WebScreenshotParams::page, ?scroll_offset: Integer?, @@ -110,14 +110,14 @@ module ContextDev ?country: ContextDev::Models::WebWebScrapeHTMLParams::country, ?exclude_selectors: ::Array[String]?, ?headers: ::Hash[Symbol, String], - ?include_frames: ContextDev::Models::WebWebScrapeHTMLParams::include_frames, + ?include_frames: bool, ?include_selectors: ::Array[String]?, ?max_age_ms: Integer?, ?pdf: ContextDev::WebWebScrapeHTMLParams::Pdf, - ?settle_animations: ContextDev::Models::WebWebScrapeHTMLParams::settle_animations, + ?settle_animations: bool, ?tags: ::Array[String], ?timeout_ms: Integer, - ?use_main_content_only: ContextDev::Models::WebWebScrapeHTMLParams::use_main_content_only, + ?use_main_content_only: bool, ?wait_for_ms: Integer?, ?zdr: ContextDev::Models::WebWebScrapeHTMLParams::zdr, ?request_options: ContextDev::request_opts @@ -126,7 +126,7 @@ module ContextDev def web_scrape_images: ( url: String, ?actions: ::Array[ContextDev::Models::WebWebScrapeImagesParams::action]?, - ?dedupe: ContextDev::Models::WebWebScrapeImagesParams::dedupe, + ?dedupe: bool, ?enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment?, ?headers: ::Hash[Symbol, String], ?max_age_ms: Integer?, @@ -142,17 +142,18 @@ module ContextDev ?country: ContextDev::Models::WebWebScrapeMdParams::country, ?exclude_selectors: ::Array[String]?, ?headers: ::Hash[Symbol, String], - ?include_frames: ContextDev::Models::WebWebScrapeMdParams::include_frames, - ?include_images: ContextDev::Models::WebWebScrapeMdParams::include_images, - ?include_links: ContextDev::Models::WebWebScrapeMdParams::include_links, + ?include_frames: bool, + ?include_html: bool, + ?include_images: bool, + ?include_links: bool, ?include_selectors: ::Array[String]?, ?max_age_ms: Integer?, ?pdf: ContextDev::WebWebScrapeMdParams::Pdf, - ?settle_animations: ContextDev::Models::WebWebScrapeMdParams::settle_animations, - ?shorten_base64_images: ContextDev::Models::WebWebScrapeMdParams::shorten_base64_images, + ?settle_animations: bool, + ?shorten_base64_images: bool, ?tags: ::Array[String], ?timeout_ms: Integer, - ?use_main_content_only: ContextDev::Models::WebWebScrapeMdParams::use_main_content_only, + ?use_main_content_only: bool, ?wait_for_ms: Integer?, ?zdr: ContextDev::Models::WebWebScrapeMdParams::zdr, ?request_options: ContextDev::request_opts diff --git a/test/context_dev/resources/news_test.rb b/test/context_dev/resources/news_test.rb new file mode 100644 index 00000000..f7ddd2e2 --- /dev/null +++ b/test/context_dev/resources/news_test.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class ContextDev::Test::Resources::NewsTest < ContextDev::Test::ResourceTest + def test_search_required_params + skip("Mock server tests are disabled") + + response = @context_dev.news.search(search_by: {entity: {name: "xx", type: :name}, type: :entity}) + + assert_pattern do + response => ContextDev::Models::NewsSearchResponse + end + + assert_pattern do + response => { + data: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::NewsSearchResponse::Data]), + has_more: ContextDev::Internal::Type::Boolean, + meta: ContextDev::Models::NewsSearchResponse::Meta, + next_cursor: String | nil, + key_metadata: ContextDev::Models::NewsSearchResponse::KeyMetadata | nil + } + end + end +end diff --git a/test/context_dev/resources/web_test.rb b/test/context_dev/resources/web_test.rb index 79e8a995..b3f2c6a5 100644 --- a/test/context_dev/resources/web_test.rb +++ b/test/context_dev/resources/web_test.rb @@ -208,6 +208,7 @@ def test_web_scrape_md_required_params url: String, actions_applied: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied]) | nil, actions_html_stale: ContextDev::Internal::Type::Boolean | nil, + html: String | nil, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata | nil } end