Skip to content

Commit b09024f

Browse files
feat(api): api update
1 parent 4e74fe3 commit b09024f

10 files changed

Lines changed: 99 additions & 9 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-86caee6743259bcab1e72868d17acdfc8a515d51b6d9b1e9a1dca49cdd3bd8da.yml
3-
openapi_spec_hash: c0855025a8590139f57db43dd3e1bad1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-955fa0d672331fb3f8b40547895bfdd1e490add254ca13db769289d3bef2ed44.yml
3+
openapi_spec_hash: 32eca3166fb8f369c9241faf4cee3077
44
config_hash: 682b89b02a20f5d1c13e2c91ecbcf5ce

‎lib/context_dev/models/web_web_scrape_html_params.rb‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,22 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel
1313
# @return [String]
1414
required :url, String
1515

16-
# @!method initialize(url:, request_options: {})
16+
# @!attribute max_age_ms
17+
# Return a cached result if a prior scrape for the same parameters exists and is
18+
# younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
19+
# omitted. Set to 0 to always scrape fresh.
20+
#
21+
# @return [Integer, nil]
22+
optional :max_age_ms, Integer
23+
24+
# @!method initialize(url:, max_age_ms: nil, request_options: {})
25+
# Some parameter documentations has been truncated, see
26+
# {ContextDev::Models::WebWebScrapeHTMLParams} for more details.
27+
#
1728
# @param url [String] Full URL to scrape (must include http:// or https:// protocol)
1829
#
30+
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
31+
#
1932
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
2033
end
2134
end

‎lib/context_dev/models/web_web_scrape_md_params.rb‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel
2626
# @return [Boolean, nil]
2727
optional :include_links, ContextDev::Internal::Type::Boolean
2828

29+
# @!attribute max_age_ms
30+
# Return a cached result if a prior scrape for the same parameters exists and is
31+
# younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
32+
# omitted. Set to 0 to always scrape fresh.
33+
#
34+
# @return [Integer, nil]
35+
optional :max_age_ms, Integer
36+
2937
# @!attribute shorten_base64_images
3038
# Shorten base64-encoded image data in the Markdown output
3139
#
@@ -39,7 +47,7 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel
3947
# @return [Boolean, nil]
4048
optional :use_main_content_only, ContextDev::Internal::Type::Boolean
4149

42-
# @!method initialize(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
50+
# @!method initialize(url:, include_images: nil, include_links: nil, max_age_ms: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
4351
# Some parameter documentations has been truncated, see
4452
# {ContextDev::Models::WebWebScrapeMdParams} for more details.
4553
#
@@ -49,6 +57,8 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel
4957
#
5058
# @param include_links [Boolean] Preserve hyperlinks in Markdown output
5159
#
60+
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
61+
#
5262
# @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output
5363
#
5464
# @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars,

‎lib/context_dev/resources/web.rb‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ def web_crawl_md(params)
8484
)
8585
end
8686

87+
# Some parameter documentations has been truncated, see
88+
# {ContextDev::Models::WebWebScrapeHTMLParams} for more details.
89+
#
8790
# Scrapes the given URL and returns the raw HTML content of the page.
8891
#
89-
# @overload web_scrape_html(url:, request_options: {})
92+
# @overload web_scrape_html(url:, max_age_ms: nil, request_options: {})
9093
#
9194
# @param url [String] Full URL to scrape (must include http:// or https:// protocol)
9295
#
96+
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
97+
#
9398
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
9499
#
95100
# @return [ContextDev::Models::WebWebScrapeHTMLResponse]
@@ -101,7 +106,7 @@ def web_scrape_html(params)
101106
@client.request(
102107
method: :get,
103108
path: "web/scrape/html",
104-
query: query,
109+
query: query.transform_keys(max_age_ms: "maxAgeMs"),
105110
model: ContextDev::Models::WebWebScrapeHTMLResponse,
106111
options: options
107112
)
@@ -138,14 +143,16 @@ def web_scrape_images(params)
138143
# Scrapes the given URL, converts the HTML content to Markdown, and returns the
139144
# result.
140145
#
141-
# @overload web_scrape_md(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
146+
# @overload web_scrape_md(url:, include_images: nil, include_links: nil, max_age_ms: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
142147
#
143148
# @param url [String] Full URL to scrape and convert to markdown (must include http:// or https:// pro
144149
#
145150
# @param include_images [Boolean] Include image references in Markdown output
146151
#
147152
# @param include_links [Boolean] Preserve hyperlinks in Markdown output
148153
#
154+
# @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
155+
#
149156
# @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output
150157
#
151158
# @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars,
@@ -164,6 +171,7 @@ def web_scrape_md(params)
164171
query: query.transform_keys(
165172
include_images: "includeImages",
166173
include_links: "includeLinks",
174+
max_age_ms: "maxAgeMs",
167175
shorten_base64_images: "shortenBase64Images",
168176
use_main_content_only: "useMainContentOnly"
169177
),

‎rbi/context_dev/models/web_web_scrape_html_params.rbi‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,40 @@ module ContextDev
1818
sig { returns(String) }
1919
attr_accessor :url
2020

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. 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+
2130
sig do
2231
params(
2332
url: String,
33+
max_age_ms: Integer,
2434
request_options: ContextDev::RequestOptions::OrHash
2535
).returns(T.attached_class)
2636
end
2737
def self.new(
2838
# Full URL to scrape (must include http:// or https:// protocol)
2939
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. Set to 0 to always scrape fresh.
43+
max_age_ms: nil,
3044
request_options: {}
3145
)
3246
end
3347

3448
sig do
3549
override.returns(
36-
{ url: String, request_options: ContextDev::RequestOptions }
50+
{
51+
url: String,
52+
max_age_ms: Integer,
53+
request_options: ContextDev::RequestOptions
54+
}
3755
)
3856
end
3957
def to_hash

‎rbi/context_dev/models/web_web_scrape_md_params.rbi‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ module ContextDev
3030
sig { params(include_links: T::Boolean).void }
3131
attr_writer :include_links
3232

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. 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+
3342
# Shorten base64-encoded image data in the Markdown output
3443
sig { returns(T.nilable(T::Boolean)) }
3544
attr_reader :shorten_base64_images
@@ -50,6 +59,7 @@ module ContextDev
5059
url: String,
5160
include_images: T::Boolean,
5261
include_links: T::Boolean,
62+
max_age_ms: Integer,
5363
shorten_base64_images: T::Boolean,
5464
use_main_content_only: T::Boolean,
5565
request_options: ContextDev::RequestOptions::OrHash
@@ -63,6 +73,10 @@ module ContextDev
6373
include_images: nil,
6474
# Preserve hyperlinks in Markdown output
6575
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. Set to 0 to always scrape fresh.
79+
max_age_ms: nil,
6680
# Shorten base64-encoded image data in the Markdown output
6781
shorten_base64_images: nil,
6882
# Extract only the main content of the page, excluding headers, footers, sidebars,
@@ -78,6 +92,7 @@ module ContextDev
7892
url: String,
7993
include_images: T::Boolean,
8094
include_links: T::Boolean,
95+
max_age_ms: Integer,
8196
shorten_base64_images: T::Boolean,
8297
use_main_content_only: T::Boolean,
8398
request_options: ContextDev::RequestOptions

‎rbi/context_dev/resources/web.rbi‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,17 @@ module ContextDev
9292
sig do
9393
params(
9494
url: String,
95+
max_age_ms: Integer,
9596
request_options: ContextDev::RequestOptions::OrHash
9697
).returns(ContextDev::Models::WebWebScrapeHTMLResponse)
9798
end
9899
def web_scrape_html(
99100
# Full URL to scrape (must include http:// or https:// protocol)
100101
url:,
102+
# Return a cached result if a prior scrape for the same parameters exists and is
103+
# younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
104+
# omitted. Set to 0 to always scrape fresh.
105+
max_age_ms: nil,
101106
request_options: {}
102107
)
103108
end
@@ -125,6 +130,7 @@ module ContextDev
125130
url: String,
126131
include_images: T::Boolean,
127132
include_links: T::Boolean,
133+
max_age_ms: Integer,
128134
shorten_base64_images: T::Boolean,
129135
use_main_content_only: T::Boolean,
130136
request_options: ContextDev::RequestOptions::OrHash
@@ -138,6 +144,10 @@ module ContextDev
138144
include_images: nil,
139145
# Preserve hyperlinks in Markdown output
140146
include_links: nil,
147+
# Return a cached result if a prior scrape for the same parameters exists and is
148+
# younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
149+
# omitted. Set to 0 to always scrape fresh.
150+
max_age_ms: nil,
141151
# Shorten base64-encoded image data in the Markdown output
142152
shorten_base64_images: nil,
143153
# Extract only the main content of the page, excluding headers, footers, sidebars,

‎sig/context_dev/models/web_web_scrape_html_params.rbs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
module ContextDev
22
module Models
33
type web_web_scrape_html_params =
4-
{ url: String } & ContextDev::Internal::Type::request_parameters
4+
{ url: String, max_age_ms: Integer }
5+
& ContextDev::Internal::Type::request_parameters
56

67
class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel
78
extend ContextDev::Internal::Type::RequestParameters::Converter
89
include ContextDev::Internal::Type::RequestParameters
910

1011
attr_accessor url: String
1112

13+
attr_reader max_age_ms: Integer?
14+
15+
def max_age_ms=: (Integer) -> Integer
16+
1217
def initialize: (
1318
url: String,
19+
?max_age_ms: Integer,
1420
?request_options: ContextDev::request_opts
1521
) -> void
1622

1723
def to_hash: -> {
1824
url: String,
25+
max_age_ms: Integer,
1926
request_options: ContextDev::RequestOptions
2027
}
2128
end

‎sig/context_dev/models/web_web_scrape_md_params.rbs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module ContextDev
55
url: String,
66
include_images: bool,
77
include_links: bool,
8+
max_age_ms: Integer,
89
:shorten_base64_images => bool,
910
use_main_content_only: bool
1011
}
@@ -24,6 +25,10 @@ module ContextDev
2425

2526
def include_links=: (bool) -> bool
2627

28+
attr_reader max_age_ms: Integer?
29+
30+
def max_age_ms=: (Integer) -> Integer
31+
2732
attr_reader shorten_base64_images: bool?
2833

2934
def shorten_base64_images=: (bool) -> bool
@@ -36,6 +41,7 @@ module ContextDev
3641
url: String,
3742
?include_images: bool,
3843
?include_links: bool,
44+
?max_age_ms: Integer,
3945
?shorten_base64_images: bool,
4046
?use_main_content_only: bool,
4147
?request_options: ContextDev::request_opts
@@ -45,6 +51,7 @@ module ContextDev
4551
url: String,
4652
include_images: bool,
4753
include_links: bool,
54+
max_age_ms: Integer,
4855
:shorten_base64_images => bool,
4956
use_main_content_only: bool,
5057
request_options: ContextDev::RequestOptions

‎sig/context_dev/resources/web.rbs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module ContextDev
2525

2626
def web_scrape_html: (
2727
url: String,
28+
?max_age_ms: Integer,
2829
?request_options: ContextDev::request_opts
2930
) -> ContextDev::Models::WebWebScrapeHTMLResponse
3031

@@ -37,6 +38,7 @@ module ContextDev
3738
url: String,
3839
?include_images: bool,
3940
?include_links: bool,
41+
?max_age_ms: Integer,
4042
?shorten_base64_images: bool,
4143
?use_main_content_only: bool,
4244
?request_options: ContextDev::request_opts

0 commit comments

Comments
 (0)