From 6eebd19243b4cc50665c65472ded42d545712df6 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Fri, 9 May 2025 13:11:29 +0000 Subject: [PATCH 1/2] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.543.1 --- .gitignore | 1 + .speakeasy/gen.lock | 10 ++-- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 14 +++--- RELEASES.md | 12 ++++- docs/models/ecommerceorderlineitem.md | 2 +- pyproject.toml | 2 +- src/apideck_unify/_version.py | 6 +-- src/apideck_unify/httpclient.py | 50 +++++++++++++------ .../models/ecommerceorderlineitem.py | 11 ++-- 10 files changed, 71 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 0f8e5ddc..4045ca01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +**/__pycache__/ **/.speakeasy/temp/ **/.speakeasy/logs/ .speakeasy/temp/ diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bc73d686..4f56c3fa 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: fca0ac3a-5f4e-452c-bbc7-2311afa8da40 management: - docChecksum: 14ed38db9a4af4d6b2892aea130bf389 + docChecksum: ef5888e0e7ebc9d485e3cff4f84a7ef6 docVersion: 10.16.5 - speakeasyVersion: 1.542.3 - generationVersion: 2.597.9 - releaseVersion: 0.14.0 - configChecksum: fe802b0121d229e0c0d3d87493c8ba09 + speakeasyVersion: 1.543.1 + generationVersion: 2.598.21 + releaseVersion: 0.14.1 + configChecksum: 21970d7463647e253f74bbf29670cafe repoURL: https://github.com/apideck-libraries/sdk-python.git installationURL: https://github.com/apideck-libraries/sdk-python.git published: true diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index f6de1476..11ab2cb7 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -19,7 +19,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: true python: - version: 0.14.0 + version: 0.14.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2afb02c1..19258ec9 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.542.3 +speakeasyVersion: 1.543.1 sources: Apideck: sourceNamespace: apideck - sourceRevisionDigest: sha256:9cded97eba03a67677e9230e91aa7619ec3d30a2ff72add7cc4e53770019ccc7 - sourceBlobDigest: sha256:90c0e0a31fb0536da50e41f7eb85bf940cc21649ab85bc20a64177151493e444 + sourceRevisionDigest: sha256:f468ad536e8a33e68600665c8afdb009888f37079ec6d206ac07d0b4028cc1a1 + sourceBlobDigest: sha256:8755fe54b3c4fecba092fd2799273e8a9d876cd2104ad3dfb92a467d242410f4 tags: - latest - - speakeasy-sdk-regen-1746174542 + - speakeasy-sdk-regen-1746796133 - 10.16.5 targets: apideck: source: Apideck sourceNamespace: apideck - sourceRevisionDigest: sha256:9cded97eba03a67677e9230e91aa7619ec3d30a2ff72add7cc4e53770019ccc7 - sourceBlobDigest: sha256:90c0e0a31fb0536da50e41f7eb85bf940cc21649ab85bc20a64177151493e444 + sourceRevisionDigest: sha256:f468ad536e8a33e68600665c8afdb009888f37079ec6d206ac07d0b4028cc1a1 + sourceBlobDigest: sha256:8755fe54b3c4fecba092fd2799273e8a9d876cd2104ad3dfb92a467d242410f4 codeSamplesNamespace: apideck-python-code-samples - codeSamplesRevisionDigest: sha256:8db1184213a80cc43443417a09ddd29bc7c40c96a57c3787aa6873bf8d86511f + codeSamplesRevisionDigest: sha256:a5d04ddc583eaac5633dd8125002894c4f1e57eb9b717ebd26f6ecfeb715581a workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index a09761e0..c4c0535f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -218,4 +218,14 @@ Based on: ### Generated - [python v0.14.0] . ### Releases -- [PyPI v0.14.0] https://pypi.org/project/apideck-unify/0.14.0 - . \ No newline at end of file +- [PyPI v0.14.0] https://pypi.org/project/apideck-unify/0.14.0 - . + +## 2025-05-09 13:08:35 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.543.1 (2.598.21) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.14.1] . +### Releases +- [PyPI v0.14.1] https://pypi.org/project/apideck-unify/0.14.1 - . \ No newline at end of file diff --git a/docs/models/ecommerceorderlineitem.md b/docs/models/ecommerceorderlineitem.md index cfcaa4ab..48719088 100644 --- a/docs/models/ecommerceorderlineitem.md +++ b/docs/models/ecommerceorderlineitem.md @@ -22,5 +22,5 @@ A single line item of an ecommerce order, representing a product or variant with | `refunded_amount` | *OptionalNullable[str]* | :heavy_minus_sign: | The amount of the line item that has been refunded. | 0 | | `refunded_quantity` | *OptionalNullable[str]* | :heavy_minus_sign: | The quantity of the line item that has been refunded. | 0 | | `sub_total` | *OptionalNullable[str]* | :heavy_minus_sign: | The sub total for the product(s) or variant associated with the line item, excluding taxes and discounts. | 43.18 | -| `total_amount` | *Nullable[str]* | :heavy_check_mark: | The total amount for the product(s) or variant associated with the line item, including taxes and discounts. | 43.18 | +| `total_amount` | *OptionalNullable[str]* | :heavy_minus_sign: | The total amount for the product(s) or variant associated with the line item, including taxes and discounts. | 43.18 | | `discounts` | List[[models.EcommerceDiscount](../models/ecommercediscount.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 274a4984..3a4957a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "apideck-unify" -version = "0.14.0" +version = "0.14.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" diff --git a/src/apideck_unify/_version.py b/src/apideck_unify/_version.py index 0972cf93..de11a348 100644 --- a/src/apideck_unify/_version.py +++ b/src/apideck_unify/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "apideck-unify" -__version__: str = "0.14.0" +__version__: str = "0.14.1" __openapi_doc_version__: str = "10.16.5" -__gen_version__: str = "2.597.9" -__user_agent__: str = "speakeasy-sdk/python 0.14.0 2.597.9 10.16.5 apideck-unify" +__gen_version__: str = "2.598.21" +__user_agent__: str = "speakeasy-sdk/python 0.14.1 2.598.21 10.16.5 apideck-unify" try: if __package__ is not None: diff --git a/src/apideck_unify/httpclient.py b/src/apideck_unify/httpclient.py index 1e426352..ad528d8d 100644 --- a/src/apideck_unify/httpclient.py +++ b/src/apideck_unify/httpclient.py @@ -2,7 +2,6 @@ # pyright: reportReturnType = false import asyncio -from concurrent.futures import ThreadPoolExecutor from typing_extensions import Protocol, runtime_checkable import httpx from typing import Any, Optional, Union @@ -116,21 +115,42 @@ def close_clients( pass if async_client is not None and not async_client_supplied: - is_async = False + # First, try the simplest approach - use asyncio.run() + # This works when we're not in an async context try: - asyncio.get_running_loop() - is_async = True - except RuntimeError: - pass - - try: - # If this function is called in an async loop then start another - # loop in a separate thread to close the async http client. - if is_async: - with ThreadPoolExecutor(max_workers=1) as executor: - future = executor.submit(asyncio.run, async_client.aclose()) - future.result() + asyncio.run(async_client.aclose()) + except RuntimeError as e: + # If we get "RuntimeError: This event loop is already running", + # it means we're in an async context + if "already running" in str(e): + try: + # We're in an async context, so get the running loop + loop = asyncio.get_running_loop() + # Create a task but don't wait for it + loop.create_task(async_client.aclose()) + except Exception: + # If we can't get the loop or create a task, just ignore + # The GC will eventually clean up the resources + pass + # If we get "RuntimeError: There is no current event loop in thread", + # we're not in an async context, but asyncio.run() failed for some reason + # In this case, we can try to create a new event loop explicitly + elif "no current event loop" in str(e): + try: + # Create a new event loop and run the coroutine + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + try: + loop.run_until_complete(async_client.aclose()) + finally: + loop.close() + asyncio.set_event_loop(None) + except Exception: + # If this also fails, just ignore + pass + # For any other RuntimeError, just ignore else: - asyncio.run(async_client.aclose()) + pass except Exception: + # For any other exception, just ignore pass diff --git a/src/apideck_unify/models/ecommerceorderlineitem.py b/src/apideck_unify/models/ecommerceorderlineitem.py index c7bf4f7c..cc575c0a 100644 --- a/src/apideck_unify/models/ecommerceorderlineitem.py +++ b/src/apideck_unify/models/ecommerceorderlineitem.py @@ -71,8 +71,6 @@ class EcommerceOrderLineItemTypedDict(TypedDict): r"""The name of the product or variant associated with the line item.""" quantity: Nullable[str] r"""The quantity of the product or variant associated with the line item.""" - total_amount: Nullable[str] - r"""The total amount for the product(s) or variant associated with the line item, including taxes and discounts.""" id: NotRequired[Nullable[str]] r"""A unique identifier for an object.""" product_id: NotRequired[Nullable[str]] @@ -98,6 +96,8 @@ class EcommerceOrderLineItemTypedDict(TypedDict): r"""The quantity of the line item that has been refunded.""" sub_total: NotRequired[Nullable[str]] r"""The sub total for the product(s) or variant associated with the line item, excluding taxes and discounts.""" + total_amount: NotRequired[Nullable[str]] + r"""The total amount for the product(s) or variant associated with the line item, including taxes and discounts.""" discounts: NotRequired[List[EcommerceDiscountTypedDict]] @@ -110,9 +110,6 @@ class EcommerceOrderLineItem(BaseModel): quantity: Nullable[str] r"""The quantity of the product or variant associated with the line item.""" - total_amount: Nullable[str] - r"""The total amount for the product(s) or variant associated with the line item, including taxes and discounts.""" - id: OptionalNullable[str] = UNSET r"""A unique identifier for an object.""" @@ -151,6 +148,9 @@ class EcommerceOrderLineItem(BaseModel): sub_total: OptionalNullable[str] = UNSET r"""The sub total for the product(s) or variant associated with the line item, excluding taxes and discounts.""" + total_amount: OptionalNullable[str] = UNSET + r"""The total amount for the product(s) or variant associated with the line item, including taxes and discounts.""" + discounts: Optional[List[EcommerceDiscount]] = None @model_serializer(mode="wrap") @@ -169,6 +169,7 @@ def serialize_model(self, handler): "refunded_amount", "refunded_quantity", "sub_total", + "total_amount", "discounts", ] nullable_fields = [ From e48e4672b4a227a82846edaa78cd6e56836107e9 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 13:11:44 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow