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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/__pycache__/
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/temp/
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
python:
version: 0.14.0
version: 0.14.1
additionalDependencies:
dev: {}
main: {}
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - .
- [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 - .
2 changes: 1 addition & 1 deletion docs/models/ecommerceorderlineitem.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/apideck_unify/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
50 changes: 35 additions & 15 deletions src/apideck_unify/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
11 changes: 6 additions & 5 deletions src/apideck_unify/models/ecommerceorderlineitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -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]]


Expand All @@ -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."""

Expand Down Expand Up @@ -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")
Expand All @@ -169,6 +169,7 @@ def serialize_model(self, handler):
"refunded_amount",
"refunded_quantity",
"sub_total",
"total_amount",
"discounts",
]
nullable_fields = [
Expand Down