context.dev 2.11.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +4 -4
- data/lib/context_dev/models/ai_extract_product_response.rb +102 -2
- data/lib/context_dev/models/ai_extract_products_response.rb +102 -2
- data/lib/context_dev/models/batch_get_results_response.rb +56 -1
- data/lib/context_dev/models/batch_submit_response.rb +54 -1
- data/lib/context_dev/models/brand_retrieve_response.rb +58 -3
- data/lib/context_dev/models/brand_retrieve_simplified_response.rb +55 -1
- data/lib/context_dev/models/news_search_params.rb +1 -0
- data/lib/context_dev/models/web_extract_fonts_response.rb +54 -1
- data/lib/context_dev/models/web_extract_params.rb +169 -6
- data/lib/context_dev/models/web_extract_response.rb +139 -2
- data/lib/context_dev/models/web_extract_styleguide_response.rb +55 -1
- data/lib/context_dev/models/web_screenshot_response.rb +54 -1
- data/lib/context_dev/models/web_search_response.rb +54 -1
- data/lib/context_dev/models/web_web_crawl_md_params.rb +7 -5
- data/lib/context_dev/models/web_web_crawl_md_response.rb +54 -1
- data/lib/context_dev/models/web_web_scrape_html_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_html_response.rb +54 -1
- data/lib/context_dev/models/web_web_scrape_images_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_images_response.rb +139 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_md_response.rb +54 -1
- data/lib/context_dev/resources/web.rb +9 -7
- data/lib/context_dev/version.rb +1 -1
- data/rbi/context_dev/models/ai_extract_product_response.rbi +218 -0
- data/rbi/context_dev/models/ai_extract_products_response.rbi +218 -0
- data/rbi/context_dev/models/batch_get_results_response.rbi +121 -0
- data/rbi/context_dev/models/batch_submit_response.rbi +117 -0
- data/rbi/context_dev/models/brand_retrieve_response.rbi +123 -2
- data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +121 -0
- data/rbi/context_dev/models/news_search_params.rbi +5 -0
- data/rbi/context_dev/models/web_extract_fonts_response.rbi +119 -0
- data/rbi/context_dev/models/web_extract_params.rbi +353 -8
- data/rbi/context_dev/models/web_extract_response.rbi +289 -3
- data/rbi/context_dev/models/web_extract_styleguide_response.rbi +119 -0
- data/rbi/context_dev/models/web_screenshot_response.rbi +117 -0
- data/rbi/context_dev/models/web_search_response.rbi +117 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +10 -6
- data/rbi/context_dev/models/web_web_crawl_md_response.rbi +117 -0
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_html_response.rbi +119 -0
- data/rbi/context_dev/models/web_web_scrape_images_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_images_response.rbi +288 -0
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +117 -0
- data/rbi/context_dev/resources/web.rbi +31 -10
- data/sig/context_dev/models/ai_extract_product_response.rbs +79 -0
- data/sig/context_dev/models/ai_extract_products_response.rbs +79 -0
- data/sig/context_dev/models/batch_get_results_response.rbs +39 -0
- data/sig/context_dev/models/batch_submit_response.rbs +39 -0
- data/sig/context_dev/models/brand_retrieve_response.rbs +39 -0
- data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +39 -0
- data/sig/context_dev/models/news_search_params.rbs +2 -0
- data/sig/context_dev/models/web_extract_fonts_response.rbs +39 -0
- data/sig/context_dev/models/web_extract_params.rbs +117 -0
- data/sig/context_dev/models/web_extract_response.rbs +120 -3
- data/sig/context_dev/models/web_extract_styleguide_response.rbs +39 -0
- data/sig/context_dev/models/web_screenshot_response.rbs +39 -0
- data/sig/context_dev/models/web_search_response.rbs +39 -0
- data/sig/context_dev/models/web_web_crawl_md_response.rbs +39 -0
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_html_response.rbs +39 -0
- data/sig/context_dev/models/web_web_scrape_images_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_images_response.rbs +117 -0
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +39 -0
- data/sig/context_dev/resources/web.rbs +1 -0
- metadata +2 -2
|
@@ -4,6 +4,14 @@ module ContextDev
|
|
|
4
4
|
module Models
|
|
5
5
|
# @see ContextDev::Resources::Brand#retrieve
|
|
6
6
|
class BrandRetrieveResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute cache_metadata
|
|
8
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
9
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
10
|
+
# oldest contributing hit.
|
|
11
|
+
#
|
|
12
|
+
# @return [ContextDev::Models::BrandRetrieveResponse::CacheMetadata]
|
|
13
|
+
required :cache_metadata, -> { ContextDev::Models::BrandRetrieveResponse::CacheMetadata }
|
|
14
|
+
|
|
7
15
|
# @!attribute brand
|
|
8
16
|
# Detailed brand information
|
|
9
17
|
#
|
|
@@ -29,10 +37,12 @@ module ContextDev
|
|
|
29
37
|
# @return [String, nil]
|
|
30
38
|
optional :status, String
|
|
31
39
|
|
|
32
|
-
# @!method initialize(brand: nil, code: nil, key_metadata: nil, status: nil)
|
|
40
|
+
# @!method initialize(cache_metadata:, brand: nil, code: nil, key_metadata: nil, status: nil)
|
|
33
41
|
# Some parameter documentations has been truncated, see
|
|
34
42
|
# {ContextDev::Models::BrandRetrieveResponse} for more details.
|
|
35
43
|
#
|
|
44
|
+
# @param cache_metadata [ContextDev::Models::BrandRetrieveResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
|
|
45
|
+
#
|
|
36
46
|
# @param brand [ContextDev::Models::BrandRetrieveResponse::Brand] Detailed brand information
|
|
37
47
|
#
|
|
38
48
|
# @param code [Integer] HTTP status code
|
|
@@ -41,6 +51,49 @@ module ContextDev
|
|
|
41
51
|
#
|
|
42
52
|
# @param status [String] Status of the response, e.g., 'ok'
|
|
43
53
|
|
|
54
|
+
# @see ContextDev::Models::BrandRetrieveResponse#cache_metadata
|
|
55
|
+
class CacheMetadata < ContextDev::Internal::Type::BaseModel
|
|
56
|
+
# @!attribute age_ms
|
|
57
|
+
# Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
58
|
+
#
|
|
59
|
+
# @return [Integer]
|
|
60
|
+
required :age_ms, Integer
|
|
61
|
+
|
|
62
|
+
# @!attribute status
|
|
63
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
64
|
+
# zero-data-retention cache bypass.
|
|
65
|
+
#
|
|
66
|
+
# @return [Symbol, ContextDev::Models::BrandRetrieveResponse::CacheMetadata::Status]
|
|
67
|
+
required :status, enum: -> { ContextDev::Models::BrandRetrieveResponse::CacheMetadata::Status }
|
|
68
|
+
|
|
69
|
+
# @!method initialize(age_ms:, status:)
|
|
70
|
+
# Some parameter documentations has been truncated, see
|
|
71
|
+
# {ContextDev::Models::BrandRetrieveResponse::CacheMetadata} for more details.
|
|
72
|
+
#
|
|
73
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
74
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
75
|
+
# oldest contributing hit.
|
|
76
|
+
#
|
|
77
|
+
# @param age_ms [Integer] Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
78
|
+
#
|
|
79
|
+
# @param status [Symbol, ContextDev::Models::BrandRetrieveResponse::CacheMetadata::Status] Whether the response was served from cache, required fresh work, or honored zero
|
|
80
|
+
|
|
81
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
82
|
+
# zero-data-retention cache bypass.
|
|
83
|
+
#
|
|
84
|
+
# @see ContextDev::Models::BrandRetrieveResponse::CacheMetadata#status
|
|
85
|
+
module Status
|
|
86
|
+
extend ContextDev::Internal::Type::Enum
|
|
87
|
+
|
|
88
|
+
HIT = :hit
|
|
89
|
+
MISS = :miss
|
|
90
|
+
ZDR = :zdr
|
|
91
|
+
|
|
92
|
+
# @!method self.values
|
|
93
|
+
# @return [Array<Symbol>]
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
44
97
|
# @see ContextDev::Models::BrandRetrieveResponse#brand
|
|
45
98
|
class Brand < ContextDev::Internal::Type::BaseModel
|
|
46
99
|
# @!attribute address
|
|
@@ -106,7 +159,9 @@ module ContextDev
|
|
|
106
159
|
optional :links, -> { ContextDev::Models::BrandRetrieveResponse::Brand::Links }
|
|
107
160
|
|
|
108
161
|
# @!attribute logos
|
|
109
|
-
# An array of logos associated with the brand
|
|
162
|
+
# An array of logos associated with the brand. When a similarly shaped SVG variant
|
|
163
|
+
# exists, it is returned ahead of its raster equivalent; otherwise relevance order
|
|
164
|
+
# is preserved
|
|
110
165
|
#
|
|
111
166
|
# @return [Array<ContextDev::Models::BrandRetrieveResponse::Brand::Logo>, nil]
|
|
112
167
|
optional :logos,
|
|
@@ -178,7 +233,7 @@ module ContextDev
|
|
|
178
233
|
#
|
|
179
234
|
# @param links [ContextDev::Models::BrandRetrieveResponse::Brand::Links] Important website links for the brand
|
|
180
235
|
#
|
|
181
|
-
# @param logos [Array<ContextDev::Models::BrandRetrieveResponse::Brand::Logo>] An array of logos associated with the brand
|
|
236
|
+
# @param logos [Array<ContextDev::Models::BrandRetrieveResponse::Brand::Logo>] An array of logos associated with the brand. When a similarly shaped SVG variant
|
|
182
237
|
#
|
|
183
238
|
# @param phone [String] Company phone number
|
|
184
239
|
#
|
|
@@ -4,6 +4,14 @@ module ContextDev
|
|
|
4
4
|
module Models
|
|
5
5
|
# @see ContextDev::Resources::Brand#retrieve_simplified
|
|
6
6
|
class BrandRetrieveSimplifiedResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute cache_metadata
|
|
8
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
9
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
10
|
+
# oldest contributing hit.
|
|
11
|
+
#
|
|
12
|
+
# @return [ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata]
|
|
13
|
+
required :cache_metadata, -> { ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata }
|
|
14
|
+
|
|
7
15
|
# @!attribute brand
|
|
8
16
|
# Simplified brand information
|
|
9
17
|
#
|
|
@@ -29,10 +37,12 @@ module ContextDev
|
|
|
29
37
|
# @return [String, nil]
|
|
30
38
|
optional :status, String
|
|
31
39
|
|
|
32
|
-
# @!method initialize(brand: nil, code: nil, key_metadata: nil, status: nil)
|
|
40
|
+
# @!method initialize(cache_metadata:, brand: nil, code: nil, key_metadata: nil, status: nil)
|
|
33
41
|
# Some parameter documentations has been truncated, see
|
|
34
42
|
# {ContextDev::Models::BrandRetrieveSimplifiedResponse} for more details.
|
|
35
43
|
#
|
|
44
|
+
# @param cache_metadata [ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
|
|
45
|
+
#
|
|
36
46
|
# @param brand [ContextDev::Models::BrandRetrieveSimplifiedResponse::Brand] Simplified brand information
|
|
37
47
|
#
|
|
38
48
|
# @param code [Integer] HTTP status code of the response
|
|
@@ -41,6 +51,50 @@ module ContextDev
|
|
|
41
51
|
#
|
|
42
52
|
# @param status [String] Status of the response, e.g., 'ok'
|
|
43
53
|
|
|
54
|
+
# @see ContextDev::Models::BrandRetrieveSimplifiedResponse#cache_metadata
|
|
55
|
+
class CacheMetadata < ContextDev::Internal::Type::BaseModel
|
|
56
|
+
# @!attribute age_ms
|
|
57
|
+
# Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
58
|
+
#
|
|
59
|
+
# @return [Integer]
|
|
60
|
+
required :age_ms, Integer
|
|
61
|
+
|
|
62
|
+
# @!attribute status
|
|
63
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
64
|
+
# zero-data-retention cache bypass.
|
|
65
|
+
#
|
|
66
|
+
# @return [Symbol, ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata::Status]
|
|
67
|
+
required :status, enum: -> { ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata::Status }
|
|
68
|
+
|
|
69
|
+
# @!method initialize(age_ms:, status:)
|
|
70
|
+
# Some parameter documentations has been truncated, see
|
|
71
|
+
# {ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata} for more
|
|
72
|
+
# details.
|
|
73
|
+
#
|
|
74
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
75
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
76
|
+
# oldest contributing hit.
|
|
77
|
+
#
|
|
78
|
+
# @param age_ms [Integer] Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
79
|
+
#
|
|
80
|
+
# @param status [Symbol, ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata::Status] Whether the response was served from cache, required fresh work, or honored zero
|
|
81
|
+
|
|
82
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
83
|
+
# zero-data-retention cache bypass.
|
|
84
|
+
#
|
|
85
|
+
# @see ContextDev::Models::BrandRetrieveSimplifiedResponse::CacheMetadata#status
|
|
86
|
+
module Status
|
|
87
|
+
extend ContextDev::Internal::Type::Enum
|
|
88
|
+
|
|
89
|
+
HIT = :hit
|
|
90
|
+
MISS = :miss
|
|
91
|
+
ZDR = :zdr
|
|
92
|
+
|
|
93
|
+
# @!method self.values
|
|
94
|
+
# @return [Array<Symbol>]
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
44
98
|
# @see ContextDev::Models::BrandRetrieveSimplifiedResponse#brand
|
|
45
99
|
class Brand < ContextDev::Internal::Type::BaseModel
|
|
46
100
|
# @!attribute backdrops
|
|
@@ -4,6 +4,14 @@ module ContextDev
|
|
|
4
4
|
module Models
|
|
5
5
|
# @see ContextDev::Resources::Web#extract_fonts
|
|
6
6
|
class WebExtractFontsResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute cache_metadata
|
|
8
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
9
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
10
|
+
# oldest contributing hit.
|
|
11
|
+
#
|
|
12
|
+
# @return [ContextDev::Models::WebExtractFontsResponse::CacheMetadata]
|
|
13
|
+
required :cache_metadata, -> { ContextDev::Models::WebExtractFontsResponse::CacheMetadata }
|
|
14
|
+
|
|
7
15
|
# @!attribute code
|
|
8
16
|
# HTTP status code, e.g., 200
|
|
9
17
|
#
|
|
@@ -46,10 +54,12 @@ module ContextDev
|
|
|
46
54
|
# @return [ContextDev::Models::WebExtractFontsResponse::KeyMetadata, nil]
|
|
47
55
|
optional :key_metadata, -> { ContextDev::Models::WebExtractFontsResponse::KeyMetadata }
|
|
48
56
|
|
|
49
|
-
# @!method initialize(code:, domain:, fonts:, status:, font_links: nil, key_metadata: nil)
|
|
57
|
+
# @!method initialize(cache_metadata:, code:, domain:, fonts:, status:, font_links: nil, key_metadata: nil)
|
|
50
58
|
# Some parameter documentations has been truncated, see
|
|
51
59
|
# {ContextDev::Models::WebExtractFontsResponse} for more details.
|
|
52
60
|
#
|
|
61
|
+
# @param cache_metadata [ContextDev::Models::WebExtractFontsResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
|
|
62
|
+
#
|
|
53
63
|
# @param code [Integer] HTTP status code, e.g., 200
|
|
54
64
|
#
|
|
55
65
|
# @param domain [String] The normalized domain that was processed
|
|
@@ -62,6 +72,49 @@ module ContextDev
|
|
|
62
72
|
#
|
|
63
73
|
# @param key_metadata [ContextDev::Models::WebExtractFontsResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
|
|
64
74
|
|
|
75
|
+
# @see ContextDev::Models::WebExtractFontsResponse#cache_metadata
|
|
76
|
+
class CacheMetadata < ContextDev::Internal::Type::BaseModel
|
|
77
|
+
# @!attribute age_ms
|
|
78
|
+
# Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
79
|
+
#
|
|
80
|
+
# @return [Integer]
|
|
81
|
+
required :age_ms, Integer
|
|
82
|
+
|
|
83
|
+
# @!attribute status
|
|
84
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
85
|
+
# zero-data-retention cache bypass.
|
|
86
|
+
#
|
|
87
|
+
# @return [Symbol, ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status]
|
|
88
|
+
required :status, enum: -> { ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status }
|
|
89
|
+
|
|
90
|
+
# @!method initialize(age_ms:, status:)
|
|
91
|
+
# Some parameter documentations has been truncated, see
|
|
92
|
+
# {ContextDev::Models::WebExtractFontsResponse::CacheMetadata} for more details.
|
|
93
|
+
#
|
|
94
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
95
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
96
|
+
# oldest contributing hit.
|
|
97
|
+
#
|
|
98
|
+
# @param age_ms [Integer] Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
99
|
+
#
|
|
100
|
+
# @param status [Symbol, ContextDev::Models::WebExtractFontsResponse::CacheMetadata::Status] Whether the response was served from cache, required fresh work, or honored zero
|
|
101
|
+
|
|
102
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
103
|
+
# zero-data-retention cache bypass.
|
|
104
|
+
#
|
|
105
|
+
# @see ContextDev::Models::WebExtractFontsResponse::CacheMetadata#status
|
|
106
|
+
module Status
|
|
107
|
+
extend ContextDev::Internal::Type::Enum
|
|
108
|
+
|
|
109
|
+
HIT = :hit
|
|
110
|
+
MISS = :miss
|
|
111
|
+
ZDR = :zdr
|
|
112
|
+
|
|
113
|
+
# @!method self.values
|
|
114
|
+
# @return [Array<Symbol>]
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
65
118
|
class Font < ContextDev::Internal::Type::BaseModel
|
|
66
119
|
# @!attribute fallbacks
|
|
67
120
|
# Array of fallback font families
|
|
@@ -8,9 +8,11 @@ module ContextDev
|
|
|
8
8
|
include ContextDev::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
10
|
# @!attribute schema
|
|
11
|
-
# JSON Schema for the returned data object.
|
|
12
|
-
#
|
|
13
|
-
#
|
|
11
|
+
# JSON Schema for the returned data object. Image fields such as `image_urls` or
|
|
12
|
+
# `product_photos` automatically make page image references available to
|
|
13
|
+
# extraction, so product data and photos can be returned in one call. TypeScript
|
|
14
|
+
# Zod users can pass a JSON Schema generated from a Zod object; Python users can
|
|
15
|
+
# pass the equivalent JSON Schema object.
|
|
14
16
|
#
|
|
15
17
|
# @return [Hash{Symbol=>Object}]
|
|
16
18
|
required :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
|
|
@@ -22,6 +24,15 @@ module ContextDev
|
|
|
22
24
|
# @return [String]
|
|
23
25
|
required :url, String
|
|
24
26
|
|
|
27
|
+
# @!attribute actions
|
|
28
|
+
# Optional browser actions executed in order on the requested page after it loads,
|
|
29
|
+
# before links are discovered or additional pages are crawled. Requires a paid
|
|
30
|
+
# plan. When actions are provided and stopAfterMs is omitted, the crawl budget
|
|
31
|
+
# defaults to 110000 ms.
|
|
32
|
+
#
|
|
33
|
+
# @return [Array<ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll>, nil]
|
|
34
|
+
optional :actions, -> { ContextDev::Internal::Type::ArrayOf[union: ContextDev::WebExtractParams::Action] }
|
|
35
|
+
|
|
25
36
|
# @!attribute fact_check
|
|
26
37
|
# When true, every returned value must be grounded in facts stated on the page;
|
|
27
38
|
# fields that cannot be supported by the page are returned as null/empty. When
|
|
@@ -87,7 +98,8 @@ module ContextDev
|
|
|
87
98
|
|
|
88
99
|
# @!attribute stop_after_ms
|
|
89
100
|
# Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
|
|
90
|
-
# (110s).
|
|
101
|
+
# (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are
|
|
102
|
+
# provided.
|
|
91
103
|
#
|
|
92
104
|
# @return [Integer, nil]
|
|
93
105
|
optional :stop_after_ms, Integer, api_name: :stopAfterMs
|
|
@@ -113,14 +125,16 @@ module ContextDev
|
|
|
113
125
|
# @return [Integer, nil]
|
|
114
126
|
optional :wait_for_ms, Integer, api_name: :waitForMs
|
|
115
127
|
|
|
116
|
-
# @!method initialize(schema:, url:, fact_check: nil, follow_subdomains: nil, include_frames: nil, instructions: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, pdf: nil, settle_animations: nil, stop_after_ms: nil, tags: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {})
|
|
128
|
+
# @!method initialize(schema:, url:, actions: nil, fact_check: nil, follow_subdomains: nil, include_frames: nil, instructions: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, pdf: nil, settle_animations: nil, stop_after_ms: nil, tags: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {})
|
|
117
129
|
# Some parameter documentations has been truncated, see
|
|
118
130
|
# {ContextDev::Models::WebExtractParams} for more details.
|
|
119
131
|
#
|
|
120
|
-
# @param schema [Hash{Symbol=>Object}] JSON Schema for the returned data object.
|
|
132
|
+
# @param schema [Hash{Symbol=>Object}] JSON Schema for the returned data object. Image fields such as `image_urls` or `
|
|
121
133
|
#
|
|
122
134
|
# @param url [String] The starting website URL to crawl and extract from. Must include http:// or http
|
|
123
135
|
#
|
|
136
|
+
# @param actions [Array<ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll>] Optional browser actions executed in order on the requested page after it loads,
|
|
137
|
+
#
|
|
124
138
|
# @param fact_check [Boolean] When true, every returned value must be grounded in facts stated on the page; fi
|
|
125
139
|
#
|
|
126
140
|
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain.
|
|
@@ -149,6 +163,155 @@ module ContextDev
|
|
|
149
163
|
#
|
|
150
164
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
|
151
165
|
|
|
166
|
+
# Browser action discriminated by `do`. Each variant exposes only its applicable
|
|
167
|
+
# fields.
|
|
168
|
+
module Action
|
|
169
|
+
extend ContextDev::Internal::Type::Union
|
|
170
|
+
|
|
171
|
+
discriminator :do
|
|
172
|
+
|
|
173
|
+
# Pause for a fixed number of milliseconds before continuing to the next action.
|
|
174
|
+
variant :wait, -> { ContextDev::WebExtractParams::Action::Wait }
|
|
175
|
+
|
|
176
|
+
# Resolve and perform one natural-language browser action.
|
|
177
|
+
variant :perform, -> { ContextDev::WebExtractParams::Action::Perform }
|
|
178
|
+
|
|
179
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for content and dimensions to settle after each iteration.
|
|
180
|
+
variant :scroll, -> { ContextDev::WebExtractParams::Action::Scroll }
|
|
181
|
+
|
|
182
|
+
class Wait < ContextDev::Internal::Type::BaseModel
|
|
183
|
+
# @!attribute do_
|
|
184
|
+
#
|
|
185
|
+
# @return [Symbol, :wait]
|
|
186
|
+
required :do_, const: :wait, api_name: :do
|
|
187
|
+
|
|
188
|
+
# @!attribute time_ms
|
|
189
|
+
#
|
|
190
|
+
# @return [Integer]
|
|
191
|
+
required :time_ms, Integer, api_name: :timeMs
|
|
192
|
+
|
|
193
|
+
# @!method initialize(time_ms:, do_: :wait)
|
|
194
|
+
# Pause for a fixed number of milliseconds before continuing to the next action.
|
|
195
|
+
#
|
|
196
|
+
# @param time_ms [Integer]
|
|
197
|
+
# @param do_ [Symbol, :wait]
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class Perform < ContextDev::Internal::Type::BaseModel
|
|
201
|
+
# @!attribute action
|
|
202
|
+
#
|
|
203
|
+
# @return [String]
|
|
204
|
+
required :action, String
|
|
205
|
+
|
|
206
|
+
# @!attribute do_
|
|
207
|
+
#
|
|
208
|
+
# @return [Symbol, :perform]
|
|
209
|
+
required :do_, const: :perform, api_name: :do
|
|
210
|
+
|
|
211
|
+
# @!method initialize(action:, do_: :perform)
|
|
212
|
+
# Resolve and perform one natural-language browser action.
|
|
213
|
+
#
|
|
214
|
+
# @param action [String]
|
|
215
|
+
# @param do_ [Symbol, :perform]
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
219
|
+
# @!attribute do_
|
|
220
|
+
#
|
|
221
|
+
# @return [Symbol, :scroll]
|
|
222
|
+
required :do_, const: :scroll, api_name: :do
|
|
223
|
+
|
|
224
|
+
# @!attribute amount
|
|
225
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
226
|
+
# Defaults to viewport.
|
|
227
|
+
#
|
|
228
|
+
# @return [Integer, Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Amount, nil]
|
|
229
|
+
optional :amount, union: -> { ContextDev::WebExtractParams::Action::Scroll::Amount }
|
|
230
|
+
|
|
231
|
+
# @!attribute container
|
|
232
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
233
|
+
#
|
|
234
|
+
# @return [String, nil]
|
|
235
|
+
optional :container, String
|
|
236
|
+
|
|
237
|
+
# @!attribute direction
|
|
238
|
+
# Direction to scroll. Defaults to down.
|
|
239
|
+
#
|
|
240
|
+
# @return [Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Direction, nil]
|
|
241
|
+
optional :direction, enum: -> { ContextDev::WebExtractParams::Action::Scroll::Direction }
|
|
242
|
+
|
|
243
|
+
# @!attribute max_scrolls
|
|
244
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
245
|
+
# changing. Defaults to 1.
|
|
246
|
+
#
|
|
247
|
+
# @return [Integer, nil]
|
|
248
|
+
optional :max_scrolls, Integer, api_name: :maxScrolls
|
|
249
|
+
|
|
250
|
+
# @!method initialize(amount: nil, container: nil, direction: nil, max_scrolls: nil, do_: :scroll)
|
|
251
|
+
# Some parameter documentations has been truncated, see
|
|
252
|
+
# {ContextDev::Models::WebExtractParams::Action::Scroll} for more details.
|
|
253
|
+
#
|
|
254
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for
|
|
255
|
+
# content and dimensions to settle after each iteration.
|
|
256
|
+
#
|
|
257
|
+
# @param amount [Integer, Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Amount] Pixels per scroll, one visible viewport, or the current scroll boundary. Default
|
|
258
|
+
#
|
|
259
|
+
# @param container [String] CSS selector for the first matching scroll container. Defaults to the page.
|
|
260
|
+
#
|
|
261
|
+
# @param direction [Symbol, ContextDev::Models::WebExtractParams::Action::Scroll::Direction] Direction to scroll. Defaults to down.
|
|
262
|
+
#
|
|
263
|
+
# @param max_scrolls [Integer] Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
264
|
+
#
|
|
265
|
+
# @param do_ [Symbol, :scroll]
|
|
266
|
+
|
|
267
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
268
|
+
# Defaults to viewport.
|
|
269
|
+
#
|
|
270
|
+
# @see ContextDev::Models::WebExtractParams::Action::Scroll#amount
|
|
271
|
+
module Amount
|
|
272
|
+
extend ContextDev::Internal::Type::Union
|
|
273
|
+
|
|
274
|
+
variant Integer
|
|
275
|
+
|
|
276
|
+
variant const: -> { ContextDev::Models::WebExtractParams::Action::Scroll::Amount::VIEWPORT }
|
|
277
|
+
|
|
278
|
+
variant const: -> { ContextDev::Models::WebExtractParams::Action::Scroll::Amount::MAX }
|
|
279
|
+
|
|
280
|
+
# @!method self.variants
|
|
281
|
+
# @return [Array(Integer, Symbol)]
|
|
282
|
+
|
|
283
|
+
define_sorbet_constant!(:Variants) do
|
|
284
|
+
T.type_alias { T.any(Integer, ContextDev::WebExtractParams::Action::Scroll::Amount::TaggedSymbol) }
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# @!group
|
|
288
|
+
|
|
289
|
+
VIEWPORT = :viewport
|
|
290
|
+
MAX = :max
|
|
291
|
+
|
|
292
|
+
# @!endgroup
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
# Direction to scroll. Defaults to down.
|
|
296
|
+
#
|
|
297
|
+
# @see ContextDev::Models::WebExtractParams::Action::Scroll#direction
|
|
298
|
+
module Direction
|
|
299
|
+
extend ContextDev::Internal::Type::Enum
|
|
300
|
+
|
|
301
|
+
UP = :up
|
|
302
|
+
DOWN = :down
|
|
303
|
+
LEFT = :left
|
|
304
|
+
RIGHT = :right
|
|
305
|
+
|
|
306
|
+
# @!method self.values
|
|
307
|
+
# @return [Array<Symbol>]
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# @!method self.variants
|
|
312
|
+
# @return [Array(ContextDev::Models::WebExtractParams::Action::Wait, ContextDev::Models::WebExtractParams::Action::Perform, ContextDev::Models::WebExtractParams::Action::Scroll)]
|
|
313
|
+
end
|
|
314
|
+
|
|
152
315
|
class Pdf < ContextDev::Internal::Type::BaseModel
|
|
153
316
|
# @!attribute end_
|
|
154
317
|
# Last 1-based PDF page to parse. Must be greater than or equal to start when both
|
|
@@ -4,6 +4,14 @@ module ContextDev
|
|
|
4
4
|
module Models
|
|
5
5
|
# @see ContextDev::Resources::Web#extract
|
|
6
6
|
class WebExtractResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute cache_metadata
|
|
8
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
9
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
10
|
+
# oldest contributing hit.
|
|
11
|
+
#
|
|
12
|
+
# @return [ContextDev::Models::WebExtractResponse::CacheMetadata]
|
|
13
|
+
required :cache_metadata, -> { ContextDev::Models::WebExtractResponse::CacheMetadata }
|
|
14
|
+
|
|
7
15
|
# @!attribute data
|
|
8
16
|
# Extracted data matching the request schema
|
|
9
17
|
#
|
|
@@ -40,10 +48,12 @@ module ContextDev
|
|
|
40
48
|
# @return [ContextDev::Models::WebExtractResponse::KeyMetadata, nil]
|
|
41
49
|
optional :key_metadata, -> { ContextDev::Models::WebExtractResponse::KeyMetadata }
|
|
42
50
|
|
|
43
|
-
# @!method initialize(data:, metadata:, status:, url:, urls_analyzed:, key_metadata: nil)
|
|
51
|
+
# @!method initialize(cache_metadata:, data:, metadata:, status:, url:, urls_analyzed:, key_metadata: nil)
|
|
44
52
|
# Some parameter documentations has been truncated, see
|
|
45
53
|
# {ContextDev::Models::WebExtractResponse} for more details.
|
|
46
54
|
#
|
|
55
|
+
# @param cache_metadata [ContextDev::Models::WebExtractResponse::CacheMetadata] Cache outcome for this response. Composite responses are hits only when every ca
|
|
56
|
+
#
|
|
47
57
|
# @param data [Hash{Symbol=>Object}] Extracted data matching the request schema
|
|
48
58
|
#
|
|
49
59
|
# @param metadata [ContextDev::Models::WebExtractResponse::Metadata]
|
|
@@ -56,6 +66,49 @@ module ContextDev
|
|
|
56
66
|
#
|
|
57
67
|
# @param key_metadata [ContextDev::Models::WebExtractResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when
|
|
58
68
|
|
|
69
|
+
# @see ContextDev::Models::WebExtractResponse#cache_metadata
|
|
70
|
+
class CacheMetadata < ContextDev::Internal::Type::BaseModel
|
|
71
|
+
# @!attribute age_ms
|
|
72
|
+
# Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
73
|
+
#
|
|
74
|
+
# @return [Integer]
|
|
75
|
+
required :age_ms, Integer
|
|
76
|
+
|
|
77
|
+
# @!attribute status
|
|
78
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
79
|
+
# zero-data-retention cache bypass.
|
|
80
|
+
#
|
|
81
|
+
# @return [Symbol, ContextDev::Models::WebExtractResponse::CacheMetadata::Status]
|
|
82
|
+
required :status, enum: -> { ContextDev::Models::WebExtractResponse::CacheMetadata::Status }
|
|
83
|
+
|
|
84
|
+
# @!method initialize(age_ms:, status:)
|
|
85
|
+
# Some parameter documentations has been truncated, see
|
|
86
|
+
# {ContextDev::Models::WebExtractResponse::CacheMetadata} for more details.
|
|
87
|
+
#
|
|
88
|
+
# Cache outcome for this response. Composite responses are hits only when every
|
|
89
|
+
# cache-controlled fetch contributing to the output was a hit; age_ms is the
|
|
90
|
+
# oldest contributing hit.
|
|
91
|
+
#
|
|
92
|
+
# @param age_ms [Integer] Age of the cached data in milliseconds. Zero for miss and zdr responses.
|
|
93
|
+
#
|
|
94
|
+
# @param status [Symbol, ContextDev::Models::WebExtractResponse::CacheMetadata::Status] Whether the response was served from cache, required fresh work, or honored zero
|
|
95
|
+
|
|
96
|
+
# Whether the response was served from cache, required fresh work, or honored
|
|
97
|
+
# zero-data-retention cache bypass.
|
|
98
|
+
#
|
|
99
|
+
# @see ContextDev::Models::WebExtractResponse::CacheMetadata#status
|
|
100
|
+
module Status
|
|
101
|
+
extend ContextDev::Internal::Type::Enum
|
|
102
|
+
|
|
103
|
+
HIT = :hit
|
|
104
|
+
MISS = :miss
|
|
105
|
+
ZDR = :zdr
|
|
106
|
+
|
|
107
|
+
# @!method self.values
|
|
108
|
+
# @return [Array<Symbol>]
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
59
112
|
# @see ContextDev::Models::WebExtractResponse#metadata
|
|
60
113
|
class Metadata < ContextDev::Internal::Type::BaseModel
|
|
61
114
|
# @!attribute max_crawl_depth
|
|
@@ -90,7 +143,15 @@ module ContextDev
|
|
|
90
143
|
# @return [Integer]
|
|
91
144
|
required :num_urls, Integer, api_name: :numUrls
|
|
92
145
|
|
|
93
|
-
# @!
|
|
146
|
+
# @!attribute actions_applied
|
|
147
|
+
# One verified outcome per requested browser action, in request order.
|
|
148
|
+
#
|
|
149
|
+
# @return [Array<ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied>, nil]
|
|
150
|
+
optional :actions_applied,
|
|
151
|
+
-> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied] },
|
|
152
|
+
api_name: :actionsApplied
|
|
153
|
+
|
|
154
|
+
# @!method initialize(max_crawl_depth:, num_blocked:, num_failed:, num_skipped:, num_succeeded:, num_urls:, actions_applied: nil)
|
|
94
155
|
# Some parameter documentations has been truncated, see
|
|
95
156
|
# {ContextDev::Models::WebExtractResponse::Metadata} for more details.
|
|
96
157
|
#
|
|
@@ -105,6 +166,82 @@ module ContextDev
|
|
|
105
166
|
# @param num_succeeded [Integer]
|
|
106
167
|
#
|
|
107
168
|
# @param num_urls [Integer]
|
|
169
|
+
#
|
|
170
|
+
# @param actions_applied [Array<ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied>] One verified outcome per requested browser action, in request order.
|
|
171
|
+
|
|
172
|
+
class ActionsApplied < ContextDev::Internal::Type::BaseModel
|
|
173
|
+
# @!attribute instruction
|
|
174
|
+
#
|
|
175
|
+
# @return [String]
|
|
176
|
+
required :instruction, String
|
|
177
|
+
|
|
178
|
+
# @!attribute status
|
|
179
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
180
|
+
# not verified. Skipped means it was not attempted.
|
|
181
|
+
#
|
|
182
|
+
# @return [Symbol, ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status]
|
|
183
|
+
required :status, enum: -> { ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status }
|
|
184
|
+
|
|
185
|
+
# @!attribute completion_evidence
|
|
186
|
+
# Visible page evidence used to verify an applied action.
|
|
187
|
+
#
|
|
188
|
+
# @return [String, nil]
|
|
189
|
+
optional :completion_evidence, String, api_name: :completionEvidence
|
|
190
|
+
|
|
191
|
+
# @!attribute duration_ms
|
|
192
|
+
#
|
|
193
|
+
# @return [Float, nil]
|
|
194
|
+
optional :duration_ms, Float, api_name: :durationMs
|
|
195
|
+
|
|
196
|
+
# @!attribute error
|
|
197
|
+
#
|
|
198
|
+
# @return [String, nil]
|
|
199
|
+
optional :error, String
|
|
200
|
+
|
|
201
|
+
# @!attribute method_
|
|
202
|
+
#
|
|
203
|
+
# @return [String, nil]
|
|
204
|
+
optional :method_, String, api_name: :method
|
|
205
|
+
|
|
206
|
+
# @!attribute target_description
|
|
207
|
+
#
|
|
208
|
+
# @return [String, nil]
|
|
209
|
+
optional :target_description, String, api_name: :targetDescription
|
|
210
|
+
|
|
211
|
+
# @!method initialize(instruction:, status:, completion_evidence: nil, duration_ms: nil, error: nil, method_: nil, target_description: nil)
|
|
212
|
+
# Some parameter documentations has been truncated, see
|
|
213
|
+
# {ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied} for more
|
|
214
|
+
# details.
|
|
215
|
+
#
|
|
216
|
+
# @param instruction [String]
|
|
217
|
+
#
|
|
218
|
+
# @param status [Symbol, ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status] Applied means the requested page state was visibly verified. Failed means it was
|
|
219
|
+
#
|
|
220
|
+
# @param completion_evidence [String] Visible page evidence used to verify an applied action.
|
|
221
|
+
#
|
|
222
|
+
# @param duration_ms [Float]
|
|
223
|
+
#
|
|
224
|
+
# @param error [String]
|
|
225
|
+
#
|
|
226
|
+
# @param method_ [String]
|
|
227
|
+
#
|
|
228
|
+
# @param target_description [String]
|
|
229
|
+
|
|
230
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
231
|
+
# not verified. Skipped means it was not attempted.
|
|
232
|
+
#
|
|
233
|
+
# @see ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied#status
|
|
234
|
+
module Status
|
|
235
|
+
extend ContextDev::Internal::Type::Enum
|
|
236
|
+
|
|
237
|
+
APPLIED = :applied
|
|
238
|
+
FAILED = :failed
|
|
239
|
+
SKIPPED = :skipped
|
|
240
|
+
|
|
241
|
+
# @!method self.values
|
|
242
|
+
# @return [Array<Symbol>]
|
|
243
|
+
end
|
|
244
|
+
end
|
|
108
245
|
end
|
|
109
246
|
|
|
110
247
|
# @see ContextDev::Models::WebExtractResponse#key_metadata
|