Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'preview-head/**'
- 'preview-base/**'
- 'preview/**'

jobs:
lint:
name: lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand All @@ -33,7 +33,6 @@ jobs:
test:
name: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.89.0"
".": "0.90.0"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.90.0 (2025-04-09)

Full Changelog: [v0.89.0...v0.90.0](https://github.com/lithic-com/lithic-python/compare/v0.89.0...v0.90.0)

### Features

* **api:** manual updates ([6800098](https://github.com/lithic-com/lithic-python/commit/6800098f32ba1d88183219c9cc822a6e57670632))


### Chores

* configure new SDK language ([4a3c8b4](https://github.com/lithic-com/lithic-python/commit/4a3c8b431da736f617049f3e6b989a14635c09c6))
* **internal:** expand CI branch coverage ([#736](https://github.com/lithic-com/lithic-python/issues/736)) ([01cf49e](https://github.com/lithic-com/lithic-python/commit/01cf49e2ae2fb20a52ce88d21368cd05b2b48dc6))
* **tests:** improve enum examples ([#734](https://github.com/lithic-com/lithic-python/issues/734)) ([cd17f0d](https://github.com/lithic-com/lithic-python/commit/cd17f0d1a1152b464fba5d96f368289e14fe1a41))

## 0.89.0 (2025-04-08)

Full Changelog: [v0.88.0...v0.89.0](https://github.com/lithic-com/lithic-python/compare/v0.88.0...v0.89.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ from lithic import Lithic
client = Lithic()

card = client.cards.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
)
print(card.product_id)
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lithic"
version = "0.89.0"
version = "0.90.0"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
22 changes: 22 additions & 0 deletions src/lithic/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
return key


def _no_transform_needed(annotation: type) -> bool:
return annotation == float or annotation == int


def _transform_recursive(
data: object,
*,
Expand Down Expand Up @@ -184,6 +188,15 @@ def _transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down Expand Up @@ -332,6 +345,15 @@ async def _async_transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "lithic"
__version__ = "0.89.0" # x-release-please-version
__version__ = "0.90.0" # x-release-please-version
44 changes: 22 additions & 22 deletions tests/api_resources/test_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ class TestCards:
@parametrize
def test_method_create(self, client: Lithic) -> None:
card = client.cards.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
)
assert_matches_type(Card, card, path=["response"])

@parametrize
def test_method_create_with_all_params(self, client: Lithic) -> None:
card = client.cards.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_program_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
carrier={"qr_code_url": "qr_code_url"},
Expand All @@ -60,15 +60,15 @@ def test_method_create_with_all_params(self, client: Lithic) -> None:
},
shipping_method="2_DAY",
spend_limit=1000,
spend_limit_duration="ANNUALLY",
spend_limit_duration="TRANSACTION",
state="OPEN",
)
assert_matches_type(Card, card, path=["response"])

@parametrize
def test_raw_response_create(self, client: Lithic) -> None:
response = client.cards.with_raw_response.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
)

assert response.is_closed is True
Expand All @@ -79,7 +79,7 @@ def test_raw_response_create(self, client: Lithic) -> None:
@parametrize
def test_streaming_response_create(self, client: Lithic) -> None:
with client.cards.with_streaming_response.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -143,8 +143,8 @@ def test_method_update_with_all_params(self, client: Lithic) -> None:
pin="pin",
pin_status="OK",
spend_limit=100,
spend_limit_duration="ANNUALLY",
state="CLOSED",
spend_limit_duration="FOREVER",
state="OPEN",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -252,7 +252,7 @@ def test_method_convert_physical_with_all_params(self, client: Lithic) -> None:
},
carrier={"qr_code_url": "https://lithic.com/activate-card/1"},
product_id="100",
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -374,7 +374,7 @@ def test_method_provision_with_all_params(self, client: Lithic) -> None:
certificate="U3RhaW5sZXNzIHJvY2tz",
client_device_id="client_device_id",
client_wallet_account_id="client_wallet_account_id",
digital_wallet="APPLE_PAY",
digital_wallet="GOOGLE_PAY",
nonce="U3RhaW5sZXNzIHJvY2tz",
nonce_signature="U3RhaW5sZXNzIHJvY2tz",
)
Expand Down Expand Up @@ -437,7 +437,7 @@ def test_method_reissue_with_all_params(self, client: Lithic) -> None:
"line2_text": "The Bluth Company",
"phone_number": "+15555555555",
},
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -509,7 +509,7 @@ def test_method_renew_with_all_params(self, client: Lithic) -> None:
exp_month="06",
exp_year="2027",
product_id="100",
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -647,14 +647,14 @@ class TestAsyncCards:
@parametrize
async def test_method_create(self, async_client: AsyncLithic) -> None:
card = await async_client.cards.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
)
assert_matches_type(Card, card, path=["response"])

@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncLithic) -> None:
card = await async_client.cards.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_program_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
carrier={"qr_code_url": "qr_code_url"},
Expand All @@ -681,15 +681,15 @@ async def test_method_create_with_all_params(self, async_client: AsyncLithic) ->
},
shipping_method="2_DAY",
spend_limit=1000,
spend_limit_duration="ANNUALLY",
spend_limit_duration="TRANSACTION",
state="OPEN",
)
assert_matches_type(Card, card, path=["response"])

@parametrize
async def test_raw_response_create(self, async_client: AsyncLithic) -> None:
response = await async_client.cards.with_raw_response.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
)

assert response.is_closed is True
Expand All @@ -700,7 +700,7 @@ async def test_raw_response_create(self, async_client: AsyncLithic) -> None:
@parametrize
async def test_streaming_response_create(self, async_client: AsyncLithic) -> None:
async with async_client.cards.with_streaming_response.create(
type="MERCHANT_LOCKED",
type="VIRTUAL",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -764,8 +764,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncLithic) ->
pin="pin",
pin_status="OK",
spend_limit=100,
spend_limit_duration="ANNUALLY",
state="CLOSED",
spend_limit_duration="FOREVER",
state="OPEN",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -873,7 +873,7 @@ async def test_method_convert_physical_with_all_params(self, async_client: Async
},
carrier={"qr_code_url": "https://lithic.com/activate-card/1"},
product_id="100",
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -995,7 +995,7 @@ async def test_method_provision_with_all_params(self, async_client: AsyncLithic)
certificate="U3RhaW5sZXNzIHJvY2tz",
client_device_id="client_device_id",
client_wallet_account_id="client_wallet_account_id",
digital_wallet="APPLE_PAY",
digital_wallet="GOOGLE_PAY",
nonce="U3RhaW5sZXNzIHJvY2tz",
nonce_signature="U3RhaW5sZXNzIHJvY2tz",
)
Expand Down Expand Up @@ -1058,7 +1058,7 @@ async def test_method_reissue_with_all_params(self, async_client: AsyncLithic) -
"line2_text": "The Bluth Company",
"phone_number": "+15555555555",
},
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down Expand Up @@ -1130,7 +1130,7 @@ async def test_method_renew_with_all_params(self, async_client: AsyncLithic) ->
exp_month="06",
exp_year="2027",
product_id="100",
shipping_method="2_DAY",
shipping_method="STANDARD",
)
assert_matches_type(Card, card, path=["response"])

Expand Down
16 changes: 8 additions & 8 deletions tests/api_resources/test_disputes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestDisputes:
def test_method_create(self, client: Lithic) -> None:
dispute = client.disputes.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
)
assert_matches_type(Dispute, dispute, path=["response"])
Expand All @@ -35,7 +35,7 @@ def test_method_create(self, client: Lithic) -> None:
def test_method_create_with_all_params(self, client: Lithic) -> None:
dispute = client.disputes.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
customer_filed_date=parse_datetime("2021-06-28T22:53:15Z"),
customer_note="customer_note",
Expand All @@ -46,7 +46,7 @@ def test_method_create_with_all_params(self, client: Lithic) -> None:
def test_raw_response_create(self, client: Lithic) -> None:
response = client.disputes.with_raw_response.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
)

Expand All @@ -59,7 +59,7 @@ def test_raw_response_create(self, client: Lithic) -> None:
def test_streaming_response_create(self, client: Lithic) -> None:
with client.disputes.with_streaming_response.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
) as response:
assert not response.is_closed
Expand Down Expand Up @@ -433,7 +433,7 @@ class TestAsyncDisputes:
async def test_method_create(self, async_client: AsyncLithic) -> None:
dispute = await async_client.disputes.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
)
assert_matches_type(Dispute, dispute, path=["response"])
Expand All @@ -442,7 +442,7 @@ async def test_method_create(self, async_client: AsyncLithic) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncLithic) -> None:
dispute = await async_client.disputes.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
customer_filed_date=parse_datetime("2021-06-28T22:53:15Z"),
customer_note="customer_note",
Expand All @@ -453,7 +453,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLithic) ->
async def test_raw_response_create(self, async_client: AsyncLithic) -> None:
response = await async_client.disputes.with_raw_response.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
)

Expand All @@ -466,7 +466,7 @@ async def test_raw_response_create(self, async_client: AsyncLithic) -> None:
async def test_streaming_response_create(self, async_client: AsyncLithic) -> None:
async with async_client.disputes.with_streaming_response.create(
amount=10000,
reason="ATM_CASH_MISDISPENSE",
reason="FRAUD_CARD_PRESENT",
transaction_token="12345624-aa69-4cbc-a946-30d90181b621",
) as response:
assert not response.is_closed
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_tokenizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_method_resend_activation_code(self, client: Lithic) -> None:
def test_method_resend_activation_code_with_all_params(self, client: Lithic) -> None:
tokenization = client.tokenizations.resend_activation_code(
tokenization_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
activation_method_type="EMAIL_TO_CARDHOLDER_ADDRESS",
activation_method_type="TEXT_TO_CARDHOLDER_NUMBER",
)
assert tokenization is None

Expand Down Expand Up @@ -605,7 +605,7 @@ async def test_method_resend_activation_code(self, async_client: AsyncLithic) ->
async def test_method_resend_activation_code_with_all_params(self, async_client: AsyncLithic) -> None:
tokenization = await async_client.tokenizations.resend_activation_code(
tokenization_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
activation_method_type="EMAIL_TO_CARDHOLDER_ADDRESS",
activation_method_type="TEXT_TO_CARDHOLDER_NUMBER",
)
assert tokenization is None

Expand Down
Loading