context.dev 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +0 -4
  5. data/lib/context_dev/internal/type/base_model.rb +3 -3
  6. data/lib/context_dev/internal/util.rb +3 -1
  7. data/lib/context_dev/models/brand_identify_from_transaction_params.rb +65 -1
  8. data/lib/context_dev/models/brand_identify_from_transaction_response.rb +190 -5
  9. data/lib/context_dev/models/brand_retrieve_by_email_params.rb +65 -0
  10. data/lib/context_dev/models/brand_retrieve_by_email_response.rb +190 -5
  11. data/lib/context_dev/models/brand_retrieve_by_isin_params.rb +65 -0
  12. data/lib/context_dev/models/brand_retrieve_by_isin_response.rb +190 -5
  13. data/lib/context_dev/models/brand_retrieve_by_name_params.rb +70 -5
  14. data/lib/context_dev/models/brand_retrieve_by_name_response.rb +190 -5
  15. data/lib/context_dev/models/brand_retrieve_by_ticker_params.rb +65 -0
  16. data/lib/context_dev/models/brand_retrieve_by_ticker_response.rb +190 -5
  17. data/lib/context_dev/models/brand_retrieve_params.rb +68 -5
  18. data/lib/context_dev/models/brand_retrieve_response.rb +190 -5
  19. data/lib/context_dev/models/industry_retrieve_naics_params.rb +4 -4
  20. data/lib/context_dev/models/{style_extract_fonts_params.rb → web_extract_fonts_params.rb} +18 -7
  21. data/lib/context_dev/models/{style_extract_fonts_response.rb → web_extract_fonts_response.rb} +5 -5
  22. data/lib/context_dev/models/{style_extract_styleguide_params.rb → web_extract_styleguide_params.rb} +8 -5
  23. data/lib/context_dev/models/{style_extract_styleguide_response.rb → web_extract_styleguide_response.rb} +147 -80
  24. data/lib/context_dev/models/web_screenshot_params.rb +19 -6
  25. data/lib/context_dev/models/web_web_scrape_html_params.rb +14 -1
  26. data/lib/context_dev/models/web_web_scrape_md_params.rb +13 -3
  27. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +2 -3
  28. data/lib/context_dev/models.rb +4 -4
  29. data/lib/context_dev/resources/brand.rb +9 -13
  30. data/lib/context_dev/resources/industry.rb +3 -3
  31. data/lib/context_dev/resources/web.rb +85 -20
  32. data/lib/context_dev/version.rb +1 -1
  33. data/lib/context_dev.rb +4 -5
  34. data/rbi/context_dev/client.rbi +0 -3
  35. data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +325 -2
  36. data/rbi/context_dev/models/brand_identify_from_transaction_response.rbi +859 -6
  37. data/rbi/context_dev/models/brand_retrieve_by_email_params.rbi +325 -0
  38. data/rbi/context_dev/models/brand_retrieve_by_email_response.rbi +859 -6
  39. data/rbi/context_dev/models/brand_retrieve_by_isin_params.rbi +325 -0
  40. data/rbi/context_dev/models/brand_retrieve_by_isin_response.rbi +859 -6
  41. data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +331 -6
  42. data/rbi/context_dev/models/brand_retrieve_by_name_response.rbi +859 -6
  43. data/rbi/context_dev/models/brand_retrieve_by_ticker_params.rbi +325 -0
  44. data/rbi/context_dev/models/brand_retrieve_by_ticker_response.rbi +859 -6
  45. data/rbi/context_dev/models/brand_retrieve_params.rbi +328 -6
  46. data/rbi/context_dev/models/brand_retrieve_response.rbi +859 -6
  47. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +6 -6
  48. data/rbi/context_dev/models/{style_extract_fonts_params.rbi → web_extract_fonts_params.rbi} +27 -7
  49. data/rbi/context_dev/models/{style_extract_fonts_response.rbi → web_extract_fonts_response.rbi} +6 -9
  50. data/rbi/context_dev/models/{style_extract_styleguide_params.rbi → web_extract_styleguide_params.rbi} +12 -6
  51. data/rbi/context_dev/models/{style_extract_styleguide_response.rbi → web_extract_styleguide_response.rbi} +232 -94
  52. data/rbi/context_dev/models/web_screenshot_params.rbi +31 -8
  53. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +19 -1
  54. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +17 -2
  55. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +2 -4
  56. data/rbi/context_dev/models.rbi +4 -5
  57. data/rbi/context_dev/resources/brand.rbi +10 -16
  58. data/rbi/context_dev/resources/industry.rbi +4 -4
  59. data/rbi/context_dev/resources/web.rbi +81 -17
  60. data/sig/context_dev/client.rbs +0 -2
  61. data/sig/context_dev/models/brand_identify_from_transaction_params.rbs +131 -1
  62. data/sig/context_dev/models/brand_identify_from_transaction_response.rbs +342 -5
  63. data/sig/context_dev/models/brand_retrieve_by_email_params.rbs +131 -1
  64. data/sig/context_dev/models/brand_retrieve_by_email_response.rbs +342 -5
  65. data/sig/context_dev/models/brand_retrieve_by_isin_params.rbs +131 -1
  66. data/sig/context_dev/models/brand_retrieve_by_isin_response.rbs +342 -5
  67. data/sig/context_dev/models/brand_retrieve_by_name_params.rbs +131 -1
  68. data/sig/context_dev/models/brand_retrieve_by_name_response.rbs +342 -5
  69. data/sig/context_dev/models/brand_retrieve_by_ticker_params.rbs +131 -1
  70. data/sig/context_dev/models/brand_retrieve_by_ticker_response.rbs +342 -5
  71. data/sig/context_dev/models/brand_retrieve_params.rbs +131 -1
  72. data/sig/context_dev/models/brand_retrieve_response.rbs +342 -5
  73. data/sig/context_dev/models/{style_extract_styleguide_params.rbs → web_extract_fonts_params.rbs} +2 -2
  74. data/sig/context_dev/models/{style_extract_fonts_response.rbs → web_extract_fonts_response.rbs} +6 -6
  75. data/sig/context_dev/models/{style_extract_fonts_params.rbs → web_extract_styleguide_params.rbs} +13 -5
  76. data/sig/context_dev/models/{style_extract_styleguide_response.rbs → web_extract_styleguide_response.rbs} +147 -95
  77. data/sig/context_dev/models/web_screenshot_params.rbs +11 -2
  78. data/sig/context_dev/models/web_web_scrape_html_params.rbs +8 -1
  79. data/sig/context_dev/models/web_web_scrape_md_params.rbs +7 -0
  80. data/sig/context_dev/models.rbs +4 -4
  81. data/sig/context_dev/resources/web.rbs +18 -1
  82. metadata +14 -17
  83. data/lib/context_dev/resources/style.rb +0 -76
  84. data/rbi/context_dev/resources/style.rbi +0 -60
  85. data/sig/context_dev/resources/style.rbs +0 -20
@@ -11,10 +11,23 @@ module ContextDev
11
11
  T.any(ContextDev::WebScreenshotParams, ContextDev::Internal::AnyHash)
12
12
  end
13
13
 
14
+ # A specific URL to screenshot directly, bypassing domain resolution (e.g.,
15
+ # 'https://example.com/pricing'). When provided, the screenshot is taken of this
16
+ # exact URL. You must provide either 'domain' or 'directUrl', but not both.
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :direct_url
19
+
20
+ sig { params(direct_url: String).void }
21
+ attr_writer :direct_url
22
+
14
23
  # Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
15
- # domain will be automatically normalized and validated.
16
- sig { returns(String) }
17
- attr_accessor :domain
24
+ # domain will be automatically normalized and validated. You must provide either
25
+ # 'domain' or 'directUrl', but not both.
26
+ sig { returns(T.nilable(String)) }
27
+ attr_reader :domain
28
+
29
+ sig { params(domain: String).void }
30
+ attr_writer :domain
18
31
 
19
32
  # Optional parameter to determine screenshot type. If 'true', takes a full page
20
33
  # screenshot capturing all content. If 'false' or not provided, takes a viewport
@@ -37,7 +50,8 @@ module ContextDev
37
50
  # Optional parameter to specify which page type to screenshot. If provided, the
38
51
  # system will scrape the domain's links and use heuristics to find the most
39
52
  # appropriate URL for the specified page type (30 supported languages). If not
40
- # provided, screenshots the main domain landing page.
53
+ # provided, screenshots the main domain landing page. Only applicable when using
54
+ # 'domain', not 'directUrl'.
41
55
  sig do
42
56
  returns(T.nilable(ContextDev::WebScreenshotParams::Page::OrSymbol))
43
57
  end
@@ -65,6 +79,7 @@ module ContextDev
65
79
 
66
80
  sig do
67
81
  params(
82
+ direct_url: String,
68
83
  domain: String,
69
84
  full_screenshot:
70
85
  ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
@@ -74,9 +89,14 @@ module ContextDev
74
89
  ).returns(T.attached_class)
75
90
  end
76
91
  def self.new(
92
+ # A specific URL to screenshot directly, bypassing domain resolution (e.g.,
93
+ # 'https://example.com/pricing'). When provided, the screenshot is taken of this
94
+ # exact URL. You must provide either 'domain' or 'directUrl', but not both.
95
+ direct_url: nil,
77
96
  # Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
78
- # domain will be automatically normalized and validated.
79
- domain:,
97
+ # domain will be automatically normalized and validated. You must provide either
98
+ # 'domain' or 'directUrl', but not both.
99
+ domain: nil,
80
100
  # Optional parameter to determine screenshot type. If 'true', takes a full page
81
101
  # screenshot capturing all content. If 'false' or not provided, takes a viewport
82
102
  # screenshot (standard browser view).
@@ -84,7 +104,8 @@ module ContextDev
84
104
  # Optional parameter to specify which page type to screenshot. If provided, the
85
105
  # system will scrape the domain's links and use heuristics to find the most
86
106
  # appropriate URL for the specified page type (30 supported languages). If not
87
- # provided, screenshots the main domain landing page.
107
+ # provided, screenshots the main domain landing page. Only applicable when using
108
+ # 'domain', not 'directUrl'.
88
109
  page: nil,
89
110
  # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
90
111
  # faster capture with basic quality. If 'quality', optimizes for higher quality
@@ -97,6 +118,7 @@ module ContextDev
97
118
  sig do
98
119
  override.returns(
99
120
  {
121
+ direct_url: String,
100
122
  domain: String,
101
123
  full_screenshot:
102
124
  ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
@@ -146,7 +168,8 @@ module ContextDev
146
168
  # Optional parameter to specify which page type to screenshot. If provided, the
147
169
  # system will scrape the domain's links and use heuristics to find the most
148
170
  # appropriate URL for the specified page type (30 supported languages). If not
149
- # provided, screenshots the main domain landing page.
171
+ # provided, screenshots the main domain landing page. Only applicable when using
172
+ # 'domain', not 'directUrl'.
150
173
  module Page
151
174
  extend ContextDev::Internal::Type::Enum
152
175
 
@@ -18,22 +18,40 @@ module ContextDev
18
18
  sig { returns(String) }
19
19
  attr_accessor :url
20
20
 
21
+ # Return a cached result if a prior scrape for the same parameters exists and is
22
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
23
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_reader :max_age_ms
26
+
27
+ sig { params(max_age_ms: Integer).void }
28
+ attr_writer :max_age_ms
29
+
21
30
  sig do
22
31
  params(
23
32
  url: String,
33
+ max_age_ms: Integer,
24
34
  request_options: ContextDev::RequestOptions::OrHash
25
35
  ).returns(T.attached_class)
26
36
  end
27
37
  def self.new(
28
38
  # Full URL to scrape (must include http:// or https:// protocol)
29
39
  url:,
40
+ # Return a cached result if a prior scrape for the same parameters exists and is
41
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
42
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
43
+ max_age_ms: nil,
30
44
  request_options: {}
31
45
  )
32
46
  end
33
47
 
34
48
  sig do
35
49
  override.returns(
36
- { url: String, request_options: ContextDev::RequestOptions }
50
+ {
51
+ url: String,
52
+ max_age_ms: Integer,
53
+ request_options: ContextDev::RequestOptions
54
+ }
37
55
  )
38
56
  end
39
57
  def to_hash
@@ -11,7 +11,7 @@ module ContextDev
11
11
  T.any(ContextDev::WebWebScrapeMdParams, ContextDev::Internal::AnyHash)
12
12
  end
13
13
 
14
- # Full URL to scrape and convert to markdown (must include http:// or https://
14
+ # Full URL to scrape into LLM usable Markdown (must include http:// or https://
15
15
  # protocol)
16
16
  sig { returns(String) }
17
17
  attr_accessor :url
@@ -30,6 +30,15 @@ module ContextDev
30
30
  sig { params(include_links: T::Boolean).void }
31
31
  attr_writer :include_links
32
32
 
33
+ # Return a cached result if a prior scrape for the same parameters exists and is
34
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
35
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
36
+ sig { returns(T.nilable(Integer)) }
37
+ attr_reader :max_age_ms
38
+
39
+ sig { params(max_age_ms: Integer).void }
40
+ attr_writer :max_age_ms
41
+
33
42
  # Shorten base64-encoded image data in the Markdown output
34
43
  sig { returns(T.nilable(T::Boolean)) }
35
44
  attr_reader :shorten_base64_images
@@ -50,19 +59,24 @@ module ContextDev
50
59
  url: String,
51
60
  include_images: T::Boolean,
52
61
  include_links: T::Boolean,
62
+ max_age_ms: Integer,
53
63
  shorten_base64_images: T::Boolean,
54
64
  use_main_content_only: T::Boolean,
55
65
  request_options: ContextDev::RequestOptions::OrHash
56
66
  ).returns(T.attached_class)
57
67
  end
58
68
  def self.new(
59
- # Full URL to scrape and convert to markdown (must include http:// or https://
69
+ # Full URL to scrape into LLM usable Markdown (must include http:// or https://
60
70
  # protocol)
61
71
  url:,
62
72
  # Include image references in Markdown output
63
73
  include_images: nil,
64
74
  # Preserve hyperlinks in Markdown output
65
75
  include_links: nil,
76
+ # Return a cached result if a prior scrape for the same parameters exists and is
77
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
78
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
79
+ max_age_ms: nil,
66
80
  # Shorten base64-encoded image data in the Markdown output
67
81
  shorten_base64_images: nil,
68
82
  # Extract only the main content of the page, excluding headers, footers, sidebars,
@@ -78,6 +92,7 @@ module ContextDev
78
92
  url: String,
79
93
  include_images: T::Boolean,
80
94
  include_links: T::Boolean,
95
+ max_age_ms: Integer,
81
96
  shorten_base64_images: T::Boolean,
82
97
  use_main_content_only: T::Boolean,
83
98
  request_options: ContextDev::RequestOptions
@@ -14,8 +14,7 @@ module ContextDev
14
14
  )
15
15
  end
16
16
 
17
- # Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
18
- # automatically normalized and validated.
17
+ # Domain to build a sitemap for
19
18
  sig { returns(String) }
20
19
  attr_accessor :domain
21
20
 
@@ -35,8 +34,7 @@ module ContextDev
35
34
  ).returns(T.attached_class)
36
35
  end
37
36
  def self.new(
38
- # Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
39
- # automatically normalized and validated.
37
+ # Domain to build a sitemap for
40
38
  domain:,
41
39
  # Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
42
40
  # Minimum is 1, maximum is 100,000.
@@ -25,16 +25,15 @@ module ContextDev
25
25
 
26
26
  IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
27
27
 
28
- StyleExtractFontsParams = ContextDev::Models::StyleExtractFontsParams
29
-
30
- StyleExtractStyleguideParams =
31
- ContextDev::Models::StyleExtractStyleguideParams
32
-
33
28
  UtilityPrefetchByEmailParams =
34
29
  ContextDev::Models::UtilityPrefetchByEmailParams
35
30
 
36
31
  UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
37
32
 
33
+ WebExtractFontsParams = ContextDev::Models::WebExtractFontsParams
34
+
35
+ WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
36
+
38
37
  WebScreenshotParams = ContextDev::Models::WebScreenshotParams
39
38
 
40
39
  WebWebCrawlMdParams = ContextDev::Models::WebWebCrawlMdParams
@@ -19,8 +19,7 @@ module ContextDev
19
19
  # Domain name to retrieve brand data for (e.g., 'example.com', 'google.com').
20
20
  # Cannot be used with name or ticker parameters.
21
21
  domain:,
22
- # Optional parameter to force the language of the retrieved brand data. Works with
23
- # all three lookup methods.
22
+ # Optional parameter to force the language of the retrieved brand data.
24
23
  force_language: nil,
25
24
  # Optional parameter to optimize the API call for maximum speed. When set to true,
26
25
  # the API will skip time-consuming operations for faster response at the cost of
@@ -64,7 +63,6 @@ module ContextDev
64
63
  force_language: nil,
65
64
  # When set to true, the API will perform an additional verification steps to
66
65
  # ensure the identified brand matches the transaction with high confidence.
67
- # Defaults to false.
68
66
  high_confidence_only: nil,
69
67
  # Optional parameter to optimize the API call for maximum speed. When set to true,
70
68
  # the API will skip time-consuming operations for faster response at the cost of
@@ -84,9 +82,8 @@ module ContextDev
84
82
  end
85
83
 
86
84
  # Retrieve brand information using an email address while detecting disposable and
87
- # free email addresses. This endpoint extracts the domain from the email address
88
- # and returns brand data for that domain. Disposable and free email addresses
89
- # (like gmail.com, yahoo.com) will throw a 422 error.
85
+ # free email addresses. Disposable and free email addresses (like gmail.com,
86
+ # yahoo.com) will throw a 422 error.
90
87
  sig do
91
88
  params(
92
89
  email: String,
@@ -117,8 +114,7 @@ module ContextDev
117
114
  end
118
115
 
119
116
  # Retrieve brand information using an ISIN (International Securities
120
- # Identification Number). This endpoint looks up the company associated with the
121
- # ISIN and returns its brand data.
117
+ # Identification Number).
122
118
  sig do
123
119
  params(
124
120
  isin: String,
@@ -148,8 +144,7 @@ module ContextDev
148
144
  )
149
145
  end
150
146
 
151
- # Retrieve brand information using a company name. This endpoint searches for the
152
- # company by name and returns its brand data.
147
+ # Retrieve brand information using a company name.
153
148
  sig do
154
149
  params(
155
150
  name: String,
@@ -166,8 +161,8 @@ module ContextDev
166
161
  # Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft
167
162
  # Corporation'). Must be 3-30 characters.
168
163
  name:,
169
- # Optional country code (GL parameter) to specify the country. This affects the
170
- # geographic location used for search queries.
164
+ # Optional country code hint (GL parameter) to specify the country for the company
165
+ # name.
171
166
  country_gl: nil,
172
167
  # Optional parameter to force the language of the retrieved brand data.
173
168
  force_language: nil,
@@ -183,8 +178,7 @@ module ContextDev
183
178
  )
184
179
  end
185
180
 
186
- # Retrieve brand information using a stock ticker symbol. This endpoint looks up
187
- # the company associated with the ticker and returns its brand data.
181
+ # Retrieve brand information using a stock ticker symbol.
188
182
  sig do
189
183
  params(
190
184
  ticker: String,
@@ -218,8 +212,8 @@ module ContextDev
218
212
  end
219
213
 
220
214
  # Returns a simplified version of brand data containing only essential
221
- # information: domain, title, colors, logos, and backdrops. This endpoint is
222
- # optimized for faster responses and reduced data transfer.
215
+ # information: domain, title, colors, logos, and backdrops. Optimized for faster
216
+ # responses and reduced data transfer.
223
217
  sig do
224
218
  params(
225
219
  domain: String,
@@ -3,7 +3,7 @@
3
3
  module ContextDev
4
4
  module Resources
5
5
  class Industry
6
- # Endpoint to classify any brand into a 2022 NAICS code.
6
+ # Classify any brand into 2022 NAICS industry codes from its domain or name.
7
7
  sig do
8
8
  params(
9
9
  input: String,
@@ -14,9 +14,9 @@ module ContextDev
14
14
  ).returns(ContextDev::Models::IndustryRetrieveNaicsResponse)
15
15
  end
16
16
  def retrieve_naics(
17
- # Brand domain or title to retrieve NAICS code for. If a valid domain is provided
18
- # in `input`, it will be used for classification, otherwise, we will search for
19
- # the brand using the provided title.
17
+ # Brand domain or title to retrieve NAICS code for. If a valid domain is provided,
18
+ # it will be used for classification, otherwise, we will search for the brand
19
+ # using the provided title.
20
20
  input:,
21
21
  # Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults
22
22
  # to 5.
@@ -3,12 +3,65 @@
3
3
  module ContextDev
4
4
  module Resources
5
5
  class Web
6
- # Capture a screenshot of a website. Supports both viewport (standard browser
7
- # view) and full-page screenshots. Can also screenshot specific page types (login,
8
- # pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
9
- # the uploaded screenshot image hosted on our CDN.
6
+ # Scrape font information from a website including font families, usage
7
+ # statistics, fallbacks, and element/word counts.
10
8
  sig do
11
9
  params(
10
+ direct_url: String,
11
+ domain: String,
12
+ timeout_ms: Integer,
13
+ request_options: ContextDev::RequestOptions::OrHash
14
+ ).returns(ContextDev::Models::WebExtractFontsResponse)
15
+ end
16
+ def extract_fonts(
17
+ # A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
18
+ # 'https://example.com/design-system'). When provided, fonts are extracted from
19
+ # this exact URL. You must provide either 'domain' or 'directUrl', but not both.
20
+ direct_url: nil,
21
+ # Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
22
+ # domain will be automatically normalized and validated. You must provide either
23
+ # 'domain' or 'directUrl', but not both.
24
+ domain: nil,
25
+ # Optional timeout in milliseconds for the request. If the request takes longer
26
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
27
+ # value is 300000ms (5 minutes).
28
+ timeout_ms: nil,
29
+ request_options: {}
30
+ )
31
+ end
32
+
33
+ # Extract a comprehensive design system from a website including colors,
34
+ # typography, spacing, shadows, and UI components.
35
+ sig do
36
+ params(
37
+ direct_url: String,
38
+ domain: String,
39
+ timeout_ms: Integer,
40
+ request_options: ContextDev::RequestOptions::OrHash
41
+ ).returns(ContextDev::Models::WebExtractStyleguideResponse)
42
+ end
43
+ def extract_styleguide(
44
+ # A specific URL to fetch the styleguide from directly, bypassing domain
45
+ # resolution (e.g., 'https://example.com/design-system'). When provided, the
46
+ # styleguide is extracted from this exact URL. You must provide either 'domain' or
47
+ # 'directUrl', but not both.
48
+ direct_url: nil,
49
+ # Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
50
+ # domain will be automatically normalized and validated. You must provide either
51
+ # 'domain' or 'directUrl', but not both.
52
+ domain: nil,
53
+ # Optional timeout in milliseconds for the request. If the request takes longer
54
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
55
+ # value is 300000ms (5 minutes).
56
+ timeout_ms: nil,
57
+ request_options: {}
58
+ )
59
+ end
60
+
61
+ # Capture a screenshot of a website.
62
+ sig do
63
+ params(
64
+ direct_url: String,
12
65
  domain: String,
13
66
  full_screenshot:
14
67
  ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
@@ -18,9 +71,14 @@ module ContextDev
18
71
  ).returns(ContextDev::Models::WebScreenshotResponse)
19
72
  end
20
73
  def screenshot(
74
+ # A specific URL to screenshot directly, bypassing domain resolution (e.g.,
75
+ # 'https://example.com/pricing'). When provided, the screenshot is taken of this
76
+ # exact URL. You must provide either 'domain' or 'directUrl', but not both.
77
+ direct_url: nil,
21
78
  # Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
22
- # domain will be automatically normalized and validated.
23
- domain:,
79
+ # domain will be automatically normalized and validated. You must provide either
80
+ # 'domain' or 'directUrl', but not both.
81
+ domain: nil,
24
82
  # Optional parameter to determine screenshot type. If 'true', takes a full page
25
83
  # screenshot capturing all content. If 'false' or not provided, takes a viewport
26
84
  # screenshot (standard browser view).
@@ -28,7 +86,8 @@ module ContextDev
28
86
  # Optional parameter to specify which page type to screenshot. If provided, the
29
87
  # system will scrape the domain's links and use heuristics to find the most
30
88
  # appropriate URL for the specified page type (30 supported languages). If not
31
- # provided, screenshots the main domain landing page.
89
+ # provided, screenshots the main domain landing page. Only applicable when using
90
+ # 'domain', not 'directUrl'.
32
91
  page: nil,
33
92
  # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
34
93
  # faster capture with basic quality. If 'quality', optimizes for higher quality
@@ -39,8 +98,7 @@ module ContextDev
39
98
  end
40
99
 
41
100
  # Performs a crawl starting from a given URL, extracts page content as Markdown,
42
- # and returns results for all crawled pages. Only follows links within the same
43
- # domain as the starting URL. Costs 1 credit per successful page crawled.
101
+ # and returns results for all crawled pages.
44
102
  sig do
45
103
  params(
46
104
  url: String,
@@ -85,12 +143,17 @@ module ContextDev
85
143
  sig do
86
144
  params(
87
145
  url: String,
146
+ max_age_ms: Integer,
88
147
  request_options: ContextDev::RequestOptions::OrHash
89
148
  ).returns(ContextDev::Models::WebWebScrapeHTMLResponse)
90
149
  end
91
150
  def web_scrape_html(
92
151
  # Full URL to scrape (must include http:// or https:// protocol)
93
152
  url:,
153
+ # Return a cached result if a prior scrape for the same parameters exists and is
154
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
155
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
156
+ max_age_ms: nil,
94
157
  request_options: {}
95
158
  )
96
159
  end
@@ -111,26 +174,30 @@ module ContextDev
111
174
  )
112
175
  end
113
176
 
114
- # Scrapes the given URL, converts the HTML content to Markdown, and returns the
115
- # result.
177
+ # Scrapes the given URL into LLM usable Markdown.
116
178
  sig do
117
179
  params(
118
180
  url: String,
119
181
  include_images: T::Boolean,
120
182
  include_links: T::Boolean,
183
+ max_age_ms: Integer,
121
184
  shorten_base64_images: T::Boolean,
122
185
  use_main_content_only: T::Boolean,
123
186
  request_options: ContextDev::RequestOptions::OrHash
124
187
  ).returns(ContextDev::Models::WebWebScrapeMdResponse)
125
188
  end
126
189
  def web_scrape_md(
127
- # Full URL to scrape and convert to markdown (must include http:// or https://
190
+ # Full URL to scrape into LLM usable Markdown (must include http:// or https://
128
191
  # protocol)
129
192
  url:,
130
193
  # Include image references in Markdown output
131
194
  include_images: nil,
132
195
  # Preserve hyperlinks in Markdown output
133
196
  include_links: nil,
197
+ # Return a cached result if a prior scrape for the same parameters exists and is
198
+ # younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
199
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
200
+ max_age_ms: nil,
134
201
  # Shorten base64-encoded image data in the Markdown output
135
202
  shorten_base64_images: nil,
136
203
  # Extract only the main content of the page, excluding headers, footers, sidebars,
@@ -140,9 +207,7 @@ module ContextDev
140
207
  )
141
208
  end
142
209
 
143
- # Crawls the sitemap of the given domain and returns all discovered page URLs.
144
- # Supports sitemap index files (recursive), parallel fetching with concurrency
145
- # control, deduplication, and filters out non-page resources (images, PDFs, etc.).
210
+ # Crawl an entire website's sitemap and return all discovered page URLs.
146
211
  sig do
147
212
  params(
148
213
  domain: String,
@@ -151,8 +216,7 @@ module ContextDev
151
216
  ).returns(ContextDev::Models::WebWebScrapeSitemapResponse)
152
217
  end
153
218
  def web_scrape_sitemap(
154
- # Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
155
- # automatically normalized and validated.
219
+ # Domain to build a sitemap for
156
220
  domain:,
157
221
  # Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
158
222
  # Minimum is 1, maximum is 100,000.
@@ -14,8 +14,6 @@ module ContextDev
14
14
 
15
15
  attr_reader ai: ContextDev::Resources::AI
16
16
 
17
- attr_reader style: ContextDev::Resources::Style
18
-
19
17
  attr_reader brand: ContextDev::Resources::Brand
20
18
 
21
19
  attr_reader industry: ContextDev::Resources::Industry