+
+
+## Summary
+
+Bolt API Reference: Postman Collection:
+
+[](https://god.gw.postman.com/run-collection/9136127-55d2bde1-a248-473f-95b5-64cfd02fb445?action=collection%2Ffork&collection-url=entityId%3D9136127-55d2bde1-a248-473f-95b5-64cfd02fb445%26entityType%3Dcollection%26workspaceId%3D78beee89-4238-4c5f-bd1f-7e98978744b4#?env%5BBolt%20Sandbox%20Environment%5D=W3sia2V5IjoiYXBpX2Jhc2VfdXJsIiwidmFsdWUiOiJodHRwczovL2FwaS1zYW5kYm94LmJvbHQuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6InRrX2Jhc2UiLCJ2YWx1ZSI6Imh0dHBzOi8vc2FuZGJveC5ib2x0dGsuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImFwaV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggQVBJIGtleT4iLCJ0eXBlIjoic2VjcmV0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJwdWJsaXNoYWJsZV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggcHVibGlzaGFibGUga2V5PiIsInR5cGUiOiJkZWZhdWx0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJkaXZpc2lvbl9pZCIsInZhbHVlIjoiPHJlcGxhY2Ugd2l0aCB5b3VyIEJvbHQgU2FuZGJveCBwdWJsaWMgZGl2aXNpb24gSUQ+IiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfV0=)
+
+## About
+ A comprehensive Bolt API reference for interacting with Transactions, Orders, Product Catalog, Configuration, Testing, and much more.
+
+ Note: You must also reference the [Merchant Callback API](https://github.com/BoltApp/Bolt-Python-SDK/blob/master//api-merchant) when building a managed checkout custom cart integration
+
+
+
+## Table of Contents
+
+* [bolt-api-sdk](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#bolt-api-sdk)
+ * [About](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#about)
+ * [SDK Installation](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#sdk-installation)
+ * [IDE Support](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#ide-support)
+ * [SDK Example Usage](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#sdk-example-usage)
+ * [Authentication](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#authentication)
+ * [Available Resources and Operations](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#available-resources-and-operations)
+ * [Retries](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#retries)
+ * [Error Handling](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#error-handling)
+ * [Server Selection](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#server-selection)
+ * [Custom HTTP Client](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#custom-http-client)
+ * [Resource Management](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#resource-management)
+ * [Debugging](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#debugging)
+* [Development](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#development)
+ * [Maturity](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#maturity)
+ * [Contributions](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#contributions)
+
+
+
+
+## SDK Installation
+
+> [!NOTE]
+> **Python version upgrade policy**
+>
+> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
+
+The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
+
+### uv
+
+*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
+
+```bash
+uv add bolt-api-sdk
+```
+
+### PIP
+
+*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
+
+```bash
+pip install bolt-api-sdk
+```
+
+### Poetry
+
+*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
+
+```bash
+poetry add bolt-api-sdk
+```
+
+### Shell and script usage with `uv`
+
+You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
+
+```shell
+uvx --from bolt-api-sdk python
+```
+
+It's also possible to write a standalone Python script without needing to set up a whole project like so:
+
+```python
+#!/usr/bin/env -S uv run --script
+# /// script
+# requires-python = ">=3.10"
+# dependencies = [
+# "bolt-api-sdk",
+# ]
+# ///
+
+from bolt_api_sdk import Bolt
+
+sdk = Bolt(
+ # SDK arguments
+)
+
+# Rest of script here...
+```
+
+Once that is saved to a file, you can run it with `uv run script.py` where
+`script.py` can be replaced with the actual file name.
+
+
+
+## IDE Support
+
+### PyCharm
+
+Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
+
+- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
+
+
+
+## SDK Example Usage
+
+### Example
+
+```python
+# Synchronous Example
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt() as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+```
+
+
+
+The same SDK client can also be used to make asynchronous requests by importing asyncio.
+
+```python
+# Asynchronous Example
+import asyncio
+from bolt_api_sdk import Bolt, models
+import os
+
+async def main():
+
+ async with Bolt() as bolt:
+
+ res = await bolt.account.get_account_async(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+
+asyncio.run(main())
+```
+
+
+
+## Authentication
+
+### Per-Client Security Schemes
+
+This SDK supports the following security schemes globally:
+
+| Name | Type | Scheme | Environment Variable |
+| ----------- | ------ | ------------ | -------------------- |
+| `x_api_key` | apiKey | API key | `BOLT_X_API_KEY` |
+| `o_auth` | oauth2 | OAuth2 token | `BOLT_O_AUTH` |
+
+You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ security=models.Security(
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ),
+) as bolt:
+
+ res = bolt.account.create_account(create_account_input={
+ "addresses": [
+ {
+ "company": "Bolt",
+ "country": "United States",
+ "country_code": "US",
+ "door_code": "123456",
+ "email": "alan.watts@example.com",
+ "first_name": "Alan",
+ "last_name": "Watts",
+ "locality": "Brooklyn",
+ "name": "Alan Watts",
+ "phone": "+12125550199",
+ "postal_code": "10044",
+ "region": "NY",
+ "region_code": "NY",
+ "street_address1": "888 main street",
+ "street_address2": "apt 3021",
+ "street_address3": "c/o Alicia Watts",
+ "street_address4": "Bridge Street Apartment Building B",
+ "metadata": {},
+ },
+ ],
+ "payment_methods": [
+ {
+ "billing_address": {
+ "company": "Bolt",
+ "country": "United States",
+ "country_code": "US",
+ "default": True,
+ "door_code": "123456",
+ "email": "alan.watts@example.com",
+ "first_name": "Alan",
+ "last_name": "Watts",
+ "locality": "Brooklyn",
+ "name": "Alan Watts",
+ "phone": "+12125550199",
+ "postal_code": "10044",
+ "region": "NY",
+ "region_code": "NY",
+ "street_address1": "888 main street",
+ "street_address2": "apt 3021",
+ "street_address3": "c/o Alicia Watts",
+ "street_address4": "Bridge Street Apartment Building B",
+ },
+ "billing_address_id": None,
+ "bin": "411111",
+ "expiration": "2025-11",
+ "last4": "1234",
+ "metadata": {},
+ "postal_code": "10044",
+ "token": "a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0",
+ "token_type": models.PaymentMethodAccountTokenType.BOLT,
+ },
+ ],
+ "profile": {
+ "email": "alan.watts@example.com",
+ "first_name": "Alan",
+ "last_name": "Watts",
+ "metadata": {},
+ "phone": "+12125550199",
+ },
+ })
+
+ # Handle response
+ print(res)
+
+```
+
+### Per-Operation Security Schemes
+
+Some operations in this SDK require the security scheme to be specified at the request level. For example:
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt() as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+
+```
+
+
+
+## Available Resources and Operations
+
+
+Available methods
+
+### [Account](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md)
+
+* [get_account](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#get_account) - Get Account Details
+* [create_account](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#create_account) - Create Bolt Account
+* [update_account_profile](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#update_account_profile) - Update Profile
+* [add_address](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#add_address) - Add Address
+* [delete_address](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#delete_address) - Delete Address
+* [replace_address](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#replace_address) - Replace Address
+* [edit_address](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#edit_address) - Edit Address
+* [detect_account](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#detect_account) - Detect Account
+* [add_payment_method](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#add_payment_method) - Add Payment Method
+* [delete_payment_method](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/account/README.md#delete_payment_method) - Delete Payment Method
+
+### [Configuration](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/configuration/README.md)
+
+* [get_merchant_callbacks](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/configuration/README.md#get_merchant_callbacks) - Get Callback URLs
+* [set_merchant_callbacks](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/configuration/README.md#set_merchant_callbacks) - Set Callback URLs
+* [get_merchant_identifiers](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/configuration/README.md#get_merchant_identifiers) - Get Merchant Identifiers
+
+### [OAuth](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/oauth/README.md)
+
+* [o_auth_token](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/oauth/README.md#o_auth_token) - OAuth Token Endpoint
+
+### [Orders](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/orders/README.md)
+
+* [create_order_token](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/orders/README.md#create_order_token) - Create Order Token
+* [track_order](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/orders/README.md#track_order) - Send order tracking details
+
+### [Statements](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/statements/README.md)
+
+* [get_statements](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/statements/README.md#get_statements) - Fetch a Statement
+
+### [Testing](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/testing/README.md)
+
+* [test_shipping](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/testing/README.md#test_shipping) - Test Shipping
+* [create_testing_shopper_account](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/testing/README.md#create_testing_shopper_account) - Create Testing Shopper Account
+* [get_test_credit_card_token](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/testing/README.md#get_test_credit_card_token) - Fetch a Test Credit Card Token
+
+### [Transactions](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md)
+
+* [authorize_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#authorize_transaction) - Authorize a Card
+* [capture_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#capture_transaction) - Capture a Transaction
+* [refund_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#refund_transaction) - Refund a Transaction
+* [review_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#review_transaction) - Review Transaction
+* [void_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#void_transaction) - Void a Transaction
+* [get_transaction_details](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#get_transaction_details) - Transaction Details
+* [update_transaction](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/transactions/README.md#update_transaction) - Update a Transaction
+
+### [Webhooks](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/webhooks/README.md)
+
+* [query_webhooks](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/webhooks/README.md#query_webhooks) - Query Webhooks
+* [create_webhook](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/webhooks/README.md#create_webhook) - Create Bolt Webhook
+* [delete_webhook](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/webhooks/README.md#delete_webhook) - Delete a Bolt Webhook
+* [get_webhook](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/docs/sdks/webhooks/README.md#get_webhook) - Get Webhook
+
+
+
+
+
+## Retries
+
+Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
+
+To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
+```python
+from bolt_api_sdk import Bolt, models
+from bolt_api_sdk.utils import BackoffStrategy, RetryConfig
+import os
+
+
+with Bolt() as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ),
+ RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
+
+ # Handle response
+ print(res)
+
+```
+
+If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
+```python
+from bolt_api_sdk import Bolt, models
+from bolt_api_sdk.utils import BackoffStrategy, RetryConfig
+import os
+
+
+with Bolt(
+ retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
+) as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+
+```
+
+
+
+## Error Handling
+
+[`BoltError`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/bolterror.py) is the base class for all HTTP error responses. It has the following properties:
+
+| Property | Type | Description |
+| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
+| `err.message` | `str` | Error message |
+| `err.status_code` | `int` | HTTP response status code eg `404` |
+| `err.headers` | `httpx.Headers` | HTTP response headers |
+| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
+| `err.raw_response` | `httpx.Response` | Raw HTTP response |
+| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#error-classes). |
+
+### Example
+```python
+from bolt_api_sdk import Bolt, errors
+
+
+with Bolt() as bolt:
+ res = None
+ try:
+
+ res = bolt.account.detect_account(x_publishable_key="")
+
+ # Handle response
+ print(res)
+
+
+ except errors.BoltError as e:
+ # The base class for HTTP error responses
+ print(e.message)
+ print(e.status_code)
+ print(e.body)
+ print(e.headers)
+ print(e.raw_response)
+
+ # Depending on the method different errors may be thrown
+ if isinstance(e, errors.ErrorsBoltAPIResponse):
+ print(e.data.errors) # Optional[List[models.ErrorBoltAPI]]
+ print(e.data.result) # Optional[models.RequestResult]
+```
+
+### Error Classes
+**Primary error:**
+* [`BoltError`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/bolterror.py): The base class for HTTP error responses.
+
+Less common errors (8)
+
+
+
+**Network errors:**
+* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
+ * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
+ * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
+
+
+**Inherit from [`BoltError`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/bolterror.py)**:
+* [`ErrorsBoltAPIResponse`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/errorsboltapiresponse.py): Applicable to 19 of 31 methods.*
+* [`ErrorsOauthServerResponse`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/errorsoauthserverresponse.py): Invalid request to OAuth Token. Applicable to 1 of 31 methods.*
+* [`UnprocessableEntityError`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/unprocessableentityerror.py): Unprocessable Entity. Status code `422`. Applicable to 1 of 31 methods.*
+* [`ResponseValidationError`](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/./src/bolt_api_sdk/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
+
+
+
+\* Check [the method documentation](https://github.com/BoltApp/Bolt-Python-SDK/blob/master/#available-resources-and-operations) to see if the error is applicable.
+
+
+
+## Server Selection
+
+### Select Server by Index
+
+You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
+
+| # | Server | Description |
+| --- | ------------------------------ | ------------------------------- |
+| 0 | `https://api.bolt.com` | The Production URL (Live Data). |
+| 1 | `https://api-sandbox.bolt.com` | The Sandbox URL (Test Data). |
+| 2 | `https://api-staging.bolt.com` | The Staging URL (Staged Data). |
+
+#### Example
+
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ server_idx=0,
+) as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+
+```
+
+### Override Server URL Per-Client
+
+The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ server_url="https://api-staging.bolt.com",
+) as bolt:
+
+ res = bolt.account.get_account(security=models.GetAccountSecurity(
+ o_auth=os.getenv("BOLT_O_AUTH", ""),
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ))
+
+ # Handle response
+ print(res)
+
+```
+
+
+
+## Custom HTTP Client
+
+The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
+Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
+This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
+
+For example, you could specify a header for every request that this sdk makes as follows:
+```python
+from bolt_api_sdk import Bolt
+import httpx
+
+http_client = httpx.Client(headers={"x-custom-header": "someValue"})
+s = Bolt(client=http_client)
+```
+
+or you could wrap the client with your own custom logic:
+```python
+from bolt_api_sdk import Bolt
+from bolt_api_sdk.httpclient import AsyncHttpClient
+import httpx
+
+class CustomClient(AsyncHttpClient):
+ client: AsyncHttpClient
+
+ def __init__(self, client: AsyncHttpClient):
+ self.client = client
+
+ async def send(
+ self,
+ request: httpx.Request,
+ *,
+ stream: bool = False,
+ auth: Union[
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
+ ] = httpx.USE_CLIENT_DEFAULT,
+ follow_redirects: Union[
+ bool, httpx._client.UseClientDefault
+ ] = httpx.USE_CLIENT_DEFAULT,
+ ) -> httpx.Response:
+ request.headers["Client-Level-Header"] = "added by client"
+
+ return await self.client.send(
+ request, stream=stream, auth=auth, follow_redirects=follow_redirects
+ )
+
+ def build_request(
+ self,
+ method: str,
+ url: httpx._types.URLTypes,
+ *,
+ content: Optional[httpx._types.RequestContent] = None,
+ data: Optional[httpx._types.RequestData] = None,
+ files: Optional[httpx._types.RequestFiles] = None,
+ json: Optional[Any] = None,
+ params: Optional[httpx._types.QueryParamTypes] = None,
+ headers: Optional[httpx._types.HeaderTypes] = None,
+ cookies: Optional[httpx._types.CookieTypes] = None,
+ timeout: Union[
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
+ ] = httpx.USE_CLIENT_DEFAULT,
+ extensions: Optional[httpx._types.RequestExtensions] = None,
+ ) -> httpx.Request:
+ return self.client.build_request(
+ method,
+ url,
+ content=content,
+ data=data,
+ files=files,
+ json=json,
+ params=params,
+ headers=headers,
+ cookies=cookies,
+ timeout=timeout,
+ extensions=extensions,
+ )
+
+s = Bolt(async_client=CustomClient(httpx.AsyncClient()))
+```
+
+
+
+## Resource Management
+
+The `Bolt` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
+
+[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
+
+```python
+from bolt_api_sdk import Bolt
+def main():
+
+ with Bolt() as bolt:
+ # Rest of application here...
+
+
+# Or when using async:
+async def amain():
+
+ async with Bolt() as bolt:
+ # Rest of application here...
+```
+
+
+
+## Debugging
+
+You can setup your SDK to emit debug logs for SDK requests and responses.
+
+You can pass your own logger class directly into your SDK.
+```python
+from bolt_api_sdk import Bolt
+import logging
+
+logging.basicConfig(level=logging.DEBUG)
+s = Bolt(debug_logger=logging.getLogger("bolt_api_sdk"))
+```
+
+You can also enable a default debug logger by setting an environment variable `BOLT_DEBUG` to true.
+
+
+
+
+# Development
+
+## Maturity
+
+This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
+to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
+looking for the latest version.
+
+## Contributions
+
+While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
+We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
+
+### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=bolt-api-sdk&utm_campaign=python)
diff --git a/README.md b/README.md
index a9373f9..4a56c2e 100644
--- a/README.md
+++ b/README.md
@@ -91,7 +91,7 @@ It's also possible to write a standalone Python script without needing to set up
```python
#!/usr/bin/env -S uv run --script
# /// script
-# requires-python = ">=3.9"
+# requires-python = ">=3.10"
# dependencies = [
# "bolt-api-sdk",
# ]
@@ -288,7 +288,7 @@ with Bolt() as bolt:
Available methods
-### [account](docs/sdks/account/README.md)
+### [Account](docs/sdks/account/README.md)
* [get_account](docs/sdks/account/README.md#get_account) - Get Account Details
* [create_account](docs/sdks/account/README.md#create_account) - Create Bolt Account
@@ -301,33 +301,32 @@ with Bolt() as bolt:
* [add_payment_method](docs/sdks/account/README.md#add_payment_method) - Add Payment Method
* [delete_payment_method](docs/sdks/account/README.md#delete_payment_method) - Delete Payment Method
-
-### [configuration](docs/sdks/configuration/README.md)
+### [Configuration](docs/sdks/configuration/README.md)
* [get_merchant_callbacks](docs/sdks/configuration/README.md#get_merchant_callbacks) - Get Callback URLs
* [set_merchant_callbacks](docs/sdks/configuration/README.md#set_merchant_callbacks) - Set Callback URLs
* [get_merchant_identifiers](docs/sdks/configuration/README.md#get_merchant_identifiers) - Get Merchant Identifiers
-### [o_auth](docs/sdks/oauth/README.md)
+### [OAuth](docs/sdks/oauth/README.md)
* [o_auth_token](docs/sdks/oauth/README.md#o_auth_token) - OAuth Token Endpoint
-### [orders](docs/sdks/orders/README.md)
+### [Orders](docs/sdks/orders/README.md)
* [create_order_token](docs/sdks/orders/README.md#create_order_token) - Create Order Token
* [track_order](docs/sdks/orders/README.md#track_order) - Send order tracking details
-### [statements](docs/sdks/statements/README.md)
+### [Statements](docs/sdks/statements/README.md)
* [get_statements](docs/sdks/statements/README.md#get_statements) - Fetch a Statement
-### [testing](docs/sdks/testing/README.md)
+### [Testing](docs/sdks/testing/README.md)
* [test_shipping](docs/sdks/testing/README.md#test_shipping) - Test Shipping
* [create_testing_shopper_account](docs/sdks/testing/README.md#create_testing_shopper_account) - Create Testing Shopper Account
* [get_test_credit_card_token](docs/sdks/testing/README.md#get_test_credit_card_token) - Fetch a Test Credit Card Token
-### [transactions](docs/sdks/transactions/README.md)
+### [Transactions](docs/sdks/transactions/README.md)
* [authorize_transaction](docs/sdks/transactions/README.md#authorize_transaction) - Authorize a Card
* [capture_transaction](docs/sdks/transactions/README.md#capture_transaction) - Capture a Transaction
@@ -337,7 +336,7 @@ with Bolt() as bolt:
* [get_transaction_details](docs/sdks/transactions/README.md#get_transaction_details) - Transaction Details
* [update_transaction](docs/sdks/transactions/README.md#update_transaction) - Update a Transaction
-### [webhooks](docs/sdks/webhooks/README.md)
+### [Webhooks](docs/sdks/webhooks/README.md)
* [query_webhooks](docs/sdks/webhooks/README.md#query_webhooks) - Query Webhooks
* [create_webhook](docs/sdks/webhooks/README.md#create_webhook) - Create Bolt Webhook
@@ -483,7 +482,7 @@ import os
with Bolt(
- server_idx=2,
+ server_idx=0,
) as bolt:
res = bolt.account.get_account(security=models.GetAccountSecurity(
diff --git a/RELEASES.md b/RELEASES.md
new file mode 100644
index 0000000..2e90d13
--- /dev/null
+++ b/RELEASES.md
@@ -0,0 +1,11 @@
+
+
+## 2026-04-03 00:53:28
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.761.1 (2.879.6) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v0.6.0] .
+### Releases
+- [PyPI v0.6.0] https://pypi.org/project/bolt-api-sdk/0.6.0 - .
\ No newline at end of file
diff --git a/docs/models/accountdetailsaddressviewpriority.md b/docs/models/accountdetailsaddressviewpriority.md
index f9fa2a7..bb2837d 100644
--- a/docs/models/accountdetailsaddressviewpriority.md
+++ b/docs/models/accountdetailsaddressviewpriority.md
@@ -2,6 +2,14 @@
The shopper-indicated priority of this address compared to other addresses on their account.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AccountDetailsAddressViewPriority
+
+value = AccountDetailsAddressViewPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/accountidentifierstatus.md b/docs/models/accountidentifierstatus.md
index ce51582..cc3a569 100644
--- a/docs/models/accountidentifierstatus.md
+++ b/docs/models/accountidentifierstatus.md
@@ -2,6 +2,14 @@
The status of the shopper account identifier (email or phone). If the account does not have this identifier, the status is "missing"; If the identifier has been used to receive an OTP code, the status is "verified"; If the identifier has not been used to receive an OTP code, the status is "unverified".
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AccountIdentifierStatus
+
+value = AccountIdentifierStatus.MISSING
+```
+
## Values
diff --git a/docs/models/action.md b/docs/models/action.md
index 36259c2..9080f68 100644
--- a/docs/models/action.md
+++ b/docs/models/action.md
@@ -1,5 +1,13 @@
# Action
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Action
+
+value = Action.SET_PASSWORD
+```
+
## Values
diff --git a/docs/models/addaddresspriority.md b/docs/models/addaddresspriority.md
index 14a1a2f..e7b0e87 100644
--- a/docs/models/addaddresspriority.md
+++ b/docs/models/addaddresspriority.md
@@ -2,6 +2,14 @@
The shopper-indicated priority of this address compared to other addresses on their account.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AddAddressPriority
+
+value = AddAddressPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/addpaymentmethodnetwork.md b/docs/models/addpaymentmethodnetwork.md
index 34bdb1a..0967b95 100644
--- a/docs/models/addpaymentmethodnetwork.md
+++ b/docs/models/addpaymentmethodnetwork.md
@@ -1,5 +1,13 @@
# AddPaymentMethodNetwork
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AddPaymentMethodNetwork
+
+value = AddPaymentMethodNetwork.VISA
+```
+
## Values
diff --git a/docs/models/addpaymentmethodpriority.md b/docs/models/addpaymentmethodpriority.md
index 395c388..afc15d8 100644
--- a/docs/models/addpaymentmethodpriority.md
+++ b/docs/models/addpaymentmethodpriority.md
@@ -3,6 +3,14 @@
Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AddPaymentMethodPriority
+
+value = AddPaymentMethodPriority.ONE
+```
+
## Values
diff --git a/docs/models/addpaymentmethodtokentype.md b/docs/models/addpaymentmethodtokentype.md
index 98472c2..735e2a2 100644
--- a/docs/models/addpaymentmethodtokentype.md
+++ b/docs/models/addpaymentmethodtokentype.md
@@ -3,6 +3,14 @@
Used to define which payment processor generated the token for this credit card. For those using Bolt's tokenizer, the value must be `bolt`.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AddPaymentMethodTokenType
+
+value = AddPaymentMethodTokenType.VANTIV
+```
+
## Values
diff --git a/docs/models/addressviewpriority.md b/docs/models/addressviewpriority.md
index e44be85..5340405 100644
--- a/docs/models/addressviewpriority.md
+++ b/docs/models/addressviewpriority.md
@@ -2,6 +2,14 @@
The shopper-indicated priority of this address compared to other addresses on their account.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AddressViewPriority
+
+value = AddressViewPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/authorizationverificationstatus.md b/docs/models/authorizationverificationstatus.md
index ba041a1..6f063f4 100644
--- a/docs/models/authorizationverificationstatus.md
+++ b/docs/models/authorizationverificationstatus.md
@@ -2,6 +2,14 @@
Used to track the status of micro-authorizations. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AuthorizationVerificationStatus
+
+value = AuthorizationVerificationStatus.NEW
+```
+
## Values
diff --git a/docs/models/authverificationstatus.md b/docs/models/authverificationstatus.md
index c122035..4216a66 100644
--- a/docs/models/authverificationstatus.md
+++ b/docs/models/authverificationstatus.md
@@ -1,5 +1,13 @@
# AuthVerificationStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AuthVerificationStatus
+
+value = AuthVerificationStatus.UNKNOWN
+```
+
## Values
diff --git a/docs/models/avsresponse.md b/docs/models/avsresponse.md
index cb5f8a2..ac774ba 100644
--- a/docs/models/avsresponse.md
+++ b/docs/models/avsresponse.md
@@ -1,5 +1,13 @@
# AvsResponse
+## Example Usage
+
+```python
+from bolt_api_sdk.models import AvsResponse
+
+value = AvsResponse.ZERO
+```
+
## Values
diff --git a/docs/models/capturestatus.md b/docs/models/capturestatus.md
index 61868eb..c019d88 100644
--- a/docs/models/capturestatus.md
+++ b/docs/models/capturestatus.md
@@ -2,6 +2,14 @@
The status of the capture. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CaptureStatus
+
+value = CaptureStatus.SUCCEEDED
+```
+
## Values
diff --git a/docs/models/captureviewtype.md b/docs/models/captureviewtype.md
index 2770f11..07728af 100644
--- a/docs/models/captureviewtype.md
+++ b/docs/models/captureviewtype.md
@@ -3,6 +3,14 @@
Fee type options. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CaptureViewType
+
+value = CaptureViewType.NET
+```
+
## Values
diff --git a/docs/models/carddisplaynetwork.md b/docs/models/carddisplaynetwork.md
index 0bc31e2..563bc50 100644
--- a/docs/models/carddisplaynetwork.md
+++ b/docs/models/carddisplaynetwork.md
@@ -2,6 +2,14 @@
The card's network. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CardDisplayNetwork
+
+value = CardDisplayNetwork.CREDIT_CARD
+```
+
## Values
diff --git a/docs/models/cardnetwork.md b/docs/models/cardnetwork.md
index 595c192..378a371 100644
--- a/docs/models/cardnetwork.md
+++ b/docs/models/cardnetwork.md
@@ -3,6 +3,14 @@
The card's network code. **Nullable** for Transactions Details. Note: LEGACY diners_club_us_ca now tagged as mastercard
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CardNetwork
+
+value = CardNetwork.VISA
+```
+
## Values
diff --git a/docs/models/cardstatus.md b/docs/models/cardstatus.md
index 5a94d05..01dcb2a 100644
--- a/docs/models/cardstatus.md
+++ b/docs/models/cardstatus.md
@@ -2,6 +2,14 @@
The card's status. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CardStatus
+
+value = CardStatus.ACTIVE
+```
+
## Values
diff --git a/docs/models/cardtokentype.md b/docs/models/cardtokentype.md
index 15ab4ea..9775e80 100644
--- a/docs/models/cardtokentype.md
+++ b/docs/models/cardtokentype.md
@@ -3,6 +3,14 @@
Used to define which payment processor generated the token for this credit card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CardTokenType
+
+value = CardTokenType.VANTIV
+```
+
## Values
diff --git a/docs/models/cartdiscountdiscountcategory.md b/docs/models/cartdiscountdiscountcategory.md
index 66471c3..dc14001 100644
--- a/docs/models/cartdiscountdiscountcategory.md
+++ b/docs/models/cartdiscountdiscountcategory.md
@@ -1,5 +1,13 @@
# CartDiscountDiscountCategory
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CartDiscountDiscountCategory
+
+value = CartDiscountDiscountCategory.COUPON
+```
+
## Values
@@ -14,4 +22,5 @@
| `MEMBERSHIP_GIFTCARD` | membership_giftcard |
| `SUBSCRIPTION_DISCOUNT` | subscription_discount |
| `REWARDS_DISCOUNT` | rewards_discount |
+| `SHIPPING_DISCOUNT` | shipping_discount |
| `UNKNOWN` | unknown |
\ No newline at end of file
diff --git a/docs/models/cartdiscounttype.md b/docs/models/cartdiscounttype.md
index fb70306..30ee7ba 100644
--- a/docs/models/cartdiscounttype.md
+++ b/docs/models/cartdiscounttype.md
@@ -2,6 +2,14 @@
The type of discount.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CartDiscountType
+
+value = CartDiscountType.FIXED_AMOUNT
+```
+
## Values
diff --git a/docs/models/cartitemshipmenttype.md b/docs/models/cartitemshipmenttype.md
index 2f77968..9a515e2 100644
--- a/docs/models/cartitemshipmenttype.md
+++ b/docs/models/cartitemshipmenttype.md
@@ -1,5 +1,13 @@
# CartItemShipmentType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CartItemShipmentType
+
+value = CartItemShipmentType.UNKNOWN
+```
+
## Values
diff --git a/docs/models/cartitemtype.md b/docs/models/cartitemtype.md
index 7158ee0..9dc2c1d 100644
--- a/docs/models/cartitemtype.md
+++ b/docs/models/cartitemtype.md
@@ -1,5 +1,13 @@
# CartItemType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CartItemType
+
+value = CartItemType.UNKNOWN
+```
+
## Values
diff --git a/docs/models/cartshipmenttype.md b/docs/models/cartshipmenttype.md
index d05351a..9ad99aa 100644
--- a/docs/models/cartshipmenttype.md
+++ b/docs/models/cartshipmenttype.md
@@ -2,6 +2,14 @@
The type corresponding to this shipment, if applicable.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CartShipmentType
+
+value = CartShipmentType.DOOR_DELIVERY
+```
+
## Values
diff --git a/docs/models/channel.md b/docs/models/channel.md
index c0095fa..bd89a64 100644
--- a/docs/models/channel.md
+++ b/docs/models/channel.md
@@ -2,6 +2,14 @@
Used to determine the channel from which the order was created.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Channel
+
+value = Channel.BROWSER
+```
+
## Values
diff --git a/docs/models/chargebackreasoncode.md b/docs/models/chargebackreasoncode.md
index 5ecad8e..be1602d 100644
--- a/docs/models/chargebackreasoncode.md
+++ b/docs/models/chargebackreasoncode.md
@@ -2,6 +2,14 @@
Bolt's [standardized reason codes](https://help.bolt.com/merchants/references/policies/disputes/dispute-codes/).
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ChargebackReasonCode
+
+value = ChargebackReasonCode.AUTHORIZATION_FAILED
+```
+
## Values
diff --git a/docs/models/chargebackrepresentmentresult.md b/docs/models/chargebackrepresentmentresult.md
index d22b1be..f814831 100644
--- a/docs/models/chargebackrepresentmentresult.md
+++ b/docs/models/chargebackrepresentmentresult.md
@@ -2,6 +2,14 @@
The result of the chargeback representment.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ChargebackRepresentmentResult
+
+value = ChargebackRepresentmentResult.NONE
+```
+
## Values
diff --git a/docs/models/checkoutsetup.md b/docs/models/checkoutsetup.md
index bac0d49..f7c03c8 100644
--- a/docs/models/checkoutsetup.md
+++ b/docs/models/checkoutsetup.md
@@ -1,5 +1,13 @@
# CheckoutSetup
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CheckoutSetup
+
+value = CheckoutSetup.SHIPPING_STEP
+```
+
## Values
diff --git a/docs/models/consumermembershipstatus.md b/docs/models/consumermembershipstatus.md
index 415fc7b..3f3fd3e 100644
--- a/docs/models/consumermembershipstatus.md
+++ b/docs/models/consumermembershipstatus.md
@@ -2,6 +2,14 @@
True if user has an AllPass membership associated to their Bolt Account. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ConsumerMembershipStatus
+
+value = ConsumerMembershipStatus.ACTIVE
+```
+
## Values
diff --git a/docs/models/creditcard.md b/docs/models/creditcard.md
index b7bd7fd..9c14c6a 100644
--- a/docs/models/creditcard.md
+++ b/docs/models/creditcard.md
@@ -15,4 +15,5 @@ The credit_card object is used to to pay for guest-checkout transactions or save
| `priority` | [Optional[models.CreditCardPriority]](../models/creditcardpriority.md) | :heavy_minus_sign: | Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card. | |
| `save` | *Optional[bool]* | :heavy_minus_sign: | Determines whether or not the credit card will be saved to the shopper's account. Defaults to `true`. | |
| `token` | *str* | :heavy_check_mark: | The Bolt token associated to the credit card. | a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0 |
-| `token_type` | [models.CreditCardTokenType](../models/creditcardtokentype.md) | :heavy_check_mark: | Used to define which payment processor generated the token for this credit card; for those using Bolt's tokenizer, the value must be `bolt`. | bolt |
\ No newline at end of file
+| `token_type` | [models.CreditCardTokenType](../models/creditcardtokentype.md) | :heavy_check_mark: | Used to define which payment processor generated the token for this credit card; for those using Bolt's tokenizer, the value must be `bolt`. | bolt |
+| `affirm_vcn_token` | *OptionalNullable[str]* | :heavy_minus_sign: | The checkout token associated with Affirm VCN credit cards. | a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0 |
\ No newline at end of file
diff --git a/docs/models/creditcardauthorizationreason.md b/docs/models/creditcardauthorizationreason.md
index a9197da..179ea4e 100644
--- a/docs/models/creditcardauthorizationreason.md
+++ b/docs/models/creditcardauthorizationreason.md
@@ -13,6 +13,14 @@ The reason code explaining the authorization status.
* `10` - unsupported_payment_method
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardAuthorizationReason
+
+value = CreditCardAuthorizationReason.NONE
+```
+
## Values
diff --git a/docs/models/creditcardauthorizationstatus.md b/docs/models/creditcardauthorizationstatus.md
index 595a9fa..8666e32 100644
--- a/docs/models/creditcardauthorizationstatus.md
+++ b/docs/models/creditcardauthorizationstatus.md
@@ -6,6 +6,14 @@ The status of the authorization request.
* `3` - error
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardAuthorizationStatus
+
+value = CreditCardAuthorizationStatus.SUCCEEDED
+```
+
## Values
diff --git a/docs/models/creditcardcreditviewstatus.md b/docs/models/creditcardcreditviewstatus.md
index 218cede..50eebba 100644
--- a/docs/models/creditcardcreditviewstatus.md
+++ b/docs/models/creditcardcreditviewstatus.md
@@ -2,6 +2,14 @@
The status of the refund to a card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardCreditViewStatus
+
+value = CreditCardCreditViewStatus.SUCCEEDED
+```
+
## Values
diff --git a/docs/models/creditcardpriority.md b/docs/models/creditcardpriority.md
index a80089c..de65de5 100644
--- a/docs/models/creditcardpriority.md
+++ b/docs/models/creditcardpriority.md
@@ -2,6 +2,14 @@
Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardPriority
+
+value = CreditCardPriority.ONE
+```
+
## Values
diff --git a/docs/models/creditcardtokentype.md b/docs/models/creditcardtokentype.md
index 724edb5..8ccda32 100644
--- a/docs/models/creditcardtokentype.md
+++ b/docs/models/creditcardtokentype.md
@@ -2,6 +2,14 @@
Used to define which payment processor generated the token for this credit card; for those using Bolt's tokenizer, the value must be `bolt`.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardTokenType
+
+value = CreditCardTokenType.BOLT
+```
+
## Values
diff --git a/docs/models/creditcardvoidcause.md b/docs/models/creditcardvoidcause.md
index 93feec7..9c0dcbc 100644
--- a/docs/models/creditcardvoidcause.md
+++ b/docs/models/creditcardvoidcause.md
@@ -2,6 +2,14 @@
Specifies why this particular transaction is voided.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardVoidCause
+
+value = CreditCardVoidCause.MERCHANT_ACTION
+```
+
## Values
diff --git a/docs/models/creditcardvoidstatus.md b/docs/models/creditcardvoidstatus.md
index 684131f..5d77e85 100644
--- a/docs/models/creditcardvoidstatus.md
+++ b/docs/models/creditcardvoidstatus.md
@@ -2,6 +2,14 @@
The status of the void request.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CreditCardVoidStatus
+
+value = CreditCardVoidStatus.SUCCEEDED
+```
+
## Values
diff --git a/docs/models/customfieldscontext.md b/docs/models/customfieldscontext.md
index a0ede30..731fd1a 100644
--- a/docs/models/customfieldscontext.md
+++ b/docs/models/customfieldscontext.md
@@ -2,6 +2,14 @@
The app context of where the custom field is used.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CustomFieldsContext
+
+value = CustomFieldsContext.CHECKOUT
+```
+
## Values
diff --git a/docs/models/customfieldviewcheckoutstep.md b/docs/models/customfieldviewcheckoutstep.md
index 8d9113e..3255af7 100644
--- a/docs/models/customfieldviewcheckoutstep.md
+++ b/docs/models/customfieldviewcheckoutstep.md
@@ -1,5 +1,13 @@
# CustomFieldViewCheckoutStep
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CustomFieldViewCheckoutStep
+
+value = CustomFieldViewCheckoutStep.SHIPPING_STEP
+```
+
## Values
diff --git a/docs/models/customfieldviewcontext.md b/docs/models/customfieldviewcontext.md
index 68830d4..53f5368 100644
--- a/docs/models/customfieldviewcontext.md
+++ b/docs/models/customfieldviewcontext.md
@@ -1,5 +1,13 @@
# CustomFieldViewContext
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CustomFieldViewContext
+
+value = CustomFieldViewContext.CHECKOUT
+```
+
## Values
diff --git a/docs/models/cvvresponse.md b/docs/models/cvvresponse.md
index 32e852e..c4613c9 100644
--- a/docs/models/cvvresponse.md
+++ b/docs/models/cvvresponse.md
@@ -1,5 +1,13 @@
# CvvResponse
+## Example Usage
+
+```python
+from bolt_api_sdk.models import CvvResponse
+
+value = CvvResponse.M
+```
+
## Values
diff --git a/docs/models/decision.md b/docs/models/decision.md
index 84b6e33..565e15f 100644
--- a/docs/models/decision.md
+++ b/docs/models/decision.md
@@ -1,5 +1,13 @@
# Decision
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Decision
+
+value = Decision.APPROVE
+```
+
## Values
diff --git a/docs/models/editaddresspriority.md b/docs/models/editaddresspriority.md
index 2015589..163c3a9 100644
--- a/docs/models/editaddresspriority.md
+++ b/docs/models/editaddresspriority.md
@@ -2,6 +2,14 @@
The shopper-indicated priority of this address compared to other addresses on their account.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import EditAddressPriority
+
+value = EditAddressPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/emailpriority.md b/docs/models/emailpriority.md
index d7775b8..93aa7c6 100644
--- a/docs/models/emailpriority.md
+++ b/docs/models/emailpriority.md
@@ -2,6 +2,14 @@
This is the priority of the contact method. This field's contents are not displayed in the transaction details view.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import EmailPriority
+
+value = EmailPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/emailstatus.md b/docs/models/emailstatus.md
index 47163a4..df82bcc 100644
--- a/docs/models/emailstatus.md
+++ b/docs/models/emailstatus.md
@@ -2,6 +2,14 @@
This is the status of the contact method.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import EmailStatus
+
+value = EmailStatus.ACTIVE
+```
+
## Values
diff --git a/docs/models/fulfillmenttype.md b/docs/models/fulfillmenttype.md
index 54931f6..9542cb4 100644
--- a/docs/models/fulfillmenttype.md
+++ b/docs/models/fulfillmenttype.md
@@ -1,5 +1,13 @@
# FulfillmentType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import FulfillmentType
+
+value = FulfillmentType.PHYSICAL_DOOR_DELIVERY
+```
+
## Values
diff --git a/docs/models/hideapm.md b/docs/models/hideapm.md
index aff18e9..a0be8d9 100644
--- a/docs/models/hideapm.md
+++ b/docs/models/hideapm.md
@@ -1,5 +1,13 @@
# HideApm
+## Example Usage
+
+```python
+from bolt_api_sdk.models import HideApm
+
+value = HideApm.PAYPAL
+```
+
## Values
diff --git a/docs/models/hooktype.md b/docs/models/hooktype.md
index 148d8d5..236e2d5 100644
--- a/docs/models/hooktype.md
+++ b/docs/models/hooktype.md
@@ -1,5 +1,13 @@
# HookType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import HookType
+
+value = HookType.ONE
+```
+
## Values
diff --git a/docs/models/icartdiscountviewdiscountcategory.md b/docs/models/icartdiscountviewdiscountcategory.md
index 3121156..13487c8 100644
--- a/docs/models/icartdiscountviewdiscountcategory.md
+++ b/docs/models/icartdiscountviewdiscountcategory.md
@@ -1,5 +1,13 @@
# ICartDiscountViewDiscountCategory
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ICartDiscountViewDiscountCategory
+
+value = ICartDiscountViewDiscountCategory.COUPON
+```
+
## Values
@@ -14,4 +22,5 @@
| `MEMBERSHIP_GIFTCARD` | membership_giftcard |
| `SUBSCRIPTION_DISCOUNT` | subscription_discount |
| `REWARDS_DISCOUNT` | rewards_discount |
+| `SHIPPING_DISCOUNT` | shipping_discount |
| `UNKNOWN` | unknown |
\ No newline at end of file
diff --git a/docs/models/icartitemviewshipmenttype.md b/docs/models/icartitemviewshipmenttype.md
index a8412f8..765ec60 100644
--- a/docs/models/icartitemviewshipmenttype.md
+++ b/docs/models/icartitemviewshipmenttype.md
@@ -1,5 +1,13 @@
# ICartItemViewShipmentType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ICartItemViewShipmentType
+
+value = ICartItemViewShipmentType.UNKNOWN
+```
+
## Values
diff --git a/docs/models/icartitemviewtype.md b/docs/models/icartitemviewtype.md
index 3a22f89..344f401 100644
--- a/docs/models/icartitemviewtype.md
+++ b/docs/models/icartitemviewtype.md
@@ -1,5 +1,13 @@
# ICartItemViewType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ICartItemViewType
+
+value = ICartItemViewType.UNKNOWN
+```
+
## Values
diff --git a/docs/models/icustomfieldviewcheckoutstep.md b/docs/models/icustomfieldviewcheckoutstep.md
index bb269fe..3f0f47b 100644
--- a/docs/models/icustomfieldviewcheckoutstep.md
+++ b/docs/models/icustomfieldviewcheckoutstep.md
@@ -1,5 +1,13 @@
# ICustomFieldViewCheckoutStep
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ICustomFieldViewCheckoutStep
+
+value = ICustomFieldViewCheckoutStep.SHIPPING_STEP
+```
+
## Values
diff --git a/docs/models/icustomfieldviewcontext.md b/docs/models/icustomfieldviewcontext.md
index f127654..1d343af 100644
--- a/docs/models/icustomfieldviewcontext.md
+++ b/docs/models/icustomfieldviewcontext.md
@@ -1,5 +1,13 @@
# ICustomFieldViewContext
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ICustomFieldViewContext
+
+value = ICustomFieldViewContext.CHECKOUT
+```
+
## Values
diff --git a/docs/models/instorecartshipmentdistanceunit.md b/docs/models/instorecartshipmentdistanceunit.md
index 365f4fd..70b5164 100644
--- a/docs/models/instorecartshipmentdistanceunit.md
+++ b/docs/models/instorecartshipmentdistanceunit.md
@@ -1,5 +1,13 @@
# InStoreCartShipmentDistanceUnit
+## Example Usage
+
+```python
+from bolt_api_sdk.models import InStoreCartShipmentDistanceUnit
+
+value = InStoreCartShipmentDistanceUnit.KM
+```
+
## Values
diff --git a/docs/models/instoreshipment2distanceunit.md b/docs/models/instoreshipment2distanceunit.md
index 7c3dd13..00ec922 100644
--- a/docs/models/instoreshipment2distanceunit.md
+++ b/docs/models/instoreshipment2distanceunit.md
@@ -1,5 +1,13 @@
# InStoreShipment2DistanceUnit
+## Example Usage
+
+```python
+from bolt_api_sdk.models import InStoreShipment2DistanceUnit
+
+value = InStoreShipment2DistanceUnit.MILE
+```
+
## Values
diff --git a/docs/models/itemshipmenttype.md b/docs/models/itemshipmenttype.md
index 4702c9b..028d1b0 100644
--- a/docs/models/itemshipmenttype.md
+++ b/docs/models/itemshipmenttype.md
@@ -2,6 +2,14 @@
The shipment type selected by the shopper.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ItemShipmentType
+
+value = ItemShipmentType.UNKNOWN
+```
+
## Values
diff --git a/docs/models/manualdisputesstatus.md b/docs/models/manualdisputesstatus.md
index 1ed8a3c..09213e3 100644
--- a/docs/models/manualdisputesstatus.md
+++ b/docs/models/manualdisputesstatus.md
@@ -1,5 +1,13 @@
# ManualDisputesStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ManualDisputesStatus
+
+value = ManualDisputesStatus.PENDING
+```
+
## Values
diff --git a/docs/models/manualdisputeviewstatus.md b/docs/models/manualdisputeviewstatus.md
index e31ef0f..dee499f 100644
--- a/docs/models/manualdisputeviewstatus.md
+++ b/docs/models/manualdisputeviewstatus.md
@@ -1,5 +1,13 @@
# ManualDisputeViewStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ManualDisputeViewStatus
+
+value = ManualDisputeViewStatus.PENDING
+```
+
## Values
diff --git a/docs/models/merchantcallbackurltype.md b/docs/models/merchantcallbackurltype.md
index f4ce37e..fd37436 100644
--- a/docs/models/merchantcallbackurltype.md
+++ b/docs/models/merchantcallbackurltype.md
@@ -2,6 +2,14 @@
Bolt merchant division callback URL type
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantCallbackURLType
+
+value = MerchantCallbackURLType.OAUTH_REDIRECT
+```
+
## Values
diff --git a/docs/models/merchantcreditcardauthorizationprocessinginitiator.md b/docs/models/merchantcreditcardauthorizationprocessinginitiator.md
index b73a035..e2a7dc1 100644
--- a/docs/models/merchantcreditcardauthorizationprocessinginitiator.md
+++ b/docs/models/merchantcreditcardauthorizationprocessinginitiator.md
@@ -11,6 +11,14 @@ Determines who initiated the transaction (e.g. shopper, merchant) and how they d
* `recurring` - Any time a card is used to pay for a recurring charge (for example, a subscription). Only use this value when you don’t know if it’s the first recurring charge.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantCreditCardAuthorizationProcessingInitiator
+
+value = MerchantCreditCardAuthorizationProcessingInitiator.INITIAL_CARD_ON_FILE
+```
+
## Values
diff --git a/docs/models/merchantcreditcardauthorizationrechargesource.md b/docs/models/merchantcreditcardauthorizationrechargesource.md
index 011d1d5..a7b9d3d 100644
--- a/docs/models/merchantcreditcardauthorizationrechargesource.md
+++ b/docs/models/merchantcreditcardauthorizationrechargesource.md
@@ -1,5 +1,13 @@
# MerchantCreditCardAuthorizationRechargeSource
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantCreditCardAuthorizationRechargeSource
+
+value = MerchantCreditCardAuthorizationRechargeSource.DIRECT_PAYMENTS
+```
+
## Values
diff --git a/docs/models/merchantcreditcardauthorizationsource.md b/docs/models/merchantcreditcardauthorizationsource.md
index a82e4c8..cf10c13 100644
--- a/docs/models/merchantcreditcardauthorizationsource.md
+++ b/docs/models/merchantcreditcardauthorizationsource.md
@@ -1,5 +1,13 @@
# MerchantCreditCardAuthorizationSource
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantCreditCardAuthorizationSource
+
+value = MerchantCreditCardAuthorizationSource.DIRECT_PAYMENTS
+```
+
## Values
diff --git a/docs/models/merchantonboardingstatuscode.md b/docs/models/merchantonboardingstatuscode.md
index 4299a79..7806031 100644
--- a/docs/models/merchantonboardingstatuscode.md
+++ b/docs/models/merchantonboardingstatuscode.md
@@ -1,5 +1,13 @@
# MerchantOnboardingStatusCode
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantOnboardingStatusCode
+
+value = MerchantOnboardingStatusCode.NEW_MERCHANT
+```
+
## Values
diff --git a/docs/models/merchantplatform.md b/docs/models/merchantplatform.md
index 55553c0..539809b 100644
--- a/docs/models/merchantplatform.md
+++ b/docs/models/merchantplatform.md
@@ -2,6 +2,14 @@
The type of platform being used for this merchant division.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantPlatform
+
+value = MerchantPlatform.NONE
+```
+
## Values
diff --git a/docs/models/merchantstatus.md b/docs/models/merchantstatus.md
index d75307a..c9dc4fa 100644
--- a/docs/models/merchantstatus.md
+++ b/docs/models/merchantstatus.md
@@ -6,6 +6,14 @@ The merchant's status:
* `3` - Offboarding
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MerchantStatus
+
+value = MerchantStatus.ONE
+```
+
## Values
diff --git a/docs/models/method.md b/docs/models/method.md
index feec76e..d86c3de 100644
--- a/docs/models/method.md
+++ b/docs/models/method.md
@@ -1,5 +1,13 @@
# Method
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Method
+
+value = Method.CODE
+```
+
## Values
diff --git a/docs/models/mocktrackinginputstatus.md b/docs/models/mocktrackinginputstatus.md
index 71e7993..d92b5b6 100644
--- a/docs/models/mocktrackinginputstatus.md
+++ b/docs/models/mocktrackinginputstatus.md
@@ -2,6 +2,14 @@
The shipment status of a simulated order.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import MockTrackingInputStatus
+
+value = MockTrackingInputStatus.IN_TRANSIT
+```
+
## Values
diff --git a/docs/models/network.md b/docs/models/network.md
index fc776ce..74fb045 100644
--- a/docs/models/network.md
+++ b/docs/models/network.md
@@ -1,5 +1,13 @@
# Network
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Network
+
+value = Network.VISA
+```
+
## Values
diff --git a/docs/models/oauthtokeninputgranttype.md b/docs/models/oauthtokeninputgranttype.md
index 0663952..b68e316 100644
--- a/docs/models/oauthtokeninputgranttype.md
+++ b/docs/models/oauthtokeninputgranttype.md
@@ -5,6 +5,14 @@ The type of OAuth 2.0 grant being utilized.
The value will always be `authorization_code` when exchanging an authorization code for an access token.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import OAuthTokenInputGrantType
+
+value = OAuthTokenInputGrantType.AUTHORIZATION_CODE
+```
+
## Values
diff --git a/docs/models/oauthtokeninputrefreshgranttype.md b/docs/models/oauthtokeninputrefreshgranttype.md
index 8f106e5..6af28fe 100644
--- a/docs/models/oauthtokeninputrefreshgranttype.md
+++ b/docs/models/oauthtokeninputrefreshgranttype.md
@@ -5,6 +5,14 @@ The type of OAuth 2.0 grant being utilized.
The value will always be `refresh_token` when exchanging a refresh token for an access token.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import OAuthTokenInputRefreshGrantType
+
+value = OAuthTokenInputRefreshGrantType.REFRESH_TOKEN
+```
+
## Values
diff --git a/docs/models/paymentmethodaccountpriority.md b/docs/models/paymentmethodaccountpriority.md
index 4c47457..77c843c 100644
--- a/docs/models/paymentmethodaccountpriority.md
+++ b/docs/models/paymentmethodaccountpriority.md
@@ -3,6 +3,14 @@
Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PaymentMethodAccountPriority
+
+value = PaymentMethodAccountPriority.ONE
+```
+
## Values
diff --git a/docs/models/paymentmethodaccounttokentype.md b/docs/models/paymentmethodaccounttokentype.md
index e1f7e4f..2e51f0f 100644
--- a/docs/models/paymentmethodaccounttokentype.md
+++ b/docs/models/paymentmethodaccounttokentype.md
@@ -3,6 +3,14 @@
Used to define which payment processor generated the token for this credit card. For those using Bolt's tokenizer, the value must be `bolt`.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PaymentMethodAccountTokenType
+
+value = PaymentMethodAccountTokenType.VANTIV
+```
+
## Values
diff --git a/docs/models/paymentservice.md b/docs/models/paymentservice.md
index 40a4998..2109b41 100644
--- a/docs/models/paymentservice.md
+++ b/docs/models/paymentservice.md
@@ -1,5 +1,13 @@
# PaymentService
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PaymentService
+
+value = PaymentService.AFFIRM
+```
+
## Values
diff --git a/docs/models/phonepriority.md b/docs/models/phonepriority.md
index c0267a6..35c98ba 100644
--- a/docs/models/phonepriority.md
+++ b/docs/models/phonepriority.md
@@ -2,6 +2,14 @@
This is the priority of the contact method. This field's contents are not displayed in the transaction details view.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PhonePriority
+
+value = PhonePriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/phonestatus.md b/docs/models/phonestatus.md
index cf3aa27..eaebfcc 100644
--- a/docs/models/phonestatus.md
+++ b/docs/models/phonestatus.md
@@ -2,6 +2,14 @@
This is the status of the contact method.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PhoneStatus
+
+value = PhoneStatus.ACTIVE
+```
+
## Values
diff --git a/docs/models/phoneviewpriority.md b/docs/models/phoneviewpriority.md
index 28db2c1..998afd5 100644
--- a/docs/models/phoneviewpriority.md
+++ b/docs/models/phoneviewpriority.md
@@ -1,5 +1,13 @@
# PhoneViewPriority
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PhoneViewPriority
+
+value = PhoneViewPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/platformaccountstatus.md b/docs/models/platformaccountstatus.md
index c1e971d..d798cb9 100644
--- a/docs/models/platformaccountstatus.md
+++ b/docs/models/platformaccountstatus.md
@@ -1,5 +1,13 @@
# PlatformAccountStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import PlatformAccountStatus
+
+value = PlatformAccountStatus.NONE
+```
+
## Values
diff --git a/docs/models/priority.md b/docs/models/priority.md
index cbaeef1..b51a216 100644
--- a/docs/models/priority.md
+++ b/docs/models/priority.md
@@ -3,6 +3,14 @@
Describes the card's priority.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Priority
+
+value = Priority.PRIMARY
+```
+
## Values
diff --git a/docs/models/processinginitiator.md b/docs/models/processinginitiator.md
index 75a1cbe..e4b54bb 100644
--- a/docs/models/processinginitiator.md
+++ b/docs/models/processinginitiator.md
@@ -2,6 +2,14 @@
Defines which payment method was used to initiate the transaction.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ProcessingInitiator
+
+value = ProcessingInitiator.INITIAL_CARD_ON_FILE
+```
+
## Values
diff --git a/docs/models/processor.md b/docs/models/processor.md
index 4de8e78..bd8a430 100644
--- a/docs/models/processor.md
+++ b/docs/models/processor.md
@@ -1,5 +1,13 @@
# Processor
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Processor
+
+value = Processor.VANTIV
+```
+
## Values
diff --git a/docs/models/replaceaddresspriority.md b/docs/models/replaceaddresspriority.md
index d60fcce..6111c94 100644
--- a/docs/models/replaceaddresspriority.md
+++ b/docs/models/replaceaddresspriority.md
@@ -2,6 +2,14 @@
The shopper-indicated priority of this address compared to other addresses on their account.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import ReplaceAddressPriority
+
+value = ReplaceAddressPriority.PRIMARY
+```
+
## Values
diff --git a/docs/models/representmentresult.md b/docs/models/representmentresult.md
index 84603ed..de1bb19 100644
--- a/docs/models/representmentresult.md
+++ b/docs/models/representmentresult.md
@@ -1,5 +1,13 @@
# RepresentmentResult
+## Example Usage
+
+```python
+from bolt_api_sdk.models import RepresentmentResult
+
+value = RepresentmentResult.NONE
+```
+
## Values
diff --git a/docs/models/requeststatus.md b/docs/models/requeststatus.md
index e1fa54f..ff39aea 100644
--- a/docs/models/requeststatus.md
+++ b/docs/models/requeststatus.md
@@ -1,5 +1,13 @@
# RequestStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import RequestStatus
+
+value = RequestStatus.REVIEWED
+```
+
## Values
diff --git a/docs/models/riskdecisionfactoryml.md b/docs/models/riskdecisionfactoryml.md
index 17f377f..9fc5251 100644
--- a/docs/models/riskdecisionfactoryml.md
+++ b/docs/models/riskdecisionfactoryml.md
@@ -2,6 +2,14 @@
One of the main contributing factors to the fraud decision and score.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import RiskDecisionFactorYml
+
+value = RiskDecisionFactorYml.ADDRESS_DETAILS
+```
+
## Values
diff --git a/docs/models/riskreviewstatus.md b/docs/models/riskreviewstatus.md
index 752d64c..e3bef1d 100644
--- a/docs/models/riskreviewstatus.md
+++ b/docs/models/riskreviewstatus.md
@@ -2,6 +2,14 @@
Describes the current Risk Review status. A transaction could be unreviewed, reviewed, or pending manual review by the Bolt team.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import RiskReviewStatus
+
+value = RiskReviewStatus.UNKNOWN
+```
+
## Values
diff --git a/docs/models/savedcreditcardviewtype.md b/docs/models/savedcreditcardviewtype.md
index 27ef542..96b0a1f 100644
--- a/docs/models/savedcreditcardviewtype.md
+++ b/docs/models/savedcreditcardviewtype.md
@@ -2,6 +2,14 @@
The payment method type. If empty, the property defaults to `card`.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import SavedCreditCardViewType
+
+value = SavedCreditCardViewType.CARD
+```
+
## Values
diff --git a/docs/models/savedpaypalaccountviewtype.md b/docs/models/savedpaypalaccountviewtype.md
index 3980286..34da706 100644
--- a/docs/models/savedpaypalaccountviewtype.md
+++ b/docs/models/savedpaypalaccountviewtype.md
@@ -2,6 +2,14 @@
Type field indicates this is a saved PayPal to differentiate it from a saved card.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import SavedPaypalAccountViewType
+
+value = SavedPaypalAccountViewType.PAYPAL
+```
+
## Values
diff --git a/docs/models/scope.md b/docs/models/scope.md
index 64b1307..1b474a9 100644
--- a/docs/models/scope.md
+++ b/docs/models/scope.md
@@ -2,6 +2,14 @@
The scope issued to the merchant when receiving an authorization code. Options include `bolt.account.manage`, `bolt.account.view`, `openid`. You can find more information on these options in our [OAuth scope documentation](https://help.bolt.com/developers/references/bolt-oauth/#scopes).
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Scope
+
+value = Scope.BOLT_ACCOUNT_MANAGE
+```
+
## Values
diff --git a/docs/models/splitsviewtype.md b/docs/models/splitsviewtype.md
index 4553edc..4c57423 100644
--- a/docs/models/splitsviewtype.md
+++ b/docs/models/splitsviewtype.md
@@ -3,6 +3,14 @@
**Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import SplitsViewType
+
+value = SplitsViewType.NET
+```
+
## Values
diff --git a/docs/models/statementsfiletype.md b/docs/models/statementsfiletype.md
index c14d70c..c3f370f 100644
--- a/docs/models/statementsfiletype.md
+++ b/docs/models/statementsfiletype.md
@@ -2,6 +2,14 @@
This is the type of the file. Currently, Bolt only supports CSV statements.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import StatementsFileType
+
+value = StatementsFileType.CSV
+```
+
## Values
diff --git a/docs/models/statementstype.md b/docs/models/statementstype.md
index 709d58e..38f97e5 100644
--- a/docs/models/statementstype.md
+++ b/docs/models/statementstype.md
@@ -6,6 +6,14 @@ The time period and statement type:
* [Dispute statement](https://help.bolt.com/operations/disputes/dispute-statements/#how-to-read-dispute-statements): Use `monthly_dispute`
+## Example Usage
+
+```python
+from bolt_api_sdk.models import StatementsType
+
+value = StatementsType.DAILY_TRANSACTION
+```
+
## Values
diff --git a/docs/models/trackingdetail.md b/docs/models/trackingdetail.md
index 417802a..d354dd0 100644
--- a/docs/models/trackingdetail.md
+++ b/docs/models/trackingdetail.md
@@ -7,7 +7,7 @@
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `city` | *str* | :heavy_check_mark: | N/A | New York |
| `country` | *str* | :heavy_check_mark: | N/A | USA |
-| `datetime` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | 2017-07-21T17:32:28Z |
+| `datetime_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | 2017-07-21T17:32:28Z |
| `message` | *str* | :heavy_check_mark: | N/A | BILLING INFORMATION RECEIVED |
| `state` | *str* | :heavy_check_mark: | N/A | New York |
| `status` | [models.TrackingDetailStatus](../models/trackingdetailstatus.md) | :heavy_check_mark: | The transit status of the order being tracked. | in_transit |
diff --git a/docs/models/trackingdetailstatus.md b/docs/models/trackingdetailstatus.md
index 5978cc1..51a7ab4 100644
--- a/docs/models/trackingdetailstatus.md
+++ b/docs/models/trackingdetailstatus.md
@@ -2,6 +2,14 @@
The transit status of the order being tracked.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TrackingDetailStatus
+
+value = TrackingDetailStatus.UNKNOWN
+```
+
## Values
diff --git a/docs/models/transactiondetailsviewviewstatus.md b/docs/models/transactiondetailsviewviewstatus.md
index d38eeb9..bbdd581 100644
--- a/docs/models/transactiondetailsviewviewstatus.md
+++ b/docs/models/transactiondetailsviewviewstatus.md
@@ -1,5 +1,13 @@
# TransactionDetailsViewViewStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionDetailsViewViewStatus
+
+value = TransactionDetailsViewViewStatus.NOT_VIEWED
+```
+
## Values
diff --git a/docs/models/transactionindemnificationdecision.md b/docs/models/transactionindemnificationdecision.md
index 2b278a8..c40ca8d 100644
--- a/docs/models/transactionindemnificationdecision.md
+++ b/docs/models/transactionindemnificationdecision.md
@@ -3,6 +3,14 @@
Describes whether the transaction is indemnified by Bolt for fraud.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionIndemnificationDecision
+
+value = TransactionIndemnificationDecision.UNKNOWN
+```
+
## Values
diff --git a/docs/models/transactionindemnificationreason.md b/docs/models/transactionindemnificationreason.md
index d7f094b..9ab6370 100644
--- a/docs/models/transactionindemnificationreason.md
+++ b/docs/models/transactionindemnificationreason.md
@@ -3,6 +3,14 @@
Describes the reason that the transaction is or is not indemnified by Bolt for fraud.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionIndemnificationReason
+
+value = TransactionIndemnificationReason.UNKNOWN
+```
+
## Values
diff --git a/docs/models/transactionprocessor.md b/docs/models/transactionprocessor.md
index acc4248..777ab29 100644
--- a/docs/models/transactionprocessor.md
+++ b/docs/models/transactionprocessor.md
@@ -2,6 +2,14 @@
The processor used. **Nullable** for Transactions Details.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionProcessor
+
+value = TransactionProcessor.ADYEN_GATEWAY
+```
+
## Values
diff --git a/docs/models/transactionprocessorstatus.md b/docs/models/transactionprocessorstatus.md
index eaf9a02..c0c73c9 100644
--- a/docs/models/transactionprocessorstatus.md
+++ b/docs/models/transactionprocessorstatus.md
@@ -2,6 +2,14 @@
The processor's status. Only `primary` and `active` processor are displayed.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionProcessorStatus
+
+value = TransactionProcessorStatus.PRIMARY
+```
+
## Values
diff --git a/docs/models/transactionsplitsviewtype.md b/docs/models/transactionsplitsviewtype.md
index 55b3fe8..3cbadc9 100644
--- a/docs/models/transactionsplitsviewtype.md
+++ b/docs/models/transactionsplitsviewtype.md
@@ -1,5 +1,13 @@
# TransactionSplitsViewType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionSplitsViewType
+
+value = TransactionSplitsViewType.NET
+```
+
## Values
diff --git a/docs/models/transactionstatus.md b/docs/models/transactionstatus.md
index f0b1b63..6046e8e 100644
--- a/docs/models/transactionstatus.md
+++ b/docs/models/transactionstatus.md
@@ -2,6 +2,14 @@
The transaction's status.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionStatus
+
+value = TransactionStatus.IN_PROGRESS
+```
+
## Values
diff --git a/docs/models/transactiontimelineviewtype.md b/docs/models/transactiontimelineviewtype.md
index 78339bd..211d58f 100644
--- a/docs/models/transactiontimelineviewtype.md
+++ b/docs/models/transactiontimelineviewtype.md
@@ -1,5 +1,13 @@
# TransactionTimelineViewType
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionTimelineViewType
+
+value = TransactionTimelineViewType.COMPLETED
+```
+
## Values
diff --git a/docs/models/transactiontype.md b/docs/models/transactiontype.md
index 77c0484..8eb8b04 100644
--- a/docs/models/transactiontype.md
+++ b/docs/models/transactiontype.md
@@ -2,6 +2,14 @@
The type of transaction.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionType
+
+value = TransactionType.CC_PAYMENT
+```
+
## Values
diff --git a/docs/models/transactionviewviewstatus.md b/docs/models/transactionviewviewstatus.md
index deb4fb7..b91e54b 100644
--- a/docs/models/transactionviewviewstatus.md
+++ b/docs/models/transactionviewviewstatus.md
@@ -1,5 +1,13 @@
# TransactionViewViewStatus
+## Example Usage
+
+```python
+from bolt_api_sdk.models import TransactionViewViewStatus
+
+value = TransactionViewViewStatus.NOT_VIEWED
+```
+
## Values
diff --git a/docs/models/type.md b/docs/models/type.md
index b320cd5..e1e1bd7 100644
--- a/docs/models/type.md
+++ b/docs/models/type.md
@@ -2,6 +2,14 @@
Determines if item is a physical, digital, or bundled good, or if the good type is unknown.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Type
+
+value = Type.BUNDLED
+```
+
## Values
diff --git a/docs/models/unit.md b/docs/models/unit.md
index d81ddb7..259c357 100644
--- a/docs/models/unit.md
+++ b/docs/models/unit.md
@@ -2,6 +2,14 @@
The unit for this subscription's frequency.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import Unit
+
+value = Unit.DAY
+```
+
## Values
diff --git a/docs/models/voidcause.md b/docs/models/voidcause.md
index 44b72ca..dba29e5 100644
--- a/docs/models/voidcause.md
+++ b/docs/models/voidcause.md
@@ -2,6 +2,14 @@
Determines why the transaction was voided.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import VoidCause
+
+value = VoidCause.MERCHANT_ACTION
+```
+
## Values
diff --git a/docs/models/webhookeventgroup.md b/docs/models/webhookeventgroup.md
index e01069f..7643259 100644
--- a/docs/models/webhookeventgroup.md
+++ b/docs/models/webhookeventgroup.md
@@ -4,6 +4,14 @@ Subscribe to a group of events.
`all`: subscribe to all existing and future event types
+## Example Usage
+
+```python
+from bolt_api_sdk.models import WebhookEventGroup
+
+value = WebhookEventGroup.ALL
+```
+
## Values
diff --git a/docs/models/webhookstype.md b/docs/models/webhookstype.md
index f96a6e9..96363c1 100644
--- a/docs/models/webhookstype.md
+++ b/docs/models/webhookstype.md
@@ -3,6 +3,14 @@
[Webhook events](https://help.bolt.com/developers/guides/webhooks/#transaction-hook-types) that trigger a notification to the URL. **Note**:`newsletter_subscription` is only for merchant use cases.
+## Example Usage
+
+```python
+from bolt_api_sdk.models import WebhooksType
+
+value = WebhooksType.PAYMENT
+```
+
## Values
diff --git a/docs/sdks/account/README.md b/docs/sdks/account/README.md
index 8e939a2..44a52cf 100644
--- a/docs/sdks/account/README.md
+++ b/docs/sdks/account/README.md
@@ -1,5 +1,4 @@
# Account
-(*account*)
## Overview
diff --git a/docs/sdks/bolt/README.md b/docs/sdks/bolt/README.md
deleted file mode 100644
index f6e3009..0000000
--- a/docs/sdks/bolt/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Bolt SDK
-
-## Overview
-
-Bolt API Reference: Postman Collection:
-
-[](https://god.gw.postman.com/run-collection/9136127-55d2bde1-a248-473f-95b5-64cfd02fb445?action=collection%2Ffork&collection-url=entityId%3D9136127-55d2bde1-a248-473f-95b5-64cfd02fb445%26entityType%3Dcollection%26workspaceId%3D78beee89-4238-4c5f-bd1f-7e98978744b4#?env%5BBolt%20Sandbox%20Environment%5D=W3sia2V5IjoiYXBpX2Jhc2VfdXJsIiwidmFsdWUiOiJodHRwczovL2FwaS1zYW5kYm94LmJvbHQuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6InRrX2Jhc2UiLCJ2YWx1ZSI6Imh0dHBzOi8vc2FuZGJveC5ib2x0dGsuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImFwaV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggQVBJIGtleT4iLCJ0eXBlIjoic2VjcmV0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJwdWJsaXNoYWJsZV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggcHVibGlzaGFibGUga2V5PiIsInR5cGUiOiJkZWZhdWx0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJkaXZpc2lvbl9pZCIsInZhbHVlIjoiPHJlcGxhY2Ugd2l0aCB5b3VyIEJvbHQgU2FuZGJveCBwdWJsaWMgZGl2aXNpb24gSUQ+IiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfV0=)
-
-## About
- A comprehensive Bolt API reference for interacting with Transactions, Orders, Product Catalog, Configuration, Testing, and much more.
-
- Note: You must also reference the [Merchant Callback API](/api-merchant) when building a managed checkout custom cart integration
-
-
-### Available Operations
diff --git a/docs/sdks/configuration/README.md b/docs/sdks/configuration/README.md
index e527dd7..b9540b7 100644
--- a/docs/sdks/configuration/README.md
+++ b/docs/sdks/configuration/README.md
@@ -1,5 +1,4 @@
# Configuration
-(*configuration*)
## Overview
diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md
index 986f525..fe2a8c9 100644
--- a/docs/sdks/oauth/README.md
+++ b/docs/sdks/oauth/README.md
@@ -1,5 +1,4 @@
# OAuth
-(*o_auth*)
## Overview
@@ -19,9 +18,9 @@ To use this endpoint, first use the Authorization Code Request flow by using the
**Reminder - the Content-Type of this request must be application/x-www-form-urlencoded**
-### Example Usage
+### Example Usage: authorization_code_request
-
+
```python
from bolt_api_sdk import Bolt, models
import os
@@ -34,9 +33,9 @@ with Bolt(
) as bolt:
res = bolt.o_auth.o_auth_token(request_body={
- "client_id": "",
- "client_secret": "",
- "code": "",
+ "client_id": "PUBLISHABLE_KEY_PLACEHOLDER",
+ "client_secret": "API_KEY_PLACEHOLDER",
+ "code": "AUTH_CODE_PLACEHOLDER",
"grant_type": models.OAuthTokenInputGrantType.AUTHORIZATION_CODE,
"scope": models.Scope.BOLT_ACCOUNT_VIEW,
})
@@ -44,6 +43,72 @@ with Bolt(
# Handle response
print(res)
+```
+### Example Usage: authorization_code_response
+
+
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ security=models.Security(
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ),
+) as bolt:
+
+ res = bolt.o_auth.o_auth_token()
+
+ # Handle response
+ print(res)
+
+```
+### Example Usage: refresh_token_request
+
+
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ security=models.Security(
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ),
+) as bolt:
+
+ res = bolt.o_auth.o_auth_token(request_body={
+ "client_id": "PUBLISHABLE_KEY_PLACEHOLDER",
+ "client_secret": "API_KEY_PLACEHOLDER",
+ "grant_type": models.OAuthTokenInputRefreshGrantType.REFRESH_TOKEN,
+ "refresh_token": "REFRESH_TOKEN_PLACEHOLDER",
+ "scope": "bolt.account.view",
+ })
+
+ # Handle response
+ print(res)
+
+```
+### Example Usage: refresh_token_response
+
+
+```python
+from bolt_api_sdk import Bolt, models
+import os
+
+
+with Bolt(
+ security=models.Security(
+ x_api_key=os.getenv("BOLT_X_API_KEY", ""),
+ ),
+) as bolt:
+
+ res = bolt.o_auth.o_auth_token()
+
+ # Handle response
+ print(res)
+
```
### Parameters
diff --git a/docs/sdks/orders/README.md b/docs/sdks/orders/README.md
index 35930e9..1a85d55 100644
--- a/docs/sdks/orders/README.md
+++ b/docs/sdks/orders/README.md
@@ -1,5 +1,4 @@
# Orders
-(*orders*)
## Overview
diff --git a/docs/sdks/statements/README.md b/docs/sdks/statements/README.md
index ea6c750..ad2c804 100644
--- a/docs/sdks/statements/README.md
+++ b/docs/sdks/statements/README.md
@@ -1,5 +1,4 @@
# Statements
-(*statements*)
## Overview
diff --git a/docs/sdks/testing/README.md b/docs/sdks/testing/README.md
index 1f241d9..bed77f6 100644
--- a/docs/sdks/testing/README.md
+++ b/docs/sdks/testing/README.md
@@ -1,5 +1,4 @@
# Testing
-(*testing*)
## Overview
@@ -38,7 +37,7 @@ with Bolt(
{
"city": "New York",
"country": "USA",
- "datetime": parse_datetime("2017-07-21T17:32:28Z"),
+ "datetime_": parse_datetime("2017-07-21T17:32:28Z"),
"message": "BILLING INFORMATION RECEIVED",
"state": "New York",
"status": models.TrackingDetailStatus.IN_TRANSIT,
diff --git a/docs/sdks/transactions/README.md b/docs/sdks/transactions/README.md
index 1e0c474..72f0d32 100644
--- a/docs/sdks/transactions/README.md
+++ b/docs/sdks/transactions/README.md
@@ -1,5 +1,4 @@
# Transactions
-(*transactions*)
## Overview
diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md
index da95ea7..9d686db 100644
--- a/docs/sdks/webhooks/README.md
+++ b/docs/sdks/webhooks/README.md
@@ -1,5 +1,4 @@
# Webhooks
-(*webhooks*)
## Overview
diff --git a/poetry.lock b/poetry.lock
index 6c4e5d6..2654058 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -96,7 +96,7 @@ description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
groups = ["main"]
-markers = "python_version < \"3.11\""
+markers = "python_version == \"3.10\""
files = [
{file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"},
{file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"},
@@ -463,7 +463,6 @@ mccabe = ">=0.6,<0.8"
platformdirs = ">=2.2.0"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
tomlkit = ">=0.10.1"
-typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""}
[package.extras]
spelling = ["pyenchant (>=3.2,<4.0)"]
@@ -471,14 +470,14 @@ testutils = ["gitpython (>3)"]
[[package]]
name = "pyright"
-version = "1.1.405"
+version = "1.1.398"
description = "Command line wrapper for pyright"
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
- {file = "pyright-1.1.405-py3-none-any.whl", hash = "sha256:a2cb13700b5508ce8e5d4546034cb7ea4aedb60215c6c33f56cec7f53996035a"},
- {file = "pyright-1.1.405.tar.gz", hash = "sha256:5c2a30e1037af27eb463a1cc0b9f6d65fec48478ccf092c1ac28385a15c55763"},
+ {file = "pyright-1.1.398-py3-none-any.whl", hash = "sha256:0a70bfd007d9ea7de1cf9740e1ad1a40a122592cfe22a3f6791b06162ad08753"},
+ {file = "pyright-1.1.398.tar.gz", hash = "sha256:357a13edd9be8082dc73be51190913e475fa41a6efb6ec0d4b7aab3bc11638d8"},
]
[package.dependencies]
@@ -509,7 +508,7 @@ description = "A lil' TOML parser"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
-markers = "python_version < \"3.11\""
+markers = "python_version == \"3.10\""
files = [
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
@@ -586,5 +585,5 @@ typing-extensions = ">=4.12.0"
[metadata]
lock-version = "2.1"
-python-versions = ">=3.9.2"
-content-hash = "feed8629015d65736379dae580e2f7eaa121b01095a9a91a2344efb03270b34e"
+python-versions = ">=3.10"
+content-hash = "f6a8355b7012376d6650030a1b23aaf67653ed8ccc9eae2880ccb8d9a23e3d6b"
diff --git a/pylintrc b/pylintrc
index e8cd3e8..cb9c15d 100644
--- a/pylintrc
+++ b/pylintrc
@@ -89,7 +89,7 @@ persistent=yes
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
-py-version=3.9
+py-version=3.10
# Discover python modules and packages in the file system subtree.
recursive=no
@@ -458,7 +458,8 @@ disable=raw-checker-failed,
consider-using-with,
wildcard-import,
unused-wildcard-import,
- too-many-return-statements
+ too-many-return-statements,
+ redefined-builtin
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
diff --git a/pyproject.toml b/pyproject.toml
index a60c272..00bdf02 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,11 @@
[project]
name = "bolt-api-sdk"
-version = "0.5.6"
+version = "0.6.0"
description = "Python Client SDK Generated by Speakeasy."
authors = [{ name = "Speakeasy" },]
-readme = "README.md"
-requires-python = ">=3.9.2"
+readme = "README-PYPI.md"
+requires-python = ">=3.10"
dependencies = [
"httpcore >=1.0.9",
"httpx >=0.28.1",
@@ -13,6 +13,7 @@ dependencies = [
]
[tool.poetry]
+repository = "https://github.com/BoltApp/Bolt-Python-SDK.git"
packages = [
{ include = "bolt_api_sdk", from = "src" }
]
@@ -27,7 +28,7 @@ in-project = true
[tool.poetry.group.dev.dependencies]
mypy = "==1.15.0"
pylint = "==3.2.3"
-pyright = "==1.1.405"
+pyright = "==1.1.398"
[build-system]
requires = ["poetry-core"]
diff --git a/scripts/prepare_readme.py b/scripts/prepare_readme.py
new file mode 100644
index 0000000..b28491f
--- /dev/null
+++ b/scripts/prepare_readme.py
@@ -0,0 +1,35 @@
+"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
+
+import re
+import shutil
+
+try:
+ with open("README.md", "r", encoding="utf-8") as rh:
+ readme_contents = rh.read()
+ GITHUB_URL = "https://github.com/BoltApp/Bolt-Python-SDK.git"
+ GITHUB_URL = (
+ GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL
+ )
+ REPO_SUBDIR = ""
+ # links on PyPI should have absolute URLs
+ readme_contents = re.sub(
+ r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))",
+ lambda m: m.group(1)
+ + GITHUB_URL
+ + "/blob/master/"
+ + REPO_SUBDIR
+ + m.group(2)
+ + m.group(3),
+ readme_contents,
+ )
+
+ with open("README-PYPI.md", "w", encoding="utf-8") as wh:
+ wh.write(readme_contents)
+except Exception as e:
+ try:
+ print("Failed to rewrite README.md to README-PYPI.md, copying original instead")
+ print(e)
+ shutil.copyfile("README.md", "README-PYPI.md")
+ except Exception as ie:
+ print("Failed to copy README.md to README-PYPI.md")
+ print(ie)
diff --git a/scripts/publish.sh b/scripts/publish.sh
index 5eb52a4..2a3ead7 100755
--- a/scripts/publish.sh
+++ b/scripts/publish.sh
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN}
+poetry run python scripts/prepare_readme.py
+
poetry publish --build --skip-existing
diff --git a/src/bolt_api_sdk/_hooks/oauth2scopes.py b/src/bolt_api_sdk/_hooks/oauth2scopes.py
new file mode 100644
index 0000000..7e1b4aa
--- /dev/null
+++ b/src/bolt_api_sdk/_hooks/oauth2scopes.py
@@ -0,0 +1,22 @@
+"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
+
+from enum import Enum
+
+
+class OAuthOAuth2Scope(str, Enum):
+ r"""Available scopes for the OAuth OAuth 2.0 scheme (authorizationCode flow).
+
+ Bolt utilizes the OAuth flow that developers can use to attain access to Bolt Account data via APIs.
+ For all APIs that require authorization, please provide your `access_token` returned from `/v1/oauth/token` via the basic auth bearer header `Authorization: bearer ${TOKEN}`.
+ [Read more about the OAuth token endpoint.](/api-bolt/#tag/OAuth)
+
+ """
+
+ BOLT_ACCOUNT_MANAGE = "bolt.account.manage"
+ r"""This scope grants permissions to perform read/edit/delete actions on Bolt Account data"""
+
+ BOLT_ACCOUNT_VIEW = "bolt.account.view"
+ r"""This scope grants permissions to perform read only actions on Bolt Account data"""
+
+ OPENID = "openid"
+ r"""This scope grants permissions that enable Bolt SSO by granting an id token JWT that stores account data. Not used in v1/account endpoints"""
diff --git a/src/bolt_api_sdk/_version.py b/src/bolt_api_sdk/_version.py
index a4ce10c..5817142 100644
--- a/src/bolt_api_sdk/_version.py
+++ b/src/bolt_api_sdk/_version.py
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "bolt-api-sdk"
-__version__: str = "0.5.6"
+__version__: str = "0.6.0"
__openapi_doc_version__: str = "1.0.1"
-__gen_version__: str = "2.716.16"
-__user_agent__: str = "speakeasy-sdk/python 0.5.6 2.716.16 1.0.1 bolt-api-sdk"
+__gen_version__: str = "2.879.6"
+__user_agent__: str = "speakeasy-sdk/python 0.6.0 2.879.6 1.0.1 bolt-api-sdk"
try:
if __package__ is not None:
diff --git a/src/bolt_api_sdk/account.py b/src/bolt_api_sdk/account.py
index 2079a53..c931359 100644
--- a/src/bolt_api_sdk/account.py
+++ b/src/bolt_api_sdk/account.py
@@ -60,6 +60,7 @@ def get_account(
accept_header_value="application/json",
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.GetAccountSecurity),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -143,6 +144,7 @@ async def get_account_async(
accept_header_value="application/json",
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.GetAccountSecurity),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -195,6 +197,8 @@ def create_account(
Create a Bolt shopping account.
+ If set, this operation will use `x_api_key` from the global security.
+
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param create_account_input:
@@ -235,12 +239,14 @@ def create_account(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.create_account_input,
+ request.create_account_input if request is not None else None,
False,
True,
"json",
Optional[models.CreateAccountInput],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -257,7 +263,7 @@ def create_account(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -295,6 +301,8 @@ async def create_account_async(
Create a Bolt shopping account.
+ If set, this operation will use `x_api_key` from the global security.
+
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param create_account_input:
@@ -335,12 +343,14 @@ async def create_account_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.create_account_input,
+ request.create_account_input if request is not None else None,
False,
True,
"json",
Optional[models.CreateAccountInput],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -357,7 +367,7 @@ async def create_account_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -439,12 +449,13 @@ def update_account_profile(
security, models.UpdateAccountProfileSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.update_profile,
+ request.update_profile if request is not None else None,
False,
True,
"json",
Optional[models.UpdateProfile],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -541,12 +552,13 @@ async def update_account_profile_async(
security, models.UpdateAccountProfileSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.update_profile,
+ request.update_profile if request is not None else None,
False,
True,
"json",
Optional[models.UpdateProfile],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -641,12 +653,13 @@ def add_address(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.AddAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -741,12 +754,13 @@ async def add_address_async(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.AddAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -836,6 +850,7 @@ def delete_address(
accept_header_value="*/*",
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.DeleteAddressSecurity),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -925,6 +940,7 @@ async def delete_address_async(
accept_header_value="*/*",
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.DeleteAddressSecurity),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1019,11 +1035,15 @@ def replace_address(
:param door_code: The building door code or community gate code.
:param name: The given and surname of the person associated with this address.
:param phone: A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.
- :param region_code: The ISO 3166-2 region code associated with this address. - * If specified, value must be valid for the `country`. - * If null, value is inferred from the `region`.
+ :param region_code: The ISO 3166-2 region code associated with this address.
+ - * If specified, value must be valid for the `country`.
+ - * If null, value is inferred from the `region`.
+
:param street_address2: Any apartment, floor, or unit details.
:param street_address3: Any additional street address details.
:param street_address4: Any additional street address details.
:param metadata: A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.bolt.com/developers/references/embedded-metadata/).
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1082,12 +1102,13 @@ def replace_address(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.ReplaceAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1182,11 +1203,15 @@ async def replace_address_async(
:param door_code: The building door code or community gate code.
:param name: The given and surname of the person associated with this address.
:param phone: A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.
- :param region_code: The ISO 3166-2 region code associated with this address. - * If specified, value must be valid for the `country`. - * If null, value is inferred from the `region`.
+ :param region_code: The ISO 3166-2 region code associated with this address.
+ - * If specified, value must be valid for the `country`.
+ - * If null, value is inferred from the `region`.
+
:param street_address2: Any apartment, floor, or unit details.
:param street_address3: Any additional street address details.
:param street_address4: Any additional street address details.
:param metadata: A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.bolt.com/developers/references/embedded-metadata/).
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1245,12 +1270,13 @@ async def replace_address_async(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.ReplaceAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1343,11 +1369,15 @@ def edit_address(
:param door_code: The building door code or community gate code.
:param name: The given and surname of the person associated with this address.
:param phone: A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.
- :param region_code: The ISO 3166-2 region code associated with this address. - * If specified, value must be valid for the `country`. - * If null, value is inferred from the `region`.
+ :param region_code: The ISO 3166-2 region code associated with this address.
+ - * If specified, value must be valid for the `country`.
+ - * If null, value is inferred from the `region`.
+
:param street_address2: Any apartment, floor, or unit details.
:param street_address3: Any additional street address details.
:param street_address4: Any additional street address details.
:param metadata: A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.bolt.com/developers/references/embedded-metadata/).
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1405,12 +1435,13 @@ def edit_address(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.EditAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1503,11 +1534,15 @@ async def edit_address_async(
:param door_code: The building door code or community gate code.
:param name: The given and surname of the person associated with this address.
:param phone: A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.
- :param region_code: The ISO 3166-2 region code associated with this address. - * If specified, value must be valid for the `country`. - * If null, value is inferred from the `region`.
+ :param region_code: The ISO 3166-2 region code associated with this address.
+ - * If specified, value must be valid for the `country`.
+ - * If null, value is inferred from the `region`.
+
:param street_address2: Any apartment, floor, or unit details.
:param street_address3: Any additional street address details.
:param street_address4: Any additional street address details.
:param metadata: A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.bolt.com/developers/references/embedded-metadata/).
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1565,12 +1600,13 @@ async def edit_address_async(
http_headers=http_headers,
security=utils.get_pydantic_model(security, models.EditAddressSecurity),
get_serialized_body=lambda: utils.serialize_request_body(
- request.address_account,
+ request.address_account if request is not None else None,
False,
True,
"json",
Optional[models.AddressAccount],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1660,6 +1696,7 @@ def detect_account(
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1676,7 +1713,7 @@ def detect_account(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="detectAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=None,
),
request=req,
@@ -1755,6 +1792,7 @@ async def detect_account_async(
user_agent_header="user-agent",
accept_header_value="application/json",
http_headers=http_headers,
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1771,7 +1809,7 @@ async def detect_account_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="detectAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=None,
),
request=req,
@@ -1865,12 +1903,13 @@ def add_payment_method(
security, models.AddPaymentMethodSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"json",
Optional[models.AddPaymentMethodRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -1975,12 +2014,13 @@ async def add_payment_method_async(
security, models.AddPaymentMethodSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"json",
Optional[models.AddPaymentMethodRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -2072,6 +2112,7 @@ def delete_payment_method(
security=utils.get_pydantic_model(
security, models.DeletePaymentMethodSecurity
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -2169,6 +2210,7 @@ async def delete_payment_method_async(
security=utils.get_pydantic_model(
security, models.DeletePaymentMethodSecurity
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
diff --git a/src/bolt_api_sdk/basesdk.py b/src/bolt_api_sdk/basesdk.py
index 3f281c6..32f09ee 100644
--- a/src/bolt_api_sdk/basesdk.py
+++ b/src/bolt_api_sdk/basesdk.py
@@ -7,7 +7,12 @@
AfterSuccessContext,
BeforeRequestContext,
)
-from bolt_api_sdk.utils import RetryConfig, SerializedRequestBody, get_body_content
+from bolt_api_sdk.utils import (
+ RetryConfig,
+ SerializedRequestBody,
+ get_body_content,
+ run_sync_in_thread,
+)
import httpx
from typing import Callable, List, Mapping, Optional, Tuple
from urllib.parse import parse_qs, urlparse
@@ -60,6 +65,8 @@ def _build_request_async(
] = None,
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
+ allow_empty_value: Optional[List[str]] = None,
+ allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
client = self.sdk_configuration.async_client
return self._build_request_with_client(
@@ -80,6 +87,8 @@ def _build_request_async(
get_serialized_body,
url_override,
http_headers,
+ allow_empty_value,
+ allowed_fields,
)
def _build_request(
@@ -102,6 +111,8 @@ def _build_request(
] = None,
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
+ allow_empty_value: Optional[List[str]] = None,
+ allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
client = self.sdk_configuration.client
return self._build_request_with_client(
@@ -122,6 +133,8 @@ def _build_request(
get_serialized_body,
url_override,
http_headers,
+ allow_empty_value,
+ allowed_fields,
)
def _build_request_with_client(
@@ -145,6 +158,8 @@ def _build_request_with_client(
] = None,
url_override: Optional[str] = None,
http_headers: Optional[Mapping[str, str]] = None,
+ allow_empty_value: Optional[List[str]] = None,
+ allowed_fields: Optional[List[str]] = None,
) -> httpx.Request:
query_params = {}
@@ -160,6 +175,7 @@ def _build_request_with_client(
query_params = utils.get_query_params(
request if request_has_query_params else None,
_globals if request_has_query_params else None,
+ allow_empty_value,
)
else:
# Pick up the query parameter from the override so they can be
@@ -177,7 +193,9 @@ def _build_request_with_client(
security = security()
security = utils.get_security_from_env(security, models.Security)
if security is not None:
- security_headers, security_query_params = utils.get_security(security)
+ security_headers, security_query_params = utils.get_security(
+ security, allowed_fields
+ )
headers = {**headers, **security_headers}
query_params = {**query_params, **security_query_params}
@@ -214,7 +232,7 @@ def _build_request_with_client(
data=serialized_request_body.data,
files=serialized_request_body.files,
headers=headers,
- timeout=timeout,
+ timeout=timeout if timeout is not None else httpx.USE_CLIENT_DEFAULT,
)
def do_request(
@@ -234,6 +252,8 @@ def do():
http_res = None
try:
req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
+ if "timeout" in request.extensions and "timeout" not in req.extensions:
+ req.extensions["timeout"] = request.extensions["timeout"]
logger.debug(
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
req.method,
@@ -305,7 +325,12 @@ async def do_request_async(
async def do():
http_res = None
try:
- req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
+ req = await run_sync_in_thread(
+ hooks.before_request, BeforeRequestContext(hook_ctx), request
+ )
+
+ if "timeout" in request.extensions and "timeout" not in req.extensions:
+ req.extensions["timeout"] = request.extensions["timeout"]
logger.debug(
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
req.method,
@@ -319,7 +344,10 @@ async def do():
http_res = await client.send(req, stream=stream)
except Exception as e:
- _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
+ _, e = await run_sync_in_thread(
+ hooks.after_error, AfterErrorContext(hook_ctx), None, e
+ )
+
if e is not None:
logger.debug("Request Exception", exc_info=True)
raise e
@@ -337,9 +365,10 @@ async def do():
)
if utils.match_status_codes(error_status_codes, http_res.status_code):
- result, err = hooks.after_error(
- AfterErrorContext(hook_ctx), http_res, None
+ result, err = await run_sync_in_thread(
+ hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
)
+
if err is not None:
logger.debug("Request Exception", exc_info=True)
raise err
@@ -359,6 +388,8 @@ async def do():
http_res = await do()
if not utils.match_status_codes(error_status_codes, http_res.status_code):
- http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
+ http_res = await run_sync_in_thread(
+ hooks.after_success, AfterSuccessContext(hook_ctx), http_res
+ )
return http_res
diff --git a/src/bolt_api_sdk/configuration.py b/src/bolt_api_sdk/configuration.py
index ca1ff86..70c1357 100644
--- a/src/bolt_api_sdk/configuration.py
+++ b/src/bolt_api_sdk/configuration.py
@@ -25,6 +25,8 @@ def get_merchant_callbacks(
Retrieves callbacks URLs for a Bolt merchant division.
+ If set, this operation will use `x_api_key` from the global security.
+
:param division_id: The unique ID associated to the merchant's Bolt Account division; Merchants can have different divisions to suit multiple use cases (storefronts, pay-by-link, phone order processing). You can view and switch between these divisions from the Bolt Merchant Dashboard.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -58,6 +60,8 @@ def get_merchant_callbacks(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -74,7 +78,7 @@ def get_merchant_callbacks(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getMerchantCallbacks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -114,6 +118,8 @@ async def get_merchant_callbacks_async(
Retrieves callbacks URLs for a Bolt merchant division.
+ If set, this operation will use `x_api_key` from the global security.
+
:param division_id: The unique ID associated to the merchant's Bolt Account division; Merchants can have different divisions to suit multiple use cases (storefronts, pay-by-link, phone order processing). You can view and switch between these divisions from the Bolt Merchant Dashboard.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -147,6 +153,8 @@ async def get_merchant_callbacks_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -163,7 +171,7 @@ async def get_merchant_callbacks_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getMerchantCallbacks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -205,6 +213,8 @@ def set_merchant_callbacks(
Configure callbacks URLs for a Bolt merchant division. This will store or override only the callback URLs that are specified in the request. Operations are fully transactional.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -241,6 +251,8 @@ def set_merchant_callbacks(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.MerchantCallbacksInput]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -257,7 +269,7 @@ def set_merchant_callbacks(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="setMerchantCallbacks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -299,6 +311,8 @@ async def set_merchant_callbacks_async(
Configure callbacks URLs for a Bolt merchant division. This will store or override only the callback URLs that are specified in the request. Operations are fully transactional.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -335,6 +349,8 @@ async def set_merchant_callbacks_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.MerchantCallbacksInput]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -351,7 +367,7 @@ async def set_merchant_callbacks_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="setMerchantCallbacks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -390,6 +406,8 @@ def get_merchant_identifiers(
This endpoint returns the merchant's public ID and the [publishable key](https://help.bolt.com/developers/tools/api-keys/) related to the merchant division.
+ If set, this operation will use `x_api_key` from the global security.
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -417,6 +435,8 @@ def get_merchant_identifiers(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -433,7 +453,7 @@ def get_merchant_identifiers(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getMerchantIdentifiers",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -472,6 +492,8 @@ async def get_merchant_identifiers_async(
This endpoint returns the merchant's public ID and the [publishable key](https://help.bolt.com/developers/tools/api-keys/) related to the merchant division.
+ If set, this operation will use `x_api_key` from the global security.
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -499,6 +521,8 @@ async def get_merchant_identifiers_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -515,7 +539,7 @@ async def get_merchant_identifiers_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getMerchantIdentifiers",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/errors/__init__.py b/src/bolt_api_sdk/errors/__init__.py
index 74978a7..f0468dc 100644
--- a/src/bolt_api_sdk/errors/__init__.py
+++ b/src/bolt_api_sdk/errors/__init__.py
@@ -1,10 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from .bolterror import BoltError
-from typing import TYPE_CHECKING
-from importlib import import_module
-import builtins
-import sys
+from typing import Any, TYPE_CHECKING
+
+from bolt_api_sdk.utils.dynamic_imports import lazy_getattr, lazy_dir
if TYPE_CHECKING:
from .apierror import APIError
@@ -49,39 +48,11 @@
}
-def dynamic_import(modname, retries=3):
- for attempt in range(retries):
- try:
- return import_module(modname, __package__)
- except KeyError:
- # Clear any half-initialized module and retry
- sys.modules.pop(modname, None)
- if attempt == retries - 1:
- break
- raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
-
-
-def __getattr__(attr_name: str) -> object:
- module_name = _dynamic_imports.get(attr_name)
- if module_name is None:
- raise AttributeError(
- f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
- )
-
- try:
- module = dynamic_import(module_name)
- result = getattr(module, attr_name)
- return result
- except ImportError as e:
- raise ImportError(
- f"Failed to import {attr_name} from {module_name}: {e}"
- ) from e
- except AttributeError as e:
- raise AttributeError(
- f"Failed to get {attr_name} from {module_name}: {e}"
- ) from e
+def __getattr__(attr_name: str) -> Any:
+ return lazy_getattr(
+ attr_name, package=__package__, dynamic_imports=_dynamic_imports
+ )
def __dir__():
- lazy_attrs = builtins.list(_dynamic_imports.keys())
- return builtins.sorted(lazy_attrs)
+ return lazy_dir(dynamic_imports=_dynamic_imports)
diff --git a/src/bolt_api_sdk/errors/apierror.py b/src/bolt_api_sdk/errors/apierror.py
index 66e602d..7e1eda9 100644
--- a/src/bolt_api_sdk/errors/apierror.py
+++ b/src/bolt_api_sdk/errors/apierror.py
@@ -9,7 +9,7 @@
MAX_MESSAGE_LEN = 10_000
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class APIError(BoltError):
"""The fallback error class if no more specific error class is matched."""
diff --git a/src/bolt_api_sdk/errors/bolterror.py b/src/bolt_api_sdk/errors/bolterror.py
index c010edc..971369c 100644
--- a/src/bolt_api_sdk/errors/bolterror.py
+++ b/src/bolt_api_sdk/errors/bolterror.py
@@ -5,7 +5,7 @@
from dataclasses import dataclass, field
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class BoltError(Exception):
"""The base class for all HTTP error responses."""
diff --git a/src/bolt_api_sdk/errors/capturetransactionop.py b/src/bolt_api_sdk/errors/capturetransactionop.py
index fdc7fda..dd97494 100644
--- a/src/bolt_api_sdk/errors/capturetransactionop.py
+++ b/src/bolt_api_sdk/errors/capturetransactionop.py
@@ -11,11 +11,10 @@
class UnprocessableEntityErrorData(BaseModel):
errors: Optional[List[models_capturetransactionop.Error]] = None
-
result: Optional[models_capturetransactionop.Result] = None
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class UnprocessableEntityError(BoltError):
r"""Unprocessable Entity"""
diff --git a/src/bolt_api_sdk/errors/errors_bolt_api_response.py b/src/bolt_api_sdk/errors/errors_bolt_api_response.py
index a3a2560..a62ed5e 100644
--- a/src/bolt_api_sdk/errors/errors_bolt_api_response.py
+++ b/src/bolt_api_sdk/errors/errors_bolt_api_response.py
@@ -14,12 +14,11 @@
class ErrorsBoltAPIResponseData(BaseModel):
errors: Optional[List[models_error_bolt_api.ErrorBoltAPI]] = None
-
result: Optional[models_request_result.RequestResult] = None
r"""Custom-defined Bolt result object."""
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class ErrorsBoltAPIResponse(BoltError):
data: ErrorsBoltAPIResponseData = field(hash=False)
diff --git a/src/bolt_api_sdk/errors/errors_oauth_server_response.py b/src/bolt_api_sdk/errors/errors_oauth_server_response.py
index 7b03b01..44f5b48 100644
--- a/src/bolt_api_sdk/errors/errors_oauth_server_response.py
+++ b/src/bolt_api_sdk/errors/errors_oauth_server_response.py
@@ -10,11 +10,10 @@
class ErrorsOauthServerResponseData(BaseModel):
error: Optional[str] = None
-
error_description: Optional[str] = None
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class ErrorsOauthServerResponse(BoltError):
r"""Invalid request to OAuth Token."""
diff --git a/src/bolt_api_sdk/errors/no_response_error.py b/src/bolt_api_sdk/errors/no_response_error.py
index b710ea2..1deab64 100644
--- a/src/bolt_api_sdk/errors/no_response_error.py
+++ b/src/bolt_api_sdk/errors/no_response_error.py
@@ -3,7 +3,7 @@
from dataclasses import dataclass
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class NoResponseError(Exception):
"""Error raised when no HTTP response is received from the server."""
diff --git a/src/bolt_api_sdk/errors/responsevalidationerror.py b/src/bolt_api_sdk/errors/responsevalidationerror.py
index 6f748bf..0149d6e 100644
--- a/src/bolt_api_sdk/errors/responsevalidationerror.py
+++ b/src/bolt_api_sdk/errors/responsevalidationerror.py
@@ -7,7 +7,7 @@
from bolt_api_sdk.errors import BoltError
-@dataclass(frozen=True)
+@dataclass(unsafe_hash=True)
class ResponseValidationError(BoltError):
"""Error raised when there is a type mismatch between the response data and the expected Pydantic model."""
diff --git a/src/bolt_api_sdk/httpclient.py b/src/bolt_api_sdk/httpclient.py
index 47b052c..89560b5 100644
--- a/src/bolt_api_sdk/httpclient.py
+++ b/src/bolt_api_sdk/httpclient.py
@@ -107,7 +107,6 @@ def close_clients(
# to them from the owning SDK instance and they can be reaped.
owner.client = None
owner.async_client = None
-
if sync_client is not None and not sync_client_supplied:
try:
sync_client.close()
diff --git a/src/bolt_api_sdk/models/__init__.py b/src/bolt_api_sdk/models/__init__.py
index 7a575fe..ab2363b 100644
--- a/src/bolt_api_sdk/models/__init__.py
+++ b/src/bolt_api_sdk/models/__init__.py
@@ -1,9 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
-from typing import TYPE_CHECKING
-from importlib import import_module
-import builtins
-import sys
+from typing import Any, TYPE_CHECKING
+
+from bolt_api_sdk.utils.dynamic_imports import lazy_getattr, lazy_dir
if TYPE_CHECKING:
from .account_details import (
@@ -1676,39 +1675,11 @@
}
-def dynamic_import(modname, retries=3):
- for attempt in range(retries):
- try:
- return import_module(modname, __package__)
- except KeyError:
- # Clear any half-initialized module and retry
- sys.modules.pop(modname, None)
- if attempt == retries - 1:
- break
- raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
-
-
-def __getattr__(attr_name: str) -> object:
- module_name = _dynamic_imports.get(attr_name)
- if module_name is None:
- raise AttributeError(
- f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
- )
-
- try:
- module = dynamic_import(module_name)
- result = getattr(module, attr_name)
- return result
- except ImportError as e:
- raise ImportError(
- f"Failed to import {attr_name} from {module_name}: {e}"
- ) from e
- except AttributeError as e:
- raise AttributeError(
- f"Failed to get {attr_name} from {module_name}: {e}"
- ) from e
+def __getattr__(attr_name: str) -> Any:
+ return lazy_getattr(
+ attr_name, package=__package__, dynamic_imports=_dynamic_imports
+ )
def __dir__():
- lazy_attrs = builtins.list(_dynamic_imports.keys())
- return builtins.sorted(lazy_attrs)
+ return lazy_dir(dynamic_imports=_dynamic_imports)
diff --git a/src/bolt_api_sdk/models/account_details.py b/src/bolt_api_sdk/models/account_details.py
index 32787dc..225c2dc 100644
--- a/src/bolt_api_sdk/models/account_details.py
+++ b/src/bolt_api_sdk/models/account_details.py
@@ -11,7 +11,8 @@
SavedPaypalAccountView,
SavedPaypalAccountViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
@@ -50,3 +51,21 @@ class AccountDetails(BaseModel):
profile: Optional[ProfileView] = None
r"""The shopper's account profile."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["addresses", "has_bolt_account", "payment_methods", "profile"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/account_details_address_view.py b/src/bolt_api_sdk/models/account_details_address_view.py
index 3932d27..7ac072c 100644
--- a/src/bolt_api_sdk/models/account_details_address_view.py
+++ b/src/bolt_api_sdk/models/account_details_address_view.py
@@ -141,59 +141,58 @@ class AccountDetailsAddressView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "door_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "locality",
- "name",
- "phone_number",
- "postal_code",
- "priority",
- "region",
- "region_code",
- "street_address1",
- "street_address2",
- "street_address3",
- "street_address4",
- "default",
- "metadata",
- ]
- nullable_fields = [
- "door_code",
- "priority",
- "region_code",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "door_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "locality",
+ "name",
+ "phone_number",
+ "postal_code",
+ "priority",
+ "region",
+ "region_code",
+ "street_address1",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ "default",
+ "metadata",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "priority",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/addaddressop.py b/src/bolt_api_sdk/models/addaddressop.py
index 6c383e5..b129b4e 100644
--- a/src/bolt_api_sdk/models/addaddressop.py
+++ b/src/bolt_api_sdk/models/addaddressop.py
@@ -33,7 +33,10 @@ class AddAddressSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -45,6 +48,7 @@ class AddAddressSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -79,6 +83,24 @@ class AddAddressRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["X-Publishable-Key", "Idempotency-Key", "address_account"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class AddAddressPriority(str, Enum):
r"""The shopper-indicated priority of this address compared to other addresses on their account."""
@@ -204,59 +226,58 @@ class AddAddressResponse(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "door_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "locality",
- "name",
- "phone_number",
- "postal_code",
- "priority",
- "region",
- "region_code",
- "street_address1",
- "street_address2",
- "street_address3",
- "street_address4",
- "metadata",
- "default",
- ]
- nullable_fields = [
- "door_code",
- "priority",
- "region_code",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "door_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "locality",
+ "name",
+ "phone_number",
+ "postal_code",
+ "priority",
+ "region",
+ "region_code",
+ "street_address1",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ "default",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "priority",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/addpaymentmethodop.py b/src/bolt_api_sdk/models/addpaymentmethodop.py
index eb65705..773a059 100644
--- a/src/bolt_api_sdk/models/addpaymentmethodop.py
+++ b/src/bolt_api_sdk/models/addpaymentmethodop.py
@@ -33,7 +33,10 @@ class AddPaymentMethodSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -45,6 +48,7 @@ class AddPaymentMethodSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -185,45 +189,42 @@ class AddPaymentMethodRequestBody(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "billing_address_id",
- "bin",
- "cryptogram",
- "eci",
- "last4",
- "metadata",
- "network",
- "number",
- "postal_code",
- "priority",
- "save",
- "token_type",
- "currency",
- ]
- nullable_fields = ["billing_address_id", "metadata"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "billing_address_id",
+ "bin",
+ "cryptogram",
+ "eci",
+ "last4",
+ "metadata",
+ "network",
+ "number",
+ "postal_code",
+ "priority",
+ "save",
+ "token_type",
+ "currency",
+ ]
+ )
+ nullable_fields = set(["billing_address_id", "metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
@@ -255,3 +256,19 @@ class AddPaymentMethodRequest(BaseModel):
Optional[AddPaymentMethodRequestBody],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "Idempotency-Key", "RequestBody"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/address.py b/src/bolt_api_sdk/models/address.py
index 33a9124..b5a955b 100644
--- a/src/bolt_api_sdk/models/address.py
+++ b/src/bolt_api_sdk/models/address.py
@@ -121,46 +121,40 @@ class Address(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "default",
- "door_code",
- "name",
- "phone",
- "region_code",
- "street_address2",
- "street_address3",
- "street_address4",
- ]
- nullable_fields = [
- "door_code",
- "region_code",
- "street_address3",
- "street_address4",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "default",
+ "door_code",
+ "name",
+ "phone",
+ "region_code",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ ]
+ )
+ nullable_fields = set(
+ ["door_code", "region_code", "street_address3", "street_address4"]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/address_account.py b/src/bolt_api_sdk/models/address_account.py
index dce2c43..036b80b 100644
--- a/src/bolt_api_sdk/models/address_account.py
+++ b/src/bolt_api_sdk/models/address_account.py
@@ -131,48 +131,47 @@ class AddressAccount(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "default",
- "door_code",
- "name",
- "phone",
- "region_code",
- "street_address2",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- nullable_fields = [
- "door_code",
- "region_code",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "default",
+ "door_code",
+ "name",
+ "phone",
+ "region_code",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/address_change_request_metadata_view.py b/src/bolt_api_sdk/models/address_change_request_metadata_view.py
index 8e6bcba..d805547 100644
--- a/src/bolt_api_sdk/models/address_change_request_metadata_view.py
+++ b/src/bolt_api_sdk/models/address_change_request_metadata_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -24,3 +25,27 @@ class AddressChangeRequestMetadataView(BaseModel):
ticket_id: Optional[str] = None
ticket_status: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "can_change_shipping_address",
+ "id",
+ "status",
+ "ticket_id",
+ "ticket_status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/address_change_view.py b/src/bolt_api_sdk/models/address_change_view.py
index 9ddce57..cc32fb7 100644
--- a/src/bolt_api_sdk/models/address_change_view.py
+++ b/src/bolt_api_sdk/models/address_change_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .address_view import AddressView, AddressViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -29,3 +30,21 @@ class AddressChangeView(BaseModel):
to_address: Optional[AddressView] = None
r"""The address object returned in the response."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["from_address", "status", "ticket_id", "timestamp", "to_address"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/address_view.py b/src/bolt_api_sdk/models/address_view.py
index 9ca3ced..4c084b8 100644
--- a/src/bolt_api_sdk/models/address_view.py
+++ b/src/bolt_api_sdk/models/address_view.py
@@ -126,56 +126,55 @@ class AddressView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "door_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "locality",
- "name",
- "phone_number",
- "postal_code",
- "priority",
- "region",
- "region_code",
- "street_address1",
- "street_address2",
- "street_address3",
- "street_address4",
- ]
- nullable_fields = [
- "door_code",
- "priority",
- "region_code",
- "street_address3",
- "street_address4",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "door_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "locality",
+ "name",
+ "phone_number",
+ "postal_code",
+ "priority",
+ "region",
+ "region_code",
+ "street_address1",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "priority",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/amount_view.py b/src/bolt_api_sdk/models/amount_view.py
index 3f927f6..1648694 100644
--- a/src/bolt_api_sdk/models/amount_view.py
+++ b/src/bolt_api_sdk/models/amount_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -18,3 +19,19 @@ class AmountView(BaseModel):
currency: Optional[str] = None
currency_symbol: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["amount", "currency", "currency_symbol"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/auth_rejection_details.py b/src/bolt_api_sdk/models/auth_rejection_details.py
index 3d28799..6ca2519 100644
--- a/src/bolt_api_sdk/models/auth_rejection_details.py
+++ b/src/bolt_api_sdk/models/auth_rejection_details.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class AuthRejectionDetails(BaseModel):
reason_code: Optional[str] = None
reason_description: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["reason_code", "reason_description"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/auth_rejection_details_view.py b/src/bolt_api_sdk/models/auth_rejection_details_view.py
index 67dade2..9734913 100644
--- a/src/bolt_api_sdk/models/auth_rejection_details_view.py
+++ b/src/bolt_api_sdk/models/auth_rejection_details_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class AuthRejectionDetailsView(BaseModel):
reason_description: str
reason_code: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["reason_code"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/authorizetransactionop.py b/src/bolt_api_sdk/models/authorizetransactionop.py
index 3d9932f..29e272e 100644
--- a/src/bolt_api_sdk/models/authorizetransactionop.py
+++ b/src/bolt_api_sdk/models/authorizetransactionop.py
@@ -9,7 +9,7 @@
MerchantCreditCardAuthorizationRecharge,
MerchantCreditCardAuthorizationRechargeTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import (
FieldMetadata,
HeaderMetadata,
@@ -17,6 +17,7 @@
SecurityMetadata,
)
import pydantic
+from pydantic import model_serializer
from typing import Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -31,7 +32,10 @@ class AuthorizeTransactionSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -43,6 +47,7 @@ class AuthorizeTransactionSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -115,3 +120,19 @@ class AuthorizeTransactionRequest(BaseModel):
* • **Anytime the shopper is paying while logged-in attach their OAuth `access_token` to the request.**
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "Idempotency-Key", "RequestBody"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/capture_transaction_with_reference.py b/src/bolt_api_sdk/models/capture_transaction_with_reference.py
index 7c63f43..d966561 100644
--- a/src/bolt_api_sdk/models/capture_transaction_with_reference.py
+++ b/src/bolt_api_sdk/models/capture_transaction_with_reference.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -38,3 +39,19 @@ class CaptureTransactionWithReference(BaseModel):
skip_hook_notification: Optional[bool] = None
r"""Set to `true` to skip receiving a webhook notification from Bolt that is triggered by this update to the transaction."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["merchant_event_id", "skip_hook_notification"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/capture_view.py b/src/bolt_api_sdk/models/capture_view.py
index 94fcc87..174ba49 100644
--- a/src/bolt_api_sdk/models/capture_view.py
+++ b/src/bolt_api_sdk/models/capture_view.py
@@ -3,8 +3,9 @@
from __future__ import annotations
from .amount_view import AmountView, AmountViewTypedDict
from .capture_status import CaptureStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -41,6 +42,22 @@ class Split(BaseModel):
"""
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["amount", "type"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class CaptureViewTypedDict(TypedDict):
r"""Deprecated. Use `captures`."""
@@ -77,3 +94,21 @@ class CaptureView(BaseModel):
status: Optional[CaptureStatus] = None
r"""The status of the capture. **Nullable** for Transactions Details."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["amount", "id", "merchant_event_id", "metadata", "splits", "status"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/capturetransactionop.py b/src/bolt_api_sdk/models/capturetransactionop.py
index 426e207..1e4ef77 100644
--- a/src/bolt_api_sdk/models/capturetransactionop.py
+++ b/src/bolt_api_sdk/models/capturetransactionop.py
@@ -5,9 +5,10 @@
CaptureTransactionWithReference,
CaptureTransactionWithReferenceTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -35,6 +36,22 @@ class CaptureTransactionRequest(BaseModel):
] = None
r"""Capture a Transaction"""
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["Idempotency-Key", "capture_transaction_with_reference"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class ErrorTypedDict(TypedDict):
code: NotRequired[float]
@@ -49,6 +66,22 @@ class Error(BaseModel):
message: Optional[str] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["code", "field", "message"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class ResultTypedDict(TypedDict):
pass
diff --git a/src/bolt_api_sdk/models/cart_add_on.py b/src/bolt_api_sdk/models/cart_add_on.py
index 954eda3..1e082f0 100644
--- a/src/bolt_api_sdk/models/cart_add_on.py
+++ b/src/bolt_api_sdk/models/cart_add_on.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -46,3 +47,25 @@ class CartAddOn(BaseModel):
Optional[str], pydantic.Field(alias="productPageUrl")
] = None
r"""The URL to the product page of the product being displayed as an add on."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["description", "imageUrl", "productPageUrl"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ CartAddOn.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/cart_create.py b/src/bolt_api_sdk/models/cart_create.py
index dd7dfc7..cbfa0a4 100644
--- a/src/bolt_api_sdk/models/cart_create.py
+++ b/src/bolt_api_sdk/models/cart_create.py
@@ -10,7 +10,8 @@
from .cart_shipment import CartShipment, CartShipmentTypedDict
from .fulfillment import Fulfillment, FulfillmentTypedDict
from .in_store_cart_shipment import InStoreCartShipment, InStoreCartShipmentTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -91,3 +92,36 @@ class CartCreate(BaseModel):
order_description: Optional[str] = None
r"""Used optionally to pass additional information like order numbers or other IDs as needed."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "add_ons",
+ "billing_address",
+ "discounts",
+ "fees",
+ "fulfillments",
+ "in_store_cart_shipments",
+ "items",
+ "loyalty_rewards",
+ "shipments",
+ "tax_amount",
+ "cart_url",
+ "display_id",
+ "metadata",
+ "order_description",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_discount.py b/src/bolt_api_sdk/models/cart_discount.py
index 9afe2d8..4cf46e1 100644
--- a/src/bolt_api_sdk/models/cart_discount.py
+++ b/src/bolt_api_sdk/models/cart_discount.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -17,6 +18,7 @@ class CartDiscountDiscountCategory(str, Enum):
MEMBERSHIP_GIFTCARD = "membership_giftcard"
SUBSCRIPTION_DISCOUNT = "subscription_discount"
REWARDS_DISCOUNT = "rewards_discount"
+ SHIPPING_DISCOUNT = "shipping_discount"
UNKNOWN = "unknown"
@@ -60,3 +62,29 @@ class CartDiscount(BaseModel):
type: Optional[CartDiscountType] = None
r"""The type of discount."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "code",
+ "description",
+ "details_url",
+ "discount_category",
+ "reference",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_fee.py b/src/bolt_api_sdk/models/cart_fee.py
index 41e382d..0cb1d2f 100644
--- a/src/bolt_api_sdk/models/cart_fee.py
+++ b/src/bolt_api_sdk/models/cart_fee.py
@@ -42,30 +42,25 @@ class CartFee(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["description"]
- nullable_fields = ["name", "description"]
- null_default_fields = []
-
+ optional_fields = set(["description"])
+ nullable_fields = set(["name", "description"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/cart_item.py b/src/bolt_api_sdk/models/cart_item.py
index 72cd50d..3259b3e 100644
--- a/src/bolt_api_sdk/models/cart_item.py
+++ b/src/bolt_api_sdk/models/cart_item.py
@@ -197,86 +197,85 @@ class CartItem(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "brand",
- "category",
- "collections",
- "color",
- "customizations",
- "description",
- "details_url",
- "external_inputs",
- "gift_option",
- "image_url",
- "isbn",
- "item_group",
- "manufacturer",
- "merchant_product_id",
- "merchant_variant_id",
- "msrp",
- "options",
- "properties",
- "shipment",
- "shipment_type",
- "size",
- "sku",
- "source",
- "seller_id",
- "tags",
- "tax_amount",
- "tax_code",
- "taxable",
- "type",
- "uom",
- "upc",
- "weight",
- "weight_unit",
- ]
- nullable_fields = [
- "brand",
- "category",
- "color",
- "description",
- "isbn",
- "item_group",
- "manufacturer",
- "msrp",
- "options",
- "size",
- "sku",
- "source",
- "seller_id",
- "tags",
- "tax_amount",
- "tax_code",
- "taxable",
- "uom",
- "upc",
- "weight",
- "weight_unit",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "brand",
+ "category",
+ "collections",
+ "color",
+ "customizations",
+ "description",
+ "details_url",
+ "external_inputs",
+ "gift_option",
+ "image_url",
+ "isbn",
+ "item_group",
+ "manufacturer",
+ "merchant_product_id",
+ "merchant_variant_id",
+ "msrp",
+ "options",
+ "properties",
+ "shipment",
+ "shipment_type",
+ "size",
+ "sku",
+ "source",
+ "seller_id",
+ "tags",
+ "tax_amount",
+ "tax_code",
+ "taxable",
+ "type",
+ "uom",
+ "upc",
+ "weight",
+ "weight_unit",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "brand",
+ "category",
+ "color",
+ "description",
+ "isbn",
+ "item_group",
+ "manufacturer",
+ "msrp",
+ "options",
+ "size",
+ "sku",
+ "source",
+ "seller_id",
+ "tags",
+ "tax_amount",
+ "tax_code",
+ "taxable",
+ "uom",
+ "upc",
+ "weight",
+ "weight_unit",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/cart_item_customization.py b/src/bolt_api_sdk/models/cart_item_customization.py
index 9f44233..081dcb8 100644
--- a/src/bolt_api_sdk/models/cart_item_customization.py
+++ b/src/bolt_api_sdk/models/cart_item_customization.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, Optional
from typing_extensions import NotRequired, TypedDict
@@ -18,3 +19,19 @@ class CartItemCustomization(BaseModel):
name: Optional[str] = None
price: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["attributes", "name", "price"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_item_gift_option.py b/src/bolt_api_sdk/models/cart_item_gift_option.py
index ed2738b..1949261 100644
--- a/src/bolt_api_sdk/models/cart_item_gift_option.py
+++ b/src/bolt_api_sdk/models/cart_item_gift_option.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -33,3 +34,19 @@ class CartItemGiftOption(BaseModel):
wrap: Optional[bool] = None
r"""Defines whether gift wrapping was requested."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["cost", "merchant_product_id", "message", "wrap"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_item_property.py b/src/bolt_api_sdk/models/cart_item_property.py
index 637ead4..9647444 100644
--- a/src/bolt_api_sdk/models/cart_item_property.py
+++ b/src/bolt_api_sdk/models/cart_item_property.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -27,3 +28,21 @@ class CartItemProperty(BaseModel):
value: Optional[str] = None
value_id: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["color", "display", "name", "name_id", "value", "value_id"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_item_property_view.py b/src/bolt_api_sdk/models/cart_item_property_view.py
index 9250b86..01dceee 100644
--- a/src/bolt_api_sdk/models/cart_item_property_view.py
+++ b/src/bolt_api_sdk/models/cart_item_property_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -21,3 +22,19 @@ class CartItemPropertyView(BaseModel):
name: Optional[str] = None
value: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["color", "display", "name", "value"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_loyalty_rewards.py b/src/bolt_api_sdk/models/cart_loyalty_rewards.py
index 396fbcd..487418d 100644
--- a/src/bolt_api_sdk/models/cart_loyalty_rewards.py
+++ b/src/bolt_api_sdk/models/cart_loyalty_rewards.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -44,3 +45,29 @@ class CartLoyaltyRewards(BaseModel):
type: Optional[str] = None
r"""The type of loyalty reward."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "coupon_code",
+ "description",
+ "details",
+ "points",
+ "source",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_loyalty_rewards_view.py b/src/bolt_api_sdk/models/cart_loyalty_rewards_view.py
index 7d92138..8b2c704 100644
--- a/src/bolt_api_sdk/models/cart_loyalty_rewards_view.py
+++ b/src/bolt_api_sdk/models/cart_loyalty_rewards_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .amount_view import AmountView, AmountViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -31,3 +32,29 @@ class CartLoyaltyRewardsView(BaseModel):
source: Optional[str] = None
type: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "coupon_code",
+ "description",
+ "details",
+ "points",
+ "source",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_shipment.py b/src/bolt_api_sdk/models/cart_shipment.py
index d94ee7b..031bf53 100644
--- a/src/bolt_api_sdk/models/cart_shipment.py
+++ b/src/bolt_api_sdk/models/cart_shipment.py
@@ -3,7 +3,8 @@
from __future__ import annotations
from .address import Address, AddressTypedDict
from .cart_shipment_type import CartShipmentType
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -120,3 +121,43 @@ class CartShipment(BaseModel):
type: Optional[CartShipmentType] = None
r"""The type corresponding to this shipment, if applicable."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "carrier",
+ "cost",
+ "discounted_by_membership",
+ "estimated_delivery_date",
+ "expedited",
+ "package_depth",
+ "package_dimension_unit",
+ "package_height",
+ "package_type",
+ "package_weight_unit",
+ "package_width",
+ "service",
+ "shipping_address",
+ "shipping_address_id",
+ "shipping_method",
+ "signature",
+ "tax_amount",
+ "tax_code",
+ "total_weight",
+ "total_weight_unit",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/cart_view.py b/src/bolt_api_sdk/models/cart_view.py
index a0b0171..350b72b 100644
--- a/src/bolt_api_sdk/models/cart_view.py
+++ b/src/bolt_api_sdk/models/cart_view.py
@@ -13,7 +13,8 @@
from .i_cart_shipment_view import ICartShipmentView, ICartShipmentViewTypedDict
from .i_currency import ICurrency, ICurrencyTypedDict
from .in_store_shipment2 import InStoreShipment2, InStoreShipment2TypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -109,3 +110,46 @@ class CartView(BaseModel):
transaction_reference: Optional[str] = None
r"""The 12 digit reference ID associated to a given transaction webhook for an order."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "billing_address",
+ "cart_url",
+ "currency",
+ "discount_amount",
+ "discounts",
+ "display_id",
+ "fee_amount",
+ "fees",
+ "fulfillments",
+ "in_store_shipments",
+ "items",
+ "loyalty_rewards",
+ "loyalty_rewards_amount",
+ "merchant_order_url",
+ "metadata",
+ "msrp",
+ "order_description",
+ "order_reference",
+ "shipments",
+ "shipping_amount",
+ "subtotal_amount",
+ "tax_amount",
+ "total_amount",
+ "transaction_reference",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/chargeback_details.py b/src/bolt_api_sdk/models/chargeback_details.py
index 3f69997..f2c27f3 100644
--- a/src/bolt_api_sdk/models/chargeback_details.py
+++ b/src/bolt_api_sdk/models/chargeback_details.py
@@ -5,7 +5,8 @@
from .chargeback_event_view import ChargebackEventView, ChargebackEventViewTypedDict
from .chargeback_reason_code import ChargebackReasonCode
from .chargeback_representment_result import ChargebackRepresentmentResult
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -53,3 +54,32 @@ class ChargebackDetails(BaseModel):
representment_result: Optional[ChargebackRepresentmentResult] = None
r"""The result of the chargeback representment."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amt_won",
+ "chargeback_amt",
+ "chargeback_fee",
+ "chargeback_id",
+ "event_views",
+ "net_amt",
+ "reason",
+ "reason_code",
+ "representment_reply_by_date",
+ "representment_result",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/chargeback_details_view.py b/src/bolt_api_sdk/models/chargeback_details_view.py
index 665329b..d153d28 100644
--- a/src/bolt_api_sdk/models/chargeback_details_view.py
+++ b/src/bolt_api_sdk/models/chargeback_details_view.py
@@ -3,8 +3,9 @@
from __future__ import annotations
from .amount_view import AmountView, AmountViewTypedDict
from .chargeback_event_view import ChargebackEventView, ChargebackEventViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -51,3 +52,32 @@ class ChargebackDetailsView(BaseModel):
r"""The reply-by date of the dispute in UnixMillis format."""
representment_result: Optional[RepresentmentResult] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amt_won",
+ "chargeback_amt",
+ "chargeback_fee",
+ "chargeback_id",
+ "event_views",
+ "net_amt",
+ "reason",
+ "reason_code",
+ "representment_reply_by_date",
+ "representment_result",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/chargeback_event_view.py b/src/bolt_api_sdk/models/chargeback_event_view.py
index 1741e77..b36bc5a 100644
--- a/src/bolt_api_sdk/models/chargeback_event_view.py
+++ b/src/bolt_api_sdk/models/chargeback_event_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class ChargebackEventView(BaseModel):
content: Optional[str] = None
time: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["content", "time"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/consumer_billing_address.py b/src/bolt_api_sdk/models/consumer_billing_address.py
index 68b4e91..b7aad48 100644
--- a/src/bolt_api_sdk/models/consumer_billing_address.py
+++ b/src/bolt_api_sdk/models/consumer_billing_address.py
@@ -99,43 +99,40 @@ class ConsumerBillingAddress(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "name",
- "phone_number",
- "street_address2",
- "street_address3",
- "street_address4",
- ]
- nullable_fields = ["id"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "name",
+ "phone_number",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ ]
+ )
+ nullable_fields = set(["id"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/consumer_self_view.py b/src/bolt_api_sdk/models/consumer_self_view.py
index 0eb99b7..eb78c91 100644
--- a/src/bolt_api_sdk/models/consumer_self_view.py
+++ b/src/bolt_api_sdk/models/consumer_self_view.py
@@ -4,8 +4,9 @@
from .email_view import EmailView, EmailViewTypedDict
from .login_view import LoginView, LoginViewTypedDict
from .phone_view import PhoneView, PhoneViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -43,3 +44,30 @@ class ConsumerSelfView(BaseModel):
phones: Optional[List[PhoneView]] = None
platform_account_status: Optional[PlatformAccountStatus] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "first_name",
+ "id",
+ "last_name",
+ "authentication",
+ "email_verified",
+ "emails",
+ "phones",
+ "platform_account_status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/consumer_summary_view.py b/src/bolt_api_sdk/models/consumer_summary_view.py
index 5c9832a..1715ed3 100644
--- a/src/bolt_api_sdk/models/consumer_summary_view.py
+++ b/src/bolt_api_sdk/models/consumer_summary_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -22,3 +23,19 @@ class ConsumerSummaryView(BaseModel):
last_name: Optional[str] = None
r"""The surname of the person associated with this record."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["first_name", "id", "last_name"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/create_account_input.py b/src/bolt_api_sdk/models/create_account_input.py
index 689e2a1..0bc9e2e 100644
--- a/src/bolt_api_sdk/models/create_account_input.py
+++ b/src/bolt_api_sdk/models/create_account_input.py
@@ -4,7 +4,8 @@
from .address_account import AddressAccount, AddressAccountTypedDict
from .payment_method_account import PaymentMethodAccount, PaymentMethodAccountTypedDict
from .profile import Profile, ProfileTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -31,3 +32,19 @@ class CreateAccountInput(BaseModel):
payment_methods: Optional[List[PaymentMethodAccount]] = None
r"""A list of payment methods associated with this account."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["addresses", "payment_methods"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/createaccountop.py b/src/bolt_api_sdk/models/createaccountop.py
index eb53702..6167c9a 100644
--- a/src/bolt_api_sdk/models/createaccountop.py
+++ b/src/bolt_api_sdk/models/createaccountop.py
@@ -2,9 +2,10 @@
from __future__ import annotations
from .create_account_input import CreateAccountInput, CreateAccountInputTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -36,3 +37,21 @@ class CreateAccountRequest(BaseModel):
Optional[CreateAccountInput],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["X-Publishable-Key", "Idempotency-Key", "create_account_input"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/createtestingshopperaccountop.py b/src/bolt_api_sdk/models/createtestingshopperaccountop.py
index b038aea..f0c2331 100644
--- a/src/bolt_api_sdk/models/createtestingshopperaccountop.py
+++ b/src/bolt_api_sdk/models/createtestingshopperaccountop.py
@@ -5,9 +5,10 @@
TestingAccountRequest,
TestingAccountRequestTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -30,3 +31,19 @@ class CreateTestingShopperAccountRequest(BaseModel):
Optional[TestingAccountRequest],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "testing_account_request"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit.py b/src/bolt_api_sdk/models/credit.py
index 696e17b..7e96984 100644
--- a/src/bolt_api_sdk/models/credit.py
+++ b/src/bolt_api_sdk/models/credit.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -12,3 +13,19 @@ class CreditTypedDict(TypedDict):
class Credit(BaseModel):
status: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card.py b/src/bolt_api_sdk/models/credit_card.py
index 2f15b0c..d45c8be 100644
--- a/src/bolt_api_sdk/models/credit_card.py
+++ b/src/bolt_api_sdk/models/credit_card.py
@@ -2,8 +2,15 @@
from __future__ import annotations
from .address import Address, AddressTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import (
+ BaseModel,
+ Nullable,
+ OptionalNullable,
+ UNSET,
+ UNSET_SENTINEL,
+)
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -42,6 +49,8 @@ class CreditCardTypedDict(TypedDict):
r"""Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card."""
save: NotRequired[bool]
r"""Determines whether or not the credit card will be saved to the shopper's account. Defaults to `true`."""
+ affirm_vcn_token: NotRequired[Nullable[str]]
+ r"""The checkout token associated with Affirm VCN credit cards."""
class CreditCard(BaseModel):
@@ -73,3 +82,33 @@ class CreditCard(BaseModel):
save: Optional[bool] = None
r"""Determines whether or not the credit card will be saved to the shopper's account. Defaults to `true`."""
+
+ affirm_vcn_token: OptionalNullable[str] = UNSET
+ r"""The checkout token associated with Affirm VCN credit cards."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["billing_address", "priority", "save", "affirm_vcn_token"]
+ )
+ nullable_fields = set(["affirm_vcn_token"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_authorization_view.py b/src/bolt_api_sdk/models/credit_card_authorization_view.py
index 236a8c3..6744158 100644
--- a/src/bolt_api_sdk/models/credit_card_authorization_view.py
+++ b/src/bolt_api_sdk/models/credit_card_authorization_view.py
@@ -3,8 +3,9 @@
from __future__ import annotations
from .credit_card_authorization_reason import CreditCardAuthorizationReason
from .credit_card_authorization_status import CreditCardAuthorizationStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Dict, Optional
from typing_extensions import NotRequired, TypedDict
@@ -154,3 +155,30 @@ class CreditCardAuthorizationView(BaseModel):
* `3` - error
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "auth",
+ "avs_response",
+ "cvv_response",
+ "merchant_event_id",
+ "metadata",
+ "processor",
+ "reason",
+ "status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_capture_view.py b/src/bolt_api_sdk/models/credit_card_capture_view.py
index b4804b5..5f84fd5 100644
--- a/src/bolt_api_sdk/models/credit_card_capture_view.py
+++ b/src/bolt_api_sdk/models/credit_card_capture_view.py
@@ -7,7 +7,8 @@
TransactionSplitsView,
TransactionSplitsViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, Optional
from typing_extensions import NotRequired, TypedDict
@@ -39,3 +40,21 @@ class CreditCardCaptureView(BaseModel):
status: Optional[CaptureStatus] = None
r"""The status of the capture. **Nullable** for Transactions Details."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["amount", "id", "merchant_event_id", "metadata", "splits", "status"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_credit_view.py b/src/bolt_api_sdk/models/credit_card_credit_view.py
index d58d381..34ec5fd 100644
--- a/src/bolt_api_sdk/models/credit_card_credit_view.py
+++ b/src/bolt_api_sdk/models/credit_card_credit_view.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -30,3 +31,19 @@ class CreditCardCreditView(BaseModel):
merchant_event_id: Optional[str] = None
r"""The reference ID associated with a transaction event (auth, capture, refund, void). This is an arbitrary identifier created by the merchant. Bolt does not enforce any uniqueness constraints on this ID. It is up to the merchant to generate identifiers that properly fulfill its needs."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["status", "merchant_event_id"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_user.py b/src/bolt_api_sdk/models/credit_card_user.py
index 17fa5f9..9a718c6 100644
--- a/src/bolt_api_sdk/models/credit_card_user.py
+++ b/src/bolt_api_sdk/models/credit_card_user.py
@@ -6,7 +6,8 @@
PhonesWithCountryCode,
PhonesWithCountryCodeTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -43,3 +44,19 @@ class CreditCardUser(BaseModel):
phones: Optional[List[PhonesWithCountryCode]] = None
r"""A list of phone numbers."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["emails", "first_name", "id", "last_name", "phones"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_view.py b/src/bolt_api_sdk/models/credit_card_view.py
index fb86708..370ed27 100644
--- a/src/bolt_api_sdk/models/credit_card_view.py
+++ b/src/bolt_api_sdk/models/credit_card_view.py
@@ -7,7 +7,8 @@
from .card_status import CardStatus
from .card_token_type import CardTokenType
from .priority import Priority
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -91,3 +92,34 @@ class CreditCardView(BaseModel):
r"""Used to define which payment processor generated the token for this credit card.
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "billing_address",
+ "bin",
+ "display_network",
+ "expiration",
+ "icon_asset_path",
+ "id",
+ "last4",
+ "network",
+ "priority",
+ "status",
+ "token",
+ "token_type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_void.py b/src/bolt_api_sdk/models/credit_card_void.py
index 6d6520f..e66cdd4 100644
--- a/src/bolt_api_sdk/models/credit_card_void.py
+++ b/src/bolt_api_sdk/models/credit_card_void.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -24,3 +25,19 @@ class CreditCardVoid(BaseModel):
skip_hook_notification: Optional[bool] = None
r"""Set to `true` to skip receiving a webhook notification from Bolt that is triggered by this update to the transaction."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["merchant_event_id", "skip_hook_notification"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/credit_card_void_view.py b/src/bolt_api_sdk/models/credit_card_void_view.py
index 0971369..8487f0f 100644
--- a/src/bolt_api_sdk/models/credit_card_void_view.py
+++ b/src/bolt_api_sdk/models/credit_card_void_view.py
@@ -3,7 +3,8 @@
from __future__ import annotations
from .credit_card_void_cause import CreditCardVoidCause
from .credit_card_void_status import CreditCardVoidStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -31,3 +32,19 @@ class CreditCardVoidView(BaseModel):
void: Optional[str] = None
r"""The void ID returned from the payment processor."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["cause", "merchant_event_id", "status", "void"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/custom_field_full_response_view.py b/src/bolt_api_sdk/models/custom_field_full_response_view.py
index 9058a6f..f7ac9e2 100644
--- a/src/bolt_api_sdk/models/custom_field_full_response_view.py
+++ b/src/bolt_api_sdk/models/custom_field_full_response_view.py
@@ -6,7 +6,8 @@
CustomFieldResponseViewTypedDict,
)
from .custom_field_view import CustomFieldView, CustomFieldViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -20,3 +21,19 @@ class CustomFieldFullResponseView(BaseModel):
field: Optional[CustomFieldView] = None
response: Optional[CustomFieldResponseView] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["field", "response"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/custom_field_response_view.py b/src/bolt_api_sdk/models/custom_field_response_view.py
index 240bec5..468ee75 100644
--- a/src/bolt_api_sdk/models/custom_field_response_view.py
+++ b/src/bolt_api_sdk/models/custom_field_response_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
@@ -18,3 +19,19 @@ class CustomFieldResponseViewTypedDict(TypedDict):
class CustomFieldResponseView(BaseModel):
response: Optional[Response] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["response"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/custom_field_view.py b/src/bolt_api_sdk/models/custom_field_view.py
index ad0e051..8b1ea45 100644
--- a/src/bolt_api_sdk/models/custom_field_view.py
+++ b/src/bolt_api_sdk/models/custom_field_view.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -55,3 +56,38 @@ class CustomFieldView(BaseModel):
subscribe_to_newsletter: Annotated[
Optional[bool], pydantic.Field(alias="subscribeToNewsletter")
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "checkout_step",
+ "dynamic",
+ "context",
+ "external_id",
+ "field_setup",
+ "label",
+ "position",
+ "public_id",
+ "required",
+ "subscribeToNewsletter",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ CustomFieldView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/custom_fields.py b/src/bolt_api_sdk/models/custom_fields.py
index 7a8c9d2..294ac5c 100644
--- a/src/bolt_api_sdk/models/custom_fields.py
+++ b/src/bolt_api_sdk/models/custom_fields.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -68,3 +69,32 @@ class CustomFields(BaseModel):
subscribe_to_newsletter: Optional[bool] = None
r"""Defines whether the shopper is opted into a newsletter or not."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "checkout_setup",
+ "dynamic",
+ "context",
+ "external_id",
+ "field_setup",
+ "label",
+ "position",
+ "public_id",
+ "required",
+ "subscribe_to_newsletter",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/customer_list_status.py b/src/bolt_api_sdk/models/customer_list_status.py
index 8c0259e..0411d9d 100644
--- a/src/bolt_api_sdk/models/customer_list_status.py
+++ b/src/bolt_api_sdk/models/customer_list_status.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class CustomerListStatus(BaseModel):
auto_approved: Optional[bool] = None
block_listed: Optional[bool] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["auto_approved", "block_listed"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/deleteaddressop.py b/src/bolt_api_sdk/models/deleteaddressop.py
index d5a1d78..16a7f42 100644
--- a/src/bolt_api_sdk/models/deleteaddressop.py
+++ b/src/bolt_api_sdk/models/deleteaddressop.py
@@ -1,7 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import (
FieldMetadata,
HeaderMetadata,
@@ -9,6 +9,7 @@
SecurityMetadata,
)
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -23,7 +24,10 @@ class DeleteAddressSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -35,6 +39,7 @@ class DeleteAddressSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -60,3 +65,19 @@ class DeleteAddressRequest(BaseModel):
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED]."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/deletepaymentmethodop.py b/src/bolt_api_sdk/models/deletepaymentmethodop.py
index feafd7b..05c75a7 100644
--- a/src/bolt_api_sdk/models/deletepaymentmethodop.py
+++ b/src/bolt_api_sdk/models/deletepaymentmethodop.py
@@ -1,7 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import (
FieldMetadata,
HeaderMetadata,
@@ -9,6 +9,7 @@
SecurityMetadata,
)
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -23,7 +24,10 @@ class DeletePaymentMethodSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -35,6 +39,7 @@ class DeletePaymentMethodSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -60,3 +65,19 @@ class DeletePaymentMethodRequest(BaseModel):
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED]."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/detectaccountop.py b/src/bolt_api_sdk/models/detectaccountop.py
index 80c4898..fe9986c 100644
--- a/src/bolt_api_sdk/models/detectaccountop.py
+++ b/src/bolt_api_sdk/models/detectaccountop.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -44,3 +45,19 @@ class DetectAccountRequest(BaseModel):
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""The shopper's phone number. Includes country code (e.g. +1); does not include dashes or spaces. Can be used to detect an account instead of `sha256_email` or `email`."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["email", "sha256_email", "phone"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/digital_delivery.py b/src/bolt_api_sdk/models/digital_delivery.py
index ca44e08..c94c15e 100644
--- a/src/bolt_api_sdk/models/digital_delivery.py
+++ b/src/bolt_api_sdk/models/digital_delivery.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class DigitalDelivery(BaseModel):
email: Optional[str] = None
phone: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["email", "phone"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/editaddressop.py b/src/bolt_api_sdk/models/editaddressop.py
index 7bc73e9..081e7b7 100644
--- a/src/bolt_api_sdk/models/editaddressop.py
+++ b/src/bolt_api_sdk/models/editaddressop.py
@@ -34,7 +34,10 @@ class EditAddressSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -46,6 +49,7 @@ class EditAddressSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -78,6 +82,22 @@ class EditAddressRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "address_account"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class EditAddressPriority(str, Enum):
r"""The shopper-indicated priority of this address compared to other addresses on their account."""
@@ -203,59 +223,58 @@ class EditAddressResponse(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "door_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "locality",
- "name",
- "phone_number",
- "postal_code",
- "priority",
- "region",
- "region_code",
- "street_address1",
- "street_address2",
- "street_address3",
- "street_address4",
- "metadata",
- "default",
- ]
- nullable_fields = [
- "door_code",
- "priority",
- "region_code",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "door_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "locality",
+ "name",
+ "phone_number",
+ "postal_code",
+ "priority",
+ "region",
+ "region_code",
+ "street_address1",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ "default",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "priority",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/eligible_payment_method.py b/src/bolt_api_sdk/models/eligible_payment_method.py
index 91b89c5..f41c5fd 100644
--- a/src/bolt_api_sdk/models/eligible_payment_method.py
+++ b/src/bolt_api_sdk/models/eligible_payment_method.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .payment_service import PaymentService
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -16,3 +17,19 @@ class EligiblePaymentMethod(BaseModel):
eligible: Optional[bool] = None
transaction_processor_type: Optional[PaymentService] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["eligible", "transaction_processor_type"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/email_view.py b/src/bolt_api_sdk/models/email_view.py
index 5888804..8e020b7 100644
--- a/src/bolt_api_sdk/models/email_view.py
+++ b/src/bolt_api_sdk/models/email_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .priority import Priority
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -28,3 +29,19 @@ class EmailView(BaseModel):
"""
status: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["address", "id", "priority", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/emails.py b/src/bolt_api_sdk/models/emails.py
index 75e30b0..a649176 100644
--- a/src/bolt_api_sdk/models/emails.py
+++ b/src/bolt_api_sdk/models/emails.py
@@ -3,7 +3,8 @@
from __future__ import annotations
from .email_priority import EmailPriority
from .email_status import EmailStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -35,3 +36,19 @@ class Emails(BaseModel):
status: Optional[EmailStatus] = None
r"""This is the status of the contact method."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["address", "id", "priority", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/error_bolt_api.py b/src/bolt_api_sdk/models/error_bolt_api.py
index 04828cd..6cf361a 100644
--- a/src/bolt_api_sdk/models/error_bolt_api.py
+++ b/src/bolt_api_sdk/models/error_bolt_api.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -23,3 +24,19 @@ class ErrorBoltAPI(BaseModel):
message: Optional[str] = None
r"""Human-readable description of the error for developers. Should not be shown to users and is not localized."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["code", "message"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/event_group_create_webhook.py b/src/bolt_api_sdk/models/event_group_create_webhook.py
index fa3203e..e7aede5 100644
--- a/src/bolt_api_sdk/models/event_group_create_webhook.py
+++ b/src/bolt_api_sdk/models/event_group_create_webhook.py
@@ -40,30 +40,25 @@ class EventGroupCreateWebhook(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["event_group"]
- nullable_fields = ["event_group"]
- null_default_fields = []
-
+ optional_fields = set(["event_group"])
+ nullable_fields = set(["event_group"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/events_array_create_webhook.py b/src/bolt_api_sdk/models/events_array_create_webhook.py
index 1191aef..782ae45 100644
--- a/src/bolt_api_sdk/models/events_array_create_webhook.py
+++ b/src/bolt_api_sdk/models/events_array_create_webhook.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .webhooks_type import WebhooksType
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -29,3 +30,19 @@ class EventsArrayCreateWebhook(BaseModel):
r"""If `webhook_event_group` is null, pick a list of notification events to subscribe to.
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["events"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/fulfillment.py b/src/bolt_api_sdk/models/fulfillment.py
index 8f582bc..102d856 100644
--- a/src/bolt_api_sdk/models/fulfillment.py
+++ b/src/bolt_api_sdk/models/fulfillment.py
@@ -5,8 +5,9 @@
from .cart_shipment import CartShipment, CartShipmentTypedDict
from .digital_delivery import DigitalDelivery, DigitalDeliveryTypedDict
from .in_store_cart_shipment import InStoreCartShipment, InStoreCartShipmentTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -43,3 +44,27 @@ class Fulfillment(BaseModel):
in_store_cart_shipment: Optional[InStoreCartShipment] = None
type: Optional[FulfillmentType] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "cart_items",
+ "cart_shipment",
+ "digital_delivery",
+ "in_store_cart_shipment",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/fulfillment_view.py b/src/bolt_api_sdk/models/fulfillment_view.py
index e3d81e1..6229291 100644
--- a/src/bolt_api_sdk/models/fulfillment_view.py
+++ b/src/bolt_api_sdk/models/fulfillment_view.py
@@ -4,7 +4,8 @@
from .i_cart_item_view import ICartItemView, ICartItemViewTypedDict
from .i_cart_shipment_view import ICartShipmentView, ICartShipmentViewTypedDict
from .in_store_shipment2 import InStoreShipment2, InStoreShipment2TypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -29,3 +30,27 @@ class FulfillmentView(BaseModel):
r"""A cart that is being prepared for shipment"""
items: Optional[List[ICartItemView]] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "cart_shipment",
+ "fulfillment_type",
+ "id",
+ "in_store_cart_shipment",
+ "items",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/getaccountop.py b/src/bolt_api_sdk/models/getaccountop.py
index 9516699..2ed788d 100644
--- a/src/bolt_api_sdk/models/getaccountop.py
+++ b/src/bolt_api_sdk/models/getaccountop.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, SecurityMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -18,7 +19,10 @@ class GetAccountSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -30,6 +34,7 @@ class GetAccountSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -48,3 +53,19 @@ class GetAccountRequest(BaseModel):
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
] = None
r"""The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED]."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/gettestcreditcardtokenop.py b/src/bolt_api_sdk/models/gettestcreditcardtokenop.py
index 61020f5..4f76f28 100644
--- a/src/bolt_api_sdk/models/gettestcreditcardtokenop.py
+++ b/src/bolt_api_sdk/models/gettestcreditcardtokenop.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -38,3 +39,19 @@ class GetTestCreditCardTokenResponse(BaseModel):
network: Optional[str] = None
r"""The credit card network."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["token", "expiry", "last4", "bin", "network"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/gift_option_view.py b/src/bolt_api_sdk/models/gift_option_view.py
index c48ffd0..18e2d7f 100644
--- a/src/bolt_api_sdk/models/gift_option_view.py
+++ b/src/bolt_api_sdk/models/gift_option_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class GiftOptionView(BaseModel):
hide_gift_message: Optional[bool] = None
hide_gift_wrap: Optional[bool] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["hide_gift_message", "hide_gift_wrap"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/gift_options.py b/src/bolt_api_sdk/models/gift_options.py
index b0a0d29..320f9e5 100644
--- a/src/bolt_api_sdk/models/gift_options.py
+++ b/src/bolt_api_sdk/models/gift_options.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -23,3 +24,19 @@ class GiftOptions(BaseModel):
wrap: Optional[bool] = None
r"""Defines whether gift wrapping was requested."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["message", "wrap"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_authorize_result_view.py b/src/bolt_api_sdk/models/i_authorize_result_view.py
index 47f3f26..8dd70ba 100644
--- a/src/bolt_api_sdk/models/i_authorize_result_view.py
+++ b/src/bolt_api_sdk/models/i_authorize_result_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .transaction_view import TransactionView, TransactionViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,21 @@ class IAuthorizeResultView(BaseModel):
order_number: Optional[str] = None
transaction: Optional[TransactionView] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["did_create_bolt_account", "order_number", "transaction"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_cart_discount_view.py b/src/bolt_api_sdk/models/i_cart_discount_view.py
index 77b1f01..56dece8 100644
--- a/src/bolt_api_sdk/models/i_cart_discount_view.py
+++ b/src/bolt_api_sdk/models/i_cart_discount_view.py
@@ -6,8 +6,9 @@
IFreeShippingDiscountView,
IFreeShippingDiscountViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -22,6 +23,7 @@ class ICartDiscountViewDiscountCategory(str, Enum):
MEMBERSHIP_GIFTCARD = "membership_giftcard"
SUBSCRIPTION_DISCOUNT = "subscription_discount"
REWARDS_DISCOUNT = "rewards_discount"
+ SHIPPING_DISCOUNT = "shipping_discount"
UNKNOWN = "unknown"
@@ -57,3 +59,29 @@ class ICartDiscountView(BaseModel):
reference: Optional[str] = None
r"""Used to define the reference ID associated with the discount available."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "code",
+ "description",
+ "details_url",
+ "discount_category",
+ "free_shipping",
+ "reference",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_cart_fee_view.py b/src/bolt_api_sdk/models/i_cart_fee_view.py
index 3c4d16e..0ec85c5 100644
--- a/src/bolt_api_sdk/models/i_cart_fee_view.py
+++ b/src/bolt_api_sdk/models/i_cart_fee_view.py
@@ -44,37 +44,34 @@ class ICartFeeView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "reference",
- "name",
- "description",
- "unit_price",
- "unit_tax_amount",
- "quantity",
- ]
- nullable_fields = ["name", "description"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "reference",
+ "name",
+ "description",
+ "unit_price",
+ "unit_tax_amount",
+ "quantity",
+ ]
+ )
+ nullable_fields = set(["name", "description"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/i_cart_item_external_inputs.py b/src/bolt_api_sdk/models/i_cart_item_external_inputs.py
index e00a6fd..d379790 100644
--- a/src/bolt_api_sdk/models/i_cart_item_external_inputs.py
+++ b/src/bolt_api_sdk/models/i_cart_item_external_inputs.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -18,3 +19,25 @@ class ICartItemExternalInputs(BaseModel):
shopify_product_reference: Optional[float] = None
shopify_product_variant_reference: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "shopify_line_item_reference",
+ "shopify_product_reference",
+ "shopify_product_variant_reference",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_cart_item_view.py b/src/bolt_api_sdk/models/i_cart_item_view.py
index d9c3ce4..b72ccdc 100644
--- a/src/bolt_api_sdk/models/i_cart_item_view.py
+++ b/src/bolt_api_sdk/models/i_cart_item_view.py
@@ -187,70 +187,67 @@ class ICartItemView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "bolt_product_id",
- "brand",
- "category",
- "collections",
- "color",
- "customizations",
- "description",
- "details_url",
- "gift_option",
- "hide",
- "image_url",
- "isbn",
- "item_group",
- "manufacturer",
- "merchant_product_id",
- "merchant_variant_id",
- "msrp",
- "name",
- "options",
- "properties",
- "quantity",
- "reference",
- "shipment_id",
- "shipment_type",
- "shopify_line_item_reference",
- "shopify_product_reference",
- "shopify_product_variant_reference",
- "size",
- "sku",
- "subscription",
- "tags",
- "tax_amount",
- "taxable",
- "total_amount",
- "type",
- "unit_price",
- "uom",
- "upc",
- "weight",
- ]
- nullable_fields = ["category", "isbn", "manufacturer", "sku", "uom", "upc"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "bolt_product_id",
+ "brand",
+ "category",
+ "collections",
+ "color",
+ "customizations",
+ "description",
+ "details_url",
+ "gift_option",
+ "hide",
+ "image_url",
+ "isbn",
+ "item_group",
+ "manufacturer",
+ "merchant_product_id",
+ "merchant_variant_id",
+ "msrp",
+ "name",
+ "options",
+ "properties",
+ "quantity",
+ "reference",
+ "shipment_id",
+ "shipment_type",
+ "shopify_line_item_reference",
+ "shopify_product_reference",
+ "shopify_product_variant_reference",
+ "size",
+ "sku",
+ "subscription",
+ "tags",
+ "tax_amount",
+ "taxable",
+ "total_amount",
+ "type",
+ "unit_price",
+ "uom",
+ "upc",
+ "weight",
+ ]
+ )
+ nullable_fields = set(["category", "isbn", "manufacturer", "sku", "uom", "upc"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/i_cart_shipment_view.py b/src/bolt_api_sdk/models/i_cart_shipment_view.py
index ad63cb7..b3f441c 100644
--- a/src/bolt_api_sdk/models/i_cart_shipment_view.py
+++ b/src/bolt_api_sdk/models/i_cart_shipment_view.py
@@ -7,8 +7,9 @@
from .i_description_part import IDescriptionPart, IDescriptionPartTypedDict
from .i_description_tooltip import IDescriptionTooltip, IDescriptionTooltipTypedDict
from .i_weight import IWeight, IWeightTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from datetime import datetime
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -29,6 +30,22 @@ class ICartShipmentViewPackageDimension(BaseModel):
width: Optional[float] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["depth", "height", "unit", "width"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class ICartShipmentViewTypedDict(TypedDict):
carrier: NotRequired[str]
@@ -101,3 +118,42 @@ class ICartShipmentView(BaseModel):
total_weight: Optional[IWeight] = None
type: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "carrier",
+ "cost",
+ "default",
+ "description",
+ "description_tooltips",
+ "estimated_delivery_date",
+ "expedited",
+ "gift_options",
+ "id",
+ "package_dimension",
+ "package_type",
+ "package_weight",
+ "reference",
+ "service",
+ "shipping_address",
+ "shipping_method",
+ "signature",
+ "tax_amount",
+ "total_weight",
+ "type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_cart_view.py b/src/bolt_api_sdk/models/i_cart_view.py
index 07beb28..71437fa 100644
--- a/src/bolt_api_sdk/models/i_cart_view.py
+++ b/src/bolt_api_sdk/models/i_cart_view.py
@@ -8,7 +8,8 @@
from .i_cart_item_view import ICartItemView, ICartItemViewTypedDict
from .i_cart_shipment_view import ICartShipmentView, ICartShipmentViewTypedDict
from .i_currency import ICurrency, ICurrencyTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -84,3 +85,40 @@ class ICartView(BaseModel):
transaction_reference: Optional[str] = None
r"""The 12 digit reference ID associated to a given transaction webhook for an order."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "billing_address",
+ "cart_url",
+ "currency",
+ "discount_amount",
+ "discounts",
+ "display_id",
+ "fee_amount",
+ "fees",
+ "items",
+ "merchant_order_url",
+ "order_description",
+ "order_reference",
+ "shipments",
+ "shipping_amount",
+ "subtotal_amount",
+ "tax_amount",
+ "total_amount",
+ "transaction_reference",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_currency.py b/src/bolt_api_sdk/models/i_currency.py
index 0429884..f0bb666 100644
--- a/src/bolt_api_sdk/models/i_currency.py
+++ b/src/bolt_api_sdk/models/i_currency.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class ICurrency(BaseModel):
currency: Optional[str] = None
currency_symbol: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["currency", "currency_symbol"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_custom_field_view.py b/src/bolt_api_sdk/models/i_custom_field_view.py
index 3cb6523..0a9e81c 100644
--- a/src/bolt_api_sdk/models/i_custom_field_view.py
+++ b/src/bolt_api_sdk/models/i_custom_field_view.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -58,3 +59,39 @@ class ICustomFieldView(BaseModel):
subscribe_to_newsletter: Annotated[
Optional[bool], pydantic.Field(alias="subscribeToNewsletter")
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "checkout_step",
+ "dynamic",
+ "context",
+ "external_id",
+ "field_setup",
+ "helper_text",
+ "label",
+ "position",
+ "public_id",
+ "required",
+ "subscribeToNewsletter",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ ICustomFieldView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/i_description_part.py b/src/bolt_api_sdk/models/i_description_part.py
index 8bc6d9d..3edffe8 100644
--- a/src/bolt_api_sdk/models/i_description_part.py
+++ b/src/bolt_api_sdk/models/i_description_part.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class IDescriptionPart(BaseModel):
content: Optional[str] = None
is_html: Optional[bool] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["content", "is_html"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_description_tooltip.py b/src/bolt_api_sdk/models/i_description_tooltip.py
index 01705f0..95487e4 100644
--- a/src/bolt_api_sdk/models/i_description_tooltip.py
+++ b/src/bolt_api_sdk/models/i_description_tooltip.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class IDescriptionTooltip(BaseModel):
html_content: Optional[str] = None
target: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["html_content", "target"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_free_shipping_discount_view.py b/src/bolt_api_sdk/models/i_free_shipping_discount_view.py
index 21f0da9..5bc5252 100644
--- a/src/bolt_api_sdk/models/i_free_shipping_discount_view.py
+++ b/src/bolt_api_sdk/models/i_free_shipping_discount_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class IFreeShippingDiscountView(BaseModel):
is_free_shipping: Optional[bool] = None
maximum_cost_allowed: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["is_free_shipping", "maximum_cost_allowed"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_gift_option_view.py b/src/bolt_api_sdk/models/i_gift_option_view.py
index a0f17a2..b4a24ca 100644
--- a/src/bolt_api_sdk/models/i_gift_option_view.py
+++ b/src/bolt_api_sdk/models/i_gift_option_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class IGiftOptionView(BaseModel):
hide_gift_message: Optional[bool] = None
hide_gift_wrap: Optional[bool] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["hide_gift_message", "hide_gift_wrap"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_order_dynamic_content.py b/src/bolt_api_sdk/models/i_order_dynamic_content.py
index d829853..71789bc 100644
--- a/src/bolt_api_sdk/models/i_order_dynamic_content.py
+++ b/src/bolt_api_sdk/models/i_order_dynamic_content.py
@@ -7,8 +7,9 @@
)
from .i_custom_field_view import ICustomFieldView, ICustomFieldViewTypedDict
from .i_gift_option_view import IGiftOptionView, IGiftOptionViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -53,3 +54,30 @@ class IOrderDynamicContent(BaseModel):
shipping_info_notice: Optional[str] = None
shipping_notice: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "custom_fields",
+ "eligible_payment_methods",
+ "gift_option_view",
+ "hide_apm",
+ "order_notice",
+ "payment_notice",
+ "shipping_info_notice",
+ "shipping_notice",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_order_external_data.py b/src/bolt_api_sdk/models/i_order_external_data.py
index 8fdb2fc..bd3d754 100644
--- a/src/bolt_api_sdk/models/i_order_external_data.py
+++ b/src/bolt_api_sdk/models/i_order_external_data.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -12,3 +13,19 @@ class IOrderExternalDataTypedDict(TypedDict):
class IOrderExternalData(BaseModel):
steam_id: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["steam_id"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_order_metadata.py b/src/bolt_api_sdk/models/i_order_metadata.py
index e86fa2a..5116f67 100644
--- a/src/bolt_api_sdk/models/i_order_metadata.py
+++ b/src/bolt_api_sdk/models/i_order_metadata.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -12,3 +13,19 @@ class IOrderMetadataTypedDict(TypedDict):
class IOrderMetadata(BaseModel):
encrypted_user_id: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["encrypted_user_id"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_order_view.py b/src/bolt_api_sdk/models/i_order_view.py
index 5a9bfa7..9444244 100644
--- a/src/bolt_api_sdk/models/i_order_view.py
+++ b/src/bolt_api_sdk/models/i_order_view.py
@@ -4,7 +4,8 @@
from .i_cart_view import ICartView, ICartViewTypedDict
from .i_order_dynamic_content import IOrderDynamicContent, IOrderDynamicContentTypedDict
from .i_order_external_data import IOrderExternalData, IOrderExternalDataTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -31,3 +32,21 @@ class IOrderView(BaseModel):
user_note: Optional[str] = None
r"""Used by shoppers to make extra requests or provide details for gift messages."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["cart", "dynamic_content", "external_data", "token", "user_note"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/i_weight.py b/src/bolt_api_sdk/models/i_weight.py
index e96f213..cfe2408 100644
--- a/src/bolt_api_sdk/models/i_weight.py
+++ b/src/bolt_api_sdk/models/i_weight.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class IWeight(BaseModel):
unit: Optional[str] = None
weight: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["unit", "weight"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/in_store_cart_shipment.py b/src/bolt_api_sdk/models/in_store_cart_shipment.py
index 72f3c53..e0a397d 100644
--- a/src/bolt_api_sdk/models/in_store_cart_shipment.py
+++ b/src/bolt_api_sdk/models/in_store_cart_shipment.py
@@ -3,8 +3,9 @@
from __future__ import annotations
from .address import Address, AddressTypedDict
from .cart_shipment import CartShipment, CartShipmentTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -49,3 +50,30 @@ class InStoreCartShipment(BaseModel):
store_name: Optional[str] = None
r"""The local store's name where the item can be picked up."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "cart_shipment",
+ "description",
+ "distance",
+ "distance_unit",
+ "in_store_pickup_address",
+ "pickup_window_close",
+ "pickup_window_open",
+ "store_name",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/in_store_shipment.py b/src/bolt_api_sdk/models/in_store_shipment.py
index e9ec6e2..705ef30 100644
--- a/src/bolt_api_sdk/models/in_store_shipment.py
+++ b/src/bolt_api_sdk/models/in_store_shipment.py
@@ -10,7 +10,8 @@
from .package_dimension import PackageDimension, PackageDimensionTypedDict
from .package_weights import PackageWeights, PackageWeightsTypedDict
from .total_weight import TotalWeight, TotalWeightTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -99,3 +100,39 @@ class InStoreShipment(BaseModel):
r"""The amount. **Nullable** for Transactions Details."""
total_weight: Optional[TotalWeight] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "carrier",
+ "cost",
+ "default",
+ "estimated_delivery_date",
+ "expedited",
+ "gift_options",
+ "id",
+ "package_dimension",
+ "package_type",
+ "package_weights",
+ "reference",
+ "service",
+ "shipping_address",
+ "shipping_method",
+ "signature",
+ "tax_amount",
+ "total_weight",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/in_store_shipment2.py b/src/bolt_api_sdk/models/in_store_shipment2.py
index a2dd60d..6102364 100644
--- a/src/bolt_api_sdk/models/in_store_shipment2.py
+++ b/src/bolt_api_sdk/models/in_store_shipment2.py
@@ -3,8 +3,9 @@
from __future__ import annotations
from .address_view import AddressView, AddressViewTypedDict
from .in_store_shipment import InStoreShipment, InStoreShipmentTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -40,3 +41,21 @@ class InStoreShipment2(BaseModel):
r"""A cart that is being prepared for shipment"""
store_name: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["address", "distance", "distance_unit", "shipment", "store_name"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/item.py b/src/bolt_api_sdk/models/item.py
index 6a89827..6055c69 100644
--- a/src/bolt_api_sdk/models/item.py
+++ b/src/bolt_api_sdk/models/item.py
@@ -7,7 +7,8 @@
from .metadata_component import MetadataComponent, MetadataComponentTypedDict
from .total_weight import TotalWeight, TotalWeightTypedDict
from .type import Type
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -168,3 +169,46 @@ class Item(BaseModel):
upc: Optional[str] = None
weight: Optional[TotalWeight] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "bolt_product_id",
+ "brand",
+ "category",
+ "collections",
+ "color",
+ "customizations",
+ "description",
+ "details_url",
+ "image_url",
+ "isbn",
+ "item_group",
+ "manufacturer",
+ "options",
+ "properties",
+ "shipment_type",
+ "size",
+ "sku",
+ "tags",
+ "tax_amount",
+ "taxable",
+ "type",
+ "uom",
+ "upc",
+ "weight",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/item_property.py b/src/bolt_api_sdk/models/item_property.py
index 82e251a..53dc346 100644
--- a/src/bolt_api_sdk/models/item_property.py
+++ b/src/bolt_api_sdk/models/item_property.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class ItemProperty(BaseModel):
name: Optional[str] = None
value: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["name", "value"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/login_view.py b/src/bolt_api_sdk/models/login_view.py
index d0f9869..290a6c5 100644
--- a/src/bolt_api_sdk/models/login_view.py
+++ b/src/bolt_api_sdk/models/login_view.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -31,3 +32,19 @@ class LoginView(BaseModel):
methods: Optional[List[Method]] = None
sso_authorization_url: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["actions", "methods", "sso_authorization_url"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/manual_dispute_view.py b/src/bolt_api_sdk/models/manual_dispute_view.py
index 0b5e490..acfe881 100644
--- a/src/bolt_api_sdk/models/manual_dispute_view.py
+++ b/src/bolt_api_sdk/models/manual_dispute_view.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -46,3 +47,32 @@ class ManualDisputeView(BaseModel):
reason: Optional[str] = None
status: Optional[ManualDisputeViewStatus] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "currency",
+ "delivery_evidence",
+ "delivery_link",
+ "dispute_evidence",
+ "dispute_link",
+ "other_evidence",
+ "other_link",
+ "reason",
+ "status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/manual_disputes.py b/src/bolt_api_sdk/models/manual_disputes.py
index e338d3e..0eaacbb 100644
--- a/src/bolt_api_sdk/models/manual_disputes.py
+++ b/src/bolt_api_sdk/models/manual_disputes.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -50,3 +51,32 @@ class ManualDisputes(BaseModel):
reason: Optional[str] = None
status: Optional[ManualDisputesStatus] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "currency",
+ "delivery_evidence",
+ "delivery_link",
+ "dispute_evidence",
+ "dispute_link",
+ "other_evidence",
+ "other_link",
+ "reason",
+ "status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/marketplace_commission_fee.py b/src/bolt_api_sdk/models/marketplace_commission_fee.py
index 8eca18c..e7e9ff6 100644
--- a/src/bolt_api_sdk/models/marketplace_commission_fee.py
+++ b/src/bolt_api_sdk/models/marketplace_commission_fee.py
@@ -38,30 +38,25 @@ class MarketplaceCommissionFee(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["metadata"]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(["metadata"])
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/merchant.py b/src/bolt_api_sdk/models/merchant.py
index 1df533c..97ede3d 100644
--- a/src/bolt_api_sdk/models/merchant.py
+++ b/src/bolt_api_sdk/models/merchant.py
@@ -8,7 +8,8 @@
TransactionOperationalProcessorTypedDict,
)
from .transaction_processor import TransactionProcessor
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -68,3 +69,19 @@ class Merchant(BaseModel):
* `3` - Offboarding
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["onboarding_status", "public_id", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_callbacks_view.py b/src/bolt_api_sdk/models/merchant_callbacks_view.py
index 6dcb9b1..e2f3d26 100644
--- a/src/bolt_api_sdk/models/merchant_callbacks_view.py
+++ b/src/bolt_api_sdk/models/merchant_callbacks_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .merchant_callback_url_type import MerchantCallbackURLType
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -21,6 +22,22 @@ class MerchantCallbacksViewCallbackURL(BaseModel):
url: Optional[str] = None
r"""The full callback URL."""
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["type", "url"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class MerchantCallbacksViewTypedDict(TypedDict):
callback_urls: NotRequired[List[MerchantCallbacksViewCallbackURLTypedDict]]
@@ -30,3 +47,19 @@ class MerchantCallbacksViewTypedDict(TypedDict):
class MerchantCallbacksView(BaseModel):
callback_urls: Optional[List[MerchantCallbacksViewCallbackURL]] = None
r"""List of callback URLs retrieved"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["callback_urls"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_credit_card_authorization.py b/src/bolt_api_sdk/models/merchant_credit_card_authorization.py
index 6a204c9..c5ef385 100644
--- a/src/bolt_api_sdk/models/merchant_credit_card_authorization.py
+++ b/src/bolt_api_sdk/models/merchant_credit_card_authorization.py
@@ -133,36 +133,33 @@ class MerchantCreditCardAuthorization(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "auto_capture",
- "merchant_event_id",
- "previous_transaction_id",
- "processing_initiator",
- "shipping_address",
- ]
- nullable_fields = ["previous_transaction_id"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "auto_capture",
+ "merchant_event_id",
+ "previous_transaction_id",
+ "processing_initiator",
+ "shipping_address",
+ ]
+ )
+ nullable_fields = set(["previous_transaction_id"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/merchant_credit_card_authorization_recharge.py b/src/bolt_api_sdk/models/merchant_credit_card_authorization_recharge.py
index c8cc440..a8230bf 100644
--- a/src/bolt_api_sdk/models/merchant_credit_card_authorization_recharge.py
+++ b/src/bolt_api_sdk/models/merchant_credit_card_authorization_recharge.py
@@ -82,36 +82,33 @@ class MerchantCreditCardAuthorizationRecharge(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "auto_capture",
- "merchant_event_id",
- "previous_transaction_id",
- "processing_initiator",
- "shipping_address",
- ]
- nullable_fields = ["previous_transaction_id"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "auto_capture",
+ "merchant_event_id",
+ "previous_transaction_id",
+ "processing_initiator",
+ "shipping_address",
+ ]
+ )
+ nullable_fields = set(["previous_transaction_id"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/merchant_division.py b/src/bolt_api_sdk/models/merchant_division.py
index 6a5a983..6d8f09a 100644
--- a/src/bolt_api_sdk/models/merchant_division.py
+++ b/src/bolt_api_sdk/models/merchant_division.py
@@ -4,7 +4,8 @@
from .merchant_logo import MerchantLogo, MerchantLogoTypedDict
from .merchant_platform import MerchantPlatform
from .webhooks_type import WebhooksType
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -152,3 +153,44 @@ class MerchantDivision(BaseModel):
validate_additional_account_data_url: Optional[str] = None
r"""The endpoint URL provided by the merchant for validating additional account data."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "account_page_url",
+ "api_base_domain_url",
+ "create_order_url",
+ "debug_url",
+ "get_account_url",
+ "shopper_custom_fields_updated_url",
+ "hook_type",
+ "hook_url",
+ "id",
+ "logo",
+ "oauth_logout_url",
+ "oauth_redirect_url",
+ "platform",
+ "plugin_config_url",
+ "privacy_policy_url",
+ "product_info_url",
+ "public_id",
+ "shipping_and_tax_url",
+ "terms_of_service_url",
+ "universal_merchant_api_url",
+ "update_cart_url",
+ "validate_additional_account_data_url",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_division_logo_view.py b/src/bolt_api_sdk/models/merchant_division_logo_view.py
index c0ed735..55a4234 100644
--- a/src/bolt_api_sdk/models/merchant_division_logo_view.py
+++ b/src/bolt_api_sdk/models/merchant_division_logo_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class MerchantDivisionLogoView(BaseModel):
domain: Optional[str] = None
resource: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["domain", "resource"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_division_summary_view.py b/src/bolt_api_sdk/models/merchant_division_summary_view.py
index bfe86ca..cb2df81 100644
--- a/src/bolt_api_sdk/models/merchant_division_summary_view.py
+++ b/src/bolt_api_sdk/models/merchant_division_summary_view.py
@@ -5,8 +5,9 @@
MerchantDivisionLogoView,
MerchantDivisionLogoViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -139,3 +140,60 @@ class MerchantDivisionSummaryView(BaseModel):
merchant_password_login_url: Optional[str] = None
r"""(Optional) Link shoppers can use to log into a merchant store via the Bolt SSO modal."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "account_page_url",
+ "api_base_domain_url",
+ "base_domain_url",
+ "confirmation_redirect_url",
+ "create_order_url",
+ "debug_url",
+ "description",
+ "display_name",
+ "get_account_url",
+ "shopper_custom_fields_updated_url",
+ "hook_type",
+ "hook_url",
+ "id",
+ "is_universal_merchant_api",
+ "is_webhooks_v2",
+ "logo",
+ "logo_dashboard",
+ "merchant_id",
+ "mobile_app_domain_url",
+ "oauth_logout_url",
+ "oauth_redirect_url",
+ "platform",
+ "plugin_config_url",
+ "privacy_policy_url",
+ "product_info_url",
+ "public_id",
+ "remote_apiurl",
+ "shipping_and_tax_url",
+ "shipping_url",
+ "status",
+ "tax_url",
+ "terms_of_service_url",
+ "universal_merchant_api_url",
+ "update_cart_url",
+ "use_async_refunds_amazon_pay",
+ "use_async_refunds_paypal",
+ "validate_additional_account_data_url",
+ "merchant_password_login_url",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_divisions_identifiers_view.py b/src/bolt_api_sdk/models/merchant_divisions_identifiers_view.py
index 9d61d80..515ea28 100644
--- a/src/bolt_api_sdk/models/merchant_divisions_identifiers_view.py
+++ b/src/bolt_api_sdk/models/merchant_divisions_identifiers_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class MerchantDivisionsIdentifiersView(BaseModel):
publishable_key: Optional[str] = None
r"""The publishable key tied to this division."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["division_id", "publishable_key"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_identifiers_view.py b/src/bolt_api_sdk/models/merchant_identifiers_view.py
index 25e133b..ed75cc9 100644
--- a/src/bolt_api_sdk/models/merchant_identifiers_view.py
+++ b/src/bolt_api_sdk/models/merchant_identifiers_view.py
@@ -5,7 +5,8 @@
MerchantDivisionsIdentifiersView,
MerchantDivisionsIdentifiersViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -26,3 +27,19 @@ class MerchantIdentifiersView(BaseModel):
signing_secret: Optional[str] = None
r"""Bolt generates one secret key per merchant and uses it to securely sign requests."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["merchant_divisions", "merchant_id", "signing_secret"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/merchant_logo.py b/src/bolt_api_sdk/models/merchant_logo.py
index 5ff1b93..8677b8c 100644
--- a/src/bolt_api_sdk/models/merchant_logo.py
+++ b/src/bolt_api_sdk/models/merchant_logo.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class MerchantLogo(BaseModel):
resource: Optional[str] = None
r"""The logo image file for the merchant division."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["domain", "resource"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/metadata_component.py b/src/bolt_api_sdk/models/metadata_component.py
index 2415b90..54e0343 100644
--- a/src/bolt_api_sdk/models/metadata_component.py
+++ b/src/bolt_api_sdk/models/metadata_component.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class MetadataComponent(BaseModel):
key1: Optional[str] = None
key2: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["key1", "key2"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/o_auth_token_input.py b/src/bolt_api_sdk/models/o_auth_token_input.py
index b054ed5..e005927 100644
--- a/src/bolt_api_sdk/models/o_auth_token_input.py
+++ b/src/bolt_api_sdk/models/o_auth_token_input.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -67,3 +68,19 @@ class OAuthTokenInput(BaseModel):
state: Annotated[Optional[str], FieldMetadata(form=True)] = None
r"""A randomly generated string issued to the merchant when receiving an authorization code used to prevent CSRF attacks"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["state"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/o_auth_token_input_refresh.py b/src/bolt_api_sdk/models/o_auth_token_input_refresh.py
index 6b81ad8..116fecb 100644
--- a/src/bolt_api_sdk/models/o_auth_token_input_refresh.py
+++ b/src/bolt_api_sdk/models/o_auth_token_input_refresh.py
@@ -1,9 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -59,3 +60,19 @@ class OAuthTokenInputRefresh(BaseModel):
state: Annotated[Optional[str], FieldMetadata(form=True)] = None
r"""A randomly generated string issued to the merchant when receiving an authorization code used to prevent CSRF attacks"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["state"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/o_auth_token_response.py b/src/bolt_api_sdk/models/o_auth_token_response.py
index 5f9ba3a..55f5ffc 100644
--- a/src/bolt_api_sdk/models/o_auth_token_response.py
+++ b/src/bolt_api_sdk/models/o_auth_token_response.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -44,3 +45,29 @@ class OAuthTokenResponse(BaseModel):
token_type: Optional[str] = None
r"""The token_type will always be bearer."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "access_token",
+ "expires_in",
+ "id_token",
+ "refresh_token",
+ "refresh_token_scope",
+ "scope",
+ "token_type",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/oauthtokenop.py b/src/bolt_api_sdk/models/oauthtokenop.py
index a5bc8fd..72d34ba 100644
--- a/src/bolt_api_sdk/models/oauthtokenop.py
+++ b/src/bolt_api_sdk/models/oauthtokenop.py
@@ -6,9 +6,15 @@
OAuthTokenInputRefresh,
OAuthTokenInputRefreshTypedDict,
)
-from bolt_api_sdk.types import BaseModel
-from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from bolt_api_sdk.utils import (
+ FieldMetadata,
+ HeaderMetadata,
+ RequestMetadata,
+ get_discriminator,
+)
import pydantic
+from pydantic import Discriminator, Tag, model_serializer
from typing import Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -19,9 +25,13 @@
)
-OAuthTokenRequestBody = TypeAliasType(
- "OAuthTokenRequestBody", Union[OAuthTokenInput, OAuthTokenInputRefresh]
-)
+OAuthTokenRequestBody = Annotated[
+ Union[
+ Annotated[OAuthTokenInput, Tag("authorization_code")],
+ Annotated[OAuthTokenInputRefresh, Tag("refresh_token")],
+ ],
+ Discriminator(lambda m: get_discriminator(m, "grant_type", "grant_type")),
+]
class OAuthTokenRequestTypedDict(TypedDict):
@@ -44,3 +54,19 @@ class OAuthTokenRequest(BaseModel):
request=RequestMetadata(media_type="application/x-www-form-urlencoded")
),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "RequestBody"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/order_create.py b/src/bolt_api_sdk/models/order_create.py
index 736253e..b91f8bf 100644
--- a/src/bolt_api_sdk/models/order_create.py
+++ b/src/bolt_api_sdk/models/order_create.py
@@ -102,6 +102,39 @@ class Cart(BaseModel):
order_description: Optional[str] = None
r"""Used optionally to pass additional information like order numbers or other IDs as needed."""
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "add_ons",
+ "billing_address",
+ "discounts",
+ "fees",
+ "fulfillments",
+ "in_store_cart_shipments",
+ "items",
+ "loyalty_rewards",
+ "shipments",
+ "tax_amount",
+ "cart_url",
+ "display_id",
+ "metadata",
+ "order_description",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class Channel(str, Enum):
r"""Used to determine the channel from which the order was created."""
@@ -142,39 +175,34 @@ class OrderCreate(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "create_cart_on_merchant_backend",
- "metadata",
- "user_note",
- "seller_splits",
- ]
- nullable_fields = [
- "create_cart_on_merchant_backend",
- "metadata",
- "seller_splits",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "create_cart_on_merchant_backend",
+ "metadata",
+ "user_note",
+ "seller_splits",
+ ]
+ )
+ nullable_fields = set(
+ ["create_cart_on_merchant_backend", "metadata", "seller_splits"]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/order_decision.py b/src/bolt_api_sdk/models/order_decision.py
index 39be1bb..0dec0a2 100644
--- a/src/bolt_api_sdk/models/order_decision.py
+++ b/src/bolt_api_sdk/models/order_decision.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .risk_decision_factor_yml import RiskDecisionFactorYml
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -24,3 +25,19 @@ class OrderDecision(BaseModel):
score: Optional[int] = None
r"""The total fraud risk score of the order."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["decision_factors", "score"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/order_decision_details_view.py b/src/bolt_api_sdk/models/order_decision_details_view.py
index 5008b50..4fa96f9 100644
--- a/src/bolt_api_sdk/models/order_decision_details_view.py
+++ b/src/bolt_api_sdk/models/order_decision_details_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class OrderDecisionDetailsView(BaseModel):
decision_factors: Optional[List[str]] = None
score: Optional[float] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["decision_factors", "score"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/order_external_data_view.py b/src/bolt_api_sdk/models/order_external_data_view.py
index 2245ee6..f7b2921 100644
--- a/src/bolt_api_sdk/models/order_external_data_view.py
+++ b/src/bolt_api_sdk/models/order_external_data_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -12,3 +13,19 @@ class OrderExternalDataViewTypedDict(TypedDict):
class OrderExternalDataView(BaseModel):
shopify: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["shopify"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/order_track_requestbody.py b/src/bolt_api_sdk/models/order_track_requestbody.py
index 503fcd2..e12fc39 100644
--- a/src/bolt_api_sdk/models/order_track_requestbody.py
+++ b/src/bolt_api_sdk/models/order_track_requestbody.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .item import Item, ItemTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -39,3 +40,19 @@ class OrderTrackRequestBody(BaseModel):
is_non_bolt_order: Optional[bool] = None
r"""Designates if the order was placed outside of Bolt checkout."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["is_non_bolt_order"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/order_view.py b/src/bolt_api_sdk/models/order_view.py
index f13930d..fb26795 100644
--- a/src/bolt_api_sdk/models/order_view.py
+++ b/src/bolt_api_sdk/models/order_view.py
@@ -7,7 +7,8 @@
OrderExternalDataView,
OrderExternalDataViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -40,3 +41,29 @@ class OrderView(BaseModel):
user_note: Optional[str] = None
r"""Used by shoppers to make extra requests or provide details for gift messages."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "cart",
+ "dynamic_content",
+ "external_data",
+ "platform_user_id",
+ "requires_action",
+ "token",
+ "user_note",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/package_dimension.py b/src/bolt_api_sdk/models/package_dimension.py
index 15f662a..d81269b 100644
--- a/src/bolt_api_sdk/models/package_dimension.py
+++ b/src/bolt_api_sdk/models/package_dimension.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -33,3 +34,19 @@ class PackageDimension(BaseModel):
width: Optional[int] = None
r"""The width."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["depth", "height", "unit", "width"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/package_weights.py b/src/bolt_api_sdk/models/package_weights.py
index 716eee2..9589cf7 100644
--- a/src/bolt_api_sdk/models/package_weights.py
+++ b/src/bolt_api_sdk/models/package_weights.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class PackageWeights(BaseModel):
weight: Optional[int] = None
r"""The weight of an item."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["unit", "weight"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/payment_method_account.py b/src/bolt_api_sdk/models/payment_method_account.py
index 406fa74..b896247 100644
--- a/src/bolt_api_sdk/models/payment_method_account.py
+++ b/src/bolt_api_sdk/models/payment_method_account.py
@@ -150,44 +150,41 @@ class PaymentMethodAccount(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "billing_address_id",
- "bin",
- "cryptogram",
- "eci",
- "last4",
- "metadata",
- "network",
- "number",
- "postal_code",
- "priority",
- "save",
- "token_type",
- "default",
- ]
- nullable_fields = ["billing_address_id", "metadata"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "billing_address_id",
+ "bin",
+ "cryptogram",
+ "eci",
+ "last4",
+ "metadata",
+ "network",
+ "number",
+ "postal_code",
+ "priority",
+ "save",
+ "token_type",
+ "default",
+ ]
+ )
+ nullable_fields = set(["billing_address_id", "metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/phone_view.py b/src/bolt_api_sdk/models/phone_view.py
index 08ffa87..b2e4ee8 100644
--- a/src/bolt_api_sdk/models/phone_view.py
+++ b/src/bolt_api_sdk/models/phone_view.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -32,3 +33,19 @@ class PhoneView(BaseModel):
priority: Optional[PhoneViewPriority] = None
status: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["country_code", "id", "number", "priority", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/phones_with_country_code.py b/src/bolt_api_sdk/models/phones_with_country_code.py
index d102df0..3a1f3da 100644
--- a/src/bolt_api_sdk/models/phones_with_country_code.py
+++ b/src/bolt_api_sdk/models/phones_with_country_code.py
@@ -3,7 +3,8 @@
from __future__ import annotations
from .phone_priority import PhonePriority
from .phone_status import PhoneStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -40,3 +41,19 @@ class PhonesWithCountryCode(BaseModel):
status: Optional[PhoneStatus] = None
r"""This is the status of the contact method."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["country_code", "id", "number", "priority", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/profile.py b/src/bolt_api_sdk/models/profile.py
index be57f58..fe2e8a9 100644
--- a/src/bolt_api_sdk/models/profile.py
+++ b/src/bolt_api_sdk/models/profile.py
@@ -53,30 +53,25 @@ class Profile(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["metadata", "phone"]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(["metadata", "phone"])
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/profile_view.py b/src/bolt_api_sdk/models/profile_view.py
index aa772d0..5cc0f42 100644
--- a/src/bolt_api_sdk/models/profile_view.py
+++ b/src/bolt_api_sdk/models/profile_view.py
@@ -58,37 +58,27 @@ class ProfileView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "email",
- "first_name",
- "last_name",
- "metadata",
- "name",
- "phone",
- ]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(
+ ["email", "first_name", "last_name", "metadata", "name", "phone"]
+ )
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/querywebhooksop.py b/src/bolt_api_sdk/models/querywebhooksop.py
index e65b9ae..7592392 100644
--- a/src/bolt_api_sdk/models/querywebhooksop.py
+++ b/src/bolt_api_sdk/models/querywebhooksop.py
@@ -2,8 +2,9 @@
from __future__ import annotations
from .webhook import Webhook, WebhookTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, QueryParamMetadata
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -30,3 +31,19 @@ class QueryWebhooksResponse(BaseModel):
r"""Success"""
webhooks: Optional[List[Webhook]] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["webhooks"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/refundtransactionop.py b/src/bolt_api_sdk/models/refundtransactionop.py
index a98e59e..f13c601 100644
--- a/src/bolt_api_sdk/models/refundtransactionop.py
+++ b/src/bolt_api_sdk/models/refundtransactionop.py
@@ -2,9 +2,10 @@
from __future__ import annotations
from .transaction_credit import TransactionCredit, TransactionCreditTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -29,3 +30,19 @@ class RefundTransactionRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
r"""Refund a Transaction"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["Idempotency-Key", "transaction_credit"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/replaceaddressop.py b/src/bolt_api_sdk/models/replaceaddressop.py
index 4576f8f..9581dfc 100644
--- a/src/bolt_api_sdk/models/replaceaddressop.py
+++ b/src/bolt_api_sdk/models/replaceaddressop.py
@@ -34,7 +34,10 @@ class ReplaceAddressSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -46,6 +49,7 @@ class ReplaceAddressSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -87,6 +91,24 @@ class ReplaceAddressRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ ["X-Publishable-Key", "Idempotency-Key", "address_account"]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class ReplaceAddressPriority(str, Enum):
r"""The shopper-indicated priority of this address compared to other addresses on their account."""
@@ -212,59 +234,58 @@ class ReplaceAddressResponse(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "company",
- "country",
- "country_code",
- "door_code",
- "email_address",
- "first_name",
- "id",
- "last_name",
- "locality",
- "name",
- "phone_number",
- "postal_code",
- "priority",
- "region",
- "region_code",
- "street_address1",
- "street_address2",
- "street_address3",
- "street_address4",
- "metadata",
- "default",
- ]
- nullable_fields = [
- "door_code",
- "priority",
- "region_code",
- "street_address3",
- "street_address4",
- "metadata",
- ]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "company",
+ "country",
+ "country_code",
+ "door_code",
+ "email_address",
+ "first_name",
+ "id",
+ "last_name",
+ "locality",
+ "name",
+ "phone_number",
+ "postal_code",
+ "priority",
+ "region",
+ "region_code",
+ "street_address1",
+ "street_address2",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ "default",
+ ]
+ )
+ nullable_fields = set(
+ [
+ "door_code",
+ "priority",
+ "region_code",
+ "street_address3",
+ "street_address4",
+ "metadata",
+ ]
+ )
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/request_result.py b/src/bolt_api_sdk/models/request_result.py
index f439c76..eb94d8d 100644
--- a/src/bolt_api_sdk/models/request_result.py
+++ b/src/bolt_api_sdk/models/request_result.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -18,3 +19,19 @@ class RequestResult(BaseModel):
success: Optional[bool] = None
r"""Indicates that the request failed. This value is always false."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["success"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/review_ticket.py b/src/bolt_api_sdk/models/review_ticket.py
index 7ab6d10..6d83bea 100644
--- a/src/bolt_api_sdk/models/review_ticket.py
+++ b/src/bolt_api_sdk/models/review_ticket.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .request_status import RequestStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -25,3 +26,19 @@ class ReviewTicket(BaseModel):
request_deadline: Optional[int] = None
status: Optional[RequestStatus] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["id", "request_deadline", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/review_ticket_view.py b/src/bolt_api_sdk/models/review_ticket_view.py
index 22ad6f6..0cc440f 100644
--- a/src/bolt_api_sdk/models/review_ticket_view.py
+++ b/src/bolt_api_sdk/models/review_ticket_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -18,3 +19,19 @@ class ReviewTicketView(BaseModel):
request_deadline: Optional[float] = None
status: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["id", "request_deadline", "status"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/reviewtransactionop.py b/src/bolt_api_sdk/models/reviewtransactionop.py
index c7421b0..4b61601 100644
--- a/src/bolt_api_sdk/models/reviewtransactionop.py
+++ b/src/bolt_api_sdk/models/reviewtransactionop.py
@@ -5,9 +5,10 @@
MerchantCreditCardReview,
MerchantCreditCardReviewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -32,3 +33,19 @@ class ReviewTransactionRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
r"""Review a Transaction"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["Idempotency-Key", "merchant_credit_card_review"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/risk_insights_yml.py b/src/bolt_api_sdk/models/risk_insights_yml.py
index 09d440e..06a4939 100644
--- a/src/bolt_api_sdk/models/risk_insights_yml.py
+++ b/src/bolt_api_sdk/models/risk_insights_yml.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .risk_decision_factor_yml import RiskDecisionFactorYml
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -36,3 +37,26 @@ class RiskInsightsYml(BaseModel):
"""
payment_instrument_factors: Optional[Dict[str, str]] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "available",
+ "decision_factors",
+ "fraud_probability",
+ "payment_instrument_factors",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/risk_model_external_result_view.py b/src/bolt_api_sdk/models/risk_model_external_result_view.py
index a3fd690..49c5eb9 100644
--- a/src/bolt_api_sdk/models/risk_model_external_result_view.py
+++ b/src/bolt_api_sdk/models/risk_model_external_result_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -23,3 +24,26 @@ class RiskModelExternalResultView(BaseModel):
fraud_probability: Optional[float] = None
payment_instrument_factors: Optional[Dict[str, str]] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "available",
+ "decision_factors",
+ "fraud_probability",
+ "payment_instrument_factors",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/risk_model_resul_contribution_view.py b/src/bolt_api_sdk/models/risk_model_resul_contribution_view.py
index f3a72c5..93f44b8 100644
--- a/src/bolt_api_sdk/models/risk_model_resul_contribution_view.py
+++ b/src/bolt_api_sdk/models/risk_model_resul_contribution_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -15,3 +16,19 @@ class RiskModelResulContributionView(BaseModel):
category: Optional[str] = None
weight: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["category", "weight"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/risk_model_result_view.py b/src/bolt_api_sdk/models/risk_model_result_view.py
index c5dcd0e..99c1fab 100644
--- a/src/bolt_api_sdk/models/risk_model_result_view.py
+++ b/src/bolt_api_sdk/models/risk_model_result_view.py
@@ -5,7 +5,8 @@
RiskModelResulContributionView,
RiskModelResulContributionViewTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -16,3 +17,19 @@ class RiskModelResultViewTypedDict(TypedDict):
class RiskModelResultView(BaseModel):
contribution: Optional[List[RiskModelResulContributionView]] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["contribution"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/saved_credit_card_view.py b/src/bolt_api_sdk/models/saved_credit_card_view.py
index 7994345..7456774 100644
--- a/src/bolt_api_sdk/models/saved_credit_card_view.py
+++ b/src/bolt_api_sdk/models/saved_credit_card_view.py
@@ -92,41 +92,38 @@ class SavedCreditCardView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = [
- "billing_address",
- "id",
- "last4",
- "exp_month",
- "exp_year",
- "network",
- "default",
- "type",
- "description",
- "metadata",
- ]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(
+ [
+ "billing_address",
+ "id",
+ "last4",
+ "exp_month",
+ "exp_year",
+ "network",
+ "default",
+ "type",
+ "description",
+ "metadata",
+ ]
+ )
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/saved_paypal_account_view.py b/src/bolt_api_sdk/models/saved_paypal_account_view.py
index 69ac86c..248db8d 100644
--- a/src/bolt_api_sdk/models/saved_paypal_account_view.py
+++ b/src/bolt_api_sdk/models/saved_paypal_account_view.py
@@ -55,30 +55,25 @@ class SavedPaypalAccountView(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["id", "type", "description", "metadata"]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(["id", "type", "description", "metadata"])
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/security.py b/src/bolt_api_sdk/models/security.py
index 9e469c8..4c845a1 100644
--- a/src/bolt_api_sdk/models/security.py
+++ b/src/bolt_api_sdk/models/security.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, SecurityMetadata
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -33,3 +34,19 @@ class Security(BaseModel):
)
),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-API-Key", "OAuth"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/shopper_metadata.py b/src/bolt_api_sdk/models/shopper_metadata.py
index 75ca8c0..96aef85 100644
--- a/src/bolt_api_sdk/models/shopper_metadata.py
+++ b/src/bolt_api_sdk/models/shopper_metadata.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -19,3 +20,25 @@ class ShopperMetadata(BaseModel):
additional_properties: Annotated[
Optional[str], pydantic.Field(alias="additionalProperties")
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["additionalProperties"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ ShopperMetadata.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/splits_view.py b/src/bolt_api_sdk/models/splits_view.py
index 1b2e78c..24e6da7 100644
--- a/src/bolt_api_sdk/models/splits_view.py
+++ b/src/bolt_api_sdk/models/splits_view.py
@@ -2,8 +2,9 @@
from __future__ import annotations
from .amount_view import AmountView, AmountViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -38,3 +39,19 @@ class SplitsView(BaseModel):
r"""**Nullable** for Transactions Details.
"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["amount", "type"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/statements_view_requestbody.py b/src/bolt_api_sdk/models/statements_view_requestbody.py
index 9a773f6..0533389 100644
--- a/src/bolt_api_sdk/models/statements_view_requestbody.py
+++ b/src/bolt_api_sdk/models/statements_view_requestbody.py
@@ -40,3 +40,9 @@ class StatementsViewRequestBody(BaseModel):
* [Dispute statement](https://help.bolt.com/operations/disputes/dispute-statements/#how-to-read-dispute-statements): Use `monthly_dispute`
"""
+
+
+try:
+ StatementsViewRequestBody.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/subscription.py b/src/bolt_api_sdk/models/subscription.py
index 8ccd220..80ebffb 100644
--- a/src/bolt_api_sdk/models/subscription.py
+++ b/src/bolt_api_sdk/models/subscription.py
@@ -1,8 +1,9 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -34,6 +35,22 @@ class Frequency(BaseModel):
value: Optional[int] = None
r"""The value applied to the unit frequency."""
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["unit", "value"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class SubscriptionTypedDict(TypedDict):
r"""Describes a product added as a recurring subscription."""
@@ -47,3 +64,19 @@ class Subscription(BaseModel):
frequency: Optional[Frequency] = None
r"""Describes how often the subscription recurs."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["frequency"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/testing_account_details.py b/src/bolt_api_sdk/models/testing_account_details.py
index 1fb4e73..68fd4df 100644
--- a/src/bolt_api_sdk/models/testing_account_details.py
+++ b/src/bolt_api_sdk/models/testing_account_details.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .account_identifier_status import AccountIdentifierStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -54,3 +55,30 @@ class TestingAccountDetails(BaseModel):
oauth_code: Optional[str] = None
r"""OAuth code that is associated with this account and can be used to exchange for an access token"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "email",
+ "email_state",
+ "phone",
+ "phone_state",
+ "otp_code",
+ "migrated_merchant_owner_id",
+ "will_deactivate_at",
+ "oauth_code",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/testing_account_request.py b/src/bolt_api_sdk/models/testing_account_request.py
index b7ff1e8..5f4fd1a 100644
--- a/src/bolt_api_sdk/models/testing_account_request.py
+++ b/src/bolt_api_sdk/models/testing_account_request.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .account_identifier_status import AccountIdentifierStatus
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -49,3 +50,29 @@ class TestingAccountRequest(BaseModel):
has_address: Optional[bool] = None
r"""Add a random U.S. address to the created account if set to `true`"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "deactivate_in_days",
+ "email",
+ "email_state",
+ "phone",
+ "phone_state",
+ "migrated",
+ "has_address",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/total_weight.py b/src/bolt_api_sdk/models/total_weight.py
index ac84616..a350cad 100644
--- a/src/bolt_api_sdk/models/total_weight.py
+++ b/src/bolt_api_sdk/models/total_weight.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class TotalWeight(BaseModel):
weight: Optional[int] = None
r"""The weight of an item."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["unit", "weight"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/tracking_detail.py b/src/bolt_api_sdk/models/tracking_detail.py
index b1df1c9..a6d4056 100644
--- a/src/bolt_api_sdk/models/tracking_detail.py
+++ b/src/bolt_api_sdk/models/tracking_detail.py
@@ -4,7 +4,8 @@
from bolt_api_sdk.types import BaseModel
from datetime import datetime
from enum import Enum
-from typing_extensions import TypedDict
+import pydantic
+from typing_extensions import Annotated, TypedDict
class TrackingDetailStatus(str, Enum):
@@ -25,7 +26,7 @@ class TrackingDetailStatus(str, Enum):
class TrackingDetailTypedDict(TypedDict):
city: str
country: str
- datetime: datetime
+ datetime_: datetime
message: str
state: str
status: TrackingDetailStatus
@@ -38,7 +39,7 @@ class TrackingDetail(BaseModel):
country: str
- datetime: datetime
+ datetime_: Annotated[datetime, pydantic.Field(alias="datetime")]
message: str
@@ -48,3 +49,9 @@ class TrackingDetail(BaseModel):
r"""The transit status of the order being tracked."""
zip: str
+
+
+try:
+ TrackingDetail.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/transaction_credit.py b/src/bolt_api_sdk/models/transaction_credit.py
index e341f7d..6c95ec2 100644
--- a/src/bolt_api_sdk/models/transaction_credit.py
+++ b/src/bolt_api_sdk/models/transaction_credit.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -34,3 +35,19 @@ class TransactionCredit(BaseModel):
skip_hook_notification: Optional[bool] = None
r"""Set to `true` to skip receiving a webhook notification from Bolt that is triggered by this update to the transaction."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["merchant_event_id", "skip_hook_notification"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/transaction_details.py b/src/bolt_api_sdk/models/transaction_details.py
index a73e202..a294154 100644
--- a/src/bolt_api_sdk/models/transaction_details.py
+++ b/src/bolt_api_sdk/models/transaction_details.py
@@ -47,8 +47,9 @@
)
from .transaction_type import TransactionType
from .transaction_view import TransactionView, TransactionViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -291,3 +292,77 @@ class TransactionDetails(BaseModel):
void: Optional[CreditCardVoidView] = None
void_cause: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "address_change_request_metadata",
+ "adjust_transactions",
+ "amount",
+ "auth_verification_status",
+ "authorization",
+ "authorization_id",
+ "capture",
+ "captures",
+ "chargeback_details",
+ "credit",
+ "custom_fields",
+ "customer_list_status",
+ "date",
+ "from_consumer",
+ "from_consumer_membership_users",
+ "from_credit_card",
+ "id",
+ "indemnification_decision",
+ "indemnification_reason",
+ "last_viewed_utc",
+ "last4",
+ "manual_disputes",
+ "merchant",
+ "merchant_division",
+ "merchant_order_number",
+ "order",
+ "order_decision",
+ "platform_metadata",
+ "processor",
+ "reference",
+ "refund_transaction_ids",
+ "refund_transactions",
+ "refunded_amount",
+ "review_ticket",
+ "risk_insights",
+ "risk_review_status",
+ "risk_score",
+ "source_transaction",
+ "splits",
+ "status",
+ "timeline",
+ "to_consumer",
+ "to_credit_card",
+ "transaction_properties",
+ "transaction_rejection_details",
+ "type",
+ "view_status",
+ "void",
+ "void_cause",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ TransactionDetails.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/transaction_details_view.py b/src/bolt_api_sdk/models/transaction_details_view.py
index 6ea86cf..7b4045a 100644
--- a/src/bolt_api_sdk/models/transaction_details_view.py
+++ b/src/bolt_api_sdk/models/transaction_details_view.py
@@ -62,9 +62,10 @@
)
from .transaction_type import TransactionType
from .transaction_view import TransactionView, TransactionViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
import pydantic
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -87,6 +88,22 @@ class TransactionRejectionDetailsTypedDict(TypedDict):
class TransactionRejectionDetails(BaseModel):
auth_rejection_details: Optional[AuthRejectionDetailsView] = None
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["auth_rejection_details"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
class VoidCause(str, Enum):
r"""Determines why the transaction was voided."""
@@ -286,3 +303,74 @@ class TransactionDetailsView(BaseModel):
void_cause: Optional[VoidCause] = None
r"""Determines why the transaction was voided."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "authorization",
+ "capture",
+ "captures",
+ "credit",
+ "date",
+ "from_consumer",
+ "from_credit_card",
+ "id",
+ "indemnification_decision",
+ "indemnification_reason",
+ "last4",
+ "last_viewed_utc",
+ "merchant_division",
+ "merchant_order_number",
+ "order_decision",
+ "processor",
+ "reference",
+ "review_ticket",
+ "risk_insights",
+ "risk_review_status",
+ "risk_score",
+ "splits",
+ "status",
+ "to_consumer",
+ "to_credit_card",
+ "transaction_properties",
+ "type",
+ "void",
+ "view_status",
+ "address_change_request_metadata",
+ "adjust_transactions",
+ "auth_verification_status",
+ "authorization_id",
+ "chargeback_details",
+ "custom_fields",
+ "customer_list_status",
+ "manual_disputes",
+ "order",
+ "refund_transaction_ids",
+ "refund_transactions",
+ "refunded_amount",
+ "source_transaction",
+ "timeline",
+ "transaction_rejection_details",
+ "void_cause",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ TransactionDetailsView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/transaction_rejection_details_view.py b/src/bolt_api_sdk/models/transaction_rejection_details_view.py
index ad89af1..c46ce21 100644
--- a/src/bolt_api_sdk/models/transaction_rejection_details_view.py
+++ b/src/bolt_api_sdk/models/transaction_rejection_details_view.py
@@ -2,7 +2,8 @@
from __future__ import annotations
from .auth_rejection_details import AuthRejectionDetails, AuthRejectionDetailsTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -13,3 +14,19 @@ class TransactionRejectionDetailsViewTypedDict(TypedDict):
class TransactionRejectionDetailsView(BaseModel):
auth_rejection_details: Optional[AuthRejectionDetails] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["auth_rejection_details"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/transaction_review_view.py b/src/bolt_api_sdk/models/transaction_review_view.py
index 4b55c4f..1e9fde4 100644
--- a/src/bolt_api_sdk/models/transaction_review_view.py
+++ b/src/bolt_api_sdk/models/transaction_review_view.py
@@ -2,8 +2,9 @@
from __future__ import annotations
from .risk_model_result_view import RiskModelResultView, RiskModelResultViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -23,3 +24,25 @@ class TransactionReviewView(BaseModel):
risk_model_result: Optional[RiskModelResultView] = None
source: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["date", "decision", "risk_model_result", "source"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ TransactionReviewView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/transaction_splits_view.py b/src/bolt_api_sdk/models/transaction_splits_view.py
index 3ad9c85..f13887f 100644
--- a/src/bolt_api_sdk/models/transaction_splits_view.py
+++ b/src/bolt_api_sdk/models/transaction_splits_view.py
@@ -2,8 +2,9 @@
from __future__ import annotations
from .amount_view import AmountView, AmountViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -26,3 +27,19 @@ class TransactionSplitsView(BaseModel):
amount: Optional[AmountView] = None
type: Optional[TransactionSplitsViewType] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["amount", "type"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/transaction_timeline_view.py b/src/bolt_api_sdk/models/transaction_timeline_view.py
index 379201a..b59b2e1 100644
--- a/src/bolt_api_sdk/models/transaction_timeline_view.py
+++ b/src/bolt_api_sdk/models/transaction_timeline_view.py
@@ -9,9 +9,10 @@
TransactionReviewViewTypedDict,
)
from .transaction_view import TransactionView, TransactionViewTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -57,3 +58,37 @@ class TransactionTimelineView(BaseModel):
type: Optional[TransactionTimelineViewType] = None
visibility: Optional[str] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "address_change",
+ "amount",
+ "consumer",
+ "date",
+ "note",
+ "review",
+ "transaction",
+ "type",
+ "visibility",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ TransactionTimelineView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/transaction_update_input.py b/src/bolt_api_sdk/models/transaction_update_input.py
index 2f3be9c..f790f9d 100644
--- a/src/bolt_api_sdk/models/transaction_update_input.py
+++ b/src/bolt_api_sdk/models/transaction_update_input.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Dict, Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class TransactionUpdateInput(BaseModel):
metadata: Optional[Dict[str, str]] = None
r"""Custom metadata associated with this Bolt transaction."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["display_id", "metadata"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/transaction_view.py b/src/bolt_api_sdk/models/transaction_view.py
index 2ff4818..00804a2 100644
--- a/src/bolt_api_sdk/models/transaction_view.py
+++ b/src/bolt_api_sdk/models/transaction_view.py
@@ -38,9 +38,10 @@
)
from .transaction_status import TransactionStatus
from .transaction_type import TransactionType
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from enum import Enum
import pydantic
+from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -178,3 +179,58 @@ class TransactionView(BaseModel):
void: Optional[CreditCardVoidView] = None
view_status: Optional[TransactionViewViewStatus] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(
+ [
+ "amount",
+ "authorization",
+ "capture",
+ "captures",
+ "credit",
+ "date",
+ "from_consumer",
+ "from_credit_card",
+ "id",
+ "indemnification_decision",
+ "indemnification_reason",
+ "last4",
+ "last_viewed_utc",
+ "merchant_division",
+ "merchant_order_number",
+ "order_decision",
+ "processor",
+ "reference",
+ "review_ticket",
+ "risk_insights",
+ "risk_review_status",
+ "risk_score",
+ "splits",
+ "status",
+ "to_consumer",
+ "to_credit_card",
+ "transaction_properties",
+ "type",
+ "void",
+ "view_status",
+ ]
+ )
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
+
+
+try:
+ TransactionView.model_rebuild()
+except NameError:
+ pass
diff --git a/src/bolt_api_sdk/models/update_profile.py b/src/bolt_api_sdk/models/update_profile.py
index 8a9a6c8..ee79ab6 100644
--- a/src/bolt_api_sdk/models/update_profile.py
+++ b/src/bolt_api_sdk/models/update_profile.py
@@ -43,30 +43,25 @@ class UpdateProfile(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["first_name", "last_name", "metadata"]
- nullable_fields = ["metadata"]
- null_default_fields = []
-
+ optional_fields = set(["first_name", "last_name", "metadata"])
+ nullable_fields = set(["metadata"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/models/updateaccountprofileop.py b/src/bolt_api_sdk/models/updateaccountprofileop.py
index a9b8762..c707ba0 100644
--- a/src/bolt_api_sdk/models/updateaccountprofileop.py
+++ b/src/bolt_api_sdk/models/updateaccountprofileop.py
@@ -2,7 +2,7 @@
from __future__ import annotations
from .update_profile import UpdateProfile, UpdateProfileTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import (
FieldMetadata,
HeaderMetadata,
@@ -10,6 +10,7 @@
SecurityMetadata,
)
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -24,7 +25,10 @@ class UpdateAccountProfileSecurity(BaseModel):
str,
FieldMetadata(
security=SecurityMetadata(
- scheme=True, scheme_type="oauth2", field_name="Authorization"
+ scheme=True,
+ scheme_type="oauth2",
+ composite=True,
+ field_name="Authorization",
)
),
]
@@ -36,6 +40,7 @@ class UpdateAccountProfileSecurity(BaseModel):
scheme=True,
scheme_type="apiKey",
sub_type="header",
+ composite=True,
field_name="X-API-Key",
)
),
@@ -60,3 +65,19 @@ class UpdateAccountProfileRequest(BaseModel):
Optional[UpdateProfile],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["X-Publishable-Key", "update_profile"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/updatetransactionop.py b/src/bolt_api_sdk/models/updatetransactionop.py
index 6d968fc..1acd6ed 100644
--- a/src/bolt_api_sdk/models/updatetransactionop.py
+++ b/src/bolt_api_sdk/models/updatetransactionop.py
@@ -5,7 +5,7 @@
TransactionUpdateInput,
TransactionUpdateInputTypedDict,
)
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import (
FieldMetadata,
HeaderMetadata,
@@ -13,6 +13,7 @@
RequestMetadata,
)
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -44,3 +45,19 @@ class UpdateTransactionRequest(BaseModel):
Optional[TransactionUpdateInput],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["Idempotency-Key", "transaction_update_input"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/user_identifier.py b/src/bolt_api_sdk/models/user_identifier.py
index 0e722df..6f80aa3 100644
--- a/src/bolt_api_sdk/models/user_identifier.py
+++ b/src/bolt_api_sdk/models/user_identifier.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -36,3 +37,19 @@ class UserIdentifier(BaseModel):
phone_id: Optional[str] = None
r"""The ID associated with the identifying phone number for this account."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["artifact", "email", "email_id", "phone_id"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/user_identity.py b/src/bolt_api_sdk/models/user_identity.py
index 33bcf46..76d2415 100644
--- a/src/bolt_api_sdk/models/user_identity.py
+++ b/src/bolt_api_sdk/models/user_identity.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -19,3 +20,19 @@ class UserIdentity(BaseModel):
last_name: Optional[str] = None
r"""The person's last name."""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["first_name", "last_name"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/v1_accounts_view.py b/src/bolt_api_sdk/models/v1_accounts_view.py
index 51ca5cc..19c543e 100644
--- a/src/bolt_api_sdk/models/v1_accounts_view.py
+++ b/src/bolt_api_sdk/models/v1_accounts_view.py
@@ -1,7 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict
@@ -12,3 +13,19 @@ class V1AccountsViewTypedDict(TypedDict):
class V1AccountsView(BaseModel):
has_bolt_account: Optional[bool] = None
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["has_bolt_account"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/voidtransactionop.py b/src/bolt_api_sdk/models/voidtransactionop.py
index 386a32d..123160e 100644
--- a/src/bolt_api_sdk/models/voidtransactionop.py
+++ b/src/bolt_api_sdk/models/voidtransactionop.py
@@ -2,9 +2,10 @@
from __future__ import annotations
from .credit_card_void import CreditCardVoid, CreditCardVoidTypedDict
-from bolt_api_sdk.types import BaseModel
+from bolt_api_sdk.types import BaseModel, UNSET_SENTINEL
from bolt_api_sdk.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
+from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -29,3 +30,19 @@ class VoidTransactionRequest(BaseModel):
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
r"""Void a Transaction"""
+
+ @model_serializer(mode="wrap")
+ def serialize_model(self, handler):
+ optional_fields = set(["Idempotency-Key", "credit_card_void"])
+ serialized = handler(self)
+ m = {}
+
+ for n, f in type(self).model_fields.items():
+ k = f.alias or n
+ val = serialized.get(k, serialized.get(n))
+
+ if val != UNSET_SENTINEL:
+ if val is not None or k not in optional_fields:
+ m[k] = val
+
+ return m
diff --git a/src/bolt_api_sdk/models/webhook.py b/src/bolt_api_sdk/models/webhook.py
index 2f2810d..961390d 100644
--- a/src/bolt_api_sdk/models/webhook.py
+++ b/src/bolt_api_sdk/models/webhook.py
@@ -56,30 +56,25 @@ class Webhook(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
- optional_fields = ["event_group", "events"]
- nullable_fields = ["event_group", "events"]
- null_default_fields = []
-
+ optional_fields = set(["event_group", "events"])
+ nullable_fields = set(["event_group", "events"])
serialized = handler(self)
-
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
- val = serialized.get(k)
- serialized.pop(k, None)
-
- optional_nullable = k in optional_fields and k in nullable_fields
- is_set = (
- self.__pydantic_fields_set__.intersection({n})
- or k in null_default_fields
- ) # pylint: disable=no-member
-
- if val is not None and val != UNSET_SENTINEL:
- m[k] = val
- elif val != UNSET_SENTINEL and (
- not k in optional_fields or (optional_nullable and is_set)
- ):
- m[k] = val
+ val = serialized.get(k, serialized.get(n))
+ is_nullable_and_explicitly_set = (
+ k in nullable_fields
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
+ )
+
+ if val != UNSET_SENTINEL:
+ if (
+ val is not None
+ or k not in optional_fields
+ or is_nullable_and_explicitly_set
+ ):
+ m[k] = val
return m
diff --git a/src/bolt_api_sdk/oauth.py b/src/bolt_api_sdk/oauth.py
index 3af9000..f8c39e2 100644
--- a/src/bolt_api_sdk/oauth.py
+++ b/src/bolt_api_sdk/oauth.py
@@ -71,12 +71,13 @@ def o_auth_token(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"form",
Optional[models.OAuthTokenRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -93,7 +94,7 @@ def o_auth_token(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="OAuthToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -179,12 +180,13 @@ async def o_auth_token_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"form",
Optional[models.OAuthTokenRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -201,7 +203,7 @@ async def o_auth_token_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="OAuthToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/orders.py b/src/bolt_api_sdk/orders.py
index f0283ab..f4bf1c6 100644
--- a/src/bolt_api_sdk/orders.py
+++ b/src/bolt_api_sdk/orders.py
@@ -27,6 +27,8 @@ def create_order_token(
Make a request to this endpoint to create a Bolt order, generate a Bolt order token, and initiate the checkout process. A Bolt order token is required for Bolt orders; see Non-Bolt orders for alternative use cases.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -63,6 +65,8 @@ def create_order_token(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.OrderCreate]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -79,7 +83,7 @@ def create_order_token(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createOrderToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -121,6 +125,8 @@ async def create_order_token_async(
Make a request to this endpoint to create a Bolt order, generate a Bolt order token, and initiate the checkout process. A Bolt order token is required for Bolt orders; see Non-Bolt orders for alternative use cases.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -157,6 +163,8 @@ async def create_order_token_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.OrderCreate]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -173,7 +181,7 @@ async def create_order_token_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createOrderToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -216,6 +224,8 @@ def track_order(
Send the carrier and order tracking number to Bolt (after a label has been printed). Bolt then uses EasyPost to forward ongoing tracking event updates to the shopper. This request must include **all** items included in the shipment; their references must also match those found in the original cart generation.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -252,6 +262,8 @@ def track_order(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.OrderTrackRequestBody]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -268,7 +280,7 @@ def track_order(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="trackOrder",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -311,6 +323,8 @@ async def track_order_async(
Send the carrier and order tracking number to Bolt (after a label has been printed). Bolt then uses EasyPost to forward ongoing tracking event updates to the shopper. This request must include **all** items included in the shipment; their references must also match those found in the original cart generation.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -347,6 +361,8 @@ async def track_order_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.OrderTrackRequestBody]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -363,7 +379,7 @@ async def track_order_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="trackOrder",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/sdk.py b/src/bolt_api_sdk/sdk.py
index 3402349..9998e65 100644
--- a/src/bolt_api_sdk/sdk.py
+++ b/src/bolt_api_sdk/sdk.py
@@ -86,8 +86,8 @@ def __init__(
Union[models.Security, Callable[[], models.Security]]
] = None,
server_idx: Optional[int] = None,
- server_url: Optional[str] = None,
url_params: Optional[Dict[str, str]] = None,
+ server_url: Optional[str] = None,
client: Optional[HttpClient] = None,
async_client: Optional[AsyncHttpClient] = None,
retry_config: OptionalNullable[RetryConfig] = UNSET,
diff --git a/src/bolt_api_sdk/statements.py b/src/bolt_api_sdk/statements.py
index 92eb57c..12d68ad 100644
--- a/src/bolt_api_sdk/statements.py
+++ b/src/bolt_api_sdk/statements.py
@@ -30,6 +30,8 @@ def get_statements(
Get a pre-signed URL for the requested statement file.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -68,6 +70,8 @@ def get_statements(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.StatementsViewRequestBody]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -84,7 +88,7 @@ def get_statements(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getStatements",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -129,6 +133,8 @@ async def get_statements_async(
Get a pre-signed URL for the requested statement file.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -167,6 +173,8 @@ async def get_statements_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.StatementsViewRequestBody]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -183,7 +191,7 @@ async def get_statements_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getStatements",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/testing.py b/src/bolt_api_sdk/testing.py
index f9fc62f..de7fdd5 100644
--- a/src/bolt_api_sdk/testing.py
+++ b/src/bolt_api_sdk/testing.py
@@ -27,6 +27,8 @@ def test_shipping(
This endpoint simulates tracking an order's shipment and is for testing purposes only.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -63,6 +65,8 @@ def test_shipping(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.MockTrackingInput]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -79,7 +83,7 @@ def test_shipping(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="testShipping",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -121,6 +125,8 @@ async def test_shipping_async(
This endpoint simulates tracking an order's shipment and is for testing purposes only.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -157,6 +163,8 @@ async def test_shipping_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, True, "json", Optional[models.MockTrackingInput]
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -173,7 +181,7 @@ async def test_shipping_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="testShipping",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -216,6 +224,8 @@ def create_testing_shopper_account(
Create a Bolt shopper account for testing purposes. Available for sandbox use only and the created account will be recycled after a certain time.
+ If set, this operation will use `x_api_key` from the global security.
+
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param testing_account_request:
:param retries: Override the default retry configuration for this method
@@ -254,12 +264,14 @@ def create_testing_shopper_account(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.testing_account_request,
+ request.testing_account_request if request is not None else None,
False,
True,
"json",
Optional[models.TestingAccountRequest],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -276,7 +288,7 @@ def create_testing_shopper_account(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createTestingShopperAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -313,6 +325,8 @@ async def create_testing_shopper_account_async(
Create a Bolt shopper account for testing purposes. Available for sandbox use only and the created account will be recycled after a certain time.
+ If set, this operation will use `x_api_key` from the global security.
+
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param testing_account_request:
:param retries: Override the default retry configuration for this method
@@ -351,12 +365,14 @@ async def create_testing_shopper_account_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.testing_account_request,
+ request.testing_account_request if request is not None else None,
False,
True,
"json",
Optional[models.TestingAccountRequest],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -373,7 +389,7 @@ async def create_testing_shopper_account_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createTestingShopperAccount",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -406,6 +422,8 @@ def get_test_credit_card_token(
This endpoint fetches a new credit card token for Bolt's universal test credit card number `4111 1111 1111 1004`. This is for testing and is available only in sandbox.
+ If set, this operation will use `x_api_key` from the global security.
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -433,6 +451,8 @@ def get_test_credit_card_token(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -449,7 +469,7 @@ def get_test_credit_card_token(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getTestCreditCardToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -484,6 +504,8 @@ async def get_test_credit_card_token_async(
This endpoint fetches a new credit card token for Bolt's universal test credit card number `4111 1111 1111 1004`. This is for testing and is available only in sandbox.
+ If set, this operation will use `x_api_key` from the global security.
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -511,6 +533,8 @@ async def get_test_credit_card_token_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -527,7 +551,7 @@ async def get_test_credit_card_token_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getTestCreditCardToken",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/transactions.py b/src/bolt_api_sdk/transactions.py
index 150f738..06bcdc5 100644
--- a/src/bolt_api_sdk/transactions.py
+++ b/src/bolt_api_sdk/transactions.py
@@ -43,7 +43,11 @@ def authorize_transaction(
:param security:
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
- :param request_body: **Authorize a Transaction** * • `merchant_credit_card_authorization`: For authorizing with a new, unsaved card. This can be for a guest checkout flow, one-time payment, or an existing Bolt shopper. * • `merchant_credit_card_authorization_recharge`: For authorizing a card using a shoppers saved payment methods. * • **Anytime the shopper is paying while logged-in attach their OAuth `access_token` to the request.**
+ :param request_body: **Authorize a Transaction**
+ * • `merchant_credit_card_authorization`: For authorizing with a new, unsaved card. This can be for a guest checkout flow, one-time payment, or an existing Bolt shopper.
+ * • `merchant_credit_card_authorization_recharge`: For authorizing a card using a shoppers saved payment methods.
+ * • **Anytime the shopper is paying while logged-in attach their OAuth `access_token` to the request.**
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -83,12 +87,13 @@ def authorize_transaction(
security, models.AuthorizeTransactionSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"json",
Optional[models.AuthorizeTransactionRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -155,7 +160,11 @@ async def authorize_transaction_async(
:param security:
:param x_publishable_key: The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
- :param request_body: **Authorize a Transaction** * • `merchant_credit_card_authorization`: For authorizing with a new, unsaved card. This can be for a guest checkout flow, one-time payment, or an existing Bolt shopper. * • `merchant_credit_card_authorization_recharge`: For authorizing a card using a shoppers saved payment methods. * • **Anytime the shopper is paying while logged-in attach their OAuth `access_token` to the request.**
+ :param request_body: **Authorize a Transaction**
+ * • `merchant_credit_card_authorization`: For authorizing with a new, unsaved card. This can be for a guest checkout flow, one-time payment, or an existing Bolt shopper.
+ * • `merchant_credit_card_authorization_recharge`: For authorizing a card using a shoppers saved payment methods.
+ * • **Anytime the shopper is paying while logged-in attach their OAuth `access_token` to the request.**
+
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -195,12 +204,13 @@ async def authorize_transaction_async(
security, models.AuthorizeTransactionSecurity
),
get_serialized_body=lambda: utils.serialize_request_body(
- request.request_body,
+ request.request_body if request is not None else None,
False,
True,
"json",
Optional[models.AuthorizeTransactionRequestBody],
),
+ allow_empty_value=None,
timeout_ms=timeout_ms,
)
@@ -258,6 +268,8 @@ def capture_transaction(
Although the response returns the standard `transaction_view` object, only `captures` and either `id` or `reference` are needed.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param capture_transaction_with_reference: Capture a Transaction
:param retries: Override the default retry configuration for this method
@@ -297,12 +309,16 @@ def capture_transaction(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.capture_transaction_with_reference,
+ request.capture_transaction_with_reference
+ if request is not None
+ else None,
False,
True,
"json",
Optional[models.CaptureTransactionWithReference],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -319,7 +335,7 @@ def capture_transaction(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="captureTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -373,6 +389,8 @@ async def capture_transaction_async(
Although the response returns the standard `transaction_view` object, only `captures` and either `id` or `reference` are needed.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param capture_transaction_with_reference: Capture a Transaction
:param retries: Override the default retry configuration for this method
@@ -412,12 +430,16 @@ async def capture_transaction_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.capture_transaction_with_reference,
+ request.capture_transaction_with_reference
+ if request is not None
+ else None,
False,
True,
"json",
Optional[models.CaptureTransactionWithReference],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -434,7 +456,7 @@ async def capture_transaction_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="captureTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -482,6 +504,8 @@ def refund_transaction(
This refunds a captured transaction. Refunds can be done for any partial amount or for the total authorized amount. These refunds are processed synchronously and return information about the refunded transaction in the standard `transaction_view` object.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param transaction_credit: Refund a Transaction
:param retries: Override the default retry configuration for this method
@@ -520,12 +544,14 @@ def refund_transaction(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.transaction_credit,
+ request.transaction_credit if request is not None else None,
False,
True,
"json",
Optional[models.TransactionCredit],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -542,7 +568,7 @@ def refund_transaction(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="refundTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -585,6 +611,8 @@ async def refund_transaction_async(
This refunds a captured transaction. Refunds can be done for any partial amount or for the total authorized amount. These refunds are processed synchronously and return information about the refunded transaction in the standard `transaction_view` object.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param transaction_credit: Refund a Transaction
:param retries: Override the default retry configuration for this method
@@ -623,12 +651,14 @@ async def refund_transaction_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.transaction_credit,
+ request.transaction_credit if request is not None else None,
False,
True,
"json",
Optional[models.TransactionCredit],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -645,7 +675,7 @@ async def refund_transaction_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="refundTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -691,6 +721,8 @@ def review_transaction(
This endpoint is used to manually approve or reject orders for a specified transaction.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param merchant_credit_card_review: Review a Transaction
:param retries: Override the default retry configuration for this method
@@ -729,12 +761,14 @@ def review_transaction(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.merchant_credit_card_review,
+ request.merchant_credit_card_review if request is not None else None,
False,
True,
"json",
Optional[models.MerchantCreditCardReview],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -751,7 +785,7 @@ def review_transaction(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="reviewTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -797,6 +831,8 @@ async def review_transaction_async(
This endpoint is used to manually approve or reject orders for a specified transaction.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param merchant_credit_card_review: Review a Transaction
:param retries: Override the default retry configuration for this method
@@ -835,12 +871,14 @@ async def review_transaction_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.merchant_credit_card_review,
+ request.merchant_credit_card_review if request is not None else None,
False,
True,
"json",
Optional[models.MerchantCreditCardReview],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -857,7 +895,7 @@ async def review_transaction_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="reviewTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -903,6 +941,8 @@ def void_transaction(
Although the response returns the standard `transaction_view` object, only `status` and either `id` or `reference` are needed.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param credit_card_void: Void a Transaction
:param retries: Override the default retry configuration for this method
@@ -941,12 +981,14 @@ def void_transaction(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.credit_card_void,
+ request.credit_card_void if request is not None else None,
False,
True,
"json",
Optional[models.CreditCardVoid],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -963,7 +1005,7 @@ def void_transaction(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="voidTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -1009,6 +1051,8 @@ async def void_transaction_async(
Although the response returns the standard `transaction_view` object, only `status` and either `id` or `reference` are needed.
+ If set, this operation will use `x_api_key` from the global security.
+
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param credit_card_void: Void a Transaction
:param retries: Override the default retry configuration for this method
@@ -1047,12 +1091,14 @@ async def void_transaction_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.credit_card_void,
+ request.credit_card_void if request is not None else None,
False,
True,
"json",
Optional[models.CreditCardVoid],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -1069,7 +1115,7 @@ async def void_transaction_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="voidTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -1112,6 +1158,8 @@ def get_transaction_details(
**Note**: All objects and fields marked `required` in the Transaction Details response are also **nullable**. This includes any sub-components (objects or fields) also marked `required`.
+ If set, this operation will use `x_api_key` from the global security.
+
:param reference: This is the Bolt transaction reference. (ex. N7Y3-NFKC-VFRF)
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -1145,6 +1193,8 @@ def get_transaction_details(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -1161,7 +1211,7 @@ def get_transaction_details(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getTransactionDetails",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -1204,6 +1254,8 @@ async def get_transaction_details_async(
**Note**: All objects and fields marked `required` in the Transaction Details response are also **nullable**. This includes any sub-components (objects or fields) also marked `required`.
+ If set, this operation will use `x_api_key` from the global security.
+
:param reference: This is the Bolt transaction reference. (ex. N7Y3-NFKC-VFRF)
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -1237,6 +1289,8 @@ async def get_transaction_details_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -1253,7 +1307,7 @@ async def get_transaction_details_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getTransactionDetails",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -1296,6 +1350,8 @@ def update_transaction(
This allows you to update certain transaction properties post-authorization.
+ If set, this operation will use `x_api_key` from the global security.
+
:param reference: This is the Bolt transaction reference. (ex. N7Y3-NFKC-VFRF)
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param display_id: This field corresponds to the merchant's order reference associated with this Bolt transaction.
@@ -1338,12 +1394,14 @@ def update_transaction(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.transaction_update_input,
+ request.transaction_update_input if request is not None else None,
False,
True,
"json",
Optional[models.TransactionUpdateInput],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -1360,7 +1418,7 @@ def update_transaction(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="updateTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -1403,6 +1461,8 @@ async def update_transaction_async(
This allows you to update certain transaction properties post-authorization.
+ If set, this operation will use `x_api_key` from the global security.
+
:param reference: This is the Bolt transaction reference. (ex. N7Y3-NFKC-VFRF)
:param idempotency_key: A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).
:param display_id: This field corresponds to the merchant's order reference associated with this Bolt transaction.
@@ -1445,12 +1505,14 @@ async def update_transaction_async(
http_headers=http_headers,
security=self.sdk_configuration.security,
get_serialized_body=lambda: utils.serialize_request_body(
- request.transaction_update_input,
+ request.transaction_update_input if request is not None else None,
False,
True,
"json",
Optional[models.TransactionUpdateInput],
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -1467,7 +1529,7 @@ async def update_transaction_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="updateTransaction",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
diff --git a/src/bolt_api_sdk/types/basemodel.py b/src/bolt_api_sdk/types/basemodel.py
index 231c2e3..a9a640a 100644
--- a/src/bolt_api_sdk/types/basemodel.py
+++ b/src/bolt_api_sdk/types/basemodel.py
@@ -2,7 +2,8 @@
from pydantic import ConfigDict, model_serializer
from pydantic import BaseModel as PydanticBaseModel
-from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union
+from pydantic_core import core_schema
+from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union
from typing_extensions import TypeAliasType, TypeAlias
@@ -35,5 +36,42 @@ def __bool__(self) -> Literal[False]:
"OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
)
-UnrecognizedInt: TypeAlias = int
-UnrecognizedStr: TypeAlias = str
+
+class UnrecognizedStr(str):
+ @classmethod
+ def __get_pydantic_core_schema__(cls, _source_type: Any, _handler: Any) -> core_schema.CoreSchema:
+ # Make UnrecognizedStr only work in lax mode, not strict mode
+ # This makes it a "fallback" option when more specific types (like Literals) don't match
+ def validate_lax(v: Any) -> 'UnrecognizedStr':
+ if isinstance(v, cls):
+ return v
+ return cls(str(v))
+
+ # Use lax_or_strict_schema where strict always fails
+ # This forces Pydantic to prefer other union members in strict mode
+ # and only fall back to UnrecognizedStr in lax mode
+ return core_schema.lax_or_strict_schema(
+ lax_schema=core_schema.chain_schema([
+ core_schema.str_schema(),
+ core_schema.no_info_plain_validator_function(validate_lax)
+ ]),
+ strict_schema=core_schema.none_schema(), # Always fails in strict mode
+ )
+
+
+class UnrecognizedInt(int):
+ @classmethod
+ def __get_pydantic_core_schema__(cls, _source_type: Any, _handler: Any) -> core_schema.CoreSchema:
+ # Make UnrecognizedInt only work in lax mode, not strict mode
+ # This makes it a "fallback" option when more specific types (like Literals) don't match
+ def validate_lax(v: Any) -> 'UnrecognizedInt':
+ if isinstance(v, cls):
+ return v
+ return cls(int(v))
+ return core_schema.lax_or_strict_schema(
+ lax_schema=core_schema.chain_schema([
+ core_schema.int_schema(),
+ core_schema.no_info_plain_validator_function(validate_lax)
+ ]),
+ strict_schema=core_schema.none_schema(), # Always fails in strict mode
+ )
diff --git a/src/bolt_api_sdk/utils/__init__.py b/src/bolt_api_sdk/utils/__init__.py
index 87192dd..aded759 100644
--- a/src/bolt_api_sdk/utils/__init__.py
+++ b/src/bolt_api_sdk/utils/__init__.py
@@ -1,9 +1,17 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
-from typing import TYPE_CHECKING
-from importlib import import_module
-import builtins
-import sys
+from typing import Any, TYPE_CHECKING, Callable, TypeVar
+import asyncio
+
+from .dynamic_imports import lazy_getattr, lazy_dir
+
+_T = TypeVar("_T")
+
+
+async def run_sync_in_thread(func: Callable[..., _T], *args) -> _T:
+ """Run a synchronous function in a thread pool to avoid blocking the event loop."""
+ return await asyncio.to_thread(func, *args)
+
if TYPE_CHECKING:
from .annotations import get_discriminator
@@ -42,7 +50,6 @@
validate_decimal,
validate_float,
validate_int,
- validate_open_enum,
)
from .url import generate_url, template_url, remove_suffix
from .values import (
@@ -104,7 +111,6 @@
"validate_const",
"validate_float",
"validate_int",
- "validate_open_enum",
"cast_partial",
]
@@ -158,43 +164,15 @@
"validate_const": ".serializers",
"validate_float": ".serializers",
"validate_int": ".serializers",
- "validate_open_enum": ".serializers",
"cast_partial": ".values",
}
-def dynamic_import(modname, retries=3):
- for attempt in range(retries):
- try:
- return import_module(modname, __package__)
- except KeyError:
- # Clear any half-initialized module and retry
- sys.modules.pop(modname, None)
- if attempt == retries - 1:
- break
- raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
-
-
-def __getattr__(attr_name: str) -> object:
- module_name = _dynamic_imports.get(attr_name)
- if module_name is None:
- raise AttributeError(
- f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
- )
-
- try:
- module = dynamic_import(module_name)
- return getattr(module, attr_name)
- except ImportError as e:
- raise ImportError(
- f"Failed to import {attr_name} from {module_name}: {e}"
- ) from e
- except AttributeError as e:
- raise AttributeError(
- f"Failed to get {attr_name} from {module_name}: {e}"
- ) from e
+def __getattr__(attr_name: str) -> Any:
+ return lazy_getattr(
+ attr_name, package=__package__, dynamic_imports=_dynamic_imports
+ )
def __dir__():
- lazy_attrs = builtins.list(_dynamic_imports.keys())
- return builtins.sorted(lazy_attrs)
+ return lazy_dir(dynamic_imports=_dynamic_imports)
diff --git a/src/bolt_api_sdk/utils/dynamic_imports.py b/src/bolt_api_sdk/utils/dynamic_imports.py
new file mode 100644
index 0000000..673edf8
--- /dev/null
+++ b/src/bolt_api_sdk/utils/dynamic_imports.py
@@ -0,0 +1,54 @@
+"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
+
+from importlib import import_module
+import builtins
+import sys
+
+
+def dynamic_import(package, modname, retries=3):
+ """Import a module relative to package, retrying on KeyError from half-initialized modules."""
+ for attempt in range(retries):
+ try:
+ return import_module(modname, package)
+ except KeyError:
+ sys.modules.pop(modname, None)
+ if attempt == retries - 1:
+ break
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
+
+
+def lazy_getattr(attr_name, *, package, dynamic_imports, sub_packages=None):
+ """Module-level __getattr__ that lazily loads from a dynamic_imports mapping.
+
+ Args:
+ attr_name: The attribute being looked up.
+ package: The caller's __package__ (for relative imports).
+ dynamic_imports: Dict mapping attribute names to relative module paths.
+ sub_packages: Optional list of subpackage names to lazy-load.
+ """
+ module_name = dynamic_imports.get(attr_name)
+ if module_name is not None:
+ try:
+ module = dynamic_import(package, module_name)
+ return getattr(module, attr_name)
+ except ImportError as e:
+ raise ImportError(
+ f"Failed to import {attr_name} from {module_name}: {e}"
+ ) from e
+ except AttributeError as e:
+ raise AttributeError(
+ f"Failed to get {attr_name} from {module_name}: {e}"
+ ) from e
+
+ if sub_packages and attr_name in sub_packages:
+ return import_module(f".{attr_name}", package)
+
+ raise AttributeError(f"module '{package}' has no attribute '{attr_name}'")
+
+
+def lazy_dir(*, dynamic_imports, sub_packages=None):
+ """Module-level __dir__ that lists lazily-loadable attributes."""
+ lazy_attrs = builtins.list(dynamic_imports.keys())
+ if sub_packages:
+ lazy_attrs.extend(sub_packages)
+ return builtins.sorted(lazy_attrs)
diff --git a/src/bolt_api_sdk/utils/enums.py b/src/bolt_api_sdk/utils/enums.py
index c3bc13c..3324e1b 100644
--- a/src/bolt_api_sdk/utils/enums.py
+++ b/src/bolt_api_sdk/utils/enums.py
@@ -2,6 +2,10 @@
import enum
import sys
+from typing import Any
+
+from pydantic_core import core_schema
+
class OpenEnumMeta(enum.EnumMeta):
# The __call__ method `boundary` kwarg was added in 3.11 and must be present
@@ -72,3 +76,59 @@ def __call__(
)
except ValueError:
return value
+
+ def __new__(mcs, name, bases, namespace, **kwargs):
+ cls = super().__new__(mcs, name, bases, namespace, **kwargs)
+
+ # Add __get_pydantic_core_schema__ to make open enums work correctly
+ # in union discrimination. In strict mode (used by Pydantic for unions),
+ # only known enum values match. In lax mode, unknown values are accepted.
+ def __get_pydantic_core_schema__(
+ cls_inner: Any, _source_type: Any, _handler: Any
+ ) -> core_schema.CoreSchema:
+ # Create a validator that only accepts known enum values (for strict mode)
+ def validate_strict(v: Any) -> Any:
+ if isinstance(v, cls_inner):
+ return v
+ # Use the parent EnumMeta's __call__ which raises ValueError for unknown values
+ return enum.EnumMeta.__call__(cls_inner, v)
+
+ # Create a lax validator that accepts unknown values
+ def validate_lax(v: Any) -> Any:
+ if isinstance(v, cls_inner):
+ return v
+ try:
+ return enum.EnumMeta.__call__(cls_inner, v)
+ except ValueError:
+ # Return the raw value for unknown enum values
+ return v
+
+ # Determine the base type schema (str or int)
+ is_int_enum = False
+ for base in cls_inner.__mro__:
+ if base is int:
+ is_int_enum = True
+ break
+ if base is str:
+ break
+
+ base_schema = (
+ core_schema.int_schema()
+ if is_int_enum
+ else core_schema.str_schema()
+ )
+
+ # Use lax_or_strict_schema:
+ # - strict mode: only known enum values match (raises ValueError for unknown)
+ # - lax mode: accept any value, return enum member or raw value
+ return core_schema.lax_or_strict_schema(
+ lax_schema=core_schema.chain_schema(
+ [base_schema, core_schema.no_info_plain_validator_function(validate_lax)]
+ ),
+ strict_schema=core_schema.chain_schema(
+ [base_schema, core_schema.no_info_plain_validator_function(validate_strict)]
+ ),
+ )
+
+ setattr(cls, "__get_pydantic_core_schema__", classmethod(__get_pydantic_core_schema__))
+ return cls
diff --git a/src/bolt_api_sdk/utils/eventstreaming.py b/src/bolt_api_sdk/utils/eventstreaming.py
index 0969899..3bdcd6d 100644
--- a/src/bolt_api_sdk/utils/eventstreaming.py
+++ b/src/bolt_api_sdk/utils/eventstreaming.py
@@ -2,7 +2,9 @@
import re
import json
+from dataclasses import dataclass, asdict
from typing import (
+ Any,
Callable,
Generic,
TypeVar,
@@ -22,6 +24,7 @@ class EventStream(Generic[T]):
client_ref: Optional[object]
response: httpx.Response
generator: Generator[T, None, None]
+ _closed: bool
def __init__(
self,
@@ -29,21 +32,28 @@ def __init__(
decoder: Callable[[str], T],
sentinel: Optional[str] = None,
client_ref: Optional[object] = None,
+ data_required: bool = True,
):
self.response = response
- self.generator = stream_events(response, decoder, sentinel)
+ self.generator = stream_events(
+ response, decoder, sentinel, data_required=data_required
+ )
self.client_ref = client_ref
+ self._closed = False
def __iter__(self):
return self
def __next__(self):
+ if self._closed:
+ raise StopIteration
return next(self.generator)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
+ self._closed = True
self.response.close()
@@ -53,6 +63,7 @@ class EventStreamAsync(Generic[T]):
client_ref: Optional[object]
response: httpx.Response
generator: AsyncGenerator[T, None]
+ _closed: bool
def __init__(
self,
@@ -60,53 +71,65 @@ def __init__(
decoder: Callable[[str], T],
sentinel: Optional[str] = None,
client_ref: Optional[object] = None,
+ data_required: bool = True,
):
self.response = response
- self.generator = stream_events_async(response, decoder, sentinel)
+ self.generator = stream_events_async(
+ response, decoder, sentinel, data_required=data_required
+ )
self.client_ref = client_ref
+ self._closed = False
def __aiter__(self):
return self
async def __anext__(self):
+ if self._closed:
+ raise StopAsyncIteration
return await self.generator.__anext__()
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
+ self._closed = True
await self.response.aclose()
+@dataclass
class ServerEvent:
id: Optional[str] = None
event: Optional[str] = None
- data: Optional[str] = None
+ data: Any = None
retry: Optional[int] = None
MESSAGE_BOUNDARIES = [
b"\r\n\r\n",
- b"\n\n",
+ b"\r\n\r",
+ b"\r\n\n",
+ b"\r\r\n",
+ b"\n\r\n",
b"\r\r",
+ b"\n\r",
+ b"\n\n",
]
+UTF8_BOM = b"\xef\xbb\xbf"
+
async def stream_events_async(
response: httpx.Response,
decoder: Callable[[str], T],
sentinel: Optional[str] = None,
+ data_required: bool = True,
) -> AsyncGenerator[T, None]:
buffer = bytearray()
position = 0
- discard = False
+ event_id: Optional[str] = None
async for chunk in response.aiter_bytes():
- # We've encountered the sentinel value and should no longer process
- # incoming data. Instead we throw new data away until the server closes
- # the connection.
- if discard:
- continue
-
+ if len(buffer) == 0 and chunk.startswith(UTF8_BOM):
+ chunk = chunk[len(UTF8_BOM) :]
buffer += chunk
for i in range(position, len(buffer)):
char = buffer[i : i + 1]
@@ -121,15 +144,30 @@ async def stream_events_async(
block = buffer[position:i]
position = i + len(seq)
- event, discard = _parse_event(block, decoder, sentinel)
+ event, discard, event_id = _parse_event(
+ raw=block,
+ decoder=decoder,
+ sentinel=sentinel,
+ event_id=event_id,
+ data_required=data_required,
+ )
if event is not None:
yield event
+ if discard:
+ await response.aclose()
+ return
if position > 0:
buffer = buffer[position:]
position = 0
- event, discard = _parse_event(buffer, decoder, sentinel)
+ event, discard, _ = _parse_event(
+ raw=buffer,
+ decoder=decoder,
+ sentinel=sentinel,
+ event_id=event_id,
+ data_required=data_required,
+ )
if event is not None:
yield event
@@ -138,17 +176,14 @@ def stream_events(
response: httpx.Response,
decoder: Callable[[str], T],
sentinel: Optional[str] = None,
+ data_required: bool = True,
) -> Generator[T, None, None]:
buffer = bytearray()
position = 0
- discard = False
+ event_id: Optional[str] = None
for chunk in response.iter_bytes():
- # We've encountered the sentinel value and should no longer process
- # incoming data. Instead we throw new data away until the server closes
- # the connection.
- if discard:
- continue
-
+ if len(buffer) == 0 and chunk.startswith(UTF8_BOM):
+ chunk = chunk[len(UTF8_BOM) :]
buffer += chunk
for i in range(position, len(buffer)):
char = buffer[i : i + 1]
@@ -163,22 +198,42 @@ def stream_events(
block = buffer[position:i]
position = i + len(seq)
- event, discard = _parse_event(block, decoder, sentinel)
+ event, discard, event_id = _parse_event(
+ raw=block,
+ decoder=decoder,
+ sentinel=sentinel,
+ event_id=event_id,
+ data_required=data_required,
+ )
if event is not None:
yield event
+ if discard:
+ response.close()
+ return
if position > 0:
buffer = buffer[position:]
position = 0
- event, discard = _parse_event(buffer, decoder, sentinel)
+ event, discard, _ = _parse_event(
+ raw=buffer,
+ decoder=decoder,
+ sentinel=sentinel,
+ event_id=event_id,
+ data_required=data_required,
+ )
if event is not None:
yield event
def _parse_event(
- raw: bytearray, decoder: Callable[[str], T], sentinel: Optional[str] = None
-) -> Tuple[Optional[T], bool]:
+ *,
+ raw: bytearray,
+ decoder: Callable[[str], T],
+ sentinel: Optional[str] = None,
+ event_id: Optional[str] = None,
+ data_required: bool = True,
+) -> Tuple[Optional[T], bool, Optional[str]]:
block = raw.decode()
lines = re.split(r"\r?\n|\r", block)
publish = False
@@ -189,13 +244,16 @@ def _parse_event(
continue
delim = line.find(":")
- if delim <= 0:
+ if delim == 0:
continue
- field = line[0:delim]
- value = line[delim + 1 :] if delim < len(line) - 1 else ""
- if len(value) and value[0] == " ":
- value = value[1:]
+ field = line
+ value = ""
+ if delim > 0:
+ field = line[0:delim]
+ value = line[delim + 1 :] if delim < len(line) - 1 else ""
+ if len(value) and value[0] == " ":
+ value = value[1:]
if field == "event":
event.event = value
@@ -204,37 +262,40 @@ def _parse_event(
data += value + "\n"
publish = True
elif field == "id":
- event.id = value
publish = True
+ if "\x00" not in value:
+ event_id = value
elif field == "retry":
- event.retry = int(value) if value.isdigit() else None
+ if value.isdigit():
+ event.retry = int(value)
publish = True
+ event.id = event_id
+
if sentinel and data == f"{sentinel}\n":
- return None, True
+ return None, True, event_id
+
+ # Skip data-less events when data is required
+ if not data and publish and data_required:
+ return None, False, event_id
if data:
data = data[:-1]
- event.data = data
-
- data_is_primitive = (
- data.isnumeric() or data == "true" or data == "false" or data == "null"
- )
- data_is_json = (
- data.startswith("{") or data.startswith("[") or data.startswith('"')
- )
-
- if data_is_primitive or data_is_json:
- try:
- event.data = json.loads(data)
- except Exception:
- pass
+ try:
+ event.data = json.loads(data)
+ except json.JSONDecodeError:
+ event.data = data
out = None
if publish:
- out = decoder(json.dumps(event.__dict__))
-
- return out, False
+ out_dict = {
+ k: v
+ for k, v in asdict(event).items()
+ if v is not None or (k == "data" and data)
+ }
+ out = decoder(json.dumps(out_dict))
+
+ return out, False, event_id
def _peek_sequence(position: int, buffer: bytearray, sequence: bytes):
diff --git a/src/bolt_api_sdk/utils/forms.py b/src/bolt_api_sdk/utils/forms.py
index e873495..f961e76 100644
--- a/src/bolt_api_sdk/utils/forms.py
+++ b/src/bolt_api_sdk/utils/forms.py
@@ -142,16 +142,21 @@ def serialize_multipart_form(
if field_metadata.file:
if isinstance(val, List):
# Handle array of files
+ array_field_name = f_name + "[]"
for file_obj in val:
if not _is_set(file_obj):
continue
-
- file_name, content, content_type = _extract_file_properties(file_obj)
+
+ file_name, content, content_type = _extract_file_properties(
+ file_obj
+ )
if content_type is not None:
- files.append((f_name + "[]", (file_name, content, content_type)))
+ files.append(
+ (array_field_name, (file_name, content, content_type))
+ )
else:
- files.append((f_name + "[]", (file_name, content)))
+ files.append((array_field_name, (file_name, content)))
else:
# Handle single file
file_name, content, content_type = _extract_file_properties(val)
@@ -161,11 +166,16 @@ def serialize_multipart_form(
else:
files.append((f_name, (file_name, content)))
elif field_metadata.json:
- files.append((f_name, (
- None,
- marshal_json(val, request_field_types[name]),
- "application/json",
- )))
+ files.append(
+ (
+ f_name,
+ (
+ None,
+ marshal_json(val, request_field_types[name]),
+ "application/json",
+ ),
+ )
+ )
else:
if isinstance(val, List):
values = []
@@ -175,7 +185,8 @@ def serialize_multipart_form(
continue
values.append(_val_to_string(value))
- form[f_name + "[]"] = values
+ array_field_name = f_name + "[]"
+ form[array_field_name] = values
else:
form[f_name] = _val_to_string(val)
return media_type, form, files
diff --git a/src/bolt_api_sdk/utils/metadata.py b/src/bolt_api_sdk/utils/metadata.py
index 173b3e5..5abddd5 100644
--- a/src/bolt_api_sdk/utils/metadata.py
+++ b/src/bolt_api_sdk/utils/metadata.py
@@ -15,6 +15,7 @@ class SecurityMetadata:
scheme_type: Optional[str] = None
sub_type: Optional[str] = None
field_name: Optional[str] = None
+ composite: bool = False
def get_field_name(self, default: str) -> str:
return self.field_name or default
diff --git a/src/bolt_api_sdk/utils/queryparams.py b/src/bolt_api_sdk/utils/queryparams.py
index 37a6e7f..c04e0db 100644
--- a/src/bolt_api_sdk/utils/queryparams.py
+++ b/src/bolt_api_sdk/utils/queryparams.py
@@ -27,12 +27,13 @@
def get_query_params(
query_params: Any,
gbls: Optional[Any] = None,
+ allow_empty_value: Optional[List[str]] = None,
) -> Dict[str, List[str]]:
params: Dict[str, List[str]] = {}
- globals_already_populated = _populate_query_params(query_params, gbls, params, [])
+ globals_already_populated = _populate_query_params(query_params, gbls, params, [], allow_empty_value)
if _is_set(gbls):
- _populate_query_params(gbls, None, params, globals_already_populated)
+ _populate_query_params(gbls, None, params, globals_already_populated, allow_empty_value)
return params
@@ -42,6 +43,7 @@ def _populate_query_params(
gbls: Any,
query_param_values: Dict[str, List[str]],
skip_fields: List[str],
+ allow_empty_value: Optional[List[str]] = None,
) -> List[str]:
globals_already_populated: List[str] = []
@@ -69,6 +71,16 @@ def _populate_query_params(
globals_already_populated.append(name)
f_name = field.alias if field.alias is not None else name
+
+ allow_empty_set = set(allow_empty_value or [])
+ should_include_empty = f_name in allow_empty_set and (
+ value is None or value == [] or value == ""
+ )
+
+ if should_include_empty:
+ query_param_values[f_name] = [""]
+ continue
+
serialization = metadata.serialization
if serialization is not None:
serialized_parms = _get_serialized_params(
diff --git a/src/bolt_api_sdk/utils/requestbodies.py b/src/bolt_api_sdk/utils/requestbodies.py
index d5240dd..1de32b6 100644
--- a/src/bolt_api_sdk/utils/requestbodies.py
+++ b/src/bolt_api_sdk/utils/requestbodies.py
@@ -44,15 +44,15 @@ def serialize_request_body(
serialized_request_body = SerializedRequestBody(media_type)
- if re.match(r"(application|text)\/.*?\+*json.*", media_type) is not None:
+ if re.match(r"^(application|text)\/([^+]+\+)*json.*", media_type) is not None:
serialized_request_body.content = marshal_json(request_body, request_body_type)
- elif re.match(r"multipart\/.*", media_type) is not None:
+ elif re.match(r"^multipart\/.*", media_type) is not None:
(
serialized_request_body.media_type,
serialized_request_body.data,
serialized_request_body.files,
) = serialize_multipart_form(media_type, request_body)
- elif re.match(r"application\/x-www-form-urlencoded.*", media_type) is not None:
+ elif re.match(r"^application\/x-www-form-urlencoded.*", media_type) is not None:
serialized_request_body.data = serialize_form_data(request_body)
elif isinstance(request_body, (bytes, bytearray, io.BytesIO, io.BufferedReader)):
serialized_request_body.content = request_body
diff --git a/src/bolt_api_sdk/utils/retries.py b/src/bolt_api_sdk/utils/retries.py
index 4d60867..af07d4e 100644
--- a/src/bolt_api_sdk/utils/retries.py
+++ b/src/bolt_api_sdk/utils/retries.py
@@ -3,7 +3,9 @@
import asyncio
import random
import time
-from typing import List
+from datetime import datetime
+from email.utils import parsedate_to_datetime
+from typing import List, Optional
import httpx
@@ -51,9 +53,11 @@ def __init__(self, config: RetryConfig, status_codes: List[str]):
class TemporaryError(Exception):
response: httpx.Response
+ retry_after: Optional[int]
def __init__(self, response: httpx.Response):
self.response = response
+ self.retry_after = _parse_retry_after_header(response)
class PermanentError(Exception):
@@ -63,6 +67,62 @@ def __init__(self, inner: Exception):
self.inner = inner
+def _parse_retry_after_header(response: httpx.Response) -> Optional[int]:
+ """Parse Retry-After header from response.
+
+ Returns:
+ Retry interval in milliseconds, or None if header is missing or invalid.
+ """
+ retry_after_header = response.headers.get("retry-after")
+ if not retry_after_header:
+ return None
+
+ try:
+ seconds = float(retry_after_header)
+ return round(seconds * 1000)
+ except ValueError:
+ pass
+
+ try:
+ retry_date = parsedate_to_datetime(retry_after_header)
+ delta = (retry_date - datetime.now(retry_date.tzinfo)).total_seconds()
+ return round(max(0, delta) * 1000)
+ except (ValueError, TypeError):
+ pass
+
+ return None
+
+
+def _get_sleep_interval(
+ exception: Exception,
+ initial_interval: int,
+ max_interval: int,
+ exponent: float,
+ retries: int,
+) -> float:
+ """Get sleep interval for retry with exponential backoff.
+
+ Args:
+ exception: The exception that triggered the retry.
+ initial_interval: Initial retry interval in milliseconds.
+ max_interval: Maximum retry interval in milliseconds.
+ exponent: Base for exponential backoff calculation.
+ retries: Current retry attempt count.
+
+ Returns:
+ Sleep interval in seconds.
+ """
+ if (
+ isinstance(exception, TemporaryError)
+ and exception.retry_after is not None
+ and exception.retry_after > 0
+ ):
+ return exception.retry_after / 1000
+
+ sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1)
+ return min(sleep, max_interval / 1000)
+
+
def retry(func, retries: Retries):
if retries.config.strategy == "backoff":
@@ -84,12 +144,7 @@ def do_request() -> httpx.Response:
if res.status_code == parsed_code:
raise TemporaryError(res)
- except httpx.ConnectError as exception:
- if retries.config.retry_connection_errors:
- raise
-
- raise PermanentError(exception) from exception
- except httpx.TimeoutException as exception:
+ except (httpx.NetworkError, httpx.TimeoutException) as exception:
if retries.config.retry_connection_errors:
raise
@@ -133,12 +188,7 @@ async def do_request() -> httpx.Response:
if res.status_code == parsed_code:
raise TemporaryError(res)
- except httpx.ConnectError as exception:
- if retries.config.retry_connection_errors:
- raise
-
- raise PermanentError(exception) from exception
- except httpx.TimeoutException as exception:
+ except (httpx.NetworkError, httpx.TimeoutException) as exception:
if retries.config.retry_connection_errors:
raise
@@ -183,8 +233,10 @@ def retry_with_backoff(
return exception.response
raise
- sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1)
- sleep = min(sleep, max_interval / 1000)
+
+ sleep = _get_sleep_interval(
+ exception, initial_interval, max_interval, exponent, retries
+ )
time.sleep(sleep)
retries += 1
@@ -211,7 +263,9 @@ async def retry_with_backoff_async(
return exception.response
raise
- sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1)
- sleep = min(sleep, max_interval / 1000)
+
+ sleep = _get_sleep_interval(
+ exception, initial_interval, max_interval, exponent, retries
+ )
await asyncio.sleep(sleep)
retries += 1
diff --git a/src/bolt_api_sdk/utils/security.py b/src/bolt_api_sdk/utils/security.py
index 058d18d..e5746c1 100644
--- a/src/bolt_api_sdk/utils/security.py
+++ b/src/bolt_api_sdk/utils/security.py
@@ -19,7 +19,9 @@
import os
-def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
+def get_security(
+ security: Any, allowed_fields: Optional[List[str]] = None
+) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
headers: Dict[str, str] = {}
query_params: Dict[str, List[str]] = {}
@@ -30,7 +32,14 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
raise TypeError("security must be a pydantic model")
sec_fields: Dict[str, FieldInfo] = security.__class__.model_fields
- for name in sec_fields:
+ sec_field_names = (
+ list(sec_fields.keys()) if allowed_fields is None else allowed_fields
+ )
+
+ for name in sec_field_names:
+ if name not in sec_fields:
+ continue
+
sec_field = sec_fields[name]
value = getattr(security, name)
@@ -52,6 +61,9 @@ def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
else:
_parse_security_scheme(headers, query_params, metadata, name, value)
+ if not metadata.composite:
+ return headers, query_params
+
return headers, query_params
@@ -80,15 +92,24 @@ def _parse_security_option(
raise TypeError("security option must be a pydantic model")
opt_fields: Dict[str, FieldInfo] = option.__class__.model_fields
+
for name in opt_fields:
opt_field = opt_fields[name]
metadata = find_field_metadata(opt_field, SecurityMetadata)
if metadata is None or not metadata.scheme:
continue
- _parse_security_scheme(
- headers, query_params, metadata, name, getattr(option, name)
- )
+
+ value = getattr(option, name)
+ if (
+ metadata.scheme_type == "http"
+ and metadata.sub_type == "basic"
+ and not isinstance(value, BaseModel)
+ ):
+ _parse_basic_auth_scheme(headers, option)
+ return
+
+ _parse_security_scheme(headers, query_params, metadata, name, value)
def _parse_security_scheme(
@@ -156,6 +177,8 @@ def _parse_security_scheme_value(
elif scheme_type == "http":
if sub_type == "bearer":
headers[header_name] = _apply_bearer(value)
+ elif sub_type == "basic":
+ headers[header_name] = value
elif sub_type == "custom":
return
else:
diff --git a/src/bolt_api_sdk/utils/serializers.py b/src/bolt_api_sdk/utils/serializers.py
index 378a14c..d2149f8 100644
--- a/src/bolt_api_sdk/utils/serializers.py
+++ b/src/bolt_api_sdk/utils/serializers.py
@@ -17,8 +17,7 @@
def serialize_decimal(as_str: bool):
def serialize(d):
- # Optional[T] is a Union[T, None]
- if is_union(type(d)) and type(None) in get_args(type(d)) and d is None:
+ if d is None:
return None
if isinstance(d, Unset):
return d
@@ -46,8 +45,7 @@ def validate_decimal(d):
def serialize_float(as_str: bool):
def serialize(f):
- # Optional[T] is a Union[T, None]
- if is_union(type(f)) and type(None) in get_args(type(f)) and f is None:
+ if f is None:
return None
if isinstance(f, Unset):
return f
@@ -75,8 +73,7 @@ def validate_float(f):
def serialize_int(as_str: bool):
def serialize(i):
- # Optional[T] is a Union[T, None]
- if is_union(type(i)) and type(None) in get_args(type(i)) and i is None:
+ if i is None:
return None
if isinstance(i, Unset):
return i
@@ -102,30 +99,9 @@ def validate_int(b):
return int(b)
-def validate_open_enum(is_int: bool):
- def validate(e):
- if e is None:
- return None
-
- if isinstance(e, Unset):
- return e
-
- if is_int:
- if not isinstance(e, int):
- raise ValueError("Expected int")
- else:
- if not isinstance(e, str):
- raise ValueError("Expected string")
-
- return e
-
- return validate
-
-
def validate_const(v):
def validate(c):
- # Optional[T] is a Union[T, None]
- if is_union(type(c)) and type(None) in get_args(type(c)) and c is None:
+ if c is None:
return None
if v != c:
diff --git a/src/bolt_api_sdk/utils/unmarshal_json_response.py b/src/bolt_api_sdk/utils/unmarshal_json_response.py
index 30f52d8..0dc6b0c 100644
--- a/src/bolt_api_sdk/utils/unmarshal_json_response.py
+++ b/src/bolt_api_sdk/utils/unmarshal_json_response.py
@@ -1,12 +1,26 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
-from typing import Any, Optional
+from typing import Any, Optional, Type, TypeVar, overload
import httpx
from .serializers import unmarshal_json
from bolt_api_sdk import errors
+T = TypeVar("T")
+
+
+@overload
+def unmarshal_json_response(
+ typ: Type[T], http_res: httpx.Response, body: Optional[str] = None
+) -> T: ...
+
+
+@overload
+def unmarshal_json_response(
+ typ: Any, http_res: httpx.Response, body: Optional[str] = None
+) -> Any: ...
+
def unmarshal_json_response(
typ: Any, http_res: httpx.Response, body: Optional[str] = None
diff --git a/src/bolt_api_sdk/webhooks.py b/src/bolt_api_sdk/webhooks.py
index 257ce45..c6ba53f 100644
--- a/src/bolt_api_sdk/webhooks.py
+++ b/src/bolt_api_sdk/webhooks.py
@@ -25,6 +25,8 @@ def query_webhooks(
Find webhook configurations belonging to a merchant division. Results are limited to only show webhooks authorized by the X-API-Key.
+ If set, this operation will use `x_api_key` from the global security.
+
:param division_id: The unique ID associated to the merchant's Bolt Account division; Merchants can have different divisions to suit multiple use cases (storefronts, pay-by-link, phone order processing). You can view and switch between these divisions from the Bolt Merchant Dashboard.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -58,6 +60,8 @@ def query_webhooks(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -74,7 +78,7 @@ def query_webhooks(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="queryWebhooks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -114,6 +118,8 @@ async def query_webhooks_async(
Find webhook configurations belonging to a merchant division. Results are limited to only show webhooks authorized by the X-API-Key.
+ If set, this operation will use `x_api_key` from the global security.
+
:param division_id: The unique ID associated to the merchant's Bolt Account division; Merchants can have different divisions to suit multiple use cases (storefronts, pay-by-link, phone order processing). You can view and switch between these divisions from the Bolt Merchant Dashboard.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -147,6 +153,8 @@ async def query_webhooks_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -163,7 +171,7 @@ async def query_webhooks_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="queryWebhooks",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -205,6 +213,8 @@ def create_webhook(
Create a new webhook to receive notifications from Bolt about various events, such as transaction status. Webhooks must have unique configuration.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -241,6 +251,8 @@ def create_webhook(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.CreateWebhookRequest
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -257,7 +269,7 @@ def create_webhook(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -299,6 +311,8 @@ async def create_webhook_async(
Create a new webhook to receive notifications from Bolt about various events, such as transaction status. Webhooks must have unique configuration.
+ If set, this operation will use `x_api_key` from the global security.
+
:param request: The request object to send.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -335,6 +349,8 @@ async def create_webhook_async(
get_serialized_body=lambda: utils.serialize_request_body(
request, False, False, "json", models.CreateWebhookRequest
),
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -351,7 +367,7 @@ async def create_webhook_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="createWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -391,6 +407,8 @@ def delete_webhook(
Delete a Bolt webhook. Provide an authorized X-API-Key to perform this action.
+ If set, this operation will use `x_api_key` from the global security.
+
:param webhook_id: Webhook ID
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -424,6 +442,8 @@ def delete_webhook(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -440,7 +460,7 @@ def delete_webhook(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="deleteWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -480,6 +500,8 @@ async def delete_webhook_async(
Delete a Bolt webhook. Provide an authorized X-API-Key to perform this action.
+ If set, this operation will use `x_api_key` from the global security.
+
:param webhook_id: Webhook ID
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -513,6 +535,8 @@ async def delete_webhook_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -529,7 +553,7 @@ async def delete_webhook_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="deleteWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -569,6 +593,8 @@ def get_webhook(
Get Webhook information by its Webhook ID. Results only include webhooks authorized by the X-API-Key.
+ If set, this operation will use `x_api_key` from the global security.
+
:param webhook_id: Webhook ID
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -602,6 +628,8 @@ def get_webhook(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -618,7 +646,7 @@ def get_webhook(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),
@@ -658,6 +686,8 @@ async def get_webhook_async(
Get Webhook information by its Webhook ID. Results only include webhooks authorized by the X-API-Key.
+ If set, this operation will use `x_api_key` from the global security.
+
:param webhook_id: Webhook ID
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
@@ -691,6 +721,8 @@ async def get_webhook_async(
accept_header_value="application/json",
http_headers=http_headers,
security=self.sdk_configuration.security,
+ allow_empty_value=None,
+ allowed_fields=["x_api_key"],
timeout_ms=timeout_ms,
)
@@ -707,7 +739,7 @@ async def get_webhook_async(
config=self.sdk_configuration,
base_url=base_url or "",
operation_id="getWebhook",
- oauth2_scopes=[],
+ oauth2_scopes=None,
security_source=get_security_from_env(
self.sdk_configuration.security, models.Security
),