From 5802ed837910167972f9be9adcc00a86abecc431 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:32:03 +0000 Subject: [PATCH] SDK regeneration --- LICENSE | 21 ++ pyproject.toml | 7 +- reference.md | 157 +++++++++ src/schematic/__init__.py | 63 ++++ src/schematic/companies/__init__.py | 3 + src/schematic/companies/client.py | 34 +- src/schematic/companies/raw_client.py | 30 +- src/schematic/companies/types/__init__.py | 3 + .../companies/types/delete_company_params.py | 24 ++ .../types/delete_company_response.py | 3 +- src/schematic/core/client_wrapper.py | 4 +- src/schematic/credits/__init__.py | 21 ++ src/schematic/credits/client.py | 198 ++++++++++- src/schematic/credits/raw_client.py | 320 +++++++++++++++++- src/schematic/credits/types/__init__.py | 31 ++ ...delete_billing_plan_credit_grant_params.py | 23 ++ ...lete_billing_plan_credit_grant_response.py | 3 +- ...n_credit_grant_request_body_expiry_type.py | 8 + ...n_credit_grant_request_body_expiry_unit.py | 5 + ...credit_grant_request_body_reset_cadence.py | 7 + ...n_credit_grant_request_body_reset_start.py | 7 + ...an_credit_grant_request_body_reset_type.py | 5 + ...date_billing_plan_credit_grant_response.py | 24 ++ src/schematic/types/__init__.py | 39 +++ src/schematic/types/condition.py | 12 +- .../types/condition_condition_type.py | 10 + .../types/condition_metric_period.py | 7 + .../condition_metric_period_month_reset.py | 5 + src/schematic/types/condition_operator.py | 7 + .../types/credit_grant_expiry_request_body.py | 29 ++ ...t_grant_expiry_request_body_expiry_type.py | 8 + ...t_grant_expiry_request_body_expiry_unit.py | 5 + ...grant_expiry_request_body_reset_cadence.py | 7 + ...t_grant_expiry_request_body_reset_start.py | 5 + ...it_grant_expiry_request_body_reset_type.py | 5 + .../types/plan_change_response_data_action.py | 1 + src/schematic/types/rule.py | 3 +- src/schematic/types/rule_rule_type.py | 16 + src/schematic/types/trait_definition.py | 6 +- .../types/trait_definition_comparable_type.py | 5 + .../types/trait_definition_entity_type.py | 5 + 41 files changed, 1150 insertions(+), 26 deletions(-) create mode 100644 LICENSE create mode 100644 src/schematic/companies/types/delete_company_params.py create mode 100644 src/schematic/credits/types/delete_billing_plan_credit_grant_params.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_type.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_unit.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_cadence.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_start.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_type.py create mode 100644 src/schematic/credits/types/update_billing_plan_credit_grant_response.py create mode 100644 src/schematic/types/condition_condition_type.py create mode 100644 src/schematic/types/condition_metric_period.py create mode 100644 src/schematic/types/condition_metric_period_month_reset.py create mode 100644 src/schematic/types/condition_operator.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body_expiry_type.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body_expiry_unit.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body_reset_cadence.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body_reset_start.py create mode 100644 src/schematic/types/credit_grant_expiry_request_body_reset_type.py create mode 100644 src/schematic/types/rule_rule_type.py create mode 100644 src/schematic/types/trait_definition_comparable_type.py create mode 100644 src/schematic/types/trait_definition_entity_type.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..605bddd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Schematic. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index af09a45..ba23d96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,12 +3,12 @@ name = "schematichq" [tool.poetry] name = "schematichq" -version = "1.1.2" +version = "1.1.3" description = "" readme = "README.md" authors = [] keywords = [] - +license = "MIT" classifiers = [ "Intended Audience :: Developers", "Programming Language :: Python", @@ -24,7 +24,8 @@ classifiers = [ "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Topic :: Software Development :: Libraries :: Python Modules", - "Typing :: Typed" + "Typing :: Typed", + "License :: OSI Approved :: MIT License" ] packages = [ { include = "schematic", from = "src"} diff --git a/reference.md b/reference.md index 3142c22..55a5ac7 100644 --- a/reference.md +++ b/reference.md @@ -5471,6 +5471,14 @@ client.credits.create_billing_plan_credit_grant(
+**apply_to_existing:** `typing.Optional[bool]` + +
+
+ +
+
+ **expiry_type:** `typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType]`
@@ -5511,6 +5519,128 @@ client.credits.create_billing_plan_credit_grant(
+ + + + +
client.credits.update_billing_plan_credit_grant(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic + +client = Schematic( + api_key="YOUR_API_KEY", +) +client.credits.update_billing_plan_credit_grant( + plan_grant_id="plan_grant_id", + reset_cadence="monthly", + reset_start="billing_period", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**plan_grant_id:** `str` — plan_grant_id + +
+
+ +
+
+ +**reset_cadence:** `UpdateBillingPlanCreditGrantRequestBodyResetCadence` + +
+
+ +
+
+ +**reset_start:** `UpdateBillingPlanCreditGrantRequestBodyResetStart` + +
+
+ +
+
+ +**apply_to_existing:** `typing.Optional[bool]` + +
+
+ +
+
+ +**credit_amount:** `typing.Optional[int]` + +
+
+ +
+
+ +**expiry_type:** `typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType]` + +
+
+ +
+
+ +**expiry_unit:** `typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit]` + +
+
+ +
+
+ +**expiry_unit_count:** `typing.Optional[int]` + +
+
+ +
+
+ +**reset_type:** `typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -5535,6 +5665,7 @@ client = Schematic( ) client.credits.delete_billing_plan_credit_grant( plan_grant_id="plan_grant_id", + apply_to_existing=True, ) ``` @@ -5559,6 +5690,14 @@ client.credits.delete_billing_plan_credit_grant(
+**apply_to_existing:** `typing.Optional[bool]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -6682,6 +6821,8 @@ client = Schematic( ) client.companies.delete_company( company_id="company_id", + cancel_subscription=True, + prorate=True, ) ``` @@ -6706,6 +6847,22 @@ client.companies.delete_company(
+**cancel_subscription:** `typing.Optional[bool]` + +
+
+ +
+
+ +**prorate:** `typing.Optional[bool]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py index fc8a880..ab74291 100644 --- a/src/schematic/__init__.py +++ b/src/schematic/__init__.py @@ -66,7 +66,11 @@ ComponentPreviewResponseData, ComponentResponseData, Condition, + ConditionConditionType, ConditionGroup, + ConditionMetricPeriod, + ConditionMetricPeriodMonthReset, + ConditionOperator, CountResponse, CouponRequestBody, CreateBillingPriceTierRequestBody, @@ -91,6 +95,12 @@ CreditCompanyGrantView, CreditGrantDetail, CreditGrantDetailGrantReason, + CreditGrantExpiryRequestBody, + CreditGrantExpiryRequestBodyExpiryType, + CreditGrantExpiryRequestBodyExpiryUnit, + CreditGrantExpiryRequestBodyResetCadence, + CreditGrantExpiryRequestBodyResetStart, + CreditGrantExpiryRequestBodyResetType, CreditLedgerEnrichedEntryResponseData, CreditTriggerConfig, CreditUsage, @@ -184,12 +194,15 @@ RuleConditionResponseData, RuleDetailResponseData, RuleResponseData, + RuleRuleType, RulesDetailResponseData, SegmentStatusResp, StripeEmbedInfo, SubscriptionTraitUpdate, TemporaryAccessTokenResponseData, TraitDefinition, + TraitDefinitionComparableType, + TraitDefinitionEntityType, UpdateAddOnRequestBody, UpdateCreditBundleRequestBody, UpdateEntitlementReqCommon, @@ -338,6 +351,7 @@ CreateUserResponse, DeleteCompanyByKeysResponse, DeleteCompanyMembershipResponse, + DeleteCompanyParams, DeleteCompanyResponse, DeletePlanTraitResponse, DeleteUserByKeysResponse, @@ -437,6 +451,7 @@ CreateCreditBundleRequestBodyExpiryUnit, CreateCreditBundleRequestBodyStatus, CreateCreditBundleResponse, + DeleteBillingPlanCreditGrantParams, DeleteBillingPlanCreditGrantResponse, DeleteCreditBundleResponse, GetCreditBundleResponse, @@ -466,6 +481,12 @@ UpdateBillingCreditRequestBodyBurnStrategy, UpdateBillingCreditRequestBodyDefaultRolloverPolicy, UpdateBillingCreditResponse, + UpdateBillingPlanCreditGrantRequestBodyExpiryType, + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit, + UpdateBillingPlanCreditGrantRequestBodyResetCadence, + UpdateBillingPlanCreditGrantRequestBodyResetStart, + UpdateBillingPlanCreditGrantRequestBodyResetType, + UpdateBillingPlanCreditGrantResponse, UpdateCreditBundleDetailsRequestBodyExpiryType, UpdateCreditBundleDetailsRequestBodyExpiryUnit, UpdateCreditBundleDetailsRequestBodyStatus, @@ -672,7 +693,11 @@ "ComponentPreviewResponseData": ".types", "ComponentResponseData": ".types", "Condition": ".types", + "ConditionConditionType": ".types", "ConditionGroup": ".types", + "ConditionMetricPeriod": ".types", + "ConditionMetricPeriodMonthReset": ".types", + "ConditionOperator": ".types", "CountApiKeysParams": ".accounts", "CountApiKeysResponse": ".accounts", "CountApiRequestsParams": ".accounts", @@ -815,6 +840,12 @@ "CreditCompanyGrantView": ".types", "CreditGrantDetail": ".types", "CreditGrantDetailGrantReason": ".types", + "CreditGrantExpiryRequestBody": ".types", + "CreditGrantExpiryRequestBodyExpiryType": ".types", + "CreditGrantExpiryRequestBodyExpiryUnit": ".types", + "CreditGrantExpiryRequestBodyResetCadence": ".types", + "CreditGrantExpiryRequestBodyResetStart": ".types", + "CreditGrantExpiryRequestBodyResetType": ".types", "CreditLedgerEnrichedEntryResponseData": ".types", "CreditTriggerConfig": ".types", "CreditUsage": ".types", @@ -828,11 +859,13 @@ "DataExportResponseData": ".types", "Decimal": ".types", "DeleteApiKeyResponse": ".accounts", + "DeleteBillingPlanCreditGrantParams": ".credits", "DeleteBillingPlanCreditGrantResponse": ".credits", "DeleteBillingProductResponse": ".billing", "DeleteCompanyByKeysResponse": ".companies", "DeleteCompanyMembershipResponse": ".companies", "DeleteCompanyOverrideResponse": ".entitlements", + "DeleteCompanyParams": ".companies", "DeleteCompanyResponse": ".companies", "DeleteComponentResponse": ".components", "DeleteCreditBundleResponse": ".credits", @@ -1077,6 +1110,7 @@ "RuleConditionResponseData": ".types", "RuleDetailResponseData": ".types", "RuleResponseData": ".types", + "RuleRuleType": ".types", "RulesDetailResponseData": ".types", "Schematic": ".client", "SchematicConfig": ".client", @@ -1093,12 +1127,20 @@ "SubscriptionTraitUpdate": ".types", "TemporaryAccessTokenResponseData": ".types", "TraitDefinition": ".types", + "TraitDefinitionComparableType": ".types", + "TraitDefinitionEntityType": ".types", "UnauthorizedError": ".errors", "UpdateAddOnRequestBody": ".types", "UpdateApiKeyResponse": ".accounts", "UpdateBillingCreditRequestBodyBurnStrategy": ".credits", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy": ".credits", "UpdateBillingCreditResponse": ".credits", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType": ".credits", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit": ".credits", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence": ".credits", + "UpdateBillingPlanCreditGrantRequestBodyResetStart": ".credits", + "UpdateBillingPlanCreditGrantRequestBodyResetType": ".credits", + "UpdateBillingPlanCreditGrantResponse": ".credits", "UpdateCompanyOverrideRequestBodyMetricPeriod": ".entitlements", "UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset": ".entitlements", "UpdateCompanyOverrideRequestBodyValueType": ".entitlements", @@ -1279,7 +1321,11 @@ def __dir__(): "ComponentPreviewResponseData", "ComponentResponseData", "Condition", + "ConditionConditionType", "ConditionGroup", + "ConditionMetricPeriod", + "ConditionMetricPeriodMonthReset", + "ConditionOperator", "CountApiKeysParams", "CountApiKeysResponse", "CountApiRequestsParams", @@ -1422,6 +1468,12 @@ def __dir__(): "CreditCompanyGrantView", "CreditGrantDetail", "CreditGrantDetailGrantReason", + "CreditGrantExpiryRequestBody", + "CreditGrantExpiryRequestBodyExpiryType", + "CreditGrantExpiryRequestBodyExpiryUnit", + "CreditGrantExpiryRequestBodyResetCadence", + "CreditGrantExpiryRequestBodyResetStart", + "CreditGrantExpiryRequestBodyResetType", "CreditLedgerEnrichedEntryResponseData", "CreditTriggerConfig", "CreditUsage", @@ -1435,11 +1487,13 @@ def __dir__(): "DataExportResponseData", "Decimal", "DeleteApiKeyResponse", + "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", "DeleteBillingProductResponse", "DeleteCompanyByKeysResponse", "DeleteCompanyMembershipResponse", "DeleteCompanyOverrideResponse", + "DeleteCompanyParams", "DeleteCompanyResponse", "DeleteComponentResponse", "DeleteCreditBundleResponse", @@ -1684,6 +1738,7 @@ def __dir__(): "RuleConditionResponseData", "RuleDetailResponseData", "RuleResponseData", + "RuleRuleType", "RulesDetailResponseData", "Schematic", "SchematicConfig", @@ -1700,12 +1755,20 @@ def __dir__(): "SubscriptionTraitUpdate", "TemporaryAccessTokenResponseData", "TraitDefinition", + "TraitDefinitionComparableType", + "TraitDefinitionEntityType", "UnauthorizedError", "UpdateAddOnRequestBody", "UpdateApiKeyResponse", "UpdateBillingCreditRequestBodyBurnStrategy", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy", "UpdateBillingCreditResponse", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence", + "UpdateBillingPlanCreditGrantRequestBodyResetStart", + "UpdateBillingPlanCreditGrantRequestBodyResetType", + "UpdateBillingPlanCreditGrantResponse", "UpdateCompanyOverrideRequestBodyMetricPeriod", "UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset", "UpdateCompanyOverrideRequestBodyValueType", diff --git a/src/schematic/companies/__init__.py b/src/schematic/companies/__init__.py index 60687ad..d290391 100644 --- a/src/schematic/companies/__init__.py +++ b/src/schematic/companies/__init__.py @@ -34,6 +34,7 @@ CreateUserResponse, DeleteCompanyByKeysResponse, DeleteCompanyMembershipResponse, + DeleteCompanyParams, DeleteCompanyResponse, DeletePlanTraitResponse, DeleteUserByKeysResponse, @@ -116,6 +117,7 @@ "CreateUserResponse": ".types", "DeleteCompanyByKeysResponse": ".types", "DeleteCompanyMembershipResponse": ".types", + "DeleteCompanyParams": ".types", "DeleteCompanyResponse": ".types", "DeletePlanTraitResponse": ".types", "DeleteUserByKeysResponse": ".types", @@ -221,6 +223,7 @@ def __dir__(): "CreateUserResponse", "DeleteCompanyByKeysResponse", "DeleteCompanyMembershipResponse", + "DeleteCompanyParams", "DeleteCompanyResponse", "DeletePlanTraitResponse", "DeleteUserByKeysResponse", diff --git a/src/schematic/companies/client.py b/src/schematic/companies/client.py index 2461d6e..ccda99d 100644 --- a/src/schematic/companies/client.py +++ b/src/schematic/companies/client.py @@ -259,7 +259,12 @@ def get_company( return _response.data def delete_company( - self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + company_id: str, + *, + cancel_subscription: typing.Optional[bool] = None, + prorate: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> DeleteCompanyResponse: """ Parameters @@ -267,6 +272,10 @@ def delete_company( company_id : str company_id + cancel_subscription : typing.Optional[bool] + + prorate : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -284,9 +293,13 @@ def delete_company( ) client.companies.delete_company( company_id="company_id", + cancel_subscription=True, + prorate=True, ) """ - _response = self._raw_client.delete_company(company_id, request_options=request_options) + _response = self._raw_client.delete_company( + company_id, cancel_subscription=cancel_subscription, prorate=prorate, request_options=request_options + ) return _response.data def count_companies( @@ -2466,7 +2479,12 @@ async def main() -> None: return _response.data async def delete_company( - self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + company_id: str, + *, + cancel_subscription: typing.Optional[bool] = None, + prorate: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> DeleteCompanyResponse: """ Parameters @@ -2474,6 +2492,10 @@ async def delete_company( company_id : str company_id + cancel_subscription : typing.Optional[bool] + + prorate : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2496,12 +2518,16 @@ async def delete_company( async def main() -> None: await client.companies.delete_company( company_id="company_id", + cancel_subscription=True, + prorate=True, ) asyncio.run(main()) """ - _response = await self._raw_client.delete_company(company_id, request_options=request_options) + _response = await self._raw_client.delete_company( + company_id, cancel_subscription=cancel_subscription, prorate=prorate, request_options=request_options + ) return _response.data async def count_companies( diff --git a/src/schematic/companies/raw_client.py b/src/schematic/companies/raw_client.py index 113525a..5dc1328 100644 --- a/src/schematic/companies/raw_client.py +++ b/src/schematic/companies/raw_client.py @@ -441,7 +441,12 @@ def get_company( ) def delete_company( - self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + company_id: str, + *, + cancel_subscription: typing.Optional[bool] = None, + prorate: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeleteCompanyResponse]: """ Parameters @@ -449,6 +454,10 @@ def delete_company( company_id : str company_id + cancel_subscription : typing.Optional[bool] + + prorate : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -460,6 +469,10 @@ def delete_company( _response = self._client_wrapper.httpx_client.request( f"companies/{jsonable_encoder(company_id)}", method="DELETE", + params={ + "cancel_subscription": cancel_subscription, + "prorate": prorate, + }, request_options=request_options, ) try: @@ -5295,7 +5308,12 @@ async def get_company( ) async def delete_company( - self, company_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + company_id: str, + *, + cancel_subscription: typing.Optional[bool] = None, + prorate: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeleteCompanyResponse]: """ Parameters @@ -5303,6 +5321,10 @@ async def delete_company( company_id : str company_id + cancel_subscription : typing.Optional[bool] + + prorate : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -5314,6 +5336,10 @@ async def delete_company( _response = await self._client_wrapper.httpx_client.request( f"companies/{jsonable_encoder(company_id)}", method="DELETE", + params={ + "cancel_subscription": cancel_subscription, + "prorate": prorate, + }, request_options=request_options, ) try: diff --git a/src/schematic/companies/types/__init__.py b/src/schematic/companies/types/__init__.py index f8ff0e8..225346a 100644 --- a/src/schematic/companies/types/__init__.py +++ b/src/schematic/companies/types/__init__.py @@ -45,6 +45,7 @@ from .create_user_response import CreateUserResponse from .delete_company_by_keys_response import DeleteCompanyByKeysResponse from .delete_company_membership_response import DeleteCompanyMembershipResponse + from .delete_company_params import DeleteCompanyParams from .delete_company_response import DeleteCompanyResponse from .delete_plan_trait_response import DeletePlanTraitResponse from .delete_user_by_keys_response import DeleteUserByKeysResponse @@ -136,6 +137,7 @@ "CreateUserResponse": ".create_user_response", "DeleteCompanyByKeysResponse": ".delete_company_by_keys_response", "DeleteCompanyMembershipResponse": ".delete_company_membership_response", + "DeleteCompanyParams": ".delete_company_params", "DeleteCompanyResponse": ".delete_company_response", "DeletePlanTraitResponse": ".delete_plan_trait_response", "DeleteUserByKeysResponse": ".delete_user_by_keys_response", @@ -241,6 +243,7 @@ def __dir__(): "CreateUserResponse", "DeleteCompanyByKeysResponse", "DeleteCompanyMembershipResponse", + "DeleteCompanyParams", "DeleteCompanyResponse", "DeletePlanTraitResponse", "DeleteUserByKeysResponse", diff --git a/src/schematic/companies/types/delete_company_params.py b/src/schematic/companies/types/delete_company_params.py new file mode 100644 index 0000000..7ad80b6 --- /dev/null +++ b/src/schematic/companies/types/delete_company_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class DeleteCompanyParams(UniversalBaseModel): + """ + Input parameters + """ + + cancel_subscription: typing.Optional[bool] = None + prorate: typing.Optional[bool] = 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/companies/types/delete_company_response.py b/src/schematic/companies/types/delete_company_response.py index 24fe3eb..e1305b0 100644 --- a/src/schematic/companies/types/delete_company_response.py +++ b/src/schematic/companies/types/delete_company_response.py @@ -5,11 +5,12 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.delete_response import DeleteResponse +from .delete_company_params import DeleteCompanyParams class DeleteCompanyResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: DeleteCompanyParams = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/core/client_wrapper.py b/src/schematic/core/client_wrapper.py index d5598f2..12a6084 100644 --- a/src/schematic/core/client_wrapper.py +++ b/src/schematic/core/client_wrapper.py @@ -22,10 +22,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "schematichq/1.1.2", + "User-Agent": "schematichq/1.1.3", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "schematichq", - "X-Fern-SDK-Version": "1.1.2", + "X-Fern-SDK-Version": "1.1.3", **(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 2a257b3..78f02a2 100644 --- a/src/schematic/credits/__init__.py +++ b/src/schematic/credits/__init__.py @@ -36,6 +36,7 @@ CreateCreditBundleRequestBodyExpiryUnit, CreateCreditBundleRequestBodyStatus, CreateCreditBundleResponse, + DeleteBillingPlanCreditGrantParams, DeleteBillingPlanCreditGrantResponse, DeleteCreditBundleResponse, GetCreditBundleResponse, @@ -65,6 +66,12 @@ UpdateBillingCreditRequestBodyBurnStrategy, UpdateBillingCreditRequestBodyDefaultRolloverPolicy, UpdateBillingCreditResponse, + UpdateBillingPlanCreditGrantRequestBodyExpiryType, + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit, + UpdateBillingPlanCreditGrantRequestBodyResetCadence, + UpdateBillingPlanCreditGrantRequestBodyResetStart, + UpdateBillingPlanCreditGrantRequestBodyResetType, + UpdateBillingPlanCreditGrantResponse, UpdateCreditBundleDetailsRequestBodyExpiryType, UpdateCreditBundleDetailsRequestBodyExpiryUnit, UpdateCreditBundleDetailsRequestBodyStatus, @@ -102,6 +109,7 @@ "CreateCreditBundleRequestBodyExpiryUnit": ".types", "CreateCreditBundleRequestBodyStatus": ".types", "CreateCreditBundleResponse": ".types", + "DeleteBillingPlanCreditGrantParams": ".types", "DeleteBillingPlanCreditGrantResponse": ".types", "DeleteCreditBundleResponse": ".types", "GetCreditBundleResponse": ".types", @@ -131,6 +139,12 @@ "UpdateBillingCreditRequestBodyBurnStrategy": ".types", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy": ".types", "UpdateBillingCreditResponse": ".types", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType": ".types", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit": ".types", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence": ".types", + "UpdateBillingPlanCreditGrantRequestBodyResetStart": ".types", + "UpdateBillingPlanCreditGrantRequestBodyResetType": ".types", + "UpdateBillingPlanCreditGrantResponse": ".types", "UpdateCreditBundleDetailsRequestBodyExpiryType": ".types", "UpdateCreditBundleDetailsRequestBodyExpiryUnit": ".types", "UpdateCreditBundleDetailsRequestBodyStatus": ".types", @@ -191,6 +205,7 @@ def __dir__(): "CreateCreditBundleRequestBodyExpiryUnit", "CreateCreditBundleRequestBodyStatus", "CreateCreditBundleResponse", + "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", "DeleteCreditBundleResponse", "GetCreditBundleResponse", @@ -220,6 +235,12 @@ def __dir__(): "UpdateBillingCreditRequestBodyBurnStrategy", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy", "UpdateBillingCreditResponse", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence", + "UpdateBillingPlanCreditGrantRequestBodyResetStart", + "UpdateBillingPlanCreditGrantRequestBodyResetType", + "UpdateBillingPlanCreditGrantResponse", "UpdateCreditBundleDetailsRequestBodyExpiryType", "UpdateCreditBundleDetailsRequestBodyExpiryUnit", "UpdateCreditBundleDetailsRequestBodyStatus", diff --git a/src/schematic/credits/client.py b/src/schematic/credits/client.py index 9bc50b0..0a4c600 100644 --- a/src/schematic/credits/client.py +++ b/src/schematic/credits/client.py @@ -61,6 +61,22 @@ UpdateBillingCreditRequestBodyDefaultRolloverPolicy, ) from .types.update_billing_credit_response import UpdateBillingCreditResponse +from .types.update_billing_plan_credit_grant_request_body_expiry_type import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryType, +) +from .types.update_billing_plan_credit_grant_request_body_expiry_unit import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit, +) +from .types.update_billing_plan_credit_grant_request_body_reset_cadence import ( + UpdateBillingPlanCreditGrantRequestBodyResetCadence, +) +from .types.update_billing_plan_credit_grant_request_body_reset_start import ( + UpdateBillingPlanCreditGrantRequestBodyResetStart, +) +from .types.update_billing_plan_credit_grant_request_body_reset_type import ( + UpdateBillingPlanCreditGrantRequestBodyResetType, +) +from .types.update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .types.update_credit_bundle_details_request_body_expiry_type import UpdateCreditBundleDetailsRequestBodyExpiryType from .types.update_credit_bundle_details_request_body_expiry_unit import UpdateCreditBundleDetailsRequestBodyExpiryUnit from .types.update_credit_bundle_details_request_body_status import UpdateCreditBundleDetailsRequestBodyStatus @@ -1216,6 +1232,7 @@ def create_billing_plan_credit_grant( plan_id: str, reset_cadence: CreateBillingPlanCreditGrantRequestBodyResetCadence, reset_start: CreateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, expiry_type: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, expiry_unit: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, expiry_unit_count: typing.Optional[int] = OMIT, @@ -1235,6 +1252,8 @@ def create_billing_plan_credit_grant( reset_start : CreateBillingPlanCreditGrantRequestBodyResetStart + apply_to_existing : typing.Optional[bool] + expiry_type : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] expiry_unit : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] @@ -1272,6 +1291,78 @@ def create_billing_plan_credit_grant( plan_id=plan_id, reset_cadence=reset_cadence, reset_start=reset_start, + apply_to_existing=apply_to_existing, + expiry_type=expiry_type, + expiry_unit=expiry_unit, + expiry_unit_count=expiry_unit_count, + reset_type=reset_type, + request_options=request_options, + ) + return _response.data + + def update_billing_plan_credit_grant( + self, + plan_grant_id: str, + *, + reset_cadence: UpdateBillingPlanCreditGrantRequestBodyResetCadence, + reset_start: UpdateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, + expiry_unit: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + reset_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateBillingPlanCreditGrantResponse: + """ + Parameters + ---------- + plan_grant_id : str + plan_grant_id + + reset_cadence : UpdateBillingPlanCreditGrantRequestBodyResetCadence + + reset_start : UpdateBillingPlanCreditGrantRequestBodyResetStart + + apply_to_existing : typing.Optional[bool] + + credit_amount : typing.Optional[int] + + expiry_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] + + expiry_unit : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + reset_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateBillingPlanCreditGrantResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.update_billing_plan_credit_grant( + plan_grant_id="plan_grant_id", + reset_cadence="monthly", + reset_start="billing_period", + ) + """ + _response = self._raw_client.update_billing_plan_credit_grant( + plan_grant_id, + reset_cadence=reset_cadence, + reset_start=reset_start, + apply_to_existing=apply_to_existing, + credit_amount=credit_amount, expiry_type=expiry_type, expiry_unit=expiry_unit, expiry_unit_count=expiry_unit_count, @@ -1281,7 +1372,11 @@ def create_billing_plan_credit_grant( return _response.data def delete_billing_plan_credit_grant( - self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + plan_grant_id: str, + *, + apply_to_existing: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> DeleteBillingPlanCreditGrantResponse: """ Parameters @@ -1289,6 +1384,8 @@ def delete_billing_plan_credit_grant( plan_grant_id : str plan_grant_id + apply_to_existing : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1306,9 +1403,12 @@ def delete_billing_plan_credit_grant( ) client.credits.delete_billing_plan_credit_grant( plan_grant_id="plan_grant_id", + apply_to_existing=True, ) """ - _response = self._raw_client.delete_billing_plan_credit_grant(plan_grant_id, request_options=request_options) + _response = self._raw_client.delete_billing_plan_credit_grant( + plan_grant_id, apply_to_existing=apply_to_existing, request_options=request_options + ) return _response.data def count_billing_plan_credit_grants( @@ -2677,6 +2777,7 @@ async def create_billing_plan_credit_grant( plan_id: str, reset_cadence: CreateBillingPlanCreditGrantRequestBodyResetCadence, reset_start: CreateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, expiry_type: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, expiry_unit: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, expiry_unit_count: typing.Optional[int] = OMIT, @@ -2696,6 +2797,8 @@ async def create_billing_plan_credit_grant( reset_start : CreateBillingPlanCreditGrantRequestBodyResetStart + apply_to_existing : typing.Optional[bool] + expiry_type : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] expiry_unit : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] @@ -2741,6 +2844,86 @@ async def main() -> None: plan_id=plan_id, reset_cadence=reset_cadence, reset_start=reset_start, + apply_to_existing=apply_to_existing, + expiry_type=expiry_type, + expiry_unit=expiry_unit, + expiry_unit_count=expiry_unit_count, + reset_type=reset_type, + request_options=request_options, + ) + return _response.data + + async def update_billing_plan_credit_grant( + self, + plan_grant_id: str, + *, + reset_cadence: UpdateBillingPlanCreditGrantRequestBodyResetCadence, + reset_start: UpdateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, + expiry_unit: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + reset_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateBillingPlanCreditGrantResponse: + """ + Parameters + ---------- + plan_grant_id : str + plan_grant_id + + reset_cadence : UpdateBillingPlanCreditGrantRequestBodyResetCadence + + reset_start : UpdateBillingPlanCreditGrantRequestBodyResetStart + + apply_to_existing : typing.Optional[bool] + + credit_amount : typing.Optional[int] + + expiry_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] + + expiry_unit : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + reset_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateBillingPlanCreditGrantResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.update_billing_plan_credit_grant( + plan_grant_id="plan_grant_id", + reset_cadence="monthly", + reset_start="billing_period", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_billing_plan_credit_grant( + plan_grant_id, + reset_cadence=reset_cadence, + reset_start=reset_start, + apply_to_existing=apply_to_existing, + credit_amount=credit_amount, expiry_type=expiry_type, expiry_unit=expiry_unit, expiry_unit_count=expiry_unit_count, @@ -2750,7 +2933,11 @@ async def main() -> None: return _response.data async def delete_billing_plan_credit_grant( - self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + plan_grant_id: str, + *, + apply_to_existing: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> DeleteBillingPlanCreditGrantResponse: """ Parameters @@ -2758,6 +2945,8 @@ async def delete_billing_plan_credit_grant( plan_grant_id : str plan_grant_id + apply_to_existing : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2780,13 +2969,14 @@ async def delete_billing_plan_credit_grant( async def main() -> None: await client.credits.delete_billing_plan_credit_grant( plan_grant_id="plan_grant_id", + apply_to_existing=True, ) asyncio.run(main()) """ _response = await self._raw_client.delete_billing_plan_credit_grant( - plan_grant_id, request_options=request_options + plan_grant_id, apply_to_existing=apply_to_existing, request_options=request_options ) return _response.data diff --git a/src/schematic/credits/raw_client.py b/src/schematic/credits/raw_client.py index a5fb170..33d5b75 100644 --- a/src/schematic/credits/raw_client.py +++ b/src/schematic/credits/raw_client.py @@ -71,6 +71,22 @@ UpdateBillingCreditRequestBodyDefaultRolloverPolicy, ) from .types.update_billing_credit_response import UpdateBillingCreditResponse +from .types.update_billing_plan_credit_grant_request_body_expiry_type import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryType, +) +from .types.update_billing_plan_credit_grant_request_body_expiry_unit import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit, +) +from .types.update_billing_plan_credit_grant_request_body_reset_cadence import ( + UpdateBillingPlanCreditGrantRequestBodyResetCadence, +) +from .types.update_billing_plan_credit_grant_request_body_reset_start import ( + UpdateBillingPlanCreditGrantRequestBodyResetStart, +) +from .types.update_billing_plan_credit_grant_request_body_reset_type import ( + UpdateBillingPlanCreditGrantRequestBodyResetType, +) +from .types.update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .types.update_credit_bundle_details_request_body_expiry_type import UpdateCreditBundleDetailsRequestBodyExpiryType from .types.update_credit_bundle_details_request_body_expiry_unit import UpdateCreditBundleDetailsRequestBodyExpiryUnit from .types.update_credit_bundle_details_request_body_status import UpdateCreditBundleDetailsRequestBodyStatus @@ -2492,6 +2508,7 @@ def create_billing_plan_credit_grant( plan_id: str, reset_cadence: CreateBillingPlanCreditGrantRequestBodyResetCadence, reset_start: CreateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, expiry_type: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, expiry_unit: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, expiry_unit_count: typing.Optional[int] = OMIT, @@ -2511,6 +2528,8 @@ def create_billing_plan_credit_grant( reset_start : CreateBillingPlanCreditGrantRequestBodyResetStart + apply_to_existing : typing.Optional[bool] + expiry_type : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] expiry_unit : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] @@ -2531,6 +2550,7 @@ def create_billing_plan_credit_grant( "billing/credits/plan-grants", method="POST", json={ + "apply_to_existing": apply_to_existing, "credit_amount": credit_amount, "credit_id": credit_id, "expiry_type": expiry_type, @@ -2621,8 +2641,149 @@ def create_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def update_billing_plan_credit_grant( + self, + plan_grant_id: str, + *, + reset_cadence: UpdateBillingPlanCreditGrantRequestBodyResetCadence, + reset_start: UpdateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, + expiry_unit: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + reset_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UpdateBillingPlanCreditGrantResponse]: + """ + Parameters + ---------- + plan_grant_id : str + plan_grant_id + + reset_cadence : UpdateBillingPlanCreditGrantRequestBodyResetCadence + + reset_start : UpdateBillingPlanCreditGrantRequestBodyResetStart + + apply_to_existing : typing.Optional[bool] + + credit_amount : typing.Optional[int] + + expiry_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] + + expiry_unit : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + reset_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UpdateBillingPlanCreditGrantResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"billing/credits/plan-grants/{jsonable_encoder(plan_grant_id)}", + method="PUT", + json={ + "apply_to_existing": apply_to_existing, + "credit_amount": credit_amount, + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "reset_cadence": reset_cadence, + "reset_start": reset_start, + "reset_type": reset_type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateBillingPlanCreditGrantResponse, + parse_obj_as( + type_=UpdateBillingPlanCreditGrantResponse, # 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 + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + def delete_billing_plan_credit_grant( - self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + plan_grant_id: str, + *, + apply_to_existing: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DeleteBillingPlanCreditGrantResponse]: """ Parameters @@ -2630,6 +2791,8 @@ def delete_billing_plan_credit_grant( plan_grant_id : str plan_grant_id + apply_to_existing : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2641,6 +2804,9 @@ def delete_billing_plan_credit_grant( _response = self._client_wrapper.httpx_client.request( f"billing/credits/plan-grants/{jsonable_encoder(plan_grant_id)}", method="DELETE", + params={ + "apply_to_existing": apply_to_existing, + }, request_options=request_options, ) try: @@ -5251,6 +5417,7 @@ async def create_billing_plan_credit_grant( plan_id: str, reset_cadence: CreateBillingPlanCreditGrantRequestBodyResetCadence, reset_start: CreateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, expiry_type: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, expiry_unit: typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, expiry_unit_count: typing.Optional[int] = OMIT, @@ -5270,6 +5437,8 @@ async def create_billing_plan_credit_grant( reset_start : CreateBillingPlanCreditGrantRequestBodyResetStart + apply_to_existing : typing.Optional[bool] + expiry_type : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryType] expiry_unit : typing.Optional[CreateBillingPlanCreditGrantRequestBodyExpiryUnit] @@ -5290,6 +5459,7 @@ async def create_billing_plan_credit_grant( "billing/credits/plan-grants", method="POST", json={ + "apply_to_existing": apply_to_existing, "credit_amount": credit_amount, "credit_id": credit_id, "expiry_type": expiry_type, @@ -5380,8 +5550,149 @@ async def create_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + async def update_billing_plan_credit_grant( + self, + plan_grant_id: str, + *, + reset_cadence: UpdateBillingPlanCreditGrantRequestBodyResetCadence, + reset_start: UpdateBillingPlanCreditGrantRequestBodyResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] = OMIT, + expiry_unit: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + reset_type: typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse]: + """ + Parameters + ---------- + plan_grant_id : str + plan_grant_id + + reset_cadence : UpdateBillingPlanCreditGrantRequestBodyResetCadence + + reset_start : UpdateBillingPlanCreditGrantRequestBodyResetStart + + apply_to_existing : typing.Optional[bool] + + credit_amount : typing.Optional[int] + + expiry_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryType] + + expiry_unit : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + reset_type : typing.Optional[UpdateBillingPlanCreditGrantRequestBodyResetType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/plan-grants/{jsonable_encoder(plan_grant_id)}", + method="PUT", + json={ + "apply_to_existing": apply_to_existing, + "credit_amount": credit_amount, + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "reset_cadence": reset_cadence, + "reset_start": reset_start, + "reset_type": reset_type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateBillingPlanCreditGrantResponse, + parse_obj_as( + type_=UpdateBillingPlanCreditGrantResponse, # 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 + ) + raise core_api_error_ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response_json + ) + async def delete_billing_plan_credit_grant( - self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None + self, + plan_grant_id: str, + *, + apply_to_existing: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse]: """ Parameters @@ -5389,6 +5700,8 @@ async def delete_billing_plan_credit_grant( plan_grant_id : str plan_grant_id + apply_to_existing : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -5400,6 +5713,9 @@ async def delete_billing_plan_credit_grant( _response = await self._client_wrapper.httpx_client.request( f"billing/credits/plan-grants/{jsonable_encoder(plan_grant_id)}", method="DELETE", + params={ + "apply_to_existing": apply_to_existing, + }, request_options=request_options, ) try: diff --git a/src/schematic/credits/types/__init__.py b/src/schematic/credits/types/__init__.py index 8a66c39..dee552b 100644 --- a/src/schematic/credits/types/__init__.py +++ b/src/schematic/credits/types/__init__.py @@ -47,6 +47,7 @@ from .create_credit_bundle_request_body_expiry_unit import CreateCreditBundleRequestBodyExpiryUnit from .create_credit_bundle_request_body_status import CreateCreditBundleRequestBodyStatus from .create_credit_bundle_response import CreateCreditBundleResponse + from .delete_billing_plan_credit_grant_params import DeleteBillingPlanCreditGrantParams from .delete_billing_plan_credit_grant_response import DeleteBillingPlanCreditGrantResponse from .delete_credit_bundle_response import DeleteCreditBundleResponse from .get_credit_bundle_response import GetCreditBundleResponse @@ -78,6 +79,22 @@ UpdateBillingCreditRequestBodyDefaultRolloverPolicy, ) from .update_billing_credit_response import UpdateBillingCreditResponse + from .update_billing_plan_credit_grant_request_body_expiry_type import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryType, + ) + from .update_billing_plan_credit_grant_request_body_expiry_unit import ( + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit, + ) + from .update_billing_plan_credit_grant_request_body_reset_cadence import ( + UpdateBillingPlanCreditGrantRequestBodyResetCadence, + ) + from .update_billing_plan_credit_grant_request_body_reset_start import ( + UpdateBillingPlanCreditGrantRequestBodyResetStart, + ) + from .update_billing_plan_credit_grant_request_body_reset_type import ( + UpdateBillingPlanCreditGrantRequestBodyResetType, + ) + from .update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .update_credit_bundle_details_request_body_expiry_type import UpdateCreditBundleDetailsRequestBodyExpiryType from .update_credit_bundle_details_request_body_expiry_unit import UpdateCreditBundleDetailsRequestBodyExpiryUnit from .update_credit_bundle_details_request_body_status import UpdateCreditBundleDetailsRequestBodyStatus @@ -114,6 +131,7 @@ "CreateCreditBundleRequestBodyExpiryUnit": ".create_credit_bundle_request_body_expiry_unit", "CreateCreditBundleRequestBodyStatus": ".create_credit_bundle_request_body_status", "CreateCreditBundleResponse": ".create_credit_bundle_response", + "DeleteBillingPlanCreditGrantParams": ".delete_billing_plan_credit_grant_params", "DeleteBillingPlanCreditGrantResponse": ".delete_billing_plan_credit_grant_response", "DeleteCreditBundleResponse": ".delete_credit_bundle_response", "GetCreditBundleResponse": ".get_credit_bundle_response", @@ -143,6 +161,12 @@ "UpdateBillingCreditRequestBodyBurnStrategy": ".update_billing_credit_request_body_burn_strategy", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy": ".update_billing_credit_request_body_default_rollover_policy", "UpdateBillingCreditResponse": ".update_billing_credit_response", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType": ".update_billing_plan_credit_grant_request_body_expiry_type", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit": ".update_billing_plan_credit_grant_request_body_expiry_unit", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence": ".update_billing_plan_credit_grant_request_body_reset_cadence", + "UpdateBillingPlanCreditGrantRequestBodyResetStart": ".update_billing_plan_credit_grant_request_body_reset_start", + "UpdateBillingPlanCreditGrantRequestBodyResetType": ".update_billing_plan_credit_grant_request_body_reset_type", + "UpdateBillingPlanCreditGrantResponse": ".update_billing_plan_credit_grant_response", "UpdateCreditBundleDetailsRequestBodyExpiryType": ".update_credit_bundle_details_request_body_expiry_type", "UpdateCreditBundleDetailsRequestBodyExpiryUnit": ".update_credit_bundle_details_request_body_expiry_unit", "UpdateCreditBundleDetailsRequestBodyStatus": ".update_credit_bundle_details_request_body_status", @@ -203,6 +227,7 @@ def __dir__(): "CreateCreditBundleRequestBodyExpiryUnit", "CreateCreditBundleRequestBodyStatus", "CreateCreditBundleResponse", + "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", "DeleteCreditBundleResponse", "GetCreditBundleResponse", @@ -232,6 +257,12 @@ def __dir__(): "UpdateBillingCreditRequestBodyBurnStrategy", "UpdateBillingCreditRequestBodyDefaultRolloverPolicy", "UpdateBillingCreditResponse", + "UpdateBillingPlanCreditGrantRequestBodyExpiryType", + "UpdateBillingPlanCreditGrantRequestBodyExpiryUnit", + "UpdateBillingPlanCreditGrantRequestBodyResetCadence", + "UpdateBillingPlanCreditGrantRequestBodyResetStart", + "UpdateBillingPlanCreditGrantRequestBodyResetType", + "UpdateBillingPlanCreditGrantResponse", "UpdateCreditBundleDetailsRequestBodyExpiryType", "UpdateCreditBundleDetailsRequestBodyExpiryUnit", "UpdateCreditBundleDetailsRequestBodyStatus", diff --git a/src/schematic/credits/types/delete_billing_plan_credit_grant_params.py b/src/schematic/credits/types/delete_billing_plan_credit_grant_params.py new file mode 100644 index 0000000..c782540 --- /dev/null +++ b/src/schematic/credits/types/delete_billing_plan_credit_grant_params.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class DeleteBillingPlanCreditGrantParams(UniversalBaseModel): + """ + Input parameters + """ + + apply_to_existing: typing.Optional[bool] = 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/delete_billing_plan_credit_grant_response.py b/src/schematic/credits/types/delete_billing_plan_credit_grant_response.py index e7a987c..58649e3 100644 --- a/src/schematic/credits/types/delete_billing_plan_credit_grant_response.py +++ b/src/schematic/credits/types/delete_billing_plan_credit_grant_response.py @@ -5,11 +5,12 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.delete_response import DeleteResponse +from .delete_billing_plan_credit_grant_params import DeleteBillingPlanCreditGrantParams class DeleteBillingPlanCreditGrantResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: DeleteBillingPlanCreditGrantParams = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_type.py b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_type.py new file mode 100644 index 0000000..45e9ac8 --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateBillingPlanCreditGrantRequestBodyExpiryType = typing.Union[ + typing.Literal["duration", "no_expiry", "end_of_trial", "end_of_billing_period", "end_of_next_billing_period"], + typing.Any, +] diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_unit.py b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_unit.py new file mode 100644 index 0000000..c11f80a --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_expiry_unit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateBillingPlanCreditGrantRequestBodyExpiryUnit = typing.Union[typing.Literal["days", "billing_periods"], typing.Any] diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_cadence.py b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_cadence.py new file mode 100644 index 0000000..8a460c2 --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_cadence.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateBillingPlanCreditGrantRequestBodyResetCadence = typing.Union[ + typing.Literal["monthly", "yearly", "daily", "weekly"], typing.Any +] diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_start.py b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_start.py new file mode 100644 index 0000000..ff5e8e0 --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_start.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateBillingPlanCreditGrantRequestBodyResetStart = typing.Union[ + typing.Literal["billing_period", "first_of_month"], typing.Any +] diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_type.py b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_type.py new file mode 100644 index 0000000..637064b --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_request_body_reset_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateBillingPlanCreditGrantRequestBodyResetType = typing.Union[typing.Literal["plan_period", "no_reset"], typing.Any] diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_response.py b/src/schematic/credits/types/update_billing_plan_credit_grant_response.py new file mode 100644 index 0000000..3f0fda2 --- /dev/null +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_response.py @@ -0,0 +1,24 @@ +# 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.billing_plan_credit_grant_response_data import BillingPlanCreditGrantResponseData + + +class UpdateBillingPlanCreditGrantResponse(UniversalBaseModel): + data: BillingPlanCreditGrantResponseData + params: typing.Dict[str, typing.Optional[typing.Any]] = 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/types/__init__.py b/src/schematic/types/__init__.py index a0b6df6..eb3a6f4 100644 --- a/src/schematic/types/__init__.py +++ b/src/schematic/types/__init__.py @@ -65,7 +65,11 @@ from .component_preview_response_data import ComponentPreviewResponseData from .component_response_data import ComponentResponseData from .condition import Condition + from .condition_condition_type import ConditionConditionType from .condition_group import ConditionGroup + from .condition_metric_period import ConditionMetricPeriod + from .condition_metric_period_month_reset import ConditionMetricPeriodMonthReset + from .condition_operator import ConditionOperator from .count_response import CountResponse from .coupon_request_body import CouponRequestBody from .create_billing_price_tier_request_body import CreateBillingPriceTierRequestBody @@ -94,6 +98,12 @@ from .credit_company_grant_view import CreditCompanyGrantView from .credit_grant_detail import CreditGrantDetail from .credit_grant_detail_grant_reason import CreditGrantDetailGrantReason + from .credit_grant_expiry_request_body import CreditGrantExpiryRequestBody + from .credit_grant_expiry_request_body_expiry_type import CreditGrantExpiryRequestBodyExpiryType + from .credit_grant_expiry_request_body_expiry_unit import CreditGrantExpiryRequestBodyExpiryUnit + from .credit_grant_expiry_request_body_reset_cadence import CreditGrantExpiryRequestBodyResetCadence + from .credit_grant_expiry_request_body_reset_start import CreditGrantExpiryRequestBodyResetStart + from .credit_grant_expiry_request_body_reset_type import CreditGrantExpiryRequestBodyResetType from .credit_ledger_enriched_entry_response_data import CreditLedgerEnrichedEntryResponseData from .credit_trigger_config import CreditTriggerConfig from .credit_usage import CreditUsage @@ -187,12 +197,15 @@ from .rule_condition_response_data import RuleConditionResponseData from .rule_detail_response_data import RuleDetailResponseData from .rule_response_data import RuleResponseData + from .rule_rule_type import RuleRuleType from .rules_detail_response_data import RulesDetailResponseData from .segment_status_resp import SegmentStatusResp from .stripe_embed_info import StripeEmbedInfo from .subscription_trait_update import SubscriptionTraitUpdate from .temporary_access_token_response_data import TemporaryAccessTokenResponseData from .trait_definition import TraitDefinition + from .trait_definition_comparable_type import TraitDefinitionComparableType + from .trait_definition_entity_type import TraitDefinitionEntityType from .update_add_on_request_body import UpdateAddOnRequestBody from .update_credit_bundle_request_body import UpdateCreditBundleRequestBody from .update_entitlement_req_common import UpdateEntitlementReqCommon @@ -276,7 +289,11 @@ "ComponentPreviewResponseData": ".component_preview_response_data", "ComponentResponseData": ".component_response_data", "Condition": ".condition", + "ConditionConditionType": ".condition_condition_type", "ConditionGroup": ".condition_group", + "ConditionMetricPeriod": ".condition_metric_period", + "ConditionMetricPeriodMonthReset": ".condition_metric_period_month_reset", + "ConditionOperator": ".condition_operator", "CountResponse": ".count_response", "CouponRequestBody": ".coupon_request_body", "CreateBillingPriceTierRequestBody": ".create_billing_price_tier_request_body", @@ -301,6 +318,12 @@ "CreditCompanyGrantView": ".credit_company_grant_view", "CreditGrantDetail": ".credit_grant_detail", "CreditGrantDetailGrantReason": ".credit_grant_detail_grant_reason", + "CreditGrantExpiryRequestBody": ".credit_grant_expiry_request_body", + "CreditGrantExpiryRequestBodyExpiryType": ".credit_grant_expiry_request_body_expiry_type", + "CreditGrantExpiryRequestBodyExpiryUnit": ".credit_grant_expiry_request_body_expiry_unit", + "CreditGrantExpiryRequestBodyResetCadence": ".credit_grant_expiry_request_body_reset_cadence", + "CreditGrantExpiryRequestBodyResetStart": ".credit_grant_expiry_request_body_reset_start", + "CreditGrantExpiryRequestBodyResetType": ".credit_grant_expiry_request_body_reset_type", "CreditLedgerEnrichedEntryResponseData": ".credit_ledger_enriched_entry_response_data", "CreditTriggerConfig": ".credit_trigger_config", "CreditUsage": ".credit_usage", @@ -394,12 +417,15 @@ "RuleConditionResponseData": ".rule_condition_response_data", "RuleDetailResponseData": ".rule_detail_response_data", "RuleResponseData": ".rule_response_data", + "RuleRuleType": ".rule_rule_type", "RulesDetailResponseData": ".rules_detail_response_data", "SegmentStatusResp": ".segment_status_resp", "StripeEmbedInfo": ".stripe_embed_info", "SubscriptionTraitUpdate": ".subscription_trait_update", "TemporaryAccessTokenResponseData": ".temporary_access_token_response_data", "TraitDefinition": ".trait_definition", + "TraitDefinitionComparableType": ".trait_definition_comparable_type", + "TraitDefinitionEntityType": ".trait_definition_entity_type", "UpdateAddOnRequestBody": ".update_add_on_request_body", "UpdateCreditBundleRequestBody": ".update_credit_bundle_request_body", "UpdateEntitlementReqCommon": ".update_entitlement_req_common", @@ -505,7 +531,11 @@ def __dir__(): "ComponentPreviewResponseData", "ComponentResponseData", "Condition", + "ConditionConditionType", "ConditionGroup", + "ConditionMetricPeriod", + "ConditionMetricPeriodMonthReset", + "ConditionOperator", "CountResponse", "CouponRequestBody", "CreateBillingPriceTierRequestBody", @@ -530,6 +560,12 @@ def __dir__(): "CreditCompanyGrantView", "CreditGrantDetail", "CreditGrantDetailGrantReason", + "CreditGrantExpiryRequestBody", + "CreditGrantExpiryRequestBodyExpiryType", + "CreditGrantExpiryRequestBodyExpiryUnit", + "CreditGrantExpiryRequestBodyResetCadence", + "CreditGrantExpiryRequestBodyResetStart", + "CreditGrantExpiryRequestBodyResetType", "CreditLedgerEnrichedEntryResponseData", "CreditTriggerConfig", "CreditUsage", @@ -623,12 +659,15 @@ def __dir__(): "RuleConditionResponseData", "RuleDetailResponseData", "RuleResponseData", + "RuleRuleType", "RulesDetailResponseData", "SegmentStatusResp", "StripeEmbedInfo", "SubscriptionTraitUpdate", "TemporaryAccessTokenResponseData", "TraitDefinition", + "TraitDefinitionComparableType", + "TraitDefinitionEntityType", "UpdateAddOnRequestBody", "UpdateCreditBundleRequestBody", "UpdateEntitlementReqCommon", diff --git a/src/schematic/types/condition.py b/src/schematic/types/condition.py index ebb2e84..45063ad 100644 --- a/src/schematic/types/condition.py +++ b/src/schematic/types/condition.py @@ -4,22 +4,26 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .condition_condition_type import ConditionConditionType +from .condition_metric_period import ConditionMetricPeriod +from .condition_metric_period_month_reset import ConditionMetricPeriodMonthReset +from .condition_operator import ConditionOperator from .trait_definition import TraitDefinition class Condition(UniversalBaseModel): account_id: str comparison_trait_definition: typing.Optional[TraitDefinition] = None - condition_type: str + condition_type: ConditionConditionType consumption_rate: typing.Optional[float] = None credit_id: typing.Optional[str] = None environment_id: str event_subtype: typing.Optional[str] = None id: str - metric_period: typing.Optional[str] = None - metric_period_month_reset: typing.Optional[str] = None + metric_period: typing.Optional[ConditionMetricPeriod] = None + metric_period_month_reset: typing.Optional[ConditionMetricPeriodMonthReset] = None metric_value: typing.Optional[int] = None - operator: str + operator: ConditionOperator resource_ids: typing.List[str] trait_definition: typing.Optional[TraitDefinition] = None trait_value: str diff --git a/src/schematic/types/condition_condition_type.py b/src/schematic/types/condition_condition_type.py new file mode 100644 index 0000000..6297d7c --- /dev/null +++ b/src/schematic/types/condition_condition_type.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConditionConditionType = typing.Union[ + typing.Literal[ + "base_plan", "billing_product", "company", "credit", "crm_product", "metric", "plan", "trait", "user" + ], + typing.Any, +] diff --git a/src/schematic/types/condition_metric_period.py b/src/schematic/types/condition_metric_period.py new file mode 100644 index 0000000..88bba10 --- /dev/null +++ b/src/schematic/types/condition_metric_period.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConditionMetricPeriod = typing.Union[ + typing.Literal["all_time", "current_day", "current_month", "current_week"], typing.Any +] diff --git a/src/schematic/types/condition_metric_period_month_reset.py b/src/schematic/types/condition_metric_period_month_reset.py new file mode 100644 index 0000000..e3b36f3 --- /dev/null +++ b/src/schematic/types/condition_metric_period_month_reset.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConditionMetricPeriodMonthReset = typing.Union[typing.Literal["first_of_month", "billing_cycle"], typing.Any] diff --git a/src/schematic/types/condition_operator.py b/src/schematic/types/condition_operator.py new file mode 100644 index 0000000..2bddfea --- /dev/null +++ b/src/schematic/types/condition_operator.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConditionOperator = typing.Union[ + typing.Literal["eq", "ne", "gt", "lt", "gte", "lte", "is_empty", "not_empty"], typing.Any +] diff --git a/src/schematic/types/credit_grant_expiry_request_body.py b/src/schematic/types/credit_grant_expiry_request_body.py new file mode 100644 index 0000000..beabf67 --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body.py @@ -0,0 +1,29 @@ +# 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 .credit_grant_expiry_request_body_expiry_type import CreditGrantExpiryRequestBodyExpiryType +from .credit_grant_expiry_request_body_expiry_unit import CreditGrantExpiryRequestBodyExpiryUnit +from .credit_grant_expiry_request_body_reset_cadence import CreditGrantExpiryRequestBodyResetCadence +from .credit_grant_expiry_request_body_reset_start import CreditGrantExpiryRequestBodyResetStart +from .credit_grant_expiry_request_body_reset_type import CreditGrantExpiryRequestBodyResetType + + +class CreditGrantExpiryRequestBody(UniversalBaseModel): + expiry_type: typing.Optional[CreditGrantExpiryRequestBodyExpiryType] = None + expiry_unit: typing.Optional[CreditGrantExpiryRequestBodyExpiryUnit] = None + expiry_unit_count: typing.Optional[int] = None + reset_cadence: CreditGrantExpiryRequestBodyResetCadence + reset_start: CreditGrantExpiryRequestBodyResetStart + reset_type: typing.Optional[CreditGrantExpiryRequestBodyResetType] = 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/types/credit_grant_expiry_request_body_expiry_type.py b/src/schematic/types/credit_grant_expiry_request_body_expiry_type.py new file mode 100644 index 0000000..eff235a --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body_expiry_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditGrantExpiryRequestBodyExpiryType = typing.Union[ + typing.Literal["duration", "no_expiry", "end_of_trial", "end_of_billing_period", "end_of_next_billing_period"], + typing.Any, +] diff --git a/src/schematic/types/credit_grant_expiry_request_body_expiry_unit.py b/src/schematic/types/credit_grant_expiry_request_body_expiry_unit.py new file mode 100644 index 0000000..d14f22b --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body_expiry_unit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditGrantExpiryRequestBodyExpiryUnit = typing.Union[typing.Literal["days", "billing_periods"], typing.Any] diff --git a/src/schematic/types/credit_grant_expiry_request_body_reset_cadence.py b/src/schematic/types/credit_grant_expiry_request_body_reset_cadence.py new file mode 100644 index 0000000..8678e02 --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body_reset_cadence.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditGrantExpiryRequestBodyResetCadence = typing.Union[ + typing.Literal["monthly", "yearly", "daily", "weekly"], typing.Any +] diff --git a/src/schematic/types/credit_grant_expiry_request_body_reset_start.py b/src/schematic/types/credit_grant_expiry_request_body_reset_start.py new file mode 100644 index 0000000..35ab912 --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body_reset_start.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditGrantExpiryRequestBodyResetStart = typing.Union[typing.Literal["billing_period", "first_of_month"], typing.Any] diff --git a/src/schematic/types/credit_grant_expiry_request_body_reset_type.py b/src/schematic/types/credit_grant_expiry_request_body_reset_type.py new file mode 100644 index 0000000..fa4388e --- /dev/null +++ b/src/schematic/types/credit_grant_expiry_request_body_reset_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditGrantExpiryRequestBodyResetType = typing.Union[typing.Literal["plan_period", "no_reset"], typing.Any] diff --git a/src/schematic/types/plan_change_response_data_action.py b/src/schematic/types/plan_change_response_data_action.py index d3df40b..b90cac9 100644 --- a/src/schematic/types/plan_change_response_data_action.py +++ b/src/schematic/types/plan_change_response_data_action.py @@ -8,6 +8,7 @@ "company_upsert", "fallback_plan", "manage_plan", + "migration", "plan_billing_product_changed", "plan_deleted", "quickstart", diff --git a/src/schematic/types/rule.py b/src/schematic/types/rule.py index 1a245cc..86338f6 100644 --- a/src/schematic/types/rule.py +++ b/src/schematic/types/rule.py @@ -6,6 +6,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .condition import Condition from .condition_group import ConditionGroup +from .rule_rule_type import RuleRuleType class Rule(UniversalBaseModel): @@ -17,7 +18,7 @@ class Rule(UniversalBaseModel): id: str name: str priority: int - rule_type: str + rule_type: RuleRuleType value: bool if IS_PYDANTIC_V2: diff --git a/src/schematic/types/rule_rule_type.py b/src/schematic/types/rule_rule_type.py new file mode 100644 index 0000000..baf7831 --- /dev/null +++ b/src/schematic/types/rule_rule_type.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RuleRuleType = typing.Union[ + typing.Literal[ + "default", + "global_override", + "company_override", + "company_override_usage_exceeded", + "plan_entitlement", + "plan_entitlement_usage_exceeded", + "standard", + ], + typing.Any, +] diff --git a/src/schematic/types/trait_definition.py b/src/schematic/types/trait_definition.py index 3eb3f11..c6524a9 100644 --- a/src/schematic/types/trait_definition.py +++ b/src/schematic/types/trait_definition.py @@ -4,11 +4,13 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .trait_definition_comparable_type import TraitDefinitionComparableType +from .trait_definition_entity_type import TraitDefinitionEntityType class TraitDefinition(UniversalBaseModel): - comparable_type: str - entity_type: str + comparable_type: TraitDefinitionComparableType + entity_type: TraitDefinitionEntityType id: str if IS_PYDANTIC_V2: diff --git a/src/schematic/types/trait_definition_comparable_type.py b/src/schematic/types/trait_definition_comparable_type.py new file mode 100644 index 0000000..36abf2c --- /dev/null +++ b/src/schematic/types/trait_definition_comparable_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TraitDefinitionComparableType = typing.Union[typing.Literal["bool", "date", "int", "string"], typing.Any] diff --git a/src/schematic/types/trait_definition_entity_type.py b/src/schematic/types/trait_definition_entity_type.py new file mode 100644 index 0000000..08718f9 --- /dev/null +++ b/src/schematic/types/trait_definition_entity_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TraitDefinitionEntityType = typing.Union[typing.Literal["user", "company"], typing.Any]