Skip to content

Commit fa51159

Browse files
feat(types): replace List[str] with SequenceNotStr in params
1 parent b448cd0 commit fa51159

17 files changed

+104
-83
lines changed

src/lithic/_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/lithic/resources/account_holders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
account_holder_simulate_enrollment_review_params,
1818
account_holder_simulate_enrollment_document_review_params,
1919
)
20-
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
20+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2121
from .._utils import is_given, required_args, maybe_transform, async_maybe_transform
2222
from .._compat import cached_property
2323
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -809,7 +809,7 @@ def simulate_enrollment_document_review(
809809
*,
810810
document_upload_token: str,
811811
status: Literal["UPLOADED", "ACCEPTED", "REJECTED", "PARTIAL_APPROVAL"],
812-
accepted_entity_status_reasons: List[str] | NotGiven = NOT_GIVEN,
812+
accepted_entity_status_reasons: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
813813
status_reason: Literal[
814814
"DOCUMENT_MISSING_REQUIRED_DATA",
815815
"DOCUMENT_UPLOAD_TOO_BLURRY",
@@ -1798,7 +1798,7 @@ async def simulate_enrollment_document_review(
17981798
*,
17991799
document_upload_token: str,
18001800
status: Literal["UPLOADED", "ACCEPTED", "REJECTED", "PARTIAL_APPROVAL"],
1801-
accepted_entity_status_reasons: List[str] | NotGiven = NOT_GIVEN,
1801+
accepted_entity_status_reasons: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
18021802
status_reason: Literal[
18031803
"DOCUMENT_MISSING_REQUIRED_DATA",
18041804
"DOCUMENT_UPLOAD_TOO_BLURRY",

src/lithic/resources/auth_rules/v2/v2.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from __future__ import annotations
44

55
import typing_extensions
6-
from typing import List, Union, Optional
6+
from typing import Union, Optional
77
from datetime import date
88
from typing_extensions import Literal, overload
99

1010
import httpx
1111

1212
from .... import _legacy_response
13-
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
13+
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
1414
from ...._utils import required_args, maybe_transform, async_maybe_transform
1515
from .backtests import (
1616
Backtests,
@@ -74,7 +74,7 @@ def with_streaming_response(self) -> V2WithStreamingResponse:
7474
def create(
7575
self,
7676
*,
77-
account_tokens: List[str],
77+
account_tokens: SequenceNotStr[str],
7878
name: Optional[str] | NotGiven = NOT_GIVEN,
7979
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
8080
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -118,7 +118,7 @@ def create(
118118
def create(
119119
self,
120120
*,
121-
card_tokens: List[str],
121+
card_tokens: SequenceNotStr[str],
122122
name: Optional[str] | NotGiven = NOT_GIVEN,
123123
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
124124
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -163,7 +163,7 @@ def create(
163163
self,
164164
*,
165165
program_level: bool,
166-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
166+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
167167
name: Optional[str] | NotGiven = NOT_GIVEN,
168168
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
169169
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -209,14 +209,14 @@ def create(
209209
def create(
210210
self,
211211
*,
212-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
212+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
213213
name: Optional[str] | NotGiven = NOT_GIVEN,
214214
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
215215
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
216216
| NotGiven = NOT_GIVEN,
217-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
217+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
218218
program_level: bool | NotGiven = NOT_GIVEN,
219-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
219+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
220220
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
221221
# The extra values given here take precedence over values defined on the client or passed to this method.
222222
extra_headers: Headers | None = None,
@@ -282,7 +282,7 @@ def update(
282282
self,
283283
auth_rule_token: str,
284284
*,
285-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
285+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
286286
name: Optional[str] | NotGiven = NOT_GIVEN,
287287
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
288288
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -325,7 +325,7 @@ def update(
325325
self,
326326
auth_rule_token: str,
327327
*,
328-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
328+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
329329
name: Optional[str] | NotGiven = NOT_GIVEN,
330330
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
331331
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -368,7 +368,7 @@ def update(
368368
self,
369369
auth_rule_token: str,
370370
*,
371-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
371+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
372372
name: Optional[str] | NotGiven = NOT_GIVEN,
373373
program_level: bool | NotGiven = NOT_GIVEN,
374374
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
@@ -413,11 +413,11 @@ def update(
413413
self,
414414
auth_rule_token: str,
415415
*,
416-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
416+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
417417
name: Optional[str] | NotGiven = NOT_GIVEN,
418418
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
419-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
420-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
419+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
420+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
421421
program_level: bool | NotGiven = NOT_GIVEN,
422422
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
423423
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -555,7 +555,7 @@ def apply(
555555
self,
556556
auth_rule_token: str,
557557
*,
558-
account_tokens: List[str],
558+
account_tokens: SequenceNotStr[str],
559559
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
560560
# The extra values given here take precedence over values defined on the client or passed to this method.
561561
extra_headers: Headers | None = None,
@@ -588,7 +588,7 @@ def apply(
588588
self,
589589
auth_rule_token: str,
590590
*,
591-
card_tokens: List[str],
591+
card_tokens: SequenceNotStr[str],
592592
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
593593
# The extra values given here take precedence over values defined on the client or passed to this method.
594594
extra_headers: Headers | None = None,
@@ -622,7 +622,7 @@ def apply(
622622
auth_rule_token: str,
623623
*,
624624
program_level: bool,
625-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
625+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
626626
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
627627
# The extra values given here take precedence over values defined on the client or passed to this method.
628628
extra_headers: Headers | None = None,
@@ -657,10 +657,10 @@ def apply(
657657
self,
658658
auth_rule_token: str,
659659
*,
660-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
661-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
660+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
661+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
662662
program_level: bool | NotGiven = NOT_GIVEN,
663-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
663+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
664664
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
665665
# The extra values given here take precedence over values defined on the client or passed to this method.
666666
extra_headers: Headers | None = None,
@@ -936,7 +936,7 @@ def with_streaming_response(self) -> AsyncV2WithStreamingResponse:
936936
async def create(
937937
self,
938938
*,
939-
account_tokens: List[str],
939+
account_tokens: SequenceNotStr[str],
940940
name: Optional[str] | NotGiven = NOT_GIVEN,
941941
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
942942
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -980,7 +980,7 @@ async def create(
980980
async def create(
981981
self,
982982
*,
983-
card_tokens: List[str],
983+
card_tokens: SequenceNotStr[str],
984984
name: Optional[str] | NotGiven = NOT_GIVEN,
985985
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
986986
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -1025,7 +1025,7 @@ async def create(
10251025
self,
10261026
*,
10271027
program_level: bool,
1028-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1028+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
10291029
name: Optional[str] | NotGiven = NOT_GIVEN,
10301030
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
10311031
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
@@ -1071,14 +1071,14 @@ async def create(
10711071
async def create(
10721072
self,
10731073
*,
1074-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
1074+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
10751075
name: Optional[str] | NotGiven = NOT_GIVEN,
10761076
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
10771077
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK", "CONDITIONAL_3DS_ACTION"]
10781078
| NotGiven = NOT_GIVEN,
1079-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
1079+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
10801080
program_level: bool | NotGiven = NOT_GIVEN,
1081-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1081+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
10821082
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10831083
# The extra values given here take precedence over values defined on the client or passed to this method.
10841084
extra_headers: Headers | None = None,
@@ -1144,7 +1144,7 @@ async def update(
11441144
self,
11451145
auth_rule_token: str,
11461146
*,
1147-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
1147+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
11481148
name: Optional[str] | NotGiven = NOT_GIVEN,
11491149
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
11501150
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1187,7 +1187,7 @@ async def update(
11871187
self,
11881188
auth_rule_token: str,
11891189
*,
1190-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
1190+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
11911191
name: Optional[str] | NotGiven = NOT_GIVEN,
11921192
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
11931193
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1230,7 +1230,7 @@ async def update(
12301230
self,
12311231
auth_rule_token: str,
12321232
*,
1233-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1233+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
12341234
name: Optional[str] | NotGiven = NOT_GIVEN,
12351235
program_level: bool | NotGiven = NOT_GIVEN,
12361236
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
@@ -1275,11 +1275,11 @@ async def update(
12751275
self,
12761276
auth_rule_token: str,
12771277
*,
1278-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
1278+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
12791279
name: Optional[str] | NotGiven = NOT_GIVEN,
12801280
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
1281-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
1282-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1281+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1282+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
12831283
program_level: bool | NotGiven = NOT_GIVEN,
12841284
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
12851285
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1417,7 +1417,7 @@ async def apply(
14171417
self,
14181418
auth_rule_token: str,
14191419
*,
1420-
account_tokens: List[str],
1420+
account_tokens: SequenceNotStr[str],
14211421
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14221422
# The extra values given here take precedence over values defined on the client or passed to this method.
14231423
extra_headers: Headers | None = None,
@@ -1450,7 +1450,7 @@ async def apply(
14501450
self,
14511451
auth_rule_token: str,
14521452
*,
1453-
card_tokens: List[str],
1453+
card_tokens: SequenceNotStr[str],
14541454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14551455
# The extra values given here take precedence over values defined on the client or passed to this method.
14561456
extra_headers: Headers | None = None,
@@ -1484,7 +1484,7 @@ async def apply(
14841484
auth_rule_token: str,
14851485
*,
14861486
program_level: bool,
1487-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1487+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
14881488
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14891489
# The extra values given here take precedence over values defined on the client or passed to this method.
14901490
extra_headers: Headers | None = None,
@@ -1519,10 +1519,10 @@ async def apply(
15191519
self,
15201520
auth_rule_token: str,
15211521
*,
1522-
account_tokens: List[str] | NotGiven = NOT_GIVEN,
1523-
card_tokens: List[str] | NotGiven = NOT_GIVEN,
1522+
account_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
1523+
card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
15241524
program_level: bool | NotGiven = NOT_GIVEN,
1525-
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
1525+
excluded_card_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
15261526
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
15271527
# The extra values given here take precedence over values defined on the client or passed to this method.
15281528
extra_headers: Headers | None = None,

src/lithic/resources/disputes.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
5+
from typing import Union
66
from datetime import datetime
77
from typing_extensions import Literal
88

@@ -16,7 +16,7 @@
1616
dispute_list_evidences_params,
1717
dispute_initiate_evidence_upload_params,
1818
)
19-
from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes
19+
from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, SequenceNotStr
2020
from .._utils import maybe_transform, async_maybe_transform
2121
from .._compat import cached_property
2222
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -242,7 +242,7 @@ def list(
242242
"SUBMITTED",
243243
]
244244
| NotGiven = NOT_GIVEN,
245-
transaction_tokens: List[str] | NotGiven = NOT_GIVEN,
245+
transaction_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
246246
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
247247
# The extra values given here take precedence over values defined on the client or passed to this method.
248248
extra_headers: Headers | None = None,
@@ -758,7 +758,7 @@ def list(
758758
"SUBMITTED",
759759
]
760760
| NotGiven = NOT_GIVEN,
761-
transaction_tokens: List[str] | NotGiven = NOT_GIVEN,
761+
transaction_tokens: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
762762
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
763763
# The extra values given here take precedence over values defined on the client or passed to this method.
764764
extra_headers: Headers | None = None,

src/lithic/resources/external_bank_accounts/external_bank_accounts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
external_bank_account_retry_prenote_params,
1919
external_bank_account_retry_micro_deposits_params,
2020
)
21-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
21+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
2222
from ..._utils import required_args, maybe_transform, async_maybe_transform
2323
from ..._compat import cached_property
2424
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -547,7 +547,7 @@ def list(
547547
*,
548548
account_token: str | NotGiven = NOT_GIVEN,
549549
account_types: List[Literal["CHECKING", "SAVINGS"]] | NotGiven = NOT_GIVEN,
550-
countries: List[str] | NotGiven = NOT_GIVEN,
550+
countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
551551
ending_before: str | NotGiven = NOT_GIVEN,
552552
owner_types: List[OwnerType] | NotGiven = NOT_GIVEN,
553553
page_size: int | NotGiven = NOT_GIVEN,
@@ -1190,7 +1190,7 @@ def list(
11901190
*,
11911191
account_token: str | NotGiven = NOT_GIVEN,
11921192
account_types: List[Literal["CHECKING", "SAVINGS"]] | NotGiven = NOT_GIVEN,
1193-
countries: List[str] | NotGiven = NOT_GIVEN,
1193+
countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
11941194
ending_before: str | NotGiven = NOT_GIVEN,
11951195
owner_types: List[OwnerType] | NotGiven = NOT_GIVEN,
11961196
page_size: int | NotGiven = NOT_GIVEN,

0 commit comments

Comments
 (0)