Skip to content

Commit 79826c4

Browse files
feat(api): api update
1 parent 4aa172e commit 79826c4

3 files changed

Lines changed: 29 additions & 22 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: 29
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9de98d1d4d2c9a431961599cb54716212c06200a919e09adedd42244038ec07b.yml
3-
openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5280c0f42603633a06d2404b120b98d0d9aa43256d13680bbdead7579a90452a.yml
3+
openapi_spec_hash: 34869d638c12bf076949bb7e050dd634
44
config_hash: ff35e224e809656528c44163aa41bebd

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, Required, Annotated, TypedDict
5+
from typing import Union
6+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
67

78
from .._utils import PropertyInfo
89

9-
__all__ = ["UtilityPrefetchParams", "Identifier"]
10+
__all__ = [
11+
"UtilityPrefetchParams",
12+
"Identifier",
13+
"IdentifierUtilityPrefetchDomainIdentifier",
14+
"IdentifierUtilityPrefetchEmailIdentifier",
15+
]
1016

1117

1218
class UtilityPrefetchParams(TypedDict, total=False):
@@ -24,15 +30,22 @@ class UtilityPrefetchParams(TypedDict, total=False):
2430
"""
2531

2632

27-
class Identifier(TypedDict, total=False):
28-
"""Identifier of the brand to prefetch. Provide exactly one of domain or email."""
33+
class IdentifierUtilityPrefetchDomainIdentifier(TypedDict, total=False):
34+
"""Prefetch brand data by domain."""
2935

30-
domain: str
36+
domain: Required[str]
3137
"""Domain name to prefetch brand data for"""
3238

33-
email: str
39+
40+
class IdentifierUtilityPrefetchEmailIdentifier(TypedDict, total=False):
41+
"""Prefetch brand data by email. The domain will be extracted and validated."""
42+
43+
email: Required[str]
3444
"""Email address to prefetch brand data for.
3545
3646
The domain will be extracted from the email. Free email providers (gmail.com,
3747
yahoo.com, etc.) and disposable email addresses are not allowed.
3848
"""
49+
50+
51+
Identifier: TypeAlias = Union[IdentifierUtilityPrefetchDomainIdentifier, IdentifierUtilityPrefetchEmailIdentifier]

‎tests/api_resources/test_utility.py‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestUtility:
2121
@parametrize
2222
def test_method_prefetch(self, client: ContextDev) -> None:
2323
utility = client.utility.prefetch(
24-
identifier={},
24+
identifier={"domain": "domain"},
2525
type="brand",
2626
)
2727
assert_matches_type(UtilityPrefetchResponse, utility, path=["response"])
@@ -30,10 +30,7 @@ def test_method_prefetch(self, client: ContextDev) -> None:
3030
@parametrize
3131
def test_method_prefetch_with_all_params(self, client: ContextDev) -> None:
3232
utility = client.utility.prefetch(
33-
identifier={
34-
"domain": "domain",
35-
"email": "dev@stainless.com",
36-
},
33+
identifier={"domain": "domain"},
3734
type="brand",
3835
timeout_ms=1000,
3936
)
@@ -43,7 +40,7 @@ def test_method_prefetch_with_all_params(self, client: ContextDev) -> None:
4340
@parametrize
4441
def test_raw_response_prefetch(self, client: ContextDev) -> None:
4542
response = client.utility.with_raw_response.prefetch(
46-
identifier={},
43+
identifier={"domain": "domain"},
4744
type="brand",
4845
)
4946

@@ -56,7 +53,7 @@ def test_raw_response_prefetch(self, client: ContextDev) -> None:
5653
@parametrize
5754
def test_streaming_response_prefetch(self, client: ContextDev) -> None:
5855
with client.utility.with_streaming_response.prefetch(
59-
identifier={},
56+
identifier={"domain": "domain"},
6057
type="brand",
6158
) as response:
6259
assert not response.is_closed
@@ -77,7 +74,7 @@ class TestAsyncUtility:
7774
@parametrize
7875
async def test_method_prefetch(self, async_client: AsyncContextDev) -> None:
7976
utility = await async_client.utility.prefetch(
80-
identifier={},
77+
identifier={"domain": "domain"},
8178
type="brand",
8279
)
8380
assert_matches_type(UtilityPrefetchResponse, utility, path=["response"])
@@ -86,10 +83,7 @@ async def test_method_prefetch(self, async_client: AsyncContextDev) -> None:
8683
@parametrize
8784
async def test_method_prefetch_with_all_params(self, async_client: AsyncContextDev) -> None:
8885
utility = await async_client.utility.prefetch(
89-
identifier={
90-
"domain": "domain",
91-
"email": "dev@stainless.com",
92-
},
86+
identifier={"domain": "domain"},
9387
type="brand",
9488
timeout_ms=1000,
9589
)
@@ -99,7 +93,7 @@ async def test_method_prefetch_with_all_params(self, async_client: AsyncContextD
9993
@parametrize
10094
async def test_raw_response_prefetch(self, async_client: AsyncContextDev) -> None:
10195
response = await async_client.utility.with_raw_response.prefetch(
102-
identifier={},
96+
identifier={"domain": "domain"},
10397
type="brand",
10498
)
10599

@@ -112,7 +106,7 @@ async def test_raw_response_prefetch(self, async_client: AsyncContextDev) -> Non
112106
@parametrize
113107
async def test_streaming_response_prefetch(self, async_client: AsyncContextDev) -> None:
114108
async with async_client.utility.with_streaming_response.prefetch(
115-
identifier={},
109+
identifier={"domain": "domain"},
116110
type="brand",
117111
) as response:
118112
assert not response.is_closed

0 commit comments

Comments
 (0)