Skip to content

Commit 54cc580

Browse files
fix(internals): fix Card schema definition
1 parent 3e9e40a commit 54cc580

15 files changed

+132
-1370
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 156
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-569e7dcb415398515370989172038db711642cd3b0bd7559bfd2b94e325a6086.yml
33
openapi_spec_hash: ce1dae8c6eb50d4490e75357c5e520a7
4-
config_hash: 63fc7a2958a0676473d3ab381c9d2fd1
4+
config_hash: e9de93b19060a153a852f7c03f235162

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ client = Lithic()
154154
card = client.cards.create(
155155
type="VIRTUAL",
156156
)
157-
print(card.product_id)
158157
```
159158

160159
## Webhook Verification

api.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,34 +178,28 @@ Types:
178178

179179
```python
180180
from lithic.types import (
181+
Card,
181182
CardSpendLimits,
183+
NonPCICard,
182184
SpendLimitDuration,
183-
CardCreateResponse,
184-
CardRetrieveResponse,
185-
CardUpdateResponse,
186-
CardListResponse,
187-
CardConvertPhysicalResponse,
188185
CardEmbedResponse,
189186
CardProvisionResponse,
190-
CardReissueResponse,
191-
CardRenewResponse,
192-
CardSearchByPanResponse,
193187
)
194188
```
195189

196190
Methods:
197191

198-
- <code title="post /v1/cards">client.cards.<a href="./src/lithic/resources/cards/cards.py">create</a>(\*\*<a href="src/lithic/types/card_create_params.py">params</a>) -> <a href="./src/lithic/types/card_create_response.py">CardCreateResponse</a></code>
199-
- <code title="get /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve</a>(card_token) -> <a href="./src/lithic/types/card_retrieve_response.py">CardRetrieveResponse</a></code>
200-
- <code title="patch /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">update</a>(card_token, \*\*<a href="src/lithic/types/card_update_params.py">params</a>) -> <a href="./src/lithic/types/card_update_response.py">CardUpdateResponse</a></code>
201-
- <code title="get /v1/cards">client.cards.<a href="./src/lithic/resources/cards/cards.py">list</a>(\*\*<a href="src/lithic/types/card_list_params.py">params</a>) -> <a href="./src/lithic/types/card_list_response.py">SyncCursorPage[CardListResponse]</a></code>
202-
- <code title="post /v1/cards/{card_token}/convert_physical">client.cards.<a href="./src/lithic/resources/cards/cards.py">convert_physical</a>(card_token, \*\*<a href="src/lithic/types/card_convert_physical_params.py">params</a>) -> <a href="./src/lithic/types/card_convert_physical_response.py">CardConvertPhysicalResponse</a></code>
192+
- <code title="post /v1/cards">client.cards.<a href="./src/lithic/resources/cards/cards.py">create</a>(\*\*<a href="src/lithic/types/card_create_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
193+
- <code title="get /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve</a>(card_token) -> <a href="./src/lithic/types/card.py">Card</a></code>
194+
- <code title="patch /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">update</a>(card_token, \*\*<a href="src/lithic/types/card_update_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
195+
- <code title="get /v1/cards">client.cards.<a href="./src/lithic/resources/cards/cards.py">list</a>(\*\*<a href="src/lithic/types/card_list_params.py">params</a>) -> <a href="./src/lithic/types/non_pci_card.py">SyncCursorPage[NonPCICard]</a></code>
196+
- <code title="post /v1/cards/{card_token}/convert_physical">client.cards.<a href="./src/lithic/resources/cards/cards.py">convert_physical</a>(card_token, \*\*<a href="src/lithic/types/card_convert_physical_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
203197
- <code title="get /v1/embed/card">client.cards.<a href="./src/lithic/resources/cards/cards.py">embed</a>(\*\*<a href="src/lithic/types/card_embed_params.py">params</a>) -> str</code>
204198
- <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>
205-
- <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_reissue_response.py">CardReissueResponse</a></code>
206-
- <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_renew_response.py">CardRenewResponse</a></code>
199+
- <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>
200+
- <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>
207201
- <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>
208-
- <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_search_by_pan_response.py">CardSearchByPanResponse</a></code>
202+
- <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>
209203
- <code>client.cards.<a href="./src/lithic/resources/cards/cards.py">get_embed_html</a>(\*args) -> str</code>
210204
- <code>client.cards.<a href="./src/lithic/resources/cards/cards.py">get_embed_url</a>(\*args) -> URL</code>
211205

src/lithic/resources/cards/cards.py

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from ..._resource import SyncAPIResource, AsyncAPIResource
5353
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
5454
from ...pagination import SyncCursorPage, AsyncCursorPage
55+
from ...types.card import Card
5556
from ..._base_client import AsyncPaginator, _merge_mappings, make_request_options
5657
from .aggregate_balances import (
5758
AggregateBalances,
@@ -61,6 +62,7 @@
6162
AggregateBalancesWithStreamingResponse,
6263
AsyncAggregateBalancesWithStreamingResponse,
6364
)
65+
from ...types.non_pci_card import NonPCICard
6466
from .financial_transactions import (
6567
FinancialTransactions,
6668
AsyncFinancialTransactions,
@@ -70,17 +72,9 @@
7072
AsyncFinancialTransactionsWithStreamingResponse,
7173
)
7274
from ...types.card_spend_limits import CardSpendLimits
73-
from ...types.card_list_response import CardListResponse
74-
from ...types.card_renew_response import CardRenewResponse
75-
from ...types.card_create_response import CardCreateResponse
76-
from ...types.card_update_response import CardUpdateResponse
7775
from ...types.spend_limit_duration import SpendLimitDuration
78-
from ...types.card_reissue_response import CardReissueResponse
7976
from ...types.shared_params.carrier import Carrier
80-
from ...types.card_retrieve_response import CardRetrieveResponse
8177
from ...types.card_provision_response import CardProvisionResponse
82-
from ...types.card_search_by_pan_response import CardSearchByPanResponse
83-
from ...types.card_convert_physical_response import CardConvertPhysicalResponse
8478
from ...types.shared_params.shipping_address import ShippingAddress
8579

8680
__all__ = ["Cards", "AsyncCards"]
@@ -145,7 +139,7 @@ def create(
145139
extra_query: Query | None = None,
146140
extra_body: Body | None = None,
147141
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
148-
) -> CardCreateResponse:
142+
) -> Card:
149143
"""Create a new virtual or physical card.
150144
151145
Parameters `shipping_address` and
@@ -289,7 +283,7 @@ def create(
289283
options=make_request_options(
290284
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
291285
),
292-
cast_to=CardCreateResponse,
286+
cast_to=Card,
293287
)
294288

295289
def retrieve(
@@ -302,7 +296,7 @@ def retrieve(
302296
extra_query: Query | None = None,
303297
extra_body: Body | None = None,
304298
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
305-
) -> CardRetrieveResponse:
299+
) -> Card:
306300
"""
307301
Get card configuration such as spend limit and state.
308302
@@ -322,7 +316,7 @@ def retrieve(
322316
options=make_request_options(
323317
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
324318
),
325-
cast_to=CardRetrieveResponse,
319+
cast_to=Card,
326320
)
327321

328322
def update(
@@ -342,7 +336,7 @@ def update(
342336
extra_query: Query | None = None,
343337
extra_body: Body | None = None,
344338
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
345-
) -> CardUpdateResponse:
339+
) -> Card:
346340
"""Update the specified properties of the card.
347341
348342
Unsupplied properties will remain
@@ -423,7 +417,7 @@ def update(
423417
options=make_request_options(
424418
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
425419
),
426-
cast_to=CardUpdateResponse,
420+
cast_to=Card,
427421
)
428422

429423
def list(
@@ -442,7 +436,7 @@ def list(
442436
extra_query: Query | None = None,
443437
extra_body: Body | None = None,
444438
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
445-
) -> SyncCursorPage[CardListResponse]:
439+
) -> SyncCursorPage[NonPCICard]:
446440
"""
447441
List cards.
448442
@@ -475,7 +469,7 @@ def list(
475469
"""
476470
return self._get_api_list(
477471
"/v1/cards",
478-
page=SyncCursorPage[CardListResponse],
472+
page=SyncCursorPage[NonPCICard],
479473
options=make_request_options(
480474
extra_headers=extra_headers,
481475
extra_query=extra_query,
@@ -494,7 +488,7 @@ def list(
494488
card_list_params.CardListParams,
495489
),
496490
),
497-
model=CardListResponse,
491+
model=NonPCICard,
498492
)
499493

500494
def convert_physical(
@@ -512,7 +506,7 @@ def convert_physical(
512506
extra_query: Query | None = None,
513507
extra_body: Body | None = None,
514508
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
515-
) -> CardConvertPhysicalResponse:
509+
) -> Card:
516510
"""Convert a virtual card into a physical card and manufacture it.
517511
518512
Customer must
@@ -572,7 +566,7 @@ def convert_physical(
572566
options=make_request_options(
573567
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
574568
),
575-
cast_to=CardConvertPhysicalResponse,
569+
cast_to=Card,
576570
)
577571

578572
def embed(
@@ -852,7 +846,7 @@ def reissue(
852846
extra_query: Query | None = None,
853847
extra_body: Body | None = None,
854848
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
855-
) -> CardReissueResponse:
849+
) -> Card:
856850
"""Initiate print and shipment of a duplicate physical card (e.g.
857851
858852
card is
@@ -907,7 +901,7 @@ def reissue(
907901
options=make_request_options(
908902
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
909903
),
910-
cast_to=CardReissueResponse,
904+
cast_to=Card,
911905
)
912906

913907
def renew(
@@ -927,7 +921,7 @@ def renew(
927921
extra_query: Query | None = None,
928922
extra_body: Body | None = None,
929923
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
930-
) -> CardRenewResponse:
924+
) -> Card:
931925
"""Applies to card types `PHYSICAL` and `VIRTUAL`.
932926
933927
For `PHYSICAL`, creates a new
@@ -994,7 +988,7 @@ def renew(
994988
options=make_request_options(
995989
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
996990
),
997-
cast_to=CardRenewResponse,
991+
cast_to=Card,
998992
)
999993

1000994
def retrieve_spend_limits(
@@ -1043,7 +1037,7 @@ def search_by_pan(
10431037
extra_query: Query | None = None,
10441038
extra_body: Body | None = None,
10451039
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1046-
) -> CardSearchByPanResponse:
1040+
) -> Card:
10471041
"""Get card configuration such as spend limit and state.
10481042
10491043
Customers must be PCI
@@ -1069,7 +1063,7 @@ def search_by_pan(
10691063
options=make_request_options(
10701064
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
10711065
),
1072-
cast_to=CardSearchByPanResponse,
1066+
cast_to=Card,
10731067
)
10741068

10751069

@@ -1132,7 +1126,7 @@ async def create(
11321126
extra_query: Query | None = None,
11331127
extra_body: Body | None = None,
11341128
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1135-
) -> CardCreateResponse:
1129+
) -> Card:
11361130
"""Create a new virtual or physical card.
11371131
11381132
Parameters `shipping_address` and
@@ -1276,7 +1270,7 @@ async def create(
12761270
options=make_request_options(
12771271
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
12781272
),
1279-
cast_to=CardCreateResponse,
1273+
cast_to=Card,
12801274
)
12811275

12821276
async def retrieve(
@@ -1289,7 +1283,7 @@ async def retrieve(
12891283
extra_query: Query | None = None,
12901284
extra_body: Body | None = None,
12911285
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1292-
) -> CardRetrieveResponse:
1286+
) -> Card:
12931287
"""
12941288
Get card configuration such as spend limit and state.
12951289
@@ -1309,7 +1303,7 @@ async def retrieve(
13091303
options=make_request_options(
13101304
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
13111305
),
1312-
cast_to=CardRetrieveResponse,
1306+
cast_to=Card,
13131307
)
13141308

13151309
async def update(
@@ -1329,7 +1323,7 @@ async def update(
13291323
extra_query: Query | None = None,
13301324
extra_body: Body | None = None,
13311325
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1332-
) -> CardUpdateResponse:
1326+
) -> Card:
13331327
"""Update the specified properties of the card.
13341328
13351329
Unsupplied properties will remain
@@ -1410,7 +1404,7 @@ async def update(
14101404
options=make_request_options(
14111405
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
14121406
),
1413-
cast_to=CardUpdateResponse,
1407+
cast_to=Card,
14141408
)
14151409

14161410
def list(
@@ -1429,7 +1423,7 @@ def list(
14291423
extra_query: Query | None = None,
14301424
extra_body: Body | None = None,
14311425
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1432-
) -> AsyncPaginator[CardListResponse, AsyncCursorPage[CardListResponse]]:
1426+
) -> AsyncPaginator[NonPCICard, AsyncCursorPage[NonPCICard]]:
14331427
"""
14341428
List cards.
14351429
@@ -1462,7 +1456,7 @@ def list(
14621456
"""
14631457
return self._get_api_list(
14641458
"/v1/cards",
1465-
page=AsyncCursorPage[CardListResponse],
1459+
page=AsyncCursorPage[NonPCICard],
14661460
options=make_request_options(
14671461
extra_headers=extra_headers,
14681462
extra_query=extra_query,
@@ -1481,7 +1475,7 @@ def list(
14811475
card_list_params.CardListParams,
14821476
),
14831477
),
1484-
model=CardListResponse,
1478+
model=NonPCICard,
14851479
)
14861480

14871481
async def convert_physical(
@@ -1499,7 +1493,7 @@ async def convert_physical(
14991493
extra_query: Query | None = None,
15001494
extra_body: Body | None = None,
15011495
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1502-
) -> CardConvertPhysicalResponse:
1496+
) -> Card:
15031497
"""Convert a virtual card into a physical card and manufacture it.
15041498
15051499
Customer must
@@ -1559,7 +1553,7 @@ async def convert_physical(
15591553
options=make_request_options(
15601554
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
15611555
),
1562-
cast_to=CardConvertPhysicalResponse,
1556+
cast_to=Card,
15631557
)
15641558

15651559
async def embed(
@@ -1839,7 +1833,7 @@ async def reissue(
18391833
extra_query: Query | None = None,
18401834
extra_body: Body | None = None,
18411835
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1842-
) -> CardReissueResponse:
1836+
) -> Card:
18431837
"""Initiate print and shipment of a duplicate physical card (e.g.
18441838
18451839
card is
@@ -1894,7 +1888,7 @@ async def reissue(
18941888
options=make_request_options(
18951889
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
18961890
),
1897-
cast_to=CardReissueResponse,
1891+
cast_to=Card,
18981892
)
18991893

19001894
async def renew(
@@ -1914,7 +1908,7 @@ async def renew(
19141908
extra_query: Query | None = None,
19151909
extra_body: Body | None = None,
19161910
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1917-
) -> CardRenewResponse:
1911+
) -> Card:
19181912
"""Applies to card types `PHYSICAL` and `VIRTUAL`.
19191913
19201914
For `PHYSICAL`, creates a new
@@ -1981,7 +1975,7 @@ async def renew(
19811975
options=make_request_options(
19821976
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
19831977
),
1984-
cast_to=CardRenewResponse,
1978+
cast_to=Card,
19851979
)
19861980

19871981
async def retrieve_spend_limits(
@@ -2030,7 +2024,7 @@ async def search_by_pan(
20302024
extra_query: Query | None = None,
20312025
extra_body: Body | None = None,
20322026
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2033-
) -> CardSearchByPanResponse:
2027+
) -> Card:
20342028
"""Get card configuration such as spend limit and state.
20352029
20362030
Customers must be PCI
@@ -2056,7 +2050,7 @@ async def search_by_pan(
20562050
options=make_request_options(
20572051
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
20582052
),
2059-
cast_to=CardSearchByPanResponse,
2053+
cast_to=Card,
20602054
)
20612055

20622056

0 commit comments

Comments
 (0)