diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 423c69f..3d2ac0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.37" + ".": "0.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fc1b600..613283f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 195 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-58749e1928f402cc3e236d38b53bce3b10530bfaccbe426181bba9b1bfc42498.yml -openapi_spec_hash: ecea6e6c4b93665aee5554839a26ded8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/frostedinc%2Fwhopsdk-fe3b84616576ea78c1dd910a9776a481e8ffc2a1a539bd552679fceb0bd8d4c3.yml +openapi_spec_hash: bfcb22d09257495e0c3d418343d4e7f9 config_hash: 2ceaf6cd488db626c181a1ca9460ace6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 37f7a9f..6c61d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.1.0 (2026-04-14) + +Full Changelog: [v0.0.37...v0.1.0](https://github.com/whopio/whopsdk-python/compare/v0.0.37...v0.1.0) + +### Features + +* **api:** api update ([4b47351](https://github.com/whopio/whopsdk-python/commit/4b473516d13634548a42f06b421747d03c54192f)) + + +### Bug Fixes + +* ensure file data are only sent as 1 parameter ([0621a7d](https://github.com/whopio/whopsdk-python/commit/0621a7d6524577f1fd7d17a63ea5f1cc2d34bb3a)) + ## 0.0.37 (2026-04-10) Full Changelog: [v0.0.36...v0.0.37](https://github.com/whopio/whopsdk-python/compare/v0.0.36...v0.0.37) diff --git a/pyproject.toml b/pyproject.toml index 4719b5b..7774c89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "whop-sdk" -version = "0.0.37" +version = "0.1.0" description = "The official Python library for the Whop API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/whop_sdk/_utils/_utils.py b/src/whop_sdk/_utils/_utils.py index eec7f4a..63b8cd6 100644 --- a/src/whop_sdk/_utils/_utils.py +++ b/src/whop_sdk/_utils/_utils.py @@ -86,8 +86,9 @@ def _extract_items( index += 1 if is_dict(obj): try: - # We are at the last entry in the path so we must remove the field - if (len(path)) == index: + # Remove the field if there are no more dict keys in the path, + # only "" traversal markers or end. + if all(p == "" for p in path[index:]): item = obj.pop(key) else: item = obj[key] diff --git a/src/whop_sdk/_version.py b/src/whop_sdk/_version.py index a1018dc..162053b 100644 --- a/src/whop_sdk/_version.py +++ b/src/whop_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "whop_sdk" -__version__ = "0.0.37" # x-release-please-version +__version__ = "0.1.0" # x-release-please-version diff --git a/src/whop_sdk/resources/checkout_configurations.py b/src/whop_sdk/resources/checkout_configurations.py index 91d5e5d..fa7592c 100644 --- a/src/whop_sdk/resources/checkout_configurations.py +++ b/src/whop_sdk/resources/checkout_configurations.py @@ -55,6 +55,7 @@ def create( *, plan: checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanPlan, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanCheckoutStyling ] @@ -91,6 +92,9 @@ def create( affiliate_code: An affiliate tracking code to attribute the checkout to a specific affiliate. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -121,6 +125,7 @@ def create( *, plan_id: str, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanIDCheckoutStyling ] @@ -158,6 +163,9 @@ def create( affiliate_code: An affiliate tracking code to attribute the checkout to a specific affiliate. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -188,6 +196,7 @@ def create( *, company_id: str, mode: Literal["setup"], + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModeSetupCheckoutStyling ] @@ -222,6 +231,9 @@ def create( company_id: The unique identifier of the company to create the checkout configuration for. Only required in setup mode. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -252,6 +264,7 @@ def create( *, plan: checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanPlan | Omit = omit, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanCheckoutStyling ] @@ -286,6 +299,7 @@ def create( { "plan": plan, "affiliate_code": affiliate_code, + "allow_promo_codes": allow_promo_codes, "checkout_styling": checkout_styling, "currency": currency, "metadata": metadata, @@ -449,6 +463,7 @@ async def create( *, plan: checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanPlan, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanCheckoutStyling ] @@ -485,6 +500,9 @@ async def create( affiliate_code: An affiliate tracking code to attribute the checkout to a specific affiliate. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -515,6 +533,7 @@ async def create( *, plan_id: str, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanIDCheckoutStyling ] @@ -552,6 +571,9 @@ async def create( affiliate_code: An affiliate tracking code to attribute the checkout to a specific affiliate. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -582,6 +604,7 @@ async def create( *, company_id: str, mode: Literal["setup"], + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModeSetupCheckoutStyling ] @@ -616,6 +639,9 @@ async def create( company_id: The unique identifier of the company to create the checkout configuration for. Only required in setup mode. + allow_promo_codes: Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + checkout_styling: Checkout styling overrides for this session. Overrides plan and company defaults. @@ -646,6 +672,7 @@ async def create( *, plan: checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanPlan | Omit = omit, affiliate_code: Optional[str] | Omit = omit, + allow_promo_codes: Optional[bool] | Omit = omit, checkout_styling: Optional[ checkout_configuration_create_params.CreateCheckoutSessionInputModePaymentWithPlanCheckoutStyling ] @@ -680,6 +707,7 @@ async def create( { "plan": plan, "affiliate_code": affiliate_code, + "allow_promo_codes": allow_promo_codes, "checkout_styling": checkout_styling, "currency": currency, "metadata": metadata, diff --git a/src/whop_sdk/types/checkout_configuration_create_params.py b/src/whop_sdk/types/checkout_configuration_create_params.py index 68a873e..bb990dc 100644 --- a/src/whop_sdk/types/checkout_configuration_create_params.py +++ b/src/whop_sdk/types/checkout_configuration_create_params.py @@ -43,6 +43,12 @@ class CreateCheckoutSessionInputModePaymentWithPlan(TypedDict, total=False): affiliate_code: Optional[str] """An affiliate tracking code to attribute the checkout to a specific affiliate.""" + allow_promo_codes: Optional[bool] + """ + Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + """ + checkout_styling: Optional[CreateCheckoutSessionInputModePaymentWithPlanCheckoutStyling] """Checkout styling overrides for this session. @@ -340,6 +346,12 @@ class CreateCheckoutSessionInputModePaymentWithPlanID(TypedDict, total=False): affiliate_code: Optional[str] """An affiliate tracking code to attribute the checkout to a specific affiliate.""" + allow_promo_codes: Optional[bool] + """ + Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + """ + checkout_styling: Optional[CreateCheckoutSessionInputModePaymentWithPlanIDCheckoutStyling] """Checkout styling overrides for this session. @@ -421,6 +433,12 @@ class CreateCheckoutSessionInputModeSetup(TypedDict, total=False): mode: Required[Literal["setup"]] + allow_promo_codes: Optional[bool] + """ + Whether the checkout should show the promo code input field and accept promo + codes. Defaults to true. + """ + checkout_styling: Optional[CreateCheckoutSessionInputModeSetupCheckoutStyling] """Checkout styling overrides for this session. diff --git a/src/whop_sdk/types/checkout_configuration_list_response.py b/src/whop_sdk/types/checkout_configuration_list_response.py index 838b396..41b6742 100644 --- a/src/whop_sdk/types/checkout_configuration_list_response.py +++ b/src/whop_sdk/types/checkout_configuration_list_response.py @@ -115,6 +115,12 @@ class CheckoutConfigurationListResponse(BaseModel): affiliate_code: Optional[str] = None """The affiliate code to use for the checkout configuration""" + allow_promo_codes: bool + """Whether the checkout configuration allows promo codes. + + When false, the promo code input is hidden and promo codes are rejected. + """ + company_id: str """The ID of the company to use for the checkout configuration""" diff --git a/src/whop_sdk/types/shared/checkout_configuration.py b/src/whop_sdk/types/shared/checkout_configuration.py index 79d6060..e1fcc4c 100644 --- a/src/whop_sdk/types/shared/checkout_configuration.py +++ b/src/whop_sdk/types/shared/checkout_configuration.py @@ -115,6 +115,12 @@ class CheckoutConfiguration(BaseModel): affiliate_code: Optional[str] = None """The affiliate code to use for the checkout configuration""" + allow_promo_codes: bool + """Whether the checkout configuration allows promo codes. + + When false, the promo code input is hidden and promo codes are rejected. + """ + company_id: str """The ID of the company to use for the checkout configuration""" diff --git a/tests/api_resources/test_checkout_configurations.py b/tests/api_resources/test_checkout_configurations.py index cb45542..76c9754 100644 --- a/tests/api_resources/test_checkout_configurations.py +++ b/tests/api_resources/test_checkout_configurations.py @@ -89,6 +89,7 @@ def test_method_create_with_all_params_overload_1(self, client: Whop) -> None: "visibility": "visible", }, affiliate_code="affiliate_code", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", @@ -153,6 +154,7 @@ def test_method_create_with_all_params_overload_2(self, client: Whop) -> None: checkout_configuration = client.checkout_configurations.create( plan_id="plan_xxxxxxxxxxxxx", affiliate_code="affiliate_code", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", @@ -212,6 +214,7 @@ def test_method_create_with_all_params_overload_3(self, client: Whop) -> None: checkout_configuration = client.checkout_configurations.create( company_id="biz_xxxxxxxxxxxxxx", mode="setup", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", @@ -430,6 +433,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "visibility": "visible", }, affiliate_code="affiliate_code", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", @@ -494,6 +498,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn checkout_configuration = await async_client.checkout_configurations.create( plan_id="plan_xxxxxxxxxxxxx", affiliate_code="affiliate_code", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", @@ -553,6 +558,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn checkout_configuration = await async_client.checkout_configurations.create( company_id="biz_xxxxxxxxxxxxxx", mode="setup", + allow_promo_codes=True, checkout_styling={ "border_style": "rounded", "button_color": "button_color", diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index a737e4c..f8ca177 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -35,6 +35,15 @@ def test_multiple_files() -> None: assert query == {"documents": [{}, {}]} +def test_top_level_file_array() -> None: + query = {"files": [b"file one", b"file two"], "title": "hello"} + assert extract_files(query, paths=[["files", ""]]) == [ + ("files[]", b"file one"), + ("files[]", b"file two"), + ] + assert query == {"title": "hello"} + + @pytest.mark.parametrize( "query,paths,expected", [