Skip to content

Commit e59f69c

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent 7b67814 commit e59f69c

141 files changed

Lines changed: 553 additions & 474 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/telnyx/_utils/_transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
lru_cache,
1717
is_mapping,
1818
is_iterable,
19+
is_sequence,
1920
)
2021
from .._files import is_base64_file_input
2122
from ._typing import (
@@ -24,6 +25,7 @@
2425
extract_type_arg,
2526
is_iterable_type,
2627
is_required_type,
28+
is_sequence_type,
2729
is_annotated_type,
2830
strip_annotated_type,
2931
)
@@ -184,6 +186,8 @@ def _transform_recursive(
184186
(is_list_type(stripped_type) and is_list(data))
185187
# Iterable[T]
186188
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
189+
# Sequence[T]
190+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
187191
):
188192
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
189193
# intended as an iterable, so we don't transform it.
@@ -346,6 +350,8 @@ async def _async_transform_recursive(
346350
(is_list_type(stripped_type) and is_list(data))
347351
# Iterable[T]
348352
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
353+
# Sequence[T]
354+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
349355
):
350356
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
351357
# intended as an iterable, so we don't transform it.

src/telnyx/resources/actions/purchase.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import Literal
76

87
import httpx
98

10-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1110
from ..._utils import maybe_transform, async_maybe_transform
1211
from ..._compat import cached_property
1312
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -51,7 +50,7 @@ def create(
5150
product: str | NotGiven = NOT_GIVEN,
5251
sim_card_group_id: str | NotGiven = NOT_GIVEN,
5352
status: Literal["enabled", "disabled", "standby"] | NotGiven = NOT_GIVEN,
54-
tags: List[str] | NotGiven = NOT_GIVEN,
53+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
5554
whitelabel_name: str | NotGiven = NOT_GIVEN,
5655
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5756
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -137,7 +136,7 @@ async def create(
137136
product: str | NotGiven = NOT_GIVEN,
138137
sim_card_group_id: str | NotGiven = NOT_GIVEN,
139138
status: Literal["enabled", "disabled", "standby"] | NotGiven = NOT_GIVEN,
140-
tags: List[str] | NotGiven = NOT_GIVEN,
139+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
141140
whitelabel_name: str | NotGiven = NOT_GIVEN,
142141
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143142
# The extra values given here take precedence over values defined on the client or passed to this method.

src/telnyx/resources/actions/register.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import Literal
76

87
import httpx
98

10-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1110
from ..._utils import maybe_transform, async_maybe_transform
1211
from ..._compat import cached_property
1312
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -47,10 +46,10 @@ def with_streaming_response(self) -> RegisterResourceWithStreamingResponse:
4746
def create(
4847
self,
4948
*,
50-
registration_codes: List[str],
49+
registration_codes: SequenceNotStr[str],
5150
sim_card_group_id: str | NotGiven = NOT_GIVEN,
5251
status: Literal["enabled", "disabled", "standby"] | NotGiven = NOT_GIVEN,
53-
tags: List[str] | NotGiven = NOT_GIVEN,
52+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
5453
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5554
# The extra values given here take precedence over values defined on the client or passed to this method.
5655
extra_headers: Headers | None = None,
@@ -121,10 +120,10 @@ def with_streaming_response(self) -> AsyncRegisterResourceWithStreamingResponse:
121120
async def create(
122121
self,
123122
*,
124-
registration_codes: List[str],
123+
registration_codes: SequenceNotStr[str],
125124
sim_card_group_id: str | NotGiven = NOT_GIVEN,
126125
status: Literal["enabled", "disabled", "standby"] | NotGiven = NOT_GIVEN,
127-
tags: List[str] | NotGiven = NOT_GIVEN,
126+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
128127
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
129128
# The extra values given here take precedence over values defined on the client or passed to this method.
130129
extra_headers: Headers | None = None,

src/telnyx/resources/ai/chat.py

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

33
from __future__ import annotations
44

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

88
import httpx
99

10-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1111
from ..._utils import maybe_transform, async_maybe_transform
1212
from ..._compat import cached_property
1313
from ...types.ai import chat_create_completion_params
@@ -51,7 +51,7 @@ def create_completion(
5151
best_of: int | NotGiven = NOT_GIVEN,
5252
early_stopping: bool | NotGiven = NOT_GIVEN,
5353
frequency_penalty: float | NotGiven = NOT_GIVEN,
54-
guided_choice: List[str] | NotGiven = NOT_GIVEN,
54+
guided_choice: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
5555
guided_json: Dict[str, object] | NotGiven = NOT_GIVEN,
5656
guided_regex: str | NotGiven = NOT_GIVEN,
5757
length_penalty: float | NotGiven = NOT_GIVEN,
@@ -226,7 +226,7 @@ async def create_completion(
226226
best_of: int | NotGiven = NOT_GIVEN,
227227
early_stopping: bool | NotGiven = NOT_GIVEN,
228228
frequency_penalty: float | NotGiven = NOT_GIVEN,
229-
guided_choice: List[str] | NotGiven = NOT_GIVEN,
229+
guided_choice: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
230230
guided_json: Dict[str, object] | NotGiven = NOT_GIVEN,
231231
guided_regex: str | NotGiven = NOT_GIVEN,
232232
length_penalty: float | NotGiven = NOT_GIVEN,

src/telnyx/resources/ai/clusters.py

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

33
from __future__ import annotations
44

5-
from typing import List
6-
75
import httpx
86

9-
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
7+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
108
from ..._utils import maybe_transform, async_maybe_transform
119
from ..._compat import cached_property
1210
from ...types.ai import cluster_list_params, cluster_compute_params, cluster_retrieve_params, cluster_fetch_graph_params
@@ -172,7 +170,7 @@ def compute(
172170
self,
173171
*,
174172
bucket: str,
175-
files: List[str] | NotGiven = NOT_GIVEN,
173+
files: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
176174
min_cluster_size: int | NotGiven = NOT_GIVEN,
177175
min_subcluster_size: int | NotGiven = NOT_GIVEN,
178176
prefix: str | NotGiven = NOT_GIVEN,
@@ -415,7 +413,7 @@ async def compute(
415413
self,
416414
*,
417415
bucket: str,
418-
files: List[str] | NotGiven = NOT_GIVEN,
416+
files: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
419417
min_cluster_size: int | NotGiven = NOT_GIVEN,
420418
min_subcluster_size: int | NotGiven = NOT_GIVEN,
421419
prefix: str | NotGiven = NOT_GIVEN,

src/telnyx/resources/ai/conversations/messages.py

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

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Iterable
5+
from typing import Dict, Union, Iterable
66
from datetime import datetime
77

88
import httpx
99

10-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1111
from ...._utils import maybe_transform, async_maybe_transform
1212
from ...._compat import cached_property
1313
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -50,7 +50,7 @@ def create(
5050
*,
5151
role: str,
5252
content: str | NotGiven = NOT_GIVEN,
53-
metadata: Dict[str, Union[str, int, bool, List[Union[str, int, bool]]]] | NotGiven = NOT_GIVEN,
53+
metadata: Dict[str, Union[str, int, bool, SequenceNotStr[Union[str, int, bool]]]] | NotGiven = NOT_GIVEN,
5454
name: str | NotGiven = NOT_GIVEN,
5555
sent_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
5656
tool_call_id: str | NotGiven = NOT_GIVEN,
@@ -163,7 +163,7 @@ async def create(
163163
*,
164164
role: str,
165165
content: str | NotGiven = NOT_GIVEN,
166-
metadata: Dict[str, Union[str, int, bool, List[Union[str, int, bool]]]] | NotGiven = NOT_GIVEN,
166+
metadata: Dict[str, Union[str, int, bool, SequenceNotStr[Union[str, int, bool]]]] | NotGiven = NOT_GIVEN,
167167
name: str | NotGiven = NOT_GIVEN,
168168
sent_at: Union[str, datetime] | NotGiven = NOT_GIVEN,
169169
tool_call_id: str | NotGiven = NOT_GIVEN,

src/telnyx/resources/ai/embeddings/embeddings.py

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

33
from __future__ import annotations
44

5-
from typing import List
65
from typing_extensions import Literal
76

87
import httpx
@@ -15,7 +14,7 @@
1514
BucketsResourceWithStreamingResponse,
1615
AsyncBucketsResourceWithStreamingResponse,
1716
)
18-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
17+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1918
from ...._utils import maybe_transform, async_maybe_transform
2019
from ...._compat import cached_property
2120
from ....types.ai import (
@@ -186,7 +185,7 @@ def retrieve(
186185
def list(
187186
self,
188187
*,
189-
status: List[str] | NotGiven = NOT_GIVEN,
188+
status: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
190189
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
191190
# The extra values given here take precedence over values defined on the client or passed to this method.
192191
extra_headers: Headers | None = None,
@@ -471,7 +470,7 @@ async def retrieve(
471470
async def list(
472471
self,
473472
*,
474-
status: List[str] | NotGiven = NOT_GIVEN,
473+
status: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
475474
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
476475
# The extra values given here take precedence over values defined on the client or passed to this method.
477476
extra_headers: Headers | None = None,

src/telnyx/resources/call_control_applications.py

Lines changed: 4 additions & 4 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, Optional
5+
from typing import Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -12,7 +12,7 @@
1212
call_control_application_create_params,
1313
call_control_application_update_params,
1414
)
15-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
15+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1616
from .._utils import maybe_transform, async_maybe_transform
1717
from .._compat import cached_property
1818
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -194,7 +194,7 @@ def update(
194194
inbound: CallControlApplicationInboundParam | NotGiven = NOT_GIVEN,
195195
outbound: CallControlApplicationOutboundParam | NotGiven = NOT_GIVEN,
196196
redact_dtmf_debug_logging: bool | NotGiven = NOT_GIVEN,
197-
tags: List[str] | NotGiven = NOT_GIVEN,
197+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
198198
webhook_api_version: Literal["1", "2"] | NotGiven = NOT_GIVEN,
199199
webhook_event_failover_url: Optional[str] | NotGiven = NOT_GIVEN,
200200
webhook_timeout_secs: Optional[int] | NotGiven = NOT_GIVEN,
@@ -541,7 +541,7 @@ async def update(
541541
inbound: CallControlApplicationInboundParam | NotGiven = NOT_GIVEN,
542542
outbound: CallControlApplicationOutboundParam | NotGiven = NOT_GIVEN,
543543
redact_dtmf_debug_logging: bool | NotGiven = NOT_GIVEN,
544-
tags: List[str] | NotGiven = NOT_GIVEN,
544+
tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
545545
webhook_api_version: Literal["1", "2"] | NotGiven = NOT_GIVEN,
546546
webhook_event_failover_url: Optional[str] | NotGiven = NOT_GIVEN,
547547
webhook_timeout_secs: Optional[int] | NotGiven = NOT_GIVEN,

src/telnyx/resources/calls/calls.py

Lines changed: 4 additions & 4 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, Union, Iterable
5+
from typing import Union, Iterable
66
from typing_extensions import Literal
77

88
import httpx
@@ -22,7 +22,7 @@
2222
ActionsResourceWithStreamingResponse,
2323
AsyncActionsResourceWithStreamingResponse,
2424
)
25-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
25+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2626
from ..._utils import maybe_transform, async_maybe_transform
2727
from ..._compat import cached_property
2828
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -77,7 +77,7 @@ def dial(
7777
*,
7878
connection_id: str,
7979
from_: str,
80-
to: Union[str, List[str]],
80+
to: Union[str, SequenceNotStr[str]],
8181
answering_machine_detection: Literal[
8282
"premium", "detect", "detect_beep", "detect_words", "greeting_end", "disabled"
8383
]
@@ -457,7 +457,7 @@ async def dial(
457457
*,
458458
connection_id: str,
459459
from_: str,
460-
to: Union[str, List[str]],
460+
to: Union[str, SequenceNotStr[str]],
461461
answering_machine_detection: Literal[
462462
"premium", "detect", "detect_beep", "detect_words", "greeting_end", "disabled"
463463
]

src/telnyx/resources/campaign_builder/campaign_builder.py

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

33
from __future__ import annotations
44

5-
from typing import Any, List, Iterable, cast
5+
from typing import Any, Iterable, cast
66

77
import httpx
88

@@ -15,7 +15,7 @@
1515
AsyncBrandResourceWithStreamingResponse,
1616
)
1717
from ...types import campaign_builder_create_params
18-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
18+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1919
from ..._utils import maybe_transform, async_maybe_transform
2020
from ..._compat import cached_property
2121
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -87,8 +87,8 @@ def create(
8787
subscriber_help: bool | NotGiven = NOT_GIVEN,
8888
subscriber_optin: bool | NotGiven = NOT_GIVEN,
8989
subscriber_optout: bool | NotGiven = NOT_GIVEN,
90-
sub_usecases: List[str] | NotGiven = NOT_GIVEN,
91-
tag: List[str] | NotGiven = NOT_GIVEN,
90+
sub_usecases: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
91+
tag: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
9292
terms_and_conditions: bool | NotGiven = NOT_GIVEN,
9393
terms_and_conditions_link: str | NotGiven = NOT_GIVEN,
9494
webhook_failover_url: str | NotGiven = NOT_GIVEN,
@@ -307,8 +307,8 @@ async def create(
307307
subscriber_help: bool | NotGiven = NOT_GIVEN,
308308
subscriber_optin: bool | NotGiven = NOT_GIVEN,
309309
subscriber_optout: bool | NotGiven = NOT_GIVEN,
310-
sub_usecases: List[str] | NotGiven = NOT_GIVEN,
311-
tag: List[str] | NotGiven = NOT_GIVEN,
310+
sub_usecases: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
311+
tag: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
312312
terms_and_conditions: bool | NotGiven = NOT_GIVEN,
313313
terms_and_conditions_link: str | NotGiven = NOT_GIVEN,
314314
webhook_failover_url: str | NotGiven = NOT_GIVEN,

0 commit comments

Comments
 (0)