From cda36b00ae8d5d91fdb020cd55d0a498a5313314 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 14:54:24 +0000 Subject: [PATCH] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-python-sdk: 4.64.1 --- .fern/metadata.json | 4 +- .fern/replay.lock | 10 + .fernignore | 3 + .gitattributes | 1 + pyproject.toml | 2 +- reference.md | 375 ++++-------- src/schematic/__init__.py | 18 - src/schematic/base_client.py | 80 +++ src/schematic/checkout/client.py | 16 + src/schematic/checkout/raw_client.py | 16 + src/schematic/core/client_wrapper.py | 4 +- src/schematic/credits/__init__.py | 12 - src/schematic/credits/client.py | 311 ---------- src/schematic/credits/raw_client.py | 543 ------------------ src/schematic/credits/types/__init__.py | 12 - .../types/count_credit_ledger_params.py | 39 -- .../types/count_credit_ledger_response.py | 25 - .../get_enriched_credit_ledger_params.py | 39 -- .../get_enriched_credit_ledger_response.py | 25 - src/schematic/plangroups/client.py | 52 ++ src/schematic/plangroups/raw_client.py | 48 ++ src/schematic/plans/client.py | 49 +- src/schematic/plans/raw_client.py | 25 - src/schematic/raw_base_client.py | 79 +++ src/schematic/types/__init__.py | 6 - .../billing_credit_grant_zeroed_out_reason.py | 2 +- ...ange_subscription_internal_request_body.py | 1 + .../types/change_subscription_request_body.py | 1 + .../types/checkout_settings_response_data.py | 3 + ...dit_ledger_enriched_entry_response_data.py | 44 -- src/schematic/types/credit_ledger_period.py | 5 - src/schematic/types/feature_entitlement.py | 12 +- .../types/plan_change_response_data.py | 5 + ...eview_subscription_change_response_data.py | 3 + .../types/rulesengine_feature_entitlement.py | 12 +- 35 files changed, 451 insertions(+), 1431 deletions(-) create mode 100644 .fern/replay.lock create mode 100644 .gitattributes delete mode 100644 src/schematic/credits/types/count_credit_ledger_params.py delete mode 100644 src/schematic/credits/types/count_credit_ledger_response.py delete mode 100644 src/schematic/credits/types/get_enriched_credit_ledger_params.py delete mode 100644 src/schematic/credits/types/get_enriched_credit_ledger_response.py create mode 100644 src/schematic/raw_base_client.py delete mode 100644 src/schematic/types/credit_ledger_enriched_entry_response_data.py delete mode 100644 src/schematic/types/credit_ledger_period.py diff --git a/.fern/metadata.json b/.fern/metadata.json index ec92118..3d72628 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -23,6 +23,6 @@ } ] }, - "originGitCommit": "a5724e8dfeba2338da634f270044ac597694f772", - "sdkVersion": "1.2.3" + "originGitCommit": "786b643cc0bf17aff1114597108246b5cf8af395", + "sdkVersion": "1.2.4" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock new file mode 100644 index 0000000..a91fd63 --- /dev/null +++ b/.fern/replay.lock @@ -0,0 +1,10 @@ +# DO NOT EDIT MANUALLY - Managed by Fern Replay +version: "1.0" +generations: + - commit_sha: 08aaebfda20179ccf2831d30f65f8182f2f74c08 + tree_hash: 7fcd2471bf31f5ab9b48228bb1cfa34ff8f5d27b + timestamp: 2026-06-16T14:54:21.146Z + cli_version: unknown + generator_versions: {} +current_generation: 08aaebfda20179ccf2831d30f65f8182f2f74c08 +patches: [] diff --git a/.fernignore b/.fernignore index 38b5616..be3a412 100644 --- a/.fernignore +++ b/.fernignore @@ -27,3 +27,6 @@ WASM_VERSION .gitignore pyproject.toml testapp/ +.fern/replay.lock +.fern/replay.yml +.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.fern/replay.lock linguist-generated=true diff --git a/pyproject.toml b/pyproject.toml index cfb22ad..279d823 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "schematichq" -version = "1.2.3" +version = "1.2.4" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index 13ed0d6..c2f7baf 100644 --- a/reference.md +++ b/reference.md @@ -1,4 +1,53 @@ # Reference +
client.get_credit_ledger() +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.get_credit_ledger() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ ## accounts
client.accounts.list_account_members(...) -> ListAccountMembersResponse
@@ -6141,250 +6190,6 @@ client.credits.release_credit_lease(
- - -
- -
client.credits.get_enriched_credit_ledger(...) -> GetEnrichedCreditLedgerResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.credits.get_enriched_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**company_id:** `str` - -
-
- -
-
- -**period:** `CreditLedgerPeriod` - -
-
- -
-
- -**billing_credit_id:** `typing.Optional[str]` - -
-
- -
-
- -**feature_id:** `typing.Optional[str]` - -
-
- -
-
- -**start_time:** `typing.Optional[str]` - -
-
- -
-
- -**end_time:** `typing.Optional[str]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.credits.count_credit_ledger(...) -> CountCreditLedgerResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.credits.count_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**company_id:** `str` - -
-
- -
-
- -**period:** `CreditLedgerPeriod` - -
-
- -
-
- -**billing_credit_id:** `typing.Optional[str]` - -
-
- -
-
- -**feature_id:** `typing.Optional[str]` - -
-
- -
-
- -**start_time:** `typing.Optional[str]` - -
-
- -
-
- -**end_time:** `typing.Optional[str]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- -
@@ -14022,7 +13827,7 @@ client.plans.mark_custom_plan_billing_paid(
```python -from schematic import Schematic, UpdatePayInAdvanceRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -14033,12 +13838,6 @@ client = Schematic( client.plans.retry_custom_plan_billing( custom_plan_billing_id="custom_plan_billing_id", customer_email="customer_email", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) ``` @@ -14071,14 +13870,6 @@ client.plans.retry_custom_plan_billing(
-**pay_in_advance:** `typing.List[UpdatePayInAdvanceRequestBody]` - -
-
- -
-
- **activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]`
@@ -15367,7 +15158,7 @@ client.plans.delete_plan_version(
```python -from schematic import Schematic, UpdatePayInAdvanceRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -15381,12 +15172,6 @@ client.plans.publish_plan_version( "excluded_company_ids" ], migration_strategy="immediate", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) ``` @@ -15427,14 +15212,6 @@ client.plans.publish_plan_version(
-**pay_in_advance:** `typing.List[UpdatePayInAdvanceRequestBody]` - -
-
- -
-
- **activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]`
@@ -19527,6 +19304,7 @@ client.plangroups.create_plan_group( checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -19608,6 +19386,14 @@ client.plangroups.create_plan_group(
+**opt_in_enabled:** `bool` + +
+
+ +
+
+ **ordered_add_ons:** `typing.List[OrderedPlansInGroup]`
@@ -19768,6 +19554,22 @@ client.plangroups.create_plan_group(
+**opt_in_text:** `typing.Optional[str]` + +
+
+ +
+
+ +**opt_in_title:** `typing.Optional[str]` + +
+
+ +
+
+ **prevent_self_service_downgrade_button_text:** `typing.Optional[str]`
@@ -19874,6 +19676,7 @@ client.plangroups.update_plan_group( checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -19963,6 +19766,14 @@ client.plangroups.update_plan_group(
+**opt_in_enabled:** `bool` + +
+
+ +
+
+ **ordered_add_ons:** `typing.List[OrderedPlansInGroup]`
@@ -20123,6 +19934,22 @@ client.plangroups.update_plan_group(
+**opt_in_text:** `typing.Optional[str]` + +
+
+ +
+
+ +**opt_in_title:** `typing.Optional[str]` + +
+
+ +
+
+ **prevent_self_service_downgrade_button_text:** `typing.Optional[str]`
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py index 26025d0..9b8f5c7 100644 --- a/src/schematic/__init__.py +++ b/src/schematic/__init__.py @@ -146,8 +146,6 @@ CreditGrantExpiryRequestBody, CreditGrantSortOrder, CreditLeaseResponseData, - CreditLedgerEnrichedEntryResponseData, - CreditLedgerPeriod, CreditTransferResponseData, CreditTransferView, CreditTriggerConfig, @@ -570,8 +568,6 @@ CountCreditBundlesResponse, CountCreditEventLedgerParams, CountCreditEventLedgerResponse, - CountCreditLedgerParams, - CountCreditLedgerResponse, CreateBillingCreditResponse, CreateBillingPlanCreditGrantResponse, CreateCreditBundleResponse, @@ -580,8 +576,6 @@ DeleteCreditBundleResponse, ExtendCreditLeaseResponse, GetCreditBundleResponse, - GetEnrichedCreditLedgerParams, - GetEnrichedCreditLedgerResponse, GetSingleBillingCreditResponse, GetSingleBillingPlanCreditGrantResponse, GrantBillingCreditsToCompanyResponse, @@ -919,8 +913,6 @@ "CountCreditBundlesResponse": ".credits", "CountCreditEventLedgerParams": ".credits", "CountCreditEventLedgerResponse": ".credits", - "CountCreditLedgerParams": ".credits", - "CountCreditLedgerResponse": ".credits", "CountCustomersParams": ".billing", "CountCustomersResponse": ".billing", "CountEntityKeyDefinitionsParams": ".companies", @@ -1004,8 +996,6 @@ "CreditGrantExpiryRequestBody": ".types", "CreditGrantSortOrder": ".types", "CreditLeaseResponseData": ".types", - "CreditLedgerEnrichedEntryResponseData": ".types", - "CreditLedgerPeriod": ".types", "CreditTransferResponseData": ".types", "CreditTransferView": ".types", "CreditTriggerConfig": ".types", @@ -1119,8 +1109,6 @@ "GetCompanyResponse": ".companies", "GetComponentResponse": ".components", "GetCreditBundleResponse": ".credits", - "GetEnrichedCreditLedgerParams": ".credits", - "GetEnrichedCreditLedgerResponse": ".credits", "GetEntityTraitDefinitionResponse": ".companies", "GetEntityTraitValuesParams": ".companies", "GetEntityTraitValuesResponse": ".companies", @@ -1686,8 +1674,6 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", - "CountCreditLedgerParams", - "CountCreditLedgerResponse", "CountCustomersParams", "CountCustomersResponse", "CountEntityKeyDefinitionsParams", @@ -1771,8 +1757,6 @@ def __dir__(): "CreditGrantExpiryRequestBody", "CreditGrantSortOrder", "CreditLeaseResponseData", - "CreditLedgerEnrichedEntryResponseData", - "CreditLedgerPeriod", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", @@ -1886,8 +1870,6 @@ def __dir__(): "GetCompanyResponse", "GetComponentResponse", "GetCreditBundleResponse", - "GetEnrichedCreditLedgerParams", - "GetEnrichedCreditLedgerResponse", "GetEntityTraitDefinitionResponse", "GetEntityTraitValuesParams", "GetEntityTraitValuesResponse", diff --git a/src/schematic/base_client.py b/src/schematic/base_client.py index f3d3125..0a0a5c3 100644 --- a/src/schematic/base_client.py +++ b/src/schematic/base_client.py @@ -7,7 +7,9 @@ import httpx from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .core.logging import LogConfig, Logger +from .core.request_options import RequestOptions from .environment import SchematicEnvironment +from .raw_base_client import AsyncRawBaseSchematic, RawBaseSchematic if typing.TYPE_CHECKING: from .accesstokens.client import AccesstokensClient, AsyncAccesstokensClient @@ -102,6 +104,7 @@ def __init__( timeout=_defaulted_timeout, logging=logging, ) + self._raw_client = RawBaseSchematic(client_wrapper=self._client_wrapper) self._accounts: typing.Optional[AccountsClient] = None self._billing: typing.Optional[BillingClient] = None self._credits: typing.Optional[CreditsClient] = None @@ -123,6 +126,40 @@ def __init__( self._accesstokens: typing.Optional[AccesstokensClient] = None self._webhooks: typing.Optional[WebhooksClient] = None + @property + def with_raw_response(self) -> RawBaseSchematic: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawBaseSchematic + """ + return self._raw_client + + def get_credit_ledger(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.get_credit_ledger() + """ + _response = self._raw_client.get_credit_ledger(request_options=request_options) + return _response.data + @property def accounts(self): if self._accounts is None: @@ -354,6 +391,7 @@ def __init__( timeout=_defaulted_timeout, logging=logging, ) + self._raw_client = AsyncRawBaseSchematic(client_wrapper=self._client_wrapper) self._accounts: typing.Optional[AsyncAccountsClient] = None self._billing: typing.Optional[AsyncBillingClient] = None self._credits: typing.Optional[AsyncCreditsClient] = None @@ -375,6 +413,48 @@ def __init__( self._accesstokens: typing.Optional[AsyncAccesstokensClient] = None self._webhooks: typing.Optional[AsyncWebhooksClient] = None + @property + def with_raw_response(self) -> AsyncRawBaseSchematic: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawBaseSchematic + """ + return self._raw_client + + async def get_credit_ledger(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.get_credit_ledger() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_credit_ledger(request_options=request_options) + return _response.data + @property def accounts(self): if self._accounts is None: diff --git a/src/schematic/checkout/client.py b/src/schematic/checkout/client.py index 9217485..dd87008 100644 --- a/src/schematic/checkout/client.py +++ b/src/schematic/checkout/client.py @@ -52,6 +52,7 @@ def internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -79,6 +80,8 @@ def internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -152,6 +155,7 @@ def internal( pay_in_advance=pay_in_advance, skip_trial=skip_trial, coupon_external_id=coupon_external_id, + opt_in_accepted=opt_in_accepted, payment_method_id=payment_method_id, promo_code=promo_code, request_options=request_options, @@ -209,6 +213,7 @@ def preview_checkout_internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -236,6 +241,8 @@ def preview_checkout_internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -309,6 +316,7 @@ def preview_checkout_internal( pay_in_advance=pay_in_advance, skip_trial=skip_trial, coupon_external_id=coupon_external_id, + opt_in_accepted=opt_in_accepted, payment_method_id=payment_method_id, promo_code=promo_code, request_options=request_options, @@ -667,6 +675,7 @@ async def internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -694,6 +703,8 @@ async def internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -775,6 +786,7 @@ async def main() -> None: pay_in_advance=pay_in_advance, skip_trial=skip_trial, coupon_external_id=coupon_external_id, + opt_in_accepted=opt_in_accepted, payment_method_id=payment_method_id, promo_code=promo_code, request_options=request_options, @@ -840,6 +852,7 @@ async def preview_checkout_internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -867,6 +880,8 @@ async def preview_checkout_internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -948,6 +963,7 @@ async def main() -> None: pay_in_advance=pay_in_advance, skip_trial=skip_trial, coupon_external_id=coupon_external_id, + opt_in_accepted=opt_in_accepted, payment_method_id=payment_method_id, promo_code=promo_code, request_options=request_options, diff --git a/src/schematic/checkout/raw_client.py b/src/schematic/checkout/raw_client.py index ed3556d..80c6e6c 100644 --- a/src/schematic/checkout/raw_client.py +++ b/src/schematic/checkout/raw_client.py @@ -54,6 +54,7 @@ def internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -81,6 +82,8 @@ def internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -115,6 +118,7 @@ def internal( ), "new_plan_id": new_plan_id, "new_price_id": new_price_id, + "opt_in_accepted": opt_in_accepted, "pay_in_advance": convert_and_respect_annotation_metadata( object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" ), @@ -332,6 +336,7 @@ def preview_checkout_internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -359,6 +364,8 @@ def preview_checkout_internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -393,6 +400,7 @@ def preview_checkout_internal( ), "new_plan_id": new_plan_id, "new_price_id": new_price_id, + "opt_in_accepted": opt_in_accepted, "pay_in_advance": convert_and_respect_annotation_metadata( object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" ), @@ -1080,6 +1088,7 @@ async def internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -1107,6 +1116,8 @@ async def internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -1141,6 +1152,7 @@ async def internal( ), "new_plan_id": new_plan_id, "new_price_id": new_price_id, + "opt_in_accepted": opt_in_accepted, "pay_in_advance": convert_and_respect_annotation_metadata( object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" ), @@ -1358,6 +1370,7 @@ async def preview_checkout_internal( pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], skip_trial: bool, coupon_external_id: typing.Optional[str] = OMIT, + opt_in_accepted: typing.Optional[bool] = OMIT, payment_method_id: typing.Optional[str] = OMIT, promo_code: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -1385,6 +1398,8 @@ async def preview_checkout_internal( coupon_external_id : typing.Optional[str] + opt_in_accepted : typing.Optional[bool] + payment_method_id : typing.Optional[str] promo_code : typing.Optional[str] @@ -1419,6 +1434,7 @@ async def preview_checkout_internal( ), "new_plan_id": new_plan_id, "new_price_id": new_price_id, + "opt_in_accepted": opt_in_accepted, "pay_in_advance": convert_and_respect_annotation_metadata( object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" ), diff --git a/src/schematic/core/client_wrapper.py b/src/schematic/core/client_wrapper.py index 25d1e4d..c123af8 100644 --- a/src/schematic/core/client_wrapper.py +++ b/src/schematic/core/client_wrapper.py @@ -27,12 +27,12 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "schematichq/1.2.3", + "User-Agent": "schematichq/1.2.4", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "schematichq", - "X-Fern-SDK-Version": "1.2.3", + "X-Fern-SDK-Version": "1.2.4", **(self.get_custom_headers() or {}), } headers["X-Schematic-Api-Key"] = self.api_key diff --git a/src/schematic/credits/__init__.py b/src/schematic/credits/__init__.py index 9661479..d8feee9 100644 --- a/src/schematic/credits/__init__.py +++ b/src/schematic/credits/__init__.py @@ -20,8 +20,6 @@ CountCreditBundlesResponse, CountCreditEventLedgerParams, CountCreditEventLedgerResponse, - CountCreditLedgerParams, - CountCreditLedgerResponse, CreateBillingCreditResponse, CreateBillingPlanCreditGrantResponse, CreateCreditBundleResponse, @@ -30,8 +28,6 @@ DeleteCreditBundleResponse, ExtendCreditLeaseResponse, GetCreditBundleResponse, - GetEnrichedCreditLedgerParams, - GetEnrichedCreditLedgerResponse, GetSingleBillingCreditResponse, GetSingleBillingPlanCreditGrantResponse, GrantBillingCreditsToCompanyResponse, @@ -70,8 +66,6 @@ "CountCreditBundlesResponse": ".types", "CountCreditEventLedgerParams": ".types", "CountCreditEventLedgerResponse": ".types", - "CountCreditLedgerParams": ".types", - "CountCreditLedgerResponse": ".types", "CreateBillingCreditResponse": ".types", "CreateBillingPlanCreditGrantResponse": ".types", "CreateCreditBundleResponse": ".types", @@ -80,8 +74,6 @@ "DeleteCreditBundleResponse": ".types", "ExtendCreditLeaseResponse": ".types", "GetCreditBundleResponse": ".types", - "GetEnrichedCreditLedgerParams": ".types", - "GetEnrichedCreditLedgerResponse": ".types", "GetSingleBillingCreditResponse": ".types", "GetSingleBillingPlanCreditGrantResponse": ".types", "GrantBillingCreditsToCompanyResponse": ".types", @@ -143,8 +135,6 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", - "CountCreditLedgerParams", - "CountCreditLedgerResponse", "CreateBillingCreditResponse", "CreateBillingPlanCreditGrantResponse", "CreateCreditBundleResponse", @@ -153,8 +143,6 @@ def __dir__(): "DeleteCreditBundleResponse", "ExtendCreditLeaseResponse", "GetCreditBundleResponse", - "GetEnrichedCreditLedgerParams", - "GetEnrichedCreditLedgerResponse", "GetSingleBillingCreditResponse", "GetSingleBillingPlanCreditGrantResponse", "GrantBillingCreditsToCompanyResponse", diff --git a/src/schematic/credits/client.py b/src/schematic/credits/client.py index 641e3f2..a069aee 100644 --- a/src/schematic/credits/client.py +++ b/src/schematic/credits/client.py @@ -21,7 +21,6 @@ from ..types.credit_currency_price_request_body import CreditCurrencyPriceRequestBody from ..types.credit_event_type import CreditEventType from ..types.credit_grant_sort_order import CreditGrantSortOrder -from ..types.credit_ledger_period import CreditLedgerPeriod from ..types.release_credit_lease_request_body import ReleaseCreditLeaseRequestBody from ..types.sort_direction import SortDirection from .raw_client import AsyncRawCreditsClient, RawCreditsClient @@ -32,7 +31,6 @@ from .types.count_company_grants_response import CountCompanyGrantsResponse from .types.count_credit_bundles_response import CountCreditBundlesResponse from .types.count_credit_event_ledger_response import CountCreditEventLedgerResponse -from .types.count_credit_ledger_response import CountCreditLedgerResponse from .types.create_billing_credit_response import CreateBillingCreditResponse from .types.create_billing_plan_credit_grant_response import CreateBillingPlanCreditGrantResponse from .types.create_credit_bundle_response import CreateCreditBundleResponse @@ -40,7 +38,6 @@ from .types.delete_credit_bundle_response import DeleteCreditBundleResponse from .types.extend_credit_lease_response import ExtendCreditLeaseResponse from .types.get_credit_bundle_response import GetCreditBundleResponse -from .types.get_enriched_credit_ledger_response import GetEnrichedCreditLedgerResponse from .types.get_single_billing_credit_response import GetSingleBillingCreditResponse from .types.get_single_billing_plan_credit_grant_response import GetSingleBillingPlanCreditGrantResponse from .types.grant_billing_credits_to_company_response import GrantBillingCreditsToCompanyResponse @@ -1241,152 +1238,6 @@ def release_credit_lease( _response = self._raw_client.release_credit_lease(lease_id, request=request, request_options=request_options) return _response.data - def get_enriched_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> GetEnrichedCreditLedgerResponse: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - GetEnrichedCreditLedgerResponse - OK - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.credits.get_enriched_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, - ) - """ - _response = self._raw_client.get_enriched_credit_ledger( - company_id=company_id, - period=period, - billing_credit_id=billing_credit_id, - feature_id=feature_id, - start_time=start_time, - end_time=end_time, - limit=limit, - offset=offset, - request_options=request_options, - ) - return _response.data - - def count_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> CountCreditLedgerResponse: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - CountCreditLedgerResponse - OK - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.credits.count_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, - ) - """ - _response = self._raw_client.count_credit_ledger( - company_id=company_id, - period=period, - billing_credit_id=billing_credit_id, - feature_id=feature_id, - start_time=start_time, - end_time=end_time, - limit=limit, - offset=offset, - request_options=request_options, - ) - return _response.data - def list_billing_plan_credit_grants( self, *, @@ -3343,168 +3194,6 @@ async def main() -> None: ) return _response.data - async def get_enriched_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> GetEnrichedCreditLedgerResponse: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - GetEnrichedCreditLedgerResponse - OK - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.credits.get_enriched_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.get_enriched_credit_ledger( - company_id=company_id, - period=period, - billing_credit_id=billing_credit_id, - feature_id=feature_id, - start_time=start_time, - end_time=end_time, - limit=limit, - offset=offset, - request_options=request_options, - ) - return _response.data - - async def count_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> CountCreditLedgerResponse: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - CountCreditLedgerResponse - OK - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.credits.count_credit_ledger( - company_id="company_id", - billing_credit_id="billing_credit_id", - feature_id="feature_id", - period="daily", - start_time="start_time", - end_time="end_time", - limit=1000000, - offset=1000000, - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.count_credit_ledger( - company_id=company_id, - period=period, - billing_credit_id=billing_credit_id, - feature_id=feature_id, - start_time=start_time, - end_time=end_time, - limit=limit, - offset=offset, - request_options=request_options, - ) - return _response.data - async def list_billing_plan_credit_grants( self, *, diff --git a/src/schematic/credits/raw_client.py b/src/schematic/credits/raw_client.py index 6814dab..7c1de97 100644 --- a/src/schematic/credits/raw_client.py +++ b/src/schematic/credits/raw_client.py @@ -34,7 +34,6 @@ from ..types.credit_currency_price_request_body import CreditCurrencyPriceRequestBody from ..types.credit_event_type import CreditEventType from ..types.credit_grant_sort_order import CreditGrantSortOrder -from ..types.credit_ledger_period import CreditLedgerPeriod from ..types.release_credit_lease_request_body import ReleaseCreditLeaseRequestBody from ..types.sort_direction import SortDirection from .types.acquire_credit_lease_response import AcquireCreditLeaseResponse @@ -44,7 +43,6 @@ from .types.count_company_grants_response import CountCompanyGrantsResponse from .types.count_credit_bundles_response import CountCreditBundlesResponse from .types.count_credit_event_ledger_response import CountCreditEventLedgerResponse -from .types.count_credit_ledger_response import CountCreditLedgerResponse from .types.create_billing_credit_response import CreateBillingCreditResponse from .types.create_billing_plan_credit_grant_response import CreateBillingPlanCreditGrantResponse from .types.create_credit_bundle_response import CreateCreditBundleResponse @@ -52,7 +50,6 @@ from .types.delete_credit_bundle_response import DeleteCreditBundleResponse from .types.extend_credit_lease_response import ExtendCreditLeaseResponse from .types.get_credit_bundle_response import GetCreditBundleResponse -from .types.get_enriched_credit_ledger_response import GetEnrichedCreditLedgerResponse from .types.get_single_billing_credit_response import GetSingleBillingCreditResponse from .types.get_single_billing_plan_credit_grant_response import GetSingleBillingPlanCreditGrantResponse from .types.grant_billing_credits_to_company_response import GrantBillingCreditsToCompanyResponse @@ -2778,276 +2775,6 @@ def release_credit_lease( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def get_enriched_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[GetEnrichedCreditLedgerResponse]: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[GetEnrichedCreditLedgerResponse] - OK - """ - _response = self._client_wrapper.httpx_client.request( - "billing/credits/ledger", - method="GET", - params={ - "company_id": company_id, - "billing_credit_id": billing_credit_id, - "feature_id": feature_id, - "period": period, - "start_time": start_time, - "end_time": end_time, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - GetEnrichedCreditLedgerResponse, - parse_obj_as( - type_=GetEnrichedCreditLedgerResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - except ValidationError as e: - raise ParsingError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - def count_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[CountCreditLedgerResponse]: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[CountCreditLedgerResponse] - OK - """ - _response = self._client_wrapper.httpx_client.request( - "billing/credits/ledger/count", - method="GET", - params={ - "company_id": company_id, - "billing_credit_id": billing_credit_id, - "feature_id": feature_id, - "period": period, - "start_time": start_time, - "end_time": end_time, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - CountCreditLedgerResponse, - parse_obj_as( - type_=CountCreditLedgerResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - except ValidationError as e: - raise ParsingError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - def list_billing_plan_credit_grants( self, *, @@ -6862,276 +6589,6 @@ async def release_credit_lease( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_enriched_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[GetEnrichedCreditLedgerResponse]: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[GetEnrichedCreditLedgerResponse] - OK - """ - _response = await self._client_wrapper.httpx_client.request( - "billing/credits/ledger", - method="GET", - params={ - "company_id": company_id, - "billing_credit_id": billing_credit_id, - "feature_id": feature_id, - "period": period, - "start_time": start_time, - "end_time": end_time, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - GetEnrichedCreditLedgerResponse, - parse_obj_as( - type_=GetEnrichedCreditLedgerResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - except ValidationError as e: - raise ParsingError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - async def count_credit_ledger( - self, - *, - company_id: str, - period: CreditLedgerPeriod, - billing_credit_id: typing.Optional[str] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountCreditLedgerResponse]: - """ - Parameters - ---------- - company_id : str - - period : CreditLedgerPeriod - - billing_credit_id : typing.Optional[str] - - feature_id : typing.Optional[str] - - start_time : typing.Optional[str] - - end_time : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[CountCreditLedgerResponse] - OK - """ - _response = await self._client_wrapper.httpx_client.request( - "billing/credits/ledger/count", - method="GET", - params={ - "company_id": company_id, - "billing_credit_id": billing_credit_id, - "feature_id": feature_id, - "period": period, - "start_time": start_time, - "end_time": end_time, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - CountCreditLedgerResponse, - parse_obj_as( - type_=CountCreditLedgerResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - except ValidationError as e: - raise ParsingError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - async def list_billing_plan_credit_grants( self, *, diff --git a/src/schematic/credits/types/__init__.py b/src/schematic/credits/types/__init__.py index 8ede7ac..69f3d65 100644 --- a/src/schematic/credits/types/__init__.py +++ b/src/schematic/credits/types/__init__.py @@ -19,8 +19,6 @@ from .count_credit_bundles_response import CountCreditBundlesResponse from .count_credit_event_ledger_params import CountCreditEventLedgerParams from .count_credit_event_ledger_response import CountCreditEventLedgerResponse - from .count_credit_ledger_params import CountCreditLedgerParams - from .count_credit_ledger_response import CountCreditLedgerResponse from .create_billing_credit_response import CreateBillingCreditResponse from .create_billing_plan_credit_grant_response import CreateBillingPlanCreditGrantResponse from .create_credit_bundle_response import CreateCreditBundleResponse @@ -29,8 +27,6 @@ from .delete_credit_bundle_response import DeleteCreditBundleResponse from .extend_credit_lease_response import ExtendCreditLeaseResponse from .get_credit_bundle_response import GetCreditBundleResponse - from .get_enriched_credit_ledger_params import GetEnrichedCreditLedgerParams - from .get_enriched_credit_ledger_response import GetEnrichedCreditLedgerResponse from .get_single_billing_credit_response import GetSingleBillingCreditResponse from .get_single_billing_plan_credit_grant_response import GetSingleBillingPlanCreditGrantResponse from .grant_billing_credits_to_company_response import GrantBillingCreditsToCompanyResponse @@ -68,8 +64,6 @@ "CountCreditBundlesResponse": ".count_credit_bundles_response", "CountCreditEventLedgerParams": ".count_credit_event_ledger_params", "CountCreditEventLedgerResponse": ".count_credit_event_ledger_response", - "CountCreditLedgerParams": ".count_credit_ledger_params", - "CountCreditLedgerResponse": ".count_credit_ledger_response", "CreateBillingCreditResponse": ".create_billing_credit_response", "CreateBillingPlanCreditGrantResponse": ".create_billing_plan_credit_grant_response", "CreateCreditBundleResponse": ".create_credit_bundle_response", @@ -78,8 +72,6 @@ "DeleteCreditBundleResponse": ".delete_credit_bundle_response", "ExtendCreditLeaseResponse": ".extend_credit_lease_response", "GetCreditBundleResponse": ".get_credit_bundle_response", - "GetEnrichedCreditLedgerParams": ".get_enriched_credit_ledger_params", - "GetEnrichedCreditLedgerResponse": ".get_enriched_credit_ledger_response", "GetSingleBillingCreditResponse": ".get_single_billing_credit_response", "GetSingleBillingPlanCreditGrantResponse": ".get_single_billing_plan_credit_grant_response", "GrantBillingCreditsToCompanyResponse": ".grant_billing_credits_to_company_response", @@ -141,8 +133,6 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", - "CountCreditLedgerParams", - "CountCreditLedgerResponse", "CreateBillingCreditResponse", "CreateBillingPlanCreditGrantResponse", "CreateCreditBundleResponse", @@ -151,8 +141,6 @@ def __dir__(): "DeleteCreditBundleResponse", "ExtendCreditLeaseResponse", "GetCreditBundleResponse", - "GetEnrichedCreditLedgerParams", - "GetEnrichedCreditLedgerResponse", "GetSingleBillingCreditResponse", "GetSingleBillingPlanCreditGrantResponse", "GrantBillingCreditsToCompanyResponse", diff --git a/src/schematic/credits/types/count_credit_ledger_params.py b/src/schematic/credits/types/count_credit_ledger_params.py deleted file mode 100644 index e8c7d96..0000000 --- a/src/schematic/credits/types/count_credit_ledger_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.credit_ledger_period import CreditLedgerPeriod - - -class CountCreditLedgerParams(UniversalBaseModel): - """ - Input parameters - """ - - billing_credit_id: typing.Optional[str] = None - company_id: typing.Optional[str] = None - end_time: typing.Optional[str] = None - feature_id: typing.Optional[str] = None - limit: typing.Optional[int] = pydantic.Field(default=None) - """ - Page limit (default 100) - """ - - offset: typing.Optional[int] = pydantic.Field(default=None) - """ - Page offset (default 0) - """ - - period: typing.Optional[CreditLedgerPeriod] = None - start_time: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/credits/types/count_credit_ledger_response.py b/src/schematic/credits/types/count_credit_ledger_response.py deleted file mode 100644 index 5928819..0000000 --- a/src/schematic/credits/types/count_credit_ledger_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.count_response import CountResponse -from .count_credit_ledger_params import CountCreditLedgerParams - - -class CountCreditLedgerResponse(UniversalBaseModel): - data: CountResponse - params: CountCreditLedgerParams = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/credits/types/get_enriched_credit_ledger_params.py b/src/schematic/credits/types/get_enriched_credit_ledger_params.py deleted file mode 100644 index 6d358b4..0000000 --- a/src/schematic/credits/types/get_enriched_credit_ledger_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.credit_ledger_period import CreditLedgerPeriod - - -class GetEnrichedCreditLedgerParams(UniversalBaseModel): - """ - Input parameters - """ - - billing_credit_id: typing.Optional[str] = None - company_id: typing.Optional[str] = None - end_time: typing.Optional[str] = None - feature_id: typing.Optional[str] = None - limit: typing.Optional[int] = pydantic.Field(default=None) - """ - Page limit (default 100) - """ - - offset: typing.Optional[int] = pydantic.Field(default=None) - """ - Page offset (default 0) - """ - - period: typing.Optional[CreditLedgerPeriod] = None - start_time: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/credits/types/get_enriched_credit_ledger_response.py b/src/schematic/credits/types/get_enriched_credit_ledger_response.py deleted file mode 100644 index 14e120a..0000000 --- a/src/schematic/credits/types/get_enriched_credit_ledger_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.credit_ledger_enriched_entry_response_data import CreditLedgerEnrichedEntryResponseData -from .get_enriched_credit_ledger_params import GetEnrichedCreditLedgerParams - - -class GetEnrichedCreditLedgerResponse(UniversalBaseModel): - data: typing.List[CreditLedgerEnrichedEntryResponseData] - params: GetEnrichedCreditLedgerParams = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/plangroups/client.py b/src/schematic/plangroups/client.py index 33e5350..db82dcd 100644 --- a/src/schematic/plangroups/client.py +++ b/src/schematic/plangroups/client.py @@ -78,6 +78,7 @@ def create_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -98,6 +99,8 @@ def create_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -122,6 +125,8 @@ def create_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -162,6 +167,10 @@ def create_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -199,6 +208,7 @@ def create_plan_group( checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -232,6 +242,7 @@ def create_plan_group( checkout_collect_email=checkout_collect_email, checkout_collect_phone=checkout_collect_phone, enable_tax_collection=enable_tax_collection, + opt_in_enabled=opt_in_enabled, ordered_add_ons=ordered_add_ons, ordered_bundle_list=ordered_bundle_list, ordered_plans=ordered_plans, @@ -252,6 +263,8 @@ def create_plan_group( fallback_plan_id=fallback_plan_id, initial_plan_id=initial_plan_id, initial_plan_price_id=initial_plan_price_id, + opt_in_text=opt_in_text, + opt_in_title=opt_in_title, prevent_self_service_downgrade_button_text=prevent_self_service_downgrade_button_text, prevent_self_service_downgrade_url=prevent_self_service_downgrade_url, scheduled_downgrade_behavior=scheduled_downgrade_behavior, @@ -273,6 +286,7 @@ def update_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -293,6 +307,8 @@ def update_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -320,6 +336,8 @@ def update_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -360,6 +378,10 @@ def update_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -398,6 +420,7 @@ def update_plan_group( checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -432,6 +455,7 @@ def update_plan_group( checkout_collect_email=checkout_collect_email, checkout_collect_phone=checkout_collect_phone, enable_tax_collection=enable_tax_collection, + opt_in_enabled=opt_in_enabled, ordered_add_ons=ordered_add_ons, ordered_bundle_list=ordered_bundle_list, ordered_plans=ordered_plans, @@ -452,6 +476,8 @@ def update_plan_group( fallback_plan_id=fallback_plan_id, initial_plan_id=initial_plan_id, initial_plan_price_id=initial_plan_price_id, + opt_in_text=opt_in_text, + opt_in_title=opt_in_title, prevent_self_service_downgrade_button_text=prevent_self_service_downgrade_button_text, prevent_self_service_downgrade_url=prevent_self_service_downgrade_url, scheduled_downgrade_behavior=scheduled_downgrade_behavior, @@ -531,6 +557,7 @@ async def create_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -551,6 +578,8 @@ async def create_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -575,6 +604,8 @@ async def create_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -615,6 +646,10 @@ async def create_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -657,6 +692,7 @@ async def main() -> None: checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -693,6 +729,7 @@ async def main() -> None: checkout_collect_email=checkout_collect_email, checkout_collect_phone=checkout_collect_phone, enable_tax_collection=enable_tax_collection, + opt_in_enabled=opt_in_enabled, ordered_add_ons=ordered_add_ons, ordered_bundle_list=ordered_bundle_list, ordered_plans=ordered_plans, @@ -713,6 +750,8 @@ async def main() -> None: fallback_plan_id=fallback_plan_id, initial_plan_id=initial_plan_id, initial_plan_price_id=initial_plan_price_id, + opt_in_text=opt_in_text, + opt_in_title=opt_in_title, prevent_self_service_downgrade_button_text=prevent_self_service_downgrade_button_text, prevent_self_service_downgrade_url=prevent_self_service_downgrade_url, scheduled_downgrade_behavior=scheduled_downgrade_behavior, @@ -734,6 +773,7 @@ async def update_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -754,6 +794,8 @@ async def update_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -781,6 +823,8 @@ async def update_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -821,6 +865,10 @@ async def update_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -864,6 +912,7 @@ async def main() -> None: checkout_collect_email=True, checkout_collect_phone=True, enable_tax_collection=True, + opt_in_enabled=True, ordered_add_ons=[ OrderedPlansInGroup( plan_id="plan_id", @@ -901,6 +950,7 @@ async def main() -> None: checkout_collect_email=checkout_collect_email, checkout_collect_phone=checkout_collect_phone, enable_tax_collection=enable_tax_collection, + opt_in_enabled=opt_in_enabled, ordered_add_ons=ordered_add_ons, ordered_bundle_list=ordered_bundle_list, ordered_plans=ordered_plans, @@ -921,6 +971,8 @@ async def main() -> None: fallback_plan_id=fallback_plan_id, initial_plan_id=initial_plan_id, initial_plan_price_id=initial_plan_price_id, + opt_in_text=opt_in_text, + opt_in_title=opt_in_title, prevent_self_service_downgrade_button_text=prevent_self_service_downgrade_button_text, prevent_self_service_downgrade_url=prevent_self_service_downgrade_url, scheduled_downgrade_behavior=scheduled_downgrade_behavior, diff --git a/src/schematic/plangroups/raw_client.py b/src/schematic/plangroups/raw_client.py index ecc5f77..6565f41 100644 --- a/src/schematic/plangroups/raw_client.py +++ b/src/schematic/plangroups/raw_client.py @@ -139,6 +139,7 @@ def create_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -159,6 +160,8 @@ def create_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -183,6 +186,8 @@ def create_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -223,6 +228,10 @@ def create_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -269,6 +278,9 @@ def create_plan_group( "fallback_plan_id": fallback_plan_id, "initial_plan_id": initial_plan_id, "initial_plan_price_id": initial_plan_price_id, + "opt_in_enabled": opt_in_enabled, + "opt_in_text": opt_in_text, + "opt_in_title": opt_in_title, "ordered_add_ons": convert_and_respect_annotation_metadata( object_=ordered_add_ons, annotation=typing.Sequence[OrderedPlansInGroup], direction="write" ), @@ -390,6 +402,7 @@ def update_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -410,6 +423,8 @@ def update_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -437,6 +452,8 @@ def update_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -477,6 +494,10 @@ def update_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -523,6 +544,9 @@ def update_plan_group( "fallback_plan_id": fallback_plan_id, "initial_plan_id": initial_plan_id, "initial_plan_price_id": initial_plan_price_id, + "opt_in_enabled": opt_in_enabled, + "opt_in_text": opt_in_text, + "opt_in_title": opt_in_title, "ordered_add_ons": convert_and_respect_annotation_metadata( object_=ordered_add_ons, annotation=typing.Sequence[OrderedPlansInGroup], direction="write" ), @@ -742,6 +766,7 @@ async def create_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -762,6 +787,8 @@ async def create_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -786,6 +813,8 @@ async def create_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -826,6 +855,10 @@ async def create_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -872,6 +905,9 @@ async def create_plan_group( "fallback_plan_id": fallback_plan_id, "initial_plan_id": initial_plan_id, "initial_plan_price_id": initial_plan_price_id, + "opt_in_enabled": opt_in_enabled, + "opt_in_text": opt_in_text, + "opt_in_title": opt_in_title, "ordered_add_ons": convert_and_respect_annotation_metadata( object_=ordered_add_ons, annotation=typing.Sequence[OrderedPlansInGroup], direction="write" ), @@ -993,6 +1029,7 @@ async def update_plan_group( checkout_collect_email: bool, checkout_collect_phone: bool, enable_tax_collection: bool, + opt_in_enabled: bool, ordered_add_ons: typing.Sequence[OrderedPlansInGroup], ordered_bundle_list: typing.Sequence[PlanGroupBundleOrder], ordered_plans: typing.Sequence[OrderedPlansInGroup], @@ -1013,6 +1050,8 @@ async def update_plan_group( fallback_plan_id: typing.Optional[str] = OMIT, initial_plan_id: typing.Optional[str] = OMIT, initial_plan_price_id: typing.Optional[str] = OMIT, + opt_in_text: typing.Optional[str] = OMIT, + opt_in_title: typing.Optional[str] = OMIT, prevent_self_service_downgrade_button_text: typing.Optional[str] = OMIT, prevent_self_service_downgrade_url: typing.Optional[str] = OMIT, scheduled_downgrade_behavior: typing.Optional[ScheduledDowngradeConfigBehavior] = OMIT, @@ -1040,6 +1079,8 @@ async def update_plan_group( enable_tax_collection : bool + opt_in_enabled : bool + ordered_add_ons : typing.Sequence[OrderedPlansInGroup] ordered_bundle_list : typing.Sequence[PlanGroupBundleOrder] @@ -1080,6 +1121,10 @@ async def update_plan_group( initial_plan_price_id : typing.Optional[str] + opt_in_text : typing.Optional[str] + + opt_in_title : typing.Optional[str] + prevent_self_service_downgrade_button_text : typing.Optional[str] prevent_self_service_downgrade_url : typing.Optional[str] @@ -1126,6 +1171,9 @@ async def update_plan_group( "fallback_plan_id": fallback_plan_id, "initial_plan_id": initial_plan_id, "initial_plan_price_id": initial_plan_price_id, + "opt_in_enabled": opt_in_enabled, + "opt_in_text": opt_in_text, + "opt_in_title": opt_in_title, "ordered_add_ons": convert_and_respect_annotation_metadata( object_=ordered_add_ons, annotation=typing.Sequence[OrderedPlansInGroup], direction="write" ), diff --git a/src/schematic/plans/client.py b/src/schematic/plans/client.py index 94061e8..cf4a98b 100644 --- a/src/schematic/plans/client.py +++ b/src/schematic/plans/client.py @@ -14,7 +14,6 @@ from ..types.plan_icon import PlanIcon from ..types.plan_type import PlanType from ..types.plan_version_migration_strategy import PlanVersionMigrationStrategy -from ..types.update_pay_in_advance_request_body import UpdatePayInAdvanceRequestBody from .raw_client import AsyncRawPlansClient, RawPlansClient from .types.count_billing_product_match_companies_response import CountBillingProductMatchCompaniesResponse from .types.count_plans_response import CountPlansResponse @@ -211,7 +210,6 @@ def retry_custom_plan_billing( custom_plan_billing_id: str, *, customer_email: str, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, days_until_due: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -224,8 +222,6 @@ def retry_custom_plan_billing( customer_email : str - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] days_until_due : typing.Optional[int] @@ -240,7 +236,7 @@ def retry_custom_plan_billing( Examples -------- - from schematic import Schematic, UpdatePayInAdvanceRequestBody + from schematic import Schematic client = Schematic( api_key="YOUR_API_KEY", @@ -248,18 +244,11 @@ def retry_custom_plan_billing( client.plans.retry_custom_plan_billing( custom_plan_billing_id="custom_plan_billing_id", customer_email="customer_email", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) """ _response = self._raw_client.retry_custom_plan_billing( custom_plan_billing_id, customer_email=customer_email, - pay_in_advance=pay_in_advance, activation_strategy=activation_strategy, days_until_due=days_until_due, request_options=request_options, @@ -1092,7 +1081,6 @@ def publish_plan_version( *, excluded_company_ids: typing.Sequence[str], migration_strategy: PlanVersionMigrationStrategy, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, customer_email: typing.Optional[str] = OMIT, days_until_due: typing.Optional[int] = OMIT, @@ -1108,8 +1096,6 @@ def publish_plan_version( migration_strategy : PlanVersionMigrationStrategy - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] customer_email : typing.Optional[str] @@ -1126,7 +1112,7 @@ def publish_plan_version( Examples -------- - from schematic import Schematic, UpdatePayInAdvanceRequestBody + from schematic import Schematic client = Schematic( api_key="YOUR_API_KEY", @@ -1135,19 +1121,12 @@ def publish_plan_version( plan_id="plan_id", excluded_company_ids=["excluded_company_ids"], migration_strategy="immediate", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) """ _response = self._raw_client.publish_plan_version( plan_id, excluded_company_ids=excluded_company_ids, migration_strategy=migration_strategy, - pay_in_advance=pay_in_advance, activation_strategy=activation_strategy, customer_email=customer_email, days_until_due=days_until_due, @@ -1352,7 +1331,6 @@ async def retry_custom_plan_billing( custom_plan_billing_id: str, *, customer_email: str, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, days_until_due: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -1365,8 +1343,6 @@ async def retry_custom_plan_billing( customer_email : str - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] days_until_due : typing.Optional[int] @@ -1383,7 +1359,7 @@ async def retry_custom_plan_billing( -------- import asyncio - from schematic import AsyncSchematic, UpdatePayInAdvanceRequestBody + from schematic import AsyncSchematic client = AsyncSchematic( api_key="YOUR_API_KEY", @@ -1394,12 +1370,6 @@ async def main() -> None: await client.plans.retry_custom_plan_billing( custom_plan_billing_id="custom_plan_billing_id", customer_email="customer_email", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) @@ -1408,7 +1378,6 @@ async def main() -> None: _response = await self._raw_client.retry_custom_plan_billing( custom_plan_billing_id, customer_email=customer_email, - pay_in_advance=pay_in_advance, activation_strategy=activation_strategy, days_until_due=days_until_due, request_options=request_options, @@ -2347,7 +2316,6 @@ async def publish_plan_version( *, excluded_company_ids: typing.Sequence[str], migration_strategy: PlanVersionMigrationStrategy, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, customer_email: typing.Optional[str] = OMIT, days_until_due: typing.Optional[int] = OMIT, @@ -2363,8 +2331,6 @@ async def publish_plan_version( migration_strategy : PlanVersionMigrationStrategy - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] customer_email : typing.Optional[str] @@ -2383,7 +2349,7 @@ async def publish_plan_version( -------- import asyncio - from schematic import AsyncSchematic, UpdatePayInAdvanceRequestBody + from schematic import AsyncSchematic client = AsyncSchematic( api_key="YOUR_API_KEY", @@ -2395,12 +2361,6 @@ async def main() -> None: plan_id="plan_id", excluded_company_ids=["excluded_company_ids"], migration_strategy="immediate", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], ) @@ -2410,7 +2370,6 @@ async def main() -> None: plan_id, excluded_company_ids=excluded_company_ids, migration_strategy=migration_strategy, - pay_in_advance=pay_in_advance, activation_strategy=activation_strategy, customer_email=customer_email, days_until_due=days_until_due, diff --git a/src/schematic/plans/raw_client.py b/src/schematic/plans/raw_client.py index 90bbe06..05202db 100644 --- a/src/schematic/plans/raw_client.py +++ b/src/schematic/plans/raw_client.py @@ -27,7 +27,6 @@ from ..types.plan_icon import PlanIcon from ..types.plan_type import PlanType from ..types.plan_version_migration_strategy import PlanVersionMigrationStrategy -from ..types.update_pay_in_advance_request_body import UpdatePayInAdvanceRequestBody from .types.count_billing_product_match_companies_response import CountBillingProductMatchCompaniesResponse from .types.count_plans_response import CountPlansResponse from .types.create_custom_plan_response import CreateCustomPlanResponse @@ -422,7 +421,6 @@ def retry_custom_plan_billing( custom_plan_billing_id: str, *, customer_email: str, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, days_until_due: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -435,8 +433,6 @@ def retry_custom_plan_billing( customer_email : str - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] days_until_due : typing.Optional[int] @@ -456,9 +452,6 @@ def retry_custom_plan_billing( "activation_strategy": activation_strategy, "customer_email": customer_email, "days_until_due": days_until_due, - "pay_in_advance": convert_and_respect_annotation_metadata( - object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" - ), }, headers={ "content-type": "application/json", @@ -2246,7 +2239,6 @@ def publish_plan_version( *, excluded_company_ids: typing.Sequence[str], migration_strategy: PlanVersionMigrationStrategy, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, customer_email: typing.Optional[str] = OMIT, days_until_due: typing.Optional[int] = OMIT, @@ -2262,8 +2254,6 @@ def publish_plan_version( migration_strategy : PlanVersionMigrationStrategy - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] customer_email : typing.Optional[str] @@ -2287,9 +2277,6 @@ def publish_plan_version( "days_until_due": days_until_due, "excluded_company_ids": excluded_company_ids, "migration_strategy": migration_strategy, - "pay_in_advance": convert_and_respect_annotation_metadata( - object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" - ), }, headers={ "content-type": "application/json", @@ -2746,7 +2733,6 @@ async def retry_custom_plan_billing( custom_plan_billing_id: str, *, customer_email: str, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, days_until_due: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, @@ -2759,8 +2745,6 @@ async def retry_custom_plan_billing( customer_email : str - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] days_until_due : typing.Optional[int] @@ -2780,9 +2764,6 @@ async def retry_custom_plan_billing( "activation_strategy": activation_strategy, "customer_email": customer_email, "days_until_due": days_until_due, - "pay_in_advance": convert_and_respect_annotation_metadata( - object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" - ), }, headers={ "content-type": "application/json", @@ -4570,7 +4551,6 @@ async def publish_plan_version( *, excluded_company_ids: typing.Sequence[str], migration_strategy: PlanVersionMigrationStrategy, - pay_in_advance: typing.Sequence[UpdatePayInAdvanceRequestBody], activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT, customer_email: typing.Optional[str] = OMIT, days_until_due: typing.Optional[int] = OMIT, @@ -4586,8 +4566,6 @@ async def publish_plan_version( migration_strategy : PlanVersionMigrationStrategy - pay_in_advance : typing.Sequence[UpdatePayInAdvanceRequestBody] - activation_strategy : typing.Optional[CustomPlanActivationStrategy] customer_email : typing.Optional[str] @@ -4611,9 +4589,6 @@ async def publish_plan_version( "days_until_due": days_until_due, "excluded_company_ids": excluded_company_ids, "migration_strategy": migration_strategy, - "pay_in_advance": convert_and_respect_annotation_metadata( - object_=pay_in_advance, annotation=typing.Sequence[UpdatePayInAdvanceRequestBody], direction="write" - ), }, headers={ "content-type": "application/json", diff --git a/src/schematic/raw_base_client.py b/src/schematic/raw_base_client.py new file mode 100644 index 0000000..df5ef2d --- /dev/null +++ b/src/schematic/raw_base_client.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .core.api_error import ApiError +from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .core.http_response import AsyncHttpResponse, HttpResponse +from .core.parse_error import ParsingError +from .core.request_options import RequestOptions +from pydantic import ValidationError + + +class RawBaseSchematic: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_credit_ledger(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + "billing/credits/ledger", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawBaseSchematic: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_credit_ledger( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/ledger", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/schematic/types/__init__.py b/src/schematic/types/__init__.py index 7c5287f..a924857 100644 --- a/src/schematic/types/__init__.py +++ b/src/schematic/types/__init__.py @@ -145,8 +145,6 @@ from .credit_grant_expiry_request_body import CreditGrantExpiryRequestBody from .credit_grant_sort_order import CreditGrantSortOrder from .credit_lease_response_data import CreditLeaseResponseData - from .credit_ledger_enriched_entry_response_data import CreditLedgerEnrichedEntryResponseData - from .credit_ledger_period import CreditLedgerPeriod from .credit_transfer_response_data import CreditTransferResponseData from .credit_transfer_view import CreditTransferView from .credit_trigger_config import CreditTriggerConfig @@ -533,8 +531,6 @@ "CreditGrantExpiryRequestBody": ".credit_grant_expiry_request_body", "CreditGrantSortOrder": ".credit_grant_sort_order", "CreditLeaseResponseData": ".credit_lease_response_data", - "CreditLedgerEnrichedEntryResponseData": ".credit_ledger_enriched_entry_response_data", - "CreditLedgerPeriod": ".credit_ledger_period", "CreditTransferResponseData": ".credit_transfer_response_data", "CreditTransferView": ".credit_transfer_view", "CreditTriggerConfig": ".credit_trigger_config", @@ -943,8 +939,6 @@ def __dir__(): "CreditGrantExpiryRequestBody", "CreditGrantSortOrder", "CreditLeaseResponseData", - "CreditLedgerEnrichedEntryResponseData", - "CreditLedgerPeriod", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", diff --git a/src/schematic/types/billing_credit_grant_zeroed_out_reason.py b/src/schematic/types/billing_credit_grant_zeroed_out_reason.py index 60795f7..c39699f 100644 --- a/src/schematic/types/billing_credit_grant_zeroed_out_reason.py +++ b/src/schematic/types/billing_credit_grant_zeroed_out_reason.py @@ -3,5 +3,5 @@ import typing BillingCreditGrantZeroedOutReason = typing.Union[ - typing.Literal["expired", "manual", "plan_change", "plan_period_reset"], typing.Any + typing.Literal["expired", "manual", "plan_change", "plan_period_reset", "reconciled"], typing.Any ] diff --git a/src/schematic/types/change_subscription_internal_request_body.py b/src/schematic/types/change_subscription_internal_request_body.py index 18d7f2b..6e0b753 100644 --- a/src/schematic/types/change_subscription_internal_request_body.py +++ b/src/schematic/types/change_subscription_internal_request_body.py @@ -20,6 +20,7 @@ class ChangeSubscriptionInternalRequestBody(UniversalBaseModel): custom_field_values: typing.List[CheckoutFieldValue] new_plan_id: str new_price_id: str + opt_in_accepted: typing.Optional[bool] = None pay_in_advance: typing.List[UpdatePayInAdvanceRequestBody] payment_method_id: typing.Optional[str] = None promo_code: typing.Optional[str] = None diff --git a/src/schematic/types/change_subscription_request_body.py b/src/schematic/types/change_subscription_request_body.py index 16fdd42..10d8c1f 100644 --- a/src/schematic/types/change_subscription_request_body.py +++ b/src/schematic/types/change_subscription_request_body.py @@ -19,6 +19,7 @@ class ChangeSubscriptionRequestBody(UniversalBaseModel): custom_field_values: typing.List[CheckoutFieldValue] new_plan_id: str new_price_id: str + opt_in_accepted: typing.Optional[bool] = None pay_in_advance: typing.List[UpdatePayInAdvanceRequestBody] payment_method_id: typing.Optional[str] = None promo_code: typing.Optional[str] = None diff --git a/src/schematic/types/checkout_settings_response_data.py b/src/schematic/types/checkout_settings_response_data.py index e7dd0f0..83d2af4 100644 --- a/src/schematic/types/checkout_settings_response_data.py +++ b/src/schematic/types/checkout_settings_response_data.py @@ -10,6 +10,9 @@ class CheckoutSettingsResponseData(UniversalBaseModel): collect_address: bool collect_email: bool collect_phone: bool + opt_in_enabled: bool + opt_in_text: typing.Optional[str] = None + opt_in_title: typing.Optional[str] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/schematic/types/credit_ledger_enriched_entry_response_data.py b/src/schematic/types/credit_ledger_enriched_entry_response_data.py deleted file mode 100644 index 8565028..0000000 --- a/src/schematic/types/credit_ledger_enriched_entry_response_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .billing_credit_ledger_response_data import BillingCreditLedgerResponseData -from .company_ledger_response_data import CompanyLedgerResponseData -from .feature_ledger_response_data import FeatureLedgerResponseData - - -class CreditLedgerEnrichedEntryResponseData(UniversalBaseModel): - billing_credit_auto_topup_grant_count: int - billing_credit_id: str - company: typing.Optional[CompanyLedgerResponseData] = None - company_id: str - credit: typing.Optional[BillingCreditLedgerResponseData] = None - expired_grant_count: int - feature: typing.Optional[FeatureLedgerResponseData] = None - feature_id: typing.Optional[str] = None - first_transaction_at: dt.datetime - free_grant_count: int - grant_count: int - last_transaction_at: dt.datetime - manually_zeroed_count: int - net_change: float - plan_grant_count: int - purchased_grant_count: int - time_bucket: dt.datetime - total_consumed: float - total_granted: float - transaction_count: int - usage_count: int - zeroed_out_count: int - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/types/credit_ledger_period.py b/src/schematic/types/credit_ledger_period.py deleted file mode 100644 index ee8e454..0000000 --- a/src/schematic/types/credit_ledger_period.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -CreditLedgerPeriod = typing.Union[typing.Literal["daily", "monthly", "raw", "weekly"], typing.Any] diff --git a/src/schematic/types/feature_entitlement.py b/src/schematic/types/feature_entitlement.py index 272ff0f..a05f081 100644 --- a/src/schematic/types/feature_entitlement.py +++ b/src/schematic/types/feature_entitlement.py @@ -23,7 +23,17 @@ class FeatureEntitlement(UniversalBaseModel): credit_remaining: typing.Optional[float] = pydantic.Field(default=None) """ - If the company has a credit-based entitlement for this feature, the remaining credit amount + If the company has a credit-based entitlement for this feature, the credit available to fund new consumption or a new lease hold — open lease holds are excluded. Clients that hold a lease should gate on this plus their own unspent hold; clients with no lease awareness should use credit_settled instead + """ + + credit_reserved: typing.Optional[float] = pydantic.Field(default=None) + """ + If the company has a credit-based entitlement for this feature, the unspent amount held by an open credit lease. Returns to credit_remaining when the lease is released + """ + + credit_settled: typing.Optional[float] = pydantic.Field(default=None) + """ + If the company has a credit-based entitlement for this feature, the balance net of actual consumption, unaffected by open lease holds (credit_remaining plus credit_reserved). The number to display to end users """ credit_total: typing.Optional[float] = pydantic.Field(default=None) diff --git a/src/schematic/types/plan_change_response_data.py b/src/schematic/types/plan_change_response_data.py index b6d65d9..2808efe 100644 --- a/src/schematic/types/plan_change_response_data.py +++ b/src/schematic/types/plan_change_response_data.py @@ -40,6 +40,11 @@ class PlanChangeResponseData(UniversalBaseModel): created_at: dt.datetime environment_id: str id: str + is_version_upgrade: bool = pydantic.Field() + """ + True when this change moved the company to a different version of the same plan (e.g. a plan version migration) rather than to a different plan. + """ + previous_base_plan: typing.Optional[PlanSnapshotView] = None previous_base_plan_version: typing.Optional[PlanVersionSnapshotView] = pydantic.Field(default=None) """ diff --git a/src/schematic/types/preview_subscription_change_response_data.py b/src/schematic/types/preview_subscription_change_response_data.py index 1f596aa..b1caac9 100644 --- a/src/schematic/types/preview_subscription_change_response_data.py +++ b/src/schematic/types/preview_subscription_change_response_data.py @@ -15,6 +15,9 @@ class PreviewSubscriptionChangeResponseData(UniversalBaseModel): finance: typing.Optional[PreviewSubscriptionFinanceResponseData] = None is_scheduled_downgrade: bool new_charges: int + opt_in_required: bool + opt_in_text: typing.Optional[str] = None + opt_in_title: typing.Optional[str] = None payment_method_required: bool percent_off: float period_start: dt.datetime diff --git a/src/schematic/types/rulesengine_feature_entitlement.py b/src/schematic/types/rulesengine_feature_entitlement.py index 0c4dfbd..b592231 100644 --- a/src/schematic/types/rulesengine_feature_entitlement.py +++ b/src/schematic/types/rulesengine_feature_entitlement.py @@ -23,7 +23,17 @@ class RulesengineFeatureEntitlement(UniversalBaseModel): credit_remaining: typing.Optional[float] = pydantic.Field(default=None) """ - If the company has a credit-based entitlement for this feature, the remaining credit amount + If the company has a credit-based entitlement for this feature, the credit available to fund new consumption or a new lease hold — open lease holds are excluded. Clients that hold a lease should gate on this plus their own unspent hold; clients with no lease awareness should use credit_settled instead + """ + + credit_reserved: typing.Optional[float] = pydantic.Field(default=None) + """ + If the company has a credit-based entitlement for this feature, the unspent amount held by an open credit lease. Returns to credit_remaining when the lease is released + """ + + credit_settled: typing.Optional[float] = pydantic.Field(default=None) + """ + If the company has a credit-based entitlement for this feature, the balance net of actual consumption, unaffected by open lease holds (credit_remaining plus credit_reserved). The number to display to end users """ credit_total: typing.Optional[float] = pydantic.Field(default=None)