Skip to content

Commit fa44a02

Browse files
feat(api): manual updates
1 parent 7a15a0a commit fa44a02

5 files changed

Lines changed: 90 additions & 13 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: 6
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-d5cf52f21333b8216b73e9659b4a1e8e0675404f0ae3d15bdd7ef368ccfa94cf.yml
3-
openapi_spec_hash: c70cbc2e38e7aeaf2173574a13e9ca55
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-c921d60adf854da13dbb83d547cbd8a32fd86d625fb12a325b7d305da7f3a93a.yml
3+
openapi_spec_hash: c02b88f26faaf9fd04177b77d34fd5c3
44
config_hash: 372b187172495fc2f76f05ba016b4a45

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,39 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
7777

7878
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
7979

80+
## Nested params
81+
82+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
83+
84+
```python
85+
from brand.dev import BrandDev
86+
87+
client = BrandDev()
88+
89+
response = client.brand.ai_query(
90+
data_to_extract=[
91+
{
92+
"datapoint_description": "datapoint_description",
93+
"datapoint_example": "datapoint_example",
94+
"datapoint_name": "datapoint_name",
95+
"datapoint_type": "text",
96+
}
97+
],
98+
domain="domain",
99+
specific_pages={
100+
"about_us": True,
101+
"blog": True,
102+
"careers": True,
103+
"contact_us": True,
104+
"faq": True,
105+
"home_page": True,
106+
"privacy_policy": True,
107+
"terms_and_conditions": True,
108+
},
109+
)
110+
print(response.specific_pages)
111+
```
112+
80113
## Handling errors
81114

82115
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `brand.dev.APIConnectionError` is raised.

src/brand/dev/resources/brand.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable
5+
from typing import Iterable
66
from typing_extensions import Literal
77

88
import httpx
@@ -161,7 +161,7 @@ def ai_query(
161161
*,
162162
data_to_extract: Iterable[brand_ai_query_params.DataToExtract],
163163
domain: str,
164-
specific_pages: List[str] | NotGiven = NOT_GIVEN,
164+
specific_pages: brand_ai_query_params.SpecificPages | NotGiven = NOT_GIVEN,
165165
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
166166
# The extra values given here take precedence over values defined on the client or passed to this method.
167167
extra_headers: Headers | None = None,
@@ -180,7 +180,7 @@ def ai_query(
180180
181181
domain: The domain name to analyze
182182
183-
specific_pages: Optional array of specific pages to analyze
183+
specific_pages: Optional object specifying which pages to analyze
184184
185185
extra_headers: Send extra headers
186186
@@ -487,7 +487,7 @@ async def ai_query(
487487
*,
488488
data_to_extract: Iterable[brand_ai_query_params.DataToExtract],
489489
domain: str,
490-
specific_pages: List[str] | NotGiven = NOT_GIVEN,
490+
specific_pages: brand_ai_query_params.SpecificPages | NotGiven = NOT_GIVEN,
491491
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
492492
# The extra values given here take precedence over values defined on the client or passed to this method.
493493
extra_headers: Headers | None = None,
@@ -506,7 +506,7 @@ async def ai_query(
506506
507507
domain: The domain name to analyze
508508
509-
specific_pages: Optional array of specific pages to analyze
509+
specific_pages: Optional object specifying which pages to analyze
510510
511511
extra_headers: Send extra headers
512512

src/brand/dev/types/brand_ai_query_params.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable
5+
from typing import Iterable
66
from typing_extensions import Literal, Required, TypedDict
77

8-
__all__ = ["BrandAIQueryParams", "DataToExtract"]
8+
__all__ = ["BrandAIQueryParams", "DataToExtract", "SpecificPages"]
99

1010

1111
class BrandAIQueryParams(TypedDict, total=False):
@@ -15,8 +15,8 @@ class BrandAIQueryParams(TypedDict, total=False):
1515
domain: Required[str]
1616
"""The domain name to analyze"""
1717

18-
specific_pages: List[str]
19-
"""Optional array of specific pages to analyze"""
18+
specific_pages: SpecificPages
19+
"""Optional object specifying which pages to analyze"""
2020

2121

2222
class DataToExtract(TypedDict, total=False):
@@ -31,3 +31,29 @@ class DataToExtract(TypedDict, total=False):
3131

3232
datapoint_type: Required[Literal["text", "number", "date", "boolean", "list", "url"]]
3333
"""Type of the data point"""
34+
35+
36+
class SpecificPages(TypedDict, total=False):
37+
about_us: bool
38+
"""Whether to analyze the about us page"""
39+
40+
blog: bool
41+
"""Whether to analyze the blog"""
42+
43+
careers: bool
44+
"""Whether to analyze the careers page"""
45+
46+
contact_us: bool
47+
"""Whether to analyze the contact us page"""
48+
49+
faq: bool
50+
"""Whether to analyze the FAQ page"""
51+
52+
home_page: bool
53+
"""Whether to analyze the home page"""
54+
55+
privacy_policy: bool
56+
"""Whether to analyze the privacy policy page"""
57+
58+
terms_and_conditions: bool
59+
"""Whether to analyze the terms and conditions page"""

tests/api_resources/test_brand.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,16 @@ def test_method_ai_query_with_all_params(self, client: BrandDev) -> None:
9696
}
9797
],
9898
domain="domain",
99-
specific_pages=["string"],
99+
specific_pages={
100+
"about_us": True,
101+
"blog": True,
102+
"careers": True,
103+
"contact_us": True,
104+
"faq": True,
105+
"home_page": True,
106+
"privacy_policy": True,
107+
"terms_and_conditions": True,
108+
},
100109
)
101110
assert_matches_type(BrandAIQueryResponse, brand, path=["response"])
102111

@@ -354,7 +363,16 @@ async def test_method_ai_query_with_all_params(self, async_client: AsyncBrandDev
354363
}
355364
],
356365
domain="domain",
357-
specific_pages=["string"],
366+
specific_pages={
367+
"about_us": True,
368+
"blog": True,
369+
"careers": True,
370+
"contact_us": True,
371+
"faq": True,
372+
"home_page": True,
373+
"privacy_policy": True,
374+
"terms_and_conditions": True,
375+
},
358376
)
359377
assert_matches_type(BrandAIQueryResponse, brand, path=["response"])
360378

0 commit comments

Comments
 (0)