Skip to content

Commit 36b8f84

Browse files
feat(api): add retrieve_signals method to accounts and cards
1 parent 91e32e0 commit 36b8f84

8 files changed

Lines changed: 534 additions & 4 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 190
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-af9701d01abffc53ba2bf56c06415d893460e6b420f122e602cf4afe67bbf57b.yml
1+
configured_endpoints: 192
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-00f07b0edcc0c3c5ef79920ced7f58dac2434df5e4c27ff6041783e8228315f9.yml
33
openapi_spec_hash: 963688b09480159a06865075c94a2577
4-
config_hash: 01dfc901bb6d54b0f582155d779bcbe0
4+
config_hash: 265a2b679964f4ad5706de101ad2a942

api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Methods:
3939
- <code title="get /v1/accounts/{account_token}">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve</a>(account_token) -> <a href="./src/lithic/types/account.py">Account</a></code>
4040
- <code title="patch /v1/accounts/{account_token}">client.accounts.<a href="./src/lithic/resources/accounts.py">update</a>(account_token, \*\*<a href="src/lithic/types/account_update_params.py">params</a>) -> <a href="./src/lithic/types/account.py">Account</a></code>
4141
- <code title="get /v1/accounts">client.accounts.<a href="./src/lithic/resources/accounts.py">list</a>(\*\*<a href="src/lithic/types/account_list_params.py">params</a>) -> <a href="./src/lithic/types/account.py">SyncCursorPage[Account]</a></code>
42+
- <code title="get /v1/accounts/{account_token}/signals">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve_signals</a>(account_token) -> <a href="./src/lithic/types/signals_response.py">SignalsResponse</a></code>
4243
- <code title="get /v1/accounts/{account_token}/spend_limits">client.accounts.<a href="./src/lithic/resources/accounts.py">retrieve_spend_limits</a>(account_token) -> <a href="./src/lithic/types/account_spend_limits.py">AccountSpendLimits</a></code>
4344

4445
# AccountHolders
@@ -88,6 +89,12 @@ Methods:
8889

8990
# AuthRules
9091

92+
Types:
93+
94+
```python
95+
from lithic.types import SignalsResponse
96+
```
97+
9198
## V2
9299

93100
Types:
@@ -233,6 +240,7 @@ Methods:
233240
- <code title="post /v1/cards/{card_token}/provision">client.cards.<a href="./src/lithic/resources/cards/cards.py">provision</a>(card_token, \*\*<a href="src/lithic/types/card_provision_params.py">params</a>) -> <a href="./src/lithic/types/card_provision_response.py">CardProvisionResponse</a></code>
234241
- <code title="post /v1/cards/{card_token}/reissue">client.cards.<a href="./src/lithic/resources/cards/cards.py">reissue</a>(card_token, \*\*<a href="src/lithic/types/card_reissue_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
235242
- <code title="post /v1/cards/{card_token}/renew">client.cards.<a href="./src/lithic/resources/cards/cards.py">renew</a>(card_token, \*\*<a href="src/lithic/types/card_renew_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
243+
- <code title="get /v1/cards/{card_token}/signals">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve_signals</a>(card_token) -> <a href="./src/lithic/types/signals_response.py">SignalsResponse</a></code>
236244
- <code title="get /v1/cards/{card_token}/spend_limits">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve_spend_limits</a>(card_token) -> <a href="./src/lithic/types/card_spend_limits.py">CardSpendLimits</a></code>
237245
- <code title="post /v1/cards/search_by_pan">client.cards.<a href="./src/lithic/resources/cards/cards.py">search_by_pan</a>(\*\*<a href="src/lithic/types/card_search_by_pan_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
238246
- <code title="post /v1/cards/{card_token}/web_provision">client.cards.<a href="./src/lithic/resources/cards/cards.py">web_provision</a>(card_token, \*\*<a href="src/lithic/types/card_web_provision_params.py">params</a>) -> <a href="./src/lithic/types/card_web_provision_response.py">CardWebProvisionResponse</a></code>

src/lithic/resources/accounts.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from ..pagination import SyncCursorPage, AsyncCursorPage
1919
from .._base_client import AsyncPaginator, make_request_options
2020
from ..types.account import Account
21+
from ..types.signals_response import SignalsResponse
2122
from ..types.account_spend_limits import AccountSpendLimits
2223

2324
__all__ = ["Accounts", "AsyncAccounts"]
@@ -259,6 +260,46 @@ def list(
259260
model=Account,
260261
)
261262

263+
def retrieve_signals(
264+
self,
265+
account_token: str,
266+
*,
267+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
268+
# The extra values given here take precedence over values defined on the client or passed to this method.
269+
extra_headers: Headers | None = None,
270+
extra_query: Query | None = None,
271+
extra_body: Body | None = None,
272+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
273+
) -> SignalsResponse:
274+
"""
275+
Returns behavioral feature state derived from an account's transaction history.
276+
277+
These signals expose the same data used by behavioral rule attributes (e.g.
278+
`AMOUNT_Z_SCORE` with `scope: ACCOUNT`, `IS_NEW_COUNTRY` with `scope: ACCOUNT`)
279+
and custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to
280+
inspect feature values before writing rules and debug rule behavior.
281+
282+
Note: 3DS fields are not available at the account scope and will be null.
283+
284+
Args:
285+
extra_headers: Send extra headers
286+
287+
extra_query: Add additional query parameters to the request
288+
289+
extra_body: Add additional JSON properties to the request
290+
291+
timeout: Override the client-level default timeout for this request, in seconds
292+
"""
293+
if not account_token:
294+
raise ValueError(f"Expected a non-empty value for `account_token` but received {account_token!r}")
295+
return self._get(
296+
path_template("/v1/accounts/{account_token}/signals", account_token=account_token),
297+
options=make_request_options(
298+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
299+
),
300+
cast_to=SignalsResponse,
301+
)
302+
262303
def retrieve_spend_limits(
263304
self,
264305
account_token: str,
@@ -533,6 +574,46 @@ def list(
533574
model=Account,
534575
)
535576

577+
async def retrieve_signals(
578+
self,
579+
account_token: str,
580+
*,
581+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
582+
# The extra values given here take precedence over values defined on the client or passed to this method.
583+
extra_headers: Headers | None = None,
584+
extra_query: Query | None = None,
585+
extra_body: Body | None = None,
586+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
587+
) -> SignalsResponse:
588+
"""
589+
Returns behavioral feature state derived from an account's transaction history.
590+
591+
These signals expose the same data used by behavioral rule attributes (e.g.
592+
`AMOUNT_Z_SCORE` with `scope: ACCOUNT`, `IS_NEW_COUNTRY` with `scope: ACCOUNT`)
593+
and custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to
594+
inspect feature values before writing rules and debug rule behavior.
595+
596+
Note: 3DS fields are not available at the account scope and will be null.
597+
598+
Args:
599+
extra_headers: Send extra headers
600+
601+
extra_query: Add additional query parameters to the request
602+
603+
extra_body: Add additional JSON properties to the request
604+
605+
timeout: Override the client-level default timeout for this request, in seconds
606+
"""
607+
if not account_token:
608+
raise ValueError(f"Expected a non-empty value for `account_token` but received {account_token!r}")
609+
return await self._get(
610+
path_template("/v1/accounts/{account_token}/signals", account_token=account_token),
611+
options=make_request_options(
612+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
613+
),
614+
cast_to=SignalsResponse,
615+
)
616+
536617
async def retrieve_spend_limits(
537618
self,
538619
account_token: str,
@@ -584,6 +665,9 @@ def __init__(self, accounts: Accounts) -> None:
584665
self.list = _legacy_response.to_raw_response_wrapper(
585666
accounts.list,
586667
)
668+
self.retrieve_signals = _legacy_response.to_raw_response_wrapper(
669+
accounts.retrieve_signals,
670+
)
587671
self.retrieve_spend_limits = _legacy_response.to_raw_response_wrapper(
588672
accounts.retrieve_spend_limits,
589673
)
@@ -602,6 +686,9 @@ def __init__(self, accounts: AsyncAccounts) -> None:
602686
self.list = _legacy_response.async_to_raw_response_wrapper(
603687
accounts.list,
604688
)
689+
self.retrieve_signals = _legacy_response.async_to_raw_response_wrapper(
690+
accounts.retrieve_signals,
691+
)
605692
self.retrieve_spend_limits = _legacy_response.async_to_raw_response_wrapper(
606693
accounts.retrieve_spend_limits,
607694
)
@@ -620,6 +707,9 @@ def __init__(self, accounts: Accounts) -> None:
620707
self.list = to_streamed_response_wrapper(
621708
accounts.list,
622709
)
710+
self.retrieve_signals = to_streamed_response_wrapper(
711+
accounts.retrieve_signals,
712+
)
623713
self.retrieve_spend_limits = to_streamed_response_wrapper(
624714
accounts.retrieve_spend_limits,
625715
)
@@ -638,6 +728,9 @@ def __init__(self, accounts: AsyncAccounts) -> None:
638728
self.list = async_to_streamed_response_wrapper(
639729
accounts.list,
640730
)
731+
self.retrieve_signals = async_to_streamed_response_wrapper(
732+
accounts.retrieve_signals,
733+
)
641734
self.retrieve_spend_limits = async_to_streamed_response_wrapper(
642735
accounts.retrieve_spend_limits,
643736
)

src/lithic/resources/cards/cards.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
FinancialTransactionsWithStreamingResponse,
5454
AsyncFinancialTransactionsWithStreamingResponse,
5555
)
56+
from ...types.signals_response import SignalsResponse
5657
from ...types.card_spend_limits import CardSpendLimits
5758
from ...types.spend_limit_duration import SpendLimitDuration
5859
from ...types.shared_params.carrier import Carrier
@@ -1110,6 +1111,44 @@ def renew(
11101111
cast_to=Card,
11111112
)
11121113

1114+
def retrieve_signals(
1115+
self,
1116+
card_token: str,
1117+
*,
1118+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1119+
# The extra values given here take precedence over values defined on the client or passed to this method.
1120+
extra_headers: Headers | None = None,
1121+
extra_query: Query | None = None,
1122+
extra_body: Body | None = None,
1123+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1124+
) -> SignalsResponse:
1125+
"""
1126+
Returns behavioral feature state derived from a card's transaction history.
1127+
1128+
These signals expose the same data used by behavioral rule attributes (e.g.
1129+
`AMOUNT_Z_SCORE` with `scope: CARD`, `IS_NEW_COUNTRY` with `scope: CARD`) and
1130+
custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to inspect
1131+
feature values before writing rules and debug rule behavior.
1132+
1133+
Args:
1134+
extra_headers: Send extra headers
1135+
1136+
extra_query: Add additional query parameters to the request
1137+
1138+
extra_body: Add additional JSON properties to the request
1139+
1140+
timeout: Override the client-level default timeout for this request, in seconds
1141+
"""
1142+
if not card_token:
1143+
raise ValueError(f"Expected a non-empty value for `card_token` but received {card_token!r}")
1144+
return self._get(
1145+
path_template("/v1/cards/{card_token}/signals", card_token=card_token),
1146+
options=make_request_options(
1147+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1148+
),
1149+
cast_to=SignalsResponse,
1150+
)
1151+
11131152
def retrieve_spend_limits(
11141153
self,
11151154
card_token: str,
@@ -2300,6 +2339,44 @@ async def renew(
23002339
cast_to=Card,
23012340
)
23022341

2342+
async def retrieve_signals(
2343+
self,
2344+
card_token: str,
2345+
*,
2346+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2347+
# The extra values given here take precedence over values defined on the client or passed to this method.
2348+
extra_headers: Headers | None = None,
2349+
extra_query: Query | None = None,
2350+
extra_body: Body | None = None,
2351+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
2352+
) -> SignalsResponse:
2353+
"""
2354+
Returns behavioral feature state derived from a card's transaction history.
2355+
2356+
These signals expose the same data used by behavioral rule attributes (e.g.
2357+
`AMOUNT_Z_SCORE` with `scope: CARD`, `IS_NEW_COUNTRY` with `scope: CARD`) and
2358+
custom code `TRANSACTION_HISTORY_SIGNALS` features, allowing clients to inspect
2359+
feature values before writing rules and debug rule behavior.
2360+
2361+
Args:
2362+
extra_headers: Send extra headers
2363+
2364+
extra_query: Add additional query parameters to the request
2365+
2366+
extra_body: Add additional JSON properties to the request
2367+
2368+
timeout: Override the client-level default timeout for this request, in seconds
2369+
"""
2370+
if not card_token:
2371+
raise ValueError(f"Expected a non-empty value for `card_token` but received {card_token!r}")
2372+
return await self._get(
2373+
path_template("/v1/cards/{card_token}/signals", card_token=card_token),
2374+
options=make_request_options(
2375+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2376+
),
2377+
cast_to=SignalsResponse,
2378+
)
2379+
23032380
async def retrieve_spend_limits(
23042381
self,
23052382
card_token: str,
@@ -2474,6 +2551,9 @@ def __init__(self, cards: Cards) -> None:
24742551
self.renew = _legacy_response.to_raw_response_wrapper(
24752552
cards.renew,
24762553
)
2554+
self.retrieve_signals = _legacy_response.to_raw_response_wrapper(
2555+
cards.retrieve_signals,
2556+
)
24772557
self.retrieve_spend_limits = _legacy_response.to_raw_response_wrapper(
24782558
cards.retrieve_spend_limits,
24792559
)
@@ -2524,6 +2604,9 @@ def __init__(self, cards: AsyncCards) -> None:
25242604
self.renew = _legacy_response.async_to_raw_response_wrapper(
25252605
cards.renew,
25262606
)
2607+
self.retrieve_signals = _legacy_response.async_to_raw_response_wrapper(
2608+
cards.retrieve_signals,
2609+
)
25272610
self.retrieve_spend_limits = _legacy_response.async_to_raw_response_wrapper(
25282611
cards.retrieve_spend_limits,
25292612
)
@@ -2574,6 +2657,9 @@ def __init__(self, cards: Cards) -> None:
25742657
self.renew = to_streamed_response_wrapper(
25752658
cards.renew,
25762659
)
2660+
self.retrieve_signals = to_streamed_response_wrapper(
2661+
cards.retrieve_signals,
2662+
)
25772663
self.retrieve_spend_limits = to_streamed_response_wrapper(
25782664
cards.retrieve_spend_limits,
25792665
)
@@ -2624,6 +2710,9 @@ def __init__(self, cards: AsyncCards) -> None:
26242710
self.renew = async_to_streamed_response_wrapper(
26252711
cards.renew,
26262712
)
2713+
self.retrieve_signals = async_to_streamed_response_wrapper(
2714+
cards.retrieve_signals,
2715+
)
26272716
self.retrieve_spend_limits = async_to_streamed_response_wrapper(
26282717
cards.retrieve_spend_limits,
26292718
)

src/lithic/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from .hold_list_params import HoldListParams as HoldListParams
4848
from .hold_void_params import HoldVoidParams as HoldVoidParams
4949
from .kyc_exempt_param import KYCExemptParam as KYCExemptParam
50+
from .signals_response import SignalsResponse as SignalsResponse
5051
from .statement_totals import StatementTotals as StatementTotals
5152
from .card_embed_params import CardEmbedParams as CardEmbedParams
5253
from .card_renew_params import CardRenewParams as CardRenewParams

0 commit comments

Comments
 (0)