Skip to content

Commit d95285a

Browse files
feat(api): manual updates
1 parent 32fd8a9 commit d95285a

7 files changed

Lines changed: 275 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 @@
1-
configured_endpoints: 12
1+
configured_endpoints: 13
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-f69782c2c4296df9db6b41a3a7359a9e4910f59e34901b9f0e8045cec3f9ca69.yml
33
openapi_spec_hash: f06c3956a6fc7e57614b120910339747
4-
config_hash: 86160e220c81f47769a71c9343e486d8
4+
config_hash: 6aaf0fe6f8877c9c5d9af95597123cb4

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Types:
66
from brand.dev.types import (
77
BrandRetrieveResponse,
88
BrandAIQueryResponse,
9+
BrandFontsResponse,
910
BrandIdentifyFromTransactionResponse,
1011
BrandPrefetchResponse,
1112
BrandRetrieveByEmailResponse,
@@ -23,6 +24,7 @@ Methods:
2324

2425
- <code title="get /brand/retrieve">client.brand.<a href="./src/brand/dev/resources/brand.py">retrieve</a>(\*\*<a href="src/brand/dev/types/brand_retrieve_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_retrieve_response.py">BrandRetrieveResponse</a></code>
2526
- <code title="post /brand/ai/query">client.brand.<a href="./src/brand/dev/resources/brand.py">ai_query</a>(\*\*<a href="src/brand/dev/types/brand_ai_query_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_ai_query_response.py">BrandAIQueryResponse</a></code>
27+
- <code title="get /brand/fonts">client.brand.<a href="./src/brand/dev/resources/brand.py">fonts</a>(\*\*<a href="src/brand/dev/types/brand_fonts_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_fonts_response.py">BrandFontsResponse</a></code>
2628
- <code title="get /brand/transaction_identifier">client.brand.<a href="./src/brand/dev/resources/brand.py">identify_from_transaction</a>(\*\*<a href="src/brand/dev/types/brand_identify_from_transaction_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_identify_from_transaction_response.py">BrandIdentifyFromTransactionResponse</a></code>
2729
- <code title="post /brand/prefetch">client.brand.<a href="./src/brand/dev/resources/brand.py">prefetch</a>(\*\*<a href="src/brand/dev/types/brand_prefetch_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_prefetch_response.py">BrandPrefetchResponse</a></code>
2830
- <code title="get /brand/retrieve-by-email">client.brand.<a href="./src/brand/dev/resources/brand.py">retrieve_by_email</a>(\*\*<a href="src/brand/dev/types/brand_retrieve_by_email_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_retrieve_by_email_response.py">BrandRetrieveByEmailResponse</a></code>

src/brand/dev/resources/brand.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import httpx
99

1010
from ..types import (
11+
brand_fonts_params,
1112
brand_ai_query_params,
1213
brand_prefetch_params,
1314
brand_retrieve_params,
@@ -32,6 +33,7 @@
3233
async_to_streamed_response_wrapper,
3334
)
3435
from .._base_client import make_request_options
36+
from ..types.brand_fonts_response import BrandFontsResponse
3537
from ..types.brand_ai_query_response import BrandAIQueryResponse
3638
from ..types.brand_prefetch_response import BrandPrefetchResponse
3739
from ..types.brand_retrieve_response import BrandRetrieveResponse
@@ -239,6 +241,56 @@ def ai_query(
239241
cast_to=BrandAIQueryResponse,
240242
)
241243

244+
def fonts(
245+
self,
246+
*,
247+
domain: str,
248+
timeout_ms: int | Omit = omit,
249+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
250+
# The extra values given here take precedence over values defined on the client or passed to this method.
251+
extra_headers: Headers | None = None,
252+
extra_query: Query | None = None,
253+
extra_body: Body | None = None,
254+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
255+
) -> BrandFontsResponse:
256+
"""
257+
Beta feature: Extract font information from a brand's website including font
258+
families, usage statistics, fallbacks, and element/word counts.
259+
260+
Args:
261+
domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
262+
domain will be automatically normalized and validated.
263+
264+
timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
265+
than this value, it will be aborted with a 408 status code. Maximum allowed
266+
value is 300000ms (5 minutes).
267+
268+
extra_headers: Send extra headers
269+
270+
extra_query: Add additional query parameters to the request
271+
272+
extra_body: Add additional JSON properties to the request
273+
274+
timeout: Override the client-level default timeout for this request, in seconds
275+
"""
276+
return self._get(
277+
"/brand/fonts",
278+
options=make_request_options(
279+
extra_headers=extra_headers,
280+
extra_query=extra_query,
281+
extra_body=extra_body,
282+
timeout=timeout,
283+
query=maybe_transform(
284+
{
285+
"domain": domain,
286+
"timeout_ms": timeout_ms,
287+
},
288+
brand_fonts_params.BrandFontsParams,
289+
),
290+
),
291+
cast_to=BrandFontsResponse,
292+
)
293+
242294
def identify_from_transaction(
243295
self,
244296
*,
@@ -1612,6 +1664,56 @@ async def ai_query(
16121664
cast_to=BrandAIQueryResponse,
16131665
)
16141666

1667+
async def fonts(
1668+
self,
1669+
*,
1670+
domain: str,
1671+
timeout_ms: int | Omit = omit,
1672+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1673+
# The extra values given here take precedence over values defined on the client or passed to this method.
1674+
extra_headers: Headers | None = None,
1675+
extra_query: Query | None = None,
1676+
extra_body: Body | None = None,
1677+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1678+
) -> BrandFontsResponse:
1679+
"""
1680+
Beta feature: Extract font information from a brand's website including font
1681+
families, usage statistics, fallbacks, and element/word counts.
1682+
1683+
Args:
1684+
domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
1685+
domain will be automatically normalized and validated.
1686+
1687+
timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
1688+
than this value, it will be aborted with a 408 status code. Maximum allowed
1689+
value is 300000ms (5 minutes).
1690+
1691+
extra_headers: Send extra headers
1692+
1693+
extra_query: Add additional query parameters to the request
1694+
1695+
extra_body: Add additional JSON properties to the request
1696+
1697+
timeout: Override the client-level default timeout for this request, in seconds
1698+
"""
1699+
return await self._get(
1700+
"/brand/fonts",
1701+
options=make_request_options(
1702+
extra_headers=extra_headers,
1703+
extra_query=extra_query,
1704+
extra_body=extra_body,
1705+
timeout=timeout,
1706+
query=await async_maybe_transform(
1707+
{
1708+
"domain": domain,
1709+
"timeout_ms": timeout_ms,
1710+
},
1711+
brand_fonts_params.BrandFontsParams,
1712+
),
1713+
),
1714+
cast_to=BrandFontsResponse,
1715+
)
1716+
16151717
async def identify_from_transaction(
16161718
self,
16171719
*,
@@ -2804,6 +2906,9 @@ def __init__(self, brand: BrandResource) -> None:
28042906
self.ai_query = to_raw_response_wrapper(
28052907
brand.ai_query,
28062908
)
2909+
self.fonts = to_raw_response_wrapper(
2910+
brand.fonts,
2911+
)
28072912
self.identify_from_transaction = to_raw_response_wrapper(
28082913
brand.identify_from_transaction,
28092914
)
@@ -2846,6 +2951,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
28462951
self.ai_query = async_to_raw_response_wrapper(
28472952
brand.ai_query,
28482953
)
2954+
self.fonts = async_to_raw_response_wrapper(
2955+
brand.fonts,
2956+
)
28492957
self.identify_from_transaction = async_to_raw_response_wrapper(
28502958
brand.identify_from_transaction,
28512959
)
@@ -2888,6 +2996,9 @@ def __init__(self, brand: BrandResource) -> None:
28882996
self.ai_query = to_streamed_response_wrapper(
28892997
brand.ai_query,
28902998
)
2999+
self.fonts = to_streamed_response_wrapper(
3000+
brand.fonts,
3001+
)
28913002
self.identify_from_transaction = to_streamed_response_wrapper(
28923003
brand.identify_from_transaction,
28933004
)
@@ -2930,6 +3041,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
29303041
self.ai_query = async_to_streamed_response_wrapper(
29313042
brand.ai_query,
29323043
)
3044+
self.fonts = async_to_streamed_response_wrapper(
3045+
brand.fonts,
3046+
)
29333047
self.identify_from_transaction = async_to_streamed_response_wrapper(
29343048
brand.identify_from_transaction,
29353049
)

src/brand/dev/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from .brand_fonts_params import BrandFontsParams as BrandFontsParams
6+
from .brand_fonts_response import BrandFontsResponse as BrandFontsResponse
57
from .brand_ai_query_params import BrandAIQueryParams as BrandAIQueryParams
68
from .brand_prefetch_params import BrandPrefetchParams as BrandPrefetchParams
79
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, Annotated, TypedDict
6+
7+
from .._utils import PropertyInfo
8+
9+
__all__ = ["BrandFontsParams"]
10+
11+
12+
class BrandFontsParams(TypedDict, total=False):
13+
domain: Required[str]
14+
"""Domain name to extract fonts from (e.g., 'example.com', 'google.com').
15+
16+
The domain will be automatically normalized and validated.
17+
"""
18+
19+
timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")]
20+
"""Optional timeout in milliseconds for the request.
21+
22+
If the request takes longer than this value, it will be aborted with a 408
23+
status code. Maximum allowed value is 300000ms (5 minutes).
24+
"""
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["BrandFontsResponse", "Font"]
8+
9+
10+
class Font(BaseModel):
11+
fallbacks: List[str]
12+
"""Array of fallback font families"""
13+
14+
font: str
15+
"""Font family name"""
16+
17+
num_elements: float
18+
"""Number of elements using this font"""
19+
20+
num_words: float
21+
"""Number of words using this font"""
22+
23+
percent_elements: float
24+
"""Percentage of elements using this font"""
25+
26+
percent_words: float
27+
"""Percentage of words using this font"""
28+
29+
uses: List[str]
30+
"""Array of CSS selectors or element types where this font is used"""
31+
32+
33+
class BrandFontsResponse(BaseModel):
34+
code: int
35+
"""HTTP status code, e.g., 200"""
36+
37+
domain: str
38+
"""The normalized domain that was processed"""
39+
40+
fonts: List[Font]
41+
"""Array of font usage information"""
42+
43+
status: str
44+
"""Status of the response, e.g., 'ok'"""

tests/api_resources/test_brand.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from brand.dev import BrandDev, AsyncBrandDev
1111
from tests.utils import assert_matches_type
1212
from brand.dev.types import (
13+
BrandFontsResponse,
1314
BrandAIQueryResponse,
1415
BrandPrefetchResponse,
1516
BrandRetrieveResponse,
@@ -154,6 +155,49 @@ def test_streaming_response_ai_query(self, client: BrandDev) -> None:
154155

155156
assert cast(Any, response.is_closed) is True
156157

158+
@pytest.mark.skip(reason="Prism tests are disabled")
159+
@parametrize
160+
def test_method_fonts(self, client: BrandDev) -> None:
161+
brand = client.brand.fonts(
162+
domain="domain",
163+
)
164+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
165+
166+
@pytest.mark.skip(reason="Prism tests are disabled")
167+
@parametrize
168+
def test_method_fonts_with_all_params(self, client: BrandDev) -> None:
169+
brand = client.brand.fonts(
170+
domain="domain",
171+
timeout_ms=1,
172+
)
173+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
174+
175+
@pytest.mark.skip(reason="Prism tests are disabled")
176+
@parametrize
177+
def test_raw_response_fonts(self, client: BrandDev) -> None:
178+
response = client.brand.with_raw_response.fonts(
179+
domain="domain",
180+
)
181+
182+
assert response.is_closed is True
183+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
184+
brand = response.parse()
185+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
186+
187+
@pytest.mark.skip(reason="Prism tests are disabled")
188+
@parametrize
189+
def test_streaming_response_fonts(self, client: BrandDev) -> None:
190+
with client.brand.with_streaming_response.fonts(
191+
domain="domain",
192+
) as response:
193+
assert not response.is_closed
194+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
195+
196+
brand = response.parse()
197+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
198+
199+
assert cast(Any, response.is_closed) is True
200+
157201
@pytest.mark.skip(reason="Prism tests are disabled")
158202
@parametrize
159203
def test_method_identify_from_transaction(self, client: BrandDev) -> None:
@@ -731,6 +775,49 @@ async def test_streaming_response_ai_query(self, async_client: AsyncBrandDev) ->
731775

732776
assert cast(Any, response.is_closed) is True
733777

778+
@pytest.mark.skip(reason="Prism tests are disabled")
779+
@parametrize
780+
async def test_method_fonts(self, async_client: AsyncBrandDev) -> None:
781+
brand = await async_client.brand.fonts(
782+
domain="domain",
783+
)
784+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
785+
786+
@pytest.mark.skip(reason="Prism tests are disabled")
787+
@parametrize
788+
async def test_method_fonts_with_all_params(self, async_client: AsyncBrandDev) -> None:
789+
brand = await async_client.brand.fonts(
790+
domain="domain",
791+
timeout_ms=1,
792+
)
793+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
794+
795+
@pytest.mark.skip(reason="Prism tests are disabled")
796+
@parametrize
797+
async def test_raw_response_fonts(self, async_client: AsyncBrandDev) -> None:
798+
response = await async_client.brand.with_raw_response.fonts(
799+
domain="domain",
800+
)
801+
802+
assert response.is_closed is True
803+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
804+
brand = await response.parse()
805+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
806+
807+
@pytest.mark.skip(reason="Prism tests are disabled")
808+
@parametrize
809+
async def test_streaming_response_fonts(self, async_client: AsyncBrandDev) -> None:
810+
async with async_client.brand.with_streaming_response.fonts(
811+
domain="domain",
812+
) as response:
813+
assert not response.is_closed
814+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
815+
816+
brand = await response.parse()
817+
assert_matches_type(BrandFontsResponse, brand, path=["response"])
818+
819+
assert cast(Any, response.is_closed) is True
820+
734821
@pytest.mark.skip(reason="Prism tests are disabled")
735822
@parametrize
736823
async def test_method_identify_from_transaction(self, async_client: AsyncBrandDev) -> None:

0 commit comments

Comments
 (0)