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
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.121.0"
".": "0.122.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 189
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fd53f07a8b1f148011972d7eba834d5995778d707ff8ef1ead92580b44142a15.yml
openapi_spec_hash: 45892e6361542824364d82181d4eb80d
config_hash: 5eca052bb23d273fa970eac3127dd919
configured_endpoints: 190
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d29b68bb85936070878d8badaa8a7c5991313285e70a990bc812c838eba85373.yml
openapi_spec_hash: 54b44da68df22eb0ea99f2bc564667a2
config_hash: ac8326134e692f3f3bdec82396bbec80
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.122.0 (2026-04-20)

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

### Features

* **api:** add card_authorization.challenge_response webhook event ([78f2c4c](https://github.com/lithic-com/lithic-python/commit/78f2c4c93def51d76abab01e41c5d80f6fe146e5))
* **api:** Add card/account/business account signals endpoints and behavioral rule attributes ([aa44c45](https://github.com/lithic-com/lithic-python/commit/aa44c45ae060d6350d56dd72e1ca7bf55d16a7e3))
* **api:** add set_verification_method to external_bank_accounts ([2645172](https://github.com/lithic-com/lithic-python/commit/26451722203cc8c6f88ec720d6529847ac09b2fd))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([5504230](https://github.com/lithic-com/lithic-python/commit/55042302360bdca2a67d23f2d835bdb3d072d071))

## 0.121.0 (2026-04-13)

Full Changelog: [v0.120.0...v0.121.0](https://github.com/lithic-com/lithic-python/compare/v0.120.0...v0.121.0)
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ Methods:
- <code title="get /v1/external_bank_accounts">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">list</a>(\*\*<a href="src/lithic/types/external_bank_account_list_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account_list_response.py">SyncCursorPage[ExternalBankAccountListResponse]</a></code>
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/retry_micro_deposits">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">retry_micro_deposits</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_retry_micro_deposits_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account_retry_micro_deposits_response.py">ExternalBankAccountRetryMicroDepositsResponse</a></code>
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/retry_prenote">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">retry_prenote</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_retry_prenote_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/set_verification_method">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">set_verification_method</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_set_verification_method_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/unpause">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">unpause</a>(external_bank_account_token) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>

## MicroDeposits
Expand Down Expand Up @@ -888,6 +889,7 @@ from lithic.types import (
AccountHolderVerificationWebhookEvent,
AccountHolderDocumentUpdatedWebhookEvent,
CardAuthorizationApprovalRequestWebhookEvent,
CardAuthorizationChallengeResponseWebhookEvent,
AuthRulesBacktestReportCreatedWebhookEvent,
BalanceUpdatedWebhookEvent,
BookTransferTransactionCreatedWebhookEvent,
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.121.0"
version = "0.122.0"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
56 changes: 53 additions & 3 deletions src/lithic/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io
import os
import pathlib
from typing import overload
from typing_extensions import TypeGuard
from typing import Sequence, cast, overload
from typing_extensions import TypeVar, TypeGuard

import anyio

Expand All @@ -17,7 +17,9 @@
HttpxFileContent,
HttpxRequestFiles,
)
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t

_T = TypeVar("_T")


def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
Expand Down Expand Up @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
return await anyio.Path(file).read_bytes()

return file


def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
"""Copy only the containers along the given paths.

Used to guard against mutation by extract_files without copying the entire structure.
Only dicts and lists that lie on a path are copied; everything else
is returned by reference.

For example, given paths=[["foo", "files", "file"]] and the structure:
{
"foo": {
"bar": {"baz": {}},
"files": {"file": <content>}
}
}
The root dict, "foo", and "files" are copied (they lie on the path).
"bar" and "baz" are returned by reference (off the path).
"""
return _deepcopy_with_paths(item, paths, 0)


def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
if not paths:
return item
if is_mapping(item):
key_to_paths: dict[str, list[Sequence[str]]] = {}
for path in paths:
if index < len(path):
key_to_paths.setdefault(path[index], []).append(path)

# if no path continues through this mapping, it won't be mutated and copying it is redundant
if not key_to_paths:
return item

result = dict(item)
for key, subpaths in key_to_paths.items():
if key in result:
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
return cast(_T, result)
if is_list(item):
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]

# if no path expects a list here, nothing will be mutated inside it - return by reference
if not array_paths:
return cast(_T, item)
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
return item
1 change: 0 additions & 1 deletion src/lithic/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
coerce_integer as coerce_integer,
file_from_path as file_from_path,
strip_not_given as strip_not_given,
deepcopy_minimal as deepcopy_minimal,
get_async_library as get_async_library,
maybe_coerce_float as maybe_coerce_float,
get_required_header as get_required_header,
Expand Down
15 changes: 0 additions & 15 deletions src/lithic/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
return isinstance(obj, Iterable)


def deepcopy_minimal(item: _T) -> _T:
"""Minimal reimplementation of copy.deepcopy() that will only copy certain object types:

- mappings, e.g. `dict`
- list

This is done for performance reasons.
"""
if is_mapping(item):
return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
if is_list(item):
return cast(_T, [deepcopy_minimal(entry) for entry in item])
return item


# copied from https://github.com/Rapptz/RoboDanny
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
size = len(seq)
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.121.0" # x-release-please-version
__version__ = "0.122.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/lithic/resources/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def list(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -390,6 +391,7 @@ def list(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down
6 changes: 6 additions & 0 deletions src/lithic/resources/events/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def create(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -214,6 +215,7 @@ def update(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -683,6 +685,7 @@ def send_simulated_example(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -806,6 +809,7 @@ async def create(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -952,6 +956,7 @@ async def update(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down Expand Up @@ -1421,6 +1426,7 @@ async def send_simulated_example(
"balance.updated",
"book_transfer_transaction.created",
"book_transfer_transaction.updated",
"card_authorization.challenge_response",
"card_transaction.enhanced_data.created",
"card_transaction.enhanced_data.updated",
"card_transaction.updated",
Expand Down
Loading