diff --git a/.fern/metadata.json b/.fern/metadata.json index 24e1159..79dc702 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "5.29.2", + "generatorVersion": "5.29.3", "generatorConfig": { "inline_request_params": true, "client": { @@ -23,7 +23,7 @@ } ] }, - "originGitCommit": "686551a0297d2f37075b3586b030ff32be5c94f7", + "originGitCommit": "31f498c0a9babdc0eec5ae88e1212a254b2f2561", "originGitCommitIsDirty": false, "invokedBy": "ci", "requestedVersion": "1.3.5", diff --git a/.fern/replay.lock b/.fern/replay.lock index 84ce67f..d0b3f5a 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -48,5 +48,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-python-sdk: 5.29.2 -current_generation: 308f5addafebb8bdbc3829e694b5f3e051580ee4 + - commit_sha: 071999bbc19019254b4bc41a10298b760e45681f + tree_hash: 785cabfd572f658199eed7df4969a807c68c0ea3 + timestamp: 2026-09-05T06:37:45.397Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 5.29.3 +current_generation: 071999bbc19019254b4bc41a10298b760e45681f patches: [] diff --git a/poetry.lock b/poetry.lock index 95f01a6..416786d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -188,20 +188,20 @@ files = [ [[package]] name = "anyio" -version = "4.14.2" +version = "4.15.0" description = "High-level concurrency and networking framework on top of asyncio or Trio" optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494"}, - {file = "anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f"}, + {file = "anyio-4.15.0-py3-none-any.whl", hash = "sha256:7ecd9937369ffce8bba0b5ccb9b3a9507b101b0ed50256aecfbab27e6c2acb99"}, + {file = "anyio-4.15.0.tar.gz", hash = "sha256:b5c620ed540725e2579c31b17bb995b3bf02c9281c9cace04c7d186380bab85e"}, ] [package.dependencies] exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" -typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} +typing_extensions = {version = ">=4.16.0", markers = "python_version < \"3.15\""} [package.extras] trio = ["trio (>=0.32.0)"] diff --git a/reference.md b/reference.md index 797fb24..2b55be2 100644 --- a/reference.md +++ b/reference.md @@ -1479,6 +1479,14 @@ client.accounts.update_onboarding_state()
+**country:** `typing.Optional[str]` + +
+
+ +
+
+ **dismissed:** `typing.Optional[bool]`
@@ -4260,6 +4268,209 @@ client.billing.count_billing_products(
+ + + + +
client.billing.list_company_billing_profiles(...) -> ListCompanyBillingProfilesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.billing.list_company_billing_profiles( + company_id="company_id", + is_default=True, + provider_type="metronome", + limit=1000000, + offset=1000000, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**is_default:** `typing.Optional[bool]` + +
+
+ +
+
+ +**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ +**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.billing.update_company_billing_profile(...) -> UpdateCompanyBillingProfileResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.billing.update_company_billing_profile( + billing_profile_id="billing_profile_id", + collection_method="charge_automatically", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_profile_id:** `str` — billing_profile_id + +
+
+ +
+
+ +**collection_method:** `BillingCollectionMethod` + +
+
+ +
+
+ +**days_until_due:** `typing.Optional[int]` + +
+
+ +
+
+ +**is_default:** `typing.Optional[bool]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**payment_method_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**proration_behavior:** `typing.Optional[ProrationBehavior]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -7134,7 +7345,7 @@ client.credits.count_billing_plan_credit_grants( -
client.credits.list_credit_event_ledger(...) -> ListCreditEventLedgerResponse +
client.credits.list_credit_spend_policies(...) -> ListCreditSpendPoliciesResponse
@@ -7155,13 +7366,14 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.credits.list_credit_event_ledger( +client.credits.list_credit_spend_policies( billing_credit_id="billing_credit_id", company_id="company_id", - end_time="end_time", - event_type="grant", - feature_id="feature_id", - start_time="start_time", + scope_type="company", + user_id="user_id", + user_ids=[ + "user_ids" + ], limit=1000000, offset=1000000, ) @@ -7180,14 +7392,6 @@ client.credits.list_credit_event_ledger(
-**company_id:** `str` - -
-
- -
-
- **billing_credit_id:** `typing.Optional[str]`
@@ -7196,7 +7400,7 @@ client.credits.list_credit_event_ledger(
-**end_time:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]`
@@ -7204,7 +7408,7 @@ client.credits.list_credit_event_ledger(
-**event_type:** `typing.Optional[CreditEventType]` +**scope_type:** `typing.Optional[CreditSpendPolicyScope]`
@@ -7212,7 +7416,7 @@ client.credits.list_credit_event_ledger(
-**feature_id:** `typing.Optional[str]` +**user_id:** `typing.Optional[str]`
@@ -7220,7 +7424,7 @@ client.credits.list_credit_event_ledger(
-**start_time:** `typing.Optional[str]` +**user_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -7256,7 +7460,7 @@ client.credits.list_credit_event_ledger(
-
client.credits.count_credit_event_ledger(...) -> CountCreditEventLedgerResponse +
client.credits.create_credit_spend_policy(...) -> CreateCreditSpendPolicyResponse
@@ -7277,15 +7481,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.credits.count_credit_event_ledger( +client.credits.create_credit_spend_policy( billing_credit_id="billing_credit_id", - company_id="company_id", - end_time="end_time", - event_type="grant", - feature_id="feature_id", - start_time="start_time", - limit=1000000, - offset=1000000, + max_per_draw=1.1, ) ``` @@ -7302,7 +7500,7 @@ client.credits.count_credit_event_ledger(
-**company_id:** `str` +**billing_credit_id:** `str`
@@ -7310,7 +7508,7 @@ client.credits.count_credit_event_ledger(
-**billing_credit_id:** `typing.Optional[str]` +**max_per_draw:** `float` — The largest number of credits a single draw may spend.
@@ -7318,7 +7516,7 @@ client.credits.count_credit_event_ledger(
-**end_time:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]` — The company the cap applies to. Set exactly one of company_id and user_id.
@@ -7326,7 +7524,7 @@ client.credits.count_credit_event_ledger(
-**event_type:** `typing.Optional[CreditEventType]` +**label:** `typing.Optional[str]`
@@ -7334,7 +7532,7 @@ client.credits.count_credit_event_ledger(
-**feature_id:** `typing.Optional[str]` +**user_id:** `typing.Optional[str]` — The user the cap applies to. Set exactly one of company_id and user_id.
@@ -7342,48 +7540,23 @@ client.credits.count_credit_event_ledger(
-**start_time:** `typing.Optional[str]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**limit:** `typing.Optional[int]` — Page limit (default 100) -
+
+
client.credits.get_credit_spend_policy(...) -> GetCreditSpendPolicyResponse
-**offset:** `typing.Optional[int]` — Page offset (default 0) - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
- - - - - - -
- -## catalogs -
client.catalogs.list_catalogs(...) -> ListCatalogsResponse -
-
- -#### 🔌 Usage +#### 🔌 Usage
@@ -7400,11 +7573,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.list_catalogs( - is_default=True, - q="q", - limit=1000000, - offset=1000000, +client.credits.get_credit_spend_policy( + spend_policy_id="spend_policy_id", ) ``` @@ -7421,31 +7591,7 @@ client.catalogs.list_catalogs(
-**is_default:** `typing.Optional[bool]` - -
-
- -
-
- -**q:** `typing.Optional[str]` — Search by catalog name - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**spend_policy_id:** `str` — spend_policy_id
@@ -7465,7 +7611,7 @@ client.catalogs.list_catalogs(
-
client.catalogs.create_catalog(...) -> CreateCatalogResponse +
client.credits.update_credit_spend_policy(...) -> UpdateCreditSpendPolicyResponse
@@ -7486,8 +7632,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.create_catalog( - name="name", +client.credits.update_credit_spend_policy( + spend_policy_id="spend_policy_id", ) ``` @@ -7504,7 +7650,7 @@ client.catalogs.create_catalog(
-**name:** `str` +**spend_policy_id:** `str` — spend_policy_id
@@ -7512,7 +7658,15 @@ client.catalogs.create_catalog(
-**description:** `typing.Optional[str]` +**label:** `typing.Optional[str]` + +
+
+ +
+
+ +**max_per_draw:** `typing.Optional[float]`
@@ -7532,7 +7686,7 @@ client.catalogs.create_catalog(
-
client.catalogs.get_catalog(...) -> GetCatalogResponse +
client.credits.delete_credit_spend_policy(...) -> DeleteCreditSpendPolicyResponse
@@ -7553,8 +7707,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.get_catalog( - catalog_id="catalog_id", +client.credits.delete_credit_spend_policy( + spend_policy_id="spend_policy_id", ) ``` @@ -7571,7 +7725,7 @@ client.catalogs.get_catalog(
-**catalog_id:** `str` — catalog_id +**spend_policy_id:** `str` — spend_policy_id
@@ -7591,7 +7745,7 @@ client.catalogs.get_catalog(
-
client.catalogs.update_catalog(...) -> UpdateCatalogResponse +
client.credits.count_credit_spend_policies(...) -> CountCreditSpendPoliciesResponse
@@ -7612,8 +7766,16 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.update_catalog( - catalog_id="catalog_id", +client.credits.count_credit_spend_policies( + billing_credit_id="billing_credit_id", + company_id="company_id", + scope_type="company", + user_id="user_id", + user_ids=[ + "user_ids" + ], + limit=1000000, + offset=1000000, ) ``` @@ -7630,7 +7792,7 @@ client.catalogs.update_catalog(
-**catalog_id:** `str` — catalog_id +**billing_credit_id:** `typing.Optional[str]`
@@ -7638,7 +7800,7 @@ client.catalogs.update_catalog(
-**description:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]`
@@ -7646,7 +7808,7 @@ client.catalogs.update_catalog(
-**is_default:** `typing.Optional[bool]` +**scope_type:** `typing.Optional[CreditSpendPolicyScope]`
@@ -7654,7 +7816,31 @@ client.catalogs.update_catalog(
-**name:** `typing.Optional[str]` +**user_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -7674,7 +7860,7 @@ client.catalogs.update_catalog(
-
client.catalogs.delete_catalog(...) -> DeleteCatalogResponse +
client.credits.list_credit_event_ledger(...) -> ListCreditEventLedgerResponse
@@ -7695,8 +7881,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.delete_catalog( - catalog_id="catalog_id", +client.credits.list_credit_event_ledger( + billing_credit_id="billing_credit_id", + company_id="company_id", + end_time="end_time", + event_type="grant", + feature_id="feature_id", + start_time="start_time", + limit=1000000, + offset=1000000, ) ``` @@ -7713,7 +7906,7 @@ client.catalogs.delete_catalog(
-**catalog_id:** `str` — catalog_id +**company_id:** `str`
@@ -7721,58 +7914,55 @@ client.catalogs.delete_catalog(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**billing_credit_id:** `typing.Optional[str]`
-
-
+
+
+**end_time:** `typing.Optional[str]` +
-
-
client.catalogs.get_configuration(...) -> GetConfigurationResponse
-#### 🔌 Usage +**event_type:** `typing.Optional[CreditEventType]` + +
+
+**feature_id:** `typing.Optional[str]` + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.catalogs.get_configuration( - catalog_id="catalog_id", -) - -``` -
-
+**start_time:** `typing.Optional[str]` + -#### ⚙️ Parameters -
+**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+
-**catalog_id:** `str` — catalog_id +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -7792,7 +7982,7 @@ client.catalogs.get_configuration(
-
client.catalogs.update_configuration(...) -> UpdateConfigurationResponse +
client.credits.count_credit_event_ledger(...) -> CountCreditEventLedgerResponse
@@ -7813,8 +8003,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.update_configuration( - catalog_id="catalog_id", +client.credits.count_credit_event_ledger( + billing_credit_id="billing_credit_id", + company_id="company_id", + end_time="end_time", + event_type="grant", + feature_id="feature_id", + start_time="start_time", + limit=1000000, + offset=1000000, ) ``` @@ -7831,23 +8028,7 @@ client.catalogs.update_configuration(
-**catalog_id:** `str` — catalog_id - -
-
- -
-
- -**custom_plan_cta_text:** `typing.Optional[str]` - -
-
- -
-
- -**custom_plan_cta_url:** `typing.Optional[str]` +**company_id:** `str`
@@ -7855,7 +8036,7 @@ client.catalogs.update_configuration(
-**custom_plan_price_text:** `typing.Optional[str]` +**billing_credit_id:** `typing.Optional[str]`
@@ -7863,7 +8044,7 @@ client.catalogs.update_configuration(
-**custom_plans_visible:** `typing.Optional[bool]` +**end_time:** `typing.Optional[str]`
@@ -7871,7 +8052,7 @@ client.catalogs.update_configuration(
-**ordered_add_ons:** `typing.Optional[typing.List[CatalogConfigOrderedPlan]]` +**event_type:** `typing.Optional[CreditEventType]`
@@ -7879,7 +8060,7 @@ client.catalogs.update_configuration(
-**ordered_bundles:** `typing.Optional[typing.List[CatalogConfigOrderedBundle]]` +**feature_id:** `typing.Optional[str]`
@@ -7887,7 +8068,7 @@ client.catalogs.update_configuration(
-**ordered_plans:** `typing.Optional[typing.List[CatalogConfigOrderedPlan]]` +**start_time:** `typing.Optional[str]`
@@ -7895,7 +8076,7 @@ client.catalogs.update_configuration(
-**pricing_model:** `typing.Optional[str]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -7903,7 +8084,7 @@ client.catalogs.update_configuration(
-**pricing_url:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -7923,7 +8104,8 @@ client.catalogs.update_configuration(
-
client.catalogs.get_credit_bundles_in_catalog(...) -> GetCreditBundlesInCatalogResponse +## catalogs +
client.catalogs.list_catalogs(...) -> ListCatalogsResponse
@@ -7944,8 +8126,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.get_credit_bundles_in_catalog( - catalog_id="catalog_id", +client.catalogs.list_catalogs( + is_default=True, + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -7962,7 +8147,31 @@ client.catalogs.get_credit_bundles_in_catalog(
-**catalog_id:** `str` — catalog_id +**is_default:** `typing.Optional[bool]` + +
+
+ +
+
+ +**q:** `typing.Optional[str]` — Search by catalog name + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -7982,7 +8191,7 @@ client.catalogs.get_credit_bundles_in_catalog(
-
client.catalogs.add_credit_bundle(...) +
client.catalogs.create_catalog(...) -> CreateCatalogResponse
@@ -8003,9 +8212,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.add_credit_bundle( - catalog_id="catalog_id", - credit_bundle_id="credit_bundle_id", +client.catalogs.create_catalog( + name="name", ) ``` @@ -8022,7 +8230,7 @@ client.catalogs.add_credit_bundle(
-**catalog_id:** `str` — catalog_id +**name:** `str`
@@ -8030,7 +8238,7 @@ client.catalogs.add_credit_bundle(
-**credit_bundle_id:** `str` — credit_bundle_id +**description:** `typing.Optional[str]`
@@ -8050,7 +8258,7 @@ client.catalogs.add_credit_bundle(
-
client.catalogs.remove_credit_bundle(...) +
client.catalogs.get_catalog(...) -> GetCatalogResponse
@@ -8071,9 +8279,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.remove_credit_bundle( +client.catalogs.get_catalog( catalog_id="catalog_id", - credit_bundle_id="credit_bundle_id", ) ``` @@ -8098,14 +8305,6 @@ client.catalogs.remove_credit_bundle(
-**credit_bundle_id:** `str` — credit_bundle_id - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -8118,7 +8317,7 @@ client.catalogs.remove_credit_bundle(
-
client.catalogs.get_derived_features(...) -> GetDerivedFeaturesResponse +
client.catalogs.update_catalog(...) -> UpdateCatalogResponse
@@ -8139,7 +8338,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.get_derived_features( +client.catalogs.update_catalog( catalog_id="catalog_id", ) @@ -8165,6 +8364,30 @@ client.catalogs.get_derived_features(
+**description:** `typing.Optional[str]` + +
+
+ +
+
+ +**is_default:** `typing.Optional[bool]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -8177,7 +8400,7 @@ client.catalogs.get_derived_features(
-
client.catalogs.get_plans_in_catalog(...) -> GetPlansInCatalogResponse +
client.catalogs.delete_catalog(...) -> DeleteCatalogResponse
@@ -8198,7 +8421,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.get_plans_in_catalog( +client.catalogs.delete_catalog( catalog_id="catalog_id", ) @@ -8236,7 +8459,7 @@ client.catalogs.get_plans_in_catalog(
-
client.catalogs.add_plan(...) +
client.catalogs.get_configuration(...) -> GetConfigurationResponse
@@ -8257,9 +8480,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.add_plan( +client.catalogs.get_configuration( catalog_id="catalog_id", - plan_id="plan_id", ) ``` @@ -8284,14 +8506,6 @@ client.catalogs.add_plan(
-**plan_id:** `str` — plan_id - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -8304,7 +8518,7 @@ client.catalogs.add_plan(
-
client.catalogs.remove_plan(...) +
client.catalogs.update_configuration(...) -> UpdateConfigurationResponse
@@ -8325,9 +8539,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.catalogs.remove_plan( +client.catalogs.update_configuration( catalog_id="catalog_id", - plan_id="plan_id", ) ``` @@ -8352,7 +8565,71 @@ client.catalogs.remove_plan(
-**plan_id:** `str` — plan_id +**custom_plan_cta_text:** `typing.Optional[str]` + +
+
+ +
+
+ +**custom_plan_cta_url:** `typing.Optional[str]` + +
+
+ +
+
+ +**custom_plan_price_text:** `typing.Optional[str]` + +
+
+ +
+
+ +**custom_plans_visible:** `typing.Optional[bool]` + +
+
+ +
+
+ +**ordered_add_ons:** `typing.Optional[typing.List[CatalogConfigOrderedPlan]]` + +
+
+ +
+
+ +**ordered_bundles:** `typing.Optional[typing.List[CatalogConfigOrderedBundle]]` + +
+
+ +
+
+ +**ordered_plans:** `typing.Optional[typing.List[CatalogConfigOrderedPlan]]` + +
+
+ +
+
+ +**pricing_model:** `typing.Optional[str]` + +
+
+ +
+
+ +**pricing_url:** `typing.Optional[str]`
@@ -8372,8 +8649,7 @@ client.catalogs.remove_plan(
-## checkout -
client.checkout.internal(...) -> CheckoutInternalResponse +
client.catalogs.get_credit_bundles_in_catalog(...) -> GetCreditBundlesInCatalogResponse
@@ -8386,7 +8662,7 @@ client.catalogs.remove_plan(
```python -from schematic import Schematic, UpdateAddOnRequestBody, UpdateAutoTopupOverrideRequestBody, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -8394,40 +8670,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.internal( - add_on_ids=[ - UpdateAddOnRequestBody( - add_on_id="add_on_id", - price_id="price_id", - ) - ], - auto_topup_overrides=[ - UpdateAutoTopupOverrideRequestBody( - plan_credit_grant_id="plan_credit_grant_id", - ) - ], - company_id="company_id", - credit_bundles=[ - UpdateCreditBundleRequestBody( - bundle_id="bundle_id", - quantity=1000000, - ) - ], - custom_field_values=[ - CheckoutFieldValue( - id="id", - value="value", - ) - ], - new_plan_id="new_plan_id", - new_price_id="new_price_id", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], - skip_trial=True, +client.catalogs.get_credit_bundles_in_catalog( + catalog_id="catalog_id", ) ``` @@ -8444,7 +8688,7 @@ client.checkout.internal(
-**request:** `ChangeSubscriptionInternalRequestBody` +**catalog_id:** `str` — catalog_id
@@ -8464,7 +8708,7 @@ client.checkout.internal(
-
client.checkout.get_checkout_data(...) -> GetCheckoutDataResponse +
client.catalogs.add_credit_bundle(...)
@@ -8485,8 +8729,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.get_checkout_data( - company_id="company_id", +client.catalogs.add_credit_bundle( + catalog_id="catalog_id", + credit_bundle_id="credit_bundle_id", ) ``` @@ -8503,15 +8748,7 @@ client.checkout.get_checkout_data(
-**company_id:** `str` - -
-
- -
-
- -**currency:** `typing.Optional[str]` +**catalog_id:** `str` — catalog_id
@@ -8519,7 +8756,7 @@ client.checkout.get_checkout_data(
-**selected_plan_id:** `typing.Optional[str]` +**credit_bundle_id:** `str` — credit_bundle_id
@@ -8539,7 +8776,7 @@ client.checkout.get_checkout_data(
-
client.checkout.preview_checkout_internal(...) -> PreviewCheckoutInternalResponse +
client.catalogs.remove_credit_bundle(...)
@@ -8552,7 +8789,7 @@ client.checkout.get_checkout_data(
```python -from schematic import Schematic, UpdateAddOnRequestBody, UpdateAutoTopupOverrideRequestBody, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -8560,40 +8797,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.preview_checkout_internal( - add_on_ids=[ - UpdateAddOnRequestBody( - add_on_id="add_on_id", - price_id="price_id", - ) - ], - auto_topup_overrides=[ - UpdateAutoTopupOverrideRequestBody( - plan_credit_grant_id="plan_credit_grant_id", - ) - ], - company_id="company_id", - credit_bundles=[ - UpdateCreditBundleRequestBody( - bundle_id="bundle_id", - quantity=1000000, - ) - ], - custom_field_values=[ - CheckoutFieldValue( - id="id", - value="value", - ) - ], - new_plan_id="new_plan_id", - new_price_id="new_price_id", - pay_in_advance=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], - skip_trial=True, +client.catalogs.remove_credit_bundle( + catalog_id="catalog_id", + credit_bundle_id="credit_bundle_id", ) ``` @@ -8610,7 +8816,15 @@ client.checkout.preview_checkout_internal(
-**request:** `ChangeSubscriptionInternalRequestBody` +**catalog_id:** `str` — catalog_id + +
+
+ +
+
+ +**credit_bundle_id:** `str` — credit_bundle_id
@@ -8630,7 +8844,7 @@ client.checkout.preview_checkout_internal(
-
client.checkout.get_company_billing_details(...) -> GetCompanyBillingDetailsResponse +
client.catalogs.get_derived_features(...) -> GetDerivedFeaturesResponse
@@ -8651,8 +8865,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.get_company_billing_details( - company_id="company_id", +client.catalogs.get_derived_features( + catalog_id="catalog_id", ) ``` @@ -8669,7 +8883,7 @@ client.checkout.get_company_billing_details(
-**company_id:** `str` — company_id +**catalog_id:** `str` — catalog_id
@@ -8689,7 +8903,7 @@ client.checkout.get_company_billing_details(
-
client.checkout.update_company_billing_details(...) -> UpdateCompanyBillingDetailsResponse +
client.catalogs.get_plans_in_catalog(...) -> GetPlansInCatalogResponse
@@ -8702,7 +8916,7 @@ client.checkout.get_company_billing_details(
```python -from schematic import Schematic, CheckoutFieldValue +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -8710,14 +8924,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.update_company_billing_details( - company_id="company_id", - values=[ - CheckoutFieldValue( - id="id", - value="value", - ) - ], +client.catalogs.get_plans_in_catalog( + catalog_id="catalog_id", ) ``` @@ -8734,7 +8942,7 @@ client.checkout.update_company_billing_details(
-**company_id:** `str` — company_id +**catalog_id:** `str` — catalog_id
@@ -8742,31 +8950,59 @@ client.checkout.update_company_billing_details(
-**values:** `typing.List[CheckoutFieldValue]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**address:** `typing.Optional[CustomerBillingAddress]` -
+
+
client.catalogs.add_plan(...)
-**email:** `typing.Optional[str]` - +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.catalogs.add_plan( + catalog_id="catalog_id", + plan_id="plan_id", +) + +```
+
+
+ +#### ⚙️ Parameters
-**phone:** `typing.Optional[str]` +
+
+ +**catalog_id:** `str` — catalog_id
@@ -8774,7 +9010,7 @@ client.checkout.update_company_billing_details(
-**tax_id:** `typing.Optional[TaxIdInput]` +**plan_id:** `str` — plan_id
@@ -8794,7 +9030,7 @@ client.checkout.update_company_billing_details(
-
client.checkout.manage_plan(...) -> ManagePlanResponse +
client.catalogs.remove_plan(...)
@@ -8807,7 +9043,7 @@ client.checkout.update_company_billing_details(
```python -from schematic import Schematic, PlanSelection, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -8815,31 +9051,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.manage_plan( - add_on_selections=[ - PlanSelection( - plan_id="plan_id", - ) - ], - company_id="company_id", - credit_bundles=[ - UpdateCreditBundleRequestBody( - bundle_id="bundle_id", - quantity=1000000, - ) - ], - custom_field_values=[ - CheckoutFieldValue( - id="id", - value="value", - ) - ], - pay_in_advance_entitlements=[ - UpdatePayInAdvanceRequestBody( - price_id="price_id", - quantity=1000000, - ) - ], +client.catalogs.remove_plan( + catalog_id="catalog_id", + plan_id="plan_id", ) ``` @@ -8856,7 +9070,15 @@ client.checkout.manage_plan(
-**request:** `ManagePlanRequest` +**catalog_id:** `str` — catalog_id + +
+
+ +
+
+ +**plan_id:** `str` — plan_id
@@ -8876,7 +9098,8 @@ client.checkout.manage_plan(
-
client.checkout.preview_manage_plan(...) -> PreviewManagePlanResponse +## checkout +
client.checkout.internal(...) -> CheckoutInternalResponse
@@ -8889,7 +9112,7 @@ client.checkout.manage_plan(
```python -from schematic import Schematic, PlanSelection, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody +from schematic import Schematic, UpdateAddOnRequestBody, UpdateAutoTopupOverrideRequestBody, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -8897,10 +9120,16 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.preview_manage_plan( - add_on_selections=[ - PlanSelection( - plan_id="plan_id", +client.checkout.internal( + add_on_ids=[ + UpdateAddOnRequestBody( + add_on_id="add_on_id", + price_id="price_id", + ) + ], + auto_topup_overrides=[ + UpdateAutoTopupOverrideRequestBody( + plan_credit_grant_id="plan_credit_grant_id", ) ], company_id="company_id", @@ -8916,12 +9145,15 @@ client.checkout.preview_manage_plan( value="value", ) ], - pay_in_advance_entitlements=[ + new_plan_id="new_plan_id", + new_price_id="new_price_id", + pay_in_advance=[ UpdatePayInAdvanceRequestBody( price_id="price_id", quantity=1000000, ) ], + skip_trial=True, ) ``` @@ -8938,7 +9170,7 @@ client.checkout.preview_manage_plan(
-**request:** `ManagePlanRequest` +**request:** `ChangeSubscriptionInternalRequestBody`
@@ -8958,7 +9190,7 @@ client.checkout.preview_manage_plan(
-
client.checkout.cancel_subscription(...) -> CancelSubscriptionResponse +
client.checkout.get_checkout_data(...) -> GetCheckoutDataResponse
@@ -8979,7 +9211,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.cancel_subscription( +client.checkout.get_checkout_data( company_id="company_id", ) @@ -9005,7 +9237,7 @@ client.checkout.cancel_subscription(
-**cancel_immediately:** `typing.Optional[bool]` — If false, subscription cancels at period end. Defaults to true. +**currency:** `typing.Optional[str]`
@@ -9013,7 +9245,7 @@ client.checkout.cancel_subscription(
-**prorate:** `typing.Optional[bool]` — If true and cancel_immediately is true, issue prorated credit. Defaults to true. +**selected_plan_id:** `typing.Optional[str]`
@@ -9033,7 +9265,7 @@ client.checkout.cancel_subscription(
-
client.checkout.update_customer_subscription_trial_end(...) -> UpdateCustomerSubscriptionTrialEndResponse +
client.checkout.preview_checkout_internal(...) -> PreviewCheckoutInternalResponse
@@ -9046,7 +9278,7 @@ client.checkout.cancel_subscription(
```python -from schematic import Schematic +from schematic import Schematic, UpdateAddOnRequestBody, UpdateAutoTopupOverrideRequestBody, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -9054,8 +9286,40 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.checkout.update_customer_subscription_trial_end( - subscription_id="subscription_id", +client.checkout.preview_checkout_internal( + add_on_ids=[ + UpdateAddOnRequestBody( + add_on_id="add_on_id", + price_id="price_id", + ) + ], + auto_topup_overrides=[ + UpdateAutoTopupOverrideRequestBody( + plan_credit_grant_id="plan_credit_grant_id", + ) + ], + company_id="company_id", + credit_bundles=[ + UpdateCreditBundleRequestBody( + bundle_id="bundle_id", + quantity=1000000, + ) + ], + custom_field_values=[ + CheckoutFieldValue( + id="id", + value="value", + ) + ], + new_plan_id="new_plan_id", + new_price_id="new_price_id", + pay_in_advance=[ + UpdatePayInAdvanceRequestBody( + price_id="price_id", + quantity=1000000, + ) + ], + skip_trial=True, ) ``` @@ -9072,15 +9336,7 @@ client.checkout.update_customer_subscription_trial_end(
-**subscription_id:** `str` — subscription_id - -
-
- -
-
- -**trial_end:** `typing.Optional[datetime.datetime]` +**request:** `ChangeSubscriptionInternalRequestBody`
@@ -9100,8 +9356,7 @@ client.checkout.update_customer_subscription_trial_end(
-## companies -
client.companies.list_companies(...) -> ListCompaniesResponse +
client.checkout.get_company_billing_details(...) -> GetCompanyBillingDetailsResponse
@@ -9122,40 +9377,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_companies( - credit_type_ids=[ - "credit_type_ids" - ], - has_scheduled_downgrade=True, - ids=[ - "ids" - ], - monetized_subscriptions=True, - plan_id="plan_id", - plan_ids=[ - "plan_ids" - ], - plan_version_id="plan_version_id", - plan_version_ids=[ - "plan_version_ids" - ], - plan_version_unpublished=True, - q="q", - sort_order_column="sort_order_column", - sort_order_direction="asc", - subscription_statuses=[ - "active" - ], - subscription_types=[ - "free" - ], - with_entitlement_for="with_entitlement_for", - without_feature_override_for="without_feature_override_for", - without_plan=True, - without_subscription=True, - with_subscription=True, - limit=1000000, - offset=1000000, +client.checkout.get_company_billing_details( + company_id="company_id", ) ``` @@ -9172,7 +9395,7 @@ client.companies.list_companies(
-**credit_type_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more credit type IDs (each ID starts with bcrd_) +**company_id:** `str` — company_id
@@ -9180,71 +9403,64 @@ client.companies.list_companies(
-**has_scheduled_downgrade:** `typing.Optional[bool]` — Filter companies that have a pending scheduled downgrade +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by multiple company IDs (starts with comp_) -
-
-
-**monetized_subscriptions:** `typing.Optional[bool]` — Filter companies that have monetized subscriptions -
+
+
client.checkout.update_company_billing_details(...) -> UpdateCompanyBillingDetailsResponse
-**plan_id:** `typing.Optional[str]` — Filter companies by plan ID (starts with plan_) - -
-
+#### 🔌 Usage
-**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more plan IDs (each ID starts with plan_) - -
-
-
-**plan_version_id:** `typing.Optional[str]` — Filter companies by plan version ID (starts with plvr_) - -
-
- -
-
+```python +from schematic import Schematic, CheckoutFieldValue +from schematic.environment import SchematicEnvironment -**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. - +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.checkout.update_company_billing_details( + company_id="company_id", + values=[ + CheckoutFieldValue( + id="id", + value="value", + ) + ], +) + +``` +
+
+#### ⚙️ Parameters +
-**plan_version_unpublished:** `typing.Optional[bool]` — Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version - -
-
-
-**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits +**company_id:** `str` — company_id
@@ -9252,7 +9468,7 @@ client.companies.list_companies(
-**sort_order_column:** `typing.Optional[str]` — Column to sort by (e.g. name, created_at, last_seen_at) +**values:** `typing.List[CheckoutFieldValue]`
@@ -9260,7 +9476,7 @@ client.companies.list_companies(
-**sort_order_direction:** `typing.Optional[SortDirection]` — Direction to sort by (asc or desc) +**address:** `typing.Optional[CustomerBillingAddress]`
@@ -9268,7 +9484,7 @@ client.companies.list_companies(
-**subscription_statuses:** `typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]` — Filter companies by one or more subscription statuses +**email:** `typing.Optional[str]`
@@ -9276,7 +9492,7 @@ client.companies.list_companies(
-**subscription_types:** `typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]` — Filter companies by one or more subscription types +**phone:** `typing.Optional[str]`
@@ -9284,7 +9500,7 @@ client.companies.list_companies(
-**with_entitlement_for:** `typing.Optional[str]` — Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID +**tax_id:** `typing.Optional[TaxIdInput]`
@@ -9292,47 +9508,81 @@ client.companies.list_companies(
-**without_feature_override_for:** `typing.Optional[str]` — Filter out companies that already have a company override for the specified feature ID +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ + -
-
-**without_plan:** `typing.Optional[bool]` — Filter out companies that have a plan -
+
+
client.checkout.manage_plan(...) -> ManagePlanResponse
-**without_subscription:** `typing.Optional[bool]` — Filter out companies that have a subscription - -
-
+#### 🔌 Usage
-**with_subscription:** `typing.Optional[bool]` — Filter companies that have a subscription - -
-
-
-**limit:** `typing.Optional[int]` — Page limit (default 100) - +```python +from schematic import Schematic, PlanSelection, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.checkout.manage_plan( + add_on_selections=[ + PlanSelection( + plan_id="plan_id", + ) + ], + company_id="company_id", + credit_bundles=[ + UpdateCreditBundleRequestBody( + bundle_id="bundle_id", + quantity=1000000, + ) + ], + custom_field_values=[ + CheckoutFieldValue( + id="id", + value="value", + ) + ], + pay_in_advance_entitlements=[ + UpdatePayInAdvanceRequestBody( + price_id="price_id", + quantity=1000000, + ) + ], +) + +``` +
+
+#### ⚙️ Parameters +
-**offset:** `typing.Optional[int]` — Page offset (default 0) +
+
+ +**request:** `ManagePlanRequest`
@@ -9352,7 +9602,7 @@ client.companies.list_companies(
-
client.companies.upsert_company(...) -> UpsertCompanyResponse +
client.checkout.preview_manage_plan(...) -> PreviewManagePlanResponse
@@ -9365,7 +9615,7 @@ client.companies.list_companies(
```python -from schematic import Schematic +from schematic import Schematic, PlanSelection, UpdateCreditBundleRequestBody, CheckoutFieldValue, UpdatePayInAdvanceRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -9373,10 +9623,31 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.upsert_company( - keys={ - "key": "value" - }, +client.checkout.preview_manage_plan( + add_on_selections=[ + PlanSelection( + plan_id="plan_id", + ) + ], + company_id="company_id", + credit_bundles=[ + UpdateCreditBundleRequestBody( + bundle_id="bundle_id", + quantity=1000000, + ) + ], + custom_field_values=[ + CheckoutFieldValue( + id="id", + value="value", + ) + ], + pay_in_advance_entitlements=[ + UpdatePayInAdvanceRequestBody( + price_id="price_id", + quantity=1000000, + ) + ], ) ``` @@ -9393,7 +9664,7 @@ client.companies.upsert_company(
-**request:** `UpsertCompanyRequestBody` +**request:** `ManagePlanRequest`
@@ -9413,7 +9684,7 @@ client.companies.upsert_company(
-
client.companies.get_company(...) -> GetCompanyResponse +
client.checkout.cancel_subscription(...) -> CancelSubscriptionResponse
@@ -9434,7 +9705,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_company( +client.checkout.cancel_subscription( company_id="company_id", ) @@ -9452,7 +9723,23 @@ client.companies.get_company(
-**company_id:** `str` — company_id +**company_id:** `str` + +
+
+ +
+
+ +**cancel_immediately:** `typing.Optional[bool]` — If false, subscription cancels at period end. Defaults to true. + +
+
+ +
+
+ +**prorate:** `typing.Optional[bool]` — If true and cancel_immediately is true, issue prorated credit. Defaults to true.
@@ -9472,7 +9759,7 @@ client.companies.get_company(
-
client.companies.delete_company(...) -> DeleteCompanyResponse +
client.checkout.update_customer_subscription_trial_end(...) -> UpdateCustomerSubscriptionTrialEndResponse
@@ -9493,10 +9780,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_company( - company_id="company_id", - cancel_subscription=True, - prorate=True, +client.checkout.update_customer_subscription_trial_end( + subscription_id="subscription_id", ) ``` @@ -9513,15 +9798,7 @@ client.companies.delete_company(
-**company_id:** `str` — company_id - -
-
- -
-
- -**cancel_subscription:** `typing.Optional[bool]` +**subscription_id:** `str` — subscription_id
@@ -9529,7 +9806,7 @@ client.companies.delete_company(
-**prorate:** `typing.Optional[bool]` +**trial_end:** `typing.Optional[datetime.datetime]`
@@ -9549,7 +9826,8 @@ client.companies.delete_company(
-
client.companies.count_companies(...) -> CountCompaniesResponse +## companies +
client.companies.list_companies(...) -> ListCompaniesResponse
@@ -9570,7 +9848,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_companies( +client.companies.list_companies( credit_type_ids=[ "credit_type_ids" ], @@ -9800,7 +10078,7 @@ client.companies.count_companies(
-
client.companies.create_company(...) -> CreateCompanyResponse +
client.companies.upsert_company(...) -> UpsertCompanyResponse
@@ -9821,7 +10099,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.create_company( +client.companies.upsert_company( keys={ "key": "value" }, @@ -9861,7 +10139,7 @@ client.companies.create_company(
-
client.companies.delete_company_by_keys(...) -> DeleteCompanyByKeysResponse +
client.companies.get_company(...) -> GetCompanyResponse
@@ -9882,10 +10160,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_company_by_keys( - keys={ - "key": "value" - }, +client.companies.get_company( + company_id="company_id", ) ``` @@ -9902,7 +10178,7 @@ client.companies.delete_company_by_keys(
-**request:** `KeysRequestBody` +**company_id:** `str` — company_id
@@ -9922,28 +10198,10 @@ client.companies.delete_company_by_keys(
-
client.companies.lookup_company(...) -> LookupCompanyResponse -
-
- -#### 📝 Description - -
-
- +
client.companies.delete_company(...) -> DeleteCompanyResponse
-Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. -The following approaches will all work to resolve a company and any of them are appropriate: -1. `/companies/lookup?keys={"foo": "bar", "fizz": "buzz"}` -2. `/companies/lookup?keys[foo]=bar&keys[fizz]=buzz` -2. `/companies/lookup?foo=bar&fizz=buzz` -
-
-
-
- #### 🔌 Usage
@@ -9961,10 +10219,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.lookup_company( - keys={ - "keys": "keys" - }, +client.companies.delete_company( + company_id="company_id", + cancel_subscription=True, + prorate=True, ) ``` @@ -9981,7 +10239,23 @@ client.companies.lookup_company(
-**keys:** `typing.Dict[str, str]` — Key/value pairs +**company_id:** `str` — company_id + +
+
+ +
+
+ +**cancel_subscription:** `typing.Optional[bool]` + +
+
+ +
+
+ +**prorate:** `typing.Optional[bool]`
@@ -10001,7 +10275,7 @@ client.companies.lookup_company(
-
client.companies.get_company_billing_entity(...) -> GetCompanyBillingEntityResponse +
client.companies.count_companies(...) -> CountCompaniesResponse
@@ -10022,11 +10296,43 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_company_billing_entity( - company_id="company_id", -) - -``` +client.companies.count_companies( + credit_type_ids=[ + "credit_type_ids" + ], + has_scheduled_downgrade=True, + ids=[ + "ids" + ], + monetized_subscriptions=True, + plan_id="plan_id", + plan_ids=[ + "plan_ids" + ], + plan_version_id="plan_version_id", + plan_version_ids=[ + "plan_version_ids" + ], + plan_version_unpublished=True, + q="q", + sort_order_column="sort_order_column", + sort_order_direction="asc", + subscription_statuses=[ + "active" + ], + subscription_types=[ + "free" + ], + with_entitlement_for="with_entitlement_for", + without_feature_override_for="without_feature_override_for", + without_plan=True, + without_subscription=True, + with_subscription=True, + limit=1000000, + offset=1000000, +) + +```
@@ -10040,7 +10346,7 @@ client.companies.get_company_billing_entity(
-**company_id:** `str` +**credit_type_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more credit type IDs (each ID starts with bcrd_)
@@ -10048,58 +10354,55 @@ client.companies.get_company_billing_entity(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**has_scheduled_downgrade:** `typing.Optional[bool]` — Filter companies that have a pending scheduled downgrade
- - +
+
+**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by multiple company IDs (starts with comp_) +
-
-
client.companies.get_billing_entity_child_subscriptions(...) -> GetBillingEntityChildSubscriptionsResponse
-#### 🔌 Usage +**monetized_subscriptions:** `typing.Optional[bool]` — Filter companies that have monetized subscriptions + +
+
+**plan_id:** `typing.Optional[str]` — Filter companies by plan ID (starts with plan_) + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.companies.get_billing_entity_child_subscriptions( - company_id="company_id", -) - -``` -
-
+**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more plan IDs (each ID starts with plan_) + -#### ⚙️ Parameters -
+**plan_version_id:** `typing.Optional[str]` — Filter companies by plan version ID (starts with plvr_) + +
+
+
-**company_id:** `str` +**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set.
@@ -10107,61 +10410,79 @@ client.companies.get_billing_entity_child_subscriptions(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**plan_version_unpublished:** `typing.Optional[bool]` — Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version
+ +
+
+ +**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits +
+
+
+**sort_order_column:** `typing.Optional[str]` — Column to sort by (e.g. name, created_at, last_seen_at) +
-
-
client.companies.list_company_memberships(...) -> ListCompanyMembershipsResponse
-#### 🔌 Usage +**sort_order_direction:** `typing.Optional[SortDirection]` — Direction to sort by (asc or desc) + +
+
+**subscription_statuses:** `typing.Optional[typing.Union[SubscriptionStatus, typing.Sequence[SubscriptionStatus]]]` — Filter companies by one or more subscription statuses + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) +**subscription_types:** `typing.Optional[typing.Union[SubscriptionType, typing.Sequence[SubscriptionType]]]` — Filter companies by one or more subscription types + +
+
-client.companies.list_company_memberships( - company_id="company_id", - user_id="user_id", - limit=1000000, - offset=1000000, -) +
+
-``` +**with_entitlement_for:** `typing.Optional[str]` — Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID +
+ +
+
+ +**without_feature_override_for:** `typing.Optional[str]` — Filter out companies that already have a company override for the specified feature ID +
-#### ⚙️ Parameters -
+**without_plan:** `typing.Optional[bool]` — Filter out companies that have a plan + +
+
+
-**company_id:** `typing.Optional[str]` +**without_subscription:** `typing.Optional[bool]` — Filter out companies that have a subscription
@@ -10169,7 +10490,7 @@ client.companies.list_company_memberships(
-**user_id:** `typing.Optional[str]` +**with_subscription:** `typing.Optional[bool]` — Filter companies that have a subscription
@@ -10205,7 +10526,7 @@ client.companies.list_company_memberships(
-
client.companies.get_or_create_company_membership(...) -> GetOrCreateCompanyMembershipResponse +
client.companies.create_company(...) -> CreateCompanyResponse
@@ -10226,9 +10547,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_or_create_company_membership( - company_id="company_id", - user_id="user_id", +client.companies.create_company( + keys={ + "key": "value" + }, ) ``` @@ -10245,15 +10567,7 @@ client.companies.get_or_create_company_membership(
-**company_id:** `str` - -
-
- -
-
- -**user_id:** `str` +**request:** `UpsertCompanyRequestBody`
@@ -10273,7 +10587,7 @@ client.companies.get_or_create_company_membership(
-
client.companies.delete_company_membership(...) -> DeleteCompanyMembershipResponse +
client.companies.delete_company_by_keys(...) -> DeleteCompanyByKeysResponse
@@ -10294,8 +10608,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_company_membership( - company_membership_id="company_membership_id", +client.companies.delete_company_by_keys( + keys={ + "key": "value" + }, ) ``` @@ -10312,7 +10628,7 @@ client.companies.delete_company_membership(
-**company_membership_id:** `str` — company_membership_id +**request:** `KeysRequestBody`
@@ -10332,10 +10648,28 @@ client.companies.delete_company_membership(
-
client.companies.get_active_company_subscription(...) -> GetActiveCompanySubscriptionResponse +
client.companies.lookup_company(...) -> LookupCompanyResponse +
+
+ +#### 📝 Description + +
+
+
+Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. +The following approaches will all work to resolve a company and any of them are appropriate: +1. `/companies/lookup?keys={"foo": "bar", "fizz": "buzz"}` +2. `/companies/lookup?keys[foo]=bar&keys[fizz]=buzz` +2. `/companies/lookup?foo=bar&fizz=buzz` +
+
+
+
+ #### 🔌 Usage
@@ -10353,13 +10687,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_active_company_subscription( - company_id="company_id", - company_ids=[ - "company_ids" - ], - limit=1000000, - offset=1000000, +client.companies.lookup_company( + keys={ + "keys": "keys" + }, ) ``` @@ -10376,31 +10707,7 @@ client.companies.get_active_company_subscription(
-**company_id:** `typing.Optional[str]` - -
-
- -
-
- -**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**keys:** `typing.Dict[str, str]` — Key/value pairs
@@ -10420,7 +10727,7 @@ client.companies.get_active_company_subscription(
-
client.companies.upsert_company_trait(...) -> UpsertCompanyTraitResponse +
client.companies.get_company_billing_entity(...) -> GetCompanyBillingEntityResponse
@@ -10441,11 +10748,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.upsert_company_trait( - keys={ - "key": "value" - }, - trait="trait", +client.companies.get_company_billing_entity( + company_id="company_id", ) ``` @@ -10462,7 +10766,7 @@ client.companies.upsert_company_trait(
-**request:** `UpsertTraitRequestBody` +**company_id:** `str`
@@ -10482,7 +10786,7 @@ client.companies.upsert_company_trait(
-
client.companies.list_entity_key_definitions(...) -> ListEntityKeyDefinitionsResponse +
client.companies.get_billing_entity_child_subscriptions(...) -> GetBillingEntityChildSubscriptionsResponse
@@ -10503,14 +10807,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_entity_key_definitions( - entity_type="company", - ids=[ - "ids" - ], - q="q", - limit=1000000, - offset=1000000, +client.companies.get_billing_entity_child_subscriptions( + company_id="company_id", ) ``` @@ -10527,7 +10825,7 @@ client.companies.list_entity_key_definitions(
-**entity_type:** `typing.Optional[EntityType]` +**company_id:** `str`
@@ -10535,15 +10833,69 @@ client.companies.list_entity_key_definitions(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+ + + + +
+
client.companies.list_company_memberships(...) -> ListCompanyMembershipsResponse
-**q:** `typing.Optional[str]` +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.companies.list_company_memberships( + company_id="company_id", + user_id="user_id", + limit=1000000, + offset=1000000, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]`
@@ -10579,7 +10931,7 @@ client.companies.list_entity_key_definitions(
-
client.companies.delete_entity_key_definition(...) -> DeleteEntityKeyDefinitionResponse +
client.companies.get_or_create_company_membership(...) -> GetOrCreateCompanyMembershipResponse
@@ -10600,8 +10952,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_entity_key_definition( - entity_key_definition_id="entity_key_definition_id", +client.companies.get_or_create_company_membership( + company_id="company_id", + user_id="user_id", ) ``` @@ -10618,7 +10971,15 @@ client.companies.delete_entity_key_definition(
-**entity_key_definition_id:** `str` — entity_key_definition_id +**company_id:** `str` + +
+
+ +
+
+ +**user_id:** `str`
@@ -10638,7 +10999,7 @@ client.companies.delete_entity_key_definition(
-
client.companies.count_entity_key_definitions(...) -> CountEntityKeyDefinitionsResponse +
client.companies.delete_company_membership(...) -> DeleteCompanyMembershipResponse
@@ -10659,14 +11020,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_entity_key_definitions( - entity_type="company", - ids=[ - "ids" - ], - q="q", - limit=1000000, - offset=1000000, +client.companies.delete_company_membership( + company_membership_id="company_membership_id", ) ``` @@ -10683,39 +11038,7 @@ client.companies.count_entity_key_definitions(
-**entity_type:** `typing.Optional[EntityType]` - -
-
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
- -
-
- -**q:** `typing.Optional[str]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**company_membership_id:** `str` — company_membership_id
@@ -10735,7 +11058,7 @@ client.companies.count_entity_key_definitions(
-
client.companies.count_entity_keys(...) -> CountEntityKeysResponse +
client.companies.get_active_company_subscription(...) -> GetActiveCompanySubscriptionResponse
@@ -10756,9 +11079,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_entity_keys( - definition_id="definition_id", - entity_type="company", +client.companies.get_active_company_subscription( + company_id="company_id", + company_ids=[ + "company_ids" + ], limit=1000000, offset=1000000, ) @@ -10777,7 +11102,7 @@ client.companies.count_entity_keys(
-**definition_id:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]`
@@ -10785,7 +11110,7 @@ client.companies.count_entity_keys(
-**entity_type:** `typing.Optional[EntityType]` +**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -10821,7 +11146,7 @@ client.companies.count_entity_keys(
-
client.companies.list_entity_trait_definitions(...) -> ListEntityTraitDefinitionsResponse +
client.companies.upsert_company_trait(...) -> UpsertCompanyTraitResponse
@@ -10842,18 +11167,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_entity_trait_definitions( - entity_type="company", - ids=[ - "ids" - ], - q="q", - trait_type="boolean", - trait_types=[ - "boolean" - ], - limit=1000000, - offset=1000000, +client.companies.upsert_company_trait( + keys={ + "key": "value" + }, + trait="trait", ) ``` @@ -10870,55 +11188,7 @@ client.companies.list_entity_trait_definitions(
-**entity_type:** `typing.Optional[EntityType]` - -
-
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
- -
-
- -**q:** `typing.Optional[str]` - -
-
- -
-
- -**trait_type:** `typing.Optional[TraitType]` - -
-
- -
-
- -**trait_types:** `typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**request:** `UpsertTraitRequestBody`
@@ -10938,7 +11208,7 @@ client.companies.list_entity_trait_definitions(
-
client.companies.get_or_create_entity_trait_definition(...) -> GetOrCreateEntityTraitDefinitionResponse +
client.companies.list_entity_key_definitions(...) -> ListEntityKeyDefinitionsResponse
@@ -10959,12 +11229,14 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_or_create_entity_trait_definition( +client.companies.list_entity_key_definitions( entity_type="company", - hierarchy=[ - "hierarchy" + ids=[ + "ids" ], - trait_type="boolean", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -10981,7 +11253,7 @@ client.companies.get_or_create_entity_trait_definition(
-**entity_type:** `EntityType` +**entity_type:** `typing.Optional[EntityType]`
@@ -10989,7 +11261,7 @@ client.companies.get_or_create_entity_trait_definition(
-**hierarchy:** `typing.List[str]` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -10997,7 +11269,7 @@ client.companies.get_or_create_entity_trait_definition(
-**trait_type:** `TraitType` +**q:** `typing.Optional[str]`
@@ -11005,7 +11277,15 @@ client.companies.get_or_create_entity_trait_definition(
-**display_name:** `typing.Optional[str]` +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -11025,7 +11305,7 @@ client.companies.get_or_create_entity_trait_definition(
-
client.companies.get_entity_trait_definition(...) -> GetEntityTraitDefinitionResponse +
client.companies.delete_entity_key_definition(...) -> DeleteEntityKeyDefinitionResponse
@@ -11046,8 +11326,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_entity_trait_definition( - entity_trait_definition_id="entity_trait_definition_id", +client.companies.delete_entity_key_definition( + entity_key_definition_id="entity_key_definition_id", ) ``` @@ -11064,7 +11344,7 @@ client.companies.get_entity_trait_definition(
-**entity_trait_definition_id:** `str` — entity_trait_definition_id +**entity_key_definition_id:** `str` — entity_key_definition_id
@@ -11084,7 +11364,7 @@ client.companies.get_entity_trait_definition(
-
client.companies.update_entity_trait_definition(...) -> UpdateEntityTraitDefinitionResponse +
client.companies.count_entity_key_definitions(...) -> CountEntityKeyDefinitionsResponse
@@ -11105,15 +11385,20 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.update_entity_trait_definition( - entity_trait_definition_id="entity_trait_definition_id", - trait_type="boolean", -) - -``` -
-
- +client.companies.count_entity_key_definitions( + entity_type="company", + ids=[ + "ids" + ], + q="q", + limit=1000000, + offset=1000000, +) + +``` + + + #### ⚙️ Parameters @@ -11124,7 +11409,7 @@ client.companies.update_entity_trait_definition(
-**entity_trait_definition_id:** `str` — entity_trait_definition_id +**entity_type:** `typing.Optional[EntityType]`
@@ -11132,7 +11417,7 @@ client.companies.update_entity_trait_definition(
-**trait_type:** `TraitType` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -11140,7 +11425,23 @@ client.companies.update_entity_trait_definition(
-**display_name:** `typing.Optional[str]` +**q:** `typing.Optional[str]` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -11160,7 +11461,7 @@ client.companies.update_entity_trait_definition(
-
client.companies.delete_entity_trait_definition(...) -> DeleteEntityTraitDefinitionResponse +
client.companies.count_entity_keys(...) -> CountEntityKeysResponse
@@ -11181,8 +11482,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_entity_trait_definition( - entity_trait_definition_id="entity_trait_definition_id", +client.companies.count_entity_keys( + definition_id="definition_id", + entity_type="company", + limit=1000000, + offset=1000000, ) ``` @@ -11199,7 +11503,7 @@ client.companies.delete_entity_trait_definition(
-**entity_trait_definition_id:** `str` — entity_trait_definition_id +**definition_id:** `typing.Optional[str]`
@@ -11207,58 +11511,23 @@ client.companies.delete_entity_trait_definition(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**entity_type:** `typing.Optional[EntityType]`
-
-
- - - - -
- -
client.companies.get_entity_trait_definition_usage(...) -> GetEntityTraitDefinitionUsageResponse -
-
- -#### 🔌 Usage - -
-
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.companies.get_entity_trait_definition_usage( - entity_trait_definition_id="entity_trait_definition_id", -) - -``` -
-
+**limit:** `typing.Optional[int]` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**entity_trait_definition_id:** `str` — entity_trait_definition_id +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -11278,7 +11547,7 @@ client.companies.get_entity_trait_definition_usage(
-
client.companies.count_entity_trait_definitions(...) -> CountEntityTraitDefinitionsResponse +
client.companies.list_entity_trait_definitions(...) -> ListEntityTraitDefinitionsResponse
@@ -11299,7 +11568,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_entity_trait_definitions( +client.companies.list_entity_trait_definitions( entity_type="company", ids=[ "ids" @@ -11395,7 +11664,7 @@ client.companies.count_entity_trait_definitions(
-
client.companies.get_entity_trait_values(...) -> GetEntityTraitValuesResponse +
client.companies.get_or_create_entity_trait_definition(...) -> GetOrCreateEntityTraitDefinitionResponse
@@ -11416,11 +11685,12 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_entity_trait_values( - definition_id="definition_id", - q="q", - limit=1000000, - offset=1000000, +client.companies.get_or_create_entity_trait_definition( + entity_type="company", + hierarchy=[ + "hierarchy" + ], + trait_type="boolean", ) ``` @@ -11437,7 +11707,7 @@ client.companies.get_entity_trait_values(
-**definition_id:** `str` +**entity_type:** `EntityType`
@@ -11445,7 +11715,7 @@ client.companies.get_entity_trait_values(
-**q:** `typing.Optional[str]` +**hierarchy:** `typing.List[str]`
@@ -11453,7 +11723,7 @@ client.companies.get_entity_trait_values(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**trait_type:** `TraitType`
@@ -11461,7 +11731,7 @@ client.companies.get_entity_trait_values(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**display_name:** `typing.Optional[str]`
@@ -11481,7 +11751,7 @@ client.companies.get_entity_trait_values(
-
client.companies.count_entity_traits(...) -> CountEntityTraitsResponse +
client.companies.get_entity_trait_definition(...) -> GetEntityTraitDefinitionResponse
@@ -11502,11 +11772,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_entity_traits( - definition_id="definition_id", - entity_type="company", - limit=1000000, - offset=1000000, +client.companies.get_entity_trait_definition( + entity_trait_definition_id="entity_trait_definition_id", ) ``` @@ -11523,31 +11790,7 @@ client.companies.count_entity_traits(
-**definition_id:** `typing.Optional[str]` - -
-
- -
-
- -**entity_type:** `typing.Optional[EntityType]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**entity_trait_definition_id:** `str` — entity_trait_definition_id
@@ -11567,7 +11810,7 @@ client.companies.count_entity_traits(
-
client.companies.list_plan_changes(...) -> ListPlanChangesResponse +
client.companies.update_entity_trait_definition(...) -> UpdateEntityTraitDefinitionResponse
@@ -11588,15 +11831,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_plan_changes( - action="checkout", - base_plan_action="fallback", - company_id="company_id", - company_ids=[ - "company_ids" - ], - limit=1000000, - offset=1000000, +client.companies.update_entity_trait_definition( + entity_trait_definition_id="entity_trait_definition_id", + trait_type="boolean", ) ``` @@ -11613,7 +11850,7 @@ client.companies.list_plan_changes(
-**action:** `typing.Optional[PlanChangeAction]` +**entity_trait_definition_id:** `str` — entity_trait_definition_id
@@ -11621,7 +11858,7 @@ client.companies.list_plan_changes(
-**base_plan_action:** `typing.Optional[PlanChangeBasePlanAction]` +**trait_type:** `TraitType`
@@ -11629,7 +11866,7 @@ client.companies.list_plan_changes(
-**company_id:** `typing.Optional[str]` +**display_name:** `typing.Optional[str]`
@@ -11637,23 +11874,58 @@ client.companies.list_plan_changes(
-**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+ + + + +
+
client.companies.delete_entity_trait_definition(...) -> DeleteEntityTraitDefinitionResponse
-**limit:** `typing.Optional[int]` — Page limit (default 100) - +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.companies.delete_entity_trait_definition( + entity_trait_definition_id="entity_trait_definition_id", +) + +```
+
+
+ +#### ⚙️ Parameters
-**offset:** `typing.Optional[int]` — Page offset (default 0) +
+
+ +**entity_trait_definition_id:** `str` — entity_trait_definition_id
@@ -11673,7 +11945,7 @@ client.companies.list_plan_changes(
-
client.companies.get_plan_change(...) -> GetPlanChangeResponse +
client.companies.get_entity_trait_definition_usage(...) -> GetEntityTraitDefinitionUsageResponse
@@ -11694,8 +11966,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_plan_change( - plan_change_id="plan_change_id", +client.companies.get_entity_trait_definition_usage( + entity_trait_definition_id="entity_trait_definition_id", ) ``` @@ -11712,7 +11984,7 @@ client.companies.get_plan_change(
-**plan_change_id:** `str` — plan_change_id +**entity_trait_definition_id:** `str` — entity_trait_definition_id
@@ -11732,7 +12004,7 @@ client.companies.get_plan_change(
-
client.companies.list_plan_traits(...) -> ListPlanTraitsResponse +
client.companies.count_entity_trait_definitions(...) -> CountEntityTraitDefinitionsResponse
@@ -11753,14 +12025,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_plan_traits( +client.companies.count_entity_trait_definitions( + entity_type="company", ids=[ "ids" ], - plan_id="plan_id", - trait_id="trait_id", - trait_ids=[ - "trait_ids" + q="q", + trait_type="boolean", + trait_types=[ + "boolean" ], limit=1000000, offset=1000000, @@ -11780,6 +12053,14 @@ client.companies.list_plan_traits(
+**entity_type:** `typing.Optional[EntityType]` + +
+
+ +
+
+ **ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -11788,7 +12069,7 @@ client.companies.list_plan_traits(
-**plan_id:** `typing.Optional[str]` +**q:** `typing.Optional[str]`
@@ -11796,7 +12077,7 @@ client.companies.list_plan_traits(
-**trait_id:** `typing.Optional[str]` +**trait_type:** `typing.Optional[TraitType]`
@@ -11804,7 +12085,7 @@ client.companies.list_plan_traits(
-**trait_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**trait_types:** `typing.Optional[typing.Union[TraitType, typing.Sequence[TraitType]]]`
@@ -11840,7 +12121,7 @@ client.companies.list_plan_traits(
-
client.companies.get_plan_trait(...) -> GetPlanTraitResponse +
client.companies.get_entity_trait_values(...) -> GetEntityTraitValuesResponse
@@ -11861,12 +12142,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_plan_trait( - plan_trait_id="plan_trait_id", -) - -``` -
+client.companies.get_entity_trait_values( + definition_id="definition_id", + q="q", + limit=1000000, + offset=1000000, +) + +``` +
@@ -11879,7 +12163,31 @@ client.companies.get_plan_trait(
-**plan_trait_id:** `str` — plan_trait_id +**definition_id:** `str` + +
+
+ +
+
+ +**q:** `typing.Optional[str]` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -11899,7 +12207,7 @@ client.companies.get_plan_trait(
-
client.companies.update_plan_traits_bulk(...) -> UpdatePlanTraitsBulkResponse +
client.companies.count_entity_traits(...) -> CountEntityTraitsResponse
@@ -11912,7 +12220,7 @@ client.companies.get_plan_trait(
```python -from schematic import Schematic, UpdatePlanTraitTraitRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -11920,15 +12228,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.update_plan_traits_bulk( - apply_to_existing_companies=True, - plan_id="plan_id", - traits=[ - UpdatePlanTraitTraitRequestBody( - trait_id="trait_id", - trait_value="trait_value", - ) - ], +client.companies.count_entity_traits( + definition_id="definition_id", + entity_type="company", + limit=1000000, + offset=1000000, ) ``` @@ -11945,7 +12249,7 @@ client.companies.update_plan_traits_bulk(
-**apply_to_existing_companies:** `bool` +**definition_id:** `typing.Optional[str]`
@@ -11953,7 +12257,7 @@ client.companies.update_plan_traits_bulk(
-**plan_id:** `str` +**entity_type:** `typing.Optional[EntityType]`
@@ -11961,7 +12265,15 @@ client.companies.update_plan_traits_bulk(
-**traits:** `typing.List[UpdatePlanTraitTraitRequestBody]` +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -11981,7 +12293,7 @@ client.companies.update_plan_traits_bulk(
-
client.companies.count_plan_traits(...) -> CountPlanTraitsResponse +
client.companies.list_plan_changes(...) -> ListPlanChangesResponse
@@ -12002,14 +12314,12 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_plan_traits( - ids=[ - "ids" - ], - plan_id="plan_id", - trait_id="trait_id", - trait_ids=[ - "trait_ids" +client.companies.list_plan_changes( + action="checkout", + base_plan_action="fallback", + company_id="company_id", + company_ids=[ + "company_ids" ], limit=1000000, offset=1000000, @@ -12029,7 +12339,7 @@ client.companies.count_plan_traits(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**action:** `typing.Optional[PlanChangeAction]`
@@ -12037,7 +12347,7 @@ client.companies.count_plan_traits(
-**plan_id:** `typing.Optional[str]` +**base_plan_action:** `typing.Optional[PlanChangeBasePlanAction]`
@@ -12045,7 +12355,7 @@ client.companies.count_plan_traits(
-**trait_id:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]`
@@ -12053,7 +12363,7 @@ client.companies.count_plan_traits(
-**trait_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -12089,7 +12399,7 @@ client.companies.count_plan_traits(
-
client.companies.upsert_user_trait(...) -> UpsertUserTraitResponse +
client.companies.get_plan_change(...) -> GetPlanChangeResponse
@@ -12110,11 +12420,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.upsert_user_trait( - keys={ - "key": "value" - }, - trait="trait", +client.companies.get_plan_change( + plan_change_id="plan_change_id", ) ``` @@ -12131,7 +12438,7 @@ client.companies.upsert_user_trait(
-**request:** `UpsertTraitRequestBody` +**plan_change_id:** `str` — plan_change_id
@@ -12151,7 +12458,7 @@ client.companies.upsert_user_trait(
-
client.companies.list_users(...) -> ListUsersResponse +
client.companies.list_plan_traits(...) -> ListPlanTraitsResponse
@@ -12172,13 +12479,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.list_users( - company_id="company_id", +client.companies.list_plan_traits( ids=[ "ids" ], plan_id="plan_id", - q="q", + trait_id="trait_id", + trait_ids=[ + "trait_ids" + ], limit=1000000, offset=1000000, ) @@ -12197,7 +12506,7 @@ client.companies.list_users(
-**company_id:** `typing.Optional[str]` — Filter users by company ID (starts with comp_) +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -12205,7 +12514,7 @@ client.companies.list_users(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter users by multiple user IDs (starts with user_) +**plan_id:** `typing.Optional[str]`
@@ -12213,7 +12522,7 @@ client.companies.list_users(
-**plan_id:** `typing.Optional[str]` — Filter users by plan ID (starts with plan_) +**trait_id:** `typing.Optional[str]`
@@ -12221,7 +12530,7 @@ client.companies.list_users(
-**q:** `typing.Optional[str]` — Search for users by name, keys or string traits +**trait_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -12257,7 +12566,7 @@ client.companies.list_users(
-
client.companies.upsert_user(...) -> UpsertUserResponse +
client.companies.get_plan_trait(...) -> GetPlanTraitResponse
@@ -12278,10 +12587,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.upsert_user( - keys={ - "key": "value" - }, +client.companies.get_plan_trait( + plan_trait_id="plan_trait_id", ) ``` @@ -12298,7 +12605,7 @@ client.companies.upsert_user(
-**request:** `UpsertUserRequestBody` +**plan_trait_id:** `str` — plan_trait_id
@@ -12318,7 +12625,7 @@ client.companies.upsert_user(
-
client.companies.get_user(...) -> GetUserResponse +
client.companies.update_plan_traits_bulk(...) -> UpdatePlanTraitsBulkResponse
@@ -12331,7 +12638,7 @@ client.companies.upsert_user(
```python -from schematic import Schematic +from schematic import Schematic, UpdatePlanTraitTraitRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -12339,8 +12646,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.get_user( - user_id="user_id", +client.companies.update_plan_traits_bulk( + apply_to_existing_companies=True, + plan_id="plan_id", + traits=[ + UpdatePlanTraitTraitRequestBody( + trait_id="trait_id", + trait_value="trait_value", + ) + ], ) ``` @@ -12357,7 +12671,7 @@ client.companies.get_user(
-**user_id:** `str` — user_id +**apply_to_existing_companies:** `bool`
@@ -12365,58 +12679,15 @@ client.companies.get_user(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**plan_id:** `str`
-
-
- - - - -
- -
client.companies.delete_user(...) -> DeleteUserResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.companies.delete_user( - user_id="user_id", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
-**user_id:** `str` — user_id +**traits:** `typing.List[UpdatePlanTraitTraitRequestBody]`
@@ -12436,7 +12707,7 @@ client.companies.delete_user(
-
client.companies.count_users(...) -> CountUsersResponse +
client.companies.count_plan_traits(...) -> CountPlanTraitsResponse
@@ -12457,13 +12728,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.count_users( - company_id="company_id", +client.companies.count_plan_traits( ids=[ "ids" ], plan_id="plan_id", - q="q", + trait_id="trait_id", + trait_ids=[ + "trait_ids" + ], limit=1000000, offset=1000000, ) @@ -12482,7 +12755,7 @@ client.companies.count_users(
-**company_id:** `typing.Optional[str]` — Filter users by company ID (starts with comp_) +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -12490,7 +12763,7 @@ client.companies.count_users(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter users by multiple user IDs (starts with user_) +**plan_id:** `typing.Optional[str]`
@@ -12498,7 +12771,7 @@ client.companies.count_users(
-**plan_id:** `typing.Optional[str]` — Filter users by plan ID (starts with plan_) +**trait_id:** `typing.Optional[str]`
@@ -12506,7 +12779,7 @@ client.companies.count_users(
-**q:** `typing.Optional[str]` — Search for users by name, keys or string traits +**trait_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -12542,7 +12815,7 @@ client.companies.count_users(
-
client.companies.create_user(...) -> CreateUserResponse +
client.companies.upsert_user_trait(...) -> UpsertUserTraitResponse
@@ -12563,10 +12836,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.create_user( +client.companies.upsert_user_trait( keys={ "key": "value" }, + trait="trait", ) ``` @@ -12583,7 +12857,7 @@ client.companies.create_user(
-**request:** `UpsertUserRequestBody` +**request:** `UpsertTraitRequestBody`
@@ -12603,7 +12877,7 @@ client.companies.create_user(
-
client.companies.delete_user_by_keys(...) -> DeleteUserByKeysResponse +
client.companies.list_users(...) -> ListUsersResponse
@@ -12624,10 +12898,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.delete_user_by_keys( - keys={ - "key": "value" - }, +client.companies.list_users( + company_id="company_id", + ids=[ + "ids" + ], + plan_id="plan_id", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -12644,7 +12923,7 @@ client.companies.delete_user_by_keys(
-**request:** `KeysRequestBody` +**company_id:** `typing.Optional[str]` — Filter users by company ID (starts with comp_)
@@ -12652,23 +12931,63 @@ client.companies.delete_user_by_keys(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter users by multiple user IDs (starts with user_)
-
-
+
+
+**plan_id:** `typing.Optional[str]` — Filter users by plan ID (starts with plan_) +
-
-
client.companies.lookup_user(...) -> LookupUserResponse
-#### 🔌 Usage +**q:** `typing.Optional[str]` — Search for users by name, keys or string traits + +
+
+ +
+
+ +**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.companies.upsert_user(...) -> UpsertUserResponse +
+
+ +#### 🔌 Usage
@@ -12685,9 +13004,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.companies.lookup_user( +client.companies.upsert_user( keys={ - "keys": "keys" + "key": "value" }, ) @@ -12705,7 +13024,7 @@ client.companies.lookup_user(
-**keys:** `typing.Dict[str, str]` — Key/value pairs +**request:** `UpsertUserRequestBody`
@@ -12725,8 +13044,7 @@ client.companies.lookup_user(
-## entitlements -
client.entitlements.list_company_overrides(...) -> ListCompanyOverridesResponse +
client.companies.get_user(...) -> GetUserResponse
@@ -12747,22 +13065,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.list_company_overrides( - company_id="company_id", - company_ids=[ - "company_ids" - ], - feature_id="feature_id", - feature_ids=[ - "feature_ids" - ], - ids=[ - "ids" - ], - without_expired=True, - q="q", - limit=1000000, - offset=1000000, +client.companies.get_user( + user_id="user_id", ) ``` @@ -12779,7 +13083,7 @@ client.entitlements.list_company_overrides(
-**company_id:** `typing.Optional[str]` — Filter company overrides by a single company ID (starting with comp_) +**user_id:** `str` — user_id
@@ -12787,63 +13091,58 @@ client.entitlements.list_company_overrides(
-**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company IDs (starting with comp_) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**feature_id:** `typing.Optional[str]` — Filter company overrides by a single feature ID (starting with feat_) -
-
-
-**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple feature IDs (starting with feat_) -
+
+
client.companies.delete_user(...) -> DeleteUserResponse
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company override IDs (starting with cmov_) - -
-
+#### 🔌 Usage
-**without_expired:** `typing.Optional[bool]` — Filter company overrides by whether they have not expired - -
-
-
-**q:** `typing.Optional[str]` — Search for company overrides by feature or company name - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.companies.delete_user( + user_id="user_id", +) + +``` +
+
+#### ⚙️ Parameters +
-**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
-
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**user_id:** `str` — user_id
@@ -12863,7 +13162,7 @@ client.entitlements.list_company_overrides(
-
client.entitlements.create_company_override(...) -> CreateCompanyOverrideResponse +
client.companies.count_users(...) -> CountUsersResponse
@@ -12884,10 +13183,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.create_company_override( +client.companies.count_users( company_id="company_id", - feature_id="feature_id", - value_type="boolean", + ids=[ + "ids" + ], + plan_id="plan_id", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -12904,7 +13208,7 @@ client.entitlements.create_company_override(
-**company_id:** `str` +**company_id:** `typing.Optional[str]` — Filter users by company ID (starts with comp_)
@@ -12912,7 +13216,7 @@ client.entitlements.create_company_override(
-**feature_id:** `str` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter users by multiple user IDs (starts with user_)
@@ -12920,7 +13224,7 @@ client.entitlements.create_company_override(
-**value_type:** `EntitlementValueType` +**plan_id:** `typing.Optional[str]` — Filter users by plan ID (starts with plan_)
@@ -12928,7 +13232,7 @@ client.entitlements.create_company_override(
-**credit_consumption_rate:** `typing.Optional[float]` +**q:** `typing.Optional[str]` — Search for users by name, keys or string traits
@@ -12936,7 +13240,7 @@ client.entitlements.create_company_override(
-**expiration_date:** `typing.Optional[datetime.datetime]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -12944,7 +13248,7 @@ client.entitlements.create_company_override(
-**metric_period:** `typing.Optional[MetricPeriod]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -12952,47 +13256,60 @@ client.entitlements.create_company_override(
-**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**note:** `typing.Optional[str]` -
+
+
client.companies.create_user(...) -> CreateUserResponse
-**value_bool:** `typing.Optional[bool]` - -
-
+#### 🔌 Usage
-**value_credit_id:** `typing.Optional[str]` - -
-
-
-**value_numeric:** `typing.Optional[int]` - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.companies.create_user( + keys={ + "key": "value" + }, +) + +``` +
+
+#### ⚙️ Parameters +
-**value_trait_id:** `typing.Optional[str]` +
+
+ +**request:** `UpsertUserRequestBody`
@@ -13012,7 +13329,7 @@ client.entitlements.create_company_override(
-
client.entitlements.get_company_override(...) -> GetCompanyOverrideResponse +
client.companies.delete_user_by_keys(...) -> DeleteUserByKeysResponse
@@ -13033,8 +13350,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.get_company_override( - company_override_id="company_override_id", +client.companies.delete_user_by_keys( + keys={ + "key": "value" + }, ) ``` @@ -13051,7 +13370,7 @@ client.entitlements.get_company_override(
-**company_override_id:** `str` — company_override_id +**request:** `KeysRequestBody`
@@ -13071,7 +13390,7 @@ client.entitlements.get_company_override(
-
client.entitlements.update_company_override(...) -> UpdateCompanyOverrideResponse +
client.companies.lookup_user(...) -> LookupUserResponse
@@ -13092,9 +13411,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.update_company_override( - company_override_id="company_override_id", - value_type="boolean", +client.companies.lookup_user( + keys={ + "keys": "keys" + }, ) ``` @@ -13111,15 +13431,7 @@ client.entitlements.update_company_override(
-**company_override_id:** `str` — company_override_id - -
-
- -
-
- -**value_type:** `EntitlementValueType` +**keys:** `typing.Dict[str, str]` — Key/value pairs
@@ -13127,63 +13439,73 @@ client.entitlements.update_company_override(
-**credit_consumption_rate:** `typing.Optional[float]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**expiration_date:** `typing.Optional[datetime.datetime]` -
-
-
-**metric_period:** `typing.Optional[MetricPeriod]` -
+
+## entitlements +
client.entitlements.list_company_overrides(...) -> ListCompanyOverridesResponse
-**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` - -
-
+#### 🔌 Usage
-**note:** `typing.Optional[str]` - -
-
-
-**value_bool:** `typing.Optional[bool]` - -
-
- -
-
+```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment -**value_credit_id:** `typing.Optional[str]` - -
-
+client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.list_company_overrides( + company_id="company_id", + company_ids=[ + "company_ids" + ], + feature_id="feature_id", + feature_ids=[ + "feature_ids" + ], + ids=[ + "ids" + ], + without_expired=True, + q="q", + limit=1000000, + offset=1000000, +) + +``` + + + + + +#### ⚙️ Parameters
-**value_numeric:** `typing.Optional[int]` +
+
+ +**company_id:** `typing.Optional[str]` — Filter company overrides by a single company ID (starting with comp_)
@@ -13191,7 +13513,7 @@ client.entitlements.update_company_override(
-**value_trait_id:** `typing.Optional[str]` +**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company IDs (starting with comp_)
@@ -13199,58 +13521,55 @@ client.entitlements.update_company_override(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**feature_id:** `typing.Optional[str]` — Filter company overrides by a single feature ID (starting with feat_)
-
-
+
+
+**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple feature IDs (starting with feat_) +
-
-
client.entitlements.delete_company_override(...) -> DeleteCompanyOverrideResponse
-#### 🔌 Usage +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company override IDs (starting with cmov_) + +
+
+**without_expired:** `typing.Optional[bool]` — Filter company overrides by whether they have not expired + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.entitlements.delete_company_override( - company_override_id="company_override_id", -) - -``` -
-
+**q:** `typing.Optional[str]` — Search for company overrides by feature or company name + -#### ⚙️ Parameters -
+**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+
-**company_override_id:** `str` — company_override_id +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -13270,7 +13589,7 @@ client.entitlements.delete_company_override(
-
client.entitlements.count_company_overrides(...) -> CountCompanyOverridesResponse +
client.entitlements.create_company_override(...) -> CreateCompanyOverrideResponse
@@ -13291,22 +13610,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.count_company_overrides( +client.entitlements.create_company_override( company_id="company_id", - company_ids=[ - "company_ids" - ], feature_id="feature_id", - feature_ids=[ - "feature_ids" - ], - ids=[ - "ids" - ], - without_expired=True, - q="q", - limit=1000000, - offset=1000000, + value_type="boolean", ) ``` @@ -13323,23 +13630,7 @@ client.entitlements.count_company_overrides(
-**company_id:** `typing.Optional[str]` — Filter company overrides by a single company ID (starting with comp_) - -
-
- -
-
- -**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company IDs (starting with comp_) - -
-
- -
-
- -**feature_id:** `typing.Optional[str]` — Filter company overrides by a single feature ID (starting with feat_) +**company_id:** `str`
@@ -13347,7 +13638,7 @@ client.entitlements.count_company_overrides(
-**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple feature IDs (starting with feat_) +**feature_id:** `str`
@@ -13355,7 +13646,7 @@ client.entitlements.count_company_overrides(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company override IDs (starting with cmov_) +**value_type:** `EntitlementValueType`
@@ -13363,7 +13654,7 @@ client.entitlements.count_company_overrides(
-**without_expired:** `typing.Optional[bool]` — Filter company overrides by whether they have not expired +**credit_consumption_rate:** `typing.Optional[float]`
@@ -13371,7 +13662,7 @@ client.entitlements.count_company_overrides(
-**q:** `typing.Optional[str]` — Search for company overrides by feature or company name +**expiration_date:** `typing.Optional[datetime.datetime]`
@@ -13379,7 +13670,7 @@ client.entitlements.count_company_overrides(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**metric_period:** `typing.Optional[MetricPeriod]`
@@ -13387,7 +13678,7 @@ client.entitlements.count_company_overrides(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]`
@@ -13395,61 +13686,15 @@ client.entitlements.count_company_overrides(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**note:** `typing.Optional[str]`
-
-
- - - - -
- -
client.entitlements.list_feature_companies(...) -> ListFeatureCompaniesResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.entitlements.list_feature_companies( - feature_id="feature_id", - q="q", - limit=1000000, - offset=1000000, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
-**feature_id:** `str` +**value_bool:** `typing.Optional[bool]`
@@ -13457,7 +13702,7 @@ client.entitlements.list_feature_companies(
-**q:** `typing.Optional[str]` +**value_credit_id:** `typing.Optional[str]`
@@ -13465,7 +13710,7 @@ client.entitlements.list_feature_companies(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**value_numeric:** `typing.Optional[int]`
@@ -13473,7 +13718,7 @@ client.entitlements.list_feature_companies(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**value_trait_id:** `typing.Optional[str]`
@@ -13493,7 +13738,7 @@ client.entitlements.list_feature_companies(
-
client.entitlements.count_feature_companies(...) -> CountFeatureCompaniesResponse +
client.entitlements.get_company_override(...) -> GetCompanyOverrideResponse
@@ -13514,11 +13759,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.count_feature_companies( - feature_id="feature_id", - q="q", - limit=1000000, - offset=1000000, +client.entitlements.get_company_override( + company_override_id="company_override_id", ) ``` @@ -13535,31 +13777,7 @@ client.entitlements.count_feature_companies(
-**feature_id:** `str` - -
-
- -
-
- -**q:** `typing.Optional[str]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) +**company_override_id:** `str` — company_override_id
@@ -13579,7 +13797,7 @@ client.entitlements.count_feature_companies(
-
client.entitlements.list_feature_usage(...) -> ListFeatureUsageResponse +
client.entitlements.update_company_override(...) -> UpdateCompanyOverrideResponse
@@ -13600,17 +13818,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.list_feature_usage( - company_id="company_id", - feature_ids=[ - "feature_ids" - ], - include_usage_aggregation=True, - managed_by="metronome", - q="q", - without_negative_entitlements=True, - limit=1000000, - offset=1000000, +client.entitlements.update_company_override( + company_override_id="company_override_id", + value_type="boolean", ) ``` @@ -13627,7 +13837,7 @@ client.entitlements.list_feature_usage(
-**company_id:** `typing.Optional[str]` +**company_override_id:** `str` — company_override_id
@@ -13635,7 +13845,7 @@ client.entitlements.list_feature_usage(
-**company_keys:** `typing.Optional[typing.Dict[str, str]]` +**value_type:** `EntitlementValueType`
@@ -13643,7 +13853,7 @@ client.entitlements.list_feature_usage(
-**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**credit_consumption_rate:** `typing.Optional[float]`
@@ -13651,7 +13861,7 @@ client.entitlements.list_feature_usage(
-**include_usage_aggregation:** `typing.Optional[bool]` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. +**expiration_date:** `typing.Optional[datetime.datetime]`
@@ -13659,7 +13869,7 @@ client.entitlements.list_feature_usage(
-**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider) +**metric_period:** `typing.Optional[MetricPeriod]`
@@ -13667,7 +13877,7 @@ client.entitlements.list_feature_usage(
-**q:** `typing.Optional[str]` +**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]`
@@ -13675,7 +13885,7 @@ client.entitlements.list_feature_usage(
-**without_negative_entitlements:** `typing.Optional[bool]` +**note:** `typing.Optional[str]`
@@ -13683,7 +13893,7 @@ client.entitlements.list_feature_usage(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**value_bool:** `typing.Optional[bool]`
@@ -13691,7 +13901,7 @@ client.entitlements.list_feature_usage(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**value_credit_id:** `typing.Optional[str]`
@@ -13699,109 +13909,7 @@ client.entitlements.list_feature_usage(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - - - -
- -
client.entitlements.list_feature_usage_history(...) -> ListFeatureUsageHistoryResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment -import datetime - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.entitlements.list_feature_usage_history( - company_ids=[ - "company_ids" - ], - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - feature_ids=[ - "feature_ids" - ], - granularity="daily", - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - limit=1000000, - offset=1000000, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**end_time:** `datetime.datetime` — Exclusive end of the window; must fall on an hour boundary - -
-
- -
-
- -**start_time:** `datetime.datetime` — Inclusive start of the window; must fall on an hour boundary - -
-
- -
-
- -**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Restrict to these company IDs; omit for every company in the environment - -
-
- -
-
- -**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit - -
-
- -
-
- -**granularity:** `typing.Optional[TimeSeriesGranularity]` — Bucket the window; omit for a single total per company and feature - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) +**value_numeric:** `typing.Optional[int]`
@@ -13809,7 +13917,7 @@ client.entitlements.list_feature_usage_history(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**value_trait_id:** `typing.Optional[str]`
@@ -13829,7 +13937,7 @@ client.entitlements.list_feature_usage_history(
-
client.entitlements.get_feature_usage_time_series(...) -> GetFeatureUsageTimeSeriesResponse +
client.entitlements.delete_company_override(...) -> DeleteCompanyOverrideResponse
@@ -13844,19 +13952,14 @@ client.entitlements.list_feature_usage_history( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment -import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.get_feature_usage_time_series( - company_id="company_id", - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - feature_id="feature_id", - granularity="daily", - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), +client.entitlements.delete_company_override( + company_override_id="company_override_id", ) ``` @@ -13873,39 +13976,7 @@ client.entitlements.get_feature_usage_time_series(
-**company_id:** `str` - -
-
- -
-
- -**end_time:** `datetime.datetime` - -
-
- -
-
- -**feature_id:** `str` - -
-
- -
-
- -**start_time:** `datetime.datetime` - -
-
- -
-
- -**granularity:** `typing.Optional[TimeSeriesGranularity]` +**company_override_id:** `str` — company_override_id
@@ -13925,7 +13996,7 @@ client.entitlements.get_feature_usage_time_series(
-
client.entitlements.count_feature_usage(...) -> CountFeatureUsageResponse +
client.entitlements.count_company_overrides(...) -> CountCompanyOverridesResponse
@@ -13946,15 +14017,20 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.count_feature_usage( +client.entitlements.count_company_overrides( company_id="company_id", + company_ids=[ + "company_ids" + ], + feature_id="feature_id", feature_ids=[ "feature_ids" ], - include_usage_aggregation=True, - managed_by="metronome", + ids=[ + "ids" + ], + without_expired=True, q="q", - without_negative_entitlements=True, limit=1000000, offset=1000000, ) @@ -13973,7 +14049,7 @@ client.entitlements.count_feature_usage(
-**company_id:** `typing.Optional[str]` +**company_id:** `typing.Optional[str]` — Filter company overrides by a single company ID (starting with comp_)
@@ -13981,7 +14057,7 @@ client.entitlements.count_feature_usage(
-**company_keys:** `typing.Optional[typing.Dict[str, str]]` +**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company IDs (starting with comp_)
@@ -13989,7 +14065,7 @@ client.entitlements.count_feature_usage(
-**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**feature_id:** `typing.Optional[str]` — Filter company overrides by a single feature ID (starting with feat_)
@@ -13997,7 +14073,7 @@ client.entitlements.count_feature_usage(
-**include_usage_aggregation:** `typing.Optional[bool]` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple feature IDs (starting with feat_)
@@ -14005,7 +14081,7 @@ client.entitlements.count_feature_usage(
-**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider) +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter company overrides by multiple company override IDs (starting with cmov_)
@@ -14013,7 +14089,7 @@ client.entitlements.count_feature_usage(
-**q:** `typing.Optional[str]` +**without_expired:** `typing.Optional[bool]` — Filter company overrides by whether they have not expired
@@ -14021,7 +14097,7 @@ client.entitlements.count_feature_usage(
-**without_negative_entitlements:** `typing.Optional[bool]` +**q:** `typing.Optional[str]` — Search for company overrides by feature or company name
@@ -14057,7 +14133,7 @@ client.entitlements.count_feature_usage(
-
client.entitlements.list_feature_users(...) -> ListFeatureUsersResponse +
client.entitlements.list_feature_companies(...) -> ListFeatureCompaniesResponse
@@ -14078,7 +14154,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.list_feature_users( +client.entitlements.list_feature_companies( feature_id="feature_id", q="q", limit=1000000, @@ -14143,7 +14219,7 @@ client.entitlements.list_feature_users(
-
client.entitlements.count_feature_users(...) -> CountFeatureUsersResponse +
client.entitlements.count_feature_companies(...) -> CountFeatureCompaniesResponse
@@ -14164,7 +14240,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.count_feature_users( +client.entitlements.count_feature_companies( feature_id="feature_id", q="q", limit=1000000, @@ -14229,7 +14305,7 @@ client.entitlements.count_feature_users(
-
client.entitlements.list_plan_entitlements(...) -> ListPlanEntitlementsResponse +
client.entitlements.list_feature_usage(...) -> ListFeatureUsageResponse
@@ -14250,24 +14326,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.list_plan_entitlements( - feature_id="feature_id", +client.entitlements.list_feature_usage( + company_id="company_id", feature_ids=[ "feature_ids" ], - ids=[ - "ids" - ], - plan_id="plan_id", - plan_ids=[ - "plan_ids" - ], - plan_version_id="plan_version_id", - plan_version_ids=[ - "plan_version_ids" - ], + include_usage_aggregation=True, + managed_by="metronome", q="q", - with_metered_products=True, + without_negative_entitlements=True, limit=1000000, offset=1000000, ) @@ -14286,23 +14353,7 @@ client.entitlements.list_plan_entitlements(
-**feature_id:** `typing.Optional[str]` — Filter plan entitlements by a single feature ID (starting with feat_) - -
-
- -
-
- -**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple feature IDs (starting with feat_) - -
-
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) +**company_id:** `typing.Optional[str]`
@@ -14310,7 +14361,7 @@ client.entitlements.list_plan_entitlements(
-**plan_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan ID (starting with plan_) +**company_keys:** `typing.Optional[typing.Dict[str, str]]`
@@ -14318,7 +14369,7 @@ client.entitlements.list_plan_entitlements(
-**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan IDs (starting with plan_) +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -14326,7 +14377,7 @@ client.entitlements.list_plan_entitlements(
-**plan_version_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan version ID (starting with plvr_) +**include_usage_aggregation:** `typing.Optional[bool]` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.
@@ -14334,7 +14385,7 @@ client.entitlements.list_plan_entitlements(
-**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan version IDs (starting with plvr_) +**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider)
@@ -14342,7 +14393,7 @@ client.entitlements.list_plan_entitlements(
-**q:** `typing.Optional[str]` — Search for plan entitlements by feature or company name +**q:** `typing.Optional[str]`
@@ -14350,7 +14401,7 @@ client.entitlements.list_plan_entitlements(
-**with_metered_products:** `typing.Optional[bool]` — Filter plan entitlements only with metered products +**without_negative_entitlements:** `typing.Optional[bool]`
@@ -14386,7 +14437,7 @@ client.entitlements.list_plan_entitlements(
-
client.entitlements.create_plan_entitlement(...) -> CreatePlanEntitlementResponse +
client.entitlements.list_feature_usage_history(...) -> ListFeatureUsageHistoryResponse
@@ -14401,16 +14452,25 @@ client.entitlements.list_plan_entitlements( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment +import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.create_plan_entitlement( - feature_id="feature_id", - plan_id="plan_id", - value_type="boolean", +client.entitlements.list_feature_usage_history( + company_ids=[ + "company_ids" + ], + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + feature_ids=[ + "feature_ids" + ], + granularity="daily", + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + limit=1000000, + offset=1000000, ) ``` @@ -14427,7 +14487,7 @@ client.entitlements.create_plan_entitlement(
-**feature_id:** `str` +**end_time:** `datetime.datetime` — Exclusive end of the window; must fall on an hour boundary
@@ -14435,7 +14495,7 @@ client.entitlements.create_plan_entitlement(
-**plan_id:** `str` +**start_time:** `datetime.datetime` — Inclusive start of the window; must fall on an hour boundary
@@ -14443,7 +14503,7 @@ client.entitlements.create_plan_entitlement(
-**value_type:** `EntitlementValueType` +**company_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Restrict to these company IDs; omit for every company in the environment
@@ -14451,7 +14511,7 @@ client.entitlements.create_plan_entitlement(
-**billing_product_id:** `typing.Optional[str]` +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit
@@ -14459,7 +14519,7 @@ client.entitlements.create_plan_entitlement(
-**billing_threshold:** `typing.Optional[int]` +**granularity:** `typing.Optional[TimeSeriesGranularity]` — Bucket the window; omit for a single total per company and feature
@@ -14467,7 +14527,7 @@ client.entitlements.create_plan_entitlement(
-**credit_consumption_rate:** `typing.Optional[float]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -14475,7 +14535,7 @@ client.entitlements.create_plan_entitlement(
-**currency:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -14483,63 +14543,63 @@ client.entitlements.create_plan_entitlement(
-**currency_prices:** `typing.Optional[typing.List[CurrencyPriceRequestBody]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**metric_period:** `typing.Optional[MetricPeriod]` -
-
-
-**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` -
+
+
client.entitlements.get_feature_usage_time_series(...) -> GetFeatureUsageTimeSeriesResponse
-**monthly_metered_price_id:** `typing.Optional[str]` - -
-
+#### 🔌 Usage
-**monthly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` - -
-
-
-**monthly_unit_price:** `typing.Optional[int]` - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment +import datetime + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.get_feature_usage_time_series( + company_id="company_id", + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + feature_id="feature_id", + granularity="daily", + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), +) + +``` +
+
+#### ⚙️ Parameters +
-**monthly_unit_price_decimal:** `typing.Optional[str]` - -
-
-
-**overage_billing_product_id:** `typing.Optional[str]` +**company_id:** `str`
@@ -14547,7 +14607,7 @@ client.entitlements.create_plan_entitlement(
-**plan_version_id:** `typing.Optional[str]` +**end_time:** `datetime.datetime`
@@ -14555,7 +14615,7 @@ client.entitlements.create_plan_entitlement(
-**price_behavior:** `typing.Optional[EntitlementPriceBehavior]` +**feature_id:** `str`
@@ -14563,7 +14623,7 @@ client.entitlements.create_plan_entitlement(
-**price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` — Use MonthlyPriceTiers or YearlyPriceTiers instead +**start_time:** `datetime.datetime`
@@ -14571,7 +14631,7 @@ client.entitlements.create_plan_entitlement(
-**quarterly_metered_price_id:** `typing.Optional[str]` +**granularity:** `typing.Optional[TimeSeriesGranularity]`
@@ -14579,55 +14639,67 @@ client.entitlements.create_plan_entitlement(
-**quarterly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ + -
-
-**quarterly_unit_price:** `typing.Optional[int]` -
+
+
client.entitlements.count_feature_usage(...) -> CountFeatureUsageResponse
-**quarterly_unit_price_decimal:** `typing.Optional[str]` - -
-
+#### 🔌 Usage
-**soft_limit:** `typing.Optional[int]` - -
-
-
-**tier_mode:** `typing.Optional[BillingTiersMode]` - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.count_feature_usage( + company_id="company_id", + feature_ids=[ + "feature_ids" + ], + include_usage_aggregation=True, + managed_by="metronome", + q="q", + without_negative_entitlements=True, + limit=1000000, + offset=1000000, +) + +``` +
+
+#### ⚙️ Parameters +
-**usage_quantity:** `typing.Optional[int]` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. - -
-
-
-**value_bool:** `typing.Optional[bool]` +**company_id:** `typing.Optional[str]`
@@ -14635,7 +14707,7 @@ client.entitlements.create_plan_entitlement(
-**value_credit_id:** `typing.Optional[str]` +**company_keys:** `typing.Optional[typing.Dict[str, str]]`
@@ -14643,7 +14715,7 @@ client.entitlements.create_plan_entitlement(
-**value_numeric:** `typing.Optional[int]` +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -14651,7 +14723,7 @@ client.entitlements.create_plan_entitlement(
-**value_trait_id:** `typing.Optional[str]` +**include_usage_aggregation:** `typing.Optional[bool]` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.
@@ -14659,7 +14731,7 @@ client.entitlements.create_plan_entitlement(
-**warning_tiers:** `typing.Optional[typing.List[WarningTierRequestBody]]` +**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider)
@@ -14667,7 +14739,7 @@ client.entitlements.create_plan_entitlement(
-**yearly_metered_price_id:** `typing.Optional[str]` +**q:** `typing.Optional[str]`
@@ -14675,7 +14747,7 @@ client.entitlements.create_plan_entitlement(
-**yearly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` +**without_negative_entitlements:** `typing.Optional[bool]`
@@ -14683,7 +14755,7 @@ client.entitlements.create_plan_entitlement(
-**yearly_unit_price:** `typing.Optional[int]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -14691,7 +14763,7 @@ client.entitlements.create_plan_entitlement(
-**yearly_unit_price_decimal:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -14711,7 +14783,7 @@ client.entitlements.create_plan_entitlement(
-
client.entitlements.get_plan_entitlement(...) -> GetPlanEntitlementResponse +
client.entitlements.list_feature_users(...) -> ListFeatureUsersResponse
@@ -14732,8 +14804,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.get_plan_entitlement( - plan_entitlement_id="plan_entitlement_id", +client.entitlements.list_feature_users( + feature_id="feature_id", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -14750,7 +14825,31 @@ client.entitlements.get_plan_entitlement(
-**plan_entitlement_id:** `str` — plan_entitlement_id +**feature_id:** `str` + +
+
+ +
+
+ +**q:** `typing.Optional[str]` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -14770,7 +14869,7 @@ client.entitlements.get_plan_entitlement(
-
client.entitlements.update_plan_entitlement(...) -> UpdatePlanEntitlementResponse +
client.entitlements.count_feature_users(...) -> CountFeatureUsersResponse
@@ -14791,9 +14890,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.update_plan_entitlement( - plan_entitlement_id="plan_entitlement_id", - value_type="boolean", +client.entitlements.count_feature_users( + feature_id="feature_id", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -14810,23 +14911,7 @@ client.entitlements.update_plan_entitlement(
-**plan_entitlement_id:** `str` — plan_entitlement_id - -
-
- -
-
- -**value_type:** `EntitlementValueType` - -
-
- -
-
- -**billing_product_id:** `typing.Optional[str]` +**feature_id:** `str`
@@ -14834,7 +14919,7 @@ client.entitlements.update_plan_entitlement(
-**billing_threshold:** `typing.Optional[int]` +**q:** `typing.Optional[str]`
@@ -14842,7 +14927,7 @@ client.entitlements.update_plan_entitlement(
-**credit_consumption_rate:** `typing.Optional[float]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -14850,7 +14935,7 @@ client.entitlements.update_plan_entitlement(
-**currency:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -14858,143 +14943,76 @@ client.entitlements.update_plan_entitlement(
-**currency_prices:** `typing.Optional[typing.List[CurrencyPriceRequestBody]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**metric_period:** `typing.Optional[MetricPeriod]` -
-
-
-**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` -
+
+
client.entitlements.list_plan_entitlements(...) -> ListPlanEntitlementsResponse
-**monthly_metered_price_id:** `typing.Optional[str]` - -
-
+#### 🔌 Usage
-**monthly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` - -
-
-
-**monthly_unit_price:** `typing.Optional[int]` - -
-
+```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment -
-
+client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) -**monthly_unit_price_decimal:** `typing.Optional[str]` - -
-
- -
-
- -**overage_billing_product_id:** `typing.Optional[str]` - -
-
- -
-
- -**price_behavior:** `typing.Optional[EntitlementPriceBehavior]` - -
-
- -
-
- -**price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` — Use MonthlyPriceTiers or YearlyPriceTiers instead - -
-
- -
-
- -**quarterly_metered_price_id:** `typing.Optional[str]` - -
-
- -
-
- -**quarterly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` - -
-
- -
-
- -**quarterly_unit_price:** `typing.Optional[int]` - -
-
- -
-
+client.entitlements.list_plan_entitlements( + feature_id="feature_id", + feature_ids=[ + "feature_ids" + ], + ids=[ + "ids" + ], + plan_id="plan_id", + plan_ids=[ + "plan_ids" + ], + plan_version_id="plan_version_id", + plan_version_ids=[ + "plan_version_ids" + ], + q="q", + with_metered_products=True, + limit=1000000, + offset=1000000, +) -**quarterly_unit_price_decimal:** `typing.Optional[str]` - +```
- -
-
- -**soft_limit:** `typing.Optional[int]` -
-
-
- -**tier_mode:** `typing.Optional[BillingTiersMode]` - -
-
+#### ⚙️ Parameters
-**usage_quantity:** `typing.Optional[int]` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. - -
-
-
-**value_bool:** `typing.Optional[bool]` +**feature_id:** `typing.Optional[str]` — Filter plan entitlements by a single feature ID (starting with feat_)
@@ -15002,7 +15020,7 @@ client.entitlements.update_plan_entitlement(
-**value_credit_id:** `typing.Optional[str]` +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple feature IDs (starting with feat_)
@@ -15010,7 +15028,7 @@ client.entitlements.update_plan_entitlement(
-**value_numeric:** `typing.Optional[int]` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)
@@ -15018,7 +15036,7 @@ client.entitlements.update_plan_entitlement(
-**value_trait_id:** `typing.Optional[str]` +**plan_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan ID (starting with plan_)
@@ -15026,7 +15044,7 @@ client.entitlements.update_plan_entitlement(
-**warning_tiers:** `typing.Optional[typing.List[WarningTierRequestBody]]` +**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan IDs (starting with plan_)
@@ -15034,7 +15052,7 @@ client.entitlements.update_plan_entitlement(
-**yearly_metered_price_id:** `typing.Optional[str]` +**plan_version_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan version ID (starting with plvr_)
@@ -15042,7 +15060,7 @@ client.entitlements.update_plan_entitlement(
-**yearly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` +**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan version IDs (starting with plvr_)
@@ -15050,7 +15068,7 @@ client.entitlements.update_plan_entitlement(
-**yearly_unit_price:** `typing.Optional[int]` +**q:** `typing.Optional[str]` — Search for plan entitlements by feature or company name
@@ -15058,7 +15076,7 @@ client.entitlements.update_plan_entitlement(
-**yearly_unit_price_decimal:** `typing.Optional[str]` +**with_metered_products:** `typing.Optional[bool]` — Filter plan entitlements only with metered products
@@ -15066,58 +15084,15 @@ client.entitlements.update_plan_entitlement(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**limit:** `typing.Optional[int]` — Page limit (default 100)
- - - - - - -
- -
client.entitlements.delete_plan_entitlement(...) -> DeletePlanEntitlementResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.entitlements.delete_plan_entitlement( - plan_entitlement_id="plan_entitlement_id", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
-**plan_entitlement_id:** `str` — plan_entitlement_id +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -15137,7 +15112,7 @@ client.entitlements.delete_plan_entitlement(
-
client.entitlements.upsert_plan_entitlement_for_billing_product(...) -> UpsertPlanEntitlementForBillingProductResponse +
client.entitlements.create_plan_entitlement(...) -> CreatePlanEntitlementResponse
@@ -15158,9 +15133,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.upsert_plan_entitlement_for_billing_product( - billing_provider="metronome", - external_resource_id="external_resource_id", +client.entitlements.create_plan_entitlement( feature_id="feature_id", plan_id="plan_id", value_type="boolean", @@ -15180,22 +15153,6 @@ client.entitlements.upsert_plan_entitlement_for_billing_product(
-**billing_provider:** `BillingProviderType` - -
-
- -
-
- -**external_resource_id:** `str` - -
-
- -
-
- **feature_id:** `str`
@@ -15480,7 +15437,7 @@ client.entitlements.upsert_plan_entitlement_for_billing_product(
-
client.entitlements.count_plan_entitlements(...) -> CountPlanEntitlementsResponse +
client.entitlements.get_plan_entitlement(...) -> GetPlanEntitlementResponse
@@ -15501,26 +15458,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.count_plan_entitlements( - feature_id="feature_id", - feature_ids=[ - "feature_ids" - ], - ids=[ - "ids" - ], - plan_id="plan_id", - plan_ids=[ - "plan_ids" - ], - plan_version_id="plan_version_id", - plan_version_ids=[ - "plan_version_ids" - ], - q="q", - with_metered_products=True, - limit=1000000, - offset=1000000, +client.entitlements.get_plan_entitlement( + plan_entitlement_id="plan_entitlement_id", ) ``` @@ -15537,7 +15476,7 @@ client.entitlements.count_plan_entitlements(
-**feature_id:** `typing.Optional[str]` — Filter plan entitlements by a single feature ID (starting with feat_) +**plan_entitlement_id:** `str` — plan_entitlement_id
@@ -15545,39 +15484,59 @@ client.entitlements.count_plan_entitlements(
-**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple feature IDs (starting with feat_) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) -
+
+
client.entitlements.update_plan_entitlement(...) -> UpdatePlanEntitlementResponse
-**plan_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan ID (starting with plan_) - -
-
+#### 🔌 Usage
-**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan IDs (starting with plan_) - +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.update_plan_entitlement( + plan_entitlement_id="plan_entitlement_id", + value_type="boolean", +) + +``` +
+
+#### ⚙️ Parameters +
-**plan_version_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan version ID (starting with plvr_) +
+
+ +**plan_entitlement_id:** `str` — plan_entitlement_id
@@ -15585,7 +15544,774 @@ client.entitlements.count_plan_entitlements(
-**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan version IDs (starting with plvr_) +**value_type:** `EntitlementValueType` + +
+
+ +
+
+ +**billing_product_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**billing_threshold:** `typing.Optional[int]` + +
+
+ +
+
+ +**credit_consumption_rate:** `typing.Optional[float]` + +
+
+ +
+
+ +**currency:** `typing.Optional[str]` + +
+
+ +
+
+ +**currency_prices:** `typing.Optional[typing.List[CurrencyPriceRequestBody]]` + +
+
+ +
+
+ +**metric_period:** `typing.Optional[MetricPeriod]` + +
+
+ +
+
+ +**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` + +
+
+ +
+
+ +**monthly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**monthly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**monthly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**monthly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**overage_billing_product_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**price_behavior:** `typing.Optional[EntitlementPriceBehavior]` + +
+
+ +
+
+ +**price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` — Use MonthlyPriceTiers or YearlyPriceTiers instead + +
+
+ +
+
+ +**quarterly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**quarterly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**quarterly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**quarterly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**soft_limit:** `typing.Optional[int]` + +
+
+ +
+
+ +**tier_mode:** `typing.Optional[BillingTiersMode]` + +
+
+ +
+
+ +**usage_quantity:** `typing.Optional[int]` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + +
+
+ +
+
+ +**value_bool:** `typing.Optional[bool]` + +
+
+ +
+
+ +**value_credit_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**value_numeric:** `typing.Optional[int]` + +
+
+ +
+
+ +**value_trait_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**warning_tiers:** `typing.Optional[typing.List[WarningTierRequestBody]]` + +
+
+ +
+
+ +**yearly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**yearly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**yearly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**yearly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + + + +
+ +
client.entitlements.delete_plan_entitlement(...) -> DeletePlanEntitlementResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.delete_plan_entitlement( + plan_entitlement_id="plan_entitlement_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**plan_entitlement_id:** `str` — plan_entitlement_id + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.entitlements.upsert_plan_entitlement_for_billing_product(...) -> UpsertPlanEntitlementForBillingProductResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.upsert_plan_entitlement_for_billing_product( + billing_provider="metronome", + external_resource_id="external_resource_id", + feature_id="feature_id", + plan_id="plan_id", + value_type="boolean", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_provider:** `BillingProviderType` + +
+
+ +
+
+ +**external_resource_id:** `str` + +
+
+ +
+
+ +**feature_id:** `str` + +
+
+ +
+
+ +**plan_id:** `str` + +
+
+ +
+
+ +**value_type:** `EntitlementValueType` + +
+
+ +
+
+ +**billing_product_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**billing_threshold:** `typing.Optional[int]` + +
+
+ +
+
+ +**credit_consumption_rate:** `typing.Optional[float]` + +
+
+ +
+
+ +**currency:** `typing.Optional[str]` + +
+
+ +
+
+ +**currency_prices:** `typing.Optional[typing.List[CurrencyPriceRequestBody]]` + +
+
+ +
+
+ +**metric_period:** `typing.Optional[MetricPeriod]` + +
+
+ +
+
+ +**metric_period_month_reset:** `typing.Optional[MetricPeriodMonthReset]` + +
+
+ +
+
+ +**monthly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**monthly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**monthly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**monthly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**overage_billing_product_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**plan_version_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**price_behavior:** `typing.Optional[EntitlementPriceBehavior]` + +
+
+ +
+
+ +**price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` — Use MonthlyPriceTiers or YearlyPriceTiers instead + +
+
+ +
+
+ +**quarterly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**quarterly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**quarterly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**quarterly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**soft_limit:** `typing.Optional[int]` + +
+
+ +
+
+ +**tier_mode:** `typing.Optional[BillingTiersMode]` + +
+
+ +
+
+ +**usage_quantity:** `typing.Optional[int]` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + +
+
+ +
+
+ +**value_bool:** `typing.Optional[bool]` + +
+
+ +
+
+ +**value_credit_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**value_numeric:** `typing.Optional[int]` + +
+
+ +
+
+ +**value_trait_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**warning_tiers:** `typing.Optional[typing.List[WarningTierRequestBody]]` + +
+
+ +
+
+ +**yearly_metered_price_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**yearly_price_tiers:** `typing.Optional[typing.List[CreatePriceTierRequestBody]]` + +
+
+ +
+
+ +**yearly_unit_price:** `typing.Optional[int]` + +
+
+ +
+
+ +**yearly_unit_price_decimal:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.entitlements.count_plan_entitlements(...) -> CountPlanEntitlementsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.count_plan_entitlements( + feature_id="feature_id", + feature_ids=[ + "feature_ids" + ], + ids=[ + "ids" + ], + plan_id="plan_id", + plan_ids=[ + "plan_ids" + ], + plan_version_id="plan_version_id", + plan_version_ids=[ + "plan_version_ids" + ], + q="q", + with_metered_products=True, + limit=1000000, + offset=1000000, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**feature_id:** `typing.Optional[str]` — Filter plan entitlements by a single feature ID (starting with feat_) + +
+
+ +
+
+ +**feature_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple feature IDs (starting with feat_) + +
+
+ +
+
+ +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) + +
+
+ +
+
+ +**plan_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan ID (starting with plan_) + +
+
+ +
+
+ +**plan_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan IDs (starting with plan_) + +
+
+ +
+
+ +**plan_version_id:** `typing.Optional[str]` — Filter plan entitlements by a single plan version ID (starting with plvr_) + +
+
+ +
+
+ +**plan_version_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter plan entitlements by multiple plan version IDs (starting with plvr_)
@@ -15601,7 +16327,91 @@ client.entitlements.count_plan_entitlements(
-**with_metered_products:** `typing.Optional[bool]` — Filter plan entitlements only with metered products +**with_metered_products:** `typing.Optional[bool]` — Filter plan entitlements only with metered products + +
+
+ +
+
+ +**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.entitlements.duplicate_plan_entitlements(...) -> DuplicatePlanEntitlementsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.duplicate_plan_entitlements( + source_plan_id="source_plan_id", + target_plan_id="target_plan_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**source_plan_id:** `str` + +
+
+ +
+
+ +**target_plan_id:** `str`
@@ -15609,15 +16419,60 @@ client.entitlements.count_plan_entitlements(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+ +
+
+
+ +
client.entitlements.get_feature_usage_by_company(...) -> GetFeatureUsageByCompanyResponse
-**offset:** `typing.Optional[int]` — Page offset (default 0) +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.get_feature_usage_by_company( + keys={ + "keys": "keys" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**keys:** `typing.Dict[str, str]` — Key/value pairs
@@ -15637,7 +16492,7 @@ client.entitlements.count_plan_entitlements(
-
client.entitlements.duplicate_plan_entitlements(...) -> DuplicatePlanEntitlementsResponse +
client.entitlements.get_user_usage_by_company(...) -> GetUserUsageByCompanyResponse
@@ -15652,15 +16507,18 @@ client.entitlements.count_plan_entitlements( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment +import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.duplicate_plan_entitlements( - source_plan_id="source_plan_id", - target_plan_id="target_plan_id", +client.entitlements.get_user_usage_by_company( + company_id="company_id", + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + feature_id="feature_id", + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), ) ``` @@ -15677,7 +16535,189 @@ client.entitlements.duplicate_plan_entitlements(
-**source_plan_id:** `str` +**company_id:** `str` — Company to break usage down for + +
+
+ +
+
+ +**end_time:** `typing.Optional[datetime.datetime]` — End of the usage window (exclusive); defaults to now + +
+
+ +
+
+ +**feature_id:** `typing.Optional[str]` — Restrict to a single event-based feature + +
+
+ +
+
+ +**start_time:** `typing.Optional[datetime.datetime]` — Start of the usage window; defaults to 30 days before the end + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + + + +
+ +
client.entitlements.get_user_usage_detail(...) -> GetUserUsageDetailResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment +import datetime + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.entitlements.get_user_usage_detail( + company_id="company_id", + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + user_id="user_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_id:** `str` — Company the user belongs to + +
+
+ +
+
+ +**user_id:** `str` — User to break usage down for + +
+
+ +
+
+ +**end_time:** `typing.Optional[datetime.datetime]` — End of the usage window (exclusive); defaults to now + +
+
+ +
+
+ +**start_time:** `typing.Optional[datetime.datetime]` — Start of the usage window; defaults to 30 days before the end + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## plans +
client.plans.update_company_plans(...) -> UpdateCompanyPlansResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.plans.update_company_plans( + company_id="company_id", + add_on_ids=[ + "add_on_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_id:** `str` — company_id + +
+
+ +
+
+ +**add_on_ids:** `typing.List[str]`
@@ -15685,7 +16725,7 @@ client.entitlements.duplicate_plan_entitlements(
-**target_plan_id:** `str` +**base_plan_id:** `typing.Optional[str]`
@@ -15705,7 +16745,7 @@ client.entitlements.duplicate_plan_entitlements(
-
client.entitlements.get_feature_usage_by_company(...) -> GetFeatureUsageByCompanyResponse +
client.plans.list_custom_plan_billings(...) -> ListCustomPlanBillingsResponse
@@ -15726,10 +16766,16 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.get_feature_usage_by_company( - keys={ - "keys": "keys" - }, +client.plans.list_custom_plan_billings( + company_id="company_id", + plan_id="plan_id", + plan_billing_source="custom_plan", + status="active", + statuses=[ + "active" + ], + limit=1000000, + offset=1000000, ) ``` @@ -15746,7 +16792,7 @@ client.entitlements.get_feature_usage_by_company(
-**keys:** `typing.Dict[str, str]` — Key/value pairs +**company_id:** `typing.Optional[str]` — Filter by company ID
@@ -15754,62 +16800,23 @@ client.entitlements.get_feature_usage_by_company(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**plan_id:** `typing.Optional[str]` — Filter by plan ID
-
-
- - - - -
- -
client.entitlements.get_user_usage_by_company(...) -> GetUserUsageByCompanyResponse -
-
- -#### 🔌 Usage - -
-
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment -import datetime - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.entitlements.get_user_usage_by_company( - company_id="company_id", - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - feature_id="feature_id", - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), -) - -``` -
-
+**plan_billing_source:** `typing.Optional[PlanBillingSource]` — Filter by the flow that created the billing record. Defaults to custom_plan. +
-#### ⚙️ Parameters - -
-
-
-**company_id:** `str` — Company to break usage down for +**status:** `typing.Optional[CustomPlanBillingStatus]` — Filter by billing status
@@ -15817,7 +16824,7 @@ client.entitlements.get_user_usage_by_company(
-**end_time:** `typing.Optional[datetime.datetime]` — End of the usage window (exclusive); defaults to now +**statuses:** `typing.Optional[typing.Union[CustomPlanBillingStatus, typing.Sequence[CustomPlanBillingStatus]]]` — Filter by multiple billing statuses
@@ -15825,7 +16832,7 @@ client.entitlements.get_user_usage_by_company(
-**feature_id:** `typing.Optional[str]` — Restrict to a single event-based feature +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -15833,7 +16840,7 @@ client.entitlements.get_user_usage_by_company(
-**start_time:** `typing.Optional[datetime.datetime]` — Start of the usage window; defaults to 30 days before the end +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -15853,7 +16860,7 @@ client.entitlements.get_user_usage_by_company(
-
client.entitlements.get_user_usage_detail(...) -> GetUserUsageDetailResponse +
client.plans.mark_custom_plan_billing_paid(...) -> MarkCustomPlanBillingPaidResponse
@@ -15868,18 +16875,17 @@ client.entitlements.get_user_usage_by_company( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment -import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.entitlements.get_user_usage_detail( - company_id="company_id", - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - user_id="user_id", +client.plans.mark_custom_plan_billing_paid( + custom_plan_billing_id="custom_plan_billing_id", + request={ + "key": "value" + }, ) ``` @@ -15896,23 +16902,7 @@ client.entitlements.get_user_usage_detail(
-**company_id:** `str` — Company the user belongs to - -
-
- -
-
- -**user_id:** `str` — User to break usage down for - -
-
- -
-
- -**end_time:** `typing.Optional[datetime.datetime]` — End of the usage window (exclusive); defaults to now +**custom_plan_billing_id:** `str` — custom_plan_billing_id
@@ -15920,7 +16910,7 @@ client.entitlements.get_user_usage_detail(
-**start_time:** `typing.Optional[datetime.datetime]` — Start of the usage window; defaults to 30 days before the end +**request:** `MarkCustomPlanBillingPaidRequestBody`
@@ -15940,8 +16930,7 @@ client.entitlements.get_user_usage_detail(
-## plans -
client.plans.update_company_plans(...) -> UpdateCompanyPlansResponse +
client.plans.retry_custom_plan_billing(...) -> RetryCustomPlanBillingResponse
@@ -15962,11 +16951,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.update_company_plans( - company_id="company_id", - add_on_ids=[ - "add_on_ids" - ], +client.plans.retry_custom_plan_billing( + custom_plan_billing_id="custom_plan_billing_id", + customer_email="customer_email", ) ``` @@ -15983,7 +16970,7 @@ client.plans.update_company_plans(
-**company_id:** `str` — company_id +**custom_plan_billing_id:** `str` — custom_plan_billing_id
@@ -15991,7 +16978,7 @@ client.plans.update_company_plans(
-**add_on_ids:** `typing.List[str]` +**customer_email:** `str`
@@ -15999,7 +16986,39 @@ client.plans.update_company_plans(
-**base_plan_id:** `typing.Optional[str]` +**activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]` + +
+
+ +
+
+ +**billing_cycle_anchor:** `typing.Optional[datetime.datetime]` — The date the subscription's billing period renews on. Only honored when the retry creates a subscription. + +
+
+ +
+
+ +**days_until_due:** `typing.Optional[int]` + +
+
+ +
+
+ +**prorate_first_period:** `typing.Optional[bool]` — When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true. + +
+
+ +
+
+ +**send_invoice:** `typing.Optional[bool]` — Whether Stripe emails the invoice when it is finalized. Defaults to true.
@@ -16019,7 +17038,7 @@ client.plans.update_company_plans(
-
client.plans.list_custom_plan_billings(...) -> ListCustomPlanBillingsResponse +
client.plans.create_custom_plan(...) -> CreateCustomPlanResponse
@@ -16040,16 +17059,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.list_custom_plan_billings( +client.plans.create_custom_plan( company_id="company_id", - plan_id="plan_id", - plan_billing_source="custom_plan", - status="active", - statuses=[ - "active" - ], - limit=1000000, - offset=1000000, + name="name", ) ``` @@ -16066,15 +17078,7 @@ client.plans.list_custom_plan_billings(
-**company_id:** `typing.Optional[str]` — Filter by company ID - -
-
- -
-
- -**plan_id:** `typing.Optional[str]` — Filter by plan ID +**company_id:** `str`
@@ -16082,7 +17086,7 @@ client.plans.list_custom_plan_billings(
-**plan_billing_source:** `typing.Optional[PlanBillingSource]` — Filter by the flow that created the billing record. Defaults to custom_plan. +**name:** `str`
@@ -16090,7 +17094,7 @@ client.plans.list_custom_plan_billings(
-**status:** `typing.Optional[CustomPlanBillingStatus]` — Filter by billing status +**copied_from_plan_id:** `typing.Optional[str]`
@@ -16098,7 +17102,7 @@ client.plans.list_custom_plan_billings(
-**statuses:** `typing.Optional[typing.Union[CustomPlanBillingStatus, typing.Sequence[CustomPlanBillingStatus]]]` — Filter by multiple billing statuses +**copied_price_id:** `typing.Optional[str]`
@@ -16106,7 +17110,7 @@ client.plans.list_custom_plan_billings(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**description:** `typing.Optional[str]`
@@ -16114,7 +17118,7 @@ client.plans.list_custom_plan_billings(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**icon:** `typing.Optional[PlanIcon]`
@@ -16134,7 +17138,7 @@ client.plans.list_custom_plan_billings(
-
client.plans.mark_custom_plan_billing_paid(...) -> MarkCustomPlanBillingPaidResponse +
client.plans.list_plans(...) -> ListPlansResponse
@@ -16155,11 +17159,26 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.mark_custom_plan_billing_paid( - custom_plan_billing_id="custom_plan_billing_id", - request={ - "key": "value" - }, +client.plans.list_plans( + company_id="company_id", + company_scoped_only=True, + exclude_company_scoped=True, + for_fallback_plan=True, + for_initial_plan=True, + for_trial_expiry_plan=True, + has_product_id=True, + ids=[ + "ids" + ], + include_draft_versions=True, + plan_type="plan", + q="q", + scoped_to_company_id="scoped_to_company_id", + with_entitlements=True, + without_entitlement_for="without_entitlement_for", + without_paid_product_id=True, + limit=1000000, + offset=1000000, ) ``` @@ -16176,7 +17195,7 @@ client.plans.mark_custom_plan_billing_paid(
-**custom_plan_billing_id:** `str` — custom_plan_billing_id +**company_id:** `typing.Optional[str]`
@@ -16184,7 +17203,7 @@ client.plans.mark_custom_plan_billing_paid(
-**request:** `MarkCustomPlanBillingPaidRequestBody` +**company_scoped_only:** `typing.Optional[bool]` — Only return plans that are scoped to a company (custom plans assigned to a company)
@@ -16192,59 +17211,71 @@ client.plans.mark_custom_plan_billing_paid(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**exclude_company_scoped:** `typing.Optional[bool]` — Exclude plans that are scoped to a company (custom plans assigned to a company)
-
-
+
+
+**for_fallback_plan:** `typing.Optional[bool]` — Filter for plans valid as fallback plans (not linked to billing) +
-
-
client.plans.retry_custom_plan_billing(...) -> RetryCustomPlanBillingResponse
-#### 🔌 Usage +**for_initial_plan:** `typing.Optional[bool]` — Filter for plans valid as initial plans (not linked to billing, free, or auto-cancelling trial) + +
+
+**for_trial_expiry_plan:** `typing.Optional[bool]` — Filter for plans valid as trial expiry plans (not linked to billing or free) + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) +**has_product_id:** `typing.Optional[bool]` — Filter out plans that do not have a billing product ID + +
+
-client.plans.retry_custom_plan_billing( - custom_plan_billing_id="custom_plan_billing_id", - customer_email="customer_email", -) +
+
-``` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +
+ +
+
+ +**include_draft_versions:** `typing.Optional[bool]` — Include billing settings from draft versions for plans which have draft version +
-#### ⚙️ Parameters -
+**plan_type:** `typing.Optional[PlanType]` — Filter by plan type + +
+
+
-**custom_plan_billing_id:** `str` — custom_plan_billing_id +**q:** `typing.Optional[str]`
@@ -16252,7 +17283,7 @@ client.plans.retry_custom_plan_billing(
-**customer_email:** `str` +**scoped_to_company_id:** `typing.Optional[str]` — Filter plans scoped to a specific company (custom plans)
@@ -16260,7 +17291,7 @@ client.plans.retry_custom_plan_billing(
-**activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]` +**with_entitlements:** `typing.Optional[bool]` — Include each plan's entitlements in the response
@@ -16268,7 +17299,7 @@ client.plans.retry_custom_plan_billing(
-**billing_cycle_anchor:** `typing.Optional[datetime.datetime]` — The date the subscription's billing period renews on. Only honored when the retry creates a subscription. +**without_entitlement_for:** `typing.Optional[str]` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -16276,7 +17307,7 @@ client.plans.retry_custom_plan_billing(
-**days_until_due:** `typing.Optional[int]` +**without_paid_product_id:** `typing.Optional[bool]` — Filter out plans that have a paid billing product ID
@@ -16284,7 +17315,7 @@ client.plans.retry_custom_plan_billing(
-**prorate_first_period:** `typing.Optional[bool]` — When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true. +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -16292,7 +17323,7 @@ client.plans.retry_custom_plan_billing(
-**send_invoice:** `typing.Optional[bool]` — Whether Stripe emails the invoice when it is finalized. Defaults to true. +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -16312,7 +17343,7 @@ client.plans.retry_custom_plan_billing(
-
client.plans.create_custom_plan(...) -> CreateCustomPlanResponse +
client.plans.create_plan(...) -> CreatePlanResponse
@@ -16333,9 +17364,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.create_custom_plan( - company_id="company_id", +client.plans.create_plan( name="name", + plan_type="plan", ) ``` @@ -16352,7 +17383,7 @@ client.plans.create_custom_plan(
-**company_id:** `str` +**request:** `CreatePlanRequestBody`
@@ -16360,31 +17391,59 @@ client.plans.create_custom_plan(
-**name:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**copied_from_plan_id:** `typing.Optional[str]` -
+
+
client.plans.get_plan(...) -> GetPlanResponse
-**copied_price_id:** `typing.Optional[str]` - +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.plans.get_plan( + plan_id="plan_id", + plan_version_id="plan_version_id", +) + +``` +
+
+#### ⚙️ Parameters +
-**description:** `typing.Optional[str]` +
+
+ +**plan_id:** `str` — plan_id
@@ -16392,7 +17451,7 @@ client.plans.create_custom_plan(
-**icon:** `typing.Optional[PlanIcon]` +**plan_version_id:** `typing.Optional[str]` — Fetch billing settings for a specific plan version
@@ -16412,7 +17471,7 @@ client.plans.create_custom_plan(
-
client.plans.list_plans(...) -> ListPlansResponse +
client.plans.update_plan(...) -> UpdatePlanResponse
@@ -16433,26 +17492,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.list_plans( - company_id="company_id", - company_scoped_only=True, - exclude_company_scoped=True, - for_fallback_plan=True, - for_initial_plan=True, - for_trial_expiry_plan=True, - has_product_id=True, - ids=[ - "ids" - ], - include_draft_versions=True, - plan_type="plan", - q="q", - scoped_to_company_id="scoped_to_company_id", - with_entitlements=True, - without_entitlement_for="without_entitlement_for", - without_paid_product_id=True, - limit=1000000, - offset=1000000, +client.plans.update_plan( + plan_id="plan_id", + name="name", ) ``` @@ -16469,7 +17511,7 @@ client.plans.list_plans(
-**company_id:** `typing.Optional[str]` +**plan_id:** `str` — plan_id
@@ -16477,7 +17519,7 @@ client.plans.list_plans(
-**company_scoped_only:** `typing.Optional[bool]` — Only return plans that are scoped to a company (custom plans assigned to a company) +**request:** `UpdatePlanRequestBody`
@@ -16485,55 +17527,58 @@ client.plans.list_plans(
-**exclude_company_scoped:** `typing.Optional[bool]` — Exclude plans that are scoped to a company (custom plans assigned to a company) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**for_fallback_plan:** `typing.Optional[bool]` — Filter for plans valid as fallback plans (not linked to billing) -
+
+
client.plans.delete_plan(...) -> DeletePlanResponse
-**for_initial_plan:** `typing.Optional[bool]` — Filter for plans valid as initial plans (not linked to billing, free, or auto-cancelling trial) - -
-
+#### 🔌 Usage
-**for_trial_expiry_plan:** `typing.Optional[bool]` — Filter for plans valid as trial expiry plans (not linked to billing or free) - -
-
-
-**has_product_id:** `typing.Optional[bool]` — Filter out plans that do not have a billing product ID - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.plans.delete_plan( + plan_id="plan_id", +) + +``` +
+
+#### ⚙️ Parameters +
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
-
-**include_draft_versions:** `typing.Optional[bool]` — Include billing settings from draft versions for plans which have draft version +**plan_id:** `str` — plan_id
@@ -16541,55 +17586,60 @@ client.plans.list_plans(
-**plan_type:** `typing.Optional[PlanType]` — Filter by plan type +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ + -
-
-**q:** `typing.Optional[str]` -
+
+
client.plans.upsert_billing_product_plan(...) -> UpsertBillingProductPlanResponse
-**scoped_to_company_id:** `typing.Optional[str]` — Filter plans scoped to a specific company (custom plans) - -
-
+#### 🔌 Usage
-**with_entitlements:** `typing.Optional[bool]` — Include each plan's entitlements in the response - -
-
-
-**without_entitlement_for:** `typing.Optional[str]` — Filter out plans that already have a plan entitlement for the specified feature ID - +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.plans.upsert_billing_product_plan( + plan_id="plan_id", + charge_type="free", + is_trialable=True, +) + +``` +
+
+#### ⚙️ Parameters +
-**without_paid_product_id:** `typing.Optional[bool]` — Filter out plans that have a paid billing product ID - -
-
-
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**plan_id:** `str` — plan_id
@@ -16597,7 +17647,7 @@ client.plans.list_plans(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**request:** `UpsertBillingProductRequestBody`
@@ -16617,7 +17667,7 @@ client.plans.list_plans(
-
client.plans.create_plan(...) -> CreatePlanResponse +
client.plans.upsert_plan_for_billing_product(...) -> UpsertPlanForBillingProductResponse
@@ -16638,7 +17688,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.create_plan( +client.plans.upsert_plan_for_billing_product( + billing_provider="metronome", + external_resource_id="external_resource_id", name="name", plan_type="plan", ) @@ -16649,15 +17701,63 @@ client.plans.create_plan(
-#### ⚙️ Parameters - +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_provider:** `BillingProviderType` + +
+
+ +
+
+ +**external_resource_id:** `str` + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**plan_type:** `PlanType` + +
+
+ +
+
+ +**description:** `typing.Optional[str]` + +
+
+
+**external_resource_version:** `typing.Optional[str]` + +
+
+
-**request:** `CreatePlanRequestBody` +**icon:** `typing.Optional[PlanIcon]`
@@ -16677,7 +17777,7 @@ client.plans.create_plan(
-
client.plans.get_plan(...) -> GetPlanResponse +
client.plans.list_billing_product_match_companies(...) -> ListBillingProductMatchCompaniesResponse
@@ -16698,9 +17798,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.get_plan( +client.plans.list_billing_product_match_companies( plan_id="plan_id", - plan_version_id="plan_version_id", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -16717,7 +17819,7 @@ client.plans.get_plan(
-**plan_id:** `str` — plan_id +**plan_id:** `str` — The plan ID to find billing product match companies for
@@ -16725,7 +17827,23 @@ client.plans.get_plan(
-**plan_version_id:** `typing.Optional[str]` — Fetch billing settings for a specific plan version +**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -16745,7 +17863,7 @@ client.plans.get_plan(
-
client.plans.update_plan(...) -> UpdatePlanResponse +
client.plans.count_billing_product_match_companies(...) -> CountBillingProductMatchCompaniesResponse
@@ -16766,9 +17884,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.update_plan( +client.plans.count_billing_product_match_companies( plan_id="plan_id", - name="name", + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -16785,7 +17905,7 @@ client.plans.update_plan(
-**plan_id:** `str` — plan_id +**plan_id:** `str` — The plan ID to find billing product match companies for
@@ -16793,7 +17913,7 @@ client.plans.update_plan(
-**request:** `UpdatePlanRequestBody` +**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits
@@ -16801,58 +17921,15 @@ client.plans.update_plan(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**limit:** `typing.Optional[int]` — Page limit (default 100) -
-
-
-
- - - - -
- -
client.plans.delete_plan(...) -> DeletePlanResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.plans.delete_plan( - plan_id="plan_id", -) - -``` -
-
-#### ⚙️ Parameters - -
-
-
-**plan_id:** `str` — plan_id +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -16872,7 +17949,7 @@ client.plans.delete_plan(
-
client.plans.upsert_billing_product_plan(...) -> UpsertBillingProductPlanResponse +
client.plans.count_plans(...) -> CountPlansResponse
@@ -16893,10 +17970,26 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.upsert_billing_product_plan( - plan_id="plan_id", - charge_type="free", - is_trialable=True, +client.plans.count_plans( + company_id="company_id", + company_scoped_only=True, + exclude_company_scoped=True, + for_fallback_plan=True, + for_initial_plan=True, + for_trial_expiry_plan=True, + has_product_id=True, + ids=[ + "ids" + ], + include_draft_versions=True, + plan_type="plan", + q="q", + scoped_to_company_id="scoped_to_company_id", + with_entitlements=True, + without_entitlement_for="without_entitlement_for", + without_paid_product_id=True, + limit=1000000, + offset=1000000, ) ``` @@ -16913,7 +18006,7 @@ client.plans.upsert_billing_product_plan(
-**plan_id:** `str` — plan_id +**company_id:** `typing.Optional[str]`
@@ -16921,7 +18014,7 @@ client.plans.upsert_billing_product_plan(
-**request:** `UpsertBillingProductRequestBody` +**company_scoped_only:** `typing.Optional[bool]` — Only return plans that are scoped to a company (custom plans assigned to a company)
@@ -16929,61 +18022,71 @@ client.plans.upsert_billing_product_plan(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**exclude_company_scoped:** `typing.Optional[bool]` — Exclude plans that are scoped to a company (custom plans assigned to a company)
-
-
+
+
+**for_fallback_plan:** `typing.Optional[bool]` — Filter for plans valid as fallback plans (not linked to billing) +
-
-
client.plans.upsert_plan_for_billing_product(...) -> UpsertPlanForBillingProductResponse
-#### 🔌 Usage +**for_initial_plan:** `typing.Optional[bool]` — Filter for plans valid as initial plans (not linked to billing, free, or auto-cancelling trial) + +
+
+**for_trial_expiry_plan:** `typing.Optional[bool]` — Filter for plans valid as trial expiry plans (not linked to billing or free) + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) +**has_product_id:** `typing.Optional[bool]` — Filter out plans that do not have a billing product ID + +
+
-client.plans.upsert_plan_for_billing_product( - billing_provider="metronome", - external_resource_id="external_resource_id", - name="name", - plan_type="plan", -) +
+
-``` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +
+ +
+
+ +**include_draft_versions:** `typing.Optional[bool]` — Include billing settings from draft versions for plans which have draft version +
-#### ⚙️ Parameters -
+**plan_type:** `typing.Optional[PlanType]` — Filter by plan type + +
+
+
-**billing_provider:** `BillingProviderType` +**q:** `typing.Optional[str]`
@@ -16991,7 +18094,7 @@ client.plans.upsert_plan_for_billing_product(
-**external_resource_id:** `str` +**scoped_to_company_id:** `typing.Optional[str]` — Filter plans scoped to a specific company (custom plans)
@@ -16999,7 +18102,7 @@ client.plans.upsert_plan_for_billing_product(
-**name:** `str` +**with_entitlements:** `typing.Optional[bool]` — Include each plan's entitlements in the response
@@ -17007,7 +18110,7 @@ client.plans.upsert_plan_for_billing_product(
-**plan_type:** `PlanType` +**without_entitlement_for:** `typing.Optional[str]` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -17015,7 +18118,7 @@ client.plans.upsert_plan_for_billing_product(
-**description:** `typing.Optional[str]` +**without_paid_product_id:** `typing.Optional[bool]` — Filter out plans that have a paid billing product ID
@@ -17023,7 +18126,7 @@ client.plans.upsert_plan_for_billing_product(
-**external_resource_version:** `typing.Optional[str]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -17031,7 +18134,7 @@ client.plans.upsert_plan_for_billing_product(
-**icon:** `typing.Optional[PlanIcon]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -17051,7 +18154,7 @@ client.plans.upsert_plan_for_billing_product(
-
client.plans.list_billing_product_match_companies(...) -> ListBillingProductMatchCompaniesResponse +
client.plans.list_plan_issues(...) -> ListPlanIssuesResponse
@@ -17072,11 +18175,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.list_billing_product_match_companies( +client.plans.list_plan_issues( plan_id="plan_id", - q="q", - limit=1000000, - offset=1000000, + plan_version_id="plan_version_id", ) ``` @@ -17093,23 +18194,7 @@ client.plans.list_billing_product_match_companies(
-**plan_id:** `str` — The plan ID to find billing product match companies for - -
-
- -
-
- -**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) +**plan_id:** `str`
@@ -17117,7 +18202,7 @@ client.plans.list_billing_product_match_companies(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**plan_version_id:** `typing.Optional[str]`
@@ -17137,7 +18222,7 @@ client.plans.list_billing_product_match_companies(
-
client.plans.count_billing_product_match_companies(...) -> CountBillingProductMatchCompaniesResponse +
client.plans.delete_plan_version(...) -> DeletePlanVersionResponse
@@ -17158,44 +18243,26 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.count_billing_product_match_companies( - plan_id="plan_id", - q="q", - limit=1000000, - offset=1000000, -) - -``` -
-
- - - -#### ⚙️ Parameters - -
-
- -
-
+client.plans.delete_plan_version( + plan_version_id="plan_version_id", + promote_archived_version=True, +) -**plan_id:** `str` — The plan ID to find billing product match companies for - +```
+
+
+ +#### ⚙️ Parameters
-**q:** `typing.Optional[str]` — Search for companies by name, keys or string traits - -
-
-
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**plan_version_id:** `str` — plan_version_id
@@ -17203,7 +18270,7 @@ client.plans.count_billing_product_match_companies(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**promote_archived_version:** `typing.Optional[bool]`
@@ -17223,7 +18290,7 @@ client.plans.count_billing_product_match_companies(
-
client.plans.count_plans(...) -> CountPlansResponse +
client.plans.publish_plan_version(...) -> PublishPlanVersionResponse
@@ -17244,26 +18311,12 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.count_plans( - company_id="company_id", - company_scoped_only=True, - exclude_company_scoped=True, - for_fallback_plan=True, - for_initial_plan=True, - for_trial_expiry_plan=True, - has_product_id=True, - ids=[ - "ids" +client.plans.publish_plan_version( + plan_version_id="plan_version_id", + excluded_company_ids=[ + "excluded_company_ids" ], - include_draft_versions=True, - plan_type="plan", - q="q", - scoped_to_company_id="scoped_to_company_id", - with_entitlements=True, - without_entitlement_for="without_entitlement_for", - without_paid_product_id=True, - limit=1000000, - offset=1000000, + migration_strategy="end_of_billing_period", ) ``` @@ -17280,7 +18333,7 @@ client.plans.count_plans(
-**company_id:** `typing.Optional[str]` +**plan_version_id:** `str` — plan_version_id
@@ -17288,7 +18341,7 @@ client.plans.count_plans(
-**company_scoped_only:** `typing.Optional[bool]` — Only return plans that are scoped to a company (custom plans assigned to a company) +**excluded_company_ids:** `typing.List[str]`
@@ -17296,7 +18349,7 @@ client.plans.count_plans(
-**exclude_company_scoped:** `typing.Optional[bool]` — Exclude plans that are scoped to a company (custom plans assigned to a company) +**migration_strategy:** `PlanVersionMigrationStrategy`
@@ -17304,7 +18357,7 @@ client.plans.count_plans(
-**for_fallback_plan:** `typing.Optional[bool]` — Filter for plans valid as fallback plans (not linked to billing) +**activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]`
@@ -17312,7 +18365,7 @@ client.plans.count_plans(
-**for_initial_plan:** `typing.Optional[bool]` — Filter for plans valid as initial plans (not linked to billing, free, or auto-cancelling trial) +**address:** `typing.Optional[CustomerBillingAddress]`
@@ -17320,7 +18373,7 @@ client.plans.count_plans(
-**for_trial_expiry_plan:** `typing.Optional[bool]` — Filter for plans valid as trial expiry plans (not linked to billing or free) +**billing_cycle_anchor:** `typing.Optional[datetime.datetime]` — The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription.
@@ -17328,7 +18381,7 @@ client.plans.count_plans(
-**has_product_id:** `typing.Optional[bool]` — Filter out plans that do not have a billing product ID +**coupon_external_id:** `typing.Optional[str]`
@@ -17336,7 +18389,7 @@ client.plans.count_plans(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**custom_field_values:** `typing.Optional[typing.List[CheckoutFieldValue]]`
@@ -17344,7 +18397,7 @@ client.plans.count_plans(
-**include_draft_versions:** `typing.Optional[bool]` — Include billing settings from draft versions for plans which have draft version +**customer_email:** `typing.Optional[str]`
@@ -17352,7 +18405,7 @@ client.plans.count_plans(
-**plan_type:** `typing.Optional[PlanType]` — Filter by plan type +**days_until_due:** `typing.Optional[int]`
@@ -17360,7 +18413,7 @@ client.plans.count_plans(
-**q:** `typing.Optional[str]` +**phone:** `typing.Optional[str]`
@@ -17368,7 +18421,7 @@ client.plans.count_plans(
-**scoped_to_company_id:** `typing.Optional[str]` — Filter plans scoped to a specific company (custom plans) +**prorate_first_period:** `typing.Optional[bool]` — When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.
@@ -17376,7 +18429,7 @@ client.plans.count_plans(
-**with_entitlements:** `typing.Optional[bool]` — Include each plan's entitlements in the response +**proration_behavior:** `typing.Optional[MigrationProrationBehavior]`
@@ -17384,7 +18437,7 @@ client.plans.count_plans(
-**without_entitlement_for:** `typing.Optional[str]` — Filter out plans that already have a plan entitlement for the specified feature ID +**require_no_migration:** `typing.Optional[bool]` — Refuse the publish if any company would be migrated onto the new version
@@ -17392,7 +18445,77 @@ client.plans.count_plans(
-**without_paid_product_id:** `typing.Optional[bool]` — Filter out plans that have a paid billing product ID +**send_invoice:** `typing.Optional[bool]` — Whether Stripe emails the invoice when it is finalized. Defaults to true. + +
+
+ +
+
+ +**tax_id:** `typing.Optional[TaxIdInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + + + +
+ +## components +
client.components.list_components(...) -> ListComponentsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.components.list_components( + q="q", + limit=1000000, + offset=1000000, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**q:** `typing.Optional[str]`
@@ -17428,7 +18551,7 @@ client.plans.count_plans(
-
client.plans.list_plan_issues(...) -> ListPlanIssuesResponse +
client.components.create_component(...) -> CreateComponentResponse
@@ -17449,9 +18572,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.list_plan_issues( - plan_id="plan_id", - plan_version_id="plan_version_id", +client.components.create_component( + entity_type="billing", + name="name", ) ``` @@ -17468,7 +18591,7 @@ client.plans.list_plan_issues(
-**plan_id:** `str` +**entity_type:** `ComponentEntityType`
@@ -17476,7 +18599,15 @@ client.plans.list_plan_issues(
-**plan_version_id:** `typing.Optional[str]` +**name:** `str` + +
+
+ +
+
+ +**ast:** `typing.Optional[typing.Dict[str, float]]`
@@ -17496,7 +18627,7 @@ client.plans.list_plan_issues(
-
client.plans.delete_plan_version(...) -> DeletePlanVersionResponse +
client.components.get_component(...) -> GetComponentResponse
@@ -17517,9 +18648,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.delete_plan_version( - plan_version_id="plan_version_id", - promote_archived_version=True, +client.components.get_component( + component_id="component_id", ) ``` @@ -17536,15 +18666,7 @@ client.plans.delete_plan_version(
-**plan_version_id:** `str` — plan_version_id - -
-
- -
-
- -**promote_archived_version:** `typing.Optional[bool]` +**component_id:** `str` — component_id
@@ -17564,7 +18686,7 @@ client.plans.delete_plan_version(
-
client.plans.publish_plan_version(...) -> PublishPlanVersionResponse +
client.components.update_component(...) -> UpdateComponentResponse
@@ -17585,12 +18707,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.plans.publish_plan_version( - plan_version_id="plan_version_id", - excluded_company_ids=[ - "excluded_company_ids" - ], - migration_strategy="end_of_billing_period", +client.components.update_component( + component_id="component_id", ) ``` @@ -17607,7 +18725,7 @@ client.plans.publish_plan_version(
-**plan_version_id:** `str` — plan_version_id +**component_id:** `str` — component_id
@@ -17615,7 +18733,7 @@ client.plans.publish_plan_version(
-**excluded_company_ids:** `typing.List[str]` +**ast:** `typing.Optional[typing.Dict[str, float]]`
@@ -17623,31 +18741,82 @@ client.plans.publish_plan_version(
-**migration_strategy:** `PlanVersionMigrationStrategy` +**entity_type:** `typing.Optional[ComponentEntityType]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**state:** `typing.Optional[ComponentState]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**activation_strategy:** `typing.Optional[CustomPlanActivationStrategy]` -
+ +
+
+
+ +
client.components.delete_component(...) -> DeleteComponentResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.components.delete_component( + component_id="component_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters +
-**address:** `typing.Optional[CustomerBillingAddress]` - -
-
-
-**billing_cycle_anchor:** `typing.Optional[datetime.datetime]` — The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription. +**component_id:** `str` — component_id
@@ -17655,71 +18824,58 @@ client.plans.publish_plan_version(
-**coupon_external_id:** `typing.Optional[str]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**custom_field_values:** `typing.Optional[typing.List[CheckoutFieldValue]]` -
-
-
-**customer_email:** `typing.Optional[str]` -
+
+
client.components.bind_catalog(...) -> BindCatalogResponse
-**days_until_due:** `typing.Optional[int]` - -
-
+#### 🔌 Usage
-**phone:** `typing.Optional[str]` - -
-
-
-**prorate_first_period:** `typing.Optional[bool]` — When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true. - -
-
+```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment -
-
+client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) -**proration_behavior:** `typing.Optional[MigrationProrationBehavior]` - +client.components.bind_catalog( + component_id="component_id", +) + +``` +
+
+#### ⚙️ Parameters +
-**require_no_migration:** `typing.Optional[bool]` — Refuse the publish if any company would be migrated onto the new version - -
-
-
-**send_invoice:** `typing.Optional[bool]` — Whether Stripe emails the invoice when it is finalized. Defaults to true. +**component_id:** `str` — component_id
@@ -17727,7 +18883,7 @@ client.plans.publish_plan_version(
-**tax_id:** `typing.Optional[TaxIdInput]` +**catalog_id:** `typing.Optional[str]`
@@ -17747,8 +18903,7 @@ client.plans.publish_plan_version(
-## components -
client.components.list_components(...) -> ListComponentsResponse +
client.components.count_components(...) -> CountComponentsResponse
@@ -17769,7 +18924,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.list_components( +client.components.count_components( q="q", limit=1000000, offset=1000000, @@ -17825,7 +18980,7 @@ client.components.list_components(
-
client.components.create_component(...) -> CreateComponentResponse +
client.components.preview_component_data(...) -> PreviewComponentDataResponse
@@ -17846,9 +19001,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.create_component( - entity_type="billing", - name="name", +client.components.preview_component_data( + company_id="company_id", + component_id="component_id", ) ``` @@ -17865,15 +19020,7 @@ client.components.create_component(
-**entity_type:** `ComponentEntityType` - -
-
- -
-
- -**name:** `str` +**company_id:** `typing.Optional[str]`
@@ -17881,7 +19028,7 @@ client.components.create_component(
-**ast:** `typing.Optional[typing.Dict[str, float]]` +**component_id:** `typing.Optional[str]`
@@ -17901,7 +19048,8 @@ client.components.create_component(
-
client.components.get_component(...) -> GetComponentResponse +## planbundle +
client.planbundle.create_custom_plan_bundle(...) -> CreateCustomPlanBundleResponse
@@ -17914,7 +19062,7 @@ client.components.create_component(
```python -from schematic import Schematic +from schematic import Schematic, UpsertBillingProductRequestBody, PlanBundleEntitlementRequestBody, CreateCustomPlanBundlePlanRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -17922,8 +19070,20 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.get_component( - component_id="component_id", +client.planbundle.create_custom_plan_bundle( + billing_product=UpsertBillingProductRequestBody( + charge_type="free", + is_trialable=True, + ), + entitlements=[ + PlanBundleEntitlementRequestBody( + action="create", + ) + ], + plan=CreateCustomPlanBundlePlanRequestBody( + company_id="company_id", + name="name", + ), ) ``` @@ -17940,7 +19100,31 @@ client.components.get_component(
-**component_id:** `str` — component_id +**billing_product:** `UpsertBillingProductRequestBody` + +
+
+ +
+
+ +**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]` + +
+
+ +
+
+ +**plan:** `CreateCustomPlanBundlePlanRequestBody` + +
+
+ +
+
+ +**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]`
@@ -17960,7 +19144,7 @@ client.components.get_component(
-
client.components.update_component(...) -> UpdateComponentResponse +
client.planbundle.create_plan_bundle(...) -> CreatePlanBundleResponse
@@ -17973,7 +19157,7 @@ client.components.get_component(
```python -from schematic import Schematic +from schematic import Schematic, PlanBundleEntitlementRequestBody, CreatePlanRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -17981,8 +19165,16 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.update_component( - component_id="component_id", +client.planbundle.create_plan_bundle( + entitlements=[ + PlanBundleEntitlementRequestBody( + action="create", + ) + ], + plan=CreatePlanRequestBody( + name="name", + plan_type="plan", + ), ) ``` @@ -17999,15 +19191,7 @@ client.components.update_component(
-**component_id:** `str` — component_id - -
-
- -
-
- -**ast:** `typing.Optional[typing.Dict[str, float]]` +**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]`
@@ -18015,7 +19199,7 @@ client.components.update_component(
-**entity_type:** `typing.Optional[ComponentEntityType]` +**plan:** `CreatePlanRequestBody`
@@ -18023,7 +19207,7 @@ client.components.update_component(
-**name:** `typing.Optional[str]` +**billing_product:** `typing.Optional[UpsertBillingProductRequestBody]`
@@ -18031,7 +19215,7 @@ client.components.update_component(
-**state:** `typing.Optional[ComponentState]` +**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]`
@@ -18051,7 +19235,7 @@ client.components.update_component(
-
client.components.delete_component(...) -> DeleteComponentResponse +
client.planbundle.update_plan_bundle(...) -> UpdatePlanBundleResponse
@@ -18064,7 +19248,7 @@ client.components.update_component(
```python -from schematic import Schematic +from schematic import Schematic, PlanBundleEntitlementRequestBody, UpdatePlanRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -18072,8 +19256,16 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.delete_component( - component_id="component_id", +client.planbundle.update_plan_bundle( + plan_id="plan_id", + entitlements=[ + PlanBundleEntitlementRequestBody( + action="create", + ) + ], + plan=UpdatePlanRequestBody( + name="name", + ), ) ``` @@ -18090,7 +19282,47 @@ client.components.delete_component(
-**component_id:** `str` — component_id +**plan_id:** `str` — plan_id + +
+
+ +
+
+ +**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]` + +
+
+ +
+
+ +**plan:** `UpdatePlanRequestBody` + +
+
+ +
+
+ +**billing_product:** `typing.Optional[UpsertBillingProductRequestBody]` + +
+
+ +
+
+ +**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]` + +
+
+ +
+
+ +**plan_version_id:** `typing.Optional[str]`
@@ -18110,7 +19342,8 @@ client.components.delete_component(
-
client.components.bind_catalog(...) -> BindCatalogResponse +## dataexports +
client.dataexports.list_data_exports(...) -> ListDataExportsResponse
@@ -18131,8 +19364,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.bind_catalog( - component_id="component_id", +client.dataexports.list_data_exports( + export_type="audit-log", + status="failure", + limit=1000000, + offset=1000000, ) ``` @@ -18149,7 +19385,23 @@ client.components.bind_catalog(
-**component_id:** `str` — component_id +**export_type:** `typing.Optional[DataExportType]` + +
+
+ +
+
+ +**status:** `typing.Optional[DataExportStatus]` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -18157,7 +19409,7 @@ client.components.bind_catalog(
-**catalog_id:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -18177,7 +19429,7 @@ client.components.bind_catalog(
-
client.components.count_components(...) -> CountComponentsResponse +
client.dataexports.create_data_export(...) -> CreateDataExportResponse
@@ -18198,10 +19450,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.count_components( - q="q", - limit=1000000, - offset=1000000, +client.dataexports.create_data_export( + export_type="audit-log", + output_file_type="csv", ) ``` @@ -18218,7 +19469,7 @@ client.components.count_components(
-**q:** `typing.Optional[str]` +**export_type:** `DataExportType`
@@ -18226,7 +19477,7 @@ client.components.count_components(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**output_file_type:** `DataExportOutputFileType`
@@ -18234,7 +19485,7 @@ client.components.count_components(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**metadata:** `typing.Optional[DataExportMetadata]`
@@ -18254,7 +19505,7 @@ client.components.count_components(
-
client.components.preview_component_data(...) -> PreviewComponentDataResponse +
client.dataexports.get_data_export(...) -> GetDataExportResponse
@@ -18275,9 +19526,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.components.preview_component_data( - company_id="company_id", - component_id="component_id", +client.dataexports.get_data_export( + data_export_id="data_export_id", ) ``` @@ -18294,15 +19544,7 @@ client.components.preview_component_data(
-**company_id:** `typing.Optional[str]` - -
-
- -
-
- -**component_id:** `typing.Optional[str]` +**data_export_id:** `str` — data_export_id
@@ -18322,8 +19564,7 @@ client.components.preview_component_data(
-## planbundle -
client.planbundle.create_custom_plan_bundle(...) -> CreateCustomPlanBundleResponse +
client.dataexports.get_data_export_artifact(...) -> typing.Iterator[bytes]
@@ -18336,7 +19577,7 @@ client.components.preview_component_data(
```python -from schematic import Schematic, UpsertBillingProductRequestBody, PlanBundleEntitlementRequestBody, CreateCustomPlanBundlePlanRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -18344,20 +19585,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.planbundle.create_custom_plan_bundle( - billing_product=UpsertBillingProductRequestBody( - charge_type="free", - is_trialable=True, - ), - entitlements=[ - PlanBundleEntitlementRequestBody( - action="create", - ) - ], - plan=CreateCustomPlanBundlePlanRequestBody( - company_id="company_id", - name="name", - ), +client.dataexports.get_data_export_artifact( + data_export_id="data_export_id", ) ``` @@ -18374,31 +19603,7 @@ client.planbundle.create_custom_plan_bundle(
-**billing_product:** `UpsertBillingProductRequestBody` - -
-
- -
-
- -**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]` - -
-
- -
-
- -**plan:** `CreateCustomPlanBundlePlanRequestBody` - -
-
- -
-
- -**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]` +**data_export_id:** `str` — data_export_id
@@ -18418,7 +19623,8 @@ client.planbundle.create_custom_plan_bundle(
-
client.planbundle.create_plan_bundle(...) -> CreatePlanBundleResponse +## events +
client.events.create_event_batch(...) -> CreateEventBatchResponse
@@ -18431,7 +19637,7 @@ client.planbundle.create_custom_plan_bundle(
```python -from schematic import Schematic, PlanBundleEntitlementRequestBody, CreatePlanRequestBody +from schematic import Schematic, CreateEventRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -18439,16 +19645,12 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.planbundle.create_plan_bundle( - entitlements=[ - PlanBundleEntitlementRequestBody( - action="create", +client.events.create_event_batch( + events=[ + CreateEventRequestBody( + event_type="flag_check", ) ], - plan=CreatePlanRequestBody( - name="name", - plan_type="plan", - ), ) ``` @@ -18465,31 +19667,7 @@ client.planbundle.create_plan_bundle(
-**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]` - -
-
- -
-
- -**plan:** `CreatePlanRequestBody` - -
-
- -
-
- -**billing_product:** `typing.Optional[UpsertBillingProductRequestBody]` - -
-
- -
-
- -**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]` +**events:** `typing.List[CreateEventRequestBody]`
@@ -18509,7 +19687,7 @@ client.planbundle.create_plan_bundle(
-
client.planbundle.update_plan_bundle(...) -> UpdatePlanBundleResponse +
client.events.get_event_summaries(...) -> GetEventSummariesResponse
@@ -18522,7 +19700,7 @@ client.planbundle.create_plan_bundle(
```python -from schematic import Schematic, PlanBundleEntitlementRequestBody, UpdatePlanRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -18530,16 +19708,13 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.planbundle.update_plan_bundle( - plan_id="plan_id", - entitlements=[ - PlanBundleEntitlementRequestBody( - action="create", - ) +client.events.get_event_summaries( + q="q", + event_subtypes=[ + "event_subtypes" ], - plan=UpdatePlanRequestBody( - name="name", - ), + limit=1000000, + offset=1000000, ) ``` @@ -18556,23 +19731,7 @@ client.planbundle.update_plan_bundle(
-**plan_id:** `str` — plan_id - -
-
- -
-
- -**entitlements:** `typing.List[PlanBundleEntitlementRequestBody]` - -
-
- -
-
- -**plan:** `UpdatePlanRequestBody` +**q:** `typing.Optional[str]`
@@ -18580,7 +19739,7 @@ client.planbundle.update_plan_bundle(
-**billing_product:** `typing.Optional[UpsertBillingProductRequestBody]` +**event_subtypes:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -18588,7 +19747,7 @@ client.planbundle.update_plan_bundle(
-**credit_grants:** `typing.Optional[typing.List[PlanBundleCreditGrantRequestBody]]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -18596,7 +19755,7 @@ client.planbundle.update_plan_bundle(
-**plan_version_id:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -18616,8 +19775,7 @@ client.planbundle.update_plan_bundle(
-## dataexports -
client.dataexports.list_data_exports(...) -> ListDataExportsResponse +
client.events.list_events(...) -> ListEventsResponse
@@ -18638,9 +19796,15 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.dataexports.list_data_exports( - export_type="audit-log", - status="failure", +client.events.list_events( + company_id="company_id", + event_subtype="event_subtype", + event_types=[ + "flag_check" + ], + flag_id="flag_id", + idempotency_key="idempotency_key", + user_id="user_id", limit=1000000, offset=1000000, ) @@ -18659,7 +19823,7 @@ client.dataexports.list_data_exports(
-**export_type:** `typing.Optional[DataExportType]` +**company_id:** `typing.Optional[str]`
@@ -18667,7 +19831,39 @@ client.dataexports.list_data_exports(
-**status:** `typing.Optional[DataExportStatus]` +**event_subtype:** `typing.Optional[str]` + +
+
+ +
+
+ +**event_types:** `typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]]` + +
+
+ +
+
+ +**flag_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**idempotency_key:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]`
@@ -18703,7 +19899,7 @@ client.dataexports.list_data_exports(
-
client.dataexports.create_data_export(...) -> CreateDataExportResponse +
client.events.create_event(...) -> CreateEventResponse
@@ -18724,9 +19920,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.dataexports.create_data_export( - export_type="audit-log", - output_file_type="csv", +client.events.create_event( + event_type="flag_check", ) ``` @@ -18743,23 +19938,7 @@ client.dataexports.create_data_export(
-**export_type:** `DataExportType` - -
-
- -
-
- -**output_file_type:** `DataExportOutputFileType` - -
-
- -
-
- -**metadata:** `typing.Optional[DataExportMetadata]` +**request:** `CreateEventRequestBody`
@@ -18779,7 +19958,7 @@ client.dataexports.create_data_export(
-
client.dataexports.get_data_export(...) -> GetDataExportResponse +
client.events.get_event(...) -> GetEventResponse
@@ -18800,8 +19979,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.dataexports.get_data_export( - data_export_id="data_export_id", +client.events.get_event( + event_id="event_id", ) ``` @@ -18818,7 +19997,7 @@ client.dataexports.get_data_export(
-**data_export_id:** `str` — data_export_id +**event_id:** `str` — event_id
@@ -18838,7 +20017,7 @@ client.dataexports.get_data_export(
-
client.dataexports.get_data_export_artifact(...) -> typing.Iterator[bytes] +
client.events.get_otlp_environment_settings() -> GetOtlpEnvironmentSettingsResponse
@@ -18859,9 +20038,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.dataexports.get_data_export_artifact( - data_export_id="data_export_id", -) +client.events.get_otlp_environment_settings() ```
@@ -18877,14 +20054,6 @@ client.dataexports.get_data_export_artifact(
-**data_export_id:** `str` — data_export_id - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -18897,8 +20066,7 @@ client.dataexports.get_data_export_artifact(
-## events -
client.events.create_event_batch(...) -> CreateEventBatchResponse +
client.events.upsert_otlp_environment_settings(...) -> UpsertOtlpEnvironmentSettingsResponse
@@ -18911,7 +20079,7 @@ client.dataexports.get_data_export_artifact(
```python -from schematic import Schematic, CreateEventRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( @@ -18919,12 +20087,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.events.create_event_batch( - events=[ - CreateEventRequestBody( - event_type="flag_check", - ) - ], +client.events.upsert_otlp_environment_settings( + tool_events_enabled=True, ) ``` @@ -18941,7 +20105,39 @@ client.events.create_event_batch(
-**events:** `typing.List[CreateEventRequestBody]` +**tool_events_enabled:** `bool` + +
+
+ +
+
+ +**company_attribute:** `typing.Optional[str]` + +
+
+ +
+
+ +**company_key:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_attribute:** `typing.Optional[str]` + +
+
+ +
+
+ +**user_key:** `typing.Optional[str]`
@@ -18961,7 +20157,7 @@ client.events.create_event_batch(
-
client.events.get_event_summaries(...) -> GetEventSummariesResponse +
client.events.delete_otlp_environment_settings() -> DeleteOtlpEnvironmentSettingsResponse
@@ -18982,14 +20178,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.events.get_event_summaries( - q="q", - event_subtypes=[ - "event_subtypes" - ], - limit=1000000, - offset=1000000, -) +client.events.delete_otlp_environment_settings() ```
@@ -19005,35 +20194,52 @@ client.events.get_event_summaries(
-**q:** `typing.Optional[str]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
-
-
-**event_subtypes:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` -
+
+
client.events.get_segment_integration_status() -> GetSegmentIntegrationStatusResponse
-**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
+#### 🔌 Usage
-**offset:** `typing.Optional[int]` — Page offset (default 0) - +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.events.get_segment_integration_status() + +``` +
+
+#### ⚙️ Parameters + +
+
+
@@ -19049,7 +20255,8 @@ client.events.get_event_summaries(
-
client.events.list_events(...) -> ListEventsResponse +## features +
client.features.list_features(...) -> ListFeaturesResponse
@@ -19070,15 +20277,19 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.events.list_events( - company_id="company_id", - event_subtype="event_subtype", - event_types=[ - "flag_check" +client.features.list_features( + boolean_require_event=True, + feature_type=[ + "boolean" ], - flag_id="flag_id", - idempotency_key="idempotency_key", - user_id="user_id", + ids=[ + "ids" + ], + managed_by="metronome", + plan_version_id="plan_version_id", + q="q", + without_company_override_for="without_company_override_for", + without_plan_entitlement_for="without_plan_entitlement_for", limit=1000000, offset=1000000, ) @@ -19097,7 +20308,7 @@ client.events.list_events(
-**company_id:** `typing.Optional[str]` +**boolean_require_event:** `typing.Optional[bool]` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.
@@ -19105,7 +20316,7 @@ client.events.list_events(
-**event_subtype:** `typing.Optional[str]` +**feature_type:** `typing.Optional[typing.Union[FeatureType, typing.Sequence[FeatureType]]]` — Filter by one or more feature types (boolean, event, trait)
@@ -19113,7 +20324,7 @@ client.events.list_events(
-**event_types:** `typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]]` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -19121,7 +20332,7 @@ client.events.list_events(
-**flag_id:** `typing.Optional[str]` +**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider)
@@ -19129,7 +20340,7 @@ client.events.list_events(
-**idempotency_key:** `typing.Optional[str]` +**plan_version_id:** `typing.Optional[str]` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used
@@ -19137,7 +20348,23 @@ client.events.list_events(
-**user_id:** `typing.Optional[str]` +**q:** `typing.Optional[str]` — Search by feature name or ID + +
+
+ +
+
+ +**without_company_override_for:** `typing.Optional[str]` — Filter out features that already have a company override for the specified company ID + +
+
+ +
+
+ +**without_plan_entitlement_for:** `typing.Optional[str]` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -19173,7 +20400,7 @@ client.events.list_events(
-
client.events.create_event(...) -> CreateEventResponse +
client.features.create_feature(...) -> CreateFeatureResponse
@@ -19194,8 +20421,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.events.create_event( - event_type="flag_check", +client.features.create_feature( + description="description", + feature_type="boolean", + name="name", ) ``` @@ -19212,7 +20441,7 @@ client.events.create_event(
-**request:** `CreateEventRequestBody` +**description:** `str`
@@ -19220,58 +20449,79 @@ client.events.create_event(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**feature_type:** `FeatureType`
+ +
+
+ +**name:** `str` +
+
+
+**event_subtype:** `typing.Optional[str]` +
-
-
client.events.get_event(...) -> GetEventResponse
-#### 🔌 Usage +**flag:** `typing.Optional[CreateOrUpdateFlagRequestBody]` + +
+
+**icon:** `typing.Optional[str]` + +
+
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) +**lifecycle_phase:** `typing.Optional[FeatureLifecyclePhase]` + +
+
-client.events.get_event( - event_id="event_id", -) +
+
-``` +**maintainer_account_member_id:** `typing.Optional[str]` +
+ +
+
+ +**plural_name:** `typing.Optional[str]` +
-#### ⚙️ Parameters -
+**singular_name:** `typing.Optional[str]` + +
+
+
-**event_id:** `str` — event_id +**trait_id:** `typing.Optional[str]`
@@ -19291,7 +20541,7 @@ client.events.get_event(
-
client.events.get_segment_integration_status() -> GetSegmentIntegrationStatusResponse +
client.features.get_feature(...) -> GetFeatureResponse
@@ -19312,7 +20562,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.events.get_segment_integration_status() +client.features.get_feature( + feature_id="feature_id", +) ```
@@ -19328,6 +20580,14 @@ client.events.get_segment_integration_status()
+**feature_id:** `str` — feature_id + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -19340,8 +20600,7 @@ client.events.get_segment_integration_status()
-## features -
client.features.list_features(...) -> ListFeaturesResponse +
client.features.update_feature(...) -> UpdateFeatureResponse
@@ -19358,25 +20617,12 @@ from schematic import Schematic from schematic.environment import SchematicEnvironment client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.features.list_features( - boolean_require_event=True, - feature_type=[ - "boolean" - ], - ids=[ - "ids" - ], - managed_by="metronome", - plan_version_id="plan_version_id", - q="q", - without_company_override_for="without_company_override_for", - without_plan_entitlement_for="without_plan_entitlement_for", - limit=1000000, - offset=1000000, + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.features.update_feature( + feature_id="feature_id", ) ``` @@ -19393,7 +20639,7 @@ client.features.list_features(
-**boolean_require_event:** `typing.Optional[bool]` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. +**feature_id:** `str` — feature_id
@@ -19401,7 +20647,7 @@ client.features.list_features(
-**feature_type:** `typing.Optional[typing.Union[FeatureType, typing.Sequence[FeatureType]]]` — Filter by one or more feature types (boolean, event, trait) +**description:** `typing.Optional[str]`
@@ -19409,7 +20655,7 @@ client.features.list_features(
-**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**event_subtype:** `typing.Optional[str]`
@@ -19417,7 +20663,7 @@ client.features.list_features(
-**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider) +**feature_type:** `typing.Optional[FeatureType]`
@@ -19425,7 +20671,7 @@ client.features.list_features(
-**plan_version_id:** `typing.Optional[str]` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used +**flag:** `typing.Optional[CreateOrUpdateFlagRequestBody]`
@@ -19433,7 +20679,7 @@ client.features.list_features(
-**q:** `typing.Optional[str]` — Search by feature name or ID +**icon:** `typing.Optional[str]`
@@ -19441,7 +20687,7 @@ client.features.list_features(
-**without_company_override_for:** `typing.Optional[str]` — Filter out features that already have a company override for the specified company ID +**lifecycle_phase:** `typing.Optional[FeatureLifecyclePhase]`
@@ -19449,7 +20695,7 @@ client.features.list_features(
-**without_plan_entitlement_for:** `typing.Optional[str]` — Filter out features that already have a plan entitlement for the specified plan ID +**maintainer_account_member_id:** `typing.Optional[str]`
@@ -19457,7 +20703,7 @@ client.features.list_features(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**name:** `typing.Optional[str]`
@@ -19465,7 +20711,23 @@ client.features.list_features(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**plural_name:** `typing.Optional[str]` + +
+
+ +
+
+ +**singular_name:** `typing.Optional[str]` + +
+
+ +
+
+ +**trait_id:** `typing.Optional[str]`
@@ -19485,7 +20747,7 @@ client.features.list_features(
-
client.features.create_feature(...) -> CreateFeatureResponse +
client.features.delete_feature(...) -> DeleteFeatureResponse
@@ -19506,8 +20768,69 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.create_feature( +client.features.delete_feature( + feature_id="feature_id", +) + +``` +
+
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**feature_id:** `str` — feature_id + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + + + +
+ +
client.features.upsert_feature_for_billing_product(...) -> UpsertFeatureForBillingProductResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.features.upsert_feature_for_billing_product( + billing_provider="metronome", description="description", + external_resource_id="external_resource_id", feature_type="boolean", name="name", ) @@ -19526,6 +20849,14 @@ client.features.create_feature(
+**billing_provider:** `BillingProviderType` + +
+
+ +
+
+ **description:** `str`
@@ -19534,6 +20865,14 @@ client.features.create_feature(
+**external_resource_id:** `str` + +
+
+ +
+
+ **feature_type:** `FeatureType`
@@ -19626,7 +20965,7 @@ client.features.create_feature(
-
client.features.get_feature(...) -> GetFeatureResponse +
client.features.count_features(...) -> CountFeaturesResponse
@@ -19647,8 +20986,21 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.get_feature( - feature_id="feature_id", +client.features.count_features( + boolean_require_event=True, + feature_type=[ + "boolean" + ], + ids=[ + "ids" + ], + managed_by="metronome", + plan_version_id="plan_version_id", + q="q", + without_company_override_for="without_company_override_for", + without_plan_entitlement_for="without_plan_entitlement_for", + limit=1000000, + offset=1000000, ) ``` @@ -19665,7 +21017,7 @@ client.features.get_feature(
-**feature_id:** `str` — feature_id +**boolean_require_event:** `typing.Optional[bool]` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.
@@ -19673,58 +21025,39 @@ client.features.get_feature(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**feature_type:** `typing.Optional[typing.Union[FeatureType, typing.Sequence[FeatureType]]]` — Filter by one or more feature types (boolean, event, trait)
-
-
+
+
+**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +
-
-
client.features.update_feature(...) -> UpdateFeatureResponse
-#### 🔌 Usage - -
-
+**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider) + +
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.features.update_feature( - feature_id="feature_id", -) - -``` -
-
+**plan_version_id:** `typing.Optional[str]` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used +
-#### ⚙️ Parameters - -
-
-
-**feature_id:** `str` — feature_id +**q:** `typing.Optional[str]` — Search by feature name or ID
@@ -19732,7 +21065,7 @@ client.features.update_feature(
-**description:** `typing.Optional[str]` +**without_company_override_for:** `typing.Optional[str]` — Filter out features that already have a company override for the specified company ID
@@ -19740,7 +21073,7 @@ client.features.update_feature(
-**event_subtype:** `typing.Optional[str]` +**without_plan_entitlement_for:** `typing.Optional[str]` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -19748,7 +21081,7 @@ client.features.update_feature(
-**feature_type:** `typing.Optional[FeatureType]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -19756,7 +21089,7 @@ client.features.update_feature(
-**flag:** `typing.Optional[CreateOrUpdateFlagRequestBody]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -19764,23 +21097,64 @@ client.features.update_feature(
-**icon:** `typing.Optional[str]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+ + + + +
+
client.features.list_flags(...) -> ListFlagsResponse
-**lifecycle_phase:** `typing.Optional[FeatureLifecyclePhase]` - +#### 🔌 Usage + +
+
+ +
+
+ +```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.features.list_flags( + feature_id="feature_id", + ids=[ + "ids" + ], + q="q", + limit=1000000, + offset=1000000, +) + +``` +
+
+#### ⚙️ Parameters +
-**maintainer_account_member_id:** `typing.Optional[str]` +
+
+ +**feature_id:** `typing.Optional[str]`
@@ -19788,7 +21162,7 @@ client.features.update_feature(
-**name:** `typing.Optional[str]` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]`
@@ -19796,7 +21170,7 @@ client.features.update_feature(
-**plural_name:** `typing.Optional[str]` +**q:** `typing.Optional[str]` — Search by flag name, key, or ID
@@ -19804,7 +21178,7 @@ client.features.update_feature(
-**singular_name:** `typing.Optional[str]` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -19812,7 +21186,7 @@ client.features.update_feature(
-**trait_id:** `typing.Optional[str]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -19832,7 +21206,7 @@ client.features.update_feature(
-
client.features.delete_feature(...) -> DeleteFeatureResponse +
client.features.create_flag(...) -> CreateFlagResponse
@@ -19853,8 +21227,11 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.delete_feature( - feature_id="feature_id", +client.features.create_flag( + default_value=True, + description="description", + key="key", + name="name", ) ``` @@ -19871,7 +21248,7 @@ client.features.delete_feature(
-**feature_id:** `str` — feature_id +**request:** `CreateFlagRequestBody`
@@ -19891,7 +21268,7 @@ client.features.delete_feature(
-
client.features.upsert_feature_for_billing_product(...) -> UpsertFeatureForBillingProductResponse +
client.features.get_flag(...) -> GetFlagResponse
@@ -19912,12 +21289,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.upsert_feature_for_billing_product( - billing_provider="metronome", - description="description", - external_resource_id="external_resource_id", - feature_type="boolean", - name="name", +client.features.get_flag( + flag_id="flag_id", ) ``` @@ -19934,7 +21307,7 @@ client.features.upsert_feature_for_billing_product(
-**billing_provider:** `BillingProviderType` +**flag_id:** `str` — flag_id
@@ -19942,87 +21315,62 @@ client.features.upsert_feature_for_billing_product(
-**description:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**external_resource_id:** `str` -
-
-
-**feature_type:** `FeatureType` -
+
+
client.features.update_flag(...) -> UpdateFlagResponse
-**name:** `str` - -
-
+#### 🔌 Usage
-**event_subtype:** `typing.Optional[str]` - -
-
-
-**flag:** `typing.Optional[CreateOrUpdateFlagRequestBody]` - -
-
- -
-
+```python +from schematic import Schematic +from schematic.environment import SchematicEnvironment -**icon:** `typing.Optional[str]` - -
-
+client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) -
-
+client.features.update_flag( + flag_id="flag_id", + default_value=True, + description="description", + key="key", + name="name", +) -**lifecycle_phase:** `typing.Optional[FeatureLifecyclePhase]` - +```
- -
-
- -**maintainer_account_member_id:** `typing.Optional[str]` -
+#### ⚙️ Parameters +
-**plural_name:** `typing.Optional[str]` - -
-
-
-**singular_name:** `typing.Optional[str]` +**flag_id:** `str` — flag_id
@@ -20030,7 +21378,7 @@ client.features.upsert_feature_for_billing_product(
-**trait_id:** `typing.Optional[str]` +**request:** `CreateFlagRequestBody`
@@ -20050,7 +21398,7 @@ client.features.upsert_feature_for_billing_product(
-
client.features.count_features(...) -> CountFeaturesResponse +
client.features.delete_flag(...) -> DeleteFlagResponse
@@ -20071,21 +21419,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.count_features( - boolean_require_event=True, - feature_type=[ - "boolean" - ], - ids=[ - "ids" - ], - managed_by="metronome", - plan_version_id="plan_version_id", - q="q", - without_company_override_for="without_company_override_for", - without_plan_entitlement_for="without_plan_entitlement_for", - limit=1000000, - offset=1000000, +client.features.delete_flag( + flag_id="flag_id", ) ``` @@ -20102,7 +21437,7 @@ client.features.count_features(
-**boolean_require_event:** `typing.Optional[bool]` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. +**flag_id:** `str` — flag_id
@@ -20110,63 +21445,87 @@ client.features.count_features(
-**feature_type:** `typing.Optional[typing.Union[FeatureType, typing.Sequence[FeatureType]]]` — Filter by one or more feature types (boolean, event, trait) +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` -
-
-
-**managed_by:** `typing.Optional[BillingProviderType]` — Filter for features managed by a billing provider, or by Schematic (no billing provider) -
+
+
client.features.update_flag_rules(...) -> UpdateFlagRulesResponse
-**plan_version_id:** `typing.Optional[str]` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used - -
-
+#### 🔌 Usage
-**q:** `typing.Optional[str]` — Search by feature name or ID - -
-
-
-**without_company_override_for:** `typing.Optional[str]` — Filter out features that already have a company override for the specified company ID - +```python +from schematic import Schematic, CreateOrUpdateRuleRequestBody, CreateOrUpdateConditionGroupRequestBody, CreateOrUpdateConditionRequestBody +from schematic.environment import SchematicEnvironment + +client = Schematic( + api_key="", + environment=SchematicEnvironment.DEFAULT, +) + +client.features.update_flag_rules( + flag_id="flag_id", + rules=[ + CreateOrUpdateRuleRequestBody( + condition_groups=[ + CreateOrUpdateConditionGroupRequestBody( + conditions=[ + CreateOrUpdateConditionRequestBody( + condition_type="base_plan", + operator="eq", + resource_ids=[ + "resource_ids" + ], + ) + ], + ) + ], + conditions=[ + CreateOrUpdateConditionRequestBody( + condition_type="base_plan", + operator="eq", + resource_ids=[ + "resource_ids" + ], + ) + ], + name="name", + priority=1000000, + value=True, + ) + ], +) + +```
+ + + +#### ⚙️ Parameters
-**without_plan_entitlement_for:** `typing.Optional[str]` — Filter out features that already have a plan entitlement for the specified plan ID - -
-
-
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**flag_id:** `str` — flag_id
@@ -20174,7 +21533,7 @@ client.features.count_features(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**rules:** `typing.List[CreateOrUpdateRuleRequestBody]`
@@ -20194,7 +21553,7 @@ client.features.count_features(
-
client.features.list_flags(...) -> ListFlagsResponse +
client.features.check_flag(...) -> CheckFlagResponse
@@ -20215,14 +21574,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.list_flags( - feature_id="feature_id", - ids=[ - "ids" - ], - q="q", - limit=1000000, - offset=1000000, +client.features.check_flag( + key="key", ) ``` @@ -20239,31 +21592,7 @@ client.features.list_flags(
-**feature_id:** `typing.Optional[str]` - -
-
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
- -
-
- -**q:** `typing.Optional[str]` — Search by flag name, key, or ID - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) +**key:** `str` — key
@@ -20271,7 +21600,7 @@ client.features.list_flags(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**request:** `CheckFlagRequestBody`
@@ -20291,7 +21620,7 @@ client.features.list_flags(
-
client.features.create_flag(...) -> CreateFlagResponse +
client.features.check_flags(...) -> CheckFlagsResponse
@@ -20312,12 +21641,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.create_flag( - default_value=True, - description="description", - key="key", - name="name", -) +client.features.check_flags() ```
@@ -20333,7 +21657,7 @@ client.features.create_flag(
-**request:** `CreateFlagRequestBody` +**request:** `CheckFlagRequestBody`
@@ -20353,7 +21677,7 @@ client.features.create_flag(
-
client.features.get_flag(...) -> GetFlagResponse +
client.features.check_flags_bulk(...) -> CheckFlagsBulkResponse
@@ -20366,7 +21690,7 @@ client.features.create_flag(
```python -from schematic import Schematic +from schematic import Schematic, CheckFlagRequestBody from schematic.environment import SchematicEnvironment client = Schematic( @@ -20374,8 +21698,10 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.get_flag( - flag_id="flag_id", +client.features.check_flags_bulk( + contexts=[ + CheckFlagRequestBody() + ], ) ``` @@ -20392,7 +21718,7 @@ client.features.get_flag(
-**flag_id:** `str` — flag_id +**contexts:** `typing.List[CheckFlagRequestBody]`
@@ -20412,7 +21738,7 @@ client.features.get_flag(
-
client.features.update_flag(...) -> UpdateFlagResponse +
client.features.count_flags(...) -> CountFlagsResponse
@@ -20433,12 +21759,14 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.update_flag( - flag_id="flag_id", - default_value=True, - description="description", - key="key", - name="name", +client.features.count_flags( + feature_id="feature_id", + ids=[ + "ids" + ], + q="q", + limit=1000000, + offset=1000000, ) ``` @@ -20455,7 +21783,7 @@ client.features.update_flag(
-**flag_id:** `str` — flag_id +**feature_id:** `typing.Optional[str]`
@@ -20463,7 +21791,31 @@ client.features.update_flag(
-**request:** `CreateFlagRequestBody` +**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` + +
+
+ +
+
+ +**q:** `typing.Optional[str]` — Search by flag name, key, or ID + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -20483,7 +21835,8 @@ client.features.update_flag(
-
client.features.delete_flag(...) -> DeleteFlagResponse +## insights +
client.insights.get_activity(...) -> GetActivityResponse
@@ -20504,8 +21857,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.delete_flag( - flag_id="flag_id", +client.insights.get_activity( + limit=1000000, ) ``` @@ -20522,7 +21875,7 @@ client.features.delete_flag(
-**flag_id:** `str` — flag_id +**limit:** `typing.Optional[int]`
@@ -20542,7 +21895,7 @@ client.features.delete_flag(
-
client.features.update_flag_rules(...) -> UpdateFlagRulesResponse +
client.insights.get_environment_feature_usage_time_series(...) -> GetEnvironmentFeatureUsageTimeSeriesResponse
@@ -20555,45 +21908,20 @@ client.features.delete_flag(
```python -from schematic import Schematic, CreateOrUpdateRuleRequestBody, CreateOrUpdateConditionGroupRequestBody, CreateOrUpdateConditionRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment +import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.features.update_flag_rules( - flag_id="flag_id", - rules=[ - CreateOrUpdateRuleRequestBody( - condition_groups=[ - CreateOrUpdateConditionGroupRequestBody( - conditions=[ - CreateOrUpdateConditionRequestBody( - condition_type="base_plan", - operator="eq", - resource_ids=[ - "resource_ids" - ], - ) - ], - ) - ], - conditions=[ - CreateOrUpdateConditionRequestBody( - condition_type="base_plan", - operator="eq", - resource_ids=[ - "resource_ids" - ], - ) - ], - name="name", - priority=1000000, - value=True, - ) - ], +client.insights.get_environment_feature_usage_time_series( + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + feature_id="feature_id", + granularity="daily", + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), ) ``` @@ -20610,7 +21938,7 @@ client.features.update_flag_rules(
-**flag_id:** `str` — flag_id +**end_time:** `datetime.datetime`
@@ -20618,7 +21946,23 @@ client.features.update_flag_rules(
-**rules:** `typing.List[CreateOrUpdateRuleRequestBody]` +**feature_id:** `str` + +
+
+ +
+
+ +**start_time:** `datetime.datetime` + +
+
+ +
+
+ +**granularity:** `typing.Optional[TimeSeriesGranularity]`
@@ -20638,7 +21982,7 @@ client.features.update_flag_rules(
-
client.features.check_flag(...) -> CheckFlagResponse +
client.insights.get_plan_growth(...) -> GetPlanGrowthResponse
@@ -20659,8 +22003,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.check_flag( - key="key", +client.insights.get_plan_growth( + months=1000000, ) ``` @@ -20677,15 +22021,7 @@ client.features.check_flag(
-**key:** `str` — key - -
-
- -
-
- -**request:** `CheckFlagRequestBody` +**months:** `typing.Optional[int]`
@@ -20705,7 +22041,7 @@ client.features.check_flag(
-
client.features.check_flags(...) -> CheckFlagsResponse +
client.insights.get_summary() -> GetSummaryResponse
@@ -20726,7 +22062,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.features.check_flags() +client.insights.get_summary() ```
@@ -20742,14 +22078,6 @@ client.features.check_flags()
-**request:** `CheckFlagRequestBody` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -20762,7 +22090,7 @@ client.features.check_flags()
-
client.features.check_flags_bulk(...) -> CheckFlagsBulkResponse +
client.insights.get_top_features_by_usage(...) -> GetTopFeaturesByUsageResponse
@@ -20775,18 +22103,19 @@ client.features.check_flags()
```python -from schematic import Schematic, CheckFlagRequestBody +from schematic import Schematic from schematic.environment import SchematicEnvironment +import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.features.check_flags_bulk( - contexts=[ - CheckFlagRequestBody() - ], +client.insights.get_top_features_by_usage( + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + limit=1000000, + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), ) ``` @@ -20803,7 +22132,23 @@ client.features.check_flags_bulk(
-**contexts:** `typing.List[CheckFlagRequestBody]` +**end_time:** `datetime.datetime` + +
+
+ +
+
+ +**start_time:** `datetime.datetime` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]`
@@ -20823,7 +22168,7 @@ client.features.check_flags_bulk(
-
client.features.count_flags(...) -> CountFlagsResponse +
client.insights.get_environment_trait_usage_time_series(...) -> GetEnvironmentTraitUsageTimeSeriesResponse
@@ -20838,20 +22183,18 @@ client.features.check_flags_bulk( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment +import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.features.count_flags( +client.insights.get_environment_trait_usage_time_series( + end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), feature_id="feature_id", - ids=[ - "ids" - ], - q="q", - limit=1000000, - offset=1000000, + granularity="daily", + start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), ) ``` @@ -20868,15 +22211,7 @@ client.features.count_flags(
-**feature_id:** `typing.Optional[str]` - -
-
- -
-
- -**ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` +**end_time:** `datetime.datetime`
@@ -20884,7 +22219,7 @@ client.features.count_flags(
-**q:** `typing.Optional[str]` — Search by flag name, key, or ID +**feature_id:** `str`
@@ -20892,7 +22227,7 @@ client.features.count_flags(
-**limit:** `typing.Optional[int]` — Page limit (default 100) +**start_time:** `datetime.datetime`
@@ -20900,7 +22235,7 @@ client.features.count_flags(
-**offset:** `typing.Optional[int]` — Page offset (default 0) +**granularity:** `typing.Optional[TimeSeriesGranularity]`
@@ -20920,8 +22255,8 @@ client.features.count_flags(
-## insights -
client.insights.get_activity(...) -> GetActivityResponse +## integrationsapi +
client.integrationsapi.run_integration(...) -> RunIntegrationResponse
@@ -20942,8 +22277,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_activity( - limit=1000000, +client.integrationsapi.run_integration( + integration_id="integration_id", ) ``` @@ -20960,7 +22295,7 @@ client.insights.get_activity(
-**limit:** `typing.Optional[int]` +**integration_id:** `str` — integration_id
@@ -20980,7 +22315,7 @@ client.insights.get_activity(
-
client.insights.get_environment_feature_usage_time_series(...) -> GetEnvironmentFeatureUsageTimeSeriesResponse +
client.integrationsapi.list_integrations(...) -> ListIntegrationsResponse
@@ -20995,18 +22330,22 @@ client.insights.get_activity( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment -import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_environment_feature_usage_time_series( - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - feature_id="feature_id", - granularity="daily", - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), +client.integrationsapi.list_integrations( + billing_only=True, + exclude_ids=[ + "exclude_ids" + ], + id="id", + state="active", + type="clerk", + limit=1000000, + offset=1000000, ) ``` @@ -21023,7 +22362,31 @@ client.insights.get_environment_feature_usage_time_series(
-**end_time:** `datetime.datetime` +**billing_only:** `typing.Optional[bool]` + +
+
+ +
+
+ +**exclude_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` + +
+
+ +
+
+ +**id:** `typing.Optional[str]` + +
+
+ +
+
+ +**state:** `typing.Optional[IntegrationState]`
@@ -21031,7 +22394,7 @@ client.insights.get_environment_feature_usage_time_series(
-**feature_id:** `str` +**type:** `typing.Optional[IntegrationType]`
@@ -21039,7 +22402,7 @@ client.insights.get_environment_feature_usage_time_series(
-**start_time:** `datetime.datetime` +**limit:** `typing.Optional[int]` — Page limit (default 100)
@@ -21047,7 +22410,7 @@ client.insights.get_environment_feature_usage_time_series(
-**granularity:** `typing.Optional[TimeSeriesGranularity]` +**offset:** `typing.Optional[int]` — Page offset (default 0)
@@ -21067,7 +22430,7 @@ client.insights.get_environment_feature_usage_time_series(
-
client.insights.get_plan_growth(...) -> GetPlanGrowthResponse +
client.integrationsapi.get_integration_webhook_url(...) -> GetIntegrationWebhookUrlResponse
@@ -21088,8 +22451,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_plan_growth( - months=1000000, +client.integrationsapi.get_integration_webhook_url( + type="type", ) ``` @@ -21106,7 +22469,7 @@ client.insights.get_plan_growth(
-**months:** `typing.Optional[int]` +**type:** `str` — type
@@ -21126,7 +22489,7 @@ client.insights.get_plan_growth(
-
client.insights.get_summary() -> GetSummaryResponse +
client.integrationsapi.install_integration(...) -> InstallIntegrationResponse
@@ -21147,7 +22510,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_summary() +client.integrationsapi.install_integration( + type="clerk", +) ```
@@ -21163,6 +22528,14 @@ client.insights.get_summary()
+**request:** `InstallIntegrationRequestBody` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -21175,7 +22548,7 @@ client.insights.get_summary()
-
client.insights.get_top_features_by_usage(...) -> GetTopFeaturesByUsageResponse +
client.integrationsapi.start_data_import(...) -> StartDataImportResponse
@@ -21190,17 +22563,14 @@ client.insights.get_summary() ```python from schematic import Schematic from schematic.environment import SchematicEnvironment -import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_top_features_by_usage( - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - limit=1000000, - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), +client.integrationsapi.start_data_import( + integration_id="integration_id", ) ``` @@ -21217,7 +22587,7 @@ client.insights.get_top_features_by_usage(
-**end_time:** `datetime.datetime` +**integration_id:** `str`
@@ -21225,7 +22595,7 @@ client.insights.get_top_features_by_usage(
-**start_time:** `datetime.datetime` +**company_matching_criteria:** `typing.Optional[CompanyMatchingCriteria]`
@@ -21233,7 +22603,7 @@ client.insights.get_top_features_by_usage(
-**limit:** `typing.Optional[int]` +**company_matching_field:** `typing.Optional[str]`
@@ -21253,7 +22623,7 @@ client.insights.get_top_features_by_usage(
-
client.insights.get_environment_trait_usage_time_series(...) -> GetEnvironmentTraitUsageTimeSeriesResponse +
client.integrationsapi.load_sample_data_set() -> LoadSampleDataSetResponse
@@ -21268,19 +22638,13 @@ client.insights.get_top_features_by_usage( ```python from schematic import Schematic from schematic.environment import SchematicEnvironment -import datetime client = Schematic( api_key="", environment=SchematicEnvironment.DEFAULT, ) -client.insights.get_environment_trait_usage_time_series( - end_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), - feature_id="feature_id", - granularity="daily", - start_time=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), -) +client.integrationsapi.load_sample_data_set() ```
@@ -21296,38 +22660,6 @@ client.insights.get_environment_trait_usage_time_series(
-**end_time:** `datetime.datetime` - -
-
- -
-
- -**feature_id:** `str` - -
-
- -
-
- -**start_time:** `datetime.datetime` - -
-
- -
-
- -**granularity:** `typing.Optional[TimeSeriesGranularity]` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -21340,8 +22672,7 @@ client.insights.get_environment_trait_usage_time_series(
-## integrationsapi -
client.integrationsapi.run_integration(...) -> RunIntegrationResponse +
client.integrationsapi.get_stripe_sandbox_claim_link() -> GetStripeSandboxClaimLinkResponse
@@ -21362,9 +22693,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.run_integration( - integration_id="integration_id", -) +client.integrationsapi.get_stripe_sandbox_claim_link() ```
@@ -21380,14 +22709,6 @@ client.integrationsapi.run_integration(
-**integration_id:** `str` — integration_id - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -21400,7 +22721,7 @@ client.integrationsapi.run_integration(
-
client.integrationsapi.list_integrations(...) -> ListIntegrationsResponse +
client.integrationsapi.get_stripe_sandbox_keys() -> GetStripeSandboxKeysResponse
@@ -21421,17 +22742,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.list_integrations( - billing_only=True, - exclude_ids=[ - "exclude_ids" - ], - id="id", - state="active", - type="clerk", - limit=1000000, - offset=1000000, -) +client.integrationsapi.get_stripe_sandbox_keys() ```
@@ -21447,62 +22758,6 @@ client.integrationsapi.list_integrations(
-**billing_only:** `typing.Optional[bool]` - -
-
- -
-
- -**exclude_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` - -
-
- -
-
- -**id:** `typing.Optional[str]` - -
-
- -
-
- -**state:** `typing.Optional[IntegrationState]` - -
-
- -
-
- -**type:** `typing.Optional[IntegrationType]` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -21515,7 +22770,7 @@ client.integrationsapi.list_integrations(
-
client.integrationsapi.get_integration_webhook_url(...) -> GetIntegrationWebhookUrlResponse +
client.integrationsapi.claim_stripe_sandbox_keys(...) -> ClaimStripeSandboxKeysResponse
@@ -21536,8 +22791,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.get_integration_webhook_url( - type="type", +client.integrationsapi.claim_stripe_sandbox_keys( + token="token", ) ``` @@ -21554,7 +22809,7 @@ client.integrationsapi.get_integration_webhook_url(
-**type:** `str` — type +**token:** `str`
@@ -21574,7 +22829,7 @@ client.integrationsapi.get_integration_webhook_url(
-
client.integrationsapi.install_integration(...) -> InstallIntegrationResponse +
client.integrationsapi.assume_stripe_installed(...) -> AssumeStripeInstalledResponse
@@ -21595,7 +22850,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.install_integration( +client.integrationsapi.assume_stripe_installed( type="clerk", ) @@ -21633,7 +22888,7 @@ client.integrationsapi.install_integration(
-
client.integrationsapi.start_data_import(...) -> StartDataImportResponse +
client.integrationsapi.install_stripe(...) -> InstallStripeResponse
@@ -21654,8 +22909,8 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.start_data_import( - integration_id="integration_id", +client.integrationsapi.install_stripe( + type="clerk", ) ``` @@ -21672,23 +22927,7 @@ client.integrationsapi.start_data_import(
-**integration_id:** `str` - -
-
- -
-
- -**company_matching_criteria:** `typing.Optional[CompanyMatchingCriteria]` - -
-
- -
-
- -**company_matching_field:** `typing.Optional[str]` +**request:** `InstallIntegrationRequestBody`
@@ -21708,7 +22947,7 @@ client.integrationsapi.start_data_import(
-
client.integrationsapi.load_sample_data_set() -> LoadSampleDataSetResponse +
client.integrationsapi.install_stripe_claimable_sandbox(...) -> InstallStripeClaimableSandboxResponse
@@ -21729,7 +22968,9 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.load_sample_data_set() +client.integrationsapi.install_stripe_claimable_sandbox( + email="email", +) ```
@@ -21745,58 +22986,31 @@ client.integrationsapi.load_sample_data_set()
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**email:** `str`
- -
- - - - -
-
client.integrationsapi.assume_stripe_installed(...) -> AssumeStripeInstalledResponse
-#### 🔌 Usage - -
-
+**country:** `typing.Optional[str]` + +
+
-```python -from schematic import Schematic -from schematic.environment import SchematicEnvironment - -client = Schematic( - api_key="", - environment=SchematicEnvironment.DEFAULT, -) - -client.integrationsapi.assume_stripe_installed( - type="clerk", -) - -``` -
-
+**name:** `typing.Optional[str]` +
-#### ⚙️ Parameters -
-
-
- -**request:** `InstallIntegrationRequestBody` +**seed_sample_data:** `typing.Optional[bool]`
@@ -21816,7 +23030,7 @@ client.integrationsapi.assume_stripe_installed(
-
client.integrationsapi.install_stripe(...) -> InstallStripeResponse +
client.integrationsapi.list_stripe_sandbox_countries() -> ListStripeSandboxCountriesResponse
@@ -21837,9 +23051,7 @@ client = Schematic( environment=SchematicEnvironment.DEFAULT, ) -client.integrationsapi.install_stripe( - type="clerk", -) +client.integrationsapi.list_stripe_sandbox_countries() ```
@@ -21855,14 +23067,6 @@ client.integrationsapi.install_stripe(
-**request:** `InstallIntegrationRequestBody` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py index 72c0d7a..e4e453a 100644 --- a/src/schematic/__init__.py +++ b/src/schematic/__init__.py @@ -98,6 +98,7 @@ CheckoutFieldWithValue, CheckoutSettingsResponseData, CheckoutSubscription, + ClaimedStripeSandboxKeysResponseData, ClerkIntegrationConfig, CompanyBillingAddressView, CompanyBillingCheckoutSettings, @@ -105,6 +106,7 @@ CompanyBillingDetailsView, CompanyBillingEntityResponseData, CompanyBillingEntitySubscriptionResponseData, + CompanyBillingProfileResponseData, CompanyCreditBalance, CompanyCreditBalanceResponseData, CompanyDetailResponseData, @@ -174,6 +176,8 @@ CreditGrantExpiryRequestBody, CreditGrantSortOrder, CreditLeaseResponseData, + CreditSpendPolicyResponseData, + CreditSpendPolicyScope, CreditTransferResponseData, CreditTransferView, CreditTriggerConfig, @@ -310,6 +314,7 @@ OnboardingTrack, OrbIntegrationConfig, OrderedPlansInGroup, + OtlpEnvironmentSettingsResponseData, PaymentMethodRequestBody, PaymentMethodResponseData, PendingMigrationResponseData, @@ -374,6 +379,7 @@ RuleConditionDetailResponseData, RuleConditionGroupDetailResponseData, RuleConditionGroupResponseData, + RuleConditionPlanVersionResponseData, RuleConditionResponseData, RuleDetailResponseData, RuleResponseData, @@ -411,6 +417,10 @@ SortDirection, StripeEmbedInfo, StripeIntegrationConfig, + StripeSandboxClaimLink, + StripeSandboxCountriesResponseData, + StripeSandboxInstallResponseData, + StripeSandboxKeysResponseData, SubscriptionStatus, SubscriptionTraitUpdate, SubscriptionType, @@ -467,7 +477,14 @@ WhoAmIResponseData, WorkOsIntegrationConfig, ) - from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError, UnauthorizedError + from .errors import ( + BadRequestError, + ForbiddenError, + InternalServerError, + NotFoundError, + PaymentRequiredError, + UnauthorizedError, + ) from . import ( accesstokens, accounts, @@ -541,6 +558,8 @@ ListBillingProductPricesResponse, ListBillingProductsParams, ListBillingProductsResponse, + ListCompanyBillingProfilesParams, + ListCompanyBillingProfilesResponse, ListCouponsParams, ListCouponsResponse, ListCustomersWithSubscriptionsParams, @@ -551,6 +570,7 @@ ListMetersResponse, ListPaymentMethodsParams, ListPaymentMethodsResponse, + UpdateCompanyBillingProfileResponse, UpsertBillingCouponResponse, UpsertBillingCustomerResponse, UpsertBillingMeterResponse, @@ -679,14 +699,19 @@ CountCreditBundlesResponse, CountCreditEventLedgerParams, CountCreditEventLedgerResponse, + CountCreditSpendPoliciesParams, + CountCreditSpendPoliciesResponse, CreateBillingCreditResponse, CreateBillingPlanCreditGrantResponse, CreateCreditBundleResponse, + CreateCreditSpendPolicyResponse, DeleteBillingPlanCreditGrantParams, DeleteBillingPlanCreditGrantResponse, DeleteCreditBundleResponse, + DeleteCreditSpendPolicyResponse, ExtendCreditLeaseResponse, GetCreditBundleResponse, + GetCreditSpendPolicyResponse, GetSingleBillingCreditResponse, GetSingleBillingPlanCreditGrantResponse, GrantBillingCreditsToCompanyResponse, @@ -702,6 +727,8 @@ ListCreditBundlesResponse, ListCreditEventLedgerParams, ListCreditEventLedgerResponse, + ListCreditSpendPoliciesParams, + ListCreditSpendPoliciesResponse, ListGrantsForCreditParams, ListGrantsForCreditResponse, ReleaseCreditLeaseResponse, @@ -709,6 +736,7 @@ UpdateBillingCreditResponse, UpdateBillingPlanCreditGrantResponse, UpdateCreditBundleDetailsResponse, + UpdateCreditSpendPolicyResponse, ZeroOutGrantResponse, ) from .dataexports import ( @@ -763,12 +791,15 @@ from .events import ( CreateEventBatchResponse, CreateEventResponse, + DeleteOtlpEnvironmentSettingsResponse, GetEventResponse, GetEventSummariesParams, GetEventSummariesResponse, + GetOtlpEnvironmentSettingsResponse, GetSegmentIntegrationStatusResponse, ListEventsParams, ListEventsResponse, + UpsertOtlpEnvironmentSettingsResponse, ) from .features import ( CheckFlagResponse, @@ -808,11 +839,16 @@ ) from .integrationsapi import ( AssumeStripeInstalledResponse, + ClaimStripeSandboxKeysResponse, GetIntegrationWebhookUrlResponse, + GetStripeSandboxClaimLinkResponse, + GetStripeSandboxKeysResponse, InstallIntegrationResponse, + InstallStripeClaimableSandboxResponse, InstallStripeResponse, ListIntegrationsParams, ListIntegrationsResponse, + ListStripeSandboxCountriesResponse, LoadSampleDataSetResponse, RunIntegrationResponse, StartDataImportResponse, @@ -1000,6 +1036,8 @@ "CheckoutInternalResponse": ".checkout", "CheckoutSettingsResponseData": ".types", "CheckoutSubscription": ".types", + "ClaimStripeSandboxKeysResponse": ".integrationsapi", + "ClaimedStripeSandboxKeysResponseData": ".types", "ClerkIntegrationConfig": ".types", "CompanyBillingAddressView": ".types", "CompanyBillingCheckoutSettings": ".types", @@ -1007,6 +1045,7 @@ "CompanyBillingDetailsView": ".types", "CompanyBillingEntityResponseData": ".types", "CompanyBillingEntitySubscriptionResponseData": ".types", + "CompanyBillingProfileResponseData": ".types", "CompanyCreditBalance": ".types", "CompanyCreditBalanceResponseData": ".types", "CompanyDetailResponseData": ".types", @@ -1077,6 +1116,8 @@ "CountCreditBundlesResponse": ".credits", "CountCreditEventLedgerParams": ".credits", "CountCreditEventLedgerResponse": ".credits", + "CountCreditSpendPoliciesParams": ".credits", + "CountCreditSpendPoliciesResponse": ".credits", "CountCustomersParams": ".billing", "CountCustomersResponse": ".billing", "CountEntityKeyDefinitionsParams": ".companies", @@ -1125,6 +1166,7 @@ "CreateCompanyResponse": ".companies", "CreateComponentResponse": ".components", "CreateCreditBundleResponse": ".credits", + "CreateCreditSpendPolicyResponse": ".credits", "CreateCustomPlanBundlePlanRequestBody": ".types", "CreateCustomPlanBundleResponse": ".planbundle", "CreateCustomPlanResponse": ".plans", @@ -1167,6 +1209,8 @@ "CreditGrantExpiryRequestBody": ".types", "CreditGrantSortOrder": ".types", "CreditLeaseResponseData": ".types", + "CreditSpendPolicyResponseData": ".types", + "CreditSpendPolicyScope": ".types", "CreditTransferResponseData": ".types", "CreditTransferView": ".types", "CreditTriggerConfig": ".types", @@ -1216,11 +1260,13 @@ "DeleteCompanyResponse": ".companies", "DeleteComponentResponse": ".components", "DeleteCreditBundleResponse": ".credits", + "DeleteCreditSpendPolicyResponse": ".credits", "DeleteEntityKeyDefinitionResponse": ".companies", "DeleteEntityTraitDefinitionResponse": ".companies", "DeleteEnvironmentResponse": ".accounts", "DeleteFeatureResponse": ".features", "DeleteFlagResponse": ".features", + "DeleteOtlpEnvironmentSettingsResponse": ".events", "DeletePaymentMethodByExternalIdResponse": ".billing", "DeletePlanEntitlementResponse": ".entitlements", "DeletePlanResponse": ".plans", @@ -1310,6 +1356,7 @@ "GetConfigurationResponse": ".catalogs", "GetCreditBundleResponse": ".credits", "GetCreditBundlesInCatalogResponse": ".catalogs", + "GetCreditSpendPolicyResponse": ".credits", "GetDataExportResponse": ".dataexports", "GetDerivedFeaturesResponse": ".catalogs", "GetEntityTraitDefinitionResponse": ".companies", @@ -1336,6 +1383,7 @@ "GetOnboardingStateResponse": ".accounts", "GetOrCreateCompanyMembershipResponse": ".companies", "GetOrCreateEntityTraitDefinitionResponse": ".companies", + "GetOtlpEnvironmentSettingsResponse": ".events", "GetPlanChangeResponse": ".companies", "GetPlanEntitlementResponse": ".entitlements", "GetPlanGroupParams": ".plangroups", @@ -1352,6 +1400,8 @@ "GetSingleBillingCreditResponse": ".credits", "GetSingleBillingPlanCreditGrantResponse": ".credits", "GetSingleLicenseResponse": ".licenses", + "GetStripeSandboxClaimLinkResponse": ".integrationsapi", + "GetStripeSandboxKeysResponse": ".integrationsapi", "GetSummaryResponse": ".insights", "GetTopFeaturesByUsageParams": ".insights", "GetTopFeaturesByUsageResponse": ".insights", @@ -1367,6 +1417,7 @@ "InsightsSummaryResponseData": ".types", "InstallIntegrationRequestBody": ".types", "InstallIntegrationResponse": ".integrationsapi", + "InstallStripeClaimableSandboxResponse": ".integrationsapi", "InstallStripeResponse": ".integrationsapi", "IntegrationCapabilities": ".types", "IntegrationConfig": ".types", @@ -1415,6 +1466,8 @@ "ListCatalogsResponse": ".catalogs", "ListCompaniesParams": ".companies", "ListCompaniesResponse": ".companies", + "ListCompanyBillingProfilesParams": ".billing", + "ListCompanyBillingProfilesResponse": ".billing", "ListCompanyCreditBalancesParams": ".credits", "ListCompanyCreditBalancesResponse": ".credits", "ListCompanyGrantsParams": ".credits", @@ -1433,6 +1486,8 @@ "ListCreditBundlesResponse": ".credits", "ListCreditEventLedgerParams": ".credits", "ListCreditEventLedgerResponse": ".credits", + "ListCreditSpendPoliciesParams": ".credits", + "ListCreditSpendPoliciesResponse": ".credits", "ListCustomPlanBillingsParams": ".plans", "ListCustomPlanBillingsResponse": ".plans", "ListCustomersWithSubscriptionsParams": ".billing", @@ -1485,6 +1540,7 @@ "ListPlansResponse": ".plans", "ListScheduledCheckoutsParams": ".scheduledcheckout", "ListScheduledCheckoutsResponse": ".scheduledcheckout", + "ListStripeSandboxCountriesResponse": ".integrationsapi", "ListUsersParams": ".companies", "ListUsersResponse": ".companies", "ListWebhookEventsParams": ".webhooks", @@ -1521,8 +1577,10 @@ "OnboardingTrack": ".types", "OrbIntegrationConfig": ".types", "OrderedPlansInGroup": ".types", + "OtlpEnvironmentSettingsResponseData": ".types", "PaymentMethodRequestBody": ".types", "PaymentMethodResponseData": ".types", + "PaymentRequiredError": ".errors", "PendingMigrationResponseData": ".types", "PlanBillingSource": ".types", "PlanBundleAction": ".types", @@ -1596,6 +1654,7 @@ "RuleConditionDetailResponseData": ".types", "RuleConditionGroupDetailResponseData": ".types", "RuleConditionGroupResponseData": ".types", + "RuleConditionPlanVersionResponseData": ".types", "RuleConditionResponseData": ".types", "RuleDetailResponseData": ".types", "RuleResponseData": ".types", @@ -1640,6 +1699,10 @@ "StartDataImportResponse": ".integrationsapi", "StripeEmbedInfo": ".types", "StripeIntegrationConfig": ".types", + "StripeSandboxClaimLink": ".types", + "StripeSandboxCountriesResponseData": ".types", + "StripeSandboxInstallResponseData": ".types", + "StripeSandboxKeysResponseData": ".types", "SubscriptionStatus": ".types", "SubscriptionTraitUpdate": ".types", "SubscriptionType": ".types", @@ -1666,12 +1729,14 @@ "UpdateBillingPlanCreditGrantResponse": ".credits", "UpdateCatalogResponse": ".catalogs", "UpdateCompanyBillingDetailsResponse": ".checkout", + "UpdateCompanyBillingProfileResponse": ".billing", "UpdateCompanyOverrideResponse": ".entitlements", "UpdateCompanyPlansResponse": ".plans", "UpdateComponentResponse": ".components", "UpdateConfigurationResponse": ".catalogs", "UpdateCreditBundleDetailsResponse": ".credits", "UpdateCreditBundleRequestBody": ".types", + "UpdateCreditSpendPolicyResponse": ".credits", "UpdateCustomerSubscriptionTrialEndResponse": ".checkout", "UpdateEntitlementReqCommon": ".types", "UpdateEntityTraitDefinitionResponse": ".companies", @@ -1704,6 +1769,7 @@ "UpsertCompanyTraitResponse": ".companies", "UpsertFeatureForBillingProductResponse": ".features", "UpsertInvoiceResponse": ".billing", + "UpsertOtlpEnvironmentSettingsResponse": ".events", "UpsertPaymentMethodResponse": ".billing", "UpsertPlanEntitlementForBillingProductResponse": ".entitlements", "UpsertPlanForBillingProductResponse": ".plans", @@ -1889,6 +1955,8 @@ def __dir__(): "CheckoutInternalResponse", "CheckoutSettingsResponseData", "CheckoutSubscription", + "ClaimStripeSandboxKeysResponse", + "ClaimedStripeSandboxKeysResponseData", "ClerkIntegrationConfig", "CompanyBillingAddressView", "CompanyBillingCheckoutSettings", @@ -1896,6 +1964,7 @@ def __dir__(): "CompanyBillingDetailsView", "CompanyBillingEntityResponseData", "CompanyBillingEntitySubscriptionResponseData", + "CompanyBillingProfileResponseData", "CompanyCreditBalance", "CompanyCreditBalanceResponseData", "CompanyDetailResponseData", @@ -1966,6 +2035,8 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", + "CountCreditSpendPoliciesParams", + "CountCreditSpendPoliciesResponse", "CountCustomersParams", "CountCustomersResponse", "CountEntityKeyDefinitionsParams", @@ -2014,6 +2085,7 @@ def __dir__(): "CreateCompanyResponse", "CreateComponentResponse", "CreateCreditBundleResponse", + "CreateCreditSpendPolicyResponse", "CreateCustomPlanBundlePlanRequestBody", "CreateCustomPlanBundleResponse", "CreateCustomPlanResponse", @@ -2056,6 +2128,8 @@ def __dir__(): "CreditGrantExpiryRequestBody", "CreditGrantSortOrder", "CreditLeaseResponseData", + "CreditSpendPolicyResponseData", + "CreditSpendPolicyScope", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", @@ -2105,11 +2179,13 @@ def __dir__(): "DeleteCompanyResponse", "DeleteComponentResponse", "DeleteCreditBundleResponse", + "DeleteCreditSpendPolicyResponse", "DeleteEntityKeyDefinitionResponse", "DeleteEntityTraitDefinitionResponse", "DeleteEnvironmentResponse", "DeleteFeatureResponse", "DeleteFlagResponse", + "DeleteOtlpEnvironmentSettingsResponse", "DeletePaymentMethodByExternalIdResponse", "DeletePlanEntitlementResponse", "DeletePlanResponse", @@ -2199,6 +2275,7 @@ def __dir__(): "GetConfigurationResponse", "GetCreditBundleResponse", "GetCreditBundlesInCatalogResponse", + "GetCreditSpendPolicyResponse", "GetDataExportResponse", "GetDerivedFeaturesResponse", "GetEntityTraitDefinitionResponse", @@ -2225,6 +2302,7 @@ def __dir__(): "GetOnboardingStateResponse", "GetOrCreateCompanyMembershipResponse", "GetOrCreateEntityTraitDefinitionResponse", + "GetOtlpEnvironmentSettingsResponse", "GetPlanChangeResponse", "GetPlanEntitlementResponse", "GetPlanGroupParams", @@ -2241,6 +2319,8 @@ def __dir__(): "GetSingleBillingCreditResponse", "GetSingleBillingPlanCreditGrantResponse", "GetSingleLicenseResponse", + "GetStripeSandboxClaimLinkResponse", + "GetStripeSandboxKeysResponse", "GetSummaryResponse", "GetTopFeaturesByUsageParams", "GetTopFeaturesByUsageResponse", @@ -2256,6 +2336,7 @@ def __dir__(): "InsightsSummaryResponseData", "InstallIntegrationRequestBody", "InstallIntegrationResponse", + "InstallStripeClaimableSandboxResponse", "InstallStripeResponse", "IntegrationCapabilities", "IntegrationConfig", @@ -2304,6 +2385,8 @@ def __dir__(): "ListCatalogsResponse", "ListCompaniesParams", "ListCompaniesResponse", + "ListCompanyBillingProfilesParams", + "ListCompanyBillingProfilesResponse", "ListCompanyCreditBalancesParams", "ListCompanyCreditBalancesResponse", "ListCompanyGrantsParams", @@ -2322,6 +2405,8 @@ def __dir__(): "ListCreditBundlesResponse", "ListCreditEventLedgerParams", "ListCreditEventLedgerResponse", + "ListCreditSpendPoliciesParams", + "ListCreditSpendPoliciesResponse", "ListCustomPlanBillingsParams", "ListCustomPlanBillingsResponse", "ListCustomersWithSubscriptionsParams", @@ -2374,6 +2459,7 @@ def __dir__(): "ListPlansResponse", "ListScheduledCheckoutsParams", "ListScheduledCheckoutsResponse", + "ListStripeSandboxCountriesResponse", "ListUsersParams", "ListUsersResponse", "ListWebhookEventsParams", @@ -2410,8 +2496,10 @@ def __dir__(): "OnboardingTrack", "OrbIntegrationConfig", "OrderedPlansInGroup", + "OtlpEnvironmentSettingsResponseData", "PaymentMethodRequestBody", "PaymentMethodResponseData", + "PaymentRequiredError", "PendingMigrationResponseData", "PlanBillingSource", "PlanBundleAction", @@ -2485,6 +2573,7 @@ def __dir__(): "RuleConditionDetailResponseData", "RuleConditionGroupDetailResponseData", "RuleConditionGroupResponseData", + "RuleConditionPlanVersionResponseData", "RuleConditionResponseData", "RuleDetailResponseData", "RuleResponseData", @@ -2529,6 +2618,10 @@ def __dir__(): "StartDataImportResponse", "StripeEmbedInfo", "StripeIntegrationConfig", + "StripeSandboxClaimLink", + "StripeSandboxCountriesResponseData", + "StripeSandboxInstallResponseData", + "StripeSandboxKeysResponseData", "SubscriptionStatus", "SubscriptionTraitUpdate", "SubscriptionType", @@ -2555,12 +2648,14 @@ def __dir__(): "UpdateBillingPlanCreditGrantResponse", "UpdateCatalogResponse", "UpdateCompanyBillingDetailsResponse", + "UpdateCompanyBillingProfileResponse", "UpdateCompanyOverrideResponse", "UpdateCompanyPlansResponse", "UpdateComponentResponse", "UpdateConfigurationResponse", "UpdateCreditBundleDetailsResponse", "UpdateCreditBundleRequestBody", + "UpdateCreditSpendPolicyResponse", "UpdateCustomerSubscriptionTrialEndResponse", "UpdateEntitlementReqCommon", "UpdateEntityTraitDefinitionResponse", @@ -2593,6 +2688,7 @@ def __dir__(): "UpsertCompanyTraitResponse", "UpsertFeatureForBillingProductResponse", "UpsertInvoiceResponse", + "UpsertOtlpEnvironmentSettingsResponse", "UpsertPaymentMethodResponse", "UpsertPlanEntitlementForBillingProductResponse", "UpsertPlanForBillingProductResponse", diff --git a/src/schematic/accounts/client.py b/src/schematic/accounts/client.py index 19d394a..2a3e7a0 100644 --- a/src/schematic/accounts/client.py +++ b/src/schematic/accounts/client.py @@ -854,6 +854,7 @@ def get_onboarding_state( def update_onboarding_state( self, *, + country: typing.Optional[str] = OMIT, dismissed: typing.Optional[bool] = OMIT, path: typing.Optional[OnboardingPath] = OMIT, pricing_page_url: typing.Optional[str] = OMIT, @@ -864,6 +865,8 @@ def update_onboarding_state( """ Parameters ---------- + country : typing.Optional[str] + dismissed : typing.Optional[bool] path : typing.Optional[OnboardingPath] @@ -892,6 +895,7 @@ def update_onboarding_state( client.accounts.update_onboarding_state() """ _response = self._raw_client.update_onboarding_state( + country=country, dismissed=dismissed, path=path, pricing_page_url=pricing_page_url, @@ -1909,6 +1913,7 @@ async def main() -> None: async def update_onboarding_state( self, *, + country: typing.Optional[str] = OMIT, dismissed: typing.Optional[bool] = OMIT, path: typing.Optional[OnboardingPath] = OMIT, pricing_page_url: typing.Optional[str] = OMIT, @@ -1919,6 +1924,8 @@ async def update_onboarding_state( """ Parameters ---------- + country : typing.Optional[str] + dismissed : typing.Optional[bool] path : typing.Optional[OnboardingPath] @@ -1955,6 +1962,7 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.update_onboarding_state( + country=country, dismissed=dismissed, path=path, pricing_page_url=pricing_page_url, diff --git a/src/schematic/accounts/raw_client.py b/src/schematic/accounts/raw_client.py index 3167ab0..67e34fb 100644 --- a/src/schematic/accounts/raw_client.py +++ b/src/schematic/accounts/raw_client.py @@ -2036,6 +2036,7 @@ def get_onboarding_state( def update_onboarding_state( self, *, + country: typing.Optional[str] = OMIT, dismissed: typing.Optional[bool] = OMIT, path: typing.Optional[OnboardingPath] = OMIT, pricing_page_url: typing.Optional[str] = OMIT, @@ -2046,6 +2047,8 @@ def update_onboarding_state( """ Parameters ---------- + country : typing.Optional[str] + dismissed : typing.Optional[bool] path : typing.Optional[OnboardingPath] @@ -2068,6 +2071,7 @@ def update_onboarding_state( "onboarding-state", method="POST", json={ + "country": country, "dismissed": dismissed, "path": path, "pricing_page_url": pricing_page_url, @@ -4328,6 +4332,7 @@ async def get_onboarding_state( async def update_onboarding_state( self, *, + country: typing.Optional[str] = OMIT, dismissed: typing.Optional[bool] = OMIT, path: typing.Optional[OnboardingPath] = OMIT, pricing_page_url: typing.Optional[str] = OMIT, @@ -4338,6 +4343,8 @@ async def update_onboarding_state( """ Parameters ---------- + country : typing.Optional[str] + dismissed : typing.Optional[bool] path : typing.Optional[OnboardingPath] @@ -4360,6 +4367,7 @@ async def update_onboarding_state( "onboarding-state", method="POST", json={ + "country": country, "dismissed": dismissed, "path": path, "pricing_page_url": pricing_page_url, diff --git a/src/schematic/billing/__init__.py b/src/schematic/billing/__init__.py index 08537a0..9281ba6 100644 --- a/src/schematic/billing/__init__.py +++ b/src/schematic/billing/__init__.py @@ -23,6 +23,8 @@ ListBillingProductPricesResponse, ListBillingProductsParams, ListBillingProductsResponse, + ListCompanyBillingProfilesParams, + ListCompanyBillingProfilesResponse, ListCouponsParams, ListCouponsResponse, ListCustomersWithSubscriptionsParams, @@ -33,6 +35,7 @@ ListMetersResponse, ListPaymentMethodsParams, ListPaymentMethodsResponse, + UpdateCompanyBillingProfileResponse, UpsertBillingCouponResponse, UpsertBillingCustomerResponse, UpsertBillingMeterResponse, @@ -59,6 +62,8 @@ "ListBillingProductPricesResponse": ".types", "ListBillingProductsParams": ".types", "ListBillingProductsResponse": ".types", + "ListCompanyBillingProfilesParams": ".types", + "ListCompanyBillingProfilesResponse": ".types", "ListCouponsParams": ".types", "ListCouponsResponse": ".types", "ListCustomersWithSubscriptionsParams": ".types", @@ -69,6 +74,7 @@ "ListMetersResponse": ".types", "ListPaymentMethodsParams": ".types", "ListPaymentMethodsResponse": ".types", + "UpdateCompanyBillingProfileResponse": ".types", "UpsertBillingCouponResponse": ".types", "UpsertBillingCustomerResponse": ".types", "UpsertBillingMeterResponse": ".types", @@ -118,6 +124,8 @@ def __dir__(): "ListBillingProductPricesResponse", "ListBillingProductsParams", "ListBillingProductsResponse", + "ListCompanyBillingProfilesParams", + "ListCompanyBillingProfilesResponse", "ListCouponsParams", "ListCouponsResponse", "ListCustomersWithSubscriptionsParams", @@ -128,6 +136,7 @@ def __dir__(): "ListMetersResponse", "ListPaymentMethodsParams", "ListPaymentMethodsResponse", + "UpdateCompanyBillingProfileResponse", "UpsertBillingCouponResponse", "UpsertBillingCustomerResponse", "UpsertBillingMeterResponse", diff --git a/src/schematic/billing/client.py b/src/schematic/billing/client.py index d2d7ef0..8e37042 100644 --- a/src/schematic/billing/client.py +++ b/src/schematic/billing/client.py @@ -5,6 +5,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions +from ..types.billing_collection_method import BillingCollectionMethod from ..types.billing_price_scheme import BillingPriceScheme from ..types.billing_price_usage_type import BillingPriceUsageType from ..types.billing_product_pricing import BillingProductPricing @@ -14,6 +15,7 @@ from ..types.billing_tiers_mode import BillingTiersMode from ..types.create_billing_price_tier_request_body import CreateBillingPriceTierRequestBody from ..types.invoice_status import InvoiceStatus +from ..types.proration_behavior import ProrationBehavior from .raw_client import AsyncRawBillingClient, RawBillingClient from .types.count_billing_products_response import CountBillingProductsResponse from .types.count_customers_response import CountCustomersResponse @@ -26,11 +28,13 @@ from .types.list_billing_prices_response import ListBillingPricesResponse from .types.list_billing_product_prices_response import ListBillingProductPricesResponse from .types.list_billing_products_response import ListBillingProductsResponse +from .types.list_company_billing_profiles_response import ListCompanyBillingProfilesResponse from .types.list_coupons_response import ListCouponsResponse from .types.list_customers_with_subscriptions_response import ListCustomersWithSubscriptionsResponse from .types.list_invoices_response import ListInvoicesResponse from .types.list_meters_response import ListMetersResponse from .types.list_payment_methods_response import ListPaymentMethodsResponse +from .types.update_company_billing_profile_response import UpdateCompanyBillingProfileResponse from .types.upsert_billing_coupon_response import UpsertBillingCouponResponse from .types.upsert_billing_customer_response import UpsertBillingCustomerResponse from .types.upsert_billing_meter_response import UpsertBillingMeterResponse @@ -1583,6 +1587,126 @@ def count_billing_products( ) return _response.data + def list_company_billing_profiles( + self, + *, + company_id: typing.Optional[str] = None, + is_default: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCompanyBillingProfilesResponse: + """ + Parameters + ---------- + company_id : typing.Optional[str] + + is_default : typing.Optional[bool] + + provider_type : typing.Optional[BillingProviderType] + + 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 + ------- + ListCompanyBillingProfilesResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.billing.list_company_billing_profiles( + company_id="company_id", + is_default=True, + provider_type="metronome", + limit=1000000, + offset=1000000, + ) + """ + _response = self._raw_client.list_company_billing_profiles( + company_id=company_id, + is_default=is_default, + provider_type=provider_type, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + + def update_company_billing_profile( + self, + billing_profile_id: str, + *, + collection_method: BillingCollectionMethod, + days_until_due: typing.Optional[int] = OMIT, + is_default: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + payment_method_id: typing.Optional[str] = OMIT, + proration_behavior: typing.Optional[ProrationBehavior] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateCompanyBillingProfileResponse: + """ + Parameters + ---------- + billing_profile_id : str + billing_profile_id + + collection_method : BillingCollectionMethod + + days_until_due : typing.Optional[int] + + is_default : typing.Optional[bool] + + name : typing.Optional[str] + + payment_method_id : typing.Optional[str] + + proration_behavior : typing.Optional[ProrationBehavior] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateCompanyBillingProfileResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.billing.update_company_billing_profile( + billing_profile_id="billing_profile_id", + collection_method="charge_automatically", + ) + """ + _response = self._raw_client.update_company_billing_profile( + billing_profile_id, + collection_method=collection_method, + days_until_due=days_until_due, + is_default=is_default, + name=name, + payment_method_id=payment_method_id, + proration_behavior=proration_behavior, + request_options=request_options, + ) + return _response.data + def upsert_billing_subscription( self, *, @@ -3459,6 +3583,142 @@ async def main() -> None: ) return _response.data + async def list_company_billing_profiles( + self, + *, + company_id: typing.Optional[str] = None, + is_default: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCompanyBillingProfilesResponse: + """ + Parameters + ---------- + company_id : typing.Optional[str] + + is_default : typing.Optional[bool] + + provider_type : typing.Optional[BillingProviderType] + + 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 + ------- + ListCompanyBillingProfilesResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.billing.list_company_billing_profiles( + company_id="company_id", + is_default=True, + provider_type="metronome", + limit=1000000, + offset=1000000, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_company_billing_profiles( + company_id=company_id, + is_default=is_default, + provider_type=provider_type, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + + async def update_company_billing_profile( + self, + billing_profile_id: str, + *, + collection_method: BillingCollectionMethod, + days_until_due: typing.Optional[int] = OMIT, + is_default: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + payment_method_id: typing.Optional[str] = OMIT, + proration_behavior: typing.Optional[ProrationBehavior] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateCompanyBillingProfileResponse: + """ + Parameters + ---------- + billing_profile_id : str + billing_profile_id + + collection_method : BillingCollectionMethod + + days_until_due : typing.Optional[int] + + is_default : typing.Optional[bool] + + name : typing.Optional[str] + + payment_method_id : typing.Optional[str] + + proration_behavior : typing.Optional[ProrationBehavior] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateCompanyBillingProfileResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.billing.update_company_billing_profile( + billing_profile_id="billing_profile_id", + collection_method="charge_automatically", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_company_billing_profile( + billing_profile_id, + collection_method=collection_method, + days_until_due=days_until_due, + is_default=is_default, + name=name, + payment_method_id=payment_method_id, + proration_behavior=proration_behavior, + request_options=request_options, + ) + return _response.data + async def upsert_billing_subscription( self, *, diff --git a/src/schematic/billing/raw_client.py b/src/schematic/billing/raw_client.py index 17e2e37..57890ac 100644 --- a/src/schematic/billing/raw_client.py +++ b/src/schematic/billing/raw_client.py @@ -18,6 +18,7 @@ from ..errors.not_found_error import NotFoundError from ..errors.unauthorized_error import UnauthorizedError from ..types.api_error import ApiError as types_api_error_ApiError +from ..types.billing_collection_method import BillingCollectionMethod from ..types.billing_price_scheme import BillingPriceScheme from ..types.billing_price_usage_type import BillingPriceUsageType from ..types.billing_product_pricing import BillingProductPricing @@ -27,6 +28,7 @@ from ..types.billing_tiers_mode import BillingTiersMode from ..types.create_billing_price_tier_request_body import CreateBillingPriceTierRequestBody from ..types.invoice_status import InvoiceStatus +from ..types.proration_behavior import ProrationBehavior from .types.count_billing_products_response import CountBillingProductsResponse from .types.count_customers_response import CountCustomersResponse from .types.delete_billing_coupon_response import DeleteBillingCouponResponse @@ -38,11 +40,13 @@ from .types.list_billing_prices_response import ListBillingPricesResponse from .types.list_billing_product_prices_response import ListBillingProductPricesResponse from .types.list_billing_products_response import ListBillingProductsResponse +from .types.list_company_billing_profiles_response import ListCompanyBillingProfilesResponse from .types.list_coupons_response import ListCouponsResponse from .types.list_customers_with_subscriptions_response import ListCustomersWithSubscriptionsResponse from .types.list_invoices_response import ListInvoicesResponse from .types.list_meters_response import ListMetersResponse from .types.list_payment_methods_response import ListPaymentMethodsResponse +from .types.update_company_billing_profile_response import UpdateCompanyBillingProfileResponse from .types.upsert_billing_coupon_response import UpsertBillingCouponResponse from .types.upsert_billing_customer_response import UpsertBillingCustomerResponse from .types.upsert_billing_meter_response import UpsertBillingMeterResponse @@ -3096,6 +3100,262 @@ def count_billing_products( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def list_company_billing_profiles( + self, + *, + company_id: typing.Optional[str] = None, + is_default: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListCompanyBillingProfilesResponse]: + """ + Parameters + ---------- + company_id : typing.Optional[str] + + is_default : typing.Optional[bool] + + provider_type : typing.Optional[BillingProviderType] + + 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[ListCompanyBillingProfilesResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + "billing/profiles", + method="GET", + params={ + "company_id": company_id, + "is_default": is_default, + "provider_type": provider_type, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListCompanyBillingProfilesResponse, + parse_obj_as( + type_=ListCompanyBillingProfilesResponse, # 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 update_company_billing_profile( + self, + billing_profile_id: str, + *, + collection_method: BillingCollectionMethod, + days_until_due: typing.Optional[int] = OMIT, + is_default: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + payment_method_id: typing.Optional[str] = OMIT, + proration_behavior: typing.Optional[ProrationBehavior] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UpdateCompanyBillingProfileResponse]: + """ + Parameters + ---------- + billing_profile_id : str + billing_profile_id + + collection_method : BillingCollectionMethod + + days_until_due : typing.Optional[int] + + is_default : typing.Optional[bool] + + name : typing.Optional[str] + + payment_method_id : typing.Optional[str] + + proration_behavior : typing.Optional[ProrationBehavior] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UpdateCompanyBillingProfileResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"billing/profiles/{encode_path_param(billing_profile_id)}", + method="PUT", + json={ + "collection_method": collection_method, + "days_until_due": days_until_due, + "is_default": is_default, + "name": name, + "payment_method_id": payment_method_id, + "proration_behavior": proration_behavior, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateCompanyBillingProfileResponse, + parse_obj_as( + type_=UpdateCompanyBillingProfileResponse, # 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 upsert_billing_subscription( self, *, @@ -6329,6 +6589,262 @@ async def count_billing_products( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + async def list_company_billing_profiles( + self, + *, + company_id: typing.Optional[str] = None, + is_default: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListCompanyBillingProfilesResponse]: + """ + Parameters + ---------- + company_id : typing.Optional[str] + + is_default : typing.Optional[bool] + + provider_type : typing.Optional[BillingProviderType] + + 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[ListCompanyBillingProfilesResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/profiles", + method="GET", + params={ + "company_id": company_id, + "is_default": is_default, + "provider_type": provider_type, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListCompanyBillingProfilesResponse, + parse_obj_as( + type_=ListCompanyBillingProfilesResponse, # 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 update_company_billing_profile( + self, + billing_profile_id: str, + *, + collection_method: BillingCollectionMethod, + days_until_due: typing.Optional[int] = OMIT, + is_default: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + payment_method_id: typing.Optional[str] = OMIT, + proration_behavior: typing.Optional[ProrationBehavior] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpdateCompanyBillingProfileResponse]: + """ + Parameters + ---------- + billing_profile_id : str + billing_profile_id + + collection_method : BillingCollectionMethod + + days_until_due : typing.Optional[int] + + is_default : typing.Optional[bool] + + name : typing.Optional[str] + + payment_method_id : typing.Optional[str] + + proration_behavior : typing.Optional[ProrationBehavior] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpdateCompanyBillingProfileResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/profiles/{encode_path_param(billing_profile_id)}", + method="PUT", + json={ + "collection_method": collection_method, + "days_until_due": days_until_due, + "is_default": is_default, + "name": name, + "payment_method_id": payment_method_id, + "proration_behavior": proration_behavior, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateCompanyBillingProfileResponse, + parse_obj_as( + type_=UpdateCompanyBillingProfileResponse, # 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 upsert_billing_subscription( self, *, diff --git a/src/schematic/billing/types/__init__.py b/src/schematic/billing/types/__init__.py index ddb5b49..b599905 100644 --- a/src/schematic/billing/types/__init__.py +++ b/src/schematic/billing/types/__init__.py @@ -22,6 +22,8 @@ from .list_billing_product_prices_response import ListBillingProductPricesResponse from .list_billing_products_params import ListBillingProductsParams from .list_billing_products_response import ListBillingProductsResponse + from .list_company_billing_profiles_params import ListCompanyBillingProfilesParams + from .list_company_billing_profiles_response import ListCompanyBillingProfilesResponse from .list_coupons_params import ListCouponsParams from .list_coupons_response import ListCouponsResponse from .list_customers_with_subscriptions_params import ListCustomersWithSubscriptionsParams @@ -32,6 +34,7 @@ from .list_meters_response import ListMetersResponse from .list_payment_methods_params import ListPaymentMethodsParams from .list_payment_methods_response import ListPaymentMethodsResponse + from .update_company_billing_profile_response import UpdateCompanyBillingProfileResponse from .upsert_billing_coupon_response import UpsertBillingCouponResponse from .upsert_billing_customer_response import UpsertBillingCustomerResponse from .upsert_billing_meter_response import UpsertBillingMeterResponse @@ -57,6 +60,8 @@ "ListBillingProductPricesResponse": ".list_billing_product_prices_response", "ListBillingProductsParams": ".list_billing_products_params", "ListBillingProductsResponse": ".list_billing_products_response", + "ListCompanyBillingProfilesParams": ".list_company_billing_profiles_params", + "ListCompanyBillingProfilesResponse": ".list_company_billing_profiles_response", "ListCouponsParams": ".list_coupons_params", "ListCouponsResponse": ".list_coupons_response", "ListCustomersWithSubscriptionsParams": ".list_customers_with_subscriptions_params", @@ -67,6 +72,7 @@ "ListMetersResponse": ".list_meters_response", "ListPaymentMethodsParams": ".list_payment_methods_params", "ListPaymentMethodsResponse": ".list_payment_methods_response", + "UpdateCompanyBillingProfileResponse": ".update_company_billing_profile_response", "UpsertBillingCouponResponse": ".upsert_billing_coupon_response", "UpsertBillingCustomerResponse": ".upsert_billing_customer_response", "UpsertBillingMeterResponse": ".upsert_billing_meter_response", @@ -116,6 +122,8 @@ def __dir__(): "ListBillingProductPricesResponse", "ListBillingProductsParams", "ListBillingProductsResponse", + "ListCompanyBillingProfilesParams", + "ListCompanyBillingProfilesResponse", "ListCouponsParams", "ListCouponsResponse", "ListCustomersWithSubscriptionsParams", @@ -126,6 +134,7 @@ def __dir__(): "ListMetersResponse", "ListPaymentMethodsParams", "ListPaymentMethodsResponse", + "UpdateCompanyBillingProfileResponse", "UpsertBillingCouponResponse", "UpsertBillingCustomerResponse", "UpsertBillingMeterResponse", diff --git a/src/schematic/billing/types/list_company_billing_profiles_params.py b/src/schematic/billing/types/list_company_billing_profiles_params.py new file mode 100644 index 0000000..7540d33 --- /dev/null +++ b/src/schematic/billing/types/list_company_billing_profiles_params.py @@ -0,0 +1,36 @@ +# 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_provider_type import BillingProviderType + + +class ListCompanyBillingProfilesParams(UniversalBaseModel): + """ + Input parameters + """ + + company_id: typing.Optional[str] = None + is_default: typing.Optional[bool] = 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) + """ + + provider_type: typing.Optional[BillingProviderType] = 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/billing/types/list_company_billing_profiles_response.py b/src/schematic/billing/types/list_company_billing_profiles_response.py new file mode 100644 index 0000000..2b061ed --- /dev/null +++ b/src/schematic/billing/types/list_company_billing_profiles_response.py @@ -0,0 +1,25 @@ +# 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.company_billing_profile_response_data import CompanyBillingProfileResponseData +from .list_company_billing_profiles_params import ListCompanyBillingProfilesParams + + +class ListCompanyBillingProfilesResponse(UniversalBaseModel): + data: typing.List[CompanyBillingProfileResponseData] + params: ListCompanyBillingProfilesParams = 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/billing/types/update_company_billing_profile_response.py b/src/schematic/billing/types/update_company_billing_profile_response.py new file mode 100644 index 0000000..edc4b58 --- /dev/null +++ b/src/schematic/billing/types/update_company_billing_profile_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.company_billing_profile_response_data import CompanyBillingProfileResponseData + + +class UpdateCompanyBillingProfileResponse(UniversalBaseModel): + data: CompanyBillingProfileResponseData + params: typing.Dict[str, 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/core/pydantic_utilities.py b/src/schematic/core/pydantic_utilities.py index 6587f5e..70816b9 100644 --- a/src/schematic/core/pydantic_utilities.py +++ b/src/schematic/core/pydantic_utilities.py @@ -5,6 +5,7 @@ import inspect import json import logging +import weakref from collections import defaultdict from dataclasses import asdict from typing import ( @@ -184,6 +185,58 @@ def _get_type_adapter(type_: Type[Any]) -> Any: return adapter +_field_alias_cache: "weakref.WeakKeyDictionary[type, Tuple[Dict[str, str], Tuple[str, ...]]]" = ( + weakref.WeakKeyDictionary() +) + + +def _get_field_aliases(model: type) -> Tuple[Dict[str, str], Tuple[str, ...]]: + """ + Map of field name to Pydantic alias for the fields whose alias differs from their name, together with the + keys that are ambiguous (an alias of one field and the name of another). Computed once per model class. + """ + cached = _field_alias_cache.get(model) + if cached is None: + fields: Mapping[str, Any] = ( + getattr(model, "model_fields", {}) if IS_PYDANTIC_V2 else getattr(model, "__fields__", {}) + ) + name_to_alias: Dict[str, str] = {} + for name, field in fields.items(): + alias = getattr(field, "alias", None) + if alias is not None and alias != name: + name_to_alias[name] = alias + cached = (name_to_alias, tuple(alias for alias in name_to_alias.values() if alias in fields)) + _field_alias_cache[model] = cached + return cached + + +def _coerce_keys_to_aliases(model: type, data: Any) -> Any: + """ + Accept Python field names in input by rewriting them to their Pydantic aliases, + while avoiding silent collisions when a key could refer to multiple fields. + """ + if not isinstance(data, Mapping): + return data + + name_to_alias, ambiguous_keys = _get_field_aliases(model) + for key in ambiguous_keys: + if key in data and name_to_alias.get(key, key) not in data: + raise ValueError( + f"Ambiguous input key '{key}': it is both a field name and an alias. " + "Provide the explicit alias key to disambiguate." + ) + + if not name_to_alias or not any(name in data for name in name_to_alias): + return data if isinstance(data, dict) else dict(data) + + rewritten: Dict[str, Any] = dict(data) + for name, alias in name_to_alias.items(): + if name in data and alias not in rewritten: + rewritten[alias] = rewritten.pop(name) + + return rewritten + + def parse_obj_as(type_: Type[T], object_: Any) -> T: # convert_and_respect_annotation_metadata is required for TypedDict aliasing. # @@ -193,20 +246,7 @@ def parse_obj_as(type_: Type[T], object_: Any) -> T: # - If the model encodes aliasing only via FieldMetadata annotations, then we MUST pre-dealias because Pydantic # will not recognize those aliases during validation. if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel): - has_pydantic_aliases = False - if IS_PYDANTIC_V2: - for field_name, field_info in getattr(type_, "model_fields", {}).items(): # type: ignore[attr-defined] - alias = getattr(field_info, "alias", None) - if alias is not None and alias != field_name: - has_pydantic_aliases = True - break - else: - for field in getattr(type_, "__fields__", {}).values(): - alias = getattr(field, "alias", None) - name = getattr(field, "name", None) - if alias is not None and name is not None and alias != name: - has_pydantic_aliases = True - break + has_pydantic_aliases = bool(_get_field_aliases(type_)[0]) dealiased_object = ( object_ @@ -239,39 +279,7 @@ class UniversalBaseModel(pydantic.BaseModel): @pydantic.model_validator(mode="before") # type: ignore[attr-defined] @classmethod def _coerce_field_names_to_aliases(cls, data: Any) -> Any: - """ - Accept Python field names in input by rewriting them to their Pydantic aliases, - while avoiding silent collisions when a key could refer to multiple fields. - """ - if not isinstance(data, Mapping): - return data - - fields = getattr(cls, "model_fields", {}) # type: ignore[attr-defined] - name_to_alias: Dict[str, str] = {} - alias_to_name: Dict[str, str] = {} - - for name, field_info in fields.items(): - alias = getattr(field_info, "alias", None) or name - name_to_alias[name] = alias - if alias != name: - alias_to_name[alias] = name - - # Detect ambiguous keys: a key that is an alias for one field and a name for another. - ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) - for key in ambiguous_keys: - if key in data and name_to_alias[key] not in data: - raise ValueError( - f"Ambiguous input key '{key}': it is both a field name and an alias. " - "Provide the explicit alias key to disambiguate." - ) - - original_keys = set(data.keys()) - rewritten: Dict[str, Any] = dict(data) - for name, alias in name_to_alias.items(): - if alias != name and name in original_keys and alias not in rewritten: - rewritten[alias] = rewritten.pop(name) - - return rewritten + return _coerce_keys_to_aliases(cls, data) @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined] def serialize_model(self) -> Any: # type: ignore[name-defined] @@ -287,37 +295,7 @@ class Config: @pydantic.root_validator(pre=True) def _coerce_field_names_to_aliases(cls, values: Any) -> Any: - """ - Pydantic v1 equivalent of _coerce_field_names_to_aliases. - """ - if not isinstance(values, Mapping): - return values - - fields = getattr(cls, "__fields__", {}) - name_to_alias: Dict[str, str] = {} - alias_to_name: Dict[str, str] = {} - - for name, field in fields.items(): - alias = getattr(field, "alias", None) or name - name_to_alias[name] = alias - if alias != name: - alias_to_name[alias] = name - - ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) - for key in ambiguous_keys: - if key in values and name_to_alias[key] not in values: - raise ValueError( - f"Ambiguous input key '{key}': it is both a field name and an alias. " - "Provide the explicit alias key to disambiguate." - ) - - original_keys = set(values.keys()) - rewritten: Dict[str, Any] = dict(values) - for name, alias in name_to_alias.items(): - if alias != name and name in original_keys and alias not in rewritten: - rewritten[alias] = rewritten.pop(name) - - return rewritten + return _coerce_keys_to_aliases(cls, values) # type: ignore[arg-type] @classmethod def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model": diff --git a/src/schematic/credits/__init__.py b/src/schematic/credits/__init__.py index d8feee9..d2bced4 100644 --- a/src/schematic/credits/__init__.py +++ b/src/schematic/credits/__init__.py @@ -20,14 +20,19 @@ CountCreditBundlesResponse, CountCreditEventLedgerParams, CountCreditEventLedgerResponse, + CountCreditSpendPoliciesParams, + CountCreditSpendPoliciesResponse, CreateBillingCreditResponse, CreateBillingPlanCreditGrantResponse, CreateCreditBundleResponse, + CreateCreditSpendPolicyResponse, DeleteBillingPlanCreditGrantParams, DeleteBillingPlanCreditGrantResponse, DeleteCreditBundleResponse, + DeleteCreditSpendPolicyResponse, ExtendCreditLeaseResponse, GetCreditBundleResponse, + GetCreditSpendPolicyResponse, GetSingleBillingCreditResponse, GetSingleBillingPlanCreditGrantResponse, GrantBillingCreditsToCompanyResponse, @@ -43,6 +48,8 @@ ListCreditBundlesResponse, ListCreditEventLedgerParams, ListCreditEventLedgerResponse, + ListCreditSpendPoliciesParams, + ListCreditSpendPoliciesResponse, ListGrantsForCreditParams, ListGrantsForCreditResponse, ReleaseCreditLeaseResponse, @@ -50,6 +57,7 @@ UpdateBillingCreditResponse, UpdateBillingPlanCreditGrantResponse, UpdateCreditBundleDetailsResponse, + UpdateCreditSpendPolicyResponse, ZeroOutGrantResponse, ) _dynamic_imports: typing.Dict[str, str] = { @@ -66,14 +74,19 @@ "CountCreditBundlesResponse": ".types", "CountCreditEventLedgerParams": ".types", "CountCreditEventLedgerResponse": ".types", + "CountCreditSpendPoliciesParams": ".types", + "CountCreditSpendPoliciesResponse": ".types", "CreateBillingCreditResponse": ".types", "CreateBillingPlanCreditGrantResponse": ".types", "CreateCreditBundleResponse": ".types", + "CreateCreditSpendPolicyResponse": ".types", "DeleteBillingPlanCreditGrantParams": ".types", "DeleteBillingPlanCreditGrantResponse": ".types", "DeleteCreditBundleResponse": ".types", + "DeleteCreditSpendPolicyResponse": ".types", "ExtendCreditLeaseResponse": ".types", "GetCreditBundleResponse": ".types", + "GetCreditSpendPolicyResponse": ".types", "GetSingleBillingCreditResponse": ".types", "GetSingleBillingPlanCreditGrantResponse": ".types", "GrantBillingCreditsToCompanyResponse": ".types", @@ -89,6 +102,8 @@ "ListCreditBundlesResponse": ".types", "ListCreditEventLedgerParams": ".types", "ListCreditEventLedgerResponse": ".types", + "ListCreditSpendPoliciesParams": ".types", + "ListCreditSpendPoliciesResponse": ".types", "ListGrantsForCreditParams": ".types", "ListGrantsForCreditResponse": ".types", "ReleaseCreditLeaseResponse": ".types", @@ -96,6 +111,7 @@ "UpdateBillingCreditResponse": ".types", "UpdateBillingPlanCreditGrantResponse": ".types", "UpdateCreditBundleDetailsResponse": ".types", + "UpdateCreditSpendPolicyResponse": ".types", "ZeroOutGrantResponse": ".types", } @@ -135,14 +151,19 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", + "CountCreditSpendPoliciesParams", + "CountCreditSpendPoliciesResponse", "CreateBillingCreditResponse", "CreateBillingPlanCreditGrantResponse", "CreateCreditBundleResponse", + "CreateCreditSpendPolicyResponse", "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", "DeleteCreditBundleResponse", + "DeleteCreditSpendPolicyResponse", "ExtendCreditLeaseResponse", "GetCreditBundleResponse", + "GetCreditSpendPolicyResponse", "GetSingleBillingCreditResponse", "GetSingleBillingPlanCreditGrantResponse", "GrantBillingCreditsToCompanyResponse", @@ -158,6 +179,8 @@ def __dir__(): "ListCreditBundlesResponse", "ListCreditEventLedgerParams", "ListCreditEventLedgerResponse", + "ListCreditSpendPoliciesParams", + "ListCreditSpendPoliciesResponse", "ListGrantsForCreditParams", "ListGrantsForCreditResponse", "ReleaseCreditLeaseResponse", @@ -165,5 +188,6 @@ def __dir__(): "UpdateBillingCreditResponse", "UpdateBillingPlanCreditGrantResponse", "UpdateCreditBundleDetailsResponse", + "UpdateCreditSpendPolicyResponse", "ZeroOutGrantResponse", ] diff --git a/src/schematic/credits/client.py b/src/schematic/credits/client.py index d261735..f202133 100644 --- a/src/schematic/credits/client.py +++ b/src/schematic/credits/client.py @@ -22,6 +22,7 @@ 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_spend_policy_scope import CreditSpendPolicyScope from ..types.plan_credit_grant_scaling import PlanCreditGrantScaling from ..types.release_credit_lease_request_body import ReleaseCreditLeaseRequestBody from ..types.sort_direction import SortDirection @@ -33,13 +34,17 @@ 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_spend_policies_response import CountCreditSpendPoliciesResponse 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 +from .types.create_credit_spend_policy_response import CreateCreditSpendPolicyResponse from .types.delete_billing_plan_credit_grant_response import DeleteBillingPlanCreditGrantResponse from .types.delete_credit_bundle_response import DeleteCreditBundleResponse +from .types.delete_credit_spend_policy_response import DeleteCreditSpendPolicyResponse from .types.extend_credit_lease_response import ExtendCreditLeaseResponse from .types.get_credit_bundle_response import GetCreditBundleResponse +from .types.get_credit_spend_policy_response import GetCreditSpendPolicyResponse 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 @@ -49,12 +54,14 @@ from .types.list_company_grants_response import ListCompanyGrantsResponse from .types.list_credit_bundles_response import ListCreditBundlesResponse from .types.list_credit_event_ledger_response import ListCreditEventLedgerResponse +from .types.list_credit_spend_policies_response import ListCreditSpendPoliciesResponse from .types.list_grants_for_credit_response import ListGrantsForCreditResponse from .types.release_credit_lease_response import ReleaseCreditLeaseResponse from .types.soft_delete_billing_credit_response import SoftDeleteBillingCreditResponse from .types.update_billing_credit_response import UpdateBillingCreditResponse from .types.update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .types.update_credit_bundle_details_response import UpdateCreditBundleDetailsResponse +from .types.update_credit_spend_policy_response import UpdateCreditSpendPolicyResponse from .types.zero_out_grant_response import ZeroOutGrantResponse # this is used as the default value for optional parameters @@ -1750,6 +1757,302 @@ def count_billing_plan_credit_grants( ) return _response.data + def list_credit_spend_policies( + self, + *, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCreditSpendPoliciesResponse: + """ + Parameters + ---------- + billing_credit_id : typing.Optional[str] + + company_id : typing.Optional[str] + + scope_type : typing.Optional[CreditSpendPolicyScope] + + user_id : typing.Optional[str] + + user_ids : typing.Optional[typing.Union[str, typing.Sequence[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 + ------- + ListCreditSpendPoliciesResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.list_credit_spend_policies( + billing_credit_id="billing_credit_id", + company_id="company_id", + scope_type="company", + user_id="user_id", + user_ids=["user_ids"], + limit=1000000, + offset=1000000, + ) + """ + _response = self._raw_client.list_credit_spend_policies( + billing_credit_id=billing_credit_id, + company_id=company_id, + scope_type=scope_type, + user_id=user_id, + user_ids=user_ids, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + + def create_credit_spend_policy( + self, + *, + billing_credit_id: str, + max_per_draw: float, + company_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateCreditSpendPolicyResponse: + """ + Parameters + ---------- + billing_credit_id : str + + max_per_draw : float + The largest number of credits a single draw may spend. + + company_id : typing.Optional[str] + The company the cap applies to. Set exactly one of company_id and user_id. + + label : typing.Optional[str] + + user_id : typing.Optional[str] + The user the cap applies to. Set exactly one of company_id and user_id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateCreditSpendPolicyResponse + Created + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.create_credit_spend_policy( + billing_credit_id="billing_credit_id", + max_per_draw=1.1, + ) + """ + _response = self._raw_client.create_credit_spend_policy( + billing_credit_id=billing_credit_id, + max_per_draw=max_per_draw, + company_id=company_id, + label=label, + user_id=user_id, + request_options=request_options, + ) + return _response.data + + def get_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetCreditSpendPolicyResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.get_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + """ + _response = self._raw_client.get_credit_spend_policy(spend_policy_id, request_options=request_options) + return _response.data + + def update_credit_spend_policy( + self, + spend_policy_id: str, + *, + label: typing.Optional[str] = OMIT, + max_per_draw: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + label : typing.Optional[str] + + max_per_draw : typing.Optional[float] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateCreditSpendPolicyResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.update_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + """ + _response = self._raw_client.update_credit_spend_policy( + spend_policy_id, label=label, max_per_draw=max_per_draw, request_options=request_options + ) + return _response.data + + def delete_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteCreditSpendPolicyResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.delete_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + """ + _response = self._raw_client.delete_credit_spend_policy(spend_policy_id, request_options=request_options) + return _response.data + + def count_credit_spend_policies( + self, + *, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CountCreditSpendPoliciesResponse: + """ + Parameters + ---------- + billing_credit_id : typing.Optional[str] + + company_id : typing.Optional[str] + + scope_type : typing.Optional[CreditSpendPolicyScope] + + user_id : typing.Optional[str] + + user_ids : typing.Optional[typing.Union[str, typing.Sequence[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 + ------- + CountCreditSpendPoliciesResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.credits.count_credit_spend_policies( + billing_credit_id="billing_credit_id", + company_id="company_id", + scope_type="company", + user_id="user_id", + user_ids=["user_ids"], + limit=1000000, + offset=1000000, + ) + """ + _response = self._raw_client.count_credit_spend_policies( + billing_credit_id=billing_credit_id, + company_id=company_id, + scope_type=scope_type, + user_id=user_id, + user_ids=user_ids, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + def list_credit_event_ledger( self, *, @@ -3812,6 +4115,350 @@ async def main() -> None: ) return _response.data + async def list_credit_spend_policies( + self, + *, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCreditSpendPoliciesResponse: + """ + Parameters + ---------- + billing_credit_id : typing.Optional[str] + + company_id : typing.Optional[str] + + scope_type : typing.Optional[CreditSpendPolicyScope] + + user_id : typing.Optional[str] + + user_ids : typing.Optional[typing.Union[str, typing.Sequence[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 + ------- + ListCreditSpendPoliciesResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.list_credit_spend_policies( + billing_credit_id="billing_credit_id", + company_id="company_id", + scope_type="company", + user_id="user_id", + user_ids=["user_ids"], + limit=1000000, + offset=1000000, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_credit_spend_policies( + billing_credit_id=billing_credit_id, + company_id=company_id, + scope_type=scope_type, + user_id=user_id, + user_ids=user_ids, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + + async def create_credit_spend_policy( + self, + *, + billing_credit_id: str, + max_per_draw: float, + company_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateCreditSpendPolicyResponse: + """ + Parameters + ---------- + billing_credit_id : str + + max_per_draw : float + The largest number of credits a single draw may spend. + + company_id : typing.Optional[str] + The company the cap applies to. Set exactly one of company_id and user_id. + + label : typing.Optional[str] + + user_id : typing.Optional[str] + The user the cap applies to. Set exactly one of company_id and user_id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateCreditSpendPolicyResponse + Created + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.create_credit_spend_policy( + billing_credit_id="billing_credit_id", + max_per_draw=1.1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_credit_spend_policy( + billing_credit_id=billing_credit_id, + max_per_draw=max_per_draw, + company_id=company_id, + label=label, + user_id=user_id, + request_options=request_options, + ) + return _response.data + + async def get_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetCreditSpendPolicyResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.get_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_credit_spend_policy(spend_policy_id, request_options=request_options) + return _response.data + + async def update_credit_spend_policy( + self, + spend_policy_id: str, + *, + label: typing.Optional[str] = OMIT, + max_per_draw: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + label : typing.Optional[str] + + max_per_draw : typing.Optional[float] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateCreditSpendPolicyResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.update_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_credit_spend_policy( + spend_policy_id, label=label, max_per_draw=max_per_draw, request_options=request_options + ) + return _response.data + + async def delete_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteCreditSpendPolicyResponse: + """ + Parameters + ---------- + spend_policy_id : str + spend_policy_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteCreditSpendPolicyResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.delete_credit_spend_policy( + spend_policy_id="spend_policy_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_credit_spend_policy(spend_policy_id, request_options=request_options) + return _response.data + + async def count_credit_spend_policies( + self, + *, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CountCreditSpendPoliciesResponse: + """ + Parameters + ---------- + billing_credit_id : typing.Optional[str] + + company_id : typing.Optional[str] + + scope_type : typing.Optional[CreditSpendPolicyScope] + + user_id : typing.Optional[str] + + user_ids : typing.Optional[typing.Union[str, typing.Sequence[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 + ------- + CountCreditSpendPoliciesResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.credits.count_credit_spend_policies( + billing_credit_id="billing_credit_id", + company_id="company_id", + scope_type="company", + user_id="user_id", + user_ids=["user_ids"], + limit=1000000, + offset=1000000, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.count_credit_spend_policies( + billing_credit_id=billing_credit_id, + company_id=company_id, + scope_type=scope_type, + user_id=user_id, + user_ids=user_ids, + limit=limit, + offset=offset, + request_options=request_options, + ) + return _response.data + async def list_credit_event_ledger( self, *, diff --git a/src/schematic/credits/raw_client.py b/src/schematic/credits/raw_client.py index babcaed..f6af493 100644 --- a/src/schematic/credits/raw_client.py +++ b/src/schematic/credits/raw_client.py @@ -16,6 +16,7 @@ from ..errors.forbidden_error import ForbiddenError from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError +from ..errors.payment_required_error import PaymentRequiredError from ..errors.unauthorized_error import UnauthorizedError from ..types.api_error import ApiError as types_api_error_ApiError from ..types.billing_credit_auto_topup_availability import BillingCreditAutoTopupAvailability @@ -35,6 +36,7 @@ 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_spend_policy_scope import CreditSpendPolicyScope from ..types.plan_credit_grant_scaling import PlanCreditGrantScaling from ..types.release_credit_lease_request_body import ReleaseCreditLeaseRequestBody from ..types.sort_direction import SortDirection @@ -45,13 +47,17 @@ 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_spend_policies_response import CountCreditSpendPoliciesResponse 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 +from .types.create_credit_spend_policy_response import CreateCreditSpendPolicyResponse from .types.delete_billing_plan_credit_grant_response import DeleteBillingPlanCreditGrantResponse from .types.delete_credit_bundle_response import DeleteCreditBundleResponse +from .types.delete_credit_spend_policy_response import DeleteCreditSpendPolicyResponse from .types.extend_credit_lease_response import ExtendCreditLeaseResponse from .types.get_credit_bundle_response import GetCreditBundleResponse +from .types.get_credit_spend_policy_response import GetCreditSpendPolicyResponse 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 @@ -61,12 +67,14 @@ from .types.list_company_grants_response import ListCompanyGrantsResponse from .types.list_credit_bundles_response import ListCreditBundlesResponse from .types.list_credit_event_ledger_response import ListCreditEventLedgerResponse +from .types.list_credit_spend_policies_response import ListCreditSpendPoliciesResponse from .types.list_grants_for_credit_response import ListGrantsForCreditResponse from .types.release_credit_lease_response import ReleaseCreditLeaseResponse from .types.soft_delete_billing_credit_response import SoftDeleteBillingCreditResponse from .types.update_billing_credit_response import UpdateBillingCreditResponse from .types.update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .types.update_credit_bundle_details_response import UpdateCreditBundleDetailsResponse +from .types.update_credit_spend_policy_response import UpdateCreditSpendPolicyResponse from .types.zero_out_grant_response import ZeroOutGrantResponse from pydantic import ValidationError @@ -2513,6 +2521,17 @@ def acquire_credit_lease( ), ), ) + if _response.status_code == 402: + raise PaymentRequiredError( + 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), @@ -2630,6 +2649,17 @@ def extend_credit_lease( ), ), ) + if _response.status_code == 402: + raise PaymentRequiredError( + 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), @@ -3675,33 +3705,30 @@ def count_billing_plan_credit_grants( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def list_credit_event_ledger( + def list_credit_spend_policies( self, *, - company_id: str, billing_credit_id: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - event_type: typing.Optional[CreditEventType] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[ListCreditEventLedgerResponse]: + ) -> HttpResponse[ListCreditSpendPoliciesResponse]: """ Parameters ---------- - company_id : str - billing_credit_id : typing.Optional[str] - end_time : typing.Optional[str] + company_id : typing.Optional[str] - event_type : typing.Optional[CreditEventType] + scope_type : typing.Optional[CreditSpendPolicyScope] - feature_id : typing.Optional[str] + user_id : typing.Optional[str] - start_time : typing.Optional[str] + user_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] limit : typing.Optional[int] Page limit (default 100) @@ -3714,19 +3741,18 @@ def list_credit_event_ledger( Returns ------- - HttpResponse[ListCreditEventLedgerResponse] + HttpResponse[ListCreditSpendPoliciesResponse] OK """ _response = self._client_wrapper.httpx_client.request( - "v2/billing/credits/ledger", + "billing/credits/spend-policies", method="GET", params={ "billing_credit_id": billing_credit_id, "company_id": company_id, - "end_time": end_time, - "event_type": event_type, - "feature_id": feature_id, - "start_time": start_time, + "scope_type": scope_type, + "user_id": user_id, + "user_ids": user_ids, "limit": limit, "offset": offset, }, @@ -3735,9 +3761,9 @@ def list_credit_event_ledger( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListCreditEventLedgerResponse, + ListCreditSpendPoliciesResponse, parse_obj_as( - type_=ListCreditEventLedgerResponse, # type: ignore + type_=ListCreditSpendPoliciesResponse, # type: ignore object_=_response.json(), ), ) @@ -3810,69 +3836,62 @@ def list_credit_event_ledger( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def count_credit_event_ledger( + def create_credit_spend_policy( self, *, - company_id: str, - billing_credit_id: typing.Optional[str] = None, - end_time: typing.Optional[str] = None, - event_type: typing.Optional[CreditEventType] = None, - feature_id: typing.Optional[str] = None, - start_time: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, + billing_credit_id: str, + max_per_draw: float, + company_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[CountCreditEventLedgerResponse]: + ) -> HttpResponse[CreateCreditSpendPolicyResponse]: """ Parameters ---------- - company_id : str - - billing_credit_id : typing.Optional[str] - - end_time : typing.Optional[str] - - event_type : typing.Optional[CreditEventType] + billing_credit_id : str - feature_id : typing.Optional[str] + max_per_draw : float + The largest number of credits a single draw may spend. - start_time : typing.Optional[str] + company_id : typing.Optional[str] + The company the cap applies to. Set exactly one of company_id and user_id. - limit : typing.Optional[int] - Page limit (default 100) + label : typing.Optional[str] - offset : typing.Optional[int] - Page offset (default 0) + user_id : typing.Optional[str] + The user the cap applies to. Set exactly one of company_id and user_id. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[CountCreditEventLedgerResponse] - OK + HttpResponse[CreateCreditSpendPolicyResponse] + Created """ _response = self._client_wrapper.httpx_client.request( - "v2/billing/credits/ledger/count", - method="GET", - params={ + "billing/credits/spend-policies", + method="POST", + json={ "billing_credit_id": billing_credit_id, "company_id": company_id, - "end_time": end_time, - "event_type": event_type, - "feature_id": feature_id, - "start_time": start_time, - "limit": limit, - "offset": offset, + "label": label, + "max_per_draw": max_per_draw, + "user_id": user_id, + }, + headers={ + "content-type": "application/json", }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountCreditEventLedgerResponse, + CreateCreditSpendPolicyResponse, parse_obj_as( - type_=CountCreditEventLedgerResponse, # type: ignore + type_=CreateCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) @@ -3945,73 +3964,38 @@ def count_credit_event_ledger( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - -class AsyncRawCreditsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def list_billing_credits( - self, - *, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListBillingCreditsResponse]: + def get_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetCreditSpendPolicyResponse]: """ Parameters ---------- - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - - name : typing.Optional[str] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) + spend_policy_id : str + spend_policy_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[ListBillingCreditsResponse] + HttpResponse[GetCreditSpendPolicyResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - "billing/credits", + _response = self._client_wrapper.httpx_client.request( + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", method="GET", - params={ - "ids": ids, - "name": name, - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListBillingCreditsResponse, + GetCreditSpendPolicyResponse, parse_obj_as( - type_=ListBillingCreditsResponse, # type: ignore + type_=GetCreditSpendPolicyResponse, # 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(), - ), - ), - ) + return HttpResponse(response=_response, data=_data) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), @@ -4069,82 +4053,38 @@ async def list_billing_credits( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def create_billing_credit( + def update_credit_spend_policy( self, + spend_policy_id: str, *, - currency: str, - description: str, - name: str, - burn_strategy: typing.Optional[BillingCreditBurnStrategy] = OMIT, - currency_prices: typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] = OMIT, - default_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - default_expiry_unit_count: typing.Optional[int] = OMIT, - default_rollover_policy: typing.Optional[BillingCreditRolloverPolicy] = OMIT, - icon: typing.Optional[str] = OMIT, - per_unit_price: typing.Optional[int] = OMIT, - per_unit_price_decimal: typing.Optional[str] = OMIT, - plural_name: typing.Optional[str] = OMIT, - singular_name: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + max_per_draw: typing.Optional[float] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CreateBillingCreditResponse]: + ) -> HttpResponse[UpdateCreditSpendPolicyResponse]: """ Parameters ---------- - currency : str - - description : str - - name : str - - burn_strategy : typing.Optional[BillingCreditBurnStrategy] - - currency_prices : typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] - - default_expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - default_expiry_unit_count : typing.Optional[int] - - default_rollover_policy : typing.Optional[BillingCreditRolloverPolicy] + spend_policy_id : str + spend_policy_id - icon : typing.Optional[str] - - per_unit_price : typing.Optional[int] - - per_unit_price_decimal : typing.Optional[str] - - plural_name : typing.Optional[str] + label : typing.Optional[str] - singular_name : typing.Optional[str] + max_per_draw : typing.Optional[float] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateBillingCreditResponse] - Created + HttpResponse[UpdateCreditSpendPolicyResponse] + OK """ - _response = await self._client_wrapper.httpx_client.request( - "billing/credits", - method="POST", + _response = self._client_wrapper.httpx_client.request( + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", + method="PUT", json={ - "burn_strategy": burn_strategy, - "currency": currency, - "currency_prices": convert_and_respect_annotation_metadata( - object_=currency_prices, - annotation=typing.Sequence[CreditCurrencyPriceRequestBody], - direction="write", - ), - "default_expiry_unit": default_expiry_unit, - "default_expiry_unit_count": default_expiry_unit_count, - "default_rollover_policy": default_rollover_policy, - "description": description, - "icon": icon, - "name": name, - "per_unit_price": per_unit_price, - "per_unit_price_decimal": per_unit_price_decimal, - "plural_name": plural_name, - "singular_name": singular_name, + "label": label, + "max_per_draw": max_per_draw, }, headers={ "content-type": "application/json", @@ -4155,13 +4095,13 @@ async def create_billing_credit( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CreateBillingCreditResponse, + UpdateCreditSpendPolicyResponse, parse_obj_as( - type_=CreateBillingCreditResponse, # type: ignore + type_=UpdateCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -4230,38 +4170,49 @@ async def create_billing_credit( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_single_billing_credit( - self, credit_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[GetSingleBillingCreditResponse]: + def delete_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteCreditSpendPolicyResponse]: """ Parameters ---------- - credit_id : str - credit_id + spend_policy_id : str + spend_policy_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[GetSingleBillingCreditResponse] + HttpResponse[DeleteCreditSpendPolicyResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/{encode_path_param(credit_id)}", - method="GET", + _response = self._client_wrapper.httpx_client.request( + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", + method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetSingleBillingCreditResponse, + DeleteCreditSpendPolicyResponse, parse_obj_as( - type_=GetSingleBillingCreditResponse, # type: ignore + type_=DeleteCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + 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), @@ -4319,99 +4270,69 @@ async def get_single_billing_credit( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def update_billing_credit( + def count_credit_spend_policies( self, - credit_id: str, *, - description: str, - name: str, - burn_strategy: typing.Optional[BillingCreditBurnStrategy] = OMIT, - currency_prices: typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] = OMIT, - default_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - default_expiry_unit_count: typing.Optional[int] = OMIT, - default_rollover_policy: typing.Optional[BillingCreditRolloverPolicy] = OMIT, - icon: typing.Optional[str] = OMIT, - per_unit_price: typing.Optional[int] = OMIT, - per_unit_price_decimal: typing.Optional[str] = OMIT, - plural_name: typing.Optional[str] = OMIT, - singular_name: typing.Optional[str] = OMIT, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpdateBillingCreditResponse]: + ) -> HttpResponse[CountCreditSpendPoliciesResponse]: """ Parameters ---------- - credit_id : str - credit_id - - description : str + billing_credit_id : typing.Optional[str] - name : str + company_id : typing.Optional[str] - burn_strategy : typing.Optional[BillingCreditBurnStrategy] + scope_type : typing.Optional[CreditSpendPolicyScope] - currency_prices : typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] + user_id : typing.Optional[str] - default_expiry_unit : typing.Optional[BillingCreditExpiryUnit] + user_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - default_expiry_unit_count : typing.Optional[int] + limit : typing.Optional[int] + Page limit (default 100) - default_rollover_policy : typing.Optional[BillingCreditRolloverPolicy] - - icon : typing.Optional[str] - - per_unit_price : typing.Optional[int] - - per_unit_price_decimal : typing.Optional[str] - - plural_name : typing.Optional[str] - - singular_name : typing.Optional[str] + offset : typing.Optional[int] + Page offset (default 0) request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[UpdateBillingCreditResponse] + HttpResponse[CountCreditSpendPoliciesResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/{encode_path_param(credit_id)}", - method="PUT", - json={ - "burn_strategy": burn_strategy, - "currency_prices": convert_and_respect_annotation_metadata( - object_=currency_prices, - annotation=typing.Sequence[CreditCurrencyPriceRequestBody], - direction="write", - ), - "default_expiry_unit": default_expiry_unit, - "default_expiry_unit_count": default_expiry_unit_count, - "default_rollover_policy": default_rollover_policy, - "description": description, - "icon": icon, - "name": name, - "per_unit_price": per_unit_price, - "per_unit_price_decimal": per_unit_price_decimal, - "plural_name": plural_name, - "singular_name": singular_name, - }, - headers={ - "content-type": "application/json", + _response = self._client_wrapper.httpx_client.request( + "billing/credits/spend-policies/count", + method="GET", + params={ + "billing_credit_id": billing_credit_id, + "company_id": company_id, + "scope_type": scope_type, + "user_id": user_id, + "user_ids": user_ids, + "limit": limit, + "offset": offset, }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - UpdateBillingCreditResponse, + CountCreditSpendPoliciesResponse, parse_obj_as( - type_=UpdateBillingCreditResponse, # type: ignore + type_=CountCreditSpendPoliciesResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -4480,38 +4401,73 @@ async def update_billing_credit( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def soft_delete_billing_credit( - self, credit_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[SoftDeleteBillingCreditResponse]: + def list_credit_event_ledger( + self, + *, + company_id: str, + billing_credit_id: typing.Optional[str] = None, + end_time: typing.Optional[str] = None, + event_type: typing.Optional[CreditEventType] = None, + feature_id: typing.Optional[str] = None, + start_time: typing.Optional[str] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListCreditEventLedgerResponse]: """ Parameters ---------- - credit_id : str - credit_id + company_id : str + + billing_credit_id : typing.Optional[str] + + end_time : typing.Optional[str] + + event_type : typing.Optional[CreditEventType] + + feature_id : typing.Optional[str] + + start_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[SoftDeleteBillingCreditResponse] + HttpResponse[ListCreditEventLedgerResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/{encode_path_param(credit_id)}", - method="DELETE", + _response = self._client_wrapper.httpx_client.request( + "v2/billing/credits/ledger", + method="GET", + params={ + "billing_credit_id": billing_credit_id, + "company_id": company_id, + "end_time": end_time, + "event_type": event_type, + "feature_id": feature_id, + "start_time": start_time, + "limit": limit, + "offset": offset, + }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - SoftDeleteBillingCreditResponse, + ListCreditEventLedgerResponse, parse_obj_as( - type_=SoftDeleteBillingCreditResponse, # type: ignore + type_=ListCreditEventLedgerResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -4580,40 +4536,73 @@ async def soft_delete_billing_credit( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_company_credit_balances( - self, *, company_id: str, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[ListCompanyCreditBalancesResponse]: + def count_credit_event_ledger( + self, + *, + company_id: str, + billing_credit_id: typing.Optional[str] = None, + end_time: typing.Optional[str] = None, + event_type: typing.Optional[CreditEventType] = None, + feature_id: typing.Optional[str] = None, + start_time: typing.Optional[str] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CountCreditEventLedgerResponse]: """ Parameters ---------- company_id : str + billing_credit_id : typing.Optional[str] + + end_time : typing.Optional[str] + + event_type : typing.Optional[CreditEventType] + + feature_id : typing.Optional[str] + + start_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[ListCompanyCreditBalancesResponse] + HttpResponse[CountCreditEventLedgerResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - "billing/credits/balance", + _response = self._client_wrapper.httpx_client.request( + "v2/billing/credits/ledger/count", method="GET", params={ + "billing_credit_id": billing_credit_id, "company_id": company_id, + "end_time": end_time, + "event_type": event_type, + "feature_id": feature_id, + "start_time": start_time, + "limit": limit, + "offset": offset, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListCompanyCreditBalancesResponse, + CountCreditEventLedgerResponse, parse_obj_as( - type_=ListCompanyCreditBalancesResponse, # type: ignore + type_=CountCreditEventLedgerResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -4682,27 +4671,26 @@ async def list_company_credit_balances( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_credit_bundles( + +class AsyncRawCreditsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_billing_credits( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - credit_id: typing.Optional[str] = None, - status: typing.Optional[BillingCreditBundleStatus] = None, - bundle_type: typing.Optional[BillingCreditBundleType] = None, + name: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListCreditBundlesResponse]: + ) -> AsyncHttpResponse[ListBillingCreditsResponse]: """ Parameters ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - credit_id : typing.Optional[str] - - status : typing.Optional[BillingCreditBundleStatus] - - bundle_type : typing.Optional[BillingCreditBundleType] + name : typing.Optional[str] limit : typing.Optional[int] Page limit (default 100) @@ -4715,17 +4703,15 @@ async def list_credit_bundles( Returns ------- - AsyncHttpResponse[ListCreditBundlesResponse] + AsyncHttpResponse[ListBillingCreditsResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/bundles", + "billing/credits", method="GET", params={ "ids": ids, - "credit_id": credit_id, - "status": status, - "bundle_type": bundle_type, + "name": name, "limit": limit, "offset": offset, }, @@ -4734,9 +4720,9 @@ async def list_credit_bundles( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListCreditBundlesResponse, + ListBillingCreditsResponse, parse_obj_as( - type_=ListCreditBundlesResponse, # type: ignore + type_=ListBillingCreditsResponse, # type: ignore object_=_response.json(), ), ) @@ -4809,83 +4795,82 @@ async def list_credit_bundles( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def create_credit_bundle( + async def create_billing_credit( self, *, - bundle_name: str, - credit_id: str, currency: str, - price_per_unit: int, - bundle_type: typing.Optional[BillingCreditBundleType] = OMIT, - compatible_plan_ids: typing.Optional[typing.Sequence[str]] = OMIT, - currency_prices: typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] = OMIT, - expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - expiry_unit_count: typing.Optional[int] = OMIT, - price_per_unit_decimal: typing.Optional[str] = OMIT, - quantity: typing.Optional[int] = OMIT, - status: typing.Optional[BillingCreditBundleStatus] = OMIT, + description: str, + name: str, + burn_strategy: typing.Optional[BillingCreditBurnStrategy] = OMIT, + currency_prices: typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] = OMIT, + default_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + default_expiry_unit_count: typing.Optional[int] = OMIT, + default_rollover_policy: typing.Optional[BillingCreditRolloverPolicy] = OMIT, + icon: typing.Optional[str] = OMIT, + per_unit_price: typing.Optional[int] = OMIT, + per_unit_price_decimal: typing.Optional[str] = OMIT, + plural_name: typing.Optional[str] = OMIT, + singular_name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CreateCreditBundleResponse]: + ) -> AsyncHttpResponse[CreateBillingCreditResponse]: """ Parameters ---------- - bundle_name : str + currency : str - credit_id : str + description : str - currency : str + name : str - price_per_unit : int + burn_strategy : typing.Optional[BillingCreditBurnStrategy] - bundle_type : typing.Optional[BillingCreditBundleType] + currency_prices : typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] - compatible_plan_ids : typing.Optional[typing.Sequence[str]] - Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan. + default_expiry_unit : typing.Optional[BillingCreditExpiryUnit] - currency_prices : typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] + default_expiry_unit_count : typing.Optional[int] - expiry_type : typing.Optional[BillingCreditExpiryType] + default_rollover_policy : typing.Optional[BillingCreditRolloverPolicy] - expiry_unit : typing.Optional[BillingCreditExpiryUnit] + icon : typing.Optional[str] - expiry_unit_count : typing.Optional[int] + per_unit_price : typing.Optional[int] - price_per_unit_decimal : typing.Optional[str] + per_unit_price_decimal : typing.Optional[str] - quantity : typing.Optional[int] + plural_name : typing.Optional[str] - status : typing.Optional[BillingCreditBundleStatus] + singular_name : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateCreditBundleResponse] + AsyncHttpResponse[CreateBillingCreditResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/bundles", + "billing/credits", method="POST", json={ - "bundle_name": bundle_name, - "bundle_type": bundle_type, - "compatible_plan_ids": compatible_plan_ids, - "credit_id": credit_id, + "burn_strategy": burn_strategy, "currency": currency, "currency_prices": convert_and_respect_annotation_metadata( object_=currency_prices, - annotation=typing.Sequence[CreditBundleCurrencyPriceRequestBody], + annotation=typing.Sequence[CreditCurrencyPriceRequestBody], direction="write", ), - "expiry_type": expiry_type, - "expiry_unit": expiry_unit, - "expiry_unit_count": expiry_unit_count, - "price_per_unit": price_per_unit, - "price_per_unit_decimal": price_per_unit_decimal, - "quantity": quantity, - "status": status, + "default_expiry_unit": default_expiry_unit, + "default_expiry_unit_count": default_expiry_unit_count, + "default_rollover_policy": default_rollover_policy, + "description": description, + "icon": icon, + "name": name, + "per_unit_price": per_unit_price, + "per_unit_price_decimal": per_unit_price_decimal, + "plural_name": plural_name, + "singular_name": singular_name, }, headers={ "content-type": "application/json", @@ -4896,9 +4881,9 @@ async def create_credit_bundle( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CreateCreditBundleResponse, + CreateBillingCreditResponse, parse_obj_as( - type_=CreateCreditBundleResponse, # type: ignore + type_=CreateBillingCreditResponse, # type: ignore object_=_response.json(), ), ) @@ -4971,34 +4956,34 @@ async def create_credit_bundle( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_credit_bundle( - self, bundle_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[GetCreditBundleResponse]: + async def get_single_billing_credit( + self, credit_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetSingleBillingCreditResponse]: """ Parameters ---------- - bundle_id : str - bundle_id + credit_id : str + credit_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[GetCreditBundleResponse] + AsyncHttpResponse[GetSingleBillingCreditResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/bundles/{encode_path_param(bundle_id)}", + f"billing/credits/{encode_path_param(credit_id)}", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetCreditBundleResponse, + GetSingleBillingCreditResponse, parse_obj_as( - type_=GetCreditBundleResponse, # type: ignore + type_=GetSingleBillingCreditResponse, # type: ignore object_=_response.json(), ), ) @@ -5060,75 +5045,82 @@ async def get_credit_bundle( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def update_credit_bundle_details( + async def update_billing_credit( self, - bundle_id: str, + credit_id: str, *, - bundle_name: str, - price_per_unit: int, - compatible_plan_ids: typing.Optional[typing.Sequence[str]] = OMIT, - currency_prices: typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] = OMIT, - expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - expiry_unit_count: typing.Optional[int] = OMIT, - price_per_unit_decimal: typing.Optional[str] = OMIT, - quantity: typing.Optional[int] = OMIT, - status: typing.Optional[BillingCreditBundleStatus] = OMIT, + description: str, + name: str, + burn_strategy: typing.Optional[BillingCreditBurnStrategy] = OMIT, + currency_prices: typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] = OMIT, + default_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + default_expiry_unit_count: typing.Optional[int] = OMIT, + default_rollover_policy: typing.Optional[BillingCreditRolloverPolicy] = OMIT, + icon: typing.Optional[str] = OMIT, + per_unit_price: typing.Optional[int] = OMIT, + per_unit_price_decimal: typing.Optional[str] = OMIT, + plural_name: typing.Optional[str] = OMIT, + singular_name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpdateCreditBundleDetailsResponse]: + ) -> AsyncHttpResponse[UpdateBillingCreditResponse]: """ Parameters ---------- - bundle_id : str - bundle_id + credit_id : str + credit_id - bundle_name : str + description : str - price_per_unit : int + name : str - compatible_plan_ids : typing.Optional[typing.Sequence[str]] - Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan. + burn_strategy : typing.Optional[BillingCreditBurnStrategy] - currency_prices : typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] + currency_prices : typing.Optional[typing.Sequence[CreditCurrencyPriceRequestBody]] - expiry_type : typing.Optional[BillingCreditExpiryType] + default_expiry_unit : typing.Optional[BillingCreditExpiryUnit] - expiry_unit : typing.Optional[BillingCreditExpiryUnit] + default_expiry_unit_count : typing.Optional[int] - expiry_unit_count : typing.Optional[int] + default_rollover_policy : typing.Optional[BillingCreditRolloverPolicy] - price_per_unit_decimal : typing.Optional[str] + icon : typing.Optional[str] - quantity : typing.Optional[int] + per_unit_price : typing.Optional[int] - status : typing.Optional[BillingCreditBundleStatus] + per_unit_price_decimal : typing.Optional[str] + + plural_name : typing.Optional[str] + + singular_name : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[UpdateCreditBundleDetailsResponse] + AsyncHttpResponse[UpdateBillingCreditResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/bundles/{encode_path_param(bundle_id)}", + f"billing/credits/{encode_path_param(credit_id)}", method="PUT", json={ - "bundle_name": bundle_name, - "compatible_plan_ids": compatible_plan_ids, + "burn_strategy": burn_strategy, "currency_prices": convert_and_respect_annotation_metadata( object_=currency_prices, - annotation=typing.Sequence[CreditBundleCurrencyPriceRequestBody], + annotation=typing.Sequence[CreditCurrencyPriceRequestBody], direction="write", ), - "expiry_type": expiry_type, - "expiry_unit": expiry_unit, - "expiry_unit_count": expiry_unit_count, - "price_per_unit": price_per_unit, - "price_per_unit_decimal": price_per_unit_decimal, - "quantity": quantity, - "status": status, + "default_expiry_unit": default_expiry_unit, + "default_expiry_unit_count": default_expiry_unit_count, + "default_rollover_policy": default_rollover_policy, + "description": description, + "icon": icon, + "name": name, + "per_unit_price": per_unit_price, + "per_unit_price_decimal": per_unit_price_decimal, + "plural_name": plural_name, + "singular_name": singular_name, }, headers={ "content-type": "application/json", @@ -5139,9 +5131,9 @@ async def update_credit_bundle_details( try: if 200 <= _response.status_code < 300: _data = typing.cast( - UpdateCreditBundleDetailsResponse, + UpdateBillingCreditResponse, parse_obj_as( - type_=UpdateCreditBundleDetailsResponse, # type: ignore + type_=UpdateBillingCreditResponse, # type: ignore object_=_response.json(), ), ) @@ -5214,34 +5206,34 @@ async def update_credit_bundle_details( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def delete_credit_bundle( - self, bundle_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[DeleteCreditBundleResponse]: + async def soft_delete_billing_credit( + self, credit_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SoftDeleteBillingCreditResponse]: """ Parameters ---------- - bundle_id : str - bundle_id + credit_id : str + credit_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[DeleteCreditBundleResponse] + AsyncHttpResponse[SoftDeleteBillingCreditResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/bundles/{encode_path_param(bundle_id)}", + f"billing/credits/{encode_path_param(credit_id)}", method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - DeleteCreditBundleResponse, + SoftDeleteBillingCreditResponse, parse_obj_as( - type_=DeleteCreditBundleResponse, # type: ignore + type_=SoftDeleteBillingCreditResponse, # type: ignore object_=_response.json(), ), ) @@ -5314,61 +5306,36 @@ async def delete_credit_bundle( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def count_credit_bundles( - self, - *, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - credit_id: typing.Optional[str] = None, - status: typing.Optional[BillingCreditBundleStatus] = None, - bundle_type: typing.Optional[BillingCreditBundleType] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountCreditBundlesResponse]: + async def list_company_credit_balances( + self, *, company_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ListCompanyCreditBalancesResponse]: """ Parameters ---------- - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - - credit_id : typing.Optional[str] - - status : typing.Optional[BillingCreditBundleStatus] - - bundle_type : typing.Optional[BillingCreditBundleType] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) + company_id : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CountCreditBundlesResponse] + AsyncHttpResponse[ListCompanyCreditBalancesResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/bundles/count", + "billing/credits/balance", method="GET", params={ - "ids": ids, - "credit_id": credit_id, - "status": status, - "bundle_type": bundle_type, - "limit": limit, - "offset": offset, + "company_id": company_id, }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountCreditBundlesResponse, + ListCompanyCreditBalancesResponse, parse_obj_as( - type_=CountCreditBundlesResponse, # type: ignore + type_=ListCompanyCreditBalancesResponse, # type: ignore object_=_response.json(), ), ) @@ -5441,21 +5408,27 @@ async def count_credit_bundles( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def count_billing_credits( + async def list_credit_bundles( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, + credit_id: typing.Optional[str] = None, + status: typing.Optional[BillingCreditBundleStatus] = None, + bundle_type: typing.Optional[BillingCreditBundleType] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountBillingCreditsResponse]: + ) -> AsyncHttpResponse[ListCreditBundlesResponse]: """ Parameters ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + credit_id : typing.Optional[str] + + status : typing.Optional[BillingCreditBundleStatus] + + bundle_type : typing.Optional[BillingCreditBundleType] limit : typing.Optional[int] Page limit (default 100) @@ -5468,15 +5441,17 @@ async def count_billing_credits( Returns ------- - AsyncHttpResponse[CountBillingCreditsResponse] + AsyncHttpResponse[ListCreditBundlesResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/count", + "billing/credits/bundles", method="GET", params={ "ids": ids, - "name": name, + "credit_id": credit_id, + "status": status, + "bundle_type": bundle_type, "limit": limit, "offset": offset, }, @@ -5485,9 +5460,9 @@ async def count_billing_credits( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountBillingCreditsResponse, + ListCreditBundlesResponse, parse_obj_as( - type_=CountBillingCreditsResponse, # type: ignore + type_=ListCreditBundlesResponse, # type: ignore object_=_response.json(), ), ) @@ -5560,47 +5535,1435 @@ async def count_billing_credits( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def zero_out_grant( + async def create_credit_bundle( self, - grant_id: str, *, - reason: typing.Optional[BillingCreditGrantZeroedOutReason] = OMIT, + bundle_name: str, + credit_id: str, + currency: str, + price_per_unit: int, + bundle_type: typing.Optional[BillingCreditBundleType] = OMIT, + compatible_plan_ids: typing.Optional[typing.Sequence[str]] = OMIT, + currency_prices: typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] = OMIT, + expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + price_per_unit_decimal: typing.Optional[str] = OMIT, + quantity: typing.Optional[int] = OMIT, + status: typing.Optional[BillingCreditBundleStatus] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ZeroOutGrantResponse]: + ) -> AsyncHttpResponse[CreateCreditBundleResponse]: """ Parameters ---------- - grant_id : str - grant_id + bundle_name : str - reason : typing.Optional[BillingCreditGrantZeroedOutReason] + credit_id : str - request_options : typing.Optional[RequestOptions] - Request-specific configuration. + currency : str - Returns - ------- - AsyncHttpResponse[ZeroOutGrantResponse] - OK - """ - _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/grants/{encode_path_param(grant_id)}/zero-out", - method="PUT", - json={ - "reason": reason, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: + price_per_unit : int + + bundle_type : typing.Optional[BillingCreditBundleType] + + compatible_plan_ids : typing.Optional[typing.Sequence[str]] + Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan. + + currency_prices : typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] + + expiry_type : typing.Optional[BillingCreditExpiryType] + + expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + price_per_unit_decimal : typing.Optional[str] + + quantity : typing.Optional[int] + + status : typing.Optional[BillingCreditBundleStatus] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateCreditBundleResponse] + Created + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/bundles", + method="POST", + json={ + "bundle_name": bundle_name, + "bundle_type": bundle_type, + "compatible_plan_ids": compatible_plan_ids, + "credit_id": credit_id, + "currency": currency, + "currency_prices": convert_and_respect_annotation_metadata( + object_=currency_prices, + annotation=typing.Sequence[CreditBundleCurrencyPriceRequestBody], + direction="write", + ), + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "price_per_unit": price_per_unit, + "price_per_unit_decimal": price_per_unit_decimal, + "quantity": quantity, + "status": status, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateCreditBundleResponse, + parse_obj_as( + type_=CreateCreditBundleResponse, # 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 get_credit_bundle( + self, bundle_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetCreditBundleResponse]: + """ + Parameters + ---------- + bundle_id : str + bundle_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetCreditBundleResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/bundles/{encode_path_param(bundle_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetCreditBundleResponse, + parse_obj_as( + type_=GetCreditBundleResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + 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 update_credit_bundle_details( + self, + bundle_id: str, + *, + bundle_name: str, + price_per_unit: int, + compatible_plan_ids: typing.Optional[typing.Sequence[str]] = OMIT, + currency_prices: typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] = OMIT, + expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + price_per_unit_decimal: typing.Optional[str] = OMIT, + quantity: typing.Optional[int] = OMIT, + status: typing.Optional[BillingCreditBundleStatus] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpdateCreditBundleDetailsResponse]: + """ + Parameters + ---------- + bundle_id : str + bundle_id + + bundle_name : str + + price_per_unit : int + + compatible_plan_ids : typing.Optional[typing.Sequence[str]] + Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan. + + currency_prices : typing.Optional[typing.Sequence[CreditBundleCurrencyPriceRequestBody]] + + expiry_type : typing.Optional[BillingCreditExpiryType] + + expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + price_per_unit_decimal : typing.Optional[str] + + quantity : typing.Optional[int] + + status : typing.Optional[BillingCreditBundleStatus] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpdateCreditBundleDetailsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/bundles/{encode_path_param(bundle_id)}", + method="PUT", + json={ + "bundle_name": bundle_name, + "compatible_plan_ids": compatible_plan_ids, + "currency_prices": convert_and_respect_annotation_metadata( + object_=currency_prices, + annotation=typing.Sequence[CreditBundleCurrencyPriceRequestBody], + direction="write", + ), + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "price_per_unit": price_per_unit, + "price_per_unit_decimal": price_per_unit_decimal, + "quantity": quantity, + "status": status, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateCreditBundleDetailsResponse, + parse_obj_as( + type_=UpdateCreditBundleDetailsResponse, # 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 delete_credit_bundle( + self, bundle_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteCreditBundleResponse]: + """ + Parameters + ---------- + bundle_id : str + bundle_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteCreditBundleResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/bundles/{encode_path_param(bundle_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteCreditBundleResponse, + parse_obj_as( + type_=DeleteCreditBundleResponse, # 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_bundles( + self, + *, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + credit_id: typing.Optional[str] = None, + status: typing.Optional[BillingCreditBundleStatus] = None, + bundle_type: typing.Optional[BillingCreditBundleType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CountCreditBundlesResponse]: + """ + Parameters + ---------- + ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + + credit_id : typing.Optional[str] + + status : typing.Optional[BillingCreditBundleStatus] + + bundle_type : typing.Optional[BillingCreditBundleType] + + 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[CountCreditBundlesResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/bundles/count", + method="GET", + params={ + "ids": ids, + "credit_id": credit_id, + "status": status, + "bundle_type": bundle_type, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CountCreditBundlesResponse, + parse_obj_as( + type_=CountCreditBundlesResponse, # 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_billing_credits( + self, + *, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + name: typing.Optional[str] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CountBillingCreditsResponse]: + """ + Parameters + ---------- + ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + + name : 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[CountBillingCreditsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/count", + method="GET", + params={ + "ids": ids, + "name": name, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CountBillingCreditsResponse, + parse_obj_as( + type_=CountBillingCreditsResponse, # 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 zero_out_grant( + self, + grant_id: str, + *, + reason: typing.Optional[BillingCreditGrantZeroedOutReason] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ZeroOutGrantResponse]: + """ + Parameters + ---------- + grant_id : str + grant_id + + reason : typing.Optional[BillingCreditGrantZeroedOutReason] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ZeroOutGrantResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/grants/{encode_path_param(grant_id)}/zero-out", + method="PUT", + json={ + "reason": reason, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ZeroOutGrantResponse, + parse_obj_as( + type_=ZeroOutGrantResponse, # 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 grant_billing_credits_to_company( + self, + *, + company_id: str, + credit_id: str, + quantity: int, + reason: BillingCreditGrantReason, + billing_periods_count: typing.Optional[int] = OMIT, + currency: typing.Optional[str] = OMIT, + expires_at: typing.Optional[dt.datetime] = OMIT, + expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + renewal_enabled: typing.Optional[bool] = OMIT, + renewal_period: typing.Optional[BillingPlanCreditGrantResetStart] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GrantBillingCreditsToCompanyResponse]: + """ + Parameters + ---------- + company_id : str + + credit_id : str + + quantity : int + + reason : BillingCreditGrantReason + + billing_periods_count : typing.Optional[int] + + currency : typing.Optional[str] + + expires_at : typing.Optional[dt.datetime] + + expiry_type : typing.Optional[BillingCreditExpiryType] + + expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + renewal_enabled : typing.Optional[bool] + + renewal_period : typing.Optional[BillingPlanCreditGrantResetStart] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GrantBillingCreditsToCompanyResponse] + Created + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/grants/company", + method="POST", + json={ + "billing_periods_count": billing_periods_count, + "company_id": company_id, + "credit_id": credit_id, + "currency": currency, + "expires_at": expires_at, + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "quantity": quantity, + "reason": reason, + "renewal_enabled": renewal_enabled, + "renewal_period": renewal_period, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GrantBillingCreditsToCompanyResponse, + parse_obj_as( + type_=GrantBillingCreditsToCompanyResponse, # 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_company_grants( + self, + *, + company_id: str, + order: typing.Optional[CreditGrantSortOrder] = None, + dir: typing.Optional[SortDirection] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CountCompanyGrantsResponse]: + """ + Parameters + ---------- + company_id : str + + order : typing.Optional[CreditGrantSortOrder] + + dir : typing.Optional[SortDirection] + + 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[CountCompanyGrantsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/grants/company/count", + method="GET", + params={ + "company_id": company_id, + "order": order, + "dir": dir, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CountCompanyGrantsResponse, + parse_obj_as( + type_=CountCompanyGrantsResponse, # 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_company_grants( + self, + *, + company_id: str, + order: typing.Optional[CreditGrantSortOrder] = None, + dir: typing.Optional[SortDirection] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListCompanyGrantsResponse]: + """ + Parameters + ---------- + company_id : str + + order : typing.Optional[CreditGrantSortOrder] + + dir : typing.Optional[SortDirection] + + 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[ListCompanyGrantsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/grants/company/list", + method="GET", + params={ + "company_id": company_id, + "order": order, + "dir": dir, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListCompanyGrantsResponse, + parse_obj_as( + type_=ListCompanyGrantsResponse, # 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_billing_credits_grants( + self, + *, + credit_id: typing.Optional[str] = None, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CountBillingCreditsGrantsResponse]: + """ + Parameters + ---------- + credit_id : typing.Optional[str] + + ids : typing.Optional[typing.Union[str, typing.Sequence[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[CountBillingCreditsGrantsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/grants/count", + method="GET", + params={ + "credit_id": credit_id, + "ids": ids, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CountBillingCreditsGrantsResponse, + parse_obj_as( + type_=CountBillingCreditsGrantsResponse, # 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_grants_for_credit( + self, + *, + credit_id: typing.Optional[str] = None, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListGrantsForCreditResponse]: + """ + Parameters + ---------- + credit_id : typing.Optional[str] + + ids : typing.Optional[typing.Union[str, typing.Sequence[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[ListGrantsForCreditResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "billing/credits/grants/list", + method="GET", + params={ + "credit_id": credit_id, + "ids": ids, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: _data = typing.cast( - ZeroOutGrantResponse, + ListGrantsForCreditResponse, parse_obj_as( - type_=ZeroOutGrantResponse, # type: ignore + type_=ListGrantsForCreditResponse, # type: ignore object_=_response.json(), ), ) @@ -5673,74 +7036,42 @@ async def zero_out_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def grant_billing_credits_to_company( + async def acquire_credit_lease( self, *, company_id: str, - credit_id: str, - quantity: int, - reason: BillingCreditGrantReason, - billing_periods_count: typing.Optional[int] = OMIT, - currency: typing.Optional[str] = OMIT, + credit_type_id: str, + requested_amount: float, expires_at: typing.Optional[dt.datetime] = OMIT, - expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - expiry_unit_count: typing.Optional[int] = OMIT, - renewal_enabled: typing.Optional[bool] = OMIT, - renewal_period: typing.Optional[BillingPlanCreditGrantResetStart] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[GrantBillingCreditsToCompanyResponse]: + ) -> AsyncHttpResponse[AcquireCreditLeaseResponse]: """ Parameters ---------- company_id : str - credit_id : str - - quantity : int - - reason : BillingCreditGrantReason - - billing_periods_count : typing.Optional[int] + credit_type_id : str - currency : typing.Optional[str] + requested_amount : float expires_at : typing.Optional[dt.datetime] - expiry_type : typing.Optional[BillingCreditExpiryType] - - expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - expiry_unit_count : typing.Optional[int] - - renewal_enabled : typing.Optional[bool] - - renewal_period : typing.Optional[BillingPlanCreditGrantResetStart] - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[GrantBillingCreditsToCompanyResponse] + AsyncHttpResponse[AcquireCreditLeaseResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/grants/company", + "billing/credits/lease", method="POST", json={ - "billing_periods_count": billing_periods_count, "company_id": company_id, - "credit_id": credit_id, - "currency": currency, + "credit_type_id": credit_type_id, "expires_at": expires_at, - "expiry_type": expiry_type, - "expiry_unit": expiry_unit, - "expiry_unit_count": expiry_unit_count, - "quantity": quantity, - "reason": reason, - "renewal_enabled": renewal_enabled, - "renewal_period": renewal_period, + "requested_amount": requested_amount, }, headers={ "content-type": "application/json", @@ -5751,9 +7082,9 @@ async def grant_billing_credits_to_company( try: if 200 <= _response.status_code < 300: _data = typing.cast( - GrantBillingCreditsToCompanyResponse, + AcquireCreditLeaseResponse, parse_obj_as( - type_=GrantBillingCreditsToCompanyResponse, # type: ignore + type_=AcquireCreditLeaseResponse, # type: ignore object_=_response.json(), ), ) @@ -5780,6 +7111,17 @@ async def grant_billing_credits_to_company( ), ), ) + if _response.status_code == 402: + raise PaymentRequiredError( + 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), @@ -5826,57 +7168,173 @@ async def grant_billing_credits_to_company( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def count_company_grants( + async def extend_credit_lease( self, + lease_id: str, *, - company_id: str, - order: typing.Optional[CreditGrantSortOrder] = None, - dir: typing.Optional[SortDirection] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, + additional_amount: float, + expires_at: typing.Optional[dt.datetime] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountCompanyGrantsResponse]: + ) -> AsyncHttpResponse[ExtendCreditLeaseResponse]: """ Parameters ---------- - company_id : str + lease_id : str + lease_id - order : typing.Optional[CreditGrantSortOrder] + additional_amount : float - dir : typing.Optional[SortDirection] + expires_at : typing.Optional[dt.datetime] - limit : typing.Optional[int] - Page limit (default 100) + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - offset : typing.Optional[int] - Page offset (default 0) + Returns + ------- + AsyncHttpResponse[ExtendCreditLeaseResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"billing/credits/lease/{encode_path_param(lease_id)}/extend", + method="PUT", + json={ + "additional_amount": additional_amount, + "expires_at": expires_at, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ExtendCreditLeaseResponse, + parse_obj_as( + type_=ExtendCreditLeaseResponse, # 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 == 402: + raise PaymentRequiredError( + 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 release_credit_lease( + self, + lease_id: str, + *, + request: ReleaseCreditLeaseRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ReleaseCreditLeaseResponse]: + """ + Parameters + ---------- + lease_id : str + lease_id + + request : ReleaseCreditLeaseRequestBody request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CountCompanyGrantsResponse] + AsyncHttpResponse[ReleaseCreditLeaseResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/grants/company/count", - method="GET", - params={ - "company_id": company_id, - "order": order, - "dir": dir, - "limit": limit, - "offset": offset, + f"billing/credits/lease/{encode_path_param(lease_id)}/release", + method="PUT", + json=request, + headers={ + "content-type": "application/json", }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountCompanyGrantsResponse, + ReleaseCreditLeaseResponse, parse_obj_as( - type_=CountCompanyGrantsResponse, # type: ignore + type_=ReleaseCreditLeaseResponse, # type: ignore object_=_response.json(), ), ) @@ -5949,24 +7407,33 @@ async def count_company_grants( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_company_grants( + async def list_billing_plan_credit_grants( self, *, - company_id: str, - order: typing.Optional[CreditGrantSortOrder] = None, - dir: typing.Optional[SortDirection] = None, + credit_id: typing.Optional[str] = None, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + plan_id: typing.Optional[str] = None, + plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + plan_version_id: typing.Optional[str] = None, + plan_version_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListCompanyGrantsResponse]: + ) -> AsyncHttpResponse[ListBillingPlanCreditGrantsResponse]: """ Parameters ---------- - company_id : str + credit_id : typing.Optional[str] - order : typing.Optional[CreditGrantSortOrder] + ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - dir : typing.Optional[SortDirection] + plan_id : typing.Optional[str] + + plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + + plan_version_id : typing.Optional[str] + + plan_version_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] limit : typing.Optional[int] Page limit (default 100) @@ -5979,16 +7446,19 @@ async def list_company_grants( Returns ------- - AsyncHttpResponse[ListCompanyGrantsResponse] + AsyncHttpResponse[ListBillingPlanCreditGrantsResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/grants/company/list", + "billing/credits/plan-grants", method="GET", params={ - "company_id": company_id, - "order": order, - "dir": dir, + "credit_id": credit_id, + "ids": ids, + "plan_id": plan_id, + "plan_ids": plan_ids, + "plan_version_id": plan_version_id, + "plan_version_ids": plan_version_ids, "limit": limit, "offset": offset, }, @@ -5997,9 +7467,9 @@ async def list_company_grants( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListCompanyGrantsResponse, + ListBillingPlanCreditGrantsResponse, parse_obj_as( - type_=ListCompanyGrantsResponse, # type: ignore + type_=ListBillingPlanCreditGrantsResponse, # type: ignore object_=_response.json(), ), ) @@ -6072,53 +7542,148 @@ async def list_company_grants( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def count_billing_credits_grants( + async def create_billing_plan_credit_grant( self, *, - credit_id: typing.Optional[str] = None, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, + credit_amount: int, + credit_id: str, + plan_id: str, + reset_cadence: BillingPlanCreditGrantResetCadence, + reset_start: BillingPlanCreditGrantResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + auto_topup_amount: typing.Optional[int] = OMIT, + auto_topup_amount_type: typing.Optional[CreditAutoTopupAmountType] = OMIT, + auto_topup_availability: typing.Optional[BillingCreditAutoTopupAvailability] = OMIT, + auto_topup_enabled: typing.Optional[bool] = OMIT, + auto_topup_expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + auto_topup_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + auto_topup_expiry_unit_count: typing.Optional[int] = OMIT, + auto_topup_self_service: typing.Optional[bool] = OMIT, + auto_topup_threshold_credits: typing.Optional[int] = OMIT, + auto_topup_threshold_percent: typing.Optional[int] = OMIT, + can_buy_bundles: typing.Optional[bool] = OMIT, + company_credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + license_id: typing.Optional[str] = OMIT, + plan_version_id: typing.Optional[str] = OMIT, + reset_type: typing.Optional[BillingPlanCreditGrantResetType] = OMIT, + rollover_percentage: typing.Optional[int] = OMIT, + scaling: typing.Optional[PlanCreditGrantScaling] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountBillingCreditsGrantsResponse]: + ) -> AsyncHttpResponse[CreateBillingPlanCreditGrantResponse]: """ Parameters ---------- - credit_id : typing.Optional[str] + credit_amount : int - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + credit_id : str - limit : typing.Optional[int] - Page limit (default 100) + plan_id : str - offset : typing.Optional[int] - Page offset (default 0) + reset_cadence : BillingPlanCreditGrantResetCadence + + reset_start : BillingPlanCreditGrantResetStart + + apply_to_existing : typing.Optional[bool] + + auto_topup_amount : typing.Optional[int] + + auto_topup_amount_type : typing.Optional[CreditAutoTopupAmountType] + + auto_topup_availability : typing.Optional[BillingCreditAutoTopupAvailability] + + auto_topup_enabled : typing.Optional[bool] + + auto_topup_expiry_type : typing.Optional[BillingCreditExpiryType] + + auto_topup_expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + auto_topup_expiry_unit_count : typing.Optional[int] + + auto_topup_self_service : typing.Optional[bool] + + auto_topup_threshold_credits : typing.Optional[int] + + auto_topup_threshold_percent : typing.Optional[int] + + can_buy_bundles : typing.Optional[bool] + Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. + + company_credit_amount : typing.Optional[int] + Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0. + + expiry_type : typing.Optional[BillingCreditExpiryType] + + expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + license_id : typing.Optional[str] + The license whose quantity scales this grant. Required when scaling is per_license. + + plan_version_id : typing.Optional[str] + + reset_type : typing.Optional[BillingPlanCreditGrantResetType] + + rollover_percentage : typing.Optional[int] + Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0. + + scaling : typing.Optional[PlanCreditGrantScaling] + Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CountBillingCreditsGrantsResponse] - OK + AsyncHttpResponse[CreateBillingPlanCreditGrantResponse] + Created """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/grants/count", - method="GET", - params={ + "billing/credits/plan-grants", + method="POST", + json={ + "apply_to_existing": apply_to_existing, + "auto_topup_amount": auto_topup_amount, + "auto_topup_amount_type": auto_topup_amount_type, + "auto_topup_availability": auto_topup_availability, + "auto_topup_enabled": auto_topup_enabled, + "auto_topup_expiry_type": auto_topup_expiry_type, + "auto_topup_expiry_unit": auto_topup_expiry_unit, + "auto_topup_expiry_unit_count": auto_topup_expiry_unit_count, + "auto_topup_self_service": auto_topup_self_service, + "auto_topup_threshold_credits": auto_topup_threshold_credits, + "auto_topup_threshold_percent": auto_topup_threshold_percent, + "can_buy_bundles": can_buy_bundles, + "company_credit_amount": company_credit_amount, + "credit_amount": credit_amount, "credit_id": credit_id, - "ids": ids, - "limit": limit, - "offset": offset, + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "license_id": license_id, + "plan_id": plan_id, + "plan_version_id": plan_version_id, + "reset_cadence": reset_cadence, + "reset_start": reset_start, + "reset_type": reset_type, + "rollover_percentage": rollover_percentage, + "scaling": scaling, + }, + headers={ + "content-type": "application/json", }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountBillingCreditsGrantsResponse, + CreateBillingPlanCreditGrantResponse, parse_obj_as( - type_=CountBillingCreditsGrantsResponse, # type: ignore + type_=CreateBillingPlanCreditGrantResponse, # type: ignore object_=_response.json(), ), ) @@ -6191,68 +7756,38 @@ async def count_billing_credits_grants( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_grants_for_credit( - self, - *, - credit_id: typing.Optional[str] = None, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListGrantsForCreditResponse]: + async def get_single_billing_plan_credit_grant( + self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetSingleBillingPlanCreditGrantResponse]: """ Parameters ---------- - credit_id : typing.Optional[str] - - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) + plan_grant_id : str + plan_grant_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[ListGrantsForCreditResponse] + AsyncHttpResponse[GetSingleBillingPlanCreditGrantResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/grants/list", + f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", method="GET", - params={ - "credit_id": credit_id, - "ids": ids, - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListGrantsForCreditResponse, + GetSingleBillingPlanCreditGrantResponse, parse_obj_as( - type_=ListGrantsForCreditResponse, # type: ignore + type_=GetSingleBillingPlanCreditGrantResponse, # 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), @@ -6310,42 +7845,127 @@ async def list_grants_for_credit( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def acquire_credit_lease( + async def update_billing_plan_credit_grant( self, + plan_grant_id: str, *, - company_id: str, - credit_type_id: str, - requested_amount: float, - expires_at: typing.Optional[dt.datetime] = OMIT, + reset_cadence: BillingPlanCreditGrantResetCadence, + reset_start: BillingPlanCreditGrantResetStart, + apply_to_existing: typing.Optional[bool] = OMIT, + auto_topup_amount: typing.Optional[int] = OMIT, + auto_topup_amount_type: typing.Optional[CreditAutoTopupAmountType] = OMIT, + auto_topup_availability: typing.Optional[BillingCreditAutoTopupAvailability] = OMIT, + auto_topup_enabled: typing.Optional[bool] = OMIT, + auto_topup_expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + auto_topup_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + auto_topup_expiry_unit_count: typing.Optional[int] = OMIT, + auto_topup_self_service: typing.Optional[bool] = OMIT, + auto_topup_threshold_credits: typing.Optional[int] = OMIT, + auto_topup_threshold_percent: typing.Optional[int] = OMIT, + can_buy_bundles: typing.Optional[bool] = OMIT, + company_credit_amount: typing.Optional[int] = OMIT, + credit_amount: typing.Optional[int] = OMIT, + expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, + expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, + expiry_unit_count: typing.Optional[int] = OMIT, + license_id: typing.Optional[str] = OMIT, + reset_type: typing.Optional[BillingPlanCreditGrantResetType] = OMIT, + rollover_percentage: typing.Optional[int] = OMIT, + scaling: typing.Optional[PlanCreditGrantScaling] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[AcquireCreditLeaseResponse]: + ) -> AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse]: """ Parameters ---------- - company_id : str + plan_grant_id : str + plan_grant_id - credit_type_id : str + reset_cadence : BillingPlanCreditGrantResetCadence - requested_amount : float + reset_start : BillingPlanCreditGrantResetStart - expires_at : typing.Optional[dt.datetime] + apply_to_existing : typing.Optional[bool] + + auto_topup_amount : typing.Optional[int] + + auto_topup_amount_type : typing.Optional[CreditAutoTopupAmountType] + + auto_topup_availability : typing.Optional[BillingCreditAutoTopupAvailability] + + auto_topup_enabled : typing.Optional[bool] + + auto_topup_expiry_type : typing.Optional[BillingCreditExpiryType] + + auto_topup_expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + auto_topup_expiry_unit_count : typing.Optional[int] + + auto_topup_self_service : typing.Optional[bool] + + auto_topup_threshold_credits : typing.Optional[int] + + auto_topup_threshold_percent : typing.Optional[int] + + can_buy_bundles : typing.Optional[bool] + Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. + + company_credit_amount : typing.Optional[int] + Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license. + + credit_amount : typing.Optional[int] + + expiry_type : typing.Optional[BillingCreditExpiryType] + + expiry_unit : typing.Optional[BillingCreditExpiryUnit] + + expiry_unit_count : typing.Optional[int] + + license_id : typing.Optional[str] + The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling. + + reset_type : typing.Optional[BillingPlanCreditGrantResetType] + + rollover_percentage : typing.Optional[int] + Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. + + scaling : typing.Optional[PlanCreditGrantScaling] + Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[AcquireCreditLeaseResponse] - Created + AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/lease", - method="POST", + f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", + method="PUT", json={ - "company_id": company_id, - "credit_type_id": credit_type_id, - "expires_at": expires_at, - "requested_amount": requested_amount, + "apply_to_existing": apply_to_existing, + "auto_topup_amount": auto_topup_amount, + "auto_topup_amount_type": auto_topup_amount_type, + "auto_topup_availability": auto_topup_availability, + "auto_topup_enabled": auto_topup_enabled, + "auto_topup_expiry_type": auto_topup_expiry_type, + "auto_topup_expiry_unit": auto_topup_expiry_unit, + "auto_topup_expiry_unit_count": auto_topup_expiry_unit_count, + "auto_topup_self_service": auto_topup_self_service, + "auto_topup_threshold_credits": auto_topup_threshold_credits, + "auto_topup_threshold_percent": auto_topup_threshold_percent, + "can_buy_bundles": can_buy_bundles, + "company_credit_amount": company_credit_amount, + "credit_amount": credit_amount, + "expiry_type": expiry_type, + "expiry_unit": expiry_unit, + "expiry_unit_count": expiry_unit_count, + "license_id": license_id, + "reset_cadence": reset_cadence, + "reset_start": reset_start, + "reset_type": reset_type, + "rollover_percentage": rollover_percentage, + "scaling": scaling, }, headers={ "content-type": "application/json", @@ -6356,9 +7976,9 @@ async def acquire_credit_lease( try: if 200 <= _response.status_code < 300: _data = typing.cast( - AcquireCreditLeaseResponse, + UpdateBillingPlanCreditGrantResponse, parse_obj_as( - type_=AcquireCreditLeaseResponse, # type: ignore + type_=UpdateBillingPlanCreditGrantResponse, # type: ignore object_=_response.json(), ), ) @@ -6431,51 +8051,43 @@ async def acquire_credit_lease( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def extend_credit_lease( + async def delete_billing_plan_credit_grant( self, - lease_id: str, + plan_grant_id: str, *, - additional_amount: float, - expires_at: typing.Optional[dt.datetime] = OMIT, + apply_to_existing: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ExtendCreditLeaseResponse]: + ) -> AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse]: """ Parameters ---------- - lease_id : str - lease_id - - additional_amount : float + plan_grant_id : str + plan_grant_id - expires_at : typing.Optional[dt.datetime] + apply_to_existing : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[ExtendCreditLeaseResponse] + AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/lease/{encode_path_param(lease_id)}/extend", - method="PUT", - json={ - "additional_amount": additional_amount, - "expires_at": expires_at, - }, - headers={ - "content-type": "application/json", + f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", + method="DELETE", + params={ + "apply_to_existing": apply_to_existing, }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ExtendCreditLeaseResponse, + DeleteBillingPlanCreditGrantResponse, parse_obj_as( - type_=ExtendCreditLeaseResponse, # type: ignore + type_=DeleteBillingPlanCreditGrantResponse, # type: ignore object_=_response.json(), ), ) @@ -6548,45 +8160,69 @@ async def extend_credit_lease( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def release_credit_lease( + async def count_billing_plan_credit_grants( self, - lease_id: str, *, - request: ReleaseCreditLeaseRequestBody, + credit_id: typing.Optional[str] = None, + ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + plan_id: typing.Optional[str] = None, + plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + plan_version_id: typing.Optional[str] = None, + plan_version_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ReleaseCreditLeaseResponse]: + ) -> AsyncHttpResponse[CountBillingPlanCreditGrantsResponse]: """ Parameters ---------- - lease_id : str - lease_id + credit_id : typing.Optional[str] - request : ReleaseCreditLeaseRequestBody + ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + + plan_id : typing.Optional[str] + + plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + + plan_version_id : typing.Optional[str] + + plan_version_ids : typing.Optional[typing.Union[str, typing.Sequence[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[ReleaseCreditLeaseResponse] + AsyncHttpResponse[CountBillingPlanCreditGrantsResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/lease/{encode_path_param(lease_id)}/release", - method="PUT", - json=request, - headers={ - "content-type": "application/json", + "billing/credits/plan-grants/count", + method="GET", + params={ + "credit_id": credit_id, + "ids": ids, + "plan_id": plan_id, + "plan_ids": plan_ids, + "plan_version_id": plan_version_id, + "plan_version_ids": plan_version_ids, + "limit": limit, + "offset": offset, }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ReleaseCreditLeaseResponse, + CountBillingPlanCreditGrantsResponse, parse_obj_as( - type_=ReleaseCreditLeaseResponse, # type: ignore + type_=CountBillingPlanCreditGrantsResponse, # type: ignore object_=_response.json(), ), ) @@ -6659,33 +8295,30 @@ async def release_credit_lease( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_billing_plan_credit_grants( + async def list_credit_spend_policies( self, *, - credit_id: typing.Optional[str] = None, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - plan_id: typing.Optional[str] = None, - plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - plan_version_id: typing.Optional[str] = None, - plan_version_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListBillingPlanCreditGrantsResponse]: + ) -> AsyncHttpResponse[ListCreditSpendPoliciesResponse]: """ Parameters ---------- - credit_id : typing.Optional[str] - - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + billing_credit_id : typing.Optional[str] - plan_id : typing.Optional[str] + company_id : typing.Optional[str] - plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + scope_type : typing.Optional[CreditSpendPolicyScope] - plan_version_id : typing.Optional[str] + user_id : typing.Optional[str] - plan_version_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + user_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] limit : typing.Optional[int] Page limit (default 100) @@ -6698,19 +8331,18 @@ async def list_billing_plan_credit_grants( Returns ------- - AsyncHttpResponse[ListBillingPlanCreditGrantsResponse] + AsyncHttpResponse[ListCreditSpendPoliciesResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/plan-grants", + "billing/credits/spend-policies", method="GET", params={ - "credit_id": credit_id, - "ids": ids, - "plan_id": plan_id, - "plan_ids": plan_ids, - "plan_version_id": plan_version_id, - "plan_version_ids": plan_version_ids, + "billing_credit_id": billing_credit_id, + "company_id": company_id, + "scope_type": scope_type, + "user_id": user_id, + "user_ids": user_ids, "limit": limit, "offset": offset, }, @@ -6719,9 +8351,9 @@ async def list_billing_plan_credit_grants( try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListBillingPlanCreditGrantsResponse, + ListCreditSpendPoliciesResponse, parse_obj_as( - type_=ListBillingPlanCreditGrantsResponse, # type: ignore + type_=ListCreditSpendPoliciesResponse, # type: ignore object_=_response.json(), ), ) @@ -6785,144 +8417,58 @@ async def list_billing_plan_credit_grants( 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 create_billing_plan_credit_grant( - self, - *, - credit_amount: int, - credit_id: str, - plan_id: str, - reset_cadence: BillingPlanCreditGrantResetCadence, - reset_start: BillingPlanCreditGrantResetStart, - apply_to_existing: typing.Optional[bool] = OMIT, - auto_topup_amount: typing.Optional[int] = OMIT, - auto_topup_amount_type: typing.Optional[CreditAutoTopupAmountType] = OMIT, - auto_topup_availability: typing.Optional[BillingCreditAutoTopupAvailability] = OMIT, - auto_topup_enabled: typing.Optional[bool] = OMIT, - auto_topup_expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - auto_topup_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - auto_topup_expiry_unit_count: typing.Optional[int] = OMIT, - auto_topup_self_service: typing.Optional[bool] = OMIT, - auto_topup_threshold_credits: typing.Optional[int] = OMIT, - auto_topup_threshold_percent: typing.Optional[int] = OMIT, - can_buy_bundles: typing.Optional[bool] = OMIT, - company_credit_amount: typing.Optional[int] = OMIT, - expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - expiry_unit_count: typing.Optional[int] = OMIT, - license_id: typing.Optional[str] = OMIT, - plan_version_id: typing.Optional[str] = OMIT, - reset_type: typing.Optional[BillingPlanCreditGrantResetType] = OMIT, - rollover_percentage: typing.Optional[int] = OMIT, - scaling: typing.Optional[PlanCreditGrantScaling] = OMIT, + ) + 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 create_credit_spend_policy( + self, + *, + billing_credit_id: str, + max_per_draw: float, + company_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + user_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CreateBillingPlanCreditGrantResponse]: + ) -> AsyncHttpResponse[CreateCreditSpendPolicyResponse]: """ Parameters ---------- - credit_amount : int - - credit_id : str - - plan_id : str - - reset_cadence : BillingPlanCreditGrantResetCadence - - reset_start : BillingPlanCreditGrantResetStart - - apply_to_existing : typing.Optional[bool] - - auto_topup_amount : typing.Optional[int] - - auto_topup_amount_type : typing.Optional[CreditAutoTopupAmountType] - - auto_topup_availability : typing.Optional[BillingCreditAutoTopupAvailability] - - auto_topup_enabled : typing.Optional[bool] - - auto_topup_expiry_type : typing.Optional[BillingCreditExpiryType] - - auto_topup_expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - auto_topup_expiry_unit_count : typing.Optional[int] - - auto_topup_self_service : typing.Optional[bool] - - auto_topup_threshold_credits : typing.Optional[int] - - auto_topup_threshold_percent : typing.Optional[int] - - can_buy_bundles : typing.Optional[bool] - Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. - - company_credit_amount : typing.Optional[int] - Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0. - - expiry_type : typing.Optional[BillingCreditExpiryType] - - expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - expiry_unit_count : typing.Optional[int] - - license_id : typing.Optional[str] - The license whose quantity scales this grant. Required when scaling is per_license. + billing_credit_id : str - plan_version_id : typing.Optional[str] + max_per_draw : float + The largest number of credits a single draw may spend. - reset_type : typing.Optional[BillingPlanCreditGrantResetType] + company_id : typing.Optional[str] + The company the cap applies to. Set exactly one of company_id and user_id. - rollover_percentage : typing.Optional[int] - Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0. + label : typing.Optional[str] - scaling : typing.Optional[PlanCreditGrantScaling] - Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed. + user_id : typing.Optional[str] + The user the cap applies to. Set exactly one of company_id and user_id. request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateBillingPlanCreditGrantResponse] + AsyncHttpResponse[CreateCreditSpendPolicyResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/plan-grants", + "billing/credits/spend-policies", method="POST", json={ - "apply_to_existing": apply_to_existing, - "auto_topup_amount": auto_topup_amount, - "auto_topup_amount_type": auto_topup_amount_type, - "auto_topup_availability": auto_topup_availability, - "auto_topup_enabled": auto_topup_enabled, - "auto_topup_expiry_type": auto_topup_expiry_type, - "auto_topup_expiry_unit": auto_topup_expiry_unit, - "auto_topup_expiry_unit_count": auto_topup_expiry_unit_count, - "auto_topup_self_service": auto_topup_self_service, - "auto_topup_threshold_credits": auto_topup_threshold_credits, - "auto_topup_threshold_percent": auto_topup_threshold_percent, - "can_buy_bundles": can_buy_bundles, - "company_credit_amount": company_credit_amount, - "credit_amount": credit_amount, - "credit_id": credit_id, - "expiry_type": expiry_type, - "expiry_unit": expiry_unit, - "expiry_unit_count": expiry_unit_count, - "license_id": license_id, - "plan_id": plan_id, - "plan_version_id": plan_version_id, - "reset_cadence": reset_cadence, - "reset_start": reset_start, - "reset_type": reset_type, - "rollover_percentage": rollover_percentage, - "scaling": scaling, + "billing_credit_id": billing_credit_id, + "company_id": company_id, + "label": label, + "max_per_draw": max_per_draw, + "user_id": user_id, }, headers={ "content-type": "application/json", @@ -6933,9 +8479,9 @@ async def create_billing_plan_credit_grant( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CreateBillingPlanCreditGrantResponse, + CreateCreditSpendPolicyResponse, parse_obj_as( - type_=CreateBillingPlanCreditGrantResponse, # type: ignore + type_=CreateCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) @@ -7008,34 +8554,34 @@ async def create_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_single_billing_plan_credit_grant( - self, plan_grant_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[GetSingleBillingPlanCreditGrantResponse]: + async def get_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetCreditSpendPolicyResponse]: """ Parameters ---------- - plan_grant_id : str - plan_grant_id + spend_policy_id : str + spend_policy_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[GetSingleBillingPlanCreditGrantResponse] + AsyncHttpResponse[GetCreditSpendPolicyResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetSingleBillingPlanCreditGrantResponse, + GetCreditSpendPolicyResponse, parse_obj_as( - type_=GetSingleBillingPlanCreditGrantResponse, # type: ignore + type_=GetCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) @@ -7097,127 +8643,38 @@ async def get_single_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def update_billing_plan_credit_grant( + async def update_credit_spend_policy( self, - plan_grant_id: str, + spend_policy_id: str, *, - reset_cadence: BillingPlanCreditGrantResetCadence, - reset_start: BillingPlanCreditGrantResetStart, - apply_to_existing: typing.Optional[bool] = OMIT, - auto_topup_amount: typing.Optional[int] = OMIT, - auto_topup_amount_type: typing.Optional[CreditAutoTopupAmountType] = OMIT, - auto_topup_availability: typing.Optional[BillingCreditAutoTopupAvailability] = OMIT, - auto_topup_enabled: typing.Optional[bool] = OMIT, - auto_topup_expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - auto_topup_expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - auto_topup_expiry_unit_count: typing.Optional[int] = OMIT, - auto_topup_self_service: typing.Optional[bool] = OMIT, - auto_topup_threshold_credits: typing.Optional[int] = OMIT, - auto_topup_threshold_percent: typing.Optional[int] = OMIT, - can_buy_bundles: typing.Optional[bool] = OMIT, - company_credit_amount: typing.Optional[int] = OMIT, - credit_amount: typing.Optional[int] = OMIT, - expiry_type: typing.Optional[BillingCreditExpiryType] = OMIT, - expiry_unit: typing.Optional[BillingCreditExpiryUnit] = OMIT, - expiry_unit_count: typing.Optional[int] = OMIT, - license_id: typing.Optional[str] = OMIT, - reset_type: typing.Optional[BillingPlanCreditGrantResetType] = OMIT, - rollover_percentage: typing.Optional[int] = OMIT, - scaling: typing.Optional[PlanCreditGrantScaling] = OMIT, + label: typing.Optional[str] = OMIT, + max_per_draw: typing.Optional[float] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse]: + ) -> AsyncHttpResponse[UpdateCreditSpendPolicyResponse]: """ Parameters ---------- - plan_grant_id : str - plan_grant_id - - reset_cadence : BillingPlanCreditGrantResetCadence - - reset_start : BillingPlanCreditGrantResetStart - - apply_to_existing : typing.Optional[bool] - - auto_topup_amount : typing.Optional[int] - - auto_topup_amount_type : typing.Optional[CreditAutoTopupAmountType] - - auto_topup_availability : typing.Optional[BillingCreditAutoTopupAvailability] - - auto_topup_enabled : typing.Optional[bool] - - auto_topup_expiry_type : typing.Optional[BillingCreditExpiryType] - - auto_topup_expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - auto_topup_expiry_unit_count : typing.Optional[int] - - auto_topup_self_service : typing.Optional[bool] - - auto_topup_threshold_credits : typing.Optional[int] - - auto_topup_threshold_percent : typing.Optional[int] - - can_buy_bundles : typing.Optional[bool] - Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. - - company_credit_amount : typing.Optional[int] - Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license. - - credit_amount : typing.Optional[int] - - expiry_type : typing.Optional[BillingCreditExpiryType] - - expiry_unit : typing.Optional[BillingCreditExpiryUnit] - - expiry_unit_count : typing.Optional[int] - - license_id : typing.Optional[str] - The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling. + spend_policy_id : str + spend_policy_id - reset_type : typing.Optional[BillingPlanCreditGrantResetType] - - rollover_percentage : typing.Optional[int] - Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. + label : typing.Optional[str] - scaling : typing.Optional[PlanCreditGrantScaling] - Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant. + max_per_draw : typing.Optional[float] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse] + AsyncHttpResponse[UpdateCreditSpendPolicyResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", method="PUT", json={ - "apply_to_existing": apply_to_existing, - "auto_topup_amount": auto_topup_amount, - "auto_topup_amount_type": auto_topup_amount_type, - "auto_topup_availability": auto_topup_availability, - "auto_topup_enabled": auto_topup_enabled, - "auto_topup_expiry_type": auto_topup_expiry_type, - "auto_topup_expiry_unit": auto_topup_expiry_unit, - "auto_topup_expiry_unit_count": auto_topup_expiry_unit_count, - "auto_topup_self_service": auto_topup_self_service, - "auto_topup_threshold_credits": auto_topup_threshold_credits, - "auto_topup_threshold_percent": auto_topup_threshold_percent, - "can_buy_bundles": can_buy_bundles, - "company_credit_amount": company_credit_amount, - "credit_amount": credit_amount, - "expiry_type": expiry_type, - "expiry_unit": expiry_unit, - "expiry_unit_count": expiry_unit_count, - "license_id": license_id, - "reset_cadence": reset_cadence, - "reset_start": reset_start, - "reset_type": reset_type, - "rollover_percentage": rollover_percentage, - "scaling": scaling, + "label": label, + "max_per_draw": max_per_draw, }, headers={ "content-type": "application/json", @@ -7228,9 +8685,9 @@ async def update_billing_plan_credit_grant( try: if 200 <= _response.status_code < 300: _data = typing.cast( - UpdateBillingPlanCreditGrantResponse, + UpdateCreditSpendPolicyResponse, parse_obj_as( - type_=UpdateBillingPlanCreditGrantResponse, # type: ignore + type_=UpdateCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) @@ -7303,43 +8760,34 @@ async def update_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def delete_billing_plan_credit_grant( - self, - plan_grant_id: str, - *, - apply_to_existing: typing.Optional[bool] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse]: + async def delete_credit_spend_policy( + self, spend_policy_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteCreditSpendPolicyResponse]: """ Parameters ---------- - plan_grant_id : str - plan_grant_id - - apply_to_existing : typing.Optional[bool] + spend_policy_id : str + spend_policy_id request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse] + AsyncHttpResponse[DeleteCreditSpendPolicyResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"billing/credits/plan-grants/{encode_path_param(plan_grant_id)}", + f"billing/credits/spend-policies/{encode_path_param(spend_policy_id)}", method="DELETE", - params={ - "apply_to_existing": apply_to_existing, - }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - DeleteBillingPlanCreditGrantResponse, + DeleteCreditSpendPolicyResponse, parse_obj_as( - type_=DeleteBillingPlanCreditGrantResponse, # type: ignore + type_=DeleteCreditSpendPolicyResponse, # type: ignore object_=_response.json(), ), ) @@ -7412,33 +8860,30 @@ async def delete_billing_plan_credit_grant( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def count_billing_plan_credit_grants( + async def count_credit_spend_policies( self, *, - credit_id: typing.Optional[str] = None, - ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - plan_id: typing.Optional[str] = None, - plan_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - plan_version_id: typing.Optional[str] = None, - plan_version_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + billing_credit_id: typing.Optional[str] = None, + company_id: typing.Optional[str] = None, + scope_type: typing.Optional[CreditSpendPolicyScope] = None, + user_id: typing.Optional[str] = None, + user_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CountBillingPlanCreditGrantsResponse]: + ) -> AsyncHttpResponse[CountCreditSpendPoliciesResponse]: """ Parameters ---------- - credit_id : typing.Optional[str] - - ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + billing_credit_id : typing.Optional[str] - plan_id : typing.Optional[str] + company_id : typing.Optional[str] - plan_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + scope_type : typing.Optional[CreditSpendPolicyScope] - plan_version_id : typing.Optional[str] + user_id : typing.Optional[str] - plan_version_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + user_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] limit : typing.Optional[int] Page limit (default 100) @@ -7451,19 +8896,18 @@ async def count_billing_plan_credit_grants( Returns ------- - AsyncHttpResponse[CountBillingPlanCreditGrantsResponse] + AsyncHttpResponse[CountCreditSpendPoliciesResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "billing/credits/plan-grants/count", + "billing/credits/spend-policies/count", method="GET", params={ - "credit_id": credit_id, - "ids": ids, - "plan_id": plan_id, - "plan_ids": plan_ids, - "plan_version_id": plan_version_id, - "plan_version_ids": plan_version_ids, + "billing_credit_id": billing_credit_id, + "company_id": company_id, + "scope_type": scope_type, + "user_id": user_id, + "user_ids": user_ids, "limit": limit, "offset": offset, }, @@ -7472,9 +8916,9 @@ async def count_billing_plan_credit_grants( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CountBillingPlanCreditGrantsResponse, + CountCreditSpendPoliciesResponse, parse_obj_as( - type_=CountBillingPlanCreditGrantsResponse, # type: ignore + type_=CountCreditSpendPoliciesResponse, # type: ignore object_=_response.json(), ), ) diff --git a/src/schematic/credits/types/__init__.py b/src/schematic/credits/types/__init__.py index 69f3d65..183b52c 100644 --- a/src/schematic/credits/types/__init__.py +++ b/src/schematic/credits/types/__init__.py @@ -19,14 +19,19 @@ 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_spend_policies_params import CountCreditSpendPoliciesParams + from .count_credit_spend_policies_response import CountCreditSpendPoliciesResponse from .create_billing_credit_response import CreateBillingCreditResponse from .create_billing_plan_credit_grant_response import CreateBillingPlanCreditGrantResponse from .create_credit_bundle_response import CreateCreditBundleResponse + from .create_credit_spend_policy_response import CreateCreditSpendPolicyResponse 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 .delete_credit_spend_policy_response import DeleteCreditSpendPolicyResponse from .extend_credit_lease_response import ExtendCreditLeaseResponse from .get_credit_bundle_response import GetCreditBundleResponse + from .get_credit_spend_policy_response import GetCreditSpendPolicyResponse 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 @@ -42,6 +47,8 @@ from .list_credit_bundles_response import ListCreditBundlesResponse from .list_credit_event_ledger_params import ListCreditEventLedgerParams from .list_credit_event_ledger_response import ListCreditEventLedgerResponse + from .list_credit_spend_policies_params import ListCreditSpendPoliciesParams + from .list_credit_spend_policies_response import ListCreditSpendPoliciesResponse from .list_grants_for_credit_params import ListGrantsForCreditParams from .list_grants_for_credit_response import ListGrantsForCreditResponse from .release_credit_lease_response import ReleaseCreditLeaseResponse @@ -49,6 +56,7 @@ from .update_billing_credit_response import UpdateBillingCreditResponse from .update_billing_plan_credit_grant_response import UpdateBillingPlanCreditGrantResponse from .update_credit_bundle_details_response import UpdateCreditBundleDetailsResponse + from .update_credit_spend_policy_response import UpdateCreditSpendPolicyResponse from .zero_out_grant_response import ZeroOutGrantResponse _dynamic_imports: typing.Dict[str, str] = { "AcquireCreditLeaseResponse": ".acquire_credit_lease_response", @@ -64,14 +72,19 @@ "CountCreditBundlesResponse": ".count_credit_bundles_response", "CountCreditEventLedgerParams": ".count_credit_event_ledger_params", "CountCreditEventLedgerResponse": ".count_credit_event_ledger_response", + "CountCreditSpendPoliciesParams": ".count_credit_spend_policies_params", + "CountCreditSpendPoliciesResponse": ".count_credit_spend_policies_response", "CreateBillingCreditResponse": ".create_billing_credit_response", "CreateBillingPlanCreditGrantResponse": ".create_billing_plan_credit_grant_response", "CreateCreditBundleResponse": ".create_credit_bundle_response", + "CreateCreditSpendPolicyResponse": ".create_credit_spend_policy_response", "DeleteBillingPlanCreditGrantParams": ".delete_billing_plan_credit_grant_params", "DeleteBillingPlanCreditGrantResponse": ".delete_billing_plan_credit_grant_response", "DeleteCreditBundleResponse": ".delete_credit_bundle_response", + "DeleteCreditSpendPolicyResponse": ".delete_credit_spend_policy_response", "ExtendCreditLeaseResponse": ".extend_credit_lease_response", "GetCreditBundleResponse": ".get_credit_bundle_response", + "GetCreditSpendPolicyResponse": ".get_credit_spend_policy_response", "GetSingleBillingCreditResponse": ".get_single_billing_credit_response", "GetSingleBillingPlanCreditGrantResponse": ".get_single_billing_plan_credit_grant_response", "GrantBillingCreditsToCompanyResponse": ".grant_billing_credits_to_company_response", @@ -87,6 +100,8 @@ "ListCreditBundlesResponse": ".list_credit_bundles_response", "ListCreditEventLedgerParams": ".list_credit_event_ledger_params", "ListCreditEventLedgerResponse": ".list_credit_event_ledger_response", + "ListCreditSpendPoliciesParams": ".list_credit_spend_policies_params", + "ListCreditSpendPoliciesResponse": ".list_credit_spend_policies_response", "ListGrantsForCreditParams": ".list_grants_for_credit_params", "ListGrantsForCreditResponse": ".list_grants_for_credit_response", "ReleaseCreditLeaseResponse": ".release_credit_lease_response", @@ -94,6 +109,7 @@ "UpdateBillingCreditResponse": ".update_billing_credit_response", "UpdateBillingPlanCreditGrantResponse": ".update_billing_plan_credit_grant_response", "UpdateCreditBundleDetailsResponse": ".update_credit_bundle_details_response", + "UpdateCreditSpendPolicyResponse": ".update_credit_spend_policy_response", "ZeroOutGrantResponse": ".zero_out_grant_response", } @@ -133,14 +149,19 @@ def __dir__(): "CountCreditBundlesResponse", "CountCreditEventLedgerParams", "CountCreditEventLedgerResponse", + "CountCreditSpendPoliciesParams", + "CountCreditSpendPoliciesResponse", "CreateBillingCreditResponse", "CreateBillingPlanCreditGrantResponse", "CreateCreditBundleResponse", + "CreateCreditSpendPolicyResponse", "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", "DeleteCreditBundleResponse", + "DeleteCreditSpendPolicyResponse", "ExtendCreditLeaseResponse", "GetCreditBundleResponse", + "GetCreditSpendPolicyResponse", "GetSingleBillingCreditResponse", "GetSingleBillingPlanCreditGrantResponse", "GrantBillingCreditsToCompanyResponse", @@ -156,6 +177,8 @@ def __dir__(): "ListCreditBundlesResponse", "ListCreditEventLedgerParams", "ListCreditEventLedgerResponse", + "ListCreditSpendPoliciesParams", + "ListCreditSpendPoliciesResponse", "ListGrantsForCreditParams", "ListGrantsForCreditResponse", "ReleaseCreditLeaseResponse", @@ -163,5 +186,6 @@ def __dir__(): "UpdateBillingCreditResponse", "UpdateBillingPlanCreditGrantResponse", "UpdateCreditBundleDetailsResponse", + "UpdateCreditSpendPolicyResponse", "ZeroOutGrantResponse", ] diff --git a/src/schematic/credits/types/count_credit_spend_policies_params.py b/src/schematic/credits/types/count_credit_spend_policies_params.py new file mode 100644 index 0000000..a2cd4b8 --- /dev/null +++ b/src/schematic/credits/types/count_credit_spend_policies_params.py @@ -0,0 +1,38 @@ +# 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_spend_policy_scope import CreditSpendPolicyScope + + +class CountCreditSpendPoliciesParams(UniversalBaseModel): + """ + Input parameters + """ + + billing_credit_id: typing.Optional[str] = None + company_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) + """ + + scope_type: typing.Optional[CreditSpendPolicyScope] = None + user_id: typing.Optional[str] = None + user_ids: typing.Optional[typing.List[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_spend_policies_response.py b/src/schematic/credits/types/count_credit_spend_policies_response.py new file mode 100644 index 0000000..480cd41 --- /dev/null +++ b/src/schematic/credits/types/count_credit_spend_policies_response.py @@ -0,0 +1,25 @@ +# 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_spend_policies_params import CountCreditSpendPoliciesParams + + +class CountCreditSpendPoliciesResponse(UniversalBaseModel): + data: CountResponse + params: CountCreditSpendPoliciesParams = 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/create_credit_spend_policy_response.py b/src/schematic/credits/types/create_credit_spend_policy_response.py new file mode 100644 index 0000000..42686f0 --- /dev/null +++ b/src/schematic/credits/types/create_credit_spend_policy_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.credit_spend_policy_response_data import CreditSpendPolicyResponseData + + +class CreateCreditSpendPolicyResponse(UniversalBaseModel): + data: CreditSpendPolicyResponseData + params: typing.Dict[str, 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/credits/types/delete_credit_spend_policy_response.py b/src/schematic/credits/types/delete_credit_spend_policy_response.py new file mode 100644 index 0000000..b0834f7 --- /dev/null +++ b/src/schematic/credits/types/delete_credit_spend_policy_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.delete_response import DeleteResponse + + +class DeleteCreditSpendPolicyResponse(UniversalBaseModel): + data: DeleteResponse + params: typing.Dict[str, 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/credits/types/get_credit_spend_policy_response.py b/src/schematic/credits/types/get_credit_spend_policy_response.py new file mode 100644 index 0000000..70977ae --- /dev/null +++ b/src/schematic/credits/types/get_credit_spend_policy_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.credit_spend_policy_response_data import CreditSpendPolicyResponseData + + +class GetCreditSpendPolicyResponse(UniversalBaseModel): + data: CreditSpendPolicyResponseData + params: typing.Dict[str, 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/credits/types/list_credit_spend_policies_params.py b/src/schematic/credits/types/list_credit_spend_policies_params.py new file mode 100644 index 0000000..1ce97cf --- /dev/null +++ b/src/schematic/credits/types/list_credit_spend_policies_params.py @@ -0,0 +1,38 @@ +# 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_spend_policy_scope import CreditSpendPolicyScope + + +class ListCreditSpendPoliciesParams(UniversalBaseModel): + """ + Input parameters + """ + + billing_credit_id: typing.Optional[str] = None + company_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) + """ + + scope_type: typing.Optional[CreditSpendPolicyScope] = None + user_id: typing.Optional[str] = None + user_ids: typing.Optional[typing.List[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/list_credit_spend_policies_response.py b/src/schematic/credits/types/list_credit_spend_policies_response.py new file mode 100644 index 0000000..bdecc6e --- /dev/null +++ b/src/schematic/credits/types/list_credit_spend_policies_response.py @@ -0,0 +1,25 @@ +# 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_spend_policy_response_data import CreditSpendPolicyResponseData +from .list_credit_spend_policies_params import ListCreditSpendPoliciesParams + + +class ListCreditSpendPoliciesResponse(UniversalBaseModel): + data: typing.List[CreditSpendPolicyResponseData] + params: ListCreditSpendPoliciesParams = 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/update_credit_spend_policy_response.py b/src/schematic/credits/types/update_credit_spend_policy_response.py new file mode 100644 index 0000000..5e4c2c7 --- /dev/null +++ b/src/schematic/credits/types/update_credit_spend_policy_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.credit_spend_policy_response_data import CreditSpendPolicyResponseData + + +class UpdateCreditSpendPolicyResponse(UniversalBaseModel): + data: CreditSpendPolicyResponseData + params: typing.Dict[str, 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/errors/__init__.py b/src/schematic/errors/__init__.py index 306a114..ace3bc0 100644 --- a/src/schematic/errors/__init__.py +++ b/src/schematic/errors/__init__.py @@ -10,12 +10,14 @@ from .forbidden_error import ForbiddenError from .internal_server_error import InternalServerError from .not_found_error import NotFoundError + from .payment_required_error import PaymentRequiredError from .unauthorized_error import UnauthorizedError _dynamic_imports: typing.Dict[str, str] = { "BadRequestError": ".bad_request_error", "ForbiddenError": ".forbidden_error", "InternalServerError": ".internal_server_error", "NotFoundError": ".not_found_error", + "PaymentRequiredError": ".payment_required_error", "UnauthorizedError": ".unauthorized_error", } @@ -41,4 +43,11 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = ["BadRequestError", "ForbiddenError", "InternalServerError", "NotFoundError", "UnauthorizedError"] +__all__ = [ + "BadRequestError", + "ForbiddenError", + "InternalServerError", + "NotFoundError", + "PaymentRequiredError", + "UnauthorizedError", +] diff --git a/src/schematic/errors/payment_required_error.py b/src/schematic/errors/payment_required_error.py new file mode 100644 index 0000000..00cdcbe --- /dev/null +++ b/src/schematic/errors/payment_required_error.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError as core_api_error_ApiError +from ..types.api_error import ApiError as types_api_error_ApiError + + +class PaymentRequiredError(core_api_error_ApiError): + def __init__(self, body: types_api_error_ApiError, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=402, headers=headers, body=body) diff --git a/src/schematic/events/__init__.py b/src/schematic/events/__init__.py index 14abe9e..ad32052 100644 --- a/src/schematic/events/__init__.py +++ b/src/schematic/events/__init__.py @@ -9,22 +9,28 @@ from .types import ( CreateEventBatchResponse, CreateEventResponse, + DeleteOtlpEnvironmentSettingsResponse, GetEventResponse, GetEventSummariesParams, GetEventSummariesResponse, + GetOtlpEnvironmentSettingsResponse, GetSegmentIntegrationStatusResponse, ListEventsParams, ListEventsResponse, + UpsertOtlpEnvironmentSettingsResponse, ) _dynamic_imports: typing.Dict[str, str] = { "CreateEventBatchResponse": ".types", "CreateEventResponse": ".types", + "DeleteOtlpEnvironmentSettingsResponse": ".types", "GetEventResponse": ".types", "GetEventSummariesParams": ".types", "GetEventSummariesResponse": ".types", + "GetOtlpEnvironmentSettingsResponse": ".types", "GetSegmentIntegrationStatusResponse": ".types", "ListEventsParams": ".types", "ListEventsResponse": ".types", + "UpsertOtlpEnvironmentSettingsResponse": ".types", } @@ -52,10 +58,13 @@ def __dir__(): __all__ = [ "CreateEventBatchResponse", "CreateEventResponse", + "DeleteOtlpEnvironmentSettingsResponse", "GetEventResponse", "GetEventSummariesParams", "GetEventSummariesResponse", + "GetOtlpEnvironmentSettingsResponse", "GetSegmentIntegrationStatusResponse", "ListEventsParams", "ListEventsResponse", + "UpsertOtlpEnvironmentSettingsResponse", ] diff --git a/src/schematic/events/client.py b/src/schematic/events/client.py index ee3991d..ab1d13a 100644 --- a/src/schematic/events/client.py +++ b/src/schematic/events/client.py @@ -11,10 +11,13 @@ from .raw_client import AsyncRawEventsClient, RawEventsClient from .types.create_event_batch_response import CreateEventBatchResponse from .types.create_event_response import CreateEventResponse +from .types.delete_otlp_environment_settings_response import DeleteOtlpEnvironmentSettingsResponse from .types.get_event_response import GetEventResponse from .types.get_event_summaries_response import GetEventSummariesResponse +from .types.get_otlp_environment_settings_response import GetOtlpEnvironmentSettingsResponse from .types.get_segment_integration_status_response import GetSegmentIntegrationStatusResponse from .types.list_events_response import ListEventsResponse +from .types.upsert_otlp_environment_settings_response import UpsertOtlpEnvironmentSettingsResponse # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -284,6 +287,110 @@ def get_event(self, event_id: str, *, request_options: typing.Optional[RequestOp _response = self._raw_client.get_event(event_id, request_options=request_options) return _response.data + def get_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.events.get_otlp_environment_settings() + """ + _response = self._raw_client.get_otlp_environment_settings(request_options=request_options) + return _response.data + + def upsert_otlp_environment_settings( + self, + *, + tool_events_enabled: bool, + company_attribute: typing.Optional[str] = OMIT, + company_key: typing.Optional[str] = OMIT, + user_attribute: typing.Optional[str] = OMIT, + user_key: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpsertOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + tool_events_enabled : bool + + company_attribute : typing.Optional[str] + + company_key : typing.Optional[str] + + user_attribute : typing.Optional[str] + + user_key : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpsertOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.events.upsert_otlp_environment_settings( + tool_events_enabled=True, + ) + """ + _response = self._raw_client.upsert_otlp_environment_settings( + tool_events_enabled=tool_events_enabled, + company_attribute=company_attribute, + company_key=company_key, + user_attribute=user_attribute, + user_key=user_key, + request_options=request_options, + ) + return _response.data + + def delete_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.events.delete_otlp_environment_settings() + """ + _response = self._raw_client.delete_otlp_environment_settings(request_options=request_options) + return _response.data + def get_segment_integration_status( self, *, request_options: typing.Optional[RequestOptions] = None ) -> GetSegmentIntegrationStatusResponse: @@ -617,6 +724,134 @@ async def main() -> None: _response = await self._raw_client.get_event(event_id, request_options=request_options) return _response.data + async def get_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.events.get_otlp_environment_settings() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_otlp_environment_settings(request_options=request_options) + return _response.data + + async def upsert_otlp_environment_settings( + self, + *, + tool_events_enabled: bool, + company_attribute: typing.Optional[str] = OMIT, + company_key: typing.Optional[str] = OMIT, + user_attribute: typing.Optional[str] = OMIT, + user_key: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpsertOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + tool_events_enabled : bool + + company_attribute : typing.Optional[str] + + company_key : typing.Optional[str] + + user_attribute : typing.Optional[str] + + user_key : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpsertOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.events.upsert_otlp_environment_settings( + tool_events_enabled=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.upsert_otlp_environment_settings( + tool_events_enabled=tool_events_enabled, + company_attribute=company_attribute, + company_key=company_key, + user_attribute=user_attribute, + user_key=user_key, + request_options=request_options, + ) + return _response.data + + async def delete_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteOtlpEnvironmentSettingsResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteOtlpEnvironmentSettingsResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.events.delete_otlp_environment_settings() + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_otlp_environment_settings(request_options=request_options) + return _response.data + async def get_segment_integration_status( self, *, request_options: typing.Optional[RequestOptions] = None ) -> GetSegmentIntegrationStatusResponse: diff --git a/src/schematic/events/raw_client.py b/src/schematic/events/raw_client.py index 2c38bba..ee966ea 100644 --- a/src/schematic/events/raw_client.py +++ b/src/schematic/events/raw_client.py @@ -23,10 +23,13 @@ from ..types.event_type import EventType from .types.create_event_batch_response import CreateEventBatchResponse from .types.create_event_response import CreateEventResponse +from .types.delete_otlp_environment_settings_response import DeleteOtlpEnvironmentSettingsResponse from .types.get_event_response import GetEventResponse from .types.get_event_summaries_response import GetEventSummariesResponse +from .types.get_otlp_environment_settings_response import GetOtlpEnvironmentSettingsResponse from .types.get_segment_integration_status_response import GetSegmentIntegrationStatusResponse from .types.list_events_response import ListEventsResponse +from .types.upsert_otlp_environment_settings_response import UpsertOtlpEnvironmentSettingsResponse from pydantic import ValidationError # this is used as the default value for optional parameters @@ -625,9 +628,9 @@ def get_event( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def get_segment_integration_status( + def get_otlp_environment_settings( self, *, request_options: typing.Optional[RequestOptions] = None - ) -> HttpResponse[GetSegmentIntegrationStatusResponse]: + ) -> HttpResponse[GetOtlpEnvironmentSettingsResponse]: """ Parameters ---------- @@ -636,20 +639,20 @@ def get_segment_integration_status( Returns ------- - HttpResponse[GetSegmentIntegrationStatusResponse] + HttpResponse[GetOtlpEnvironmentSettingsResponse] OK """ _response = self._client_wrapper.httpx_client.request( - "segment-integration", + "otlp/settings", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetSegmentIntegrationStatusResponse, + GetOtlpEnvironmentSettingsResponse, parse_obj_as( - type_=GetSegmentIntegrationStatusResponse, # type: ignore + type_=GetOtlpEnvironmentSettingsResponse, # type: ignore object_=_response.json(), ), ) @@ -711,37 +714,46 @@ def get_segment_integration_status( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - -class AsyncRawEventsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def create_event_batch( + def upsert_otlp_environment_settings( self, *, - events: typing.Sequence[CreateEventRequestBody], + tool_events_enabled: bool, + company_attribute: typing.Optional[str] = OMIT, + company_key: typing.Optional[str] = OMIT, + user_attribute: typing.Optional[str] = OMIT, + user_key: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CreateEventBatchResponse]: + ) -> HttpResponse[UpsertOtlpEnvironmentSettingsResponse]: """ Parameters ---------- - events : typing.Sequence[CreateEventRequestBody] + tool_events_enabled : bool + + company_attribute : typing.Optional[str] + + company_key : typing.Optional[str] + + user_attribute : typing.Optional[str] + + user_key : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateEventBatchResponse] - Created + HttpResponse[UpsertOtlpEnvironmentSettingsResponse] + OK """ - _response = await self._client_wrapper.httpx_client.request( - "event-batch", + _response = self._client_wrapper.httpx_client.request( + "otlp/settings", method="POST", json={ - "events": convert_and_respect_annotation_metadata( - object_=events, annotation=typing.Sequence[CreateEventRequestBody], direction="write" - ), + "company_attribute": company_attribute, + "company_key": company_key, + "tool_events_enabled": tool_events_enabled, + "user_attribute": user_attribute, + "user_key": user_key, }, headers={ "content-type": "application/json", @@ -752,13 +764,13 @@ async def create_event_batch( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CreateEventBatchResponse, + UpsertOtlpEnvironmentSettingsResponse, parse_obj_as( - type_=CreateEventBatchResponse, # type: ignore + type_=UpsertOtlpEnvironmentSettingsResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -827,57 +839,35 @@ async def create_event_batch( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_event_summaries( - self, - *, - q: typing.Optional[str] = None, - event_subtypes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[GetEventSummariesResponse]: + def delete_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteOtlpEnvironmentSettingsResponse]: """ Parameters ---------- - q : typing.Optional[str] - - event_subtypes : typing.Optional[typing.Union[str, typing.Sequence[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[GetEventSummariesResponse] + HttpResponse[DeleteOtlpEnvironmentSettingsResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - "event-types", - method="GET", - params={ - "q": q, - "event_subtypes": event_subtypes, - "limit": limit, - "offset": offset, - }, + _response = self._client_wrapper.httpx_client.request( + "otlp/settings", + method="DELETE", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetEventSummariesResponse, + DeleteOtlpEnvironmentSettingsResponse, parse_obj_as( - type_=GetEventSummariesResponse, # type: ignore + type_=DeleteOtlpEnvironmentSettingsResponse, # type: ignore object_=_response.json(), ), ) - return AsyncHttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -946,84 +936,35 @@ async def get_event_summaries( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_events( - self, - *, - company_id: typing.Optional[str] = None, - event_subtype: typing.Optional[str] = None, - event_types: typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]] = None, - flag_id: typing.Optional[str] = None, - idempotency_key: typing.Optional[str] = None, - user_id: typing.Optional[str] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListEventsResponse]: + def get_segment_integration_status( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetSegmentIntegrationStatusResponse]: """ Parameters ---------- - company_id : typing.Optional[str] - - event_subtype : typing.Optional[str] - - event_types : typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]] - - flag_id : typing.Optional[str] - - idempotency_key : typing.Optional[str] - - user_id : 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[ListEventsResponse] + HttpResponse[GetSegmentIntegrationStatusResponse] OK """ - _response = await self._client_wrapper.httpx_client.request( - "events", + _response = self._client_wrapper.httpx_client.request( + "segment-integration", method="GET", - params={ - "company_id": company_id, - "event_subtype": event_subtype, - "event_types": event_types, - "flag_id": flag_id, - "idempotency_key": idempotency_key, - "user_id": user_id, - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListEventsResponse, + GetSegmentIntegrationStatusResponse, parse_obj_as( - type_=ListEventsResponse, # type: ignore + type_=GetSegmentIntegrationStatusResponse, # 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(), - ), - ), - ) + return HttpResponse(response=_response, data=_data) if _response.status_code == 401: raise UnauthorizedError( headers=dict(_response.headers), @@ -1081,55 +1022,37 @@ async def list_events( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def create_event( + +class AsyncRawEventsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_event_batch( self, *, - event_type: EventType, - backfill: typing.Optional[bool] = OMIT, - body: typing.Optional[EventBody] = OMIT, - idempotency_key: typing.Optional[str] = OMIT, - sent_at: typing.Optional[dt.datetime] = OMIT, - trusted_client_clock: typing.Optional[bool] = OMIT, + events: typing.Sequence[CreateEventRequestBody], request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[CreateEventResponse]: + ) -> AsyncHttpResponse[CreateEventBatchResponse]: """ Parameters ---------- - event_type : EventType - Either 'identify' or 'track' - - backfill : typing.Optional[bool] - Requires a secret API key, and trusted_client_clock. Import historical data without affecting billing. - - body : typing.Optional[EventBody] - - idempotency_key : typing.Optional[str] - Optional client-supplied key. Duplicate events with the same key (scoped to the environment) are dropped for 24h. - - sent_at : typing.Optional[dt.datetime] - Optionally provide a timestamp at which the event was sent to Schematic - - trusted_client_clock : typing.Optional[bool] - Requires a secret API key and sent_at. Use sent_at as the effective timestamp. + events : typing.Sequence[CreateEventRequestBody] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateEventResponse] + AsyncHttpResponse[CreateEventBatchResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "events", + "event-batch", method="POST", json={ - "backfill": backfill, - "body": convert_and_respect_annotation_metadata(object_=body, annotation=EventBody, direction="write"), - "event_type": event_type, - "idempotency_key": idempotency_key, - "sent_at": sent_at, - "trusted_client_clock": trusted_client_clock, + "events": convert_and_respect_annotation_metadata( + object_=events, annotation=typing.Sequence[CreateEventRequestBody], direction="write" + ), }, headers={ "content-type": "application/json", @@ -1140,9 +1063,9 @@ async def create_event( try: if 200 <= _response.status_code < 300: _data = typing.cast( - CreateEventResponse, + CreateEventBatchResponse, parse_obj_as( - type_=CreateEventResponse, # type: ignore + type_=CreateEventBatchResponse, # type: ignore object_=_response.json(), ), ) @@ -1215,38 +1138,734 @@ async def create_event( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_event( - self, event_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[GetEventResponse]: + async def get_event_summaries( + self, + *, + q: typing.Optional[str] = None, + event_subtypes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetEventSummariesResponse]: """ Parameters ---------- - event_id : str - event_id + q : typing.Optional[str] + + event_subtypes : typing.Optional[typing.Union[str, typing.Sequence[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[GetEventResponse] + AsyncHttpResponse[GetEventSummariesResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"events/{encode_path_param(event_id)}", + "event-types", method="GET", + params={ + "q": q, + "event_subtypes": event_subtypes, + "limit": limit, + "offset": offset, + }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetEventResponse, + GetEventSummariesResponse, parse_obj_as( - type_=GetEventResponse, # type: ignore + type_=GetEventSummariesResponse, # 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_events( + self, + *, + company_id: typing.Optional[str] = None, + event_subtype: typing.Optional[str] = None, + event_types: typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]] = None, + flag_id: typing.Optional[str] = None, + idempotency_key: typing.Optional[str] = None, + user_id: typing.Optional[str] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListEventsResponse]: + """ + Parameters + ---------- + company_id : typing.Optional[str] + + event_subtype : typing.Optional[str] + + event_types : typing.Optional[typing.Union[EventType, typing.Sequence[EventType]]] + + flag_id : typing.Optional[str] + + idempotency_key : typing.Optional[str] + + user_id : 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[ListEventsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "events", + method="GET", + params={ + "company_id": company_id, + "event_subtype": event_subtype, + "event_types": event_types, + "flag_id": flag_id, + "idempotency_key": idempotency_key, + "user_id": user_id, + "limit": limit, + "offset": offset, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListEventsResponse, + parse_obj_as( + type_=ListEventsResponse, # 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 create_event( + self, + *, + event_type: EventType, + backfill: typing.Optional[bool] = OMIT, + body: typing.Optional[EventBody] = OMIT, + idempotency_key: typing.Optional[str] = OMIT, + sent_at: typing.Optional[dt.datetime] = OMIT, + trusted_client_clock: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateEventResponse]: + """ + Parameters + ---------- + event_type : EventType + Either 'identify' or 'track' + + backfill : typing.Optional[bool] + Requires a secret API key, and trusted_client_clock. Import historical data without affecting billing. + + body : typing.Optional[EventBody] + + idempotency_key : typing.Optional[str] + Optional client-supplied key. Duplicate events with the same key (scoped to the environment) are dropped for 24h. + + sent_at : typing.Optional[dt.datetime] + Optionally provide a timestamp at which the event was sent to Schematic + + trusted_client_clock : typing.Optional[bool] + Requires a secret API key and sent_at. Use sent_at as the effective timestamp. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateEventResponse] + Created + """ + _response = await self._client_wrapper.httpx_client.request( + "events", + method="POST", + json={ + "backfill": backfill, + "body": convert_and_respect_annotation_metadata(object_=body, annotation=EventBody, direction="write"), + "event_type": event_type, + "idempotency_key": idempotency_key, + "sent_at": sent_at, + "trusted_client_clock": trusted_client_clock, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateEventResponse, + parse_obj_as( + type_=CreateEventResponse, # 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 get_event( + self, event_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetEventResponse]: + """ + Parameters + ---------- + event_id : str + event_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetEventResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"events/{encode_path_param(event_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetEventResponse, + parse_obj_as( + type_=GetEventResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + 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 get_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetOtlpEnvironmentSettingsResponse]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetOtlpEnvironmentSettingsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "otlp/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetOtlpEnvironmentSettingsResponse, + parse_obj_as( + type_=GetOtlpEnvironmentSettingsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + 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 upsert_otlp_environment_settings( + self, + *, + tool_events_enabled: bool, + company_attribute: typing.Optional[str] = OMIT, + company_key: typing.Optional[str] = OMIT, + user_attribute: typing.Optional[str] = OMIT, + user_key: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpsertOtlpEnvironmentSettingsResponse]: + """ + Parameters + ---------- + tool_events_enabled : bool + + company_attribute : typing.Optional[str] + + company_key : typing.Optional[str] + + user_attribute : typing.Optional[str] + + user_key : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpsertOtlpEnvironmentSettingsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "otlp/settings", + method="POST", + json={ + "company_attribute": company_attribute, + "company_key": company_key, + "tool_events_enabled": tool_events_enabled, + "user_attribute": user_attribute, + "user_key": user_key, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpsertOtlpEnvironmentSettingsResponse, + parse_obj_as( + type_=UpsertOtlpEnvironmentSettingsResponse, # 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 delete_otlp_environment_settings( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteOtlpEnvironmentSettingsResponse]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteOtlpEnvironmentSettingsResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + "otlp/settings", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteOtlpEnvironmentSettingsResponse, + parse_obj_as( + type_=DeleteOtlpEnvironmentSettingsResponse, # 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), diff --git a/src/schematic/events/types/__init__.py b/src/schematic/events/types/__init__.py index 92f9b44..6cb5c39 100644 --- a/src/schematic/events/types/__init__.py +++ b/src/schematic/events/types/__init__.py @@ -8,21 +8,27 @@ if typing.TYPE_CHECKING: from .create_event_batch_response import CreateEventBatchResponse from .create_event_response import CreateEventResponse + from .delete_otlp_environment_settings_response import DeleteOtlpEnvironmentSettingsResponse from .get_event_response import GetEventResponse from .get_event_summaries_params import GetEventSummariesParams from .get_event_summaries_response import GetEventSummariesResponse + from .get_otlp_environment_settings_response import GetOtlpEnvironmentSettingsResponse from .get_segment_integration_status_response import GetSegmentIntegrationStatusResponse from .list_events_params import ListEventsParams from .list_events_response import ListEventsResponse + from .upsert_otlp_environment_settings_response import UpsertOtlpEnvironmentSettingsResponse _dynamic_imports: typing.Dict[str, str] = { "CreateEventBatchResponse": ".create_event_batch_response", "CreateEventResponse": ".create_event_response", + "DeleteOtlpEnvironmentSettingsResponse": ".delete_otlp_environment_settings_response", "GetEventResponse": ".get_event_response", "GetEventSummariesParams": ".get_event_summaries_params", "GetEventSummariesResponse": ".get_event_summaries_response", + "GetOtlpEnvironmentSettingsResponse": ".get_otlp_environment_settings_response", "GetSegmentIntegrationStatusResponse": ".get_segment_integration_status_response", "ListEventsParams": ".list_events_params", "ListEventsResponse": ".list_events_response", + "UpsertOtlpEnvironmentSettingsResponse": ".upsert_otlp_environment_settings_response", } @@ -50,10 +56,13 @@ def __dir__(): __all__ = [ "CreateEventBatchResponse", "CreateEventResponse", + "DeleteOtlpEnvironmentSettingsResponse", "GetEventResponse", "GetEventSummariesParams", "GetEventSummariesResponse", + "GetOtlpEnvironmentSettingsResponse", "GetSegmentIntegrationStatusResponse", "ListEventsParams", "ListEventsResponse", + "UpsertOtlpEnvironmentSettingsResponse", ] diff --git a/src/schematic/events/types/delete_otlp_environment_settings_response.py b/src/schematic/events/types/delete_otlp_environment_settings_response.py new file mode 100644 index 0000000..44f57bf --- /dev/null +++ b/src/schematic/events/types/delete_otlp_environment_settings_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.delete_response import DeleteResponse + + +class DeleteOtlpEnvironmentSettingsResponse(UniversalBaseModel): + data: DeleteResponse + params: typing.Dict[str, 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/events/types/get_otlp_environment_settings_response.py b/src/schematic/events/types/get_otlp_environment_settings_response.py new file mode 100644 index 0000000..3d90543 --- /dev/null +++ b/src/schematic/events/types/get_otlp_environment_settings_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.otlp_environment_settings_response_data import OtlpEnvironmentSettingsResponseData + + +class GetOtlpEnvironmentSettingsResponse(UniversalBaseModel): + data: OtlpEnvironmentSettingsResponseData + params: typing.Dict[str, 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/events/types/upsert_otlp_environment_settings_response.py b/src/schematic/events/types/upsert_otlp_environment_settings_response.py new file mode 100644 index 0000000..6e0fd3a --- /dev/null +++ b/src/schematic/events/types/upsert_otlp_environment_settings_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.otlp_environment_settings_response_data import OtlpEnvironmentSettingsResponseData + + +class UpsertOtlpEnvironmentSettingsResponse(UniversalBaseModel): + data: OtlpEnvironmentSettingsResponseData + params: typing.Dict[str, 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/integrationsapi/__init__.py b/src/schematic/integrationsapi/__init__.py index 13f91ac..e1dd2a5 100644 --- a/src/schematic/integrationsapi/__init__.py +++ b/src/schematic/integrationsapi/__init__.py @@ -8,11 +8,16 @@ if typing.TYPE_CHECKING: from .types import ( AssumeStripeInstalledResponse, + ClaimStripeSandboxKeysResponse, GetIntegrationWebhookUrlResponse, + GetStripeSandboxClaimLinkResponse, + GetStripeSandboxKeysResponse, InstallIntegrationResponse, + InstallStripeClaimableSandboxResponse, InstallStripeResponse, ListIntegrationsParams, ListIntegrationsResponse, + ListStripeSandboxCountriesResponse, LoadSampleDataSetResponse, RunIntegrationResponse, StartDataImportResponse, @@ -20,11 +25,16 @@ ) _dynamic_imports: typing.Dict[str, str] = { "AssumeStripeInstalledResponse": ".types", + "ClaimStripeSandboxKeysResponse": ".types", "GetIntegrationWebhookUrlResponse": ".types", + "GetStripeSandboxClaimLinkResponse": ".types", + "GetStripeSandboxKeysResponse": ".types", "InstallIntegrationResponse": ".types", + "InstallStripeClaimableSandboxResponse": ".types", "InstallStripeResponse": ".types", "ListIntegrationsParams": ".types", "ListIntegrationsResponse": ".types", + "ListStripeSandboxCountriesResponse": ".types", "LoadSampleDataSetResponse": ".types", "RunIntegrationResponse": ".types", "StartDataImportResponse": ".types", @@ -55,11 +65,16 @@ def __dir__(): __all__ = [ "AssumeStripeInstalledResponse", + "ClaimStripeSandboxKeysResponse", "GetIntegrationWebhookUrlResponse", + "GetStripeSandboxClaimLinkResponse", + "GetStripeSandboxKeysResponse", "InstallIntegrationResponse", + "InstallStripeClaimableSandboxResponse", "InstallStripeResponse", "ListIntegrationsParams", "ListIntegrationsResponse", + "ListStripeSandboxCountriesResponse", "LoadSampleDataSetResponse", "RunIntegrationResponse", "StartDataImportResponse", diff --git a/src/schematic/integrationsapi/client.py b/src/schematic/integrationsapi/client.py index 872baa6..9d69ecb 100644 --- a/src/schematic/integrationsapi/client.py +++ b/src/schematic/integrationsapi/client.py @@ -9,10 +9,15 @@ from ..types.integration_type import IntegrationType from .raw_client import AsyncRawIntegrationsapiClient, RawIntegrationsapiClient from .types.assume_stripe_installed_response import AssumeStripeInstalledResponse +from .types.claim_stripe_sandbox_keys_response import ClaimStripeSandboxKeysResponse from .types.get_integration_webhook_url_response import GetIntegrationWebhookUrlResponse +from .types.get_stripe_sandbox_claim_link_response import GetStripeSandboxClaimLinkResponse +from .types.get_stripe_sandbox_keys_response import GetStripeSandboxKeysResponse from .types.install_integration_response import InstallIntegrationResponse +from .types.install_stripe_claimable_sandbox_response import InstallStripeClaimableSandboxResponse from .types.install_stripe_response import InstallStripeResponse from .types.list_integrations_response import ListIntegrationsResponse +from .types.list_stripe_sandbox_countries_response import ListStripeSandboxCountriesResponse from .types.load_sample_data_set_response import LoadSampleDataSetResponse from .types.run_integration_response import RunIntegrationResponse from .types.start_data_import_response import StartDataImportResponse @@ -293,6 +298,88 @@ def load_sample_data_set( _response = self._raw_client.load_sample_data_set(request_options=request_options) return _response.data + def get_stripe_sandbox_claim_link( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetStripeSandboxClaimLinkResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetStripeSandboxClaimLinkResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.integrationsapi.get_stripe_sandbox_claim_link() + """ + _response = self._raw_client.get_stripe_sandbox_claim_link(request_options=request_options) + return _response.data + + def get_stripe_sandbox_keys( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetStripeSandboxKeysResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetStripeSandboxKeysResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.integrationsapi.get_stripe_sandbox_keys() + """ + _response = self._raw_client.get_stripe_sandbox_keys(request_options=request_options) + return _response.data + + def claim_stripe_sandbox_keys( + self, *, token: str, request_options: typing.Optional[RequestOptions] = None + ) -> ClaimStripeSandboxKeysResponse: + """ + Parameters + ---------- + token : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ClaimStripeSandboxKeysResponse + Created + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.integrationsapi.claim_stripe_sandbox_keys( + token="token", + ) + """ + _response = self._raw_client.claim_stripe_sandbox_keys(token=token, request_options=request_options) + return _response.data + def assume_stripe_installed( self, *, @@ -405,6 +492,76 @@ def install_stripe( ) return _response.data + def install_stripe_claimable_sandbox( + self, + *, + email: str, + country: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + seed_sample_data: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> InstallStripeClaimableSandboxResponse: + """ + Parameters + ---------- + email : str + + country : typing.Optional[str] + + name : typing.Optional[str] + + seed_sample_data : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + InstallStripeClaimableSandboxResponse + Created + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.integrationsapi.install_stripe_claimable_sandbox( + email="email", + ) + """ + _response = self._raw_client.install_stripe_claimable_sandbox( + email=email, country=country, name=name, seed_sample_data=seed_sample_data, request_options=request_options + ) + return _response.data + + def list_stripe_sandbox_countries( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ListStripeSandboxCountriesResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListStripeSandboxCountriesResponse + OK + + Examples + -------- + from schematic import Schematic + + client = Schematic( + api_key="YOUR_API_KEY", + ) + client.integrationsapi.list_stripe_sandbox_countries() + """ + _response = self._raw_client.list_stripe_sandbox_countries(request_options=request_options) + return _response.data + def uninstall_integration( self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> UninstallIntegrationResponse: @@ -756,6 +913,112 @@ async def main() -> None: _response = await self._raw_client.load_sample_data_set(request_options=request_options) return _response.data + async def get_stripe_sandbox_claim_link( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetStripeSandboxClaimLinkResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetStripeSandboxClaimLinkResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.integrationsapi.get_stripe_sandbox_claim_link() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_stripe_sandbox_claim_link(request_options=request_options) + return _response.data + + async def get_stripe_sandbox_keys( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetStripeSandboxKeysResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetStripeSandboxKeysResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.integrationsapi.get_stripe_sandbox_keys() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_stripe_sandbox_keys(request_options=request_options) + return _response.data + + async def claim_stripe_sandbox_keys( + self, *, token: str, request_options: typing.Optional[RequestOptions] = None + ) -> ClaimStripeSandboxKeysResponse: + """ + Parameters + ---------- + token : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ClaimStripeSandboxKeysResponse + Created + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.integrationsapi.claim_stripe_sandbox_keys( + token="token", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.claim_stripe_sandbox_keys(token=token, request_options=request_options) + return _response.data + async def assume_stripe_installed( self, *, @@ -884,6 +1147,92 @@ async def main() -> None: ) return _response.data + async def install_stripe_claimable_sandbox( + self, + *, + email: str, + country: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + seed_sample_data: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> InstallStripeClaimableSandboxResponse: + """ + Parameters + ---------- + email : str + + country : typing.Optional[str] + + name : typing.Optional[str] + + seed_sample_data : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + InstallStripeClaimableSandboxResponse + Created + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.integrationsapi.install_stripe_claimable_sandbox( + email="email", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.install_stripe_claimable_sandbox( + email=email, country=country, name=name, seed_sample_data=seed_sample_data, request_options=request_options + ) + return _response.data + + async def list_stripe_sandbox_countries( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ListStripeSandboxCountriesResponse: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListStripeSandboxCountriesResponse + OK + + Examples + -------- + import asyncio + + from schematic import AsyncSchematic + + client = AsyncSchematic( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.integrationsapi.list_stripe_sandbox_countries() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_stripe_sandbox_countries(request_options=request_options) + return _response.data + async def uninstall_integration( self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> UninstallIntegrationResponse: diff --git a/src/schematic/integrationsapi/raw_client.py b/src/schematic/integrationsapi/raw_client.py index afd5a3f..243dbe7 100644 --- a/src/schematic/integrationsapi/raw_client.py +++ b/src/schematic/integrationsapi/raw_client.py @@ -20,10 +20,15 @@ from ..types.integration_state import IntegrationState from ..types.integration_type import IntegrationType from .types.assume_stripe_installed_response import AssumeStripeInstalledResponse +from .types.claim_stripe_sandbox_keys_response import ClaimStripeSandboxKeysResponse from .types.get_integration_webhook_url_response import GetIntegrationWebhookUrlResponse +from .types.get_stripe_sandbox_claim_link_response import GetStripeSandboxClaimLinkResponse +from .types.get_stripe_sandbox_keys_response import GetStripeSandboxKeysResponse from .types.install_integration_response import InstallIntegrationResponse +from .types.install_stripe_claimable_sandbox_response import InstallStripeClaimableSandboxResponse from .types.install_stripe_response import InstallStripeResponse from .types.list_integrations_response import ListIntegrationsResponse +from .types.list_stripe_sandbox_countries_response import ListStripeSandboxCountriesResponse from .types.load_sample_data_set_response import LoadSampleDataSetResponse from .types.run_integration_response import RunIntegrationResponse from .types.start_data_import_response import StartDataImportResponse @@ -679,67 +684,1006 @@ def load_sample_data_set( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) + def get_stripe_sandbox_claim_link( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetStripeSandboxClaimLinkResponse]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetStripeSandboxClaimLinkResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/sandbox/claim-link", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetStripeSandboxClaimLinkResponse, + parse_obj_as( + type_=GetStripeSandboxClaimLinkResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + 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 get_stripe_sandbox_keys( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetStripeSandboxKeysResponse]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetStripeSandboxKeysResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/sandbox/keys", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetStripeSandboxKeysResponse, + parse_obj_as( + type_=GetStripeSandboxKeysResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + 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 claim_stripe_sandbox_keys( + self, *, token: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ClaimStripeSandboxKeysResponse]: + """ + Parameters + ---------- + token : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ClaimStripeSandboxKeysResponse] + Created + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/sandbox/keys/claim", + method="POST", + json={ + "token": token, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ClaimStripeSandboxKeysResponse, + parse_obj_as( + type_=ClaimStripeSandboxKeysResponse, # 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 assume_stripe_installed( self, *, - type: IntegrationType, - company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, - company_matching_field: typing.Optional[str] = OMIT, - config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - is_sandbox: typing.Optional[bool] = OMIT, - live_mode: typing.Optional[bool] = OMIT, + type: IntegrationType, + company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, + company_matching_field: typing.Optional[str] = OMIT, + config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + is_sandbox: typing.Optional[bool] = OMIT, + live_mode: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AssumeStripeInstalledResponse]: + """ + Parameters + ---------- + type : IntegrationType + + company_matching_criteria : typing.Optional[CompanyMatchingCriteria] + + company_matching_field : typing.Optional[str] + + config : typing.Optional[typing.Dict[str, typing.Any]] + + is_sandbox : typing.Optional[bool] + + live_mode : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AssumeStripeInstalledResponse] + Created + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/v2/assume-installed", + method="POST", + json={ + "company_matching_criteria": company_matching_criteria, + "company_matching_field": company_matching_field, + "config": config, + "is_sandbox": is_sandbox, + "live_mode": live_mode, + "type": type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssumeStripeInstalledResponse, + parse_obj_as( + type_=AssumeStripeInstalledResponse, # 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 install_stripe( + self, + *, + type: IntegrationType, + company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, + company_matching_field: typing.Optional[str] = OMIT, + config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + is_sandbox: typing.Optional[bool] = OMIT, + live_mode: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[InstallStripeResponse]: + """ + Parameters + ---------- + type : IntegrationType + + company_matching_criteria : typing.Optional[CompanyMatchingCriteria] + + company_matching_field : typing.Optional[str] + + config : typing.Optional[typing.Dict[str, typing.Any]] + + is_sandbox : typing.Optional[bool] + + live_mode : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[InstallStripeResponse] + Created + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/v2/install", + method="POST", + json={ + "company_matching_criteria": company_matching_criteria, + "company_matching_field": company_matching_field, + "config": config, + "is_sandbox": is_sandbox, + "live_mode": live_mode, + "type": type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + InstallStripeResponse, + parse_obj_as( + type_=InstallStripeResponse, # 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 install_stripe_claimable_sandbox( + self, + *, + email: str, + country: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + seed_sample_data: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[InstallStripeClaimableSandboxResponse]: + """ + Parameters + ---------- + email : str + + country : typing.Optional[str] + + name : typing.Optional[str] + + seed_sample_data : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[InstallStripeClaimableSandboxResponse] + Created + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/v2/sandbox", + method="POST", + json={ + "country": country, + "email": email, + "name": name, + "seed_sample_data": seed_sample_data, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + InstallStripeClaimableSandboxResponse, + parse_obj_as( + type_=InstallStripeClaimableSandboxResponse, # 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_stripe_sandbox_countries( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ListStripeSandboxCountriesResponse]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListStripeSandboxCountriesResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + "integrations/stripe/v2/sandbox-countries", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListStripeSandboxCountriesResponse, + parse_obj_as( + type_=ListStripeSandboxCountriesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + 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 uninstall_integration( + self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UninstallIntegrationResponse]: + """ + Parameters + ---------- + integration_id : str + integration_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UninstallIntegrationResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"integrations/uninstall/{encode_path_param(integration_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UninstallIntegrationResponse, + parse_obj_as( + type_=UninstallIntegrationResponse, # 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 + ) + + +class AsyncRawIntegrationsapiClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def run_integration( + self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RunIntegrationResponse]: + """ + Parameters + ---------- + integration_id : str + integration_id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RunIntegrationResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"integration/start/{encode_path_param(integration_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RunIntegrationResponse, + parse_obj_as( + type_=RunIntegrationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + 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_integrations( + self, + *, + billing_only: typing.Optional[bool] = None, + exclude_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + id: typing.Optional[str] = None, + state: typing.Optional[IntegrationState] = None, + type: typing.Optional[IntegrationType] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[AssumeStripeInstalledResponse]: + ) -> AsyncHttpResponse[ListIntegrationsResponse]: """ Parameters ---------- - type : IntegrationType + billing_only : typing.Optional[bool] - company_matching_criteria : typing.Optional[CompanyMatchingCriteria] + exclude_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - company_matching_field : typing.Optional[str] + id : typing.Optional[str] - config : typing.Optional[typing.Dict[str, typing.Any]] + state : typing.Optional[IntegrationState] - is_sandbox : typing.Optional[bool] + type : typing.Optional[IntegrationType] - live_mode : typing.Optional[bool] + 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[AssumeStripeInstalledResponse] - Created + AsyncHttpResponse[ListIntegrationsResponse] + OK """ - _response = self._client_wrapper.httpx_client.request( - "integrations/stripe/v2/assume-installed", - method="POST", - json={ - "company_matching_criteria": company_matching_criteria, - "company_matching_field": company_matching_field, - "config": config, - "is_sandbox": is_sandbox, - "live_mode": live_mode, + _response = await self._client_wrapper.httpx_client.request( + "integrations", + method="GET", + params={ + "billing_only": billing_only, + "exclude_ids": exclude_ids, + "id": id, + "state": state, "type": type, - }, - headers={ - "content-type": "application/json", + "limit": limit, + "offset": offset, }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - AssumeStripeInstalledResponse, + ListIntegrationsResponse, parse_obj_as( - type_=AssumeStripeInstalledResponse, # type: ignore + type_=ListIntegrationsResponse, # type: ignore object_=_response.json(), ), ) - return HttpResponse(response=_response, data=_data) + return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -808,7 +1752,96 @@ def assume_stripe_installed( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def install_stripe( + async def get_integration_webhook_url( + self, type: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetIntegrationWebhookUrlResponse]: + """ + Parameters + ---------- + type : str + type + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetIntegrationWebhookUrlResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"integrations/{encode_path_param(type)}/webhook-url", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetIntegrationWebhookUrlResponse, + parse_obj_as( + type_=GetIntegrationWebhookUrlResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + 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 install_integration( self, *, type: IntegrationType, @@ -818,7 +1851,7 @@ def install_stripe( is_sandbox: typing.Optional[bool] = OMIT, live_mode: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[InstallStripeResponse]: + ) -> AsyncHttpResponse[InstallIntegrationResponse]: """ Parameters ---------- @@ -839,11 +1872,11 @@ def install_stripe( Returns ------- - HttpResponse[InstallStripeResponse] + AsyncHttpResponse[InstallIntegrationResponse] Created """ - _response = self._client_wrapper.httpx_client.request( - "integrations/stripe/v2/install", + _response = await self._client_wrapper.httpx_client.request( + "integrations/install", method="POST", json={ "company_matching_criteria": company_matching_criteria, @@ -862,13 +1895,13 @@ def install_stripe( try: if 200 <= _response.status_code < 300: _data = typing.cast( - InstallStripeResponse, + InstallIntegrationResponse, parse_obj_as( - type_=InstallStripeResponse, # type: ignore + type_=InstallIntegrationResponse, # type: ignore object_=_response.json(), ), ) - return HttpResponse(response=_response, data=_data) + return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -937,38 +1970,55 @@ def install_stripe( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def uninstall_integration( - self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> HttpResponse[UninstallIntegrationResponse]: + async def start_data_import( + self, + *, + integration_id: str, + company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, + company_matching_field: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[StartDataImportResponse]: """ Parameters ---------- integration_id : str - integration_id + + company_matching_criteria : typing.Optional[CompanyMatchingCriteria] + + company_matching_field : typing.Optional[str] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[UninstallIntegrationResponse] - OK + AsyncHttpResponse[StartDataImportResponse] + Created """ - _response = self._client_wrapper.httpx_client.request( - f"integrations/uninstall/{encode_path_param(integration_id)}", - method="DELETE", + _response = await self._client_wrapper.httpx_client.request( + "integrations/start-data-import", + method="POST", + json={ + "company_matching_criteria": company_matching_criteria, + "company_matching_field": company_matching_field, + "integration_id": integration_id, + }, + headers={ + "content-type": "application/json", + }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - UninstallIntegrationResponse, + StartDataImportResponse, parse_obj_as( - type_=UninstallIntegrationResponse, # type: ignore + type_=StartDataImportResponse, # type: ignore object_=_response.json(), ), ) - return HttpResponse(response=_response, data=_data) + return AsyncHttpResponse(response=_response, data=_data) if _response.status_code == 400: raise BadRequestError( headers=dict(_response.headers), @@ -1037,39 +2087,31 @@ def uninstall_integration( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - -class AsyncRawIntegrationsapiClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def run_integration( - self, integration_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[RunIntegrationResponse]: + async def load_sample_data_set( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[LoadSampleDataSetResponse]: """ Parameters ---------- - integration_id : str - integration_id - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[RunIntegrationResponse] + AsyncHttpResponse[LoadSampleDataSetResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"integration/start/{encode_path_param(integration_id)}", + "integrations/stripe/dataset-sample-v2", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - RunIntegrationResponse, + LoadSampleDataSetResponse, parse_obj_as( - type_=RunIntegrationResponse, # type: ignore + type_=LoadSampleDataSetResponse, # type: ignore object_=_response.json(), ), ) @@ -1131,80 +2173,35 @@ async def run_integration( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def list_integrations( - self, - *, - billing_only: typing.Optional[bool] = None, - exclude_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - id: typing.Optional[str] = None, - state: typing.Optional[IntegrationState] = None, - type: typing.Optional[IntegrationType] = None, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[ListIntegrationsResponse]: + async def get_stripe_sandbox_claim_link( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetStripeSandboxClaimLinkResponse]: """ Parameters ---------- - billing_only : typing.Optional[bool] - - exclude_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - - id : typing.Optional[str] - - state : typing.Optional[IntegrationState] - - type : typing.Optional[IntegrationType] - - 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[ListIntegrationsResponse] + AsyncHttpResponse[GetStripeSandboxClaimLinkResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - "integrations", + "integrations/stripe/sandbox/claim-link", method="GET", - params={ - "billing_only": billing_only, - "exclude_ids": exclude_ids, - "id": id, - "state": state, - "type": type, - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - ListIntegrationsResponse, + GetStripeSandboxClaimLinkResponse, parse_obj_as( - type_=ListIntegrationsResponse, # type: ignore + type_=GetStripeSandboxClaimLinkResponse, # 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), @@ -1262,34 +2259,31 @@ async def list_integrations( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_integration_webhook_url( - self, type: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[GetIntegrationWebhookUrlResponse]: + async def get_stripe_sandbox_keys( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetStripeSandboxKeysResponse]: """ Parameters ---------- - type : str - type - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[GetIntegrationWebhookUrlResponse] + AsyncHttpResponse[GetStripeSandboxKeysResponse] OK """ _response = await self._client_wrapper.httpx_client.request( - f"integrations/{encode_path_param(type)}/webhook-url", + "integrations/stripe/sandbox/keys", method="GET", request_options=request_options, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - GetIntegrationWebhookUrlResponse, + GetStripeSandboxKeysResponse, parse_obj_as( - type_=GetIntegrationWebhookUrlResponse, # type: ignore + type_=GetStripeSandboxKeysResponse, # type: ignore object_=_response.json(), ), ) @@ -1351,50 +2345,27 @@ async def get_integration_webhook_url( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def install_integration( - self, - *, - type: IntegrationType, - company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, - company_matching_field: typing.Optional[str] = OMIT, - config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - is_sandbox: typing.Optional[bool] = OMIT, - live_mode: typing.Optional[bool] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[InstallIntegrationResponse]: + async def claim_stripe_sandbox_keys( + self, *, token: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ClaimStripeSandboxKeysResponse]: """ Parameters ---------- - type : IntegrationType - - company_matching_criteria : typing.Optional[CompanyMatchingCriteria] - - company_matching_field : typing.Optional[str] - - config : typing.Optional[typing.Dict[str, typing.Any]] - - is_sandbox : typing.Optional[bool] - - live_mode : typing.Optional[bool] + token : str request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[InstallIntegrationResponse] + AsyncHttpResponse[ClaimStripeSandboxKeysResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "integrations/install", + "integrations/stripe/sandbox/keys/claim", method="POST", json={ - "company_matching_criteria": company_matching_criteria, - "company_matching_field": company_matching_field, - "config": config, - "is_sandbox": is_sandbox, - "live_mode": live_mode, - "type": type, + "token": token, }, headers={ "content-type": "application/json", @@ -1405,9 +2376,9 @@ async def install_integration( try: if 200 <= _response.status_code < 300: _data = typing.cast( - InstallIntegrationResponse, + ClaimStripeSandboxKeysResponse, parse_obj_as( - type_=InstallIntegrationResponse, # type: ignore + type_=ClaimStripeSandboxKeysResponse, # type: ignore object_=_response.json(), ), ) @@ -1480,38 +2451,50 @@ async def install_integration( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def start_data_import( + async def assume_stripe_installed( self, *, - integration_id: str, + type: IntegrationType, company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, company_matching_field: typing.Optional[str] = OMIT, + config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + is_sandbox: typing.Optional[bool] = OMIT, + live_mode: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[StartDataImportResponse]: + ) -> AsyncHttpResponse[AssumeStripeInstalledResponse]: """ Parameters ---------- - integration_id : str + type : IntegrationType company_matching_criteria : typing.Optional[CompanyMatchingCriteria] company_matching_field : typing.Optional[str] + config : typing.Optional[typing.Dict[str, typing.Any]] + + is_sandbox : typing.Optional[bool] + + live_mode : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[StartDataImportResponse] + AsyncHttpResponse[AssumeStripeInstalledResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "integrations/start-data-import", + "integrations/stripe/v2/assume-installed", method="POST", json={ "company_matching_criteria": company_matching_criteria, "company_matching_field": company_matching_field, - "integration_id": integration_id, + "config": config, + "is_sandbox": is_sandbox, + "live_mode": live_mode, + "type": type, }, headers={ "content-type": "application/json", @@ -1522,9 +2505,9 @@ async def start_data_import( try: if 200 <= _response.status_code < 300: _data = typing.cast( - StartDataImportResponse, + AssumeStripeInstalledResponse, parse_obj_as( - type_=StartDataImportResponse, # type: ignore + type_=AssumeStripeInstalledResponse, # type: ignore object_=_response.json(), ), ) @@ -1597,35 +2580,78 @@ async def start_data_import( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def load_sample_data_set( - self, *, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[LoadSampleDataSetResponse]: + async def install_stripe( + self, + *, + type: IntegrationType, + company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, + company_matching_field: typing.Optional[str] = OMIT, + config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + is_sandbox: typing.Optional[bool] = OMIT, + live_mode: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[InstallStripeResponse]: """ Parameters ---------- + type : IntegrationType + + company_matching_criteria : typing.Optional[CompanyMatchingCriteria] + + company_matching_field : typing.Optional[str] + + config : typing.Optional[typing.Dict[str, typing.Any]] + + is_sandbox : typing.Optional[bool] + + live_mode : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[LoadSampleDataSetResponse] - OK + AsyncHttpResponse[InstallStripeResponse] + Created """ _response = await self._client_wrapper.httpx_client.request( - "integrations/stripe/dataset-sample-v2", - method="GET", + "integrations/stripe/v2/install", + method="POST", + json={ + "company_matching_criteria": company_matching_criteria, + "company_matching_field": company_matching_field, + "config": config, + "is_sandbox": is_sandbox, + "live_mode": live_mode, + "type": type, + }, + headers={ + "content-type": "application/json", + }, request_options=request_options, + omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - LoadSampleDataSetResponse, + InstallStripeResponse, parse_obj_as( - type_=LoadSampleDataSetResponse, # type: ignore + type_=InstallStripeResponse, # 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), @@ -1683,50 +2709,42 @@ async def load_sample_data_set( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def assume_stripe_installed( + async def install_stripe_claimable_sandbox( self, *, - type: IntegrationType, - company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, - company_matching_field: typing.Optional[str] = OMIT, - config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - is_sandbox: typing.Optional[bool] = OMIT, - live_mode: typing.Optional[bool] = OMIT, + email: str, + country: typing.Optional[str] = OMIT, + name: typing.Optional[str] = OMIT, + seed_sample_data: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[AssumeStripeInstalledResponse]: + ) -> AsyncHttpResponse[InstallStripeClaimableSandboxResponse]: """ Parameters ---------- - type : IntegrationType + email : str - company_matching_criteria : typing.Optional[CompanyMatchingCriteria] - - company_matching_field : typing.Optional[str] - - config : typing.Optional[typing.Dict[str, typing.Any]] + country : typing.Optional[str] - is_sandbox : typing.Optional[bool] + name : typing.Optional[str] - live_mode : typing.Optional[bool] + seed_sample_data : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[AssumeStripeInstalledResponse] + AsyncHttpResponse[InstallStripeClaimableSandboxResponse] Created """ _response = await self._client_wrapper.httpx_client.request( - "integrations/stripe/v2/assume-installed", + "integrations/stripe/v2/sandbox", method="POST", json={ - "company_matching_criteria": company_matching_criteria, - "company_matching_field": company_matching_field, - "config": config, - "is_sandbox": is_sandbox, - "live_mode": live_mode, - "type": type, + "country": country, + "email": email, + "name": name, + "seed_sample_data": seed_sample_data, }, headers={ "content-type": "application/json", @@ -1737,9 +2755,9 @@ async def assume_stripe_installed( try: if 200 <= _response.status_code < 300: _data = typing.cast( - AssumeStripeInstalledResponse, + InstallStripeClaimableSandboxResponse, parse_obj_as( - type_=AssumeStripeInstalledResponse, # type: ignore + type_=InstallStripeClaimableSandboxResponse, # type: ignore object_=_response.json(), ), ) @@ -1812,78 +2830,35 @@ async def assume_stripe_installed( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def install_stripe( - self, - *, - type: IntegrationType, - company_matching_criteria: typing.Optional[CompanyMatchingCriteria] = OMIT, - company_matching_field: typing.Optional[str] = OMIT, - config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, - is_sandbox: typing.Optional[bool] = OMIT, - live_mode: typing.Optional[bool] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[InstallStripeResponse]: + async def list_stripe_sandbox_countries( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ListStripeSandboxCountriesResponse]: """ Parameters ---------- - type : IntegrationType - - company_matching_criteria : typing.Optional[CompanyMatchingCriteria] - - company_matching_field : typing.Optional[str] - - config : typing.Optional[typing.Dict[str, typing.Any]] - - is_sandbox : typing.Optional[bool] - - live_mode : typing.Optional[bool] - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[InstallStripeResponse] - Created + AsyncHttpResponse[ListStripeSandboxCountriesResponse] + OK """ _response = await self._client_wrapper.httpx_client.request( - "integrations/stripe/v2/install", - method="POST", - json={ - "company_matching_criteria": company_matching_criteria, - "company_matching_field": company_matching_field, - "config": config, - "is_sandbox": is_sandbox, - "live_mode": live_mode, - "type": type, - }, - headers={ - "content-type": "application/json", - }, + "integrations/stripe/v2/sandbox-countries", + method="GET", request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: _data = typing.cast( - InstallStripeResponse, + ListStripeSandboxCountriesResponse, parse_obj_as( - type_=InstallStripeResponse, # type: ignore + type_=ListStripeSandboxCountriesResponse, # 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), diff --git a/src/schematic/integrationsapi/types/__init__.py b/src/schematic/integrationsapi/types/__init__.py index 6719438..1600161 100644 --- a/src/schematic/integrationsapi/types/__init__.py +++ b/src/schematic/integrationsapi/types/__init__.py @@ -7,22 +7,32 @@ if typing.TYPE_CHECKING: from .assume_stripe_installed_response import AssumeStripeInstalledResponse + from .claim_stripe_sandbox_keys_response import ClaimStripeSandboxKeysResponse from .get_integration_webhook_url_response import GetIntegrationWebhookUrlResponse + from .get_stripe_sandbox_claim_link_response import GetStripeSandboxClaimLinkResponse + from .get_stripe_sandbox_keys_response import GetStripeSandboxKeysResponse from .install_integration_response import InstallIntegrationResponse + from .install_stripe_claimable_sandbox_response import InstallStripeClaimableSandboxResponse from .install_stripe_response import InstallStripeResponse from .list_integrations_params import ListIntegrationsParams from .list_integrations_response import ListIntegrationsResponse + from .list_stripe_sandbox_countries_response import ListStripeSandboxCountriesResponse from .load_sample_data_set_response import LoadSampleDataSetResponse from .run_integration_response import RunIntegrationResponse from .start_data_import_response import StartDataImportResponse from .uninstall_integration_response import UninstallIntegrationResponse _dynamic_imports: typing.Dict[str, str] = { "AssumeStripeInstalledResponse": ".assume_stripe_installed_response", + "ClaimStripeSandboxKeysResponse": ".claim_stripe_sandbox_keys_response", "GetIntegrationWebhookUrlResponse": ".get_integration_webhook_url_response", + "GetStripeSandboxClaimLinkResponse": ".get_stripe_sandbox_claim_link_response", + "GetStripeSandboxKeysResponse": ".get_stripe_sandbox_keys_response", "InstallIntegrationResponse": ".install_integration_response", + "InstallStripeClaimableSandboxResponse": ".install_stripe_claimable_sandbox_response", "InstallStripeResponse": ".install_stripe_response", "ListIntegrationsParams": ".list_integrations_params", "ListIntegrationsResponse": ".list_integrations_response", + "ListStripeSandboxCountriesResponse": ".list_stripe_sandbox_countries_response", "LoadSampleDataSetResponse": ".load_sample_data_set_response", "RunIntegrationResponse": ".run_integration_response", "StartDataImportResponse": ".start_data_import_response", @@ -53,11 +63,16 @@ def __dir__(): __all__ = [ "AssumeStripeInstalledResponse", + "ClaimStripeSandboxKeysResponse", "GetIntegrationWebhookUrlResponse", + "GetStripeSandboxClaimLinkResponse", + "GetStripeSandboxKeysResponse", "InstallIntegrationResponse", + "InstallStripeClaimableSandboxResponse", "InstallStripeResponse", "ListIntegrationsParams", "ListIntegrationsResponse", + "ListStripeSandboxCountriesResponse", "LoadSampleDataSetResponse", "RunIntegrationResponse", "StartDataImportResponse", diff --git a/src/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.py b/src/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.py new file mode 100644 index 0000000..5e2804d --- /dev/null +++ b/src/schematic/integrationsapi/types/claim_stripe_sandbox_keys_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.claimed_stripe_sandbox_keys_response_data import ClaimedStripeSandboxKeysResponseData + + +class ClaimStripeSandboxKeysResponse(UniversalBaseModel): + data: ClaimedStripeSandboxKeysResponseData + params: typing.Dict[str, 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/integrationsapi/types/get_stripe_sandbox_claim_link_response.py b/src/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.py new file mode 100644 index 0000000..67a08bd --- /dev/null +++ b/src/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_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.stripe_sandbox_claim_link import StripeSandboxClaimLink + + +class GetStripeSandboxClaimLinkResponse(UniversalBaseModel): + data: StripeSandboxClaimLink + params: typing.Dict[str, 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/integrationsapi/types/get_stripe_sandbox_keys_response.py b/src/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.py new file mode 100644 index 0000000..b9e7cc2 --- /dev/null +++ b/src/schematic/integrationsapi/types/get_stripe_sandbox_keys_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.claimed_stripe_sandbox_keys_response_data import ClaimedStripeSandboxKeysResponseData + + +class GetStripeSandboxKeysResponse(UniversalBaseModel): + data: ClaimedStripeSandboxKeysResponseData + params: typing.Dict[str, 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/integrationsapi/types/install_stripe_claimable_sandbox_response.py b/src/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.py new file mode 100644 index 0000000..2bd1ddd --- /dev/null +++ b/src/schematic/integrationsapi/types/install_stripe_claimable_sandbox_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.stripe_sandbox_install_response_data import StripeSandboxInstallResponseData + + +class InstallStripeClaimableSandboxResponse(UniversalBaseModel): + data: StripeSandboxInstallResponseData + params: typing.Dict[str, 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/integrationsapi/types/list_stripe_sandbox_countries_response.py b/src/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.py new file mode 100644 index 0000000..7957e92 --- /dev/null +++ b/src/schematic/integrationsapi/types/list_stripe_sandbox_countries_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.stripe_sandbox_countries_response_data import StripeSandboxCountriesResponseData + + +class ListStripeSandboxCountriesResponse(UniversalBaseModel): + data: StripeSandboxCountriesResponseData + params: typing.Dict[str, 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 fffc03f..b092c98 100644 --- a/src/schematic/types/__init__.py +++ b/src/schematic/types/__init__.py @@ -97,6 +97,7 @@ from .checkout_field_with_value import CheckoutFieldWithValue from .checkout_settings_response_data import CheckoutSettingsResponseData from .checkout_subscription import CheckoutSubscription + from .claimed_stripe_sandbox_keys_response_data import ClaimedStripeSandboxKeysResponseData from .clerk_integration_config import ClerkIntegrationConfig from .company_billing_address_view import CompanyBillingAddressView from .company_billing_checkout_settings import CompanyBillingCheckoutSettings @@ -104,6 +105,7 @@ from .company_billing_details_view import CompanyBillingDetailsView from .company_billing_entity_response_data import CompanyBillingEntityResponseData from .company_billing_entity_subscription_response_data import CompanyBillingEntitySubscriptionResponseData + from .company_billing_profile_response_data import CompanyBillingProfileResponseData from .company_credit_balance import CompanyCreditBalance from .company_credit_balance_response_data import CompanyCreditBalanceResponseData from .company_detail_response_data import CompanyDetailResponseData @@ -177,6 +179,8 @@ from .credit_grant_expiry_request_body import CreditGrantExpiryRequestBody from .credit_grant_sort_order import CreditGrantSortOrder from .credit_lease_response_data import CreditLeaseResponseData + from .credit_spend_policy_response_data import CreditSpendPolicyResponseData + from .credit_spend_policy_scope import CreditSpendPolicyScope from .credit_transfer_response_data import CreditTransferResponseData from .credit_transfer_view import CreditTransferView from .credit_trigger_config import CreditTriggerConfig @@ -317,6 +321,7 @@ from .onboarding_track import OnboardingTrack from .orb_integration_config import OrbIntegrationConfig from .ordered_plans_in_group import OrderedPlansInGroup + from .otlp_environment_settings_response_data import OtlpEnvironmentSettingsResponseData from .payment_method_request_body import PaymentMethodRequestBody from .payment_method_response_data import PaymentMethodResponseData from .pending_migration_response_data import PendingMigrationResponseData @@ -381,6 +386,7 @@ from .rule_condition_detail_response_data import RuleConditionDetailResponseData from .rule_condition_group_detail_response_data import RuleConditionGroupDetailResponseData from .rule_condition_group_response_data import RuleConditionGroupResponseData + from .rule_condition_plan_version_response_data import RuleConditionPlanVersionResponseData from .rule_condition_response_data import RuleConditionResponseData from .rule_detail_response_data import RuleDetailResponseData from .rule_response_data import RuleResponseData @@ -418,6 +424,10 @@ from .sort_direction import SortDirection from .stripe_embed_info import StripeEmbedInfo from .stripe_integration_config import StripeIntegrationConfig + from .stripe_sandbox_claim_link import StripeSandboxClaimLink + from .stripe_sandbox_countries_response_data import StripeSandboxCountriesResponseData + from .stripe_sandbox_install_response_data import StripeSandboxInstallResponseData + from .stripe_sandbox_keys_response_data import StripeSandboxKeysResponseData from .subscription_status import SubscriptionStatus from .subscription_trait_update import SubscriptionTraitUpdate from .subscription_type import SubscriptionType @@ -565,6 +575,7 @@ "CheckoutFieldWithValue": ".checkout_field_with_value", "CheckoutSettingsResponseData": ".checkout_settings_response_data", "CheckoutSubscription": ".checkout_subscription", + "ClaimedStripeSandboxKeysResponseData": ".claimed_stripe_sandbox_keys_response_data", "ClerkIntegrationConfig": ".clerk_integration_config", "CompanyBillingAddressView": ".company_billing_address_view", "CompanyBillingCheckoutSettings": ".company_billing_checkout_settings", @@ -572,6 +583,7 @@ "CompanyBillingDetailsView": ".company_billing_details_view", "CompanyBillingEntityResponseData": ".company_billing_entity_response_data", "CompanyBillingEntitySubscriptionResponseData": ".company_billing_entity_subscription_response_data", + "CompanyBillingProfileResponseData": ".company_billing_profile_response_data", "CompanyCreditBalance": ".company_credit_balance", "CompanyCreditBalanceResponseData": ".company_credit_balance_response_data", "CompanyDetailResponseData": ".company_detail_response_data", @@ -641,6 +653,8 @@ "CreditGrantExpiryRequestBody": ".credit_grant_expiry_request_body", "CreditGrantSortOrder": ".credit_grant_sort_order", "CreditLeaseResponseData": ".credit_lease_response_data", + "CreditSpendPolicyResponseData": ".credit_spend_policy_response_data", + "CreditSpendPolicyScope": ".credit_spend_policy_scope", "CreditTransferResponseData": ".credit_transfer_response_data", "CreditTransferView": ".credit_transfer_view", "CreditTriggerConfig": ".credit_trigger_config", @@ -777,6 +791,7 @@ "OnboardingTrack": ".onboarding_track", "OrbIntegrationConfig": ".orb_integration_config", "OrderedPlansInGroup": ".ordered_plans_in_group", + "OtlpEnvironmentSettingsResponseData": ".otlp_environment_settings_response_data", "PaymentMethodRequestBody": ".payment_method_request_body", "PaymentMethodResponseData": ".payment_method_response_data", "PendingMigrationResponseData": ".pending_migration_response_data", @@ -841,6 +856,7 @@ "RuleConditionDetailResponseData": ".rule_condition_detail_response_data", "RuleConditionGroupDetailResponseData": ".rule_condition_group_detail_response_data", "RuleConditionGroupResponseData": ".rule_condition_group_response_data", + "RuleConditionPlanVersionResponseData": ".rule_condition_plan_version_response_data", "RuleConditionResponseData": ".rule_condition_response_data", "RuleDetailResponseData": ".rule_detail_response_data", "RuleResponseData": ".rule_response_data", @@ -878,6 +894,10 @@ "SortDirection": ".sort_direction", "StripeEmbedInfo": ".stripe_embed_info", "StripeIntegrationConfig": ".stripe_integration_config", + "StripeSandboxClaimLink": ".stripe_sandbox_claim_link", + "StripeSandboxCountriesResponseData": ".stripe_sandbox_countries_response_data", + "StripeSandboxInstallResponseData": ".stripe_sandbox_install_response_data", + "StripeSandboxKeysResponseData": ".stripe_sandbox_keys_response_data", "SubscriptionStatus": ".subscription_status", "SubscriptionTraitUpdate": ".subscription_trait_update", "SubscriptionType": ".subscription_type", @@ -1049,6 +1069,7 @@ def __dir__(): "CheckoutFieldWithValue", "CheckoutSettingsResponseData", "CheckoutSubscription", + "ClaimedStripeSandboxKeysResponseData", "ClerkIntegrationConfig", "CompanyBillingAddressView", "CompanyBillingCheckoutSettings", @@ -1056,6 +1077,7 @@ def __dir__(): "CompanyBillingDetailsView", "CompanyBillingEntityResponseData", "CompanyBillingEntitySubscriptionResponseData", + "CompanyBillingProfileResponseData", "CompanyCreditBalance", "CompanyCreditBalanceResponseData", "CompanyDetailResponseData", @@ -1125,6 +1147,8 @@ def __dir__(): "CreditGrantExpiryRequestBody", "CreditGrantSortOrder", "CreditLeaseResponseData", + "CreditSpendPolicyResponseData", + "CreditSpendPolicyScope", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", @@ -1261,6 +1285,7 @@ def __dir__(): "OnboardingTrack", "OrbIntegrationConfig", "OrderedPlansInGroup", + "OtlpEnvironmentSettingsResponseData", "PaymentMethodRequestBody", "PaymentMethodResponseData", "PendingMigrationResponseData", @@ -1325,6 +1350,7 @@ def __dir__(): "RuleConditionDetailResponseData", "RuleConditionGroupDetailResponseData", "RuleConditionGroupResponseData", + "RuleConditionPlanVersionResponseData", "RuleConditionResponseData", "RuleDetailResponseData", "RuleResponseData", @@ -1362,6 +1388,10 @@ def __dir__(): "SortDirection", "StripeEmbedInfo", "StripeIntegrationConfig", + "StripeSandboxClaimLink", + "StripeSandboxCountriesResponseData", + "StripeSandboxInstallResponseData", + "StripeSandboxKeysResponseData", "SubscriptionStatus", "SubscriptionTraitUpdate", "SubscriptionType", diff --git a/src/schematic/types/claimed_stripe_sandbox_keys_response_data.py b/src/schematic/types/claimed_stripe_sandbox_keys_response_data.py new file mode 100644 index 0000000..fed7b20 --- /dev/null +++ b/src/schematic/types/claimed_stripe_sandbox_keys_response_data.py @@ -0,0 +1,21 @@ +# 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 ClaimedStripeSandboxKeysResponseData(UniversalBaseModel): + publishable: str + sandbox_id: str + secret: str + + 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/company_billing_profile_response_data.py b/src/schematic/types/company_billing_profile_response_data.py new file mode 100644 index 0000000..9fb811b --- /dev/null +++ b/src/schematic/types/company_billing_profile_response_data.py @@ -0,0 +1,36 @@ +# 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_collection_method import BillingCollectionMethod +from .billing_provider_type import BillingProviderType +from .proration_behavior import ProrationBehavior + + +class CompanyBillingProfileResponseData(UniversalBaseModel): + account_id: str + billing_customer_id: typing.Optional[str] = None + collection_method: BillingCollectionMethod + company_id: str + created_at: dt.datetime + days_until_due: typing.Optional[int] = None + environment_id: str + id: str + is_default: bool + name: typing.Optional[str] = None + payment_method_id: typing.Optional[str] = None + proration_behavior: typing.Optional[ProrationBehavior] = None + provider_type: BillingProviderType + updated_at: dt.datetime + + 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/company_detail_response_data.py b/src/schematic/types/company_detail_response_data.py index e9c0dd2..02a3d94 100644 --- a/src/schematic/types/company_detail_response_data.py +++ b/src/schematic/types/company_detail_response_data.py @@ -6,6 +6,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_subscription_view import BillingSubscriptionView +from .company_billing_profile_response_data import CompanyBillingProfileResponseData from .company_event_period_metrics_response_data import CompanyEventPeriodMetricsResponseData from .company_plan_with_billing_sub_view import CompanyPlanWithBillingSubView from .custom_plan_billing_response_data import CustomPlanBillingResponseData @@ -22,6 +23,8 @@ class CompanyDetailResponseData(UniversalBaseModel): add_ons: typing.List[CompanyPlanWithBillingSubView] billing_credit_balances: typing.Optional[typing.Dict[str, float]] = None + billing_profile: typing.Optional[CompanyBillingProfileResponseData] = None + billing_profiles: typing.Optional[typing.List[CompanyBillingProfileResponseData]] = None billing_subscription: typing.Optional[BillingSubscriptionView] = None billing_subscriptions: typing.List[BillingSubscriptionView] created_at: dt.datetime diff --git a/src/schematic/types/company_override_response_data.py b/src/schematic/types/company_override_response_data.py index 47ff366..17c4b73 100644 --- a/src/schematic/types/company_override_response_data.py +++ b/src/schematic/types/company_override_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_credit_response_data import BillingCreditResponseData from .company_detail_response_data import CompanyDetailResponseData from .company_override_note_response_data import CompanyOverrideNoteResponseData from .entitlement_value_type import EntitlementValueType @@ -31,6 +32,8 @@ class CompanyOverrideResponseData(UniversalBaseModel): rule_id_usage_exceeded: typing.Optional[str] = None updated_at: dt.datetime value_bool: typing.Optional[bool] = None + value_credit: typing.Optional[BillingCreditResponseData] = None + value_credit_id: typing.Optional[str] = None value_numeric: typing.Optional[int] = None value_trait: typing.Optional[EntityTraitDefinitionResponseData] = None value_trait_id: typing.Optional[str] = None diff --git a/src/schematic/types/credit_spend_policy_response_data.py b/src/schematic/types/credit_spend_policy_response_data.py new file mode 100644 index 0000000..4a2e6d7 --- /dev/null +++ b/src/schematic/types/credit_spend_policy_response_data.py @@ -0,0 +1,29 @@ +# 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 .credit_spend_policy_scope import CreditSpendPolicyScope + + +class CreditSpendPolicyResponseData(UniversalBaseModel): + billing_credit_id: str + company_id: typing.Optional[str] = None + created_at: dt.datetime + id: str + label: typing.Optional[str] = None + max_per_draw: typing.Optional[float] = None + scope_type: CreditSpendPolicyScope + updated_at: dt.datetime + user_id: 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/types/credit_spend_policy_scope.py b/src/schematic/types/credit_spend_policy_scope.py new file mode 100644 index 0000000..a804ec1 --- /dev/null +++ b/src/schematic/types/credit_spend_policy_scope.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditSpendPolicyScope = typing.Union[typing.Literal["company", "user", "group"], typing.Any] diff --git a/src/schematic/types/event_body_inference.py b/src/schematic/types/event_body_inference.py index 124518c..5882069 100644 --- a/src/schematic/types/event_body_inference.py +++ b/src/schematic/types/event_body_inference.py @@ -7,9 +7,14 @@ class EventBodyInference(UniversalBaseModel): + cache_creation_input_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of input tokens written to a prompt cache; a subset of input_tokens + """ + cached_input_tokens: typing.Optional[int] = pydantic.Field(default=None) """ - Number of input tokens served from cache + Number of input tokens served from cache; a subset of input_tokens """ company: typing.Dict[str, str] = pydantic.Field() @@ -34,7 +39,7 @@ class EventBodyInference(UniversalBaseModel): input_tokens: int = pydantic.Field() """ - Number of input tokens for the inference request + Total number of input tokens for the inference request, including those served from and written to a prompt cache """ operation: typing.Optional[str] = pydantic.Field(default=None) diff --git a/src/schematic/types/get_onboarding_state_resp.py b/src/schematic/types/get_onboarding_state_resp.py index 48f0bd2..88d829f 100644 --- a/src/schematic/types/get_onboarding_state_resp.py +++ b/src/schematic/types/get_onboarding_state_resp.py @@ -15,6 +15,7 @@ class GetOnboardingStateResp(UniversalBaseModel): agent_connected_at: typing.Optional[dt.datetime] = None + country: typing.Optional[str] = None dismissed_at: typing.Optional[dt.datetime] = None environment_id: typing.Optional[str] = None milestones: typing.List[OnboardingMilestoneView] diff --git a/src/schematic/types/integration_config.py b/src/schematic/types/integration_config.py index 9efe950..f96c424 100644 --- a/src/schematic/types/integration_config.py +++ b/src/schematic/types/integration_config.py @@ -2,6 +2,7 @@ from __future__ import annotations +import datetime as dt import typing import pydantic @@ -56,6 +57,9 @@ class IntegrationConfig_Stripe(UniversalBaseModel): type: typing.Literal["stripe"] = "stripe" account_id: typing.Optional[str] = None account_name: typing.Optional[str] = None + claimable_sandbox_expires_at: typing.Optional[dt.datetime] = None + claimable_sandbox_id: typing.Optional[str] = None + claimable_sandbox_status: typing.Optional[str] = None company_update_only: typing.Optional[bool] = None is_sandbox: bool live_mode: bool diff --git a/src/schematic/types/otlp_environment_settings_response_data.py b/src/schematic/types/otlp_environment_settings_response_data.py new file mode 100644 index 0000000..a785c60 --- /dev/null +++ b/src/schematic/types/otlp_environment_settings_response_data.py @@ -0,0 +1,27 @@ +# 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 + + +class OtlpEnvironmentSettingsResponseData(UniversalBaseModel): + company_attribute: typing.Optional[str] = None + company_key: typing.Optional[str] = None + created_at: dt.datetime + environment_id: str + tool_events_enabled: bool + updated_at: dt.datetime + user_attribute: typing.Optional[str] = None + user_key: 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/types/rule_condition_detail_response_data.py b/src/schematic/types/rule_condition_detail_response_data.py index 4d64cae..545b53d 100644 --- a/src/schematic/types/rule_condition_detail_response_data.py +++ b/src/schematic/types/rule_condition_detail_response_data.py @@ -12,6 +12,7 @@ from .metric_period import MetricPeriod from .metric_period_month_reset import MetricPeriodMonthReset from .preview_object_response_data import PreviewObjectResponseData +from .rule_condition_plan_version_response_data import RuleConditionPlanVersionResponseData class RuleConditionDetailResponseData(UniversalBaseModel): @@ -28,6 +29,7 @@ class RuleConditionDetailResponseData(UniversalBaseModel): metric_period_month_reset: typing.Optional[MetricPeriodMonthReset] = None metric_value: typing.Optional[int] = None operator: ComparableOperator + plan_versions: typing.Optional[typing.List[RuleConditionPlanVersionResponseData]] = None resource_ids: typing.List[str] resources: typing.List[PreviewObjectResponseData] rule_id: str diff --git a/src/schematic/types/rule_condition_plan_version_response_data.py b/src/schematic/types/rule_condition_plan_version_response_data.py new file mode 100644 index 0000000..adae298 --- /dev/null +++ b/src/schematic/types/rule_condition_plan_version_response_data.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 +from .plan_version_status import PlanVersionStatus + + +class RuleConditionPlanVersionResponseData(UniversalBaseModel): + id: str + name: str + status: PlanVersionStatus + version: 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/stripe_integration_config.py b/src/schematic/types/stripe_integration_config.py index 2c19740..957d54f 100644 --- a/src/schematic/types/stripe_integration_config.py +++ b/src/schematic/types/stripe_integration_config.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +import datetime as dt import typing import pydantic @@ -17,6 +18,21 @@ class StripeIntegrationConfig(UniversalBaseModel): Display name of the connected Stripe account """ + claimable_sandbox_expires_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + When Stripe deletes the sandbox if nobody claims it, 60 days from creation; absent on sandboxes created before it was recorded + """ + + claimable_sandbox_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Stripe claimable sandbox this connection was provisioned from; absent for an OAuth connect + """ + + claimable_sandbox_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Stripe's claim status for the sandbox: unclaimed, claimed, or live + """ + company_update_only: typing.Optional[bool] = pydantic.Field(default=None) """ When importing Stripe customers, only update existing companies, do not create new companies diff --git a/src/schematic/types/stripe_sandbox_claim_link.py b/src/schematic/types/stripe_sandbox_claim_link.py new file mode 100644 index 0000000..7aa73d6 --- /dev/null +++ b/src/schematic/types/stripe_sandbox_claim_link.py @@ -0,0 +1,23 @@ +# 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 + + +class StripeSandboxClaimLink(UniversalBaseModel): + claim_url: str + expires_at: typing.Optional[dt.datetime] = None + sandbox_id: str + status: str + + 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/stripe_sandbox_countries_response_data.py b/src/schematic/types/stripe_sandbox_countries_response_data.py new file mode 100644 index 0000000..87901e2 --- /dev/null +++ b/src/schematic/types/stripe_sandbox_countries_response_data.py @@ -0,0 +1,19 @@ +# 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 StripeSandboxCountriesResponseData(UniversalBaseModel): + countries: typing.List[str] + + 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/stripe_sandbox_install_response_data.py b/src/schematic/types/stripe_sandbox_install_response_data.py new file mode 100644 index 0000000..2f86af2 --- /dev/null +++ b/src/schematic/types/stripe_sandbox_install_response_data.py @@ -0,0 +1,28 @@ +# 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 .integration_install_response_data import IntegrationInstallResponseData +from .stripe_sandbox_keys_response_data import StripeSandboxKeysResponseData + + +class StripeSandboxInstallResponseData(UniversalBaseModel): + api_keys: typing.Optional[StripeSandboxKeysResponseData] = None + claim_url: str + claim_url_expires_at: typing.Optional[dt.datetime] = None + expires_at: typing.Optional[dt.datetime] = None + install: IntegrationInstallResponseData + sandbox_id: str + stripe_account_id: str + + 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/stripe_sandbox_keys_response_data.py b/src/schematic/types/stripe_sandbox_keys_response_data.py new file mode 100644 index 0000000..b12e2f5 --- /dev/null +++ b/src/schematic/types/stripe_sandbox_keys_response_data.py @@ -0,0 +1,21 @@ +# 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 StripeSandboxKeysResponseData(UniversalBaseModel): + mcp: str + publishable: str + secret: str + + 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