Skip to content

Commit bd0f93f

Browse files
feat(api): api update
1 parent a92d7b7 commit bd0f93f

4 files changed

Lines changed: 45 additions & 31 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/brand-dev%2Fbrand.dev-f2509d0b758e88572e5a8145b8296cb330154727d9797e615ad19e44e050af26.yml
3-
openapi_spec_hash: 40640a033ee09bda79ec066ba3744206
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-905e35387d755a84a2e7cd711f31eeea130e08a83bb7b39d3fa5445a187ef62f.yml
3+
openapi_spec_hash: 205b2c17cb40ad54d76c2c06c9e5dda4
44
config_hash: 91cf2dcefb99c39eb9cd3e98e15d6011

src/brand/dev/resources/brand.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,8 @@ def retrieve_simplified(
22442244
def screenshot(
22452245
self,
22462246
*,
2247-
domain: str,
2247+
direct_url: str | Omit = omit,
2248+
domain: str | Omit = omit,
22482249
full_screenshot: Literal["true", "false"] | Omit = omit,
22492250
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
22502251
prioritize: Literal["speed", "quality"] | Omit = omit,
@@ -2259,10 +2260,15 @@ def screenshot(
22592260
22602261
Supports both viewport (standard browser
22612262
view) and full-page screenshots. Can also screenshot specific page types (login,
2262-
pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
2263-
the uploaded screenshot image hosted on our CDN.
2263+
pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
2264+
or 'directUrl' must be provided as a query parameter, but not both. Returns a
2265+
URL to the uploaded screenshot image hosted on our CDN.
22642266
22652267
Args:
2268+
direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
2269+
'https://example.com/pricing'). When provided, the screenshot is taken of this
2270+
exact URL.
2271+
22662272
domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
22672273
domain will be automatically normalized and validated.
22682274
@@ -2273,7 +2279,8 @@ def screenshot(
22732279
page: Optional parameter to specify which page type to screenshot. If provided, the
22742280
system will scrape the domain's links and use heuristics to find the most
22752281
appropriate URL for the specified page type (30 supported languages). If not
2276-
provided, screenshots the main domain landing page.
2282+
provided, screenshots the main domain landing page. Only applicable when using
2283+
'domain', not 'directUrl'.
22772284
22782285
prioritize: Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
22792286
faster capture with basic quality. If 'quality', optimizes for higher quality
@@ -2296,6 +2303,7 @@ def screenshot(
22962303
timeout=timeout,
22972304
query=maybe_transform(
22982305
{
2306+
"direct_url": direct_url,
22992307
"domain": domain,
23002308
"full_screenshot": full_screenshot,
23012309
"page": page,
@@ -4733,7 +4741,8 @@ async def retrieve_simplified(
47334741
async def screenshot(
47344742
self,
47354743
*,
4736-
domain: str,
4744+
direct_url: str | Omit = omit,
4745+
domain: str | Omit = omit,
47374746
full_screenshot: Literal["true", "false"] | Omit = omit,
47384747
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
47394748
prioritize: Literal["speed", "quality"] | Omit = omit,
@@ -4748,10 +4757,15 @@ async def screenshot(
47484757
47494758
Supports both viewport (standard browser
47504759
view) and full-page screenshots. Can also screenshot specific page types (login,
4751-
pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to
4752-
the uploaded screenshot image hosted on our CDN.
4760+
pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
4761+
or 'directUrl' must be provided as a query parameter, but not both. Returns a
4762+
URL to the uploaded screenshot image hosted on our CDN.
47534763
47544764
Args:
4765+
direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
4766+
'https://example.com/pricing'). When provided, the screenshot is taken of this
4767+
exact URL.
4768+
47554769
domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
47564770
domain will be automatically normalized and validated.
47574771
@@ -4762,7 +4776,8 @@ async def screenshot(
47624776
page: Optional parameter to specify which page type to screenshot. If provided, the
47634777
system will scrape the domain's links and use heuristics to find the most
47644778
appropriate URL for the specified page type (30 supported languages). If not
4765-
provided, screenshots the main domain landing page.
4779+
provided, screenshots the main domain landing page. Only applicable when using
4780+
'domain', not 'directUrl'.
47664781
47674782
prioritize: Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
47684783
faster capture with basic quality. If 'quality', optimizes for higher quality
@@ -4785,6 +4800,7 @@ async def screenshot(
47854800
timeout=timeout,
47864801
query=await async_maybe_transform(
47874802
{
4803+
"direct_url": direct_url,
47884804
"domain": domain,
47894805
"full_screenshot": full_screenshot,
47904806
"page": page,

src/brand/dev/types/brand_screenshot_params.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, Required, Annotated, TypedDict
5+
from typing_extensions import Literal, Annotated, TypedDict
66

77
from .._utils import PropertyInfo
88

99
__all__ = ["BrandScreenshotParams"]
1010

1111

1212
class BrandScreenshotParams(TypedDict, total=False):
13-
domain: Required[str]
13+
direct_url: Annotated[str, PropertyInfo(alias="directUrl")]
14+
"""
15+
A specific URL to screenshot directly, bypassing domain resolution (e.g.,
16+
'https://example.com/pricing'). When provided, the screenshot is taken of this
17+
exact URL.
18+
"""
19+
20+
domain: str
1421
"""Domain name to take screenshot of (e.g., 'example.com', 'google.com').
1522
1623
The domain will be automatically normalized and validated.
@@ -28,7 +35,8 @@ class BrandScreenshotParams(TypedDict, total=False):
2835
2936
If provided, the system will scrape the domain's links and use heuristics to
3037
find the most appropriate URL for the specified page type (30 supported
31-
languages). If not provided, screenshots the main domain landing page.
38+
languages). If not provided, screenshots the main domain landing page. Only
39+
applicable when using 'domain', not 'directUrl'.
3240
"""
3341

3442
prioritize: Literal["speed", "quality"]

tests/api_resources/test_brand.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -757,15 +757,14 @@ def test_streaming_response_retrieve_simplified(self, client: BrandDev) -> None:
757757
@pytest.mark.skip(reason="Mock server tests are disabled")
758758
@parametrize
759759
def test_method_screenshot(self, client: BrandDev) -> None:
760-
brand = client.brand.screenshot(
761-
domain="domain",
762-
)
760+
brand = client.brand.screenshot()
763761
assert_matches_type(BrandScreenshotResponse, brand, path=["response"])
764762

765763
@pytest.mark.skip(reason="Mock server tests are disabled")
766764
@parametrize
767765
def test_method_screenshot_with_all_params(self, client: BrandDev) -> None:
768766
brand = client.brand.screenshot(
767+
direct_url="https://example.com",
769768
domain="domain",
770769
full_screenshot="true",
771770
page="login",
@@ -776,9 +775,7 @@ def test_method_screenshot_with_all_params(self, client: BrandDev) -> None:
776775
@pytest.mark.skip(reason="Mock server tests are disabled")
777776
@parametrize
778777
def test_raw_response_screenshot(self, client: BrandDev) -> None:
779-
response = client.brand.with_raw_response.screenshot(
780-
domain="domain",
781-
)
778+
response = client.brand.with_raw_response.screenshot()
782779

783780
assert response.is_closed is True
784781
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -788,9 +785,7 @@ def test_raw_response_screenshot(self, client: BrandDev) -> None:
788785
@pytest.mark.skip(reason="Mock server tests are disabled")
789786
@parametrize
790787
def test_streaming_response_screenshot(self, client: BrandDev) -> None:
791-
with client.brand.with_streaming_response.screenshot(
792-
domain="domain",
793-
) as response:
788+
with client.brand.with_streaming_response.screenshot() as response:
794789
assert not response.is_closed
795790
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
796791

@@ -1719,15 +1714,14 @@ async def test_streaming_response_retrieve_simplified(self, async_client: AsyncB
17191714
@pytest.mark.skip(reason="Mock server tests are disabled")
17201715
@parametrize
17211716
async def test_method_screenshot(self, async_client: AsyncBrandDev) -> None:
1722-
brand = await async_client.brand.screenshot(
1723-
domain="domain",
1724-
)
1717+
brand = await async_client.brand.screenshot()
17251718
assert_matches_type(BrandScreenshotResponse, brand, path=["response"])
17261719

17271720
@pytest.mark.skip(reason="Mock server tests are disabled")
17281721
@parametrize
17291722
async def test_method_screenshot_with_all_params(self, async_client: AsyncBrandDev) -> None:
17301723
brand = await async_client.brand.screenshot(
1724+
direct_url="https://example.com",
17311725
domain="domain",
17321726
full_screenshot="true",
17331727
page="login",
@@ -1738,9 +1732,7 @@ async def test_method_screenshot_with_all_params(self, async_client: AsyncBrandD
17381732
@pytest.mark.skip(reason="Mock server tests are disabled")
17391733
@parametrize
17401734
async def test_raw_response_screenshot(self, async_client: AsyncBrandDev) -> None:
1741-
response = await async_client.brand.with_raw_response.screenshot(
1742-
domain="domain",
1743-
)
1735+
response = await async_client.brand.with_raw_response.screenshot()
17441736

17451737
assert response.is_closed is True
17461738
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -1750,9 +1742,7 @@ async def test_raw_response_screenshot(self, async_client: AsyncBrandDev) -> Non
17501742
@pytest.mark.skip(reason="Mock server tests are disabled")
17511743
@parametrize
17521744
async def test_streaming_response_screenshot(self, async_client: AsyncBrandDev) -> None:
1753-
async with async_client.brand.with_streaming_response.screenshot(
1754-
domain="domain",
1755-
) as response:
1745+
async with async_client.brand.with_streaming_response.screenshot() as response:
17561746
assert not response.is_closed
17571747
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
17581748

0 commit comments

Comments
 (0)