Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0607a37
codegen metadata
stainless-app[bot] Oct 16, 2025
6fc03bc
chore: bump `httpx-aiohttp` version to 0.1.9
stainless-app[bot] Oct 17, 2025
f7eaf72
feat: add beta tag to stripe auto charge items
stainless-app[bot] Oct 17, 2025
f4ec768
codegen metadata
stainless-app[bot] Oct 17, 2025
2db9469
feat: internal: moving plans docs to deprecated section of new docs site
stainless-app[bot] Oct 20, 2025
36af1bf
feat: add exclude_zero_balances field behind a FF for anthropic
stainless-app[bot] Oct 21, 2025
d4c8c1e
codegen metadata
stainless-app[bot] Oct 21, 2025
6496de7
codegen metadata
stainless-app[bot] Oct 21, 2025
f74df85
feat: Relax requirement on customer level commits for invoice_contrac…
stainless-app[bot] Oct 21, 2025
f5f3f82
codegen metadata
stainless-app[bot] Oct 22, 2025
0d0d478
feat: not ready for review
stainless-app[bot] Oct 22, 2025
4025e58
feat: ignore_duplicates
stainless-app[bot] Oct 23, 2025
0d2c224
feat: docs(api) Documentation for seat-based subscription linked recu…
stainless-app[bot] Oct 23, 2025
ca07022
feat: not ready for review
stainless-app[bot] Oct 23, 2025
ac261c2
fix(api): Make id field required in /v2/notifications/edit
stainless-app[bot] Oct 23, 2025
a8c98bb
feat: [ORCH-282] plumb `payment_method_id` to the payment gateway object
stainless-app[bot] Oct 24, 2025
d1f8d43
docs: add migrate amendments to edits page
stainless-app[bot] Oct 24, 2025
a75c6fd
chore(api): Note SQL BM is not supported in previewCustomerEvents des…
stainless-app[bot] Oct 28, 2025
cef8c10
codegen metadata
stainless-app[bot] Oct 28, 2025
a9868ad
codegen metadata
stainless-app[bot] Oct 28, 2025
ed2abf0
fix(client): close streams without requiring full consumption
stainless-app[bot] Oct 29, 2025
f88624e
feat: Add avalara creds + billing provider APIs to SDK. Add avalara c…
stainless-app[bot] Oct 29, 2025
b64d7f6
feat: add METRONOME to BillingProvider type
stainless-app[bot] Oct 29, 2025
53f9064
chore(internal/tests): avoid race condition with implicit client cleanup
stainless-app[bot] Oct 30, 2025
1bf5eb0
codegen metadata
stainless-app[bot] Oct 30, 2025
9678520
codegen metadata
stainless-app[bot] Oct 31, 2025
25d584b
feat: [ORCH-797] add billing_provider_error to invoice.external_invoice
stainless-app[bot] Oct 31, 2025
60584c7
codegen metadata
stainless-app[bot] Oct 31, 2025
4bdaa73
feat: update get customer alerts api to include low seat balance type
stainless-app[bot] Oct 31, 2025
04303f8
release: 3.1.0
stainless-app[bot] Oct 31, 2025
File filter

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 @@
{
".": "3.0.0"
".": "3.1.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: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-50a7ba4d20e9d681f3e493ecfcc8da36f5f7e53cdb51c519fa320b5df36714a6.yml
openapi_spec_hash: a650dc88c4f2f7a2bb7882df479676b0
config_hash: e105157c649df8f21991893def212b44
configured_endpoints: 110
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-52432b9ea19d7a6374ecb5e73a961b16134db2939efdde9a5b16897c89591168.yml
openapi_spec_hash: 4ae323c11bdc1d11d8923fa0c0b6a933
config_hash: 5aa28b992429a1dddfb3c5b0d777d1ce
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Changelog

## 3.1.0 (2025-10-31)

Full Changelog: [v3.0.0...v3.1.0](https://github.com/Metronome-Industries/metronome-python/compare/v3.0.0...v3.1.0)

### Features

* [ORCH-282] plumb `payment_method_id` to the payment gateway object ([a8c98bb](https://github.com/Metronome-Industries/metronome-python/commit/a8c98bb612d3eab8318ff405ebe44a2e7a06bce3))
* [ORCH-797] add billing_provider_error to invoice.external_invoice ([25d584b](https://github.com/Metronome-Industries/metronome-python/commit/25d584b771a073e0ff1dfabfc0ed9fa9419ecfe1))
* Add avalara creds + billing provider APIs to SDK. Add avalara creds API to docs. ([f88624e](https://github.com/Metronome-Industries/metronome-python/commit/f88624ea8665948cc0f0430a4a6af2811ed1b1ee))
* add beta tag to stripe auto charge items ([f7eaf72](https://github.com/Metronome-Industries/metronome-python/commit/f7eaf72534bcdcebe1cfc22f74693a7f9de62257))
* add exclude_zero_balances field behind a FF for anthropic ([36af1bf](https://github.com/Metronome-Industries/metronome-python/commit/36af1bfcd66da1feb70165e378ba959d3cbee998))
* add METRONOME to BillingProvider type ([b64d7f6](https://github.com/Metronome-Industries/metronome-python/commit/b64d7f63fb5433927eb1c05deeaaa0f5d817f410))
* docs(api) Documentation for seat-based subscription linked recurring commits beta release ([0d2c224](https://github.com/Metronome-Industries/metronome-python/commit/0d2c2242ca6907b7447e962756ec1907f0cf5bf0))
* ignore_duplicates ([4025e58](https://github.com/Metronome-Industries/metronome-python/commit/4025e5896f98e0189aa5fbdd01ec7c0505e4332f))
* internal: moving plans docs to deprecated section of new docs site ([2db9469](https://github.com/Metronome-Industries/metronome-python/commit/2db9469e4eccd1d147579d09bf35ff7a1f2ca738))
* not ready for review ([ca07022](https://github.com/Metronome-Industries/metronome-python/commit/ca07022666e58b2a319d81c6e1a0fdcfe3a3b1b7))
* not ready for review ([0d0d478](https://github.com/Metronome-Industries/metronome-python/commit/0d0d478ec50247380402630c76176af5a5755800))
* Relax requirement on customer level commits for invoice_contract_id if do_not_invoice is set to true ([f74df85](https://github.com/Metronome-Industries/metronome-python/commit/f74df850bdb8085f27866f36234a8612488cf65f))
* update get customer alerts api to include low seat balance type ([4bdaa73](https://github.com/Metronome-Industries/metronome-python/commit/4bdaa732cce863d5ec97aa3bee6d2a17d58a3839))


### Bug Fixes

* **api:** Make id field required in /v2/notifications/edit ([ac261c2](https://github.com/Metronome-Industries/metronome-python/commit/ac261c2589c05db34216d2bf84141bab854a592a))
* **client:** close streams without requiring full consumption ([ed2abf0](https://github.com/Metronome-Industries/metronome-python/commit/ed2abf0e91e189da7a059f8b8db33b49de9a273a))


### Chores

* **api:** Note SQL BM is not supported in previewCustomerEvents description ([a75c6fd](https://github.com/Metronome-Industries/metronome-python/commit/a75c6fd81edcad1e4b1848c9a11599c2245b58f1))
* bump `httpx-aiohttp` version to 0.1.9 ([6fc03bc](https://github.com/Metronome-Industries/metronome-python/commit/6fc03bcde0da509f5bc4e6a8e32c769d4d5d24a4))
* **internal/tests:** avoid race condition with implicit client cleanup ([53f9064](https://github.com/Metronome-Industries/metronome-python/commit/53f90642543d6ea42dcde84344b3edaf0c0cfdfb))


### Documentation

* add migrate amendments to edits page ([d1f8d43](https://github.com/Metronome-Industries/metronome-python/commit/d1f8d43d5b2c3a3b3ae26b1d21c33dd0d381229b))

## 3.0.0 (2025-10-16)

Full Changelog: [v2.0.0...v3.0.0](https://github.com/Metronome-Industries/metronome-python/compare/v2.0.0...v3.0.0)
Expand Down
25 changes: 25 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,28 @@ Methods:
- <code title="post /v1/payments/list">client.v1.payments.<a href="./src/metronome/resources/v1/payments.py">list</a>(\*\*<a href="src/metronome/types/v1/payment_list_params.py">params</a>) -> <a href="./src/metronome/types/v1/payment.py">SyncBodyCursorPage[Payment]</a></code>
- <code title="post /v1/payments/attempt">client.v1.payments.<a href="./src/metronome/resources/v1/payments.py">attempt</a>(\*\*<a href="src/metronome/types/v1/payment_attempt_params.py">params</a>) -> <a href="./src/metronome/types/v1/payment_attempt_response.py">PaymentAttemptResponse</a></code>
- <code title="post /v1/payments/cancel">client.v1.payments.<a href="./src/metronome/resources/v1/payments.py">cancel</a>(\*\*<a href="src/metronome/types/v1/payment_cancel_params.py">params</a>) -> <a href="./src/metronome/types/v1/payment_cancel_response.py">PaymentCancelResponse</a></code>

## Settings

Types:

```python
from metronome.types.v1 import SettingUpsertAvalaraCredentialsResponse
```

Methods:

- <code title="post /v1/upsertAvalaraCredentials">client.v1.settings.<a href="./src/metronome/resources/v1/settings/settings.py">upsert_avalara_credentials</a>(\*\*<a href="src/metronome/types/v1/setting_upsert_avalara_credentials_params.py">params</a>) -> <a href="./src/metronome/types/v1/setting_upsert_avalara_credentials_response.py">SettingUpsertAvalaraCredentialsResponse</a></code>

### BillingProviders

Types:

```python
from metronome.types.v1.settings import BillingProviderCreateResponse, BillingProviderListResponse
```

Methods:

- <code title="post /v1/setUpBillingProvider">client.v1.settings.billing_providers.<a href="./src/metronome/resources/v1/settings/billing_providers.py">create</a>(\*\*<a href="src/metronome/types/v1/settings/billing_provider_create_params.py">params</a>) -> <a href="./src/metronome/types/v1/settings/billing_provider_create_response.py">BillingProviderCreateResponse</a></code>
- <code title="post /v1/listConfiguredBillingProviders">client.v1.settings.billing_providers.<a href="./src/metronome/resources/v1/settings/billing_providers.py">list</a>(\*\*<a href="src/metronome/types/v1/settings/billing_provider_list_params.py">params</a>) -> <a href="./src/metronome/types/v1/settings/billing_provider_list_response.py">BillingProviderListResponse</a></code>
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "metronome-sdk"
version = "3.0.0"
version = "3.1.0"
description = "The official Python library for the metronome API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -39,7 +39,7 @@ Homepage = "https://github.com/Metronome-Industries/metronome-python"
Repository = "https://github.com/Metronome-Industries/metronome-python"

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

[tool.rye]
managed = true
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 metronome-sdk
# via respx
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via metronome-sdk
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 metronome-sdk
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via metronome-sdk
idna==3.4
# via anyio
Expand Down
10 changes: 4 additions & 6 deletions src/metronome/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
response.close()

def __enter__(self) -> Self:
return self
Expand Down Expand Up @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
async for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()

async def __aenter__(self) -> Self:
return self
Expand Down
2 changes: 1 addition & 1 deletion src/metronome/_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__ = "metronome"
__version__ = "3.0.0" # x-release-please-version
__version__ = "3.1.0" # x-release-please-version
14 changes: 14 additions & 0 deletions src/metronome/resources/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
ServicesResourceWithStreamingResponse,
AsyncServicesResourceWithStreamingResponse,
)
from .settings import (
SettingsResource,
AsyncSettingsResource,
SettingsResourceWithRawResponse,
AsyncSettingsResourceWithRawResponse,
SettingsResourceWithStreamingResponse,
AsyncSettingsResourceWithStreamingResponse,
)
from .contracts import (
ContractsResource,
AsyncContractsResource,
Expand Down Expand Up @@ -206,6 +214,12 @@
"AsyncPaymentsResourceWithRawResponse",
"PaymentsResourceWithStreamingResponse",
"AsyncPaymentsResourceWithStreamingResponse",
"SettingsResource",
"AsyncSettingsResource",
"SettingsResourceWithRawResponse",
"AsyncSettingsResourceWithRawResponse",
"SettingsResourceWithStreamingResponse",
"AsyncSettingsResourceWithStreamingResponse",
"V1Resource",
"AsyncV1Resource",
"V1ResourceWithRawResponse",
Expand Down
12 changes: 10 additions & 2 deletions src/metronome/resources/v1/contracts/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def amend(

New clients should implement
using the `editContract` endpoint. Read more about the migration to contract
editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and
editing [here](/guides/implement-metronome/migrate-amendments-to-edits/) and
reach out to your Metronome representative for more details. Once contract
editing is enabled, access to this endpoint will be removed.

Expand Down Expand Up @@ -786,6 +786,7 @@ def list_balances(
id: str | Omit = omit,
covering_date: Union[str, datetime] | Omit = omit,
effective_before: Union[str, datetime] | Omit = omit,
exclude_zero_balances: bool | Omit = omit,
include_archived: bool | Omit = omit,
include_balance: bool | Omit = omit,
include_contract_balances: bool | Omit = omit,
Expand Down Expand Up @@ -841,6 +842,8 @@ def list_balances(

effective_before: Include only balances that have any access before the provided date (exclusive)

exclude_zero_balances: Exclude balances with zero amounts from the response.

include_archived: Include archived credits and credits from archived contracts.

include_balance: Include the balance of credits and commits in the response. Setting this flag
Expand Down Expand Up @@ -874,6 +877,7 @@ def list_balances(
"id": id,
"covering_date": covering_date,
"effective_before": effective_before,
"exclude_zero_balances": exclude_zero_balances,
"include_archived": include_archived,
"include_balance": include_balance,
"include_contract_balances": include_contract_balances,
Expand Down Expand Up @@ -1728,7 +1732,7 @@ async def amend(

New clients should implement
using the `editContract` endpoint. Read more about the migration to contract
editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and
editing [here](/guides/implement-metronome/migrate-amendments-to-edits/) and
reach out to your Metronome representative for more details. Once contract
editing is enabled, access to this endpoint will be removed.

Expand Down Expand Up @@ -1906,6 +1910,7 @@ def list_balances(
id: str | Omit = omit,
covering_date: Union[str, datetime] | Omit = omit,
effective_before: Union[str, datetime] | Omit = omit,
exclude_zero_balances: bool | Omit = omit,
include_archived: bool | Omit = omit,
include_balance: bool | Omit = omit,
include_contract_balances: bool | Omit = omit,
Expand Down Expand Up @@ -1961,6 +1966,8 @@ def list_balances(

effective_before: Include only balances that have any access before the provided date (exclusive)

exclude_zero_balances: Exclude balances with zero amounts from the response.

include_archived: Include archived credits and credits from archived contracts.

include_balance: Include the balance of credits and commits in the response. Setting this flag
Expand Down Expand Up @@ -1994,6 +2001,7 @@ def list_balances(
"id": id,
"covering_date": covering_date,
"effective_before": effective_before,
"exclude_zero_balances": exclude_zero_balances,
"include_archived": include_archived,
"include_balance": include_balance,
"include_contract_balances": include_contract_balances,
Expand Down
48 changes: 32 additions & 16 deletions src/metronome/resources/v1/credit_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def create(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantCreateResponse:
"""
Create a new credit grant
"""Create a new credit grant.

This is a Plans (deprecated) endpoint. New clients
should implement using Contracts.

Args:
customer_id: the Metronome ID of the customer
Expand Down Expand Up @@ -168,7 +170,8 @@ def list(
) -> SyncCursorPage[CreditGrantListResponse]:
"""List credit grants.

This list does not included voided grants.
This list does not included voided grants. This is a Plans
(deprecated) endpoint. New clients should implement using Contracts.

Args:
limit: Max number of results that should be returned
Expand Down Expand Up @@ -240,8 +243,10 @@ def edit(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantEditResponse:
"""
Edit an existing credit grant
"""Edit an existing credit grant.

This is a Plans (deprecated) endpoint. New
clients should implement using Contracts.

Args:
id: the ID of the credit grant
Expand Down Expand Up @@ -297,7 +302,8 @@ def list_entries(

Returns lists of ledgers per customer.
Ledger entries are returned in chronological order. Ledger entries associated
with voided credit grants are not included.
with voided credit grants are not included. This is a Plans (deprecated)
endpoint. New clients should implement using Contracts.

Args:
next_page: Cursor that indicates where the next page of results should start.
Expand Down Expand Up @@ -368,8 +374,10 @@ def void(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantVoidResponse:
"""
Void a credit grant
"""Void a credit grant.

This is a Plans (deprecated) endpoint. New clients should
implement using Contracts.

Args:
release_uniqueness_key: If true, resets the uniqueness key on this grant so it can be re-used
Expand Down Expand Up @@ -445,8 +453,10 @@ async def create(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantCreateResponse:
"""
Create a new credit grant
"""Create a new credit grant.

This is a Plans (deprecated) endpoint. New clients
should implement using Contracts.

Args:
customer_id: the Metronome ID of the customer
Expand Down Expand Up @@ -533,7 +543,8 @@ def list(
) -> AsyncPaginator[CreditGrantListResponse, AsyncCursorPage[CreditGrantListResponse]]:
"""List credit grants.

This list does not included voided grants.
This list does not included voided grants. This is a Plans
(deprecated) endpoint. New clients should implement using Contracts.

Args:
limit: Max number of results that should be returned
Expand Down Expand Up @@ -605,8 +616,10 @@ async def edit(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantEditResponse:
"""
Edit an existing credit grant
"""Edit an existing credit grant.

This is a Plans (deprecated) endpoint. New
clients should implement using Contracts.

Args:
id: the ID of the credit grant
Expand Down Expand Up @@ -662,7 +675,8 @@ def list_entries(

Returns lists of ledgers per customer.
Ledger entries are returned in chronological order. Ledger entries associated
with voided credit grants are not included.
with voided credit grants are not included. This is a Plans (deprecated)
endpoint. New clients should implement using Contracts.

Args:
next_page: Cursor that indicates where the next page of results should start.
Expand Down Expand Up @@ -733,8 +747,10 @@ async def void(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> CreditGrantVoidResponse:
"""
Void a credit grant
"""Void a credit grant.

This is a Plans (deprecated) endpoint. New clients should
implement using Contracts.

Args:
release_uniqueness_key: If true, resets the uniqueness key on this grant so it can be re-used
Expand Down
Loading