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.108.0"
".": "0.109.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: 169
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b1839661d8405911184d5cb7230f16e626a616e5b744634bd7f0bb4e730bf899.yml
openapi_spec_hash: c1c2c5a5c2a4067a714b35f873e3846f
config_hash: 98214f2eab6804b5c0048331e32c08e3
configured_endpoints: 168
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6432801dcf017d9234739b9f6153a8cfecd91255af4765f24ba5209f3e320b5c.yml
openapi_spec_hash: c2cfee2f044ba15d15b5bfdbd37280c0
config_hash: 8ac73ccdb428816c89c84802c794a3f8
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.109.0 (2025-10-23)

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

### Features

* **api:** updates to Auth Rules and Card provisioning ([5a634bb](https://github.com/lithic-com/lithic-python/commit/5a634bbbaccf90921d5339d4173c6798e11f5898))


### Chores

* bump `httpx-aiohttp` version to 0.1.9 ([1f43f1d](https://github.com/lithic-com/lithic-python/commit/1f43f1da5db00568795b4f04462f075ea7130d16))
* **internal:** detect missing future annotations with ruff ([a179321](https://github.com/lithic-com/lithic-python/commit/a1793216b4f1e68c98b6c6d22314ebbc34cba322))

## 0.108.0 (2025-10-08)

Full Changelog: [v0.107.0...v0.108.0](https://github.com/lithic-com/lithic-python/compare/v0.107.0...v0.108.0)
Expand Down
3 changes: 1 addition & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ from lithic.types.auth_rules import (
V2ApplyResponse,
V2DraftResponse,
V2PromoteResponse,
V2ReportResponse,
V2RetrieveFeaturesResponse,
V2RetrieveReportResponse,
)
Expand All @@ -111,7 +110,6 @@ Methods:
- <code title="post /v2/auth_rules/{auth_rule_token}/apply">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">apply</a>(auth_rule_token, \*\*<a href="src/lithic/types/auth_rules/v2_apply_params.py">params</a>) -> <a href="./src/lithic/types/auth_rules/v2_apply_response.py">V2ApplyResponse</a></code>
- <code title="post /v2/auth_rules/{auth_rule_token}/draft">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">draft</a>(auth_rule_token, \*\*<a href="src/lithic/types/auth_rules/v2_draft_params.py">params</a>) -> <a href="./src/lithic/types/auth_rules/v2_draft_response.py">V2DraftResponse</a></code>
- <code title="post /v2/auth_rules/{auth_rule_token}/promote">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">promote</a>(auth_rule_token) -> <a href="./src/lithic/types/auth_rules/v2_promote_response.py">V2PromoteResponse</a></code>
- <code title="post /v2/auth_rules/{auth_rule_token}/report">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">report</a>(auth_rule_token) -> <a href="./src/lithic/types/auth_rules/v2_report_response.py">V2ReportResponse</a></code>
- <code title="get /v2/auth_rules/{auth_rule_token}/features">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">retrieve_features</a>(auth_rule_token, \*\*<a href="src/lithic/types/auth_rules/v2_retrieve_features_params.py">params</a>) -> <a href="./src/lithic/types/auth_rules/v2_retrieve_features_response.py">V2RetrieveFeaturesResponse</a></code>
- <code title="get /v2/auth_rules/{auth_rule_token}/report">client.auth_rules.v2.<a href="./src/lithic/resources/auth_rules/v2/v2.py">retrieve_report</a>(auth_rule_token, \*\*<a href="src/lithic/types/auth_rules/v2_retrieve_report_params.py">params</a>) -> <a href="./src/lithic/types/auth_rules/v2_retrieve_report_response.py">V2RetrieveReportResponse</a></code>

Expand Down Expand Up @@ -187,6 +185,7 @@ from lithic.types import (
Card,
CardSpendLimits,
NonPCICard,
ProvisionResponse,
SpendLimitDuration,
CardEmbedResponse,
CardProvisionResponse,
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lithic"
version = "0.108.0"
version = "0.109.0"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -39,7 +39,7 @@ Homepage = "https://github.com/lithic-com/lithic-python"
Repository = "https://github.com/lithic-com/lithic-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]

[tool.rye]
managed = true
Expand Down Expand Up @@ -224,6 +224,8 @@ select = [
"B",
# remove unused imports
"F401",
# check for missing future annotations
"FA102",
# bare except statements
"E722",
# unused arguments
Expand All @@ -246,6 +248,8 @@ unfixable = [
"T203",
]

extend-safe-fixes = ["FA102"]

[tool.ruff.lint.flake8-tidy-imports.banned-api]
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ httpx==0.28.1
# via httpx-aiohttp
# via lithic
# via respx
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via lithic
idna==3.4
# via anyio
Expand Down
2 changes: 1 addition & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ httpcore==1.0.9
httpx==0.28.1
# via httpx-aiohttp
# via lithic
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via lithic
idna==3.4
# via anyio
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.108.0" # x-release-please-version
__version__ = "0.109.0" # x-release-please-version
191 changes: 0 additions & 191 deletions src/lithic/resources/auth_rules/v2/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from ....types.auth_rules.v2_apply_response import V2ApplyResponse
from ....types.auth_rules.v2_draft_response import V2DraftResponse
from ....types.auth_rules.v2_create_response import V2CreateResponse
from ....types.auth_rules.v2_report_response import V2ReportResponse
from ....types.auth_rules.v2_update_response import V2UpdateResponse
from ....types.auth_rules.v2_promote_response import V2PromoteResponse
from ....types.auth_rules.v2_retrieve_response import V2RetrieveResponse
Expand Down Expand Up @@ -796,91 +795,6 @@ def promote(
cast_to=V2PromoteResponse,
)

@typing_extensions.deprecated("deprecated")
def report(
self,
auth_rule_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> V2ReportResponse:
"""This endpoint is deprecated and will be removed in the future.

Requests a
performance report of an Auth rule to be asynchronously generated. Reports can
only be run on rules in draft or active mode and will included approved and
declined statistics as well as examples. The generated report will be delivered
asynchronously through a webhook with `event_type` =
`auth_rules.performance_report.created`. See the docs on setting up
[webhook subscriptions](https://docs.lithic.com/docs/events-api).

Reports are generated based on data collected by Lithic's processing system in
the trailing week. The performance of the auth rule will be assessed on the
configuration of the auth rule at the time the report is requested. This implies
that if a performance report is requested, right after updating an auth rule,
depending on the number of events processed for a card program, it may be the
case that no data is available for the report. Therefore Lithic recommends to
decouple making updates to an Auth Rule, and requesting performance reports.

To make this concrete, consider the following example:

1. At time `t`, a new Auth Rule is created, and applies to all auth events on a
card program. The Auth Rule has not yet been promoted, causing the draft
version of the rule to be applied in shadow mode.
2. At time `t + 1 hour` a performance report is requested for the Auth Rule.
This performance report will _only_ contain data for the Auth Rule being
executed in the window between `t` and `t + 1 hour`. This is because Lithic's
transaction processing system will only start capturing data for the Auth
Rule at the time it is created.
3. At time `t + 2 hours` the draft version of the Auth Rule is promoted to the
active version of the Auth Rule by calling the
`/v2/auth_rules/{auth_rule_token}/promote` endpoint. If a performance report
is requested at this moment it will still only contain data for this version
of the rule, but the window of available data will now span from `t` to
`t + 2 hours`.
4. At time `t + 3 hours` a new version of the rule is drafted by calling the
`/v2/auth_rules/{auth_rule_token}/draft` endpoint. If a performance report is
requested right at this moment, it will only contain data for events to which
both the active version and the draft version is applied. Lithic does this to
ensure that performance reports represent a fair comparison between rules.
Because there may be no events in this window, and because there may be some
lag before data is available in a performance report, the requested
performance report could contain no to little data.
5. At time `t + 4 hours` another performance report is requested: this time the
performance report will contain data from the window between `t + 3 hours`
and `t + 4 hours`, for any events to which both the current version of the
Auth rule (in enforcing mode) and the draft version of the Auth rule (in
shadow mode) applied.

Note that generating a report may take up to 15 minutes and that delivery is not
guaranteed. Customers are required to have created an event subscription to
receive the webhook. Additionally, there is a delay of approximately 15 minutes
between when Lithic's transaction processing systems have processed the
transaction, and when a transaction will be included in the report.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not auth_rule_token:
raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}")
return self._post(
f"/v2/auth_rules/{auth_rule_token}/report",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=V2ReportResponse,
)

def retrieve_features(
self,
auth_rule_token: str,
Expand Down Expand Up @@ -1744,91 +1658,6 @@ async def promote(
cast_to=V2PromoteResponse,
)

@typing_extensions.deprecated("deprecated")
async def report(
self,
auth_rule_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> V2ReportResponse:
"""This endpoint is deprecated and will be removed in the future.

Requests a
performance report of an Auth rule to be asynchronously generated. Reports can
only be run on rules in draft or active mode and will included approved and
declined statistics as well as examples. The generated report will be delivered
asynchronously through a webhook with `event_type` =
`auth_rules.performance_report.created`. See the docs on setting up
[webhook subscriptions](https://docs.lithic.com/docs/events-api).

Reports are generated based on data collected by Lithic's processing system in
the trailing week. The performance of the auth rule will be assessed on the
configuration of the auth rule at the time the report is requested. This implies
that if a performance report is requested, right after updating an auth rule,
depending on the number of events processed for a card program, it may be the
case that no data is available for the report. Therefore Lithic recommends to
decouple making updates to an Auth Rule, and requesting performance reports.

To make this concrete, consider the following example:

1. At time `t`, a new Auth Rule is created, and applies to all auth events on a
card program. The Auth Rule has not yet been promoted, causing the draft
version of the rule to be applied in shadow mode.
2. At time `t + 1 hour` a performance report is requested for the Auth Rule.
This performance report will _only_ contain data for the Auth Rule being
executed in the window between `t` and `t + 1 hour`. This is because Lithic's
transaction processing system will only start capturing data for the Auth
Rule at the time it is created.
3. At time `t + 2 hours` the draft version of the Auth Rule is promoted to the
active version of the Auth Rule by calling the
`/v2/auth_rules/{auth_rule_token}/promote` endpoint. If a performance report
is requested at this moment it will still only contain data for this version
of the rule, but the window of available data will now span from `t` to
`t + 2 hours`.
4. At time `t + 3 hours` a new version of the rule is drafted by calling the
`/v2/auth_rules/{auth_rule_token}/draft` endpoint. If a performance report is
requested right at this moment, it will only contain data for events to which
both the active version and the draft version is applied. Lithic does this to
ensure that performance reports represent a fair comparison between rules.
Because there may be no events in this window, and because there may be some
lag before data is available in a performance report, the requested
performance report could contain no to little data.
5. At time `t + 4 hours` another performance report is requested: this time the
performance report will contain data from the window between `t + 3 hours`
and `t + 4 hours`, for any events to which both the current version of the
Auth rule (in enforcing mode) and the draft version of the Auth rule (in
shadow mode) applied.

Note that generating a report may take up to 15 minutes and that delivery is not
guaranteed. Customers are required to have created an event subscription to
receive the webhook. Additionally, there is a delay of approximately 15 minutes
between when Lithic's transaction processing systems have processed the
transaction, and when a transaction will be included in the report.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not auth_rule_token:
raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}")
return await self._post(
f"/v2/auth_rules/{auth_rule_token}/report",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=V2ReportResponse,
)

async def retrieve_features(
self,
auth_rule_token: str,
Expand Down Expand Up @@ -1974,11 +1803,6 @@ def __init__(self, v2: V2) -> None:
self.promote = _legacy_response.to_raw_response_wrapper(
v2.promote,
)
self.report = ( # pyright: ignore[reportDeprecated]
_legacy_response.to_raw_response_wrapper(
v2.report, # pyright: ignore[reportDeprecated],
)
)
self.retrieve_features = _legacy_response.to_raw_response_wrapper(
v2.retrieve_features,
)
Expand Down Expand Up @@ -2021,11 +1845,6 @@ def __init__(self, v2: AsyncV2) -> None:
self.promote = _legacy_response.async_to_raw_response_wrapper(
v2.promote,
)
self.report = ( # pyright: ignore[reportDeprecated]
_legacy_response.async_to_raw_response_wrapper(
v2.report, # pyright: ignore[reportDeprecated],
)
)
self.retrieve_features = _legacy_response.async_to_raw_response_wrapper(
v2.retrieve_features,
)
Expand Down Expand Up @@ -2068,11 +1887,6 @@ def __init__(self, v2: V2) -> None:
self.promote = to_streamed_response_wrapper(
v2.promote,
)
self.report = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
v2.report, # pyright: ignore[reportDeprecated],
)
)
self.retrieve_features = to_streamed_response_wrapper(
v2.retrieve_features,
)
Expand Down Expand Up @@ -2115,11 +1929,6 @@ def __init__(self, v2: AsyncV2) -> None:
self.promote = async_to_streamed_response_wrapper(
v2.promote,
)
self.report = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
v2.report, # pyright: ignore[reportDeprecated],
)
)
self.retrieve_features = async_to_streamed_response_wrapper(
v2.retrieve_features,
)
Expand Down
2 changes: 0 additions & 2 deletions src/lithic/resources/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def list(
"account_holder.created",
"account_holder.updated",
"account_holder.verification",
"auth_rules.performance_report.created",
"balance.updated",
"book_transfer_transaction.created",
"card.created",
Expand Down Expand Up @@ -380,7 +379,6 @@ def list(
"account_holder.created",
"account_holder.updated",
"account_holder.verification",
"auth_rules.performance_report.created",
"balance.updated",
"book_transfer_transaction.created",
"card.created",
Expand Down
Loading