Skip to content

Commit 4a10229

Browse files
feat(api): api update
1 parent 605cf15 commit 4a10229

4 files changed

Lines changed: 49 additions & 5 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: 20
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-3a8af8deb24e840300df2b1a74edfb075287af9f38e6d343960ba75fce00ab68.yml
3-
openapi_spec_hash: acc99bb843c5c7d630bc2a80b1b97444
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-5ccec8151205f9db00c9218a6c903ddb337cbbb51384876fb2090a181b92cdf5.yml
3+
openapi_spec_hash: d82bad84c8896bf48e3c3522cf9e37f8
44
config_hash: 80cc0bee9b5635f8cd6ec09e92226d88

‎src/context/dev/resources/web.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ def web_scrape_sitemap(
259259
self,
260260
*,
261261
domain: str,
262+
max_links: int | Omit = omit,
262263
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
263264
# The extra values given here take precedence over values defined on the client or passed to this method.
264265
extra_headers: Headers | None = None,
@@ -275,6 +276,9 @@ def web_scrape_sitemap(
275276
domain: Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
276277
automatically normalized and validated.
277278
279+
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
280+
Minimum is 1, maximum is 100,000.
281+
278282
extra_headers: Send extra headers
279283
280284
extra_query: Add additional query parameters to the request
@@ -290,7 +294,13 @@ def web_scrape_sitemap(
290294
extra_query=extra_query,
291295
extra_body=extra_body,
292296
timeout=timeout,
293-
query=maybe_transform({"domain": domain}, web_web_scrape_sitemap_params.WebWebScrapeSitemapParams),
297+
query=maybe_transform(
298+
{
299+
"domain": domain,
300+
"max_links": max_links,
301+
},
302+
web_web_scrape_sitemap_params.WebWebScrapeSitemapParams,
303+
),
294304
),
295305
cast_to=WebWebScrapeSitemapResponse,
296306
)
@@ -522,6 +532,7 @@ async def web_scrape_sitemap(
522532
self,
523533
*,
524534
domain: str,
535+
max_links: int | Omit = omit,
525536
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
526537
# The extra values given here take precedence over values defined on the client or passed to this method.
527538
extra_headers: Headers | None = None,
@@ -538,6 +549,9 @@ async def web_scrape_sitemap(
538549
domain: Domain name to crawl sitemaps for (e.g., 'example.com'). The domain will be
539550
automatically normalized and validated.
540551
552+
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
553+
Minimum is 1, maximum is 100,000.
554+
541555
extra_headers: Send extra headers
542556
543557
extra_query: Add additional query parameters to the request
@@ -554,7 +568,11 @@ async def web_scrape_sitemap(
554568
extra_body=extra_body,
555569
timeout=timeout,
556570
query=await async_maybe_transform(
557-
{"domain": domain}, web_web_scrape_sitemap_params.WebWebScrapeSitemapParams
571+
{
572+
"domain": domain,
573+
"max_links": max_links,
574+
},
575+
web_web_scrape_sitemap_params.WebWebScrapeSitemapParams,
558576
),
559577
),
560578
cast_to=WebWebScrapeSitemapResponse,

‎src/context/dev/types/web_web_scrape_sitemap_params.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Required, Annotated, TypedDict
6+
7+
from .._utils import PropertyInfo
68

79
__all__ = ["WebWebScrapeSitemapParams"]
810

@@ -13,3 +15,9 @@ class WebWebScrapeSitemapParams(TypedDict, total=False):
1315
1416
The domain will be automatically normalized and validated.
1517
"""
18+
19+
max_links: Annotated[int, PropertyInfo(alias="maxLinks")]
20+
"""Maximum number of links to return from the sitemap crawl.
21+
22+
Defaults to 10,000. Minimum is 1, maximum is 100,000.
23+
"""

‎tests/api_resources/test_web.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ def test_method_web_scrape_sitemap(self, client: ContextDev) -> None:
189189
)
190190
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
191191

192+
@pytest.mark.skip(reason="Mock server tests are disabled")
193+
@parametrize
194+
def test_method_web_scrape_sitemap_with_all_params(self, client: ContextDev) -> None:
195+
web = client.web.web_scrape_sitemap(
196+
domain="domain",
197+
max_links=1,
198+
)
199+
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
200+
192201
@pytest.mark.skip(reason="Mock server tests are disabled")
193202
@parametrize
194203
def test_raw_response_web_scrape_sitemap(self, client: ContextDev) -> None:
@@ -387,6 +396,15 @@ async def test_method_web_scrape_sitemap(self, async_client: AsyncContextDev) ->
387396
)
388397
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
389398

399+
@pytest.mark.skip(reason="Mock server tests are disabled")
400+
@parametrize
401+
async def test_method_web_scrape_sitemap_with_all_params(self, async_client: AsyncContextDev) -> None:
402+
web = await async_client.web.web_scrape_sitemap(
403+
domain="domain",
404+
max_links=1,
405+
)
406+
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
407+
390408
@pytest.mark.skip(reason="Mock server tests are disabled")
391409
@parametrize
392410
async def test_raw_response_web_scrape_sitemap(self, async_client: AsyncContextDev) -> None:

0 commit comments

Comments
 (0)