Skip to content

Commit de020ba

Browse files
feat(api): api update
1 parent e9fb3b8 commit de020ba

4 files changed

Lines changed: 20 additions & 2 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: 25
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d3da262409c68576e457536f6c0e7ecc538219e0af19df415111c18f8fe92cfd.yml
3-
openapi_spec_hash: 25009575202702d24bc6672472eb8506
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a4f78808dc23a76896b451576b3b44b0d663977f2032eaed0271dd386b20c43c.yml
3+
openapi_spec_hash: 01f9e1ae0d635f8b874f48e3ba461476
44
config_hash: c7b0cdaba3b9797b77efd89e1754d803

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def extract_styleguide(
353353
def screenshot(
354354
self,
355355
*,
356+
color_scheme: Literal["light", "dark"] | Omit = omit,
356357
country: Literal[
357358
"ad",
358359
"ae",
@@ -581,6 +582,9 @@ def screenshot(
581582
Capture a screenshot of a website.
582583
583584
Args:
585+
color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use
586+
'light' or 'dark' when the site offers both appearances.
587+
584588
country: Two-letter ISO 3166-1 alpha-2 country code for the website request location.
585589
When provided, Context.dev fetches the target page from that country.
586590
@@ -644,6 +648,7 @@ def screenshot(
644648
timeout=timeout,
645649
query=maybe_transform(
646650
{
651+
"color_scheme": color_scheme,
647652
"country": country,
648653
"direct_url": direct_url,
649654
"domain": domain,
@@ -2376,6 +2381,7 @@ async def extract_styleguide(
23762381
async def screenshot(
23772382
self,
23782383
*,
2384+
color_scheme: Literal["light", "dark"] | Omit = omit,
23792385
country: Literal[
23802386
"ad",
23812387
"ae",
@@ -2604,6 +2610,9 @@ async def screenshot(
26042610
Capture a screenshot of a website.
26052611
26062612
Args:
2613+
color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use
2614+
'light' or 'dark' when the site offers both appearances.
2615+
26072616
country: Two-letter ISO 3166-1 alpha-2 country code for the website request location.
26082617
When provided, Context.dev fetches the target page from that country.
26092618
@@ -2667,6 +2676,7 @@ async def screenshot(
26672676
timeout=timeout,
26682677
query=await async_maybe_transform(
26692678
{
2679+
"color_scheme": color_scheme,
26702680
"country": country,
26712681
"direct_url": direct_url,
26722682
"domain": domain,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111

1212
class WebScreenshotParams(TypedDict, total=False):
13+
color_scheme: Annotated[Literal["light", "dark"], PropertyInfo(alias="colorScheme")]
14+
"""Optional parameter to choose the site's visual theme in the screenshot.
15+
16+
Use 'light' or 'dark' when the site offers both appearances.
17+
"""
18+
1319
country: Literal[
1420
"ad",
1521
"ae",

‎tests/api_resources/test_web.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def test_method_screenshot(self, client: ContextDev) -> None:
242242
@parametrize
243243
def test_method_screenshot_with_all_params(self, client: ContextDev) -> None:
244244
web = client.web.screenshot(
245+
color_scheme="light",
245246
country="de",
246247
direct_url="https://example.com",
247248
domain="domain",
@@ -841,6 +842,7 @@ async def test_method_screenshot(self, async_client: AsyncContextDev) -> None:
841842
@parametrize
842843
async def test_method_screenshot_with_all_params(self, async_client: AsyncContextDev) -> None:
843844
web = await async_client.web.screenshot(
845+
color_scheme="light",
844846
country="de",
845847
direct_url="https://example.com",
846848
domain="domain",

0 commit comments

Comments
 (0)