diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..99bbdc4 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# uvx ruff format +c1de3e776998c4128593c584413d143f1e0e2bd4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efbe957..219dc42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,4 +37,4 @@ jobs: - name: Run unit tests run: | - python -m unittest discover -v || true + python -m unittest discover -v diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ce5f66..949c755 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Verify tag matches package version + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + PACKAGE_VERSION="$(cat chargebee/version.py | cut -d'"' -f2)" + + echo "Tag version: $TAG_VERSION" + echo "Package version: $PACKAGE_VERSION" + + if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then + echo "❌ Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)" + exit 1 + fi + echo "✅ Tag matches package version." + - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0925055..d8072de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### v3.11.0b1 (2025-08-27) +* * * + +### New Features +* Use `httpx` instead of `requests`, thereby adding support for asynchronous API requests. ### v3.10.0 (2025-08-25) * * * diff --git a/README.md b/README.md index 0c85c9f..bc2982e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,33 @@ customer = response.customer card = response.card ``` +### Async HTTP client + +Starting with version `3.9.0`, the Chargebee Python SDK can optionally be configured to use an asynchronous HTTP client which uses `asyncio` to perform non-blocking requests. This can be enabled by passing the `use_async_client=True` argument to the constructor: + +```python +cb_client = Chargebee(api_key="api_key", site="site", use_async_client=True) +``` + +When configured to use the async client, all model methods return a coroutine, which will have to be awaited to get the response: + +```python +async def get_customers(): + response = await cb_client.Customer.list( + cb_client.Customer.ListParams( + first_name=Filters.StringFilter(IS="John") + ) + ) + return response +``` + +Note: The async methods will have to be wrapped in an event loop during invocation. For example, the `asyncio.run` method can be used to run the above example: + +```python +import asyncio +response = asyncio.run(get_customers()) +``` + ### List API Request With Filter For pagination, `offset` is the parameter that is being used. The value used for this parameter must be the value returned in `next_offset` parameter from the previous API call. diff --git a/chargebee/api_error.py b/chargebee/api_error.py index 333d446..f47feed 100644 --- a/chargebee/api_error.py +++ b/chargebee/api_error.py @@ -1,5 +1,4 @@ class APIError(Exception): - def __init__(self, http_code, json_obj, headers=None): Exception.__init__(self, json_obj.get("message")) self.json_obj = json_obj diff --git a/chargebee/compat.py b/chargebee/compat.py index f046dfb..3e9667a 100644 --- a/chargebee/compat.py +++ b/chargebee/compat.py @@ -10,3 +10,9 @@ if py_major_v >= 3: from urllib.parse import urlencode, urlparse + +# httpx supports trio and asyncio +try: + import trio as event_loop +except ImportError: + import asyncio as event_loop diff --git a/chargebee/environment.py b/chargebee/environment.py index 64c9acf..be860d7 100644 --- a/chargebee/environment.py +++ b/chargebee/environment.py @@ -11,6 +11,7 @@ class Environment(object): time_travel_retry_delay_ms = 3000 retry_config = RetryConfig() enable_debug_logs = False + use_async_client = False def __init__(self, options): self.api_key = options["api_key"] diff --git a/chargebee/http_request.py b/chargebee/http_request.py index 54a0b0c..217beb5 100644 --- a/chargebee/http_request.py +++ b/chargebee/http_request.py @@ -5,8 +5,9 @@ import random import re import time +import ssl -import requests +import httpx from chargebee import ( APIError, @@ -14,7 +15,7 @@ InvalidRequestError, OperationFailedError, ) -from chargebee import compat, util +from chargebee import compat, util, environment from chargebee.main import Chargebee from chargebee.version import VERSION @@ -30,31 +31,32 @@ def _basic_auth_str(username): def request( method, url, - env, + env: environment.Environment, params=None, headers=None, subDomain=None, isJsonRequest=False, - options=None, + options={}, + use_async_client=False, ): if not env: raise Exception("No environment configured.") - if headers is None: - headers = {} + + headers = headers or {} + request_args = {"method": method.upper()} retry_config = env.get_retry_config() if hasattr(env, "get_retry_config") else None url = env.api_url(url, subDomain) - if method.lower() in ("get", "head", "delete"): - url = "%s?%s" % (url, compat.urlencode(params)) - payload = None - else: - if isJsonRequest: - payload = params - headers["Content-type"] = "application/json;charset=UTF-8" - else: - payload = compat.urlencode(params) - headers["Content-type"] = "application/x-www-form-urlencoded" + match method.lower(), isJsonRequest: + case "get" | "head" | "delete", _: + request_args["params"] = params + case _, True: + headers["Content-Type"] = "application/json;charset=UTF-8" + request_args["json"] = params + case _, False: + headers["Content-Type"] = "application/x-www-form-urlencoded" + request_args["data"] = params headers.update( { @@ -71,7 +73,7 @@ def request( idempotency_key is None and retry_config.is_enabled() and method.lower() == "post" - and options["isIdempotent"] + and options.get("isIdempotent") ): headers[Chargebee.idempotency_header] = util.generate_uuid_v4() @@ -79,20 +81,34 @@ def request( scheme = "https" if Chargebee.verify_ca_certs or env.protocol == "https" else "http" full_url = f"{scheme}://{meta.netloc + meta.path + '?' + meta.query}" + timeout = httpx.Timeout( + None, + connect=env.connect_timeout, + read=env.read_timeout, + ) + request_args = { - "method": method.upper(), - "timeout": (env.connect_timeout, env.read_timeout), - "data": payload, + **request_args, + "timeout": timeout, "headers": headers, "url": full_url, } + if Chargebee.verify_ca_certs: - request_args["verify"] = Chargebee.ca_cert_path + ctx = ssl.create_default_context(cafile=Chargebee.ca_cert_path) + request_args["verify"] = ctx - return process_response(full_url, request_args, retry_config, env.enable_debug_logs) + if use_async_client: + return _process_response_async( + full_url, request_args, retry_config, env.enable_debug_logs + ) + else: + return _process_response( + full_url, request_args, retry_config, env.enable_debug_logs + ) -def process_response(url, request_args, retry_config, enable_debug_logs): +def _process_response(url, request_args, retry_config, enable_debug_logs): retry_count = 0 while True: @@ -107,30 +123,75 @@ def process_response(url, request_args, retry_config, enable_debug_logs): } ) ) - if request_args["data"]: - _logger.debug("PAYLOAD: {0}".format(request_args["data"])) + if payload := request_args.get("json", request_args.get("data")): + _logger.debug("PAYLOAD: {0}".format(payload)) if retry_count > 0: headers = request_args.get("headers", {}) headers["X-CB-Retry-Attempt"] = str(retry_count) request_args["headers"] = headers - response = requests.request(**request_args) - _logger.debug( - f"{request_args['method']} Response: {response.status_code} - {response.text}" + return _make_request(request_args) + + except Exception as err: + status_code = extract_status_code(err) + + if not retry_config or not retry_config.is_enabled(): + raise err + + if status_code == 429: + delay_ms = parse_retry_after(err) or retry_config.get_delay_ms() + log( + f"Rate limit hit. Retrying in {delay_ms}ms", + "INFO", + enable_debug_logs, + ) + sleep(delay_ms) + retry_count += 1 + continue + + if not should_retry(status_code, retry_count, retry_config): + log( + f"Request failed after {retry_count} retries: {str(err)}", + "ERROR", + enable_debug_logs, + ) + raise err + + delay_ms = calculate_backoff_delay(retry_count, retry_config.get_delay_ms()) + log( + f"Retrying [{retry_count + 1}/{retry_config.get_max_retries()}] in {delay_ms}ms due to status {status_code}", + "INFO", + enable_debug_logs, ) + sleep(delay_ms) + retry_count += 1 - try: - resp_json = compat.json.loads(response.text) - except Exception: - raise map_plaintext_to_error(response) - if response.status_code < 200 or response.status_code > 299: - handle_api_resp_error( - url, response.status_code, resp_json, response.headers +async def _process_response_async(url, request_args, retry_config, enable_debug_logs): + retry_count = 0 + + while True: + try: + _logger.debug(f"{request_args['method']} Request: {url}") + _logger.debug( + "HEADERS: {0}".format( + { + k: v + for k, v in request_args["headers"].items() + if k.lower() != "authorization" + } ) + ) + if payload := request_args.get("json", request_args.get("data")): + _logger.debug("PAYLOAD: {0}".format(payload)) + + if retry_count > 0: + headers = request_args.get("headers", {}) + headers["X-CB-Retry-Attempt"] = str(retry_count) + request_args["headers"] = headers - return resp_json, response.headers, response.status_code + return await _make_request_async(request_args) except Exception as err: status_code = extract_status_code(err) @@ -145,7 +206,7 @@ def process_response(url, request_args, retry_config, enable_debug_logs): "INFO", enable_debug_logs, ) - sleep(delay_ms) + await sleep_async(delay_ms) retry_count += 1 continue @@ -163,10 +224,44 @@ def process_response(url, request_args, retry_config, enable_debug_logs): "INFO", enable_debug_logs, ) - sleep(delay_ms) + await sleep_async(delay_ms) retry_count += 1 +def _handle_response(request_args: dict, response: httpx.Response): + _logger.debug( + f"{request_args['method']} Response: {response.status_code} - {response.text}" + ) + + try: + resp_json = compat.json.loads(response.text) + except Exception: + raise map_plaintext_to_error(response) + + if response.status_code < 200 or response.status_code > 299: + handle_api_resp_error( + request_args["url"], response.status_code, resp_json, response.headers + ) + + return resp_json, response.headers, response.status_code + + +def _make_request(request_args): + """Make a synchronous HTTP request using httpx""" + verify = request_args.pop("verify", True) + with httpx.Client(verify=verify) as client: + response = client.request(**request_args) + return _handle_response(request_args, response) + + +async def _make_request_async(request_args): + """Make an asynchronous HTTP request using httpx""" + verify = request_args.pop("verify", True) + async with httpx.AsyncClient(verify=verify) as client: + response = await client.request(**request_args) + return _handle_response(request_args, response) + + def map_plaintext_to_error(response): text = response.text if "503" in text: @@ -246,6 +341,10 @@ def sleep(milliseconds): time.sleep(milliseconds / 1000.0) +async def sleep_async(milliseconds): + await compat.event_loop.sleep(milliseconds / 1000.0) + + def log(message, level="INFO", enable_debug_logs=False): if enable_debug_logs: print(f"[{level}] {message}") diff --git a/chargebee/main.py b/chargebee/main.py index 2a67068..9d87456 100644 --- a/chargebee/main.py +++ b/chargebee/main.py @@ -7,7 +7,6 @@ @dataclass class Chargebee: - env: Environment = None idempotency_header: str = "chargebee-idempotency-key" @@ -22,6 +21,7 @@ def __init__( protocol: str = None, connection_time_out: int = None, read_time_out: int = None, + use_async_client: bool = False, ): self.env = Environment({"api_key": api_key, "site": site}) if chargebee_domain is not None: @@ -32,6 +32,8 @@ def __init__( self.update_connect_timeout_secs(connection_time_out) if read_time_out is not None: self.update_read_timeout_secs(read_time_out) + if use_async_client: + self.env.use_async_client = True self.env.set_api_endpoint() self.Addon = chargebee.Addon(self.env) diff --git a/chargebee/model.py b/chargebee/model.py index d117ea6..8b0af05 100644 --- a/chargebee/model.py +++ b/chargebee/model.py @@ -3,7 +3,6 @@ class Model(object): - def __init__(self, values): self.raw_data = values self._response_type = self.__class__ diff --git a/chargebee/models/addon/operations.py b/chargebee/models/addon/operations.py index 4e04ba3..54b5677 100644 --- a/chargebee/models/addon/operations.py +++ b/chargebee/models/addon/operations.py @@ -8,7 +8,6 @@ @dataclass class Addon: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/addon/responses.py b/chargebee/models/addon/responses.py index ba2ecd4..2a5e75d 100644 --- a/chargebee/models/addon/responses.py +++ b/chargebee/models/addon/responses.py @@ -93,14 +93,12 @@ class ListAddonResponse: @dataclass class ListResponse(Response): - list: List[ListAddonResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - addon: AddonResponse diff --git a/chargebee/models/address/operations.py b/chargebee/models/address/operations.py index c0feeb1..130b6d6 100644 --- a/chargebee/models/address/operations.py +++ b/chargebee/models/address/operations.py @@ -6,7 +6,6 @@ @dataclass class Address: - env: environment.Environment class RetrieveParams(TypedDict): diff --git a/chargebee/models/address/responses.py b/chargebee/models/address/responses.py index 202f06e..cd7ad5d 100644 --- a/chargebee/models/address/responses.py +++ b/chargebee/models/address/responses.py @@ -27,7 +27,6 @@ class AddressResponse(Model): @dataclass class RetrieveResponse(Response): - address: AddressResponse diff --git a/chargebee/models/advance_invoice_schedule/operations.py b/chargebee/models/advance_invoice_schedule/operations.py index bf060be..2f60337 100644 --- a/chargebee/models/advance_invoice_schedule/operations.py +++ b/chargebee/models/advance_invoice_schedule/operations.py @@ -7,7 +7,6 @@ @dataclass class AdvanceInvoiceSchedule: - env: environment.Environment class ScheduleType(Enum): diff --git a/chargebee/models/attached_item/operations.py b/chargebee/models/attached_item/operations.py index 93dae6c..c15fc25 100644 --- a/chargebee/models/attached_item/operations.py +++ b/chargebee/models/attached_item/operations.py @@ -8,7 +8,6 @@ @dataclass class AttachedItem: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/attached_item/responses.py b/chargebee/models/attached_item/responses.py index 78b4a9f..fc1f57e 100644 --- a/chargebee/models/attached_item/responses.py +++ b/chargebee/models/attached_item/responses.py @@ -39,7 +39,6 @@ class UpdateResponse(Response): @dataclass class RetrieveResponse(Response): - attached_item: AttachedItemResponse @@ -56,6 +55,5 @@ class ListAttachedItemResponse: @dataclass class ListResponse(Response): - list: List[ListAttachedItemResponse] next_offset: str = None diff --git a/chargebee/models/attribute/operations.py b/chargebee/models/attribute/operations.py index 4895d55..609e561 100644 --- a/chargebee/models/attribute/operations.py +++ b/chargebee/models/attribute/operations.py @@ -5,7 +5,6 @@ @dataclass class Attribute: - env: environment.Environment pass diff --git a/chargebee/models/billing_configuration/operations.py b/chargebee/models/billing_configuration/operations.py index fea0c73..9acd99b 100644 --- a/chargebee/models/billing_configuration/operations.py +++ b/chargebee/models/billing_configuration/operations.py @@ -5,7 +5,6 @@ @dataclass class BillingConfiguration: - env: environment.Environment class BillingDate(TypedDict): diff --git a/chargebee/models/brand/operations.py b/chargebee/models/brand/operations.py index f08f0d1..04d9c94 100644 --- a/chargebee/models/brand/operations.py +++ b/chargebee/models/brand/operations.py @@ -5,7 +5,6 @@ @dataclass class Brand: - env: environment.Environment pass diff --git a/chargebee/models/business_entity/operations.py b/chargebee/models/business_entity/operations.py index 2416b01..9ebb708 100644 --- a/chargebee/models/business_entity/operations.py +++ b/chargebee/models/business_entity/operations.py @@ -7,7 +7,6 @@ @dataclass class BusinessEntity: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/business_entity/responses.py b/chargebee/models/business_entity/responses.py index 0d207e8..750af65 100644 --- a/chargebee/models/business_entity/responses.py +++ b/chargebee/models/business_entity/responses.py @@ -30,6 +30,5 @@ class GetTransfersBusinessEntityResponse: @dataclass class GetTransfersResponse(Response): - list: List[GetTransfersBusinessEntityResponse] next_offset: str = None diff --git a/chargebee/models/business_entity_transfer/operations.py b/chargebee/models/business_entity_transfer/operations.py index e0eb6a9..96cebe8 100644 --- a/chargebee/models/business_entity_transfer/operations.py +++ b/chargebee/models/business_entity_transfer/operations.py @@ -6,7 +6,6 @@ @dataclass class BusinessEntityTransfer: - env: environment.Environment class ResourceType(Enum): diff --git a/chargebee/models/card/operations.py b/chargebee/models/card/operations.py index 3749d58..25d3e2e 100644 --- a/chargebee/models/card/operations.py +++ b/chargebee/models/card/operations.py @@ -7,7 +7,6 @@ @dataclass class Card: - env: environment.Environment class PreferredScheme(Enum): diff --git a/chargebee/models/card/responses.py b/chargebee/models/card/responses.py index c7820b4..2236b49 100644 --- a/chargebee/models/card/responses.py +++ b/chargebee/models/card/responses.py @@ -40,7 +40,6 @@ class CardResponse(Model): @dataclass class RetrieveResponse(Response): - card: CardResponse diff --git a/chargebee/models/comment/operations.py b/chargebee/models/comment/operations.py index e51aff1..5cc1075 100644 --- a/chargebee/models/comment/operations.py +++ b/chargebee/models/comment/operations.py @@ -8,7 +8,6 @@ @dataclass class Comment: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/comment/responses.py b/chargebee/models/comment/responses.py index 7c29d8e..5e9dd24 100644 --- a/chargebee/models/comment/responses.py +++ b/chargebee/models/comment/responses.py @@ -25,7 +25,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - comment: CommentResponse @@ -36,7 +35,6 @@ class ListCommentResponse: @dataclass class ListResponse(Response): - list: List[ListCommentResponse] next_offset: str = None diff --git a/chargebee/models/configuration/operations.py b/chargebee/models/configuration/operations.py index a422b0d..e79f871 100644 --- a/chargebee/models/configuration/operations.py +++ b/chargebee/models/configuration/operations.py @@ -5,7 +5,6 @@ @dataclass class Configuration: - env: environment.Environment def list(self, headers=None) -> ListResponse: diff --git a/chargebee/models/configuration/responses.py b/chargebee/models/configuration/responses.py index 3ca574a..13a183d 100644 --- a/chargebee/models/configuration/responses.py +++ b/chargebee/models/configuration/responses.py @@ -14,5 +14,4 @@ class ConfigurationResponse(Model): @dataclass class ListResponse(Response): - configurations: List[ConfigurationResponse] diff --git a/chargebee/models/contact/operations.py b/chargebee/models/contact/operations.py index 9418aee..fef8a0e 100644 --- a/chargebee/models/contact/operations.py +++ b/chargebee/models/contact/operations.py @@ -5,7 +5,6 @@ @dataclass class Contact: - env: environment.Environment pass diff --git a/chargebee/models/contract_term/operations.py b/chargebee/models/contract_term/operations.py index 17cb968..34b78d9 100644 --- a/chargebee/models/contract_term/operations.py +++ b/chargebee/models/contract_term/operations.py @@ -6,7 +6,6 @@ @dataclass class ContractTerm: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/coupon/operations.py b/chargebee/models/coupon/operations.py index 6246a8e..8d4e015 100644 --- a/chargebee/models/coupon/operations.py +++ b/chargebee/models/coupon/operations.py @@ -8,7 +8,6 @@ @dataclass class Coupon: - env: environment.Environment class DiscountType(Enum): diff --git a/chargebee/models/coupon/responses.py b/chargebee/models/coupon/responses.py index cae2d85..6f413f8 100644 --- a/chargebee/models/coupon/responses.py +++ b/chargebee/models/coupon/responses.py @@ -93,14 +93,12 @@ class ListCouponResponse: @dataclass class ListResponse(Response): - list: List[ListCouponResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - coupon: CouponResponse diff --git a/chargebee/models/coupon_code/operations.py b/chargebee/models/coupon_code/operations.py index 7ef3a6c..1d48651 100644 --- a/chargebee/models/coupon_code/operations.py +++ b/chargebee/models/coupon_code/operations.py @@ -7,7 +7,6 @@ @dataclass class CouponCode: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/coupon_code/responses.py b/chargebee/models/coupon_code/responses.py index 7d6241c..c0c962c 100644 --- a/chargebee/models/coupon_code/responses.py +++ b/chargebee/models/coupon_code/responses.py @@ -22,7 +22,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - coupon_code: CouponCodeResponse @@ -33,7 +32,6 @@ class ListCouponCodeResponse: @dataclass class ListResponse(Response): - list: List[ListCouponCodeResponse] next_offset: str = None diff --git a/chargebee/models/coupon_set/operations.py b/chargebee/models/coupon_set/operations.py index 9fca822..082522e 100644 --- a/chargebee/models/coupon_set/operations.py +++ b/chargebee/models/coupon_set/operations.py @@ -6,7 +6,6 @@ @dataclass class CouponSet: - env: environment.Environment class CreateParams(TypedDict): diff --git a/chargebee/models/coupon_set/responses.py b/chargebee/models/coupon_set/responses.py index eb5bc17..9c5a1f0 100644 --- a/chargebee/models/coupon_set/responses.py +++ b/chargebee/models/coupon_set/responses.py @@ -35,14 +35,12 @@ class ListCouponSetResponse: @dataclass class ListResponse(Response): - list: List[ListCouponSetResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - coupon_set: CouponSetResponse diff --git a/chargebee/models/credit_note/operations.py b/chargebee/models/credit_note/operations.py index da8aebb..8425c14 100644 --- a/chargebee/models/credit_note/operations.py +++ b/chargebee/models/credit_note/operations.py @@ -8,7 +8,6 @@ @dataclass class CreditNote: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/credit_note/responses.py b/chargebee/models/credit_note/responses.py index a4c8ed4..cd43c2b 100644 --- a/chargebee/models/credit_note/responses.py +++ b/chargebee/models/credit_note/responses.py @@ -266,7 +266,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - credit_note: CreditNoteResponse @@ -278,7 +277,6 @@ class PdfResponse(Response): @dataclass class DownloadEinvoiceResponse(Response): - downloads: List["download.DownloadResponse"] @@ -309,7 +307,6 @@ class ListCreditNoteResponse: @dataclass class ListResponse(Response): - list: List[ListCreditNoteResponse] next_offset: str = None @@ -321,7 +318,6 @@ class CreditNotesForCustomerCreditNoteResponse: @dataclass class CreditNotesForCustomerResponse(Response): - list: List[CreditNotesForCustomerCreditNoteResponse] next_offset: str = None diff --git a/chargebee/models/credit_note_estimate/operations.py b/chargebee/models/credit_note_estimate/operations.py index 005b301..92c960f 100644 --- a/chargebee/models/credit_note_estimate/operations.py +++ b/chargebee/models/credit_note_estimate/operations.py @@ -7,7 +7,6 @@ @dataclass class CreditNoteEstimate: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/currency/operations.py b/chargebee/models/currency/operations.py index 6df7bcf..e023d51 100644 --- a/chargebee/models/currency/operations.py +++ b/chargebee/models/currency/operations.py @@ -6,7 +6,6 @@ @dataclass class Currency: - env: environment.Environment class ForexType(Enum): diff --git a/chargebee/models/currency/responses.py b/chargebee/models/currency/responses.py index e40bb0a..f80f322 100644 --- a/chargebee/models/currency/responses.py +++ b/chargebee/models/currency/responses.py @@ -17,13 +17,11 @@ class CurrencyResponse(Model): @dataclass class ListResponse(Response): - currency: CurrencyResponse @dataclass class RetrieveResponse(Response): - currency: CurrencyResponse diff --git a/chargebee/models/customer/operations.py b/chargebee/models/customer/operations.py index fee47bf..b51efd9 100644 --- a/chargebee/models/customer/operations.py +++ b/chargebee/models/customer/operations.py @@ -8,7 +8,6 @@ @dataclass class Customer: - env: environment.Environment class VatNumberStatus(Enum): diff --git a/chargebee/models/customer/responses.py b/chargebee/models/customer/responses.py index d1f93ba..41bc27a 100644 --- a/chargebee/models/customer/responses.py +++ b/chargebee/models/customer/responses.py @@ -212,14 +212,12 @@ class ListCustomerResponse: @dataclass class ListResponse(Response): - list: List[ListCustomerResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - customer: CustomerResponse card: "card.CardResponse" = None @@ -252,7 +250,6 @@ class ContactsForCustomerCustomerResponse: @dataclass class ContactsForCustomerResponse(Response): - list: List[ContactsForCustomerCustomerResponse] next_offset: str = None @@ -362,7 +359,6 @@ class DeleteRelationshipResponse(Response): @dataclass class HierarchyResponse(Response): - hierarchies: List["hierarchy.HierarchyResponse"] @@ -373,7 +369,6 @@ class ListHierarchyDetailCustomerResponse: @dataclass class ListHierarchyDetailResponse(Response): - list: List[ListHierarchyDetailCustomerResponse] next_offset: str = None diff --git a/chargebee/models/customer_entitlement/operations.py b/chargebee/models/customer_entitlement/operations.py index 84a0b9a..86dd52e 100644 --- a/chargebee/models/customer_entitlement/operations.py +++ b/chargebee/models/customer_entitlement/operations.py @@ -5,7 +5,6 @@ @dataclass class CustomerEntitlement: - env: environment.Environment class EntitlementsForCustomerParams(TypedDict): diff --git a/chargebee/models/customer_entitlement/responses.py b/chargebee/models/customer_entitlement/responses.py index 5b212d3..0a18b92 100644 --- a/chargebee/models/customer_entitlement/responses.py +++ b/chargebee/models/customer_entitlement/responses.py @@ -22,6 +22,5 @@ class EntitlementsForCustomerCustomerEntitlementResponse: @dataclass class EntitlementsForCustomerResponse(Response): - list: List[EntitlementsForCustomerCustomerEntitlementResponse] next_offset: str = None diff --git a/chargebee/models/differential_price/operations.py b/chargebee/models/differential_price/operations.py index 230c6ec..d40fd6c 100644 --- a/chargebee/models/differential_price/operations.py +++ b/chargebee/models/differential_price/operations.py @@ -8,7 +8,6 @@ @dataclass class DifferentialPrice: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/differential_price/responses.py b/chargebee/models/differential_price/responses.py index 188a100..f9aacce 100644 --- a/chargebee/models/differential_price/responses.py +++ b/chargebee/models/differential_price/responses.py @@ -52,7 +52,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - differential_price: DifferentialPriceResponse @@ -75,6 +74,5 @@ class ListDifferentialPriceResponse: @dataclass class ListResponse(Response): - list: List[ListDifferentialPriceResponse] next_offset: str = None diff --git a/chargebee/models/discount/operations.py b/chargebee/models/discount/operations.py index 74c290d..3ded8c7 100644 --- a/chargebee/models/discount/operations.py +++ b/chargebee/models/discount/operations.py @@ -6,7 +6,6 @@ @dataclass class Discount: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/download/operations.py b/chargebee/models/download/operations.py index f0ecbf0..b5d2a17 100644 --- a/chargebee/models/download/operations.py +++ b/chargebee/models/download/operations.py @@ -5,7 +5,6 @@ @dataclass class Download: - env: environment.Environment pass diff --git a/chargebee/models/entitlement/operations.py b/chargebee/models/entitlement/operations.py index a787642..3a7740e 100644 --- a/chargebee/models/entitlement/operations.py +++ b/chargebee/models/entitlement/operations.py @@ -8,7 +8,6 @@ @dataclass class Entitlement: - env: environment.Environment class EntityType(Enum): diff --git a/chargebee/models/entitlement/responses.py b/chargebee/models/entitlement/responses.py index 42ebb47..68cc51a 100644 --- a/chargebee/models/entitlement/responses.py +++ b/chargebee/models/entitlement/responses.py @@ -23,7 +23,6 @@ class ListEntitlementResponse: @dataclass class ListResponse(Response): - list: List[ListEntitlementResponse] next_offset: str = None diff --git a/chargebee/models/entitlement_override/operations.py b/chargebee/models/entitlement_override/operations.py index f2cf353..62e4901 100644 --- a/chargebee/models/entitlement_override/operations.py +++ b/chargebee/models/entitlement_override/operations.py @@ -7,7 +7,6 @@ @dataclass class EntitlementOverride: - env: environment.Environment class ScheduleStatus(Enum): diff --git a/chargebee/models/entitlement_override/responses.py b/chargebee/models/entitlement_override/responses.py index 3a115fa..b7496a2 100644 --- a/chargebee/models/entitlement_override/responses.py +++ b/chargebee/models/entitlement_override/responses.py @@ -32,6 +32,5 @@ class ListEntitlementOverrideForSubscriptionEntitlementOverrideResponse: @dataclass class ListEntitlementOverrideForSubscriptionResponse(Response): - list: List[ListEntitlementOverrideForSubscriptionEntitlementOverrideResponse] next_offset: str = None diff --git a/chargebee/models/estimate/operations.py b/chargebee/models/estimate/operations.py index d4ec423..40f7e64 100644 --- a/chargebee/models/estimate/operations.py +++ b/chargebee/models/estimate/operations.py @@ -16,7 +16,6 @@ @dataclass class Estimate: - env: environment.Environment class PaymentScheduleEstimateEntityType(Enum): diff --git a/chargebee/models/estimate/responses.py b/chargebee/models/estimate/responses.py index 39eff9e..d7e0337 100644 --- a/chargebee/models/estimate/responses.py +++ b/chargebee/models/estimate/responses.py @@ -47,7 +47,6 @@ class CreateSubItemEstimateResponse(Response): @dataclass class CreateSubForCustomerEstimateResponse(Response): - estimate: EstimateResponse @@ -71,7 +70,6 @@ class UpdateSubscriptionForItemsResponse(Response): @dataclass class RenewalEstimateResponse(Response): - estimate: EstimateResponse @@ -89,7 +87,6 @@ class RegenerateInvoiceEstimateResponse(Response): @dataclass class UpcomingInvoicesEstimateResponse(Response): - estimate: EstimateResponse diff --git a/chargebee/models/event/operations.py b/chargebee/models/event/operations.py index 2ced185..c5c2e35 100644 --- a/chargebee/models/event/operations.py +++ b/chargebee/models/event/operations.py @@ -9,7 +9,6 @@ @dataclass class Event: - env: environment.Environment class WebhookStatus(Enum): diff --git a/chargebee/models/event/responses.py b/chargebee/models/event/responses.py index a291760..704c117 100644 --- a/chargebee/models/event/responses.py +++ b/chargebee/models/event/responses.py @@ -34,12 +34,10 @@ class ListEventResponse: @dataclass class ListResponse(Response): - list: List[ListEventResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - event: EventResponse diff --git a/chargebee/models/export/operations.py b/chargebee/models/export/operations.py index 6dcb02c..28266bd 100644 --- a/chargebee/models/export/operations.py +++ b/chargebee/models/export/operations.py @@ -8,7 +8,6 @@ @dataclass class Export: - env: environment.Environment class MimeType(Enum): diff --git a/chargebee/models/export/responses.py b/chargebee/models/export/responses.py index 099c5d3..1571eca 100644 --- a/chargebee/models/export/responses.py +++ b/chargebee/models/export/responses.py @@ -25,7 +25,6 @@ class ExportResponse(Model): @dataclass class RetrieveResponse(Response): - export: ExportResponse diff --git a/chargebee/models/feature/operations.py b/chargebee/models/feature/operations.py index c4efa4b..0d0e88b 100644 --- a/chargebee/models/feature/operations.py +++ b/chargebee/models/feature/operations.py @@ -7,7 +7,6 @@ @dataclass class Feature: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/feature/responses.py b/chargebee/models/feature/responses.py index b39823e..c88a26a 100644 --- a/chargebee/models/feature/responses.py +++ b/chargebee/models/feature/responses.py @@ -35,7 +35,6 @@ class ListFeatureResponse: @dataclass class ListResponse(Response): - list: List[ListFeatureResponse] next_offset: str = None @@ -54,7 +53,6 @@ class UpdateResponse(Response): @dataclass class RetrieveResponse(Response): - feature: FeatureResponse diff --git a/chargebee/models/gateway_error_detail/operations.py b/chargebee/models/gateway_error_detail/operations.py index 19370ac..50afed5 100644 --- a/chargebee/models/gateway_error_detail/operations.py +++ b/chargebee/models/gateway_error_detail/operations.py @@ -5,7 +5,6 @@ @dataclass class GatewayErrorDetail: - env: environment.Environment pass diff --git a/chargebee/models/gift/operations.py b/chargebee/models/gift/operations.py index ef5d1d3..36721f8 100644 --- a/chargebee/models/gift/operations.py +++ b/chargebee/models/gift/operations.py @@ -8,7 +8,6 @@ @dataclass class Gift: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/gift/responses.py b/chargebee/models/gift/responses.py index 87812a4..4c83997 100644 --- a/chargebee/models/gift/responses.py +++ b/chargebee/models/gift/responses.py @@ -65,7 +65,6 @@ class CreateForItemsResponse(Response): @dataclass class RetrieveResponse(Response): - gift: GiftResponse subscription: "subscription.SubscriptionResponse" @@ -78,7 +77,6 @@ class ListGiftResponse: @dataclass class ListResponse(Response): - list: List[ListGiftResponse] next_offset: str = None diff --git a/chargebee/models/hierarchy/operations.py b/chargebee/models/hierarchy/operations.py index 84f2904..851bb0d 100644 --- a/chargebee/models/hierarchy/operations.py +++ b/chargebee/models/hierarchy/operations.py @@ -5,7 +5,6 @@ @dataclass class Hierarchy: - env: environment.Environment pass diff --git a/chargebee/models/hosted_page/operations.py b/chargebee/models/hosted_page/operations.py index c90c383..b4e74c9 100644 --- a/chargebee/models/hosted_page/operations.py +++ b/chargebee/models/hosted_page/operations.py @@ -8,7 +8,6 @@ @dataclass class HostedPage: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/hosted_page/responses.py b/chargebee/models/hosted_page/responses.py index b85c708..dcc075e 100644 --- a/chargebee/models/hosted_page/responses.py +++ b/chargebee/models/hosted_page/responses.py @@ -128,7 +128,6 @@ class AcknowledgeResponse(Response): @dataclass class RetrieveResponse(Response): - hosted_page: HostedPageResponse @@ -139,7 +138,6 @@ class ListHostedPageResponse: @dataclass class ListResponse(Response): - list: List[ListHostedPageResponse] next_offset: str = None diff --git a/chargebee/models/impacted_customer/operations.py b/chargebee/models/impacted_customer/operations.py index c72f79f..93b89cb 100644 --- a/chargebee/models/impacted_customer/operations.py +++ b/chargebee/models/impacted_customer/operations.py @@ -5,7 +5,6 @@ @dataclass class ImpactedCustomer: - env: environment.Environment class Download(TypedDict): diff --git a/chargebee/models/impacted_item/operations.py b/chargebee/models/impacted_item/operations.py index 5dc7978..6c2f0f7 100644 --- a/chargebee/models/impacted_item/operations.py +++ b/chargebee/models/impacted_item/operations.py @@ -5,7 +5,6 @@ @dataclass class ImpactedItem: - env: environment.Environment class Download(TypedDict): diff --git a/chargebee/models/impacted_item_price/operations.py b/chargebee/models/impacted_item_price/operations.py index a8029ae..a093598 100644 --- a/chargebee/models/impacted_item_price/operations.py +++ b/chargebee/models/impacted_item_price/operations.py @@ -5,7 +5,6 @@ @dataclass class ImpactedItemPrice: - env: environment.Environment class Download(TypedDict): diff --git a/chargebee/models/impacted_subscription/operations.py b/chargebee/models/impacted_subscription/operations.py index b671361..ec2804a 100644 --- a/chargebee/models/impacted_subscription/operations.py +++ b/chargebee/models/impacted_subscription/operations.py @@ -5,7 +5,6 @@ @dataclass class ImpactedSubscription: - env: environment.Environment class Download(TypedDict): diff --git a/chargebee/models/in_app_subscription/operations.py b/chargebee/models/in_app_subscription/operations.py index 60d4169..d8ecb34 100644 --- a/chargebee/models/in_app_subscription/operations.py +++ b/chargebee/models/in_app_subscription/operations.py @@ -6,7 +6,6 @@ @dataclass class InAppSubscription: - env: environment.Environment class StoreStatus(Enum): diff --git a/chargebee/models/invoice/operations.py b/chargebee/models/invoice/operations.py index 74d3754..e208a0e 100644 --- a/chargebee/models/invoice/operations.py +++ b/chargebee/models/invoice/operations.py @@ -15,7 +15,6 @@ @dataclass class Invoice: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/invoice/responses.py b/chargebee/models/invoice/responses.py index 720dbcf..5e5bcc8 100644 --- a/chargebee/models/invoice/responses.py +++ b/chargebee/models/invoice/responses.py @@ -445,7 +445,6 @@ class ListInvoiceResponse: @dataclass class ListResponse(Response): - list: List[ListInvoiceResponse] next_offset: str = None @@ -457,7 +456,6 @@ class InvoicesForCustomerInvoiceResponse: @dataclass class InvoicesForCustomerResponse(Response): - list: List[InvoicesForCustomerInvoiceResponse] next_offset: str = None @@ -469,14 +467,12 @@ class InvoicesForSubscriptionInvoiceResponse: @dataclass class InvoicesForSubscriptionResponse(Response): - list: List[InvoicesForSubscriptionInvoiceResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - invoice: InvoiceResponse @@ -488,7 +484,6 @@ class PdfResponse(Response): @dataclass class DownloadEinvoiceResponse(Response): - downloads: List["download.DownloadResponse"] @@ -499,7 +494,6 @@ class ListPaymentReferenceNumbersInvoiceResponse: @dataclass class ListPaymentReferenceNumbersResponse(Response): - list: List[ListPaymentReferenceNumbersInvoiceResponse] next_offset: str = None @@ -618,7 +612,6 @@ class ApplyPaymentScheduleSchemeResponse(Response): @dataclass class PaymentSchedulesResponse(Response): - payment_schedules: List["payment_schedule.PaymentScheduleResponse"] diff --git a/chargebee/models/invoice_estimate/operations.py b/chargebee/models/invoice_estimate/operations.py index b02c7f1..f1d265b 100644 --- a/chargebee/models/invoice_estimate/operations.py +++ b/chargebee/models/invoice_estimate/operations.py @@ -7,7 +7,6 @@ @dataclass class InvoiceEstimate: - env: environment.Environment class LineItemEntityType(Enum): diff --git a/chargebee/models/item/operations.py b/chargebee/models/item/operations.py index f75e71a..7ddc6e6 100644 --- a/chargebee/models/item/operations.py +++ b/chargebee/models/item/operations.py @@ -8,7 +8,6 @@ @dataclass class Item: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/item/responses.py b/chargebee/models/item/responses.py index e932750..0049dae 100644 --- a/chargebee/models/item/responses.py +++ b/chargebee/models/item/responses.py @@ -67,7 +67,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - item: ItemResponse @@ -84,7 +83,6 @@ class ListItemResponse: @dataclass class ListResponse(Response): - list: List[ListItemResponse] next_offset: str = None diff --git a/chargebee/models/item_entitlement/operations.py b/chargebee/models/item_entitlement/operations.py index 9b01456..9aef846 100644 --- a/chargebee/models/item_entitlement/operations.py +++ b/chargebee/models/item_entitlement/operations.py @@ -7,7 +7,6 @@ @dataclass class ItemEntitlement: - env: environment.Environment class ItemType(Enum): diff --git a/chargebee/models/item_entitlement/responses.py b/chargebee/models/item_entitlement/responses.py index a1d2a4b..f3b52aa 100644 --- a/chargebee/models/item_entitlement/responses.py +++ b/chargebee/models/item_entitlement/responses.py @@ -23,7 +23,6 @@ class ItemEntitlementsForItemItemEntitlementResponse: @dataclass class ItemEntitlementsForItemResponse(Response): - list: List[ItemEntitlementsForItemItemEntitlementResponse] next_offset: str = None @@ -35,7 +34,6 @@ class ItemEntitlementsForFeatureItemEntitlementResponse: @dataclass class ItemEntitlementsForFeatureResponse(Response): - list: List[ItemEntitlementsForFeatureItemEntitlementResponse] next_offset: str = None diff --git a/chargebee/models/item_family/operations.py b/chargebee/models/item_family/operations.py index 8a17c7d..1bb8b4c 100644 --- a/chargebee/models/item_family/operations.py +++ b/chargebee/models/item_family/operations.py @@ -7,7 +7,6 @@ @dataclass class ItemFamily: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/item_family/responses.py b/chargebee/models/item_family/responses.py index ded56c5..0f7de0d 100644 --- a/chargebee/models/item_family/responses.py +++ b/chargebee/models/item_family/responses.py @@ -26,7 +26,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - item_family: ItemFamilyResponse @@ -37,7 +36,6 @@ class ListItemFamilyResponse: @dataclass class ListResponse(Response): - list: List[ListItemFamilyResponse] next_offset: str = None diff --git a/chargebee/models/item_price/operations.py b/chargebee/models/item_price/operations.py index 0f9d85e..9733854 100644 --- a/chargebee/models/item_price/operations.py +++ b/chargebee/models/item_price/operations.py @@ -8,7 +8,6 @@ @dataclass class ItemPrice: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/item_price/responses.py b/chargebee/models/item_price/responses.py index 4ebc17a..790b717 100644 --- a/chargebee/models/item_price/responses.py +++ b/chargebee/models/item_price/responses.py @@ -105,7 +105,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - item_price: ItemPriceResponse @@ -122,7 +121,6 @@ class ListItemPriceResponse: @dataclass class ListResponse(Response): - list: List[ListItemPriceResponse] next_offset: str = None @@ -140,7 +138,6 @@ class FindApplicableItemsItemPriceResponse: @dataclass class FindApplicableItemsResponse(Response): - list: List[FindApplicableItemsItemPriceResponse] next_offset: str = None @@ -152,6 +149,5 @@ class FindApplicableItemPricesItemPriceResponse: @dataclass class FindApplicableItemPricesResponse(Response): - list: List[FindApplicableItemPricesItemPriceResponse] next_offset: str = None diff --git a/chargebee/models/metadata/operations.py b/chargebee/models/metadata/operations.py index 1762be9..29094b7 100644 --- a/chargebee/models/metadata/operations.py +++ b/chargebee/models/metadata/operations.py @@ -5,7 +5,6 @@ @dataclass class Metadata: - env: environment.Environment pass diff --git a/chargebee/models/omnichannel_one_time_order/operations.py b/chargebee/models/omnichannel_one_time_order/operations.py index ff77e38..9f5652d 100644 --- a/chargebee/models/omnichannel_one_time_order/operations.py +++ b/chargebee/models/omnichannel_one_time_order/operations.py @@ -8,7 +8,6 @@ @dataclass class OmnichannelOneTimeOrder: - env: environment.Environment class Source(Enum): diff --git a/chargebee/models/omnichannel_one_time_order/responses.py b/chargebee/models/omnichannel_one_time_order/responses.py index 0b218b2..e43c1bb 100644 --- a/chargebee/models/omnichannel_one_time_order/responses.py +++ b/chargebee/models/omnichannel_one_time_order/responses.py @@ -41,7 +41,6 @@ class OmnichannelOneTimeOrderResponse(Model): @dataclass class RetrieveResponse(Response): - omnichannel_one_time_order: OmnichannelOneTimeOrderResponse @@ -52,6 +51,5 @@ class ListOmnichannelOneTimeOrderResponse: @dataclass class ListResponse(Response): - list: List[ListOmnichannelOneTimeOrderResponse] next_offset: str = None diff --git a/chargebee/models/omnichannel_one_time_order_item/operations.py b/chargebee/models/omnichannel_one_time_order_item/operations.py index 07be1b0..14bfc7d 100644 --- a/chargebee/models/omnichannel_one_time_order_item/operations.py +++ b/chargebee/models/omnichannel_one_time_order_item/operations.py @@ -6,7 +6,6 @@ @dataclass class OmnichannelOneTimeOrderItem: - env: environment.Environment class CancellationReason(Enum): diff --git a/chargebee/models/omnichannel_subscription/operations.py b/chargebee/models/omnichannel_subscription/operations.py index 3592480..8c2fa83 100644 --- a/chargebee/models/omnichannel_subscription/operations.py +++ b/chargebee/models/omnichannel_subscription/operations.py @@ -8,7 +8,6 @@ @dataclass class OmnichannelSubscription: - env: environment.Environment class Source(Enum): diff --git a/chargebee/models/omnichannel_subscription/responses.py b/chargebee/models/omnichannel_subscription/responses.py index 110d315..26b241f 100644 --- a/chargebee/models/omnichannel_subscription/responses.py +++ b/chargebee/models/omnichannel_subscription/responses.py @@ -33,14 +33,11 @@ class OmnichannelSubscriptionResponse(Model): omnichannel_subscription_items: List[ "omnichannel_subscription_item.OmnichannelSubscriptionItemResponse" ] = None - initial_purchase_transaction: ( - "omnichannel_transaction.OmnichannelTransactionResponse" - ) = None + initial_purchase_transaction: "omnichannel_transaction.OmnichannelTransactionResponse" = None @dataclass class RetrieveResponse(Response): - omnichannel_subscription: OmnichannelSubscriptionResponse @@ -51,7 +48,6 @@ class ListOmnichannelSubscriptionResponse: @dataclass class ListResponse(Response): - list: List[ListOmnichannelSubscriptionResponse] next_offset: str = None @@ -63,7 +59,6 @@ class OmnichannelTransactionsForOmnichannelSubscriptionOmnichannelSubscriptionRe @dataclass class OmnichannelTransactionsForOmnichannelSubscriptionResponse(Response): - list: List[ OmnichannelTransactionsForOmnichannelSubscriptionOmnichannelSubscriptionResponse ] diff --git a/chargebee/models/omnichannel_subscription_item/operations.py b/chargebee/models/omnichannel_subscription_item/operations.py index a7ba04a..bf6ce82 100644 --- a/chargebee/models/omnichannel_subscription_item/operations.py +++ b/chargebee/models/omnichannel_subscription_item/operations.py @@ -6,7 +6,6 @@ @dataclass class OmnichannelSubscriptionItem: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/omnichannel_subscription_item/responses.py b/chargebee/models/omnichannel_subscription_item/responses.py index 1d4d644..c6d17f5 100644 --- a/chargebee/models/omnichannel_subscription_item/responses.py +++ b/chargebee/models/omnichannel_subscription_item/responses.py @@ -49,6 +49,5 @@ class ListOmniSubItemScheduleChangesOmnichannelSubscriptionItemResponse: @dataclass class ListOmniSubItemScheduleChangesResponse(Response): - list: List[ListOmniSubItemScheduleChangesOmnichannelSubscriptionItemResponse] next_offset: str = None diff --git a/chargebee/models/omnichannel_subscription_item_scheduled_change/operations.py b/chargebee/models/omnichannel_subscription_item_scheduled_change/operations.py index 1b5cff5..2f73f4d 100644 --- a/chargebee/models/omnichannel_subscription_item_scheduled_change/operations.py +++ b/chargebee/models/omnichannel_subscription_item_scheduled_change/operations.py @@ -6,7 +6,6 @@ @dataclass class OmnichannelSubscriptionItemScheduledChange: - env: environment.Environment class ChangeType(Enum): diff --git a/chargebee/models/omnichannel_transaction/operations.py b/chargebee/models/omnichannel_transaction/operations.py index 0eb6657..5cb6504 100644 --- a/chargebee/models/omnichannel_transaction/operations.py +++ b/chargebee/models/omnichannel_transaction/operations.py @@ -6,7 +6,6 @@ @dataclass class OmnichannelTransaction: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/order/operations.py b/chargebee/models/order/operations.py index c582954..5b3cb5e 100644 --- a/chargebee/models/order/operations.py +++ b/chargebee/models/order/operations.py @@ -8,7 +8,6 @@ @dataclass class Order: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/order/responses.py b/chargebee/models/order/responses.py index 73f58f7..ddc905e 100644 --- a/chargebee/models/order/responses.py +++ b/chargebee/models/order/responses.py @@ -223,7 +223,6 @@ class ReopenResponse(Response): @dataclass class RetrieveResponse(Response): - order: OrderResponse @@ -240,7 +239,6 @@ class ListOrderResponse: @dataclass class ListResponse(Response): - list: List[ListOrderResponse] next_offset: str = None @@ -252,7 +250,6 @@ class OrdersForInvoiceOrderResponse: @dataclass class OrdersForInvoiceResponse(Response): - list: List[OrdersForInvoiceOrderResponse] next_offset: str = None diff --git a/chargebee/models/payment_intent/operations.py b/chargebee/models/payment_intent/operations.py index 2f08ea5..c30a0c7 100644 --- a/chargebee/models/payment_intent/operations.py +++ b/chargebee/models/payment_intent/operations.py @@ -7,7 +7,6 @@ @dataclass class PaymentIntent: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/payment_intent/responses.py b/chargebee/models/payment_intent/responses.py index be86056..8587736 100644 --- a/chargebee/models/payment_intent/responses.py +++ b/chargebee/models/payment_intent/responses.py @@ -56,5 +56,4 @@ class UpdateResponse(Response): @dataclass class RetrieveResponse(Response): - payment_intent: PaymentIntentResponse diff --git a/chargebee/models/payment_reference_number/operations.py b/chargebee/models/payment_reference_number/operations.py index 57370be..f98e57b 100644 --- a/chargebee/models/payment_reference_number/operations.py +++ b/chargebee/models/payment_reference_number/operations.py @@ -6,7 +6,6 @@ @dataclass class PaymentReferenceNumber: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/payment_schedule/operations.py b/chargebee/models/payment_schedule/operations.py index 24a37e8..3397ee5 100644 --- a/chargebee/models/payment_schedule/operations.py +++ b/chargebee/models/payment_schedule/operations.py @@ -6,7 +6,6 @@ @dataclass class PaymentSchedule: - env: environment.Environment class EntityType(Enum): diff --git a/chargebee/models/payment_schedule_estimate/operations.py b/chargebee/models/payment_schedule_estimate/operations.py index ea86597..881353b 100644 --- a/chargebee/models/payment_schedule_estimate/operations.py +++ b/chargebee/models/payment_schedule_estimate/operations.py @@ -6,7 +6,6 @@ @dataclass class PaymentScheduleEstimate: - env: environment.Environment class EntityType(Enum): diff --git a/chargebee/models/payment_schedule_scheme/operations.py b/chargebee/models/payment_schedule_scheme/operations.py index f91e48a..5d83c55 100644 --- a/chargebee/models/payment_schedule_scheme/operations.py +++ b/chargebee/models/payment_schedule_scheme/operations.py @@ -6,7 +6,6 @@ @dataclass class PaymentScheduleScheme: - env: environment.Environment class PeriodUnit(Enum): diff --git a/chargebee/models/payment_schedule_scheme/responses.py b/chargebee/models/payment_schedule_scheme/responses.py index 1153b4a..2433065 100644 --- a/chargebee/models/payment_schedule_scheme/responses.py +++ b/chargebee/models/payment_schedule_scheme/responses.py @@ -34,7 +34,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - payment_schedule_scheme: PaymentScheduleSchemeResponse diff --git a/chargebee/models/payment_source/operations.py b/chargebee/models/payment_source/operations.py index f46048b..bd78782 100644 --- a/chargebee/models/payment_source/operations.py +++ b/chargebee/models/payment_source/operations.py @@ -8,7 +8,6 @@ @dataclass class PaymentSource: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/payment_source/responses.py b/chargebee/models/payment_source/responses.py index edd5e0d..ff8eb93 100644 --- a/chargebee/models/payment_source/responses.py +++ b/chargebee/models/payment_source/responses.py @@ -216,7 +216,6 @@ class VerifyBankAccountResponse(Response): @dataclass class RetrieveResponse(Response): - payment_source: PaymentSourceResponse @@ -227,7 +226,6 @@ class ListPaymentSourceResponse: @dataclass class ListResponse(Response): - list: List[ListPaymentSourceResponse] next_offset: str = None diff --git a/chargebee/models/payment_voucher/operations.py b/chargebee/models/payment_voucher/operations.py index 170bbe8..a288bf2 100644 --- a/chargebee/models/payment_voucher/operations.py +++ b/chargebee/models/payment_voucher/operations.py @@ -8,7 +8,6 @@ @dataclass class PaymentVoucher: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/payment_voucher/responses.py b/chargebee/models/payment_voucher/responses.py index 28cc910..6a7637a 100644 --- a/chargebee/models/payment_voucher/responses.py +++ b/chargebee/models/payment_voucher/responses.py @@ -45,7 +45,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - payment_voucher: PaymentVoucherResponse @@ -56,7 +55,6 @@ class PaymentVouchersForInvoicePaymentVoucherResponse: @dataclass class PaymentVouchersForInvoiceResponse(Response): - list: List[PaymentVouchersForInvoicePaymentVoucherResponse] next_offset: str = None @@ -68,6 +66,5 @@ class PaymentVouchersForCustomerPaymentVoucherResponse: @dataclass class PaymentVouchersForCustomerResponse(Response): - list: List[PaymentVouchersForCustomerPaymentVoucherResponse] next_offset: str = None diff --git a/chargebee/models/plan/operations.py b/chargebee/models/plan/operations.py index 32fa8f8..8558e5e 100644 --- a/chargebee/models/plan/operations.py +++ b/chargebee/models/plan/operations.py @@ -8,7 +8,6 @@ @dataclass class Plan: - env: environment.Environment class PeriodUnit(Enum): diff --git a/chargebee/models/plan/responses.py b/chargebee/models/plan/responses.py index bab43f1..8f036ab 100644 --- a/chargebee/models/plan/responses.py +++ b/chargebee/models/plan/responses.py @@ -131,14 +131,12 @@ class ListPlanResponse: @dataclass class ListResponse(Response): - list: List[ListPlanResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - plan: PlanResponse diff --git a/chargebee/models/portal_session/operations.py b/chargebee/models/portal_session/operations.py index 988c6c2..21ef4ec 100644 --- a/chargebee/models/portal_session/operations.py +++ b/chargebee/models/portal_session/operations.py @@ -6,7 +6,6 @@ @dataclass class PortalSession: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/portal_session/responses.py b/chargebee/models/portal_session/responses.py index f10c78b..2597000 100644 --- a/chargebee/models/portal_session/responses.py +++ b/chargebee/models/portal_session/responses.py @@ -40,7 +40,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - portal_session: PortalSessionResponse diff --git a/chargebee/models/price_variant/operations.py b/chargebee/models/price_variant/operations.py index bc9ce2a..bdc42e4 100644 --- a/chargebee/models/price_variant/operations.py +++ b/chargebee/models/price_variant/operations.py @@ -7,7 +7,6 @@ @dataclass class PriceVariant: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/price_variant/responses.py b/chargebee/models/price_variant/responses.py index 358fed5..7bdc1d5 100644 --- a/chargebee/models/price_variant/responses.py +++ b/chargebee/models/price_variant/responses.py @@ -37,7 +37,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - price_variant: PriceVariantResponse @@ -60,6 +59,5 @@ class ListPriceVariantResponse: @dataclass class ListResponse(Response): - list: List[ListPriceVariantResponse] next_offset: str = None diff --git a/chargebee/models/pricing_page_session/operations.py b/chargebee/models/pricing_page_session/operations.py index a12b0d1..d17d96f 100644 --- a/chargebee/models/pricing_page_session/operations.py +++ b/chargebee/models/pricing_page_session/operations.py @@ -6,7 +6,6 @@ @dataclass class PricingPageSession: - env: environment.Environment class CreateForNewSubscriptionPricingPageParams(TypedDict): diff --git a/chargebee/models/promotional_credit/operations.py b/chargebee/models/promotional_credit/operations.py index 70314d2..7c05654 100644 --- a/chargebee/models/promotional_credit/operations.py +++ b/chargebee/models/promotional_credit/operations.py @@ -8,7 +8,6 @@ @dataclass class PromotionalCredit: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/promotional_credit/responses.py b/chargebee/models/promotional_credit/responses.py index 01a6dd1..27f8f87 100644 --- a/chargebee/models/promotional_credit/responses.py +++ b/chargebee/models/promotional_credit/responses.py @@ -51,12 +51,10 @@ class ListPromotionalCreditResponse: @dataclass class ListResponse(Response): - list: List[ListPromotionalCreditResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - promotional_credit: PromotionalCreditResponse diff --git a/chargebee/models/purchase/operations.py b/chargebee/models/purchase/operations.py index 08d0898..18f6d62 100644 --- a/chargebee/models/purchase/operations.py +++ b/chargebee/models/purchase/operations.py @@ -6,7 +6,6 @@ @dataclass class Purchase: - env: environment.Environment class CreatePurchaseItemParams(TypedDict): diff --git a/chargebee/models/quote/operations.py b/chargebee/models/quote/operations.py index 8481e48..b3d066a 100644 --- a/chargebee/models/quote/operations.py +++ b/chargebee/models/quote/operations.py @@ -8,7 +8,6 @@ @dataclass class Quote: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/quote/responses.py b/chargebee/models/quote/responses.py index 0378e8d..74a193d 100644 --- a/chargebee/models/quote/responses.py +++ b/chargebee/models/quote/responses.py @@ -199,7 +199,6 @@ class QuoteResponse(Model): @dataclass class RetrieveResponse(Response): - quote: QuoteResponse quoted_subscription: "quoted_subscription.QuotedSubscriptionResponse" = None quoted_charge: "quoted_charge.QuotedChargeResponse" = None @@ -303,7 +302,6 @@ class ListQuoteResponse: @dataclass class ListResponse(Response): - list: List[ListQuoteResponse] next_offset: str = None @@ -315,7 +313,6 @@ class QuoteLineGroupsForQuoteQuoteResponse: @dataclass class QuoteLineGroupsForQuoteResponse(Response): - list: List[QuoteLineGroupsForQuoteQuoteResponse] next_offset: str = None diff --git a/chargebee/models/quote_line_group/operations.py b/chargebee/models/quote_line_group/operations.py index 7c04055..5cf8423 100644 --- a/chargebee/models/quote_line_group/operations.py +++ b/chargebee/models/quote_line_group/operations.py @@ -7,7 +7,6 @@ @dataclass class QuoteLineGroup: - env: environment.Environment class ChargeEvent(Enum): diff --git a/chargebee/models/quoted_charge/operations.py b/chargebee/models/quoted_charge/operations.py index 9ff4c3c..291d3b5 100644 --- a/chargebee/models/quoted_charge/operations.py +++ b/chargebee/models/quoted_charge/operations.py @@ -6,7 +6,6 @@ @dataclass class QuotedCharge: - env: environment.Environment class Charge(TypedDict): diff --git a/chargebee/models/quoted_ramp/operations.py b/chargebee/models/quoted_ramp/operations.py index 3326cea..3dabc42 100644 --- a/chargebee/models/quoted_ramp/operations.py +++ b/chargebee/models/quoted_ramp/operations.py @@ -7,7 +7,6 @@ @dataclass class QuotedRamp: - env: environment.Environment class DiscountType(Enum): diff --git a/chargebee/models/quoted_subscription/operations.py b/chargebee/models/quoted_subscription/operations.py index 6c47071..1c8589e 100644 --- a/chargebee/models/quoted_subscription/operations.py +++ b/chargebee/models/quoted_subscription/operations.py @@ -7,7 +7,6 @@ @dataclass class QuotedSubscription: - env: environment.Environment class ChangeOption(Enum): diff --git a/chargebee/models/ramp/operations.py b/chargebee/models/ramp/operations.py index a466781..267f476 100644 --- a/chargebee/models/ramp/operations.py +++ b/chargebee/models/ramp/operations.py @@ -8,7 +8,6 @@ @dataclass class Ramp: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/ramp/responses.py b/chargebee/models/ramp/responses.py index 4097c4f..aabf610 100644 --- a/chargebee/models/ramp/responses.py +++ b/chargebee/models/ramp/responses.py @@ -123,7 +123,6 @@ class UpdateResponse(Response): @dataclass class RetrieveResponse(Response): - ramp: RampResponse @@ -140,6 +139,5 @@ class ListRampResponse: @dataclass class ListResponse(Response): - list: List[ListRampResponse] next_offset: str = None diff --git a/chargebee/models/recorded_purchase/operations.py b/chargebee/models/recorded_purchase/operations.py index 94b1473..ae35e46 100644 --- a/chargebee/models/recorded_purchase/operations.py +++ b/chargebee/models/recorded_purchase/operations.py @@ -6,7 +6,6 @@ @dataclass class RecordedPurchase: - env: environment.Environment class Source(Enum): diff --git a/chargebee/models/recorded_purchase/responses.py b/chargebee/models/recorded_purchase/responses.py index 7eb982c..b98cc99 100644 --- a/chargebee/models/recorded_purchase/responses.py +++ b/chargebee/models/recorded_purchase/responses.py @@ -50,5 +50,4 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - recorded_purchase: RecordedPurchaseResponse diff --git a/chargebee/models/resource_migration/operations.py b/chargebee/models/resource_migration/operations.py index fc89d1a..048a43e 100644 --- a/chargebee/models/resource_migration/operations.py +++ b/chargebee/models/resource_migration/operations.py @@ -7,7 +7,6 @@ @dataclass class ResourceMigration: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/resource_migration/responses.py b/chargebee/models/resource_migration/responses.py index 05664a6..f20fcbf 100644 --- a/chargebee/models/resource_migration/responses.py +++ b/chargebee/models/resource_migration/responses.py @@ -18,5 +18,4 @@ class ResourceMigrationResponse(Model): @dataclass class RetrieveLatestResponse(Response): - resource_migration: ResourceMigrationResponse diff --git a/chargebee/models/rule/operations.py b/chargebee/models/rule/operations.py index b4948ba..ef5c7f3 100644 --- a/chargebee/models/rule/operations.py +++ b/chargebee/models/rule/operations.py @@ -6,7 +6,6 @@ @dataclass class Rule: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/rule/responses.py b/chargebee/models/rule/responses.py index f56b701..17789ea 100644 --- a/chargebee/models/rule/responses.py +++ b/chargebee/models/rule/responses.py @@ -21,5 +21,4 @@ class RuleResponse(Model): @dataclass class RetrieveResponse(Response): - rule: RuleResponse diff --git a/chargebee/models/site_migration_detail/operations.py b/chargebee/models/site_migration_detail/operations.py index cf0adc9..8754e01 100644 --- a/chargebee/models/site_migration_detail/operations.py +++ b/chargebee/models/site_migration_detail/operations.py @@ -7,7 +7,6 @@ @dataclass class SiteMigrationDetail: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/site_migration_detail/responses.py b/chargebee/models/site_migration_detail/responses.py index b853b42..bfddcba 100644 --- a/chargebee/models/site_migration_detail/responses.py +++ b/chargebee/models/site_migration_detail/responses.py @@ -22,6 +22,5 @@ class ListSiteMigrationDetailResponse: @dataclass class ListResponse(Response): - list: List[ListSiteMigrationDetailResponse] next_offset: str = None diff --git a/chargebee/models/subscription/operations.py b/chargebee/models/subscription/operations.py index 0ad0ee1..710ce7c 100644 --- a/chargebee/models/subscription/operations.py +++ b/chargebee/models/subscription/operations.py @@ -8,7 +8,6 @@ @dataclass class Subscription: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/subscription/responses.py b/chargebee/models/subscription/responses.py index d9343bf..76ee046 100644 --- a/chargebee/models/subscription/responses.py +++ b/chargebee/models/subscription/responses.py @@ -324,7 +324,6 @@ class ListSubscriptionResponse: @dataclass class ListResponse(Response): - list: List[ListSubscriptionResponse] next_offset: str = None @@ -336,7 +335,6 @@ class SubscriptionsForCustomerSubscriptionResponse: @dataclass class SubscriptionsForCustomerResponse(Response): - list: List[SubscriptionsForCustomerSubscriptionResponse] next_offset: str = None @@ -348,7 +346,6 @@ class ContractTermsForSubscriptionSubscriptionResponse: @dataclass class ContractTermsForSubscriptionResponse(Response): - list: List[ContractTermsForSubscriptionSubscriptionResponse] next_offset: str = None @@ -360,14 +357,12 @@ class ListDiscountsSubscriptionResponse: @dataclass class ListDiscountsResponse(Response): - list: List[ListDiscountsSubscriptionResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - subscription: SubscriptionResponse customer: "customer.CustomerResponse" card: "card.CardResponse" = None @@ -375,7 +370,6 @@ class RetrieveResponse(Response): @dataclass class RetrieveWithScheduledChangesResponse(Response): - subscription: SubscriptionResponse customer: "customer.CustomerResponse" card: "card.CardResponse" = None @@ -483,7 +477,6 @@ class EditAdvanceInvoiceScheduleResponse(Response): @dataclass class RetrieveAdvanceInvoiceScheduleResponse(Response): - advance_invoice_schedules: List[ "advance_invoice_schedule.AdvanceInvoiceScheduleResponse" ] diff --git a/chargebee/models/subscription_entitlement/operations.py b/chargebee/models/subscription_entitlement/operations.py index d2500d2..8d97836 100644 --- a/chargebee/models/subscription_entitlement/operations.py +++ b/chargebee/models/subscription_entitlement/operations.py @@ -7,7 +7,6 @@ @dataclass class SubscriptionEntitlement: - env: environment.Environment class ScheduleStatus(Enum): diff --git a/chargebee/models/subscription_entitlement/responses.py b/chargebee/models/subscription_entitlement/responses.py index 8ea7919..ce7ba78 100644 --- a/chargebee/models/subscription_entitlement/responses.py +++ b/chargebee/models/subscription_entitlement/responses.py @@ -36,7 +36,6 @@ class SubscriptionEntitlementsForSubscriptionSubscriptionEntitlementResponse: @dataclass class SubscriptionEntitlementsForSubscriptionResponse(Response): - list: List[SubscriptionEntitlementsForSubscriptionSubscriptionEntitlementResponse] next_offset: str = None diff --git a/chargebee/models/subscription_entitlements_created_detail/operations.py b/chargebee/models/subscription_entitlements_created_detail/operations.py index 3e89867..663a410 100644 --- a/chargebee/models/subscription_entitlements_created_detail/operations.py +++ b/chargebee/models/subscription_entitlements_created_detail/operations.py @@ -5,7 +5,6 @@ @dataclass class SubscriptionEntitlementsCreatedDetail: - env: environment.Environment pass diff --git a/chargebee/models/subscription_entitlements_updated_detail/operations.py b/chargebee/models/subscription_entitlements_updated_detail/operations.py index 6123c74..fb998c4 100644 --- a/chargebee/models/subscription_entitlements_updated_detail/operations.py +++ b/chargebee/models/subscription_entitlements_updated_detail/operations.py @@ -5,7 +5,6 @@ @dataclass class SubscriptionEntitlementsUpdatedDetail: - env: environment.Environment pass diff --git a/chargebee/models/subscription_estimate/operations.py b/chargebee/models/subscription_estimate/operations.py index 3b041a9..a225559 100644 --- a/chargebee/models/subscription_estimate/operations.py +++ b/chargebee/models/subscription_estimate/operations.py @@ -7,7 +7,6 @@ @dataclass class SubscriptionEstimate: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/tax_withheld/operations.py b/chargebee/models/tax_withheld/operations.py index c015415..4148493 100644 --- a/chargebee/models/tax_withheld/operations.py +++ b/chargebee/models/tax_withheld/operations.py @@ -6,7 +6,6 @@ @dataclass class TaxWithheld: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/third_party_payment_method/operations.py b/chargebee/models/third_party_payment_method/operations.py index cae87f6..19ae517 100644 --- a/chargebee/models/third_party_payment_method/operations.py +++ b/chargebee/models/third_party_payment_method/operations.py @@ -5,7 +5,6 @@ @dataclass class ThirdPartyPaymentMethod: - env: environment.Environment pass diff --git a/chargebee/models/time_machine/operations.py b/chargebee/models/time_machine/operations.py index 85dee7c..9d237c2 100644 --- a/chargebee/models/time_machine/operations.py +++ b/chargebee/models/time_machine/operations.py @@ -8,7 +8,6 @@ @dataclass class TimeMachine: - env: environment.Environment class TimeTravelStatus(Enum): diff --git a/chargebee/models/time_machine/responses.py b/chargebee/models/time_machine/responses.py index e35b89a..81fce37 100644 --- a/chargebee/models/time_machine/responses.py +++ b/chargebee/models/time_machine/responses.py @@ -18,7 +18,6 @@ class TimeMachineResponse(Model): @dataclass class RetrieveResponse(Response): - time_machine: TimeMachineResponse diff --git a/chargebee/models/token/operations.py b/chargebee/models/token/operations.py index b1e3681..171926a 100644 --- a/chargebee/models/token/operations.py +++ b/chargebee/models/token/operations.py @@ -6,7 +6,6 @@ @dataclass class Token: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/transaction/operations.py b/chargebee/models/transaction/operations.py index 754774c..4843ac6 100644 --- a/chargebee/models/transaction/operations.py +++ b/chargebee/models/transaction/operations.py @@ -8,7 +8,6 @@ @dataclass class Transaction: - env: environment.Environment class Type(Enum): diff --git a/chargebee/models/transaction/responses.py b/chargebee/models/transaction/responses.py index 4f89ccf..f57f8fd 100644 --- a/chargebee/models/transaction/responses.py +++ b/chargebee/models/transaction/responses.py @@ -155,7 +155,6 @@ class ListTransactionResponse: @dataclass class ListResponse(Response): - list: List[ListTransactionResponse] next_offset: str = None @@ -167,7 +166,6 @@ class TransactionsForCustomerTransactionResponse: @dataclass class TransactionsForCustomerResponse(Response): - list: List[TransactionsForCustomerTransactionResponse] next_offset: str = None @@ -179,7 +177,6 @@ class TransactionsForSubscriptionTransactionResponse: @dataclass class TransactionsForSubscriptionResponse(Response): - list: List[TransactionsForSubscriptionTransactionResponse] next_offset: str = None @@ -191,14 +188,12 @@ class PaymentsForInvoiceTransactionResponse: @dataclass class PaymentsForInvoiceResponse(Response): - list: List[PaymentsForInvoiceTransactionResponse] next_offset: str = None @dataclass class RetrieveResponse(Response): - transaction: TransactionResponse diff --git a/chargebee/models/unbilled_charge/operations.py b/chargebee/models/unbilled_charge/operations.py index 87c7ef0..40b396e 100644 --- a/chargebee/models/unbilled_charge/operations.py +++ b/chargebee/models/unbilled_charge/operations.py @@ -8,7 +8,6 @@ @dataclass class UnbilledCharge: - env: environment.Environment class EntityType(Enum): diff --git a/chargebee/models/unbilled_charge/responses.py b/chargebee/models/unbilled_charge/responses.py index 22fbacf..182657a 100644 --- a/chargebee/models/unbilled_charge/responses.py +++ b/chargebee/models/unbilled_charge/responses.py @@ -80,7 +80,6 @@ class ListUnbilledChargeResponse: @dataclass class ListResponse(Response): - list: List[ListUnbilledChargeResponse] next_offset: str = None diff --git a/chargebee/models/usage/operations.py b/chargebee/models/usage/operations.py index 34f471c..c649449 100644 --- a/chargebee/models/usage/operations.py +++ b/chargebee/models/usage/operations.py @@ -7,7 +7,6 @@ @dataclass class Usage: - env: environment.Environment class PdfInvoiceParams(TypedDict): diff --git a/chargebee/models/usage/responses.py b/chargebee/models/usage/responses.py index 7b2a1db..7627776 100644 --- a/chargebee/models/usage/responses.py +++ b/chargebee/models/usage/responses.py @@ -30,7 +30,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - usage: UsageResponse @@ -47,7 +46,6 @@ class ListUsageResponse: @dataclass class ListResponse(Response): - list: List[ListUsageResponse] next_offset: str = None diff --git a/chargebee/models/usage_event/operations.py b/chargebee/models/usage_event/operations.py index de26d2c..989bbca 100644 --- a/chargebee/models/usage_event/operations.py +++ b/chargebee/models/usage_event/operations.py @@ -5,7 +5,6 @@ @dataclass class UsageEvent: - env: environment.Environment class BatchIngestEventParams(TypedDict): diff --git a/chargebee/models/usage_file/operations.py b/chargebee/models/usage_file/operations.py index 0693f90..10a9907 100644 --- a/chargebee/models/usage_file/operations.py +++ b/chargebee/models/usage_file/operations.py @@ -6,7 +6,6 @@ @dataclass class UsageFile: - env: environment.Environment class Status(Enum): diff --git a/chargebee/models/usage_file/responses.py b/chargebee/models/usage_file/responses.py index 66a8e9d..d05fdb8 100644 --- a/chargebee/models/usage_file/responses.py +++ b/chargebee/models/usage_file/responses.py @@ -39,5 +39,4 @@ class UploadUrlResponse(Response): @dataclass class ProcessingStatusResponse(Response): - usage_file: UsageFileResponse diff --git a/chargebee/models/virtual_bank_account/operations.py b/chargebee/models/virtual_bank_account/operations.py index 68884f6..6aff2f2 100644 --- a/chargebee/models/virtual_bank_account/operations.py +++ b/chargebee/models/virtual_bank_account/operations.py @@ -7,7 +7,6 @@ @dataclass class VirtualBankAccount: - env: environment.Environment class Scheme(Enum): diff --git a/chargebee/models/virtual_bank_account/responses.py b/chargebee/models/virtual_bank_account/responses.py index 8a67041..93ace82 100644 --- a/chargebee/models/virtual_bank_account/responses.py +++ b/chargebee/models/virtual_bank_account/responses.py @@ -41,7 +41,6 @@ class CreateResponse(Response): @dataclass class RetrieveResponse(Response): - virtual_bank_account: VirtualBankAccountResponse @@ -52,7 +51,6 @@ class ListVirtualBankAccountResponse: @dataclass class ListResponse(Response): - list: List[ListVirtualBankAccountResponse] next_offset: str = None diff --git a/chargebee/models/webhook_endpoint/operations.py b/chargebee/models/webhook_endpoint/operations.py index f410665..9533aa7 100644 --- a/chargebee/models/webhook_endpoint/operations.py +++ b/chargebee/models/webhook_endpoint/operations.py @@ -7,7 +7,6 @@ @dataclass class WebhookEndpoint: - env: environment.Environment class ApiVersion(Enum): diff --git a/chargebee/models/webhook_endpoint/responses.py b/chargebee/models/webhook_endpoint/responses.py index 8a48a52..02e619c 100644 --- a/chargebee/models/webhook_endpoint/responses.py +++ b/chargebee/models/webhook_endpoint/responses.py @@ -32,7 +32,6 @@ class UpdateResponse(Response): @dataclass class RetrieveResponse(Response): - webhook_endpoint: WebhookEndpointResponse @@ -49,6 +48,5 @@ class ListWebhookEndpointResponse: @dataclass class ListResponse(Response): - list: List[ListWebhookEndpointResponse] next_offset: str = None diff --git a/chargebee/request.py b/chargebee/request.py index 78da35c..d81722f 100644 --- a/chargebee/request.py +++ b/chargebee/request.py @@ -1,8 +1,8 @@ import json import urllib -from chargebee import compat -from chargebee import util, http_request +from chargebee import compat, environment, util, http_request +from chargebee.responses import Response def lowercase_keys(data): @@ -20,7 +20,7 @@ def lowercase_keys(data): def send_list_request( method, url, - env=None, + env: environment.Environment = None, params=None, headers=None, response_type=None, @@ -55,7 +55,7 @@ def send_list_request( def send( method, url, - env, + env: environment.Environment, params=None, headers=None, response_type=None, @@ -75,19 +75,32 @@ def send( else util.serialize(params, None, None, jsonKeys) ) - response, response_headers, http_code = http_request.request( - method, url, env, ser_params, headers, subDomain, isJsonRequest, options - ) - - from chargebee.responses import Response - - if "list" in response: - return Response( - response_type, response, response_headers, http_code - ).parse_list_response() - return Response( - response_type, response, response_headers, http_code - ).parse_response() + request_args = { + "method": method, + "url": url, + "env": env, + "params": ser_params, + "headers": headers, + "subDomain": subDomain, + "isJsonRequest": isJsonRequest, + "options": options, + "use_async_client": env.use_async_client, + } + + if env.use_async_client: + + async def async_request(): + response, response_headers, http_code = await http_request.request( + **request_args + ) + return Response( + response_type, response, response_headers, http_code + ).parse() + + return async_request() + else: + response, response_headers, http_code = http_request.request(**request_args) + return Response(response_type, response, response_headers, http_code).parse() def uri_path(*paths): diff --git a/chargebee/responses.py b/chargebee/responses.py index 1e1d15b..6b8767f 100644 --- a/chargebee/responses.py +++ b/chargebee/responses.py @@ -24,7 +24,8 @@ def __init__( self, response_type: Type[T], response, response_header=None, http_code=None ): self._response = response - if "list" in response: + self._is_list_response = "list" in response + if self._is_list_response: self._response = response["list"] self._next_offset = response.get("next_offset", None) self._response_header = response_header @@ -37,6 +38,13 @@ def is_idempotency_replayed(self) -> bool: def http_status_code(self) -> int: return int(self._response_status_code) + def parse(self) -> T: + return ( + self.parse_list_response() + if self._is_list_response + else self.parse_response() + ) + def parse_response(self) -> T: init_data = {} for name, type in get_type_hints(self._response_type).items(): diff --git a/chargebee/version.py b/chargebee/version.py index 71960e3..41994af 100644 --- a/chargebee/version.py +++ b/chargebee/version.py @@ -1 +1 @@ -VERSION = "3.10.0" +VERSION = "3.11.0" diff --git a/pyproject.toml b/pyproject.toml index 0837f83..854a6d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=66", "wheel", "requests>=2.29.0"] +requires = ["setuptools>=66", "wheel", "httpx>=0.28.0"] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 2cc44dc..c5f4daa 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ with open("README.md", "r") as file: description = file.read() -requires = ["requests"] +requires = ["httpx"] setup( name="chargebee", diff --git a/tests/test_http_request.py b/tests/test_http_request.py index 224057c..fc1664a 100644 --- a/tests/test_http_request.py +++ b/tests/test_http_request.py @@ -1,7 +1,9 @@ import json import unittest -from unittest.mock import patch, Mock +import asyncio +from unittest.mock import patch, Mock, AsyncMock +from chargebee import environment from chargebee.api_error import InvalidRequestError @@ -24,29 +26,36 @@ def get_retry_on(self): return self.retry_on_codes -class MockEnvironment: +class MockEnvironment(environment.Environment): def __init__(self): self.api_key = "test_key" + self.site = "test_site" self.connect_timeout = 2 self.read_timeout = 5 self.enable_debug_logs = False - - def api_url(self, path, subdomain=None): - return "https://mock.chargebee.com" + path + self.set_api_endpoint() def get_retry_config(self): return MockRetryConfig() -class RequestTests(unittest.TestCase): +def make_mock_client(status_code=200, text="", headers={}, is_async=False): + mock_client = Mock() if not is_async else AsyncMock() + mock_response = Mock() + mock_response.status_code = status_code + mock_response.text = text + mock_response.headers = headers + return mock_client, mock_response - @patch("requests.request") - def test_successful_request(self, mock_request): - mock_response = Mock() - mock_response.status_code = 200 - mock_response.text = json.dumps({"message": "success"}) - mock_response.headers = {} - mock_request.return_value = mock_response + +class RequestTests(unittest.TestCase): + @patch("httpx.Client") + def test_successful_request(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"message": "success"}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client from chargebee.http_request import request @@ -55,19 +64,19 @@ def test_successful_request(self, mock_request): self.assertEqual(status, 200) self.assertEqual(resp["message"], "success") - @patch("requests.request") - def test_rate_limit_retry(self, mock_request): - retry_response = Mock() - retry_response.status_code = 429 - retry_response.text = json.dumps({"api_error_code": "rate_limit"}) - retry_response.headers = {"Retry-After": "1"} + @patch("httpx.Client") + def test_rate_limit_retry(self, mock_client_class): + mock_client, retry_response = make_mock_client( + 429, json.dumps({"api_error_code": "rate_limit"}), {"Retry-After": "1"} + ) success_response = Mock() success_response.status_code = 200 success_response.text = json.dumps({"message": "ok"}) success_response.headers = {} - mock_request.side_effect = [retry_response, success_response] + mock_client.request.side_effect = [retry_response, success_response] + mock_client_class.return_value.__enter__.return_value = mock_client from chargebee.http_request import request @@ -75,16 +84,13 @@ def test_rate_limit_retry(self, mock_request): self.assertEqual(status, 200) self.assertEqual(resp["message"], "ok") - self.assertEqual(mock_request.call_count, 2) - - @patch("requests.request") - def test_retry_until_max_retries(self, mock_request): - error_response = Mock() - error_response.status_code = 503 - error_response.text = "503 Service Unavailable" - error_response.headers = {} + self.assertEqual(mock_client.request.call_count, 2) - mock_request.return_value = error_response + @patch("httpx.Client") + def test_retry_until_max_retries(self, mock_client_class): + mock_client, mock_response = make_mock_client(503, "503 Service Unavailable") + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client from chargebee.http_request import request @@ -94,17 +100,18 @@ def test_retry_until_max_retries(self, mock_request): err = context.exception self.assertIsInstance(err, Exception) self.assertIn("internal_temporary_error", str(err)) - self.assertEqual(mock_request.call_count, 4) # 1 original + 3 retries - - @patch("requests.request") - def test_no_retry_on_400(self, mock_request): - error_json = {"api_error_code": "invalid_request", "type": "invalid_request"} - error_response = Mock() - error_response.status_code = 400 - error_response.text = json.dumps(error_json) - error_response.headers = {} - - mock_request.return_value = error_response + self.assertEqual(mock_client.request.call_count, 4) # 1 original + 3 retries + + @patch("httpx.Client") + def test_no_retry_on_400(self, mock_client_class): + mock_client, mock_response = make_mock_client( + 400, + json.dumps( + {"api_error_code": "invalid_request", "type": "invalid_request"} + ), + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client from chargebee.http_request import request @@ -114,29 +121,158 @@ def test_no_retry_on_400(self, mock_request): err = context.exception self.assertEqual(err.http_code, 400) self.assertEqual(err.api_error_code, "invalid_request") - self.assertEqual(mock_request.call_count, 1) + self.assertEqual(mock_client.request.call_count, 1) - @patch("requests.request") - def test_custom_retry_on_header_parsing(self, mock_request): - retry_response = Mock() - retry_response.status_code = 429 - retry_response.text = json.dumps({"api_error_code": "rate_limit"}) - retry_response.headers = {"Retry-After": "2"} + @patch("httpx.Client") + def test_custom_retry_on_header_parsing(self, mock_client_class): + mock_client, retry_response = make_mock_client( + 429, json.dumps({"api_error_code": "rate_limit"}), {"Retry-After": "2"} + ) success_response = Mock() success_response.status_code = 200 success_response.text = json.dumps({"message": "done"}) success_response.headers = {} - mock_request.side_effect = [retry_response, success_response] + mock_client.request.side_effect = [retry_response, success_response] + mock_client_class.return_value.__enter__.return_value = mock_client from chargebee.http_request import request resp, headers, status = request("GET", "/test", MockEnvironment(), params={}) self.assertEqual(resp["message"], "done") - self.assertEqual(mock_request.call_count, 2) + self.assertEqual(mock_client.request.call_count, 2) + + @patch("httpx.AsyncClient") + def test_async_successful_request(self, mock_async_client_class): + mock_async_client, mock_response = make_mock_client( + text=json.dumps({"message": "async_success"}), is_async=True + ) + mock_async_client.request.return_value = mock_response + mock_async_client_class.return_value.__aenter__.return_value = mock_async_client + + from chargebee.http_request import request + + async def test_async_request(): + resp, headers, status = await request( + "GET", "/test", MockEnvironment(), params={}, use_async_client=True + ) + return resp, headers, status + + resp, headers, status = asyncio.run(test_async_request()) + + self.assertEqual(status, 200) + self.assertEqual(resp["message"], "async_success") + + @patch("httpx.AsyncClient") + def test_async_rate_limit_retry(self, mock_async_client_class): + mock_async_client, retry_response = make_mock_client( + 429, + json.dumps({"api_error_code": "rate_limit"}), + {"Retry-After": "1"}, + is_async=True, + ) + + success_response = Mock() + success_response.status_code = 200 + success_response.text = json.dumps({"message": "async_ok"}) + success_response.headers = {} + + mock_async_client.request.side_effect = [retry_response, success_response] + mock_async_client_class.return_value.__aenter__.return_value = mock_async_client + + from chargebee.http_request import request + + async def test_async_retry(): + resp, headers, status = await request( + "GET", "/test", MockEnvironment(), params={}, use_async_client=True + ) + return resp, headers, status + + resp, headers, status = asyncio.run(test_async_retry()) + + self.assertEqual(status, 200) + self.assertEqual(resp["message"], "async_ok") + self.assertEqual(mock_async_client.request.call_count, 2) + + @patch("httpx.Client") + def test_json_request_payload(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"message": "json_success"}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client + + from chargebee.http_request import request + + test_data = {"key": "value", "nested": {"data": "test"}} + resp, headers, status = request( + "POST", "/test", MockEnvironment(), params=test_data, isJsonRequest=True + ) + + # Verify that the request was made with json parameter + call_args = mock_client.request.call_args + self.assertIn("json", call_args[1]) + self.assertIn("application/json", call_args[1]["headers"]["Content-Type"]) + self.assertEqual(call_args[1]["json"], test_data) + self.assertNotIn("data", call_args[1]) + + @patch("httpx.Client") + def test_get_request(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"message": "json_success"}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client + + from chargebee.http_request import request + + params = {"page": 1, "count": 10} + resp, headers, status = request( + "GET", "/test", MockEnvironment(), params=params, isJsonRequest=True + ) + + call_args = mock_client.request.call_args + self.assertNotIn("json", call_args[1]) + self.assertNotIn("data", call_args[1]) + self.assertIn("params", call_args[1]) + self.assertNotIn("Content-Type", call_args[1]["headers"]) + + @patch("httpx.Client") + def test_timeout(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"message": "json_success"}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client + + from chargebee.http_request import request + + params = {"page": 1, "count": 10} + env = MockEnvironment() + resp, headers, status = request( + "GET", "/test", env, params=params, isJsonRequest=True + ) + + call_args = mock_client.request.call_args + self.assertEqual(call_args[1]["timeout"].connect, env.connect_timeout) + self.assertEqual(call_args[1]["timeout"].read, env.read_timeout) + + @patch("httpx.Client") + def test_subdomain_url(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"message": "json_success"}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client + + from chargebee.http_request import request + env = MockEnvironment() + resp, headers, status = request("GET", "/test", env, subDomain="ingest") -if __name__ == "__main__": - unittest.main() + call_args = mock_client.request.call_args + self.assertEqual( + call_args[1]["url"], "https://test_site.ingest.chargebee.com/api/v2/test?" + ) diff --git a/tests/test_model.py b/tests/test_model.py new file mode 100644 index 0000000..91836a5 --- /dev/null +++ b/tests/test_model.py @@ -0,0 +1,59 @@ +import asyncio +import json +import unittest +from unittest.mock import patch + +from .test_http_request import make_mock_client + +customer = {"customer": {"id": "customer-1", "first_name": "John", "last_name": "Doe"}} + + +class ModelTest(unittest.TestCase): + @patch("httpx.Client") + def test_sync_list(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"list": [customer]}) + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__enter__.return_value = mock_client + + from chargebee import Chargebee, Filters + from chargebee.models.customer import CustomerResponse + + client = Chargebee(api_key="key", site="test_site") + response = client.Customer.list( + client.Customer.ListParams(email=Filters.StringFilter(STARTS_WITH="john")) + ) + + self.assertEqual(response.http_status_code, 200) + self.assertIsInstance(response.list, list) + self.assertEqual(len(response.list), 1) + self.assertIsInstance(response.list[0].customer, CustomerResponse) + self.assertEqual(response.list[0].customer.id, "customer-1") + + @patch("httpx.AsyncClient") + def test_async_list(self, mock_client_class): + mock_client, mock_response = make_mock_client( + text=json.dumps({"list": [customer]}), is_async=True + ) + mock_client.request.return_value = mock_response + mock_client_class.return_value.__aenter__.return_value = mock_client + + from chargebee import Chargebee, Filters + from chargebee.models.customer import CustomerResponse + + async def send_request(): + client = Chargebee(api_key="key", site="test_site", use_async_client=True) + return await client.Customer.list( + client.Customer.ListParams( + email=Filters.StringFilter(STARTS_WITH="john") + ) + ) + + response = asyncio.run(send_request()) + + self.assertEqual(response.http_status_code, 200) + self.assertIsInstance(response.list, list) + self.assertEqual(len(response.list), 1) + self.assertIsInstance(response.list[0].customer, CustomerResponse) + self.assertEqual(response.list[0].customer.id, "customer-1") diff --git a/tests/util.py b/tests/test_util.py similarity index 99% rename from tests/util.py rename to tests/test_util.py index 7fc08ed..29c98a9 100644 --- a/tests/util.py +++ b/tests/test_util.py @@ -4,7 +4,6 @@ class UtilTest(unittest.TestCase): - def test_serialize(self): before = { "id": "sub_KyVq7DNSNM7CSD",