diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 0000000..e525397 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,26 @@ +{ + "cliVersion": "3.24.4", + "generatorName": "fernapi/fern-python-sdk", + "generatorVersion": "4.46.3", + "generatorConfig": { + "inline_request_params": true, + "client": { + "class_name": "BaseSchematic", + "filename": "base_client.py", + "exported_class_name": "Schematic", + "exported_filename": "client.py" + }, + "additional_init_exports": [ + { + "from": "client", + "imports": [ + "AsyncSchematic", + "AsyncSchematicConfig", + "LocalCache", + "Schematic", + "SchematicConfig" + ] + } + ] + } +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9818c03..e4588ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,4 @@ name: ci - on: [push] jobs: compile: @@ -10,7 +9,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 @@ -26,7 +25,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 @@ -34,7 +33,7 @@ jobs: run: poetry install - name: Test - run: poetry run pytest -rP . + run: poetry run pytest -rP -n auto . publish: needs: [compile, test] @@ -46,7 +45,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 - name: Bootstrap poetry run: | curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..9cb8230 --- /dev/null +++ b/changelog.md @@ -0,0 +1,4 @@ +## 1.1.5 - 2025-12-19 +* SDK regeneration +* Unable to analyze changes with AI, incrementing PATCH version. + diff --git a/poetry.lock b/poetry.lock index a19d7e2..9decbf8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -75,6 +75,20 @@ typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "execnet" +version = "2.1.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec"}, + {file = "execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "h11" version = "0.16.0" @@ -418,6 +432,26 @@ pytest = ">=7.0.0,<9" docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"] +[[package]] +name = "pytest-xdist" +version = "3.6.1" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, + {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -557,4 +591,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "8551b871abee465e23fb0966d51f2c155fd257b55bdcb0c02d095de19f92f358" +content-hash = "bcf31a142c86d9e556553c8c260a93b563ac64a043076dbd48b26111d422c26e" diff --git a/pyproject.toml b/pyproject.toml index 9099bd4..7b5c428 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,10 @@ [project] name = "schematichq" +dynamic = ["version"] [tool.poetry] name = "schematichq" -version = "1.1.4" +version = "1.1.5" description = "" readme = "README.md" authors = [] @@ -31,7 +32,7 @@ packages = [ { include = "schematic", from = "src"} ] -[project.urls] +[tool.poetry.urls] Repository = 'https://github.com/schematichq/schematic-python' [tool.poetry.dependencies] @@ -45,6 +46,7 @@ typing_extensions = ">= 4.0.0" mypy = "==1.13.0" pytest = "^7.4.0" pytest-asyncio = "^0.23.5" +pytest-xdist = "^3.6.1" python-dateutil = "^2.9.0" types-python-dateutil = "^2.9.0.20240316" ruff = "==0.11.5" diff --git a/reference.md b/reference.md index d6b6202..6ababaa 100644 --- a/reference.md +++ b/reference.md @@ -1,5 +1,5 @@ # Reference -
client.put_plan_audiences_plan_audience_id(...) +
client.put_plan_audiences_plan_audience_id(...) -> AsyncHttpResponse[None]
@@ -55,7 +55,7 @@ client.put_plan_audiences_plan_audience_id(
-
client.delete_plan_audiences_plan_audience_id(...) +
client.delete_plan_audiences_plan_audience_id(...) -> AsyncHttpResponse[None]
@@ -112,7 +112,7 @@ client.delete_plan_audiences_plan_audience_id(
## accounts -
client.accounts.list_api_keys(...) +
client.accounts.list_api_keys(...) -> AsyncHttpResponse[ListApiKeysResponse]
@@ -195,7 +195,7 @@ client.accounts.list_api_keys(
-
client.accounts.create_api_key(...) +
client.accounts.create_api_key(...) -> AsyncHttpResponse[CreateApiKeyResponse]
@@ -267,7 +267,7 @@ client.accounts.create_api_key(
-
client.accounts.get_api_key(...) +
client.accounts.get_api_key(...) -> AsyncHttpResponse[GetApiKeyResponse]
@@ -323,7 +323,7 @@ client.accounts.get_api_key(
-
client.accounts.update_api_key(...) +
client.accounts.update_api_key(...) -> AsyncHttpResponse[UpdateApiKeyResponse]
@@ -395,7 +395,7 @@ client.accounts.update_api_key(
-
client.accounts.delete_api_key(...) +
client.accounts.delete_api_key(...) -> AsyncHttpResponse[DeleteApiKeyResponse]
@@ -451,7 +451,7 @@ client.accounts.delete_api_key(
-
client.accounts.count_api_keys(...) +
client.accounts.count_api_keys(...) -> AsyncHttpResponse[CountApiKeysResponse]
@@ -534,7 +534,7 @@ client.accounts.count_api_keys(
-
client.accounts.list_api_requests(...) +
client.accounts.list_api_requests(...) -> AsyncHttpResponse[ListApiRequestsResponse]
@@ -626,7 +626,7 @@ client.accounts.list_api_requests(
-
client.accounts.get_api_request(...) +
client.accounts.get_api_request(...) -> AsyncHttpResponse[GetApiRequestResponse]
@@ -682,7 +682,7 @@ client.accounts.get_api_request(
-
client.accounts.count_api_requests(...) +
client.accounts.count_api_requests(...) -> AsyncHttpResponse[CountApiRequestsResponse]
@@ -774,7 +774,7 @@ client.accounts.count_api_requests(
-
client.accounts.list_environments(...) +
client.accounts.list_environments(...) -> AsyncHttpResponse[ListEnvironmentsResponse]
@@ -847,7 +847,7 @@ client.accounts.list_environments(
-
client.accounts.create_environment(...) +
client.accounts.create_environment(...) -> AsyncHttpResponse[CreateEnvironmentResponse]
@@ -912,7 +912,7 @@ client.accounts.create_environment(
-
client.accounts.get_environment(...) +
client.accounts.get_environment(...) -> AsyncHttpResponse[GetEnvironmentResponse]
@@ -968,7 +968,7 @@ client.accounts.get_environment(
-
client.accounts.update_environment(...) +
client.accounts.update_environment(...) -> AsyncHttpResponse[UpdateEnvironmentResponse]
@@ -1040,7 +1040,7 @@ client.accounts.update_environment(
-
client.accounts.delete_environment(...) +
client.accounts.delete_environment(...) -> AsyncHttpResponse[DeleteEnvironmentResponse]
@@ -1096,7 +1096,7 @@ client.accounts.delete_environment(
-
client.accounts.quickstart() +
client.accounts.quickstart() -> AsyncHttpResponse[QuickstartResponse]
@@ -1143,7 +1143,7 @@ client.accounts.quickstart()
## billing -
client.billing.list_coupons(...) +
client.billing.list_coupons(...) -> AsyncHttpResponse[ListCouponsResponse]
@@ -1226,7 +1226,7 @@ client.billing.list_coupons(
-
client.billing.upsert_billing_coupon(...) +
client.billing.upsert_billing_coupon(...) -> AsyncHttpResponse[UpsertBillingCouponResponse]
@@ -1353,7 +1353,7 @@ client.billing.upsert_billing_coupon(
-
client.billing.upsert_billing_customer(...) +
client.billing.upsert_billing_customer(...) -> AsyncHttpResponse[UpsertBillingCustomerResponse]
@@ -1449,6 +1449,14 @@ client.billing.upsert_billing_customer(
+**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -1461,7 +1469,7 @@ client.billing.upsert_billing_customer(
-
client.billing.list_customers_with_subscriptions(...) +
client.billing.list_customers_with_subscriptions(...) -> AsyncHttpResponse[ListCustomersWithSubscriptionsResponse]
@@ -1480,8 +1488,9 @@ client = Schematic( api_key="YOUR_API_KEY", ) client.billing.list_customers_with_subscriptions( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -1509,6 +1518,14 @@ client.billing.list_customers_with_subscriptions(
+**failed_to_import:** `typing.Optional[bool]` + +
+
+ +
+
+ **name:** `typing.Optional[str]`
@@ -1517,7 +1534,7 @@ client.billing.list_customers_with_subscriptions(
-**failed_to_import:** `typing.Optional[bool]` +**provider_type:** `typing.Optional[BillingProviderType]`
@@ -1561,7 +1578,7 @@ client.billing.list_customers_with_subscriptions(
-
client.billing.count_customers(...) +
client.billing.count_customers(...) -> AsyncHttpResponse[CountCustomersResponse]
@@ -1580,8 +1597,9 @@ client = Schematic( api_key="YOUR_API_KEY", ) client.billing.count_customers( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -1609,6 +1627,14 @@ client.billing.count_customers(
+**failed_to_import:** `typing.Optional[bool]` + +
+
+ +
+
+ **name:** `typing.Optional[str]`
@@ -1617,7 +1643,7 @@ client.billing.count_customers(
-**failed_to_import:** `typing.Optional[bool]` +**provider_type:** `typing.Optional[BillingProviderType]`
@@ -1661,7 +1687,7 @@ client.billing.count_customers(
-
client.billing.list_invoices(...) +
client.billing.list_invoices(...) -> AsyncHttpResponse[ListInvoicesResponse]
@@ -1753,7 +1779,7 @@ client.billing.list_invoices(
-
client.billing.upsert_invoice(...) +
client.billing.upsert_invoice(...) -> AsyncHttpResponse[UpsertInvoiceResponse]
@@ -1903,7 +1929,7 @@ client.billing.upsert_invoice(
-
client.billing.list_meters(...) +
client.billing.list_meters(...) -> AsyncHttpResponse[ListMetersResponse]
@@ -1977,7 +2003,7 @@ client.billing.list_meters(
-
client.billing.upsert_billing_meter(...) +
client.billing.upsert_billing_meter(...) -> AsyncHttpResponse[UpsertBillingMeterResponse]
@@ -2060,7 +2086,7 @@ client.billing.upsert_billing_meter(
-
client.billing.list_payment_methods(...) +
client.billing.list_payment_methods(...) -> AsyncHttpResponse[ListPaymentMethodsResponse]
@@ -2143,7 +2169,7 @@ client.billing.list_payment_methods(
-
client.billing.upsert_payment_method(...) +
client.billing.upsert_payment_method(...) -> AsyncHttpResponse[UpsertPaymentMethodResponse]
@@ -2289,7 +2315,7 @@ client.billing.upsert_payment_method(
-
client.billing.list_billing_prices(...) +
client.billing.list_billing_prices(...) -> AsyncHttpResponse[ListBillingPricesResponse]
@@ -2314,6 +2340,7 @@ client.billing.list_billing_prices( is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -2400,6 +2427,14 @@ client.billing.list_billing_prices(
+**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ **q:** `typing.Optional[str]`
@@ -2460,7 +2495,7 @@ client.billing.list_billing_prices(
-
client.billing.upsert_billing_price(...) +
client.billing.upsert_billing_price(...) -> AsyncHttpResponse[UpsertBillingPriceResponse]
@@ -2613,6 +2648,14 @@ client.billing.upsert_billing_price(
+**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ **tiers_mode:** `typing.Optional[BillingTiersMode]`
@@ -2633,7 +2676,7 @@ client.billing.upsert_billing_price(
-
client.billing.delete_billing_product(...) +
client.billing.delete_billing_product(...) -> AsyncHttpResponse[DeleteBillingProductResponse]
@@ -2689,7 +2732,7 @@ client.billing.delete_billing_product(
-
client.billing.list_billing_product_prices(...) +
client.billing.list_billing_product_prices(...) -> AsyncHttpResponse[ListBillingProductPricesResponse]
@@ -2714,6 +2757,7 @@ client.billing.list_billing_product_prices( is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -2800,6 +2844,14 @@ client.billing.list_billing_product_prices(
+**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ **q:** `typing.Optional[str]`
@@ -2860,7 +2912,7 @@ client.billing.list_billing_product_prices(
-
client.billing.delete_product_price(...) +
client.billing.delete_product_price(...) -> AsyncHttpResponse[DeleteProductPriceResponse]
@@ -2916,7 +2968,7 @@ client.billing.delete_product_price(
-
client.billing.upsert_billing_product(...) +
client.billing.upsert_billing_product(...) -> AsyncHttpResponse[UpsertBillingProductResponse]
@@ -2986,6 +3038,14 @@ client.billing.upsert_billing_product(
+**provider_type:** `typing.Optional[BillingProviderType]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -2998,7 +3058,7 @@ client.billing.upsert_billing_product(
-
client.billing.list_billing_products(...) +
client.billing.list_billing_products(...) -> AsyncHttpResponse[ListBillingProductsResponse]
@@ -3017,14 +3077,15 @@ client = Schematic( api_key="YOUR_API_KEY", ) client.billing.list_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) @@ -3051,7 +3112,7 @@ client.billing.list_billing_products(
-**name:** `typing.Optional[str]` +**is_active:** `typing.Optional[bool]` — Filter products that are active
@@ -3059,7 +3120,7 @@ client.billing.list_billing_products(
-**q:** `typing.Optional[str]` +**name:** `typing.Optional[str]`
@@ -3075,7 +3136,7 @@ client.billing.list_billing_products(
-**without_linked_to_plan:** `typing.Optional[bool]` — Filter products that are not linked to any plan +**provider_type:** `typing.Optional[BillingProviderType]`
@@ -3083,7 +3144,7 @@ client.billing.list_billing_products(
-**with_one_time_charges:** `typing.Optional[bool]` — Filter products that are one time charges +**q:** `typing.Optional[str]`
@@ -3091,7 +3152,7 @@ client.billing.list_billing_products(
-**with_zero_price:** `typing.Optional[bool]` — Filter products that have zero price for free subscription type +**with_one_time_charges:** `typing.Optional[bool]` — Filter products that are one time charges
@@ -3107,7 +3168,15 @@ client.billing.list_billing_products(
-**is_active:** `typing.Optional[bool]` — Filter products that are active +**with_zero_price:** `typing.Optional[bool]` — Filter products that have zero price for free subscription type + +
+
+ +
+
+ +**without_linked_to_plan:** `typing.Optional[bool]` — Filter products that are not linked to any plan
@@ -3143,7 +3212,7 @@ client.billing.list_billing_products(
-
client.billing.count_billing_products(...) +
client.billing.count_billing_products(...) -> AsyncHttpResponse[CountBillingProductsResponse]
@@ -3162,14 +3231,15 @@ client = Schematic( api_key="YOUR_API_KEY", ) client.billing.count_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) @@ -3196,7 +3266,7 @@ client.billing.count_billing_products(
-**name:** `typing.Optional[str]` +**is_active:** `typing.Optional[bool]` — Filter products that are active
@@ -3204,7 +3274,7 @@ client.billing.count_billing_products(
-**q:** `typing.Optional[str]` +**name:** `typing.Optional[str]`
@@ -3220,7 +3290,7 @@ client.billing.count_billing_products(
-**without_linked_to_plan:** `typing.Optional[bool]` — Filter products that are not linked to any plan +**provider_type:** `typing.Optional[BillingProviderType]`
@@ -3228,7 +3298,7 @@ client.billing.count_billing_products(
-**with_one_time_charges:** `typing.Optional[bool]` — Filter products that are one time charges +**q:** `typing.Optional[str]`
@@ -3236,7 +3306,7 @@ client.billing.count_billing_products(
-**with_zero_price:** `typing.Optional[bool]` — Filter products that have zero price for free subscription type +**with_one_time_charges:** `typing.Optional[bool]` — Filter products that are one time charges
@@ -3252,7 +3322,15 @@ client.billing.count_billing_products(
-**is_active:** `typing.Optional[bool]` — Filter products that are active +**with_zero_price:** `typing.Optional[bool]` — Filter products that have zero price for free subscription type + +
+
+ +
+
+ +**without_linked_to_plan:** `typing.Optional[bool]` — Filter products that are not linked to any plan
@@ -3288,7 +3366,7 @@ client.billing.count_billing_products(
-
client.billing.upsert_billing_subscription(...) +
client.billing.upsert_billing_subscription(...) -> AsyncHttpResponse[UpsertBillingSubscriptionResponse]
@@ -3462,7 +3540,7 @@ client.billing.upsert_billing_subscription(
-**metadata:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` +**metadata:** `typing.Optional[typing.Dict[str, typing.Any]]`
@@ -3523,7 +3601,7 @@ client.billing.upsert_billing_subscription(
## credits -
client.credits.list_billing_credits(...) +
client.credits.list_billing_credits(...) -> AsyncHttpResponse[ListBillingCreditsResponse]
@@ -3605,7 +3683,7 @@ client.credits.list_billing_credits(
-
client.credits.create_billing_credit(...) +
client.credits.create_billing_credit(...) -> AsyncHttpResponse[CreateBillingCreditResponse]
@@ -3751,7 +3829,7 @@ client.credits.create_billing_credit(
-
client.credits.get_single_billing_credit(...) +
client.credits.get_single_billing_credit(...) -> AsyncHttpResponse[GetSingleBillingCreditResponse]
@@ -3807,7 +3885,7 @@ client.credits.get_single_billing_credit(
-
client.credits.update_billing_credit(...) +
client.credits.update_billing_credit(...) -> AsyncHttpResponse[UpdateBillingCreditResponse]
@@ -3953,7 +4031,7 @@ client.credits.update_billing_credit(
-
client.credits.soft_delete_billing_credit(...) +
client.credits.soft_delete_billing_credit(...) -> AsyncHttpResponse[SoftDeleteBillingCreditResponse]
@@ -4009,7 +4087,7 @@ client.credits.soft_delete_billing_credit(
-
client.credits.list_credit_bundles(...) +
client.credits.list_credit_bundles(...) -> AsyncHttpResponse[ListCreditBundlesResponse]
@@ -4108,7 +4186,7 @@ client.credits.list_credit_bundles(
-
client.credits.create_credit_bundle(...) +
client.credits.create_credit_bundle(...) -> AsyncHttpResponse[CreateCreditBundleResponse]
@@ -4247,7 +4325,7 @@ client.credits.create_credit_bundle(
-
client.credits.get_credit_bundle(...) +
client.credits.get_credit_bundle(...) -> AsyncHttpResponse[GetCreditBundleResponse]
@@ -4303,7 +4381,7 @@ client.credits.get_credit_bundle(
-
client.credits.update_credit_bundle_details(...) +
client.credits.update_credit_bundle_details(...) -> AsyncHttpResponse[UpdateCreditBundleDetailsResponse]
@@ -4425,7 +4503,7 @@ client.credits.update_credit_bundle_details(
-
client.credits.delete_credit_bundle(...) +
client.credits.delete_credit_bundle(...) -> AsyncHttpResponse[DeleteCreditBundleResponse]
@@ -4481,7 +4559,7 @@ client.credits.delete_credit_bundle(
-
client.credits.count_credit_bundles(...) +
client.credits.count_credit_bundles(...) -> AsyncHttpResponse[CountCreditBundlesResponse]
@@ -4580,7 +4658,7 @@ client.credits.count_credit_bundles(
-
client.credits.count_billing_credits(...) +
client.credits.count_billing_credits(...) -> AsyncHttpResponse[CountBillingCreditsResponse]
@@ -4662,7 +4740,7 @@ client.credits.count_billing_credits(
-
client.credits.zero_out_grant(...) +
client.credits.zero_out_grant(...) -> AsyncHttpResponse[ZeroOutGrantResponse]
@@ -4726,7 +4804,7 @@ client.credits.zero_out_grant(
-
client.credits.grant_billing_credits_to_company(...) +
client.credits.grant_billing_credits_to_company(...) -> AsyncHttpResponse[GrantBillingCreditsToCompanyResponse]
@@ -4865,7 +4943,7 @@ client.credits.grant_billing_credits_to_company(
-
client.credits.list_company_grants(...) +
client.credits.list_company_grants(...) -> AsyncHttpResponse[ListCompanyGrantsResponse]
@@ -4957,7 +5035,7 @@ client.credits.list_company_grants(
-
client.credits.count_billing_credits_grants(...) +
client.credits.count_billing_credits_grants(...) -> AsyncHttpResponse[CountBillingCreditsGrantsResponse]
@@ -5039,7 +5117,7 @@ client.credits.count_billing_credits_grants(
-
client.credits.list_grants_for_credit(...) +
client.credits.list_grants_for_credit(...) -> AsyncHttpResponse[ListGrantsForCreditResponse]
@@ -5121,7 +5199,7 @@ client.credits.list_grants_for_credit(
-
client.credits.get_enriched_credit_ledger(...) +
client.credits.get_enriched_credit_ledger(...) -> AsyncHttpResponse[GetEnrichedCreditLedgerResponse]
@@ -5240,7 +5318,7 @@ client.credits.get_enriched_credit_ledger(
-
client.credits.count_credit_ledger(...) +
client.credits.count_credit_ledger(...) -> AsyncHttpResponse[CountCreditLedgerResponse]
@@ -5359,7 +5437,7 @@ client.credits.count_credit_ledger(
-
client.credits.list_billing_plan_credit_grants(...) +
client.credits.list_billing_plan_credit_grants(...) -> AsyncHttpResponse[ListBillingPlanCreditGrantsResponse]
@@ -5458,7 +5536,7 @@ client.credits.list_billing_plan_credit_grants(
-
client.credits.create_billing_plan_credit_grant(...) +
client.credits.create_billing_plan_credit_grant(...) -> AsyncHttpResponse[CreateBillingPlanCreditGrantResponse]
@@ -5646,7 +5724,7 @@ client.credits.create_billing_plan_credit_grant(
-
client.credits.update_billing_plan_credit_grant(...) +
client.credits.update_billing_plan_credit_grant(...) -> AsyncHttpResponse[UpdateBillingPlanCreditGrantResponse]
@@ -5824,7 +5902,7 @@ client.credits.update_billing_plan_credit_grant(
-
client.credits.delete_billing_plan_credit_grant(...) +
client.credits.delete_billing_plan_credit_grant(...) -> AsyncHttpResponse[DeleteBillingPlanCreditGrantResponse]
@@ -5889,7 +5967,7 @@ client.credits.delete_billing_plan_credit_grant(
-
client.credits.count_billing_plan_credit_grants(...) +
client.credits.count_billing_plan_credit_grants(...) -> AsyncHttpResponse[CountBillingPlanCreditGrantsResponse]
@@ -5989,7 +6067,7 @@ client.credits.count_billing_plan_credit_grants(
## checkout -
client.checkout.internal(...) +
client.checkout.internal(...) -> AsyncHttpResponse[CheckoutInternalResponse]
@@ -6143,7 +6221,7 @@ client.checkout.internal(
-
client.checkout.get_checkout_data(...) +
client.checkout.get_checkout_data(...) -> AsyncHttpResponse[GetCheckoutDataResponse]
@@ -6207,7 +6285,7 @@ client.checkout.get_checkout_data(
-
client.checkout.preview_checkout_internal(...) +
client.checkout.preview_checkout_internal(...) -> AsyncHttpResponse[PreviewCheckoutInternalResponse]
@@ -6361,7 +6439,7 @@ client.checkout.preview_checkout_internal(
-
client.checkout.manage_plan(...) +
client.checkout.manage_plan(...) -> AsyncHttpResponse[ManagePlanResponse]
@@ -6527,7 +6605,7 @@ client.checkout.manage_plan(
-
client.checkout.preview_manage_plan(...) +
client.checkout.preview_manage_plan(...) -> AsyncHttpResponse[PreviewManagePlanResponse]
@@ -6693,7 +6771,7 @@ client.checkout.preview_manage_plan(
-
client.checkout.cancel_subscription(...) +
client.checkout.cancel_subscription(...) -> AsyncHttpResponse[CancelSubscriptionResponse]
@@ -6765,7 +6843,7 @@ client.checkout.cancel_subscription(
-
client.checkout.update_customer_subscription_trial_end(...) +
client.checkout.update_customer_subscription_trial_end(...) -> AsyncHttpResponse[UpdateCustomerSubscriptionTrialEndResponse]
@@ -6830,7 +6908,7 @@ client.checkout.update_customer_subscription_trial_end(
## companies -
client.companies.list_companies(...) +
client.companies.list_companies(...) -> AsyncHttpResponse[ListCompaniesResponse]
@@ -6948,7 +7026,7 @@ client.companies.list_companies(
-
client.companies.upsert_company(...) +
client.companies.upsert_company(...) -> AsyncHttpResponse[UpsertCompanyResponse]
@@ -7016,7 +7094,7 @@ client.companies.upsert_company(
-**traits:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — A map of trait names to trait values +**traits:** `typing.Optional[typing.Dict[str, typing.Any]]` — A map of trait names to trait values
@@ -7044,7 +7122,7 @@ client.companies.upsert_company(
-
client.companies.get_company(...) +
client.companies.get_company(...) -> AsyncHttpResponse[GetCompanyResponse]
@@ -7100,7 +7178,7 @@ client.companies.get_company(
-
client.companies.delete_company(...) +
client.companies.delete_company(...) -> AsyncHttpResponse[DeleteCompanyResponse]
@@ -7174,7 +7252,7 @@ client.companies.delete_company(
-
client.companies.count_companies(...) +
client.companies.count_companies(...) -> AsyncHttpResponse[CountCompaniesResponse]
@@ -7292,7 +7370,7 @@ client.companies.count_companies(
-
client.companies.count_companies_for_advanced_filter(...) +
client.companies.count_companies_for_advanced_filter(...) -> AsyncHttpResponse[CountCompaniesForAdvancedFilterResponse]
@@ -7471,7 +7549,7 @@ client.companies.count_companies_for_advanced_filter(
-
client.companies.create_company(...) +
client.companies.create_company(...) -> AsyncHttpResponse[CreateCompanyResponse]
@@ -7539,7 +7617,7 @@ client.companies.create_company(
-**traits:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — A map of trait names to trait values +**traits:** `typing.Optional[typing.Dict[str, typing.Any]]` — A map of trait names to trait values
@@ -7567,7 +7645,7 @@ client.companies.create_company(
-
client.companies.delete_company_by_keys(...) +
client.companies.delete_company_by_keys(...) -> AsyncHttpResponse[DeleteCompanyByKeysResponse]
@@ -7623,7 +7701,7 @@ client.companies.delete_company_by_keys(
-
client.companies.list_companies_for_advanced_filter(...) +
client.companies.list_companies_for_advanced_filter(...) -> AsyncHttpResponse[ListCompaniesForAdvancedFilterResponse]
@@ -7802,7 +7880,7 @@ client.companies.list_companies_for_advanced_filter(
-
client.companies.lookup_company(...) +
client.companies.lookup_company(...) -> AsyncHttpResponse[LookupCompanyResponse]
@@ -7858,90 +7936,7 @@ client.companies.lookup_company(
-
client.companies.get_active_deals(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.companies.get_active_deals( - company_id="company_id", - deal_stage="deal_stage", - limit=1, - offset=1, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**company_id:** `str` - -
-
- -
-
- -**deal_stage:** `str` - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Page limit (default 100) - -
-
- -
-
- -**offset:** `typing.Optional[int]` — Page offset (default 0) - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.companies.list_company_memberships(...) +
client.companies.list_company_memberships(...) -> AsyncHttpResponse[ListCompanyMembershipsResponse]
@@ -8024,7 +8019,7 @@ client.companies.list_company_memberships(
-
client.companies.get_or_create_company_membership(...) +
client.companies.get_or_create_company_membership(...) -> AsyncHttpResponse[GetOrCreateCompanyMembershipResponse]
@@ -8089,7 +8084,7 @@ client.companies.get_or_create_company_membership(
-
client.companies.delete_company_membership(...) +
client.companies.delete_company_membership(...) -> AsyncHttpResponse[DeleteCompanyMembershipResponse]
@@ -8145,7 +8140,7 @@ client.companies.delete_company_membership(
-
client.companies.get_active_company_subscription(...) +
client.companies.get_active_company_subscription(...) -> AsyncHttpResponse[GetActiveCompanySubscriptionResponse]
@@ -8227,7 +8222,7 @@ client.companies.get_active_company_subscription(
-
client.companies.upsert_company_trait(...) +
client.companies.upsert_company_trait(...) -> AsyncHttpResponse[UpsertCompanyTraitResponse]
@@ -8316,7 +8311,7 @@ client.companies.upsert_company_trait(
-
client.companies.list_entity_key_definitions(...) +
client.companies.list_entity_key_definitions(...) -> AsyncHttpResponse[ListEntityKeyDefinitionsResponse]
@@ -8407,7 +8402,7 @@ client.companies.list_entity_key_definitions(
-
client.companies.count_entity_key_definitions(...) +
client.companies.count_entity_key_definitions(...) -> AsyncHttpResponse[CountEntityKeyDefinitionsResponse]
@@ -8498,7 +8493,7 @@ client.companies.count_entity_key_definitions(
-
client.companies.list_entity_trait_definitions(...) +
client.companies.list_entity_trait_definitions(...) -> AsyncHttpResponse[ListEntityTraitDefinitionsResponse]
@@ -8606,7 +8601,7 @@ client.companies.list_entity_trait_definitions(
-
client.companies.get_or_create_entity_trait_definition(...) +
client.companies.get_or_create_entity_trait_definition(...) -> AsyncHttpResponse[GetOrCreateEntityTraitDefinitionResponse]
@@ -8688,7 +8683,7 @@ client.companies.get_or_create_entity_trait_definition(
-
client.companies.get_entity_trait_definition(...) +
client.companies.get_entity_trait_definition(...) -> AsyncHttpResponse[GetEntityTraitDefinitionResponse]
@@ -8744,7 +8739,7 @@ client.companies.get_entity_trait_definition(
-
client.companies.update_entity_trait_definition(...) +
client.companies.update_entity_trait_definition(...) -> AsyncHttpResponse[UpdateEntityTraitDefinitionResponse]
@@ -8817,7 +8812,7 @@ client.companies.update_entity_trait_definition(
-
client.companies.count_entity_trait_definitions(...) +
client.companies.count_entity_trait_definitions(...) -> AsyncHttpResponse[CountEntityTraitDefinitionsResponse]
@@ -8925,7 +8920,7 @@ client.companies.count_entity_trait_definitions(
-
client.companies.get_entity_trait_values(...) +
client.companies.get_entity_trait_values(...) -> AsyncHttpResponse[GetEntityTraitValuesResponse]
@@ -9008,7 +9003,7 @@ client.companies.get_entity_trait_values(
-
client.companies.list_plan_changes(...) +
client.companies.list_plan_changes(...) -> AsyncHttpResponse[ListPlanChangesResponse]
@@ -9116,7 +9111,7 @@ client.companies.list_plan_changes(
-
client.companies.get_plan_change(...) +
client.companies.get_plan_change(...) -> AsyncHttpResponse[GetPlanChangeResponse]
@@ -9172,7 +9167,7 @@ client.companies.get_plan_change(
-
client.companies.list_plan_traits(...) +
client.companies.list_plan_traits(...) -> AsyncHttpResponse[ListPlanTraitsResponse]
@@ -9271,7 +9266,7 @@ client.companies.list_plan_traits(
-
client.companies.create_plan_trait(...) +
client.companies.create_plan_trait(...) -> AsyncHttpResponse[CreatePlanTraitResponse]
@@ -9345,7 +9340,7 @@ client.companies.create_plan_trait(
-
client.companies.get_plan_trait(...) +
client.companies.get_plan_trait(...) -> AsyncHttpResponse[GetPlanTraitResponse]
@@ -9401,7 +9396,7 @@ client.companies.get_plan_trait(
-
client.companies.update_plan_trait(...) +
client.companies.update_plan_trait(...) -> AsyncHttpResponse[UpdatePlanTraitResponse]
@@ -9475,7 +9470,7 @@ client.companies.update_plan_trait(
-
client.companies.delete_plan_trait(...) +
client.companies.delete_plan_trait(...) -> AsyncHttpResponse[DeletePlanTraitResponse]
@@ -9531,7 +9526,7 @@ client.companies.delete_plan_trait(
-
client.companies.update_plan_traits_bulk(...) +
client.companies.update_plan_traits_bulk(...) -> AsyncHttpResponse[UpdatePlanTraitsBulkResponse]
@@ -9610,7 +9605,7 @@ client.companies.update_plan_traits_bulk(
-
client.companies.count_plan_traits(...) +
client.companies.count_plan_traits(...) -> AsyncHttpResponse[CountPlanTraitsResponse]
@@ -9709,7 +9704,7 @@ client.companies.count_plan_traits(
-
client.companies.upsert_user_trait(...) +
client.companies.upsert_user_trait(...) -> AsyncHttpResponse[UpsertUserTraitResponse]
@@ -9798,7 +9793,7 @@ client.companies.upsert_user_trait(
-
client.companies.list_users(...) +
client.companies.list_users(...) -> AsyncHttpResponse[ListUsersResponse]
@@ -9898,7 +9893,7 @@ client.companies.list_users(
-
client.companies.upsert_user(...) +
client.companies.upsert_user(...) -> AsyncHttpResponse[UpsertUserResponse]
@@ -9998,7 +9993,7 @@ client.companies.upsert_user(
-**traits:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — A map of trait names to trait values +**traits:** `typing.Optional[typing.Dict[str, typing.Any]]` — A map of trait names to trait values
@@ -10026,7 +10021,7 @@ client.companies.upsert_user(
-
client.companies.get_user(...) +
client.companies.get_user(...) -> AsyncHttpResponse[GetUserResponse]
@@ -10082,7 +10077,7 @@ client.companies.get_user(
-
client.companies.delete_user(...) +
client.companies.delete_user(...) -> AsyncHttpResponse[DeleteUserResponse]
@@ -10138,7 +10133,7 @@ client.companies.delete_user(
-
client.companies.count_users(...) +
client.companies.count_users(...) -> AsyncHttpResponse[CountUsersResponse]
@@ -10238,7 +10233,7 @@ client.companies.count_users(
-
client.companies.create_user(...) +
client.companies.create_user(...) -> AsyncHttpResponse[CreateUserResponse]
@@ -10338,7 +10333,7 @@ client.companies.create_user(
-**traits:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` — A map of trait names to trait values +**traits:** `typing.Optional[typing.Dict[str, typing.Any]]` — A map of trait names to trait values
@@ -10366,7 +10361,7 @@ client.companies.create_user(
-
client.companies.delete_user_by_keys(...) +
client.companies.delete_user_by_keys(...) -> AsyncHttpResponse[DeleteUserByKeysResponse]
@@ -10422,7 +10417,7 @@ client.companies.delete_user_by_keys(
-
client.companies.lookup_user(...) +
client.companies.lookup_user(...) -> AsyncHttpResponse[LookupUserResponse]
@@ -10479,7 +10474,7 @@ client.companies.lookup_user(
## entitlements -
client.entitlements.list_company_overrides(...) +
client.entitlements.list_company_overrides(...) -> AsyncHttpResponse[ListCompanyOverridesResponse]
@@ -10604,7 +10599,7 @@ client.entitlements.list_company_overrides(
-
client.entitlements.create_company_override(...) +
client.entitlements.create_company_override(...) -> AsyncHttpResponse[CreateCompanyOverrideResponse]
@@ -10750,7 +10745,7 @@ client.entitlements.create_company_override(
-
client.entitlements.get_company_override(...) +
client.entitlements.get_company_override(...) -> AsyncHttpResponse[GetCompanyOverrideResponse]
@@ -10806,7 +10801,7 @@ client.entitlements.get_company_override(
-
client.entitlements.update_company_override(...) +
client.entitlements.update_company_override(...) -> AsyncHttpResponse[UpdateCompanyOverrideResponse]
@@ -10943,7 +10938,7 @@ client.entitlements.update_company_override(
-
client.entitlements.delete_company_override(...) +
client.entitlements.delete_company_override(...) -> AsyncHttpResponse[DeleteCompanyOverrideResponse]
@@ -10999,7 +10994,7 @@ client.entitlements.delete_company_override(
-
client.entitlements.count_company_overrides(...) +
client.entitlements.count_company_overrides(...) -> AsyncHttpResponse[CountCompanyOverridesResponse]
@@ -11124,7 +11119,7 @@ client.entitlements.count_company_overrides(
-
client.entitlements.list_feature_companies(...) +
client.entitlements.list_feature_companies(...) -> AsyncHttpResponse[ListFeatureCompaniesResponse]
@@ -11207,7 +11202,7 @@ client.entitlements.list_feature_companies(
-
client.entitlements.count_feature_companies(...) +
client.entitlements.count_feature_companies(...) -> AsyncHttpResponse[CountFeatureCompaniesResponse]
@@ -11290,7 +11285,7 @@ client.entitlements.count_feature_companies(
-
client.entitlements.list_feature_usage(...) +
client.entitlements.list_feature_usage(...) -> AsyncHttpResponse[ListFeatureUsageResponse]
@@ -11310,6 +11305,7 @@ client = Schematic( ) client.entitlements.list_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -11354,6 +11350,14 @@ 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. + +
+
+ +
+
+ **q:** `typing.Optional[str]`
@@ -11398,7 +11402,7 @@ client.entitlements.list_feature_usage(
-
client.entitlements.count_feature_usage(...) +
client.entitlements.count_feature_usage(...) -> AsyncHttpResponse[CountFeatureUsageResponse]
@@ -11418,6 +11422,7 @@ client = Schematic( ) client.entitlements.count_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -11462,6 +11467,14 @@ 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. + +
+
+ +
+
+ **q:** `typing.Optional[str]`
@@ -11506,7 +11519,7 @@ client.entitlements.count_feature_usage(
-
client.entitlements.list_feature_users(...) +
client.entitlements.list_feature_users(...) -> AsyncHttpResponse[ListFeatureUsersResponse]
@@ -11589,7 +11602,7 @@ client.entitlements.list_feature_users(
-
client.entitlements.count_feature_users(...) +
client.entitlements.count_feature_users(...) -> AsyncHttpResponse[CountFeatureUsersResponse]
@@ -11672,7 +11685,7 @@ client.entitlements.count_feature_users(
-
client.entitlements.list_plan_entitlements(...) +
client.entitlements.list_plan_entitlements(...) -> AsyncHttpResponse[ListPlanEntitlementsResponse]
@@ -11797,7 +11810,7 @@ client.entitlements.list_plan_entitlements(
-
client.entitlements.create_plan_entitlement(...) +
client.entitlements.create_plan_entitlement(...) -> AsyncHttpResponse[CreatePlanEntitlementResponse]
@@ -12055,7 +12068,7 @@ client.entitlements.create_plan_entitlement(
-
client.entitlements.get_plan_entitlement(...) +
client.entitlements.get_plan_entitlement(...) -> AsyncHttpResponse[GetPlanEntitlementResponse]
@@ -12111,7 +12124,7 @@ client.entitlements.get_plan_entitlement(
-
client.entitlements.update_plan_entitlement(...) +
client.entitlements.update_plan_entitlement(...) -> AsyncHttpResponse[UpdatePlanEntitlementResponse]
@@ -12360,7 +12373,7 @@ client.entitlements.update_plan_entitlement(
-
client.entitlements.delete_plan_entitlement(...) +
client.entitlements.delete_plan_entitlement(...) -> AsyncHttpResponse[DeletePlanEntitlementResponse]
@@ -12416,7 +12429,7 @@ client.entitlements.delete_plan_entitlement(
-
client.entitlements.count_plan_entitlements(...) +
client.entitlements.count_plan_entitlements(...) -> AsyncHttpResponse[CountPlanEntitlementsResponse]
@@ -12541,7 +12554,7 @@ client.entitlements.count_plan_entitlements(
-
client.entitlements.duplicate_plan_entitlements(...) +
client.entitlements.duplicate_plan_entitlements(...) -> AsyncHttpResponse[DuplicatePlanEntitlementsResponse]
@@ -12606,7 +12619,7 @@ client.entitlements.duplicate_plan_entitlements(
-
client.entitlements.get_feature_usage_by_company(...) +
client.entitlements.get_feature_usage_by_company(...) -> AsyncHttpResponse[GetFeatureUsageByCompanyResponse]
@@ -12663,7 +12676,7 @@ client.entitlements.get_feature_usage_by_company(
## plans -
client.plans.update_company_plans(...) +
client.plans.update_company_plans(...) -> AsyncHttpResponse[UpdateCompanyPlansResponse]
@@ -12736,7 +12749,7 @@ client.plans.update_company_plans(
-
client.plans.list_plans(...) +
client.plans.list_plans(...) -> AsyncHttpResponse[ListPlansResponse]
@@ -12890,7 +12903,7 @@ client.plans.list_plans(
-
client.plans.create_plan(...) +
client.plans.create_plan(...) -> AsyncHttpResponse[CreatePlanResponse]
@@ -12972,7 +12985,7 @@ client.plans.create_plan(
-
client.plans.get_plan(...) +
client.plans.get_plan(...) -> AsyncHttpResponse[GetPlanResponse]
@@ -13028,7 +13041,7 @@ client.plans.get_plan(
-
client.plans.update_plan(...) +
client.plans.update_plan(...) -> AsyncHttpResponse[UpdatePlanResponse]
@@ -13109,7 +13122,7 @@ client.plans.update_plan(
-
client.plans.delete_plan(...) +
client.plans.delete_plan(...) -> AsyncHttpResponse[DeletePlanResponse]
@@ -13165,7 +13178,7 @@ client.plans.delete_plan(
-
client.plans.upsert_billing_product_plan(...) +
client.plans.upsert_billing_product_plan(...) -> AsyncHttpResponse[UpsertBillingProductPlanResponse]
@@ -13311,7 +13324,7 @@ client.plans.upsert_billing_product_plan(
-
client.plans.count_plans(...) +
client.plans.count_plans(...) -> AsyncHttpResponse[CountPlansResponse]
@@ -13465,7 +13478,7 @@ client.plans.count_plans(
-
client.plans.list_plan_issues(...) +
client.plans.list_plan_issues(...) -> AsyncHttpResponse[ListPlanIssuesResponse]
@@ -13522,7 +13535,7 @@ client.plans.list_plan_issues(
## components -
client.components.list_components(...) +
client.components.list_components(...) -> AsyncHttpResponse[ListComponentsResponse]
@@ -13596,7 +13609,7 @@ client.components.list_components(
-
client.components.create_component(...) +
client.components.create_component(...) -> AsyncHttpResponse[CreateComponentResponse]
@@ -13669,7 +13682,7 @@ client.components.create_component(
-
client.components.get_component(...) +
client.components.get_component(...) -> AsyncHttpResponse[GetComponentResponse]
@@ -13725,7 +13738,7 @@ client.components.get_component(
-
client.components.update_component(...) +
client.components.update_component(...) -> AsyncHttpResponse[UpdateComponentResponse]
@@ -13813,7 +13826,7 @@ client.components.update_component(
-
client.components.delete_component(...) +
client.components.delete_component(...) -> AsyncHttpResponse[DeleteComponentResponse]
@@ -13869,7 +13882,7 @@ client.components.delete_component(
-
client.components.count_components(...) +
client.components.count_components(...) -> AsyncHttpResponse[CountComponentsResponse]
@@ -13943,7 +13956,7 @@ client.components.count_components(
-
client.components.preview_component_data(...) +
client.components.preview_component_data(...) -> AsyncHttpResponse[PreviewComponentDataResponse]
@@ -14004,517 +14017,12 @@ client.components.preview_component_data(
- - -
- -## crm -
client.crm.upsert_deal_line_item_association(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.crm.upsert_deal_line_item_association( - deal_external_id="deal_external_id", - line_item_external_id="line_item_external_id", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**deal_external_id:** `str` - -
-
- -
-
- -**line_item_external_id:** `str` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.crm.upsert_line_item(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.crm.upsert_line_item( - amount="amount", - interval="interval", - line_item_external_id="line_item_external_id", - product_external_id="product_external_id", - quantity=1, -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**amount:** `str` - -
-
- -
-
- -**interval:** `str` - -
-
- -
-
- -**line_item_external_id:** `str` - -
-
- -
-
- -**product_external_id:** `str` - -
-
- -
-
- -**quantity:** `int` - -
-
- -
-
- -**discount_percentage:** `typing.Optional[str]` - -
-
- -
-
- -**term_month:** `typing.Optional[int]` - -
-
- -
-
- -**total_discount:** `typing.Optional[str]` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.crm.upsert_crm_deal(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.crm.upsert_crm_deal( - crm_company_key="crm_company_key", - crm_type="crm_type", - deal_external_id="deal_external_id", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**crm_company_key:** `str` - -
-
- -
-
- -**crm_type:** `str` - -
-
- -
-
- -**deal_external_id:** `str` - -
-
- -
-
- -**arr:** `typing.Optional[str]` - -
-
- -
-
- -**crm_company_id:** `typing.Optional[str]` - -
-
- -
-
- -**crm_product_id:** `typing.Optional[str]` - -
-
- -
-
- -**deal_name:** `typing.Optional[str]` - -
-
- -
-
- -**deal_stage:** `typing.Optional[str]` - -
-
- -
-
- -**mrr:** `typing.Optional[str]` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.crm.list_crm_products(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.crm.list_crm_products( - name="name", - limit=1, - offset=1, -) - -``` -
-
-
-
- -#### ⚙️ 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. - -
-
-
-
- - -
-
-
- -
client.crm.upsert_crm_product(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from schematic import Schematic - -client = Schematic( - api_key="YOUR_API_KEY", -) -client.crm.upsert_crm_product( - currency="currency", - description="description", - external_id="external_id", - interval="interval", - name="name", - price="price", - quantity=1, - sku="sku", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**currency:** `str` - -
-
- -
-
- -**description:** `str` - -
-
- -
-
- -**external_id:** `str` - -
-
- -
-
- -**interval:** `str` - -
-
- -
-
- -**name:** `str` - -
-
- -
-
- -**price:** `str` - -
-
- -
-
- -**quantity:** `int` - -
-
- -
-
- -**sku:** `str` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- -
## dataexports -
client.dataexports.create_data_export(...) +
client.dataexports.create_data_export(...) -> AsyncHttpResponse[CreateDataExportResponse]
@@ -14570,7 +14078,7 @@ client.dataexports.create_data_export(
-
client.dataexports.get_data_export_artifact(...) +
client.dataexports.get_data_export_artifact(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]
@@ -14627,7 +14135,7 @@ client.dataexports.get_data_export_artifact(
## events -
client.events.create_event_batch(...) +
client.events.create_event_batch(...) -> AsyncHttpResponse[CreateEventBatchResponse]
@@ -14687,7 +14195,7 @@ client.events.create_event_batch(
-
client.events.get_event_summaries(...) +
client.events.get_event_summaries(...) -> AsyncHttpResponse[GetEventSummariesResponse]
@@ -14769,7 +14277,7 @@ client.events.get_event_summaries(
-
client.events.list_events(...) +
client.events.list_events(...) -> AsyncHttpResponse[ListEventsResponse]
@@ -14878,7 +14386,7 @@ client.events.list_events(
-
client.events.create_event(...) +
client.events.create_event(...) -> AsyncHttpResponse[CreateEventResponse]
@@ -14950,7 +14458,7 @@ client.events.create_event(
-
client.events.get_event(...) +
client.events.get_event(...) -> AsyncHttpResponse[GetEventResponse]
@@ -15006,7 +14514,7 @@ client.events.get_event(
-
client.events.get_segment_integration_status() +
client.events.get_segment_integration_status() -> AsyncHttpResponse[GetSegmentIntegrationStatusResponse]
@@ -15053,7 +14561,7 @@ client.events.get_segment_integration_status()
## features -
client.features.list_features(...) +
client.features.list_features(...) -> AsyncHttpResponse[ListFeaturesResponse]
@@ -15170,7 +14678,7 @@ client.features.list_features(
-
client.features.create_feature(...) +
client.features.create_feature(...) -> AsyncHttpResponse[CreateFeatureResponse]
@@ -15308,7 +14816,7 @@ client.features.create_feature(
-
client.features.get_feature(...) +
client.features.get_feature(...) -> AsyncHttpResponse[GetFeatureResponse]
@@ -15364,7 +14872,7 @@ client.features.get_feature(
-
client.features.update_feature(...) +
client.features.update_feature(...) -> AsyncHttpResponse[UpdateFeatureResponse]
@@ -15508,7 +15016,7 @@ client.features.update_feature(
-
client.features.delete_feature(...) +
client.features.delete_feature(...) -> AsyncHttpResponse[DeleteFeatureResponse]
@@ -15564,7 +15072,7 @@ client.features.delete_feature(
-
client.features.count_features(...) +
client.features.count_features(...) -> AsyncHttpResponse[CountFeaturesResponse]
@@ -15681,7 +15189,7 @@ client.features.count_features(
-
client.features.list_flags(...) +
client.features.list_flags(...) -> AsyncHttpResponse[ListFlagsResponse]
@@ -15772,7 +15280,7 @@ client.features.list_flags(
-
client.features.create_flag(...) +
client.features.create_flag(...) -> AsyncHttpResponse[CreateFlagResponse]
@@ -15871,7 +15379,7 @@ client.features.create_flag(
-
client.features.get_flag(...) +
client.features.get_flag(...) -> AsyncHttpResponse[GetFlagResponse]
@@ -15927,7 +15435,7 @@ client.features.get_flag(
-
client.features.update_flag(...) +
client.features.update_flag(...) -> AsyncHttpResponse[UpdateFlagResponse]
@@ -16035,7 +15543,7 @@ client.features.update_flag(
-
client.features.delete_flag(...) +
client.features.delete_flag(...) -> AsyncHttpResponse[DeleteFlagResponse]
@@ -16091,7 +15599,7 @@ client.features.delete_flag(
-
client.features.update_flag_rules(...) +
client.features.update_flag_rules(...) -> AsyncHttpResponse[UpdateFlagRulesResponse]
@@ -16185,7 +15693,7 @@ client.features.update_flag_rules(
-
client.features.check_flag(...) +
client.features.check_flag(...) -> AsyncHttpResponse[CheckFlagResponse]
@@ -16257,7 +15765,7 @@ client.features.check_flag(
-
client.features.check_flags(...) +
client.features.check_flags(...) -> AsyncHttpResponse[CheckFlagsResponse]
@@ -16319,7 +15827,7 @@ client.features.check_flags()
-
client.features.check_flags_bulk(...) +
client.features.check_flags_bulk(...) -> AsyncHttpResponse[CheckFlagsBulkResponse]
@@ -16375,7 +15883,7 @@ client.features.check_flags_bulk(
-
client.features.count_flags(...) +
client.features.count_flags(...) -> AsyncHttpResponse[CountFlagsResponse]
@@ -16467,7 +15975,7 @@ client.features.count_flags(
## plangroups -
client.plangroups.get_plan_group() +
client.plangroups.get_plan_group() -> AsyncHttpResponse[GetPlanGroupResponse]
@@ -16513,7 +16021,7 @@ client.plangroups.get_plan_group()
-
client.plangroups.create_plan_group(...) +
client.plangroups.create_plan_group(...) -> AsyncHttpResponse[CreatePlanGroupResponse]
@@ -16812,7 +16320,7 @@ client.plangroups.create_plan_group(
-
client.plangroups.update_plan_group(...) +
client.plangroups.update_plan_group(...) -> AsyncHttpResponse[UpdatePlanGroupResponse]
@@ -17121,7 +16629,7 @@ client.plangroups.update_plan_group(
## accesstokens -
client.accesstokens.issue_temporary_access_token(...) +
client.accesstokens.issue_temporary_access_token(...) -> AsyncHttpResponse[IssueTemporaryAccessTokenResponse]
@@ -17178,7 +16686,7 @@ client.accesstokens.issue_temporary_access_token(
## webhooks -
client.webhooks.list_webhook_events(...) +
client.webhooks.list_webhook_events(...) -> AsyncHttpResponse[ListWebhookEventsResponse]
@@ -17269,7 +16777,7 @@ client.webhooks.list_webhook_events(
-
client.webhooks.get_webhook_event(...) +
client.webhooks.get_webhook_event(...) -> AsyncHttpResponse[GetWebhookEventResponse]
@@ -17325,7 +16833,7 @@ client.webhooks.get_webhook_event(
-
client.webhooks.count_webhook_events(...) +
client.webhooks.count_webhook_events(...) -> AsyncHttpResponse[CountWebhookEventsResponse]
@@ -17416,7 +16924,7 @@ client.webhooks.count_webhook_events(
-
client.webhooks.list_webhooks(...) +
client.webhooks.list_webhooks(...) -> AsyncHttpResponse[ListWebhooksResponse]
@@ -17490,7 +16998,7 @@ client.webhooks.list_webhooks(
-
client.webhooks.create_webhook(...) +
client.webhooks.create_webhook(...) -> AsyncHttpResponse[CreateWebhookResponse]
@@ -17580,7 +17088,7 @@ client.webhooks.create_webhook(
-
client.webhooks.get_webhook(...) +
client.webhooks.get_webhook(...) -> AsyncHttpResponse[GetWebhookResponse]
@@ -17636,7 +17144,7 @@ client.webhooks.get_webhook(
-
client.webhooks.update_webhook(...) +
client.webhooks.update_webhook(...) -> AsyncHttpResponse[UpdateWebhookResponse]
@@ -17740,7 +17248,7 @@ client.webhooks.update_webhook(
-
client.webhooks.delete_webhook(...) +
client.webhooks.delete_webhook(...) -> AsyncHttpResponse[DeleteWebhookResponse]
@@ -17796,7 +17304,7 @@ client.webhooks.delete_webhook(
-
client.webhooks.count_webhooks(...) +
client.webhooks.count_webhooks(...) -> AsyncHttpResponse[CountWebhooksResponse]
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py index a7e989b..1d61316 100644 --- a/src/schematic/__init__.py +++ b/src/schematic/__init__.py @@ -47,6 +47,7 @@ BillingProductPriceTierResponseData, BillingProductPricing, BillingProductResponseData, + BillingProviderType, BillingSubscriptionDiscount, BillingSubscriptionDiscountView, BillingSubscriptionResponseData, @@ -63,7 +64,6 @@ CheckoutDataResponseData, CheckoutSettingsResponseData, CheckoutSubscription, - CompanyCrmDealsResponseData, CompanyDetailResponseData, CompanyEventPeriodMetricsResponseData, CompanyLedgerResponseData, @@ -120,20 +120,18 @@ CreditGrantSortOrder, CreditLedgerEnrichedEntryResponseData, CreditLedgerPeriod, + CreditTransferResponseData, + CreditTransferView, CreditTriggerConfig, CreditUsage, + CreditUsageAggregation, CreditUsageResponseData, - CrmDealLineItem, - CrmDealResponseData, - CrmLineItemResponseData, - CrmProductResponseData, CustomPlanConfig, CustomPlanViewConfigResponseData, DataExportOutputFileType, DataExportResponseData, DataExportStatus, DataExportType, - Decimal, DeleteResponse, DuplicatePlanEntitlementsResponseResponseData, EntitlementPriceBehavior, @@ -294,7 +292,6 @@ companies, components, credits, - crm, dataexports, entitlements, events, @@ -393,8 +390,6 @@ DeleteUserResponse, GetActiveCompanySubscriptionParams, GetActiveCompanySubscriptionResponse, - GetActiveDealsParams, - GetActiveDealsResponse, GetCompanyResponse, GetEntityTraitDefinitionResponse, GetEntityTraitValuesParams, @@ -482,14 +477,6 @@ UpdateCreditBundleDetailsResponse, ZeroOutGrantResponse, ) - from .crm import ( - ListCrmProductsParams, - ListCrmProductsResponse, - UpsertCrmDealResponse, - UpsertCrmProductResponse, - UpsertDealLineItemAssociationResponse, - UpsertLineItemResponse, - ) from .dataexports import CreateDataExportResponse from .entitlements import ( CountCompanyOverridesParams, @@ -640,6 +627,7 @@ "BillingProductPriceTierResponseData": ".types", "BillingProductPricing": ".types", "BillingProductResponseData": ".types", + "BillingProviderType": ".types", "BillingSubscriptionDiscount": ".types", "BillingSubscriptionDiscountView": ".types", "BillingSubscriptionResponseData": ".types", @@ -661,7 +649,6 @@ "CheckoutInternalResponse": ".checkout", "CheckoutSettingsResponseData": ".types", "CheckoutSubscription": ".types", - "CompanyCrmDealsResponseData": ".types", "CompanyDetailResponseData": ".types", "CompanyEventPeriodMetricsResponseData": ".types", "CompanyLedgerResponseData": ".types", @@ -793,20 +780,18 @@ "CreditGrantSortOrder": ".types", "CreditLedgerEnrichedEntryResponseData": ".types", "CreditLedgerPeriod": ".types", + "CreditTransferResponseData": ".types", + "CreditTransferView": ".types", "CreditTriggerConfig": ".types", "CreditUsage": ".types", + "CreditUsageAggregation": ".types", "CreditUsageResponseData": ".types", - "CrmDealLineItem": ".types", - "CrmDealResponseData": ".types", - "CrmLineItemResponseData": ".types", - "CrmProductResponseData": ".types", "CustomPlanConfig": ".types", "CustomPlanViewConfigResponseData": ".types", "DataExportOutputFileType": ".types", "DataExportResponseData": ".types", "DataExportStatus": ".types", "DataExportType": ".types", - "Decimal": ".types", "DeleteApiKeyResponse": ".accounts", "DeleteBillingPlanCreditGrantParams": ".credits", "DeleteBillingPlanCreditGrantResponse": ".credits", @@ -874,8 +859,6 @@ "GenericPreviewObject": ".types", "GetActiveCompanySubscriptionParams": ".companies", "GetActiveCompanySubscriptionResponse": ".companies", - "GetActiveDealsParams": ".companies", - "GetActiveDealsResponse": ".companies", "GetApiKeyResponse": ".accounts", "GetApiRequestResponse": ".accounts", "GetCheckoutDataResponse": ".checkout", @@ -945,8 +928,6 @@ "ListCouponsResponse": ".billing", "ListCreditBundlesParams": ".credits", "ListCreditBundlesResponse": ".credits", - "ListCrmProductsParams": ".crm", - "ListCrmProductsResponse": ".crm", "ListCustomersWithSubscriptionsParams": ".billing", "ListCustomersWithSubscriptionsResponse": ".billing", "ListEntityKeyDefinitionsParams": ".companies", @@ -1131,11 +1112,7 @@ "UpsertCompanyRequestBody": ".types", "UpsertCompanyResponse": ".companies", "UpsertCompanyTraitResponse": ".companies", - "UpsertCrmDealResponse": ".crm", - "UpsertCrmProductResponse": ".crm", - "UpsertDealLineItemAssociationResponse": ".crm", "UpsertInvoiceResponse": ".billing", - "UpsertLineItemResponse": ".crm", "UpsertPaymentMethodResponse": ".billing", "UpsertTraitRequestBody": ".types", "UpsertUserRequestBody": ".types", @@ -1161,7 +1138,6 @@ "companies": ".companies", "components": ".components", "credits": ".credits", - "crm": ".crm", "dataexports": ".dataexports", "entitlements": ".entitlements", "events": ".events", @@ -1237,6 +1213,7 @@ def __dir__(): "BillingProductPriceTierResponseData", "BillingProductPricing", "BillingProductResponseData", + "BillingProviderType", "BillingSubscriptionDiscount", "BillingSubscriptionDiscountView", "BillingSubscriptionResponseData", @@ -1258,7 +1235,6 @@ def __dir__(): "CheckoutInternalResponse", "CheckoutSettingsResponseData", "CheckoutSubscription", - "CompanyCrmDealsResponseData", "CompanyDetailResponseData", "CompanyEventPeriodMetricsResponseData", "CompanyLedgerResponseData", @@ -1390,20 +1366,18 @@ def __dir__(): "CreditGrantSortOrder", "CreditLedgerEnrichedEntryResponseData", "CreditLedgerPeriod", + "CreditTransferResponseData", + "CreditTransferView", "CreditTriggerConfig", "CreditUsage", + "CreditUsageAggregation", "CreditUsageResponseData", - "CrmDealLineItem", - "CrmDealResponseData", - "CrmLineItemResponseData", - "CrmProductResponseData", "CustomPlanConfig", "CustomPlanViewConfigResponseData", "DataExportOutputFileType", "DataExportResponseData", "DataExportStatus", "DataExportType", - "Decimal", "DeleteApiKeyResponse", "DeleteBillingPlanCreditGrantParams", "DeleteBillingPlanCreditGrantResponse", @@ -1471,8 +1445,6 @@ def __dir__(): "GenericPreviewObject", "GetActiveCompanySubscriptionParams", "GetActiveCompanySubscriptionResponse", - "GetActiveDealsParams", - "GetActiveDealsResponse", "GetApiKeyResponse", "GetApiRequestResponse", "GetCheckoutDataResponse", @@ -1542,8 +1514,6 @@ def __dir__(): "ListCouponsResponse", "ListCreditBundlesParams", "ListCreditBundlesResponse", - "ListCrmProductsParams", - "ListCrmProductsResponse", "ListCustomersWithSubscriptionsParams", "ListCustomersWithSubscriptionsResponse", "ListEntityKeyDefinitionsParams", @@ -1728,11 +1698,7 @@ def __dir__(): "UpsertCompanyRequestBody", "UpsertCompanyResponse", "UpsertCompanyTraitResponse", - "UpsertCrmDealResponse", - "UpsertCrmProductResponse", - "UpsertDealLineItemAssociationResponse", "UpsertInvoiceResponse", - "UpsertLineItemResponse", "UpsertPaymentMethodResponse", "UpsertTraitRequestBody", "UpsertUserRequestBody", @@ -1758,7 +1724,6 @@ def __dir__(): "companies", "components", "credits", - "crm", "dataexports", "entitlements", "events", diff --git a/src/schematic/accesstokens/types/issue_temporary_access_token_response.py b/src/schematic/accesstokens/types/issue_temporary_access_token_response.py index 2708c8b..c972c4e 100644 --- a/src/schematic/accesstokens/types/issue_temporary_access_token_response.py +++ b/src/schematic/accesstokens/types/issue_temporary_access_token_response.py @@ -9,7 +9,7 @@ class IssueTemporaryAccessTokenResponse(UniversalBaseModel): data: IssueTemporaryAccessTokenResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/create_api_key_response.py b/src/schematic/accounts/types/create_api_key_response.py index 9017791..7632f90 100644 --- a/src/schematic/accounts/types/create_api_key_response.py +++ b/src/schematic/accounts/types/create_api_key_response.py @@ -9,7 +9,7 @@ class CreateApiKeyResponse(UniversalBaseModel): data: ApiKeyCreateResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/create_environment_response.py b/src/schematic/accounts/types/create_environment_response.py index ce0b5f7..d1fecb4 100644 --- a/src/schematic/accounts/types/create_environment_response.py +++ b/src/schematic/accounts/types/create_environment_response.py @@ -9,7 +9,7 @@ class CreateEnvironmentResponse(UniversalBaseModel): data: EnvironmentDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/delete_api_key_response.py b/src/schematic/accounts/types/delete_api_key_response.py index 1001bc0..cfcb79b 100644 --- a/src/schematic/accounts/types/delete_api_key_response.py +++ b/src/schematic/accounts/types/delete_api_key_response.py @@ -9,7 +9,7 @@ class DeleteApiKeyResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/delete_environment_response.py b/src/schematic/accounts/types/delete_environment_response.py index 4e042a2..6e1b7e2 100644 --- a/src/schematic/accounts/types/delete_environment_response.py +++ b/src/schematic/accounts/types/delete_environment_response.py @@ -9,7 +9,7 @@ class DeleteEnvironmentResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/get_api_key_response.py b/src/schematic/accounts/types/get_api_key_response.py index ae9193b..89d295f 100644 --- a/src/schematic/accounts/types/get_api_key_response.py +++ b/src/schematic/accounts/types/get_api_key_response.py @@ -9,7 +9,7 @@ class GetApiKeyResponse(UniversalBaseModel): data: ApiKeyResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/get_api_request_response.py b/src/schematic/accounts/types/get_api_request_response.py index 7d62f95..00c140b 100644 --- a/src/schematic/accounts/types/get_api_request_response.py +++ b/src/schematic/accounts/types/get_api_request_response.py @@ -9,7 +9,7 @@ class GetApiRequestResponse(UniversalBaseModel): data: ApiKeyRequestResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/get_environment_response.py b/src/schematic/accounts/types/get_environment_response.py index 10867b9..b6bf87d 100644 --- a/src/schematic/accounts/types/get_environment_response.py +++ b/src/schematic/accounts/types/get_environment_response.py @@ -9,7 +9,7 @@ class GetEnvironmentResponse(UniversalBaseModel): data: EnvironmentResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/quickstart_response.py b/src/schematic/accounts/types/quickstart_response.py index cf8554d..d99970f 100644 --- a/src/schematic/accounts/types/quickstart_response.py +++ b/src/schematic/accounts/types/quickstart_response.py @@ -9,7 +9,7 @@ class QuickstartResponse(UniversalBaseModel): data: QuickstartResp - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/update_api_key_response.py b/src/schematic/accounts/types/update_api_key_response.py index 9eb61b9..9696cdc 100644 --- a/src/schematic/accounts/types/update_api_key_response.py +++ b/src/schematic/accounts/types/update_api_key_response.py @@ -9,7 +9,7 @@ class UpdateApiKeyResponse(UniversalBaseModel): data: ApiKeyResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/accounts/types/update_environment_response.py b/src/schematic/accounts/types/update_environment_response.py index addd772..e149576 100644 --- a/src/schematic/accounts/types/update_environment_response.py +++ b/src/schematic/accounts/types/update_environment_response.py @@ -9,7 +9,7 @@ class UpdateEnvironmentResponse(UniversalBaseModel): data: EnvironmentResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/base_client.py b/src/schematic/base_client.py index d1d17c8..f0b30a4 100644 --- a/src/schematic/base_client.py +++ b/src/schematic/base_client.py @@ -18,7 +18,6 @@ from .companies.client import AsyncCompaniesClient, CompaniesClient from .components.client import AsyncComponentsClient, ComponentsClient from .credits.client import AsyncCreditsClient, CreditsClient - from .crm.client import AsyncCrmClient, CrmClient from .dataexports.client import AsyncDataexportsClient, DataexportsClient from .entitlements.client import AsyncEntitlementsClient, EntitlementsClient from .events.client import AsyncEventsClient, EventsClient @@ -102,7 +101,6 @@ def __init__( self._entitlements: typing.Optional[EntitlementsClient] = None self._plans: typing.Optional[PlansClient] = None self._components: typing.Optional[ComponentsClient] = None - self._crm: typing.Optional[CrmClient] = None self._dataexports: typing.Optional[DataexportsClient] = None self._events: typing.Optional[EventsClient] = None self._features: typing.Optional[FeaturesClient] = None @@ -247,14 +245,6 @@ def components(self): self._components = ComponentsClient(client_wrapper=self._client_wrapper) return self._components - @property - def crm(self): - if self._crm is None: - from .crm.client import CrmClient # noqa: E402 - - self._crm = CrmClient(client_wrapper=self._client_wrapper) - return self._crm - @property def dataexports(self): if self._dataexports is None: @@ -378,7 +368,6 @@ def __init__( self._entitlements: typing.Optional[AsyncEntitlementsClient] = None self._plans: typing.Optional[AsyncPlansClient] = None self._components: typing.Optional[AsyncComponentsClient] = None - self._crm: typing.Optional[AsyncCrmClient] = None self._dataexports: typing.Optional[AsyncDataexportsClient] = None self._events: typing.Optional[AsyncEventsClient] = None self._features: typing.Optional[AsyncFeaturesClient] = None @@ -539,14 +528,6 @@ def components(self): self._components = AsyncComponentsClient(client_wrapper=self._client_wrapper) return self._components - @property - def crm(self): - if self._crm is None: - from .crm.client import AsyncCrmClient # noqa: E402 - - self._crm = AsyncCrmClient(client_wrapper=self._client_wrapper) - return self._crm - @property def dataexports(self): if self._dataexports is None: diff --git a/src/schematic/billing/client.py b/src/schematic/billing/client.py index a78c030..a547b03 100644 --- a/src/schematic/billing/client.py +++ b/src/schematic/billing/client.py @@ -8,6 +8,7 @@ from ..types.billing_price_scheme import BillingPriceScheme from ..types.billing_price_usage_type import BillingPriceUsageType from ..types.billing_product_pricing import BillingProductPricing +from ..types.billing_provider_type import BillingProviderType from ..types.billing_subscription_discount import BillingSubscriptionDiscount from ..types.billing_subscription_trial_end_setting import BillingSubscriptionTrialEndSetting from ..types.billing_tiers_mode import BillingTiersMode @@ -187,6 +188,7 @@ def upsert_billing_customer( name: str, company_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingCustomerResponse: """ @@ -206,6 +208,8 @@ def upsert_billing_customer( default_payment_method_id : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -237,6 +241,7 @@ def upsert_billing_customer( name=name, company_id=company_id, default_payment_method_id=default_payment_method_id, + provider_type=provider_type, request_options=request_options, ) return _response.data @@ -245,8 +250,9 @@ def list_customers_with_subscriptions( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -257,9 +263,11 @@ def list_customers_with_subscriptions( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -285,8 +293,9 @@ def list_customers_with_subscriptions( api_key="YOUR_API_KEY", ) client.billing.list_customers_with_subscriptions( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -294,8 +303,9 @@ def list_customers_with_subscriptions( """ _response = self._raw_client.list_customers_with_subscriptions( company_ids=company_ids, - name=name, failed_to_import=failed_to_import, + name=name, + provider_type=provider_type, q=q, limit=limit, offset=offset, @@ -307,8 +317,9 @@ def count_customers( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -319,9 +330,11 @@ def count_customers( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -347,8 +360,9 @@ def count_customers( api_key="YOUR_API_KEY", ) client.billing.count_customers( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -356,8 +370,9 @@ def count_customers( """ _response = self._raw_client.count_customers( company_ids=company_ids, - name=name, failed_to_import=failed_to_import, + name=name, + provider_type=provider_type, q=q, limit=limit, offset=offset, @@ -751,6 +766,7 @@ def list_billing_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -781,6 +797,8 @@ def list_billing_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -818,6 +836,7 @@ def list_billing_prices( is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -835,6 +854,7 @@ def list_billing_prices( price=price, product_id=product_id, product_ids=product_ids, + provider_type=provider_type, q=q, tiers_mode=tiers_mode, usage_type=usage_type, @@ -861,6 +881,7 @@ def upsert_billing_price( meter_id: typing.Optional[str] = OMIT, package_size: typing.Optional[int] = OMIT, price_decimal: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, tiers_mode: typing.Optional[BillingTiersMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingPriceResponse: @@ -893,6 +914,8 @@ def upsert_billing_price( price_decimal : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + tiers_mode : typing.Optional[BillingTiersMode] request_options : typing.Optional[RequestOptions] @@ -941,6 +964,7 @@ def upsert_billing_price( meter_id=meter_id, package_size=package_size, price_decimal=price_decimal, + provider_type=provider_type, tiers_mode=tiers_mode, request_options=request_options, ) @@ -988,6 +1012,7 @@ def list_billing_product_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -1018,6 +1043,8 @@ def list_billing_product_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -1055,6 +1082,7 @@ def list_billing_product_prices( is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -1072,6 +1100,7 @@ def list_billing_product_prices( price=price, product_id=product_id, product_ids=product_ids, + provider_type=provider_type, q=q, tiers_mode=tiers_mode, usage_type=usage_type, @@ -1120,6 +1149,7 @@ def upsert_billing_product( name: str, price: float, is_active: typing.Optional[bool] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingProductResponse: """ @@ -1133,6 +1163,8 @@ def upsert_billing_product( is_active : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1155,7 +1187,12 @@ def upsert_billing_product( ) """ _response = self._raw_client.upsert_billing_product( - external_id=external_id, name=name, price=price, is_active=is_active, request_options=request_options + external_id=external_id, + name=name, + price=price, + is_active=is_active, + provider_type=provider_type, + request_options=request_options, ) return _response.data @@ -1163,14 +1200,15 @@ def list_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -1180,26 +1218,28 @@ def list_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -1223,28 +1263,30 @@ def list_billing_products( api_key="YOUR_API_KEY", ) client.billing.list_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) """ _response = self._raw_client.list_billing_products( ids=ids, + is_active=is_active, name=name, - q=q, price_usage_type=price_usage_type, - without_linked_to_plan=without_linked_to_plan, + provider_type=provider_type, + q=q, with_one_time_charges=with_one_time_charges, - with_zero_price=with_zero_price, with_prices_only=with_prices_only, - is_active=is_active, + with_zero_price=with_zero_price, + without_linked_to_plan=without_linked_to_plan, limit=limit, offset=offset, request_options=request_options, @@ -1255,14 +1297,15 @@ def count_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -1272,26 +1315,28 @@ def count_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -1315,28 +1360,30 @@ def count_billing_products( api_key="YOUR_API_KEY", ) client.billing.count_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) """ _response = self._raw_client.count_billing_products( ids=ids, + is_active=is_active, name=name, - q=q, price_usage_type=price_usage_type, - without_linked_to_plan=without_linked_to_plan, + provider_type=provider_type, + q=q, with_one_time_charges=with_one_time_charges, - with_zero_price=with_zero_price, with_prices_only=with_prices_only, - is_active=is_active, + with_zero_price=with_zero_price, + without_linked_to_plan=without_linked_to_plan, limit=limit, offset=offset, request_options=request_options, @@ -1359,7 +1406,7 @@ def upsert_billing_subscription( default_payment_method_external_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, interval: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, period_end: typing.Optional[int] = OMIT, period_start: typing.Optional[int] = OMIT, status: typing.Optional[str] = OMIT, @@ -1396,7 +1443,7 @@ def upsert_billing_subscription( interval : typing.Optional[str] - metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + metadata : typing.Optional[typing.Dict[str, typing.Any]] period_end : typing.Optional[int] @@ -1651,6 +1698,7 @@ async def upsert_billing_customer( name: str, company_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingCustomerResponse: """ @@ -1670,6 +1718,8 @@ async def upsert_billing_customer( default_payment_method_id : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1709,6 +1759,7 @@ async def main() -> None: name=name, company_id=company_id, default_payment_method_id=default_payment_method_id, + provider_type=provider_type, request_options=request_options, ) return _response.data @@ -1717,8 +1768,9 @@ async def list_customers_with_subscriptions( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -1729,9 +1781,11 @@ async def list_customers_with_subscriptions( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -1762,8 +1816,9 @@ async def list_customers_with_subscriptions( async def main() -> None: await client.billing.list_customers_with_subscriptions( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -1774,8 +1829,9 @@ async def main() -> None: """ _response = await self._raw_client.list_customers_with_subscriptions( company_ids=company_ids, - name=name, failed_to_import=failed_to_import, + name=name, + provider_type=provider_type, q=q, limit=limit, offset=offset, @@ -1787,8 +1843,9 @@ async def count_customers( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -1799,9 +1856,11 @@ async def count_customers( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -1832,8 +1891,9 @@ async def count_customers( async def main() -> None: await client.billing.count_customers( - name="name", failed_to_import=True, + name="name", + provider_type="schematic", q="q", limit=1, offset=1, @@ -1844,8 +1904,9 @@ async def main() -> None: """ _response = await self._raw_client.count_customers( company_ids=company_ids, - name=name, failed_to_import=failed_to_import, + name=name, + provider_type=provider_type, q=q, limit=limit, offset=offset, @@ -2287,6 +2348,7 @@ async def list_billing_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -2317,6 +2379,8 @@ async def list_billing_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -2359,6 +2423,7 @@ async def main() -> None: is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -2379,6 +2444,7 @@ async def main() -> None: price=price, product_id=product_id, product_ids=product_ids, + provider_type=provider_type, q=q, tiers_mode=tiers_mode, usage_type=usage_type, @@ -2405,6 +2471,7 @@ async def upsert_billing_price( meter_id: typing.Optional[str] = OMIT, package_size: typing.Optional[int] = OMIT, price_decimal: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, tiers_mode: typing.Optional[BillingTiersMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingPriceResponse: @@ -2437,6 +2504,8 @@ async def upsert_billing_price( price_decimal : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + tiers_mode : typing.Optional[BillingTiersMode] request_options : typing.Optional[RequestOptions] @@ -2493,6 +2562,7 @@ async def main() -> None: meter_id=meter_id, package_size=package_size, price_decimal=price_decimal, + provider_type=provider_type, tiers_mode=tiers_mode, request_options=request_options, ) @@ -2548,6 +2618,7 @@ async def list_billing_product_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -2578,6 +2649,8 @@ async def list_billing_product_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -2620,6 +2693,7 @@ async def main() -> None: is_active=True, price=1, product_id="product_id", + provider_type="schematic", q="q", tiers_mode="graduated", usage_type="licensed", @@ -2640,6 +2714,7 @@ async def main() -> None: price=price, product_id=product_id, product_ids=product_ids, + provider_type=provider_type, q=q, tiers_mode=tiers_mode, usage_type=usage_type, @@ -2696,6 +2771,7 @@ async def upsert_billing_product( name: str, price: float, is_active: typing.Optional[bool] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertBillingProductResponse: """ @@ -2709,6 +2785,8 @@ async def upsert_billing_product( is_active : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2739,7 +2817,12 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.upsert_billing_product( - external_id=external_id, name=name, price=price, is_active=is_active, request_options=request_options + external_id=external_id, + name=name, + price=price, + is_active=is_active, + provider_type=provider_type, + request_options=request_options, ) return _response.data @@ -2747,14 +2830,15 @@ async def list_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -2764,26 +2848,28 @@ async def list_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -2812,14 +2898,15 @@ async def list_billing_products( async def main() -> None: await client.billing.list_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) @@ -2829,14 +2916,15 @@ async def main() -> None: """ _response = await self._raw_client.list_billing_products( ids=ids, + is_active=is_active, name=name, - q=q, price_usage_type=price_usage_type, - without_linked_to_plan=without_linked_to_plan, + provider_type=provider_type, + q=q, with_one_time_charges=with_one_time_charges, - with_zero_price=with_zero_price, with_prices_only=with_prices_only, - is_active=is_active, + with_zero_price=with_zero_price, + without_linked_to_plan=without_linked_to_plan, limit=limit, offset=offset, request_options=request_options, @@ -2847,14 +2935,15 @@ async def count_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -2864,26 +2953,28 @@ async def count_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -2912,14 +3003,15 @@ async def count_billing_products( async def main() -> None: await client.billing.count_billing_products( + is_active=True, name="name", - q="q", price_usage_type="licensed", - without_linked_to_plan=True, + provider_type="schematic", + q="q", with_one_time_charges=True, - with_zero_price=True, with_prices_only=True, - is_active=True, + with_zero_price=True, + without_linked_to_plan=True, limit=1, offset=1, ) @@ -2929,14 +3021,15 @@ async def main() -> None: """ _response = await self._raw_client.count_billing_products( ids=ids, + is_active=is_active, name=name, - q=q, price_usage_type=price_usage_type, - without_linked_to_plan=without_linked_to_plan, + provider_type=provider_type, + q=q, with_one_time_charges=with_one_time_charges, - with_zero_price=with_zero_price, with_prices_only=with_prices_only, - is_active=is_active, + with_zero_price=with_zero_price, + without_linked_to_plan=without_linked_to_plan, limit=limit, offset=offset, request_options=request_options, @@ -2959,7 +3052,7 @@ async def upsert_billing_subscription( default_payment_method_external_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, interval: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, period_end: typing.Optional[int] = OMIT, period_start: typing.Optional[int] = OMIT, status: typing.Optional[str] = OMIT, @@ -2996,7 +3089,7 @@ async def upsert_billing_subscription( interval : typing.Optional[str] - metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + metadata : typing.Optional[typing.Dict[str, typing.Any]] period_end : typing.Optional[int] diff --git a/src/schematic/billing/raw_client.py b/src/schematic/billing/raw_client.py index 8b10ac0..c2966b4 100644 --- a/src/schematic/billing/raw_client.py +++ b/src/schematic/billing/raw_client.py @@ -20,6 +20,7 @@ from ..types.billing_price_scheme import BillingPriceScheme from ..types.billing_price_usage_type import BillingPriceUsageType from ..types.billing_product_pricing import BillingProductPricing +from ..types.billing_provider_type import BillingProviderType from ..types.billing_subscription_discount import BillingSubscriptionDiscount from ..types.billing_subscription_trial_end_setting import BillingSubscriptionTrialEndSetting from ..types.billing_tiers_mode import BillingTiersMode @@ -315,6 +316,7 @@ def upsert_billing_customer( name: str, company_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpsertBillingCustomerResponse]: """ @@ -334,6 +336,8 @@ def upsert_billing_customer( default_payment_method_id : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -353,6 +357,7 @@ def upsert_billing_customer( "failed_to_import": failed_to_import, "meta": meta, "name": name, + "provider_type": provider_type, }, headers={ "content-type": "application/json", @@ -438,8 +443,9 @@ def list_customers_with_subscriptions( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -450,9 +456,11 @@ def list_customers_with_subscriptions( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -475,8 +483,9 @@ def list_customers_with_subscriptions( method="GET", params={ "company_ids": company_ids, - "name": name, "failed_to_import": failed_to_import, + "name": name, + "provider_type": provider_type, "q": q, "limit": limit, "offset": offset, @@ -561,8 +570,9 @@ def count_customers( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -573,9 +583,11 @@ def count_customers( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -598,8 +610,9 @@ def count_customers( method="GET", params={ "company_ids": company_ids, - "name": name, "failed_to_import": failed_to_import, + "name": name, + "provider_type": provider_type, "q": q, "limit": limit, "offset": offset, @@ -1451,6 +1464,7 @@ def list_billing_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -1481,6 +1495,8 @@ def list_billing_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -1516,6 +1532,7 @@ def list_billing_prices( "price": price, "product_id": product_id, "product_ids": product_ids, + "provider_type": provider_type, "q": q, "tiers_mode": tiers_mode, "usage_type": usage_type, @@ -1615,6 +1632,7 @@ def upsert_billing_price( meter_id: typing.Optional[str] = OMIT, package_size: typing.Optional[int] = OMIT, price_decimal: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, tiers_mode: typing.Optional[BillingTiersMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpsertBillingPriceResponse]: @@ -1647,6 +1665,8 @@ def upsert_billing_price( price_decimal : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + tiers_mode : typing.Optional[BillingTiersMode] request_options : typing.Optional[RequestOptions] @@ -1677,6 +1697,7 @@ def upsert_billing_price( direction="write", ), "product_external_id": product_external_id, + "provider_type": provider_type, "tiers_mode": tiers_mode, "usage_type": usage_type, }, @@ -1867,6 +1888,7 @@ def list_billing_product_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -1897,6 +1919,8 @@ def list_billing_product_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -1932,6 +1956,7 @@ def list_billing_product_prices( "price": price, "product_id": product_id, "product_ids": product_ids, + "provider_type": provider_type, "q": q, "tiers_mode": tiers_mode, "usage_type": usage_type, @@ -2118,6 +2143,7 @@ def upsert_billing_product( name: str, price: float, is_active: typing.Optional[bool] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpsertBillingProductResponse]: """ @@ -2131,6 +2157,8 @@ def upsert_billing_product( is_active : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2147,6 +2175,7 @@ def upsert_billing_product( "is_active": is_active, "name": name, "price": price, + "provider_type": provider_type, }, headers={ "content-type": "application/json", @@ -2232,14 +2261,15 @@ def list_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -2249,26 +2279,28 @@ def list_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -2289,14 +2321,15 @@ def list_billing_products( method="GET", params={ "ids": ids, + "is_active": is_active, "name": name, - "q": q, "price_usage_type": price_usage_type, - "without_linked_to_plan": without_linked_to_plan, + "provider_type": provider_type, + "q": q, "with_one_time_charges": with_one_time_charges, - "with_zero_price": with_zero_price, "with_prices_only": with_prices_only, - "is_active": is_active, + "with_zero_price": with_zero_price, + "without_linked_to_plan": without_linked_to_plan, "limit": limit, "offset": offset, }, @@ -2380,14 +2413,15 @@ def count_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -2397,26 +2431,28 @@ def count_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -2437,14 +2473,15 @@ def count_billing_products( method="GET", params={ "ids": ids, + "is_active": is_active, "name": name, - "q": q, "price_usage_type": price_usage_type, - "without_linked_to_plan": without_linked_to_plan, + "provider_type": provider_type, + "q": q, "with_one_time_charges": with_one_time_charges, - "with_zero_price": with_zero_price, "with_prices_only": with_prices_only, - "is_active": is_active, + "with_zero_price": with_zero_price, + "without_linked_to_plan": without_linked_to_plan, "limit": limit, "offset": offset, }, @@ -2540,7 +2577,7 @@ def upsert_billing_subscription( default_payment_method_external_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, interval: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, period_end: typing.Optional[int] = OMIT, period_start: typing.Optional[int] = OMIT, status: typing.Optional[str] = OMIT, @@ -2577,7 +2614,7 @@ def upsert_billing_subscription( interval : typing.Optional[str] - metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + metadata : typing.Optional[typing.Dict[str, typing.Any]] period_end : typing.Optional[int] @@ -2972,6 +3009,7 @@ async def upsert_billing_customer( name: str, company_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpsertBillingCustomerResponse]: """ @@ -2991,6 +3029,8 @@ async def upsert_billing_customer( default_payment_method_id : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -3010,6 +3050,7 @@ async def upsert_billing_customer( "failed_to_import": failed_to_import, "meta": meta, "name": name, + "provider_type": provider_type, }, headers={ "content-type": "application/json", @@ -3095,8 +3136,9 @@ async def list_customers_with_subscriptions( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -3107,9 +3149,11 @@ async def list_customers_with_subscriptions( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -3132,8 +3176,9 @@ async def list_customers_with_subscriptions( method="GET", params={ "company_ids": company_ids, - "name": name, "failed_to_import": failed_to_import, + "name": name, + "provider_type": provider_type, "q": q, "limit": limit, "offset": offset, @@ -3218,8 +3263,9 @@ async def count_customers( self, *, company_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - name: typing.Optional[str] = None, failed_to_import: typing.Optional[bool] = None, + name: typing.Optional[str] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, @@ -3230,9 +3276,11 @@ async def count_customers( ---------- company_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + failed_to_import : typing.Optional[bool] + name : typing.Optional[str] - failed_to_import : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] q : typing.Optional[str] @@ -3255,8 +3303,9 @@ async def count_customers( method="GET", params={ "company_ids": company_ids, - "name": name, "failed_to_import": failed_to_import, + "name": name, + "provider_type": provider_type, "q": q, "limit": limit, "offset": offset, @@ -4108,6 +4157,7 @@ async def list_billing_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -4138,6 +4188,8 @@ async def list_billing_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -4173,6 +4225,7 @@ async def list_billing_prices( "price": price, "product_id": product_id, "product_ids": product_ids, + "provider_type": provider_type, "q": q, "tiers_mode": tiers_mode, "usage_type": usage_type, @@ -4272,6 +4325,7 @@ async def upsert_billing_price( meter_id: typing.Optional[str] = OMIT, package_size: typing.Optional[int] = OMIT, price_decimal: typing.Optional[str] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, tiers_mode: typing.Optional[BillingTiersMode] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpsertBillingPriceResponse]: @@ -4304,6 +4358,8 @@ async def upsert_billing_price( price_decimal : typing.Optional[str] + provider_type : typing.Optional[BillingProviderType] + tiers_mode : typing.Optional[BillingTiersMode] request_options : typing.Optional[RequestOptions] @@ -4334,6 +4390,7 @@ async def upsert_billing_price( direction="write", ), "product_external_id": product_external_id, + "provider_type": provider_type, "tiers_mode": tiers_mode, "usage_type": usage_type, }, @@ -4524,6 +4581,7 @@ async def list_billing_product_prices( price: typing.Optional[int] = None, product_id: typing.Optional[str] = None, product_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + provider_type: typing.Optional[BillingProviderType] = None, q: typing.Optional[str] = None, tiers_mode: typing.Optional[BillingTiersMode] = None, usage_type: typing.Optional[BillingPriceUsageType] = None, @@ -4554,6 +4612,8 @@ async def list_billing_product_prices( product_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + provider_type : typing.Optional[BillingProviderType] + q : typing.Optional[str] tiers_mode : typing.Optional[BillingTiersMode] @@ -4589,6 +4649,7 @@ async def list_billing_product_prices( "price": price, "product_id": product_id, "product_ids": product_ids, + "provider_type": provider_type, "q": q, "tiers_mode": tiers_mode, "usage_type": usage_type, @@ -4775,6 +4836,7 @@ async def upsert_billing_product( name: str, price: float, is_active: typing.Optional[bool] = OMIT, + provider_type: typing.Optional[BillingProviderType] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpsertBillingProductResponse]: """ @@ -4788,6 +4850,8 @@ async def upsert_billing_product( is_active : typing.Optional[bool] + provider_type : typing.Optional[BillingProviderType] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -4804,6 +4868,7 @@ async def upsert_billing_product( "is_active": is_active, "name": name, "price": price, + "provider_type": provider_type, }, headers={ "content-type": "application/json", @@ -4889,14 +4954,15 @@ async def list_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -4906,26 +4972,28 @@ async def list_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -4946,14 +5014,15 @@ async def list_billing_products( method="GET", params={ "ids": ids, + "is_active": is_active, "name": name, - "q": q, "price_usage_type": price_usage_type, - "without_linked_to_plan": without_linked_to_plan, + "provider_type": provider_type, + "q": q, "with_one_time_charges": with_one_time_charges, - "with_zero_price": with_zero_price, "with_prices_only": with_prices_only, - "is_active": is_active, + "with_zero_price": with_zero_price, + "without_linked_to_plan": without_linked_to_plan, "limit": limit, "offset": offset, }, @@ -5037,14 +5106,15 @@ async def count_billing_products( self, *, ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + is_active: typing.Optional[bool] = None, name: typing.Optional[str] = None, - q: typing.Optional[str] = None, price_usage_type: typing.Optional[BillingPriceUsageType] = None, - without_linked_to_plan: typing.Optional[bool] = None, + provider_type: typing.Optional[BillingProviderType] = None, + q: typing.Optional[str] = None, with_one_time_charges: typing.Optional[bool] = None, - with_zero_price: typing.Optional[bool] = None, with_prices_only: typing.Optional[bool] = None, - is_active: typing.Optional[bool] = None, + with_zero_price: typing.Optional[bool] = None, + without_linked_to_plan: typing.Optional[bool] = None, limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, @@ -5054,26 +5124,28 @@ async def count_billing_products( ---------- ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] - name : typing.Optional[str] + is_active : typing.Optional[bool] + Filter products that are active - q : typing.Optional[str] + name : typing.Optional[str] price_usage_type : typing.Optional[BillingPriceUsageType] - without_linked_to_plan : typing.Optional[bool] - Filter products that are not linked to any plan + provider_type : typing.Optional[BillingProviderType] + + q : typing.Optional[str] with_one_time_charges : typing.Optional[bool] Filter products that are one time charges - with_zero_price : typing.Optional[bool] - Filter products that have zero price for free subscription type - with_prices_only : typing.Optional[bool] Filter products that have prices - is_active : typing.Optional[bool] - Filter products that are active + with_zero_price : typing.Optional[bool] + Filter products that have zero price for free subscription type + + without_linked_to_plan : typing.Optional[bool] + Filter products that are not linked to any plan limit : typing.Optional[int] Page limit (default 100) @@ -5094,14 +5166,15 @@ async def count_billing_products( method="GET", params={ "ids": ids, + "is_active": is_active, "name": name, - "q": q, "price_usage_type": price_usage_type, - "without_linked_to_plan": without_linked_to_plan, + "provider_type": provider_type, + "q": q, "with_one_time_charges": with_one_time_charges, - "with_zero_price": with_zero_price, "with_prices_only": with_prices_only, - "is_active": is_active, + "with_zero_price": with_zero_price, + "without_linked_to_plan": without_linked_to_plan, "limit": limit, "offset": offset, }, @@ -5197,7 +5270,7 @@ async def upsert_billing_subscription( default_payment_method_external_id: typing.Optional[str] = OMIT, default_payment_method_id: typing.Optional[str] = OMIT, interval: typing.Optional[str] = OMIT, - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, period_end: typing.Optional[int] = OMIT, period_start: typing.Optional[int] = OMIT, status: typing.Optional[str] = OMIT, @@ -5234,7 +5307,7 @@ async def upsert_billing_subscription( interval : typing.Optional[str] - metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + metadata : typing.Optional[typing.Dict[str, typing.Any]] period_end : typing.Optional[int] diff --git a/src/schematic/billing/types/count_billing_products_params.py b/src/schematic/billing/types/count_billing_products_params.py index 839cda5..dec043d 100644 --- a/src/schematic/billing/types/count_billing_products_params.py +++ b/src/schematic/billing/types/count_billing_products_params.py @@ -5,6 +5,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.billing_price_usage_type import BillingPriceUsageType +from ...types.billing_provider_type import BillingProviderType class CountBillingProductsParams(UniversalBaseModel): @@ -30,6 +31,7 @@ class CountBillingProductsParams(UniversalBaseModel): """ price_usage_type: typing.Optional[BillingPriceUsageType] = None + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None with_one_time_charges: typing.Optional[bool] = pydantic.Field(default=None) """ diff --git a/src/schematic/billing/types/count_customers_params.py b/src/schematic/billing/types/count_customers_params.py index 84ed4a6..4f707dd 100644 --- a/src/schematic/billing/types/count_customers_params.py +++ b/src/schematic/billing/types/count_customers_params.py @@ -4,6 +4,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ...types.billing_provider_type import BillingProviderType class CountCustomersParams(UniversalBaseModel): @@ -24,6 +25,7 @@ class CountCustomersParams(UniversalBaseModel): Page offset (default 0) """ + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None if IS_PYDANTIC_V2: diff --git a/src/schematic/billing/types/delete_billing_product_response.py b/src/schematic/billing/types/delete_billing_product_response.py index 6208f43..bdeb28c 100644 --- a/src/schematic/billing/types/delete_billing_product_response.py +++ b/src/schematic/billing/types/delete_billing_product_response.py @@ -9,7 +9,7 @@ class DeleteBillingProductResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/delete_product_price_response.py b/src/schematic/billing/types/delete_product_price_response.py index fb2762c..7fd6bf5 100644 --- a/src/schematic/billing/types/delete_product_price_response.py +++ b/src/schematic/billing/types/delete_product_price_response.py @@ -9,7 +9,7 @@ class DeleteProductPriceResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/list_billing_prices_params.py b/src/schematic/billing/types/list_billing_prices_params.py index 2ffaa88..06a7f2b 100644 --- a/src/schematic/billing/types/list_billing_prices_params.py +++ b/src/schematic/billing/types/list_billing_prices_params.py @@ -5,6 +5,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.billing_price_usage_type import BillingPriceUsageType +from ...types.billing_provider_type import BillingProviderType from ...types.billing_tiers_mode import BillingTiersMode @@ -43,6 +44,7 @@ class ListBillingPricesParams(UniversalBaseModel): price: typing.Optional[int] = None product_id: typing.Optional[str] = None product_ids: typing.Optional[typing.List[str]] = None + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None tiers_mode: typing.Optional[BillingTiersMode] = None usage_type: typing.Optional[BillingPriceUsageType] = None diff --git a/src/schematic/billing/types/list_billing_product_prices_params.py b/src/schematic/billing/types/list_billing_product_prices_params.py index 84b9ba8..cd633e7 100644 --- a/src/schematic/billing/types/list_billing_product_prices_params.py +++ b/src/schematic/billing/types/list_billing_product_prices_params.py @@ -5,6 +5,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.billing_price_usage_type import BillingPriceUsageType +from ...types.billing_provider_type import BillingProviderType from ...types.billing_tiers_mode import BillingTiersMode @@ -43,6 +44,7 @@ class ListBillingProductPricesParams(UniversalBaseModel): price: typing.Optional[int] = None product_id: typing.Optional[str] = None product_ids: typing.Optional[typing.List[str]] = None + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None tiers_mode: typing.Optional[BillingTiersMode] = None usage_type: typing.Optional[BillingPriceUsageType] = None diff --git a/src/schematic/billing/types/list_billing_products_params.py b/src/schematic/billing/types/list_billing_products_params.py index c9d7e71..ece9a97 100644 --- a/src/schematic/billing/types/list_billing_products_params.py +++ b/src/schematic/billing/types/list_billing_products_params.py @@ -5,6 +5,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ...types.billing_price_usage_type import BillingPriceUsageType +from ...types.billing_provider_type import BillingProviderType class ListBillingProductsParams(UniversalBaseModel): @@ -30,6 +31,7 @@ class ListBillingProductsParams(UniversalBaseModel): """ price_usage_type: typing.Optional[BillingPriceUsageType] = None + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None with_one_time_charges: typing.Optional[bool] = pydantic.Field(default=None) """ diff --git a/src/schematic/billing/types/list_customers_with_subscriptions_params.py b/src/schematic/billing/types/list_customers_with_subscriptions_params.py index c4e5c04..98dc01d 100644 --- a/src/schematic/billing/types/list_customers_with_subscriptions_params.py +++ b/src/schematic/billing/types/list_customers_with_subscriptions_params.py @@ -4,6 +4,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ...types.billing_provider_type import BillingProviderType class ListCustomersWithSubscriptionsParams(UniversalBaseModel): @@ -24,6 +25,7 @@ class ListCustomersWithSubscriptionsParams(UniversalBaseModel): Page offset (default 0) """ + provider_type: typing.Optional[BillingProviderType] = None q: typing.Optional[str] = None if IS_PYDANTIC_V2: diff --git a/src/schematic/billing/types/upsert_billing_coupon_response.py b/src/schematic/billing/types/upsert_billing_coupon_response.py index 72c192a..ba0d733 100644 --- a/src/schematic/billing/types/upsert_billing_coupon_response.py +++ b/src/schematic/billing/types/upsert_billing_coupon_response.py @@ -9,7 +9,7 @@ class UpsertBillingCouponResponse(UniversalBaseModel): data: BillingCouponResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_billing_customer_response.py b/src/schematic/billing/types/upsert_billing_customer_response.py index f3220cc..6b6a66a 100644 --- a/src/schematic/billing/types/upsert_billing_customer_response.py +++ b/src/schematic/billing/types/upsert_billing_customer_response.py @@ -9,7 +9,7 @@ class UpsertBillingCustomerResponse(UniversalBaseModel): data: BillingCustomerResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_billing_meter_response.py b/src/schematic/billing/types/upsert_billing_meter_response.py index fd6968e..596d957 100644 --- a/src/schematic/billing/types/upsert_billing_meter_response.py +++ b/src/schematic/billing/types/upsert_billing_meter_response.py @@ -9,7 +9,7 @@ class UpsertBillingMeterResponse(UniversalBaseModel): data: BillingMeterResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_billing_price_response.py b/src/schematic/billing/types/upsert_billing_price_response.py index 26be222..615a5f4 100644 --- a/src/schematic/billing/types/upsert_billing_price_response.py +++ b/src/schematic/billing/types/upsert_billing_price_response.py @@ -9,7 +9,7 @@ class UpsertBillingPriceResponse(UniversalBaseModel): data: BillingPriceResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_billing_product_response.py b/src/schematic/billing/types/upsert_billing_product_response.py index 115f3b5..e9936b4 100644 --- a/src/schematic/billing/types/upsert_billing_product_response.py +++ b/src/schematic/billing/types/upsert_billing_product_response.py @@ -9,7 +9,7 @@ class UpsertBillingProductResponse(UniversalBaseModel): data: BillingProductResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_billing_subscription_response.py b/src/schematic/billing/types/upsert_billing_subscription_response.py index 04010a6..6731de9 100644 --- a/src/schematic/billing/types/upsert_billing_subscription_response.py +++ b/src/schematic/billing/types/upsert_billing_subscription_response.py @@ -9,7 +9,7 @@ class UpsertBillingSubscriptionResponse(UniversalBaseModel): data: BillingSubscriptionResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_invoice_response.py b/src/schematic/billing/types/upsert_invoice_response.py index d03eea5..dac89b1 100644 --- a/src/schematic/billing/types/upsert_invoice_response.py +++ b/src/schematic/billing/types/upsert_invoice_response.py @@ -9,7 +9,7 @@ class UpsertInvoiceResponse(UniversalBaseModel): data: InvoiceResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/billing/types/upsert_payment_method_response.py b/src/schematic/billing/types/upsert_payment_method_response.py index 15e6337..724d5d8 100644 --- a/src/schematic/billing/types/upsert_payment_method_response.py +++ b/src/schematic/billing/types/upsert_payment_method_response.py @@ -9,7 +9,7 @@ class UpsertPaymentMethodResponse(UniversalBaseModel): data: PaymentMethodResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/cancel_subscription_response.py b/src/schematic/checkout/types/cancel_subscription_response.py index 6563b02..978f61b 100644 --- a/src/schematic/checkout/types/cancel_subscription_response.py +++ b/src/schematic/checkout/types/cancel_subscription_response.py @@ -9,7 +9,7 @@ class CancelSubscriptionResponse(UniversalBaseModel): data: ManagePlanResponseResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/checkout_internal_response.py b/src/schematic/checkout/types/checkout_internal_response.py index 7235c91..f9121fb 100644 --- a/src/schematic/checkout/types/checkout_internal_response.py +++ b/src/schematic/checkout/types/checkout_internal_response.py @@ -9,7 +9,7 @@ class CheckoutInternalResponse(UniversalBaseModel): data: CheckoutSubscription - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/get_checkout_data_response.py b/src/schematic/checkout/types/get_checkout_data_response.py index 928784c..8e19820 100644 --- a/src/schematic/checkout/types/get_checkout_data_response.py +++ b/src/schematic/checkout/types/get_checkout_data_response.py @@ -9,7 +9,7 @@ class GetCheckoutDataResponse(UniversalBaseModel): data: CheckoutDataResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/manage_plan_response.py b/src/schematic/checkout/types/manage_plan_response.py index 80a35d5..b5d40cb 100644 --- a/src/schematic/checkout/types/manage_plan_response.py +++ b/src/schematic/checkout/types/manage_plan_response.py @@ -9,7 +9,7 @@ class ManagePlanResponse(UniversalBaseModel): data: ManagePlanResponseResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/preview_checkout_internal_response.py b/src/schematic/checkout/types/preview_checkout_internal_response.py index c2a2c2a..7343ae9 100644 --- a/src/schematic/checkout/types/preview_checkout_internal_response.py +++ b/src/schematic/checkout/types/preview_checkout_internal_response.py @@ -9,7 +9,7 @@ class PreviewCheckoutInternalResponse(UniversalBaseModel): data: PreviewSubscriptionChangeResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/preview_manage_plan_response.py b/src/schematic/checkout/types/preview_manage_plan_response.py index ee4be04..02bacd6 100644 --- a/src/schematic/checkout/types/preview_manage_plan_response.py +++ b/src/schematic/checkout/types/preview_manage_plan_response.py @@ -9,7 +9,7 @@ class PreviewManagePlanResponse(UniversalBaseModel): data: ManagePlanPreviewResponseResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/checkout/types/update_customer_subscription_trial_end_response.py b/src/schematic/checkout/types/update_customer_subscription_trial_end_response.py index 09321bf..b2b30ee 100644 --- a/src/schematic/checkout/types/update_customer_subscription_trial_end_response.py +++ b/src/schematic/checkout/types/update_customer_subscription_trial_end_response.py @@ -9,7 +9,7 @@ class UpdateCustomerSubscriptionTrialEndResponse(UniversalBaseModel): data: BillingSubscriptionView - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/__init__.py b/src/schematic/companies/__init__.py index aa72266..679dddc 100644 --- a/src/schematic/companies/__init__.py +++ b/src/schematic/companies/__init__.py @@ -31,8 +31,6 @@ DeleteUserResponse, GetActiveCompanySubscriptionParams, GetActiveCompanySubscriptionResponse, - GetActiveDealsParams, - GetActiveDealsResponse, GetCompanyResponse, GetEntityTraitDefinitionResponse, GetEntityTraitValuesParams, @@ -95,8 +93,6 @@ "DeleteUserResponse": ".types", "GetActiveCompanySubscriptionParams": ".types", "GetActiveCompanySubscriptionResponse": ".types", - "GetActiveDealsParams": ".types", - "GetActiveDealsResponse": ".types", "GetCompanyResponse": ".types", "GetEntityTraitDefinitionResponse": ".types", "GetEntityTraitValuesParams": ".types", @@ -182,8 +178,6 @@ def __dir__(): "DeleteUserResponse", "GetActiveCompanySubscriptionParams", "GetActiveCompanySubscriptionResponse", - "GetActiveDealsParams", - "GetActiveDealsResponse", "GetCompanyResponse", "GetEntityTraitDefinitionResponse", "GetEntityTraitValuesParams", diff --git a/src/schematic/companies/client.py b/src/schematic/companies/client.py index 53495fa..8c74d33 100644 --- a/src/schematic/companies/client.py +++ b/src/schematic/companies/client.py @@ -28,7 +28,6 @@ from .types.delete_user_by_keys_response import DeleteUserByKeysResponse from .types.delete_user_response import DeleteUserResponse from .types.get_active_company_subscription_response import GetActiveCompanySubscriptionResponse -from .types.get_active_deals_response import GetActiveDealsResponse from .types.get_company_response import GetCompanyResponse from .types.get_entity_trait_definition_response import GetEntityTraitDefinitionResponse from .types.get_entity_trait_values_response import GetEntityTraitValuesResponse @@ -159,7 +158,7 @@ def upsert_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertCompanyResponse: @@ -176,7 +175,7 @@ def upsert_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -487,7 +486,7 @@ def create_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CreateCompanyResponse: @@ -504,7 +503,7 @@ def create_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -716,55 +715,6 @@ def lookup_company( _response = self._raw_client.lookup_company(keys=keys, request_options=request_options) return _response.data - def get_active_deals( - self, - *, - company_id: str, - deal_stage: str, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> GetActiveDealsResponse: - """ - Parameters - ---------- - company_id : str - - deal_stage : 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 - ------- - GetActiveDealsResponse - OK - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.companies.get_active_deals( - company_id="company_id", - deal_stage="deal_stage", - limit=1, - offset=1, - ) - """ - _response = self._raw_client.get_active_deals( - company_id=company_id, deal_stage=deal_stage, limit=limit, offset=offset, request_options=request_options - ) - return _response.data - def list_company_memberships( self, *, @@ -1939,7 +1889,7 @@ def upsert_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertUserResponse: @@ -1968,7 +1918,7 @@ def upsert_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -2144,7 +2094,7 @@ def create_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CreateUserResponse: @@ -2173,7 +2123,7 @@ def create_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -2382,7 +2332,7 @@ async def upsert_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertCompanyResponse: @@ -2399,7 +2349,7 @@ async def upsert_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -2750,7 +2700,7 @@ async def create_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CreateCompanyResponse: @@ -2767,7 +2717,7 @@ async def create_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -3011,63 +2961,6 @@ async def main() -> None: _response = await self._raw_client.lookup_company(keys=keys, request_options=request_options) return _response.data - async def get_active_deals( - self, - *, - company_id: str, - deal_stage: str, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> GetActiveDealsResponse: - """ - Parameters - ---------- - company_id : str - - deal_stage : 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 - ------- - GetActiveDealsResponse - OK - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.companies.get_active_deals( - company_id="company_id", - deal_stage="deal_stage", - limit=1, - offset=1, - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.get_active_deals( - company_id=company_id, deal_stage=deal_stage, limit=limit, offset=offset, request_options=request_options - ) - return _response.data - async def list_company_memberships( self, *, @@ -4436,7 +4329,7 @@ async def upsert_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> UpsertUserResponse: @@ -4465,7 +4358,7 @@ async def upsert_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -4675,7 +4568,7 @@ async def create_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> CreateUserResponse: @@ -4704,7 +4597,7 @@ async def create_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] diff --git a/src/schematic/companies/raw_client.py b/src/schematic/companies/raw_client.py index 1ce17fa..ecf99e8 100644 --- a/src/schematic/companies/raw_client.py +++ b/src/schematic/companies/raw_client.py @@ -39,7 +39,6 @@ from .types.delete_user_by_keys_response import DeleteUserByKeysResponse from .types.delete_user_response import DeleteUserResponse from .types.get_active_company_subscription_response import GetActiveCompanySubscriptionResponse -from .types.get_active_deals_response import GetActiveDealsResponse from .types.get_company_response import GetCompanyResponse from .types.get_entity_trait_definition_response import GetEntityTraitDefinitionResponse from .types.get_entity_trait_values_response import GetEntityTraitValuesResponse @@ -218,7 +217,7 @@ def upsert_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpsertCompanyResponse]: @@ -235,7 +234,7 @@ def upsert_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -851,7 +850,7 @@ def create_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[CreateCompanyResponse]: @@ -868,7 +867,7 @@ def create_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -1336,121 +1335,6 @@ def lookup_company( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - def get_active_deals( - self, - *, - company_id: str, - deal_stage: str, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[GetActiveDealsResponse]: - """ - Parameters - ---------- - company_id : str - - deal_stage : str - - limit : typing.Optional[int] - Page limit (default 100) - - offset : typing.Optional[int] - Page offset (default 0) - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[GetActiveDealsResponse] - OK - """ - _response = self._client_wrapper.httpx_client.request( - "company-crm-deals", - method="GET", - params={ - "company_id": company_id, - "deal_stage": deal_stage, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - GetActiveDealsResponse, - parse_obj_as( - type_=GetActiveDealsResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - def list_company_memberships( self, *, @@ -4169,7 +4053,7 @@ def upsert_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpsertUserResponse]: @@ -4198,7 +4082,7 @@ def upsert_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -4625,7 +4509,7 @@ def create_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[CreateUserResponse]: @@ -4654,7 +4538,7 @@ def create_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -5101,7 +4985,7 @@ async def upsert_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpsertCompanyResponse]: @@ -5118,7 +5002,7 @@ async def upsert_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -5734,7 +5618,7 @@ async def create_company( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[CreateCompanyResponse]: @@ -5751,7 +5635,7 @@ async def create_company( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -6219,121 +6103,6 @@ async def lookup_company( status_code=_response.status_code, headers=dict(_response.headers), body=_response_json ) - async def get_active_deals( - self, - *, - company_id: str, - deal_stage: str, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[GetActiveDealsResponse]: - """ - Parameters - ---------- - company_id : str - - deal_stage : 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[GetActiveDealsResponse] - OK - """ - _response = await self._client_wrapper.httpx_client.request( - "company-crm-deals", - method="GET", - params={ - "company_id": company_id, - "deal_stage": deal_stage, - "limit": limit, - "offset": offset, - }, - request_options=request_options, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - GetActiveDealsResponse, - parse_obj_as( - type_=GetActiveDealsResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - async def list_company_memberships( self, *, @@ -9052,7 +8821,7 @@ async def upsert_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpsertUserResponse]: @@ -9081,7 +8850,7 @@ async def upsert_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] @@ -9508,7 +9277,7 @@ async def create_user( id: typing.Optional[str] = OMIT, last_seen_at: typing.Optional[dt.datetime] = OMIT, name: typing.Optional[str] = OMIT, - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + traits: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, update_only: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[CreateUserResponse]: @@ -9537,7 +9306,7 @@ async def create_user( name : typing.Optional[str] - traits : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + traits : typing.Optional[typing.Dict[str, typing.Any]] A map of trait names to trait values update_only : typing.Optional[bool] diff --git a/src/schematic/companies/types/__init__.py b/src/schematic/companies/types/__init__.py index 0651546..43825a3 100644 --- a/src/schematic/companies/types/__init__.py +++ b/src/schematic/companies/types/__init__.py @@ -30,8 +30,6 @@ from .delete_user_response import DeleteUserResponse from .get_active_company_subscription_params import GetActiveCompanySubscriptionParams from .get_active_company_subscription_response import GetActiveCompanySubscriptionResponse - from .get_active_deals_params import GetActiveDealsParams - from .get_active_deals_response import GetActiveDealsResponse from .get_company_response import GetCompanyResponse from .get_entity_trait_definition_response import GetEntityTraitDefinitionResponse from .get_entity_trait_values_params import GetEntityTraitValuesParams @@ -93,8 +91,6 @@ "DeleteUserResponse": ".delete_user_response", "GetActiveCompanySubscriptionParams": ".get_active_company_subscription_params", "GetActiveCompanySubscriptionResponse": ".get_active_company_subscription_response", - "GetActiveDealsParams": ".get_active_deals_params", - "GetActiveDealsResponse": ".get_active_deals_response", "GetCompanyResponse": ".get_company_response", "GetEntityTraitDefinitionResponse": ".get_entity_trait_definition_response", "GetEntityTraitValuesParams": ".get_entity_trait_values_params", @@ -180,8 +176,6 @@ def __dir__(): "DeleteUserResponse", "GetActiveCompanySubscriptionParams", "GetActiveCompanySubscriptionResponse", - "GetActiveDealsParams", - "GetActiveDealsResponse", "GetCompanyResponse", "GetEntityTraitDefinitionResponse", "GetEntityTraitValuesParams", diff --git a/src/schematic/companies/types/create_company_response.py b/src/schematic/companies/types/create_company_response.py index 9fe0873..a03febf 100644 --- a/src/schematic/companies/types/create_company_response.py +++ b/src/schematic/companies/types/create_company_response.py @@ -9,7 +9,7 @@ class CreateCompanyResponse(UniversalBaseModel): data: CompanyDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/create_plan_trait_response.py b/src/schematic/companies/types/create_plan_trait_response.py index 4969db8..b5516fd 100644 --- a/src/schematic/companies/types/create_plan_trait_response.py +++ b/src/schematic/companies/types/create_plan_trait_response.py @@ -9,7 +9,7 @@ class CreatePlanTraitResponse(UniversalBaseModel): data: PlanTraitResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/create_user_response.py b/src/schematic/companies/types/create_user_response.py index ca48067..b10cf1d 100644 --- a/src/schematic/companies/types/create_user_response.py +++ b/src/schematic/companies/types/create_user_response.py @@ -9,7 +9,7 @@ class CreateUserResponse(UniversalBaseModel): data: UserDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/delete_company_by_keys_response.py b/src/schematic/companies/types/delete_company_by_keys_response.py index e745355..0bb2357 100644 --- a/src/schematic/companies/types/delete_company_by_keys_response.py +++ b/src/schematic/companies/types/delete_company_by_keys_response.py @@ -9,7 +9,7 @@ class DeleteCompanyByKeysResponse(UniversalBaseModel): data: CompanyResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/delete_company_membership_response.py b/src/schematic/companies/types/delete_company_membership_response.py index 3ceb217..edd0fa6 100644 --- a/src/schematic/companies/types/delete_company_membership_response.py +++ b/src/schematic/companies/types/delete_company_membership_response.py @@ -9,7 +9,7 @@ class DeleteCompanyMembershipResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/delete_plan_trait_response.py b/src/schematic/companies/types/delete_plan_trait_response.py index bea045b..5381083 100644 --- a/src/schematic/companies/types/delete_plan_trait_response.py +++ b/src/schematic/companies/types/delete_plan_trait_response.py @@ -9,7 +9,7 @@ class DeletePlanTraitResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/delete_user_by_keys_response.py b/src/schematic/companies/types/delete_user_by_keys_response.py index 46ffc4d..c615263 100644 --- a/src/schematic/companies/types/delete_user_by_keys_response.py +++ b/src/schematic/companies/types/delete_user_by_keys_response.py @@ -9,7 +9,7 @@ class DeleteUserByKeysResponse(UniversalBaseModel): data: UserResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/delete_user_response.py b/src/schematic/companies/types/delete_user_response.py index 6c07099..30771ff 100644 --- a/src/schematic/companies/types/delete_user_response.py +++ b/src/schematic/companies/types/delete_user_response.py @@ -9,7 +9,7 @@ class DeleteUserResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_active_deals_params.py b/src/schematic/companies/types/get_active_deals_params.py deleted file mode 100644 index c08ecae..0000000 --- a/src/schematic/companies/types/get_active_deals_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class GetActiveDealsParams(UniversalBaseModel): - """ - Input parameters - """ - - company_id: typing.Optional[str] = None - deal_stage: 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) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/companies/types/get_active_deals_response.py b/src/schematic/companies/types/get_active_deals_response.py deleted file mode 100644 index 1981c86..0000000 --- a/src/schematic/companies/types/get_active_deals_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.company_crm_deals_response_data import CompanyCrmDealsResponseData -from .get_active_deals_params import GetActiveDealsParams - - -class GetActiveDealsResponse(UniversalBaseModel): - data: typing.List[CompanyCrmDealsResponseData] - params: GetActiveDealsParams = 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/companies/types/get_company_response.py b/src/schematic/companies/types/get_company_response.py index acf6148..c8cc301 100644 --- a/src/schematic/companies/types/get_company_response.py +++ b/src/schematic/companies/types/get_company_response.py @@ -9,7 +9,7 @@ class GetCompanyResponse(UniversalBaseModel): data: CompanyDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_entity_trait_definition_response.py b/src/schematic/companies/types/get_entity_trait_definition_response.py index d6c4991..6089bd4 100644 --- a/src/schematic/companies/types/get_entity_trait_definition_response.py +++ b/src/schematic/companies/types/get_entity_trait_definition_response.py @@ -9,7 +9,7 @@ class GetEntityTraitDefinitionResponse(UniversalBaseModel): data: EntityTraitDefinitionResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_or_create_company_membership_response.py b/src/schematic/companies/types/get_or_create_company_membership_response.py index 152e114..fc8b955 100644 --- a/src/schematic/companies/types/get_or_create_company_membership_response.py +++ b/src/schematic/companies/types/get_or_create_company_membership_response.py @@ -9,7 +9,7 @@ class GetOrCreateCompanyMembershipResponse(UniversalBaseModel): data: CompanyMembershipDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_or_create_entity_trait_definition_response.py b/src/schematic/companies/types/get_or_create_entity_trait_definition_response.py index 04fef8a..56f8cde 100644 --- a/src/schematic/companies/types/get_or_create_entity_trait_definition_response.py +++ b/src/schematic/companies/types/get_or_create_entity_trait_definition_response.py @@ -9,7 +9,7 @@ class GetOrCreateEntityTraitDefinitionResponse(UniversalBaseModel): data: EntityTraitDefinitionResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_plan_change_response.py b/src/schematic/companies/types/get_plan_change_response.py index a912904..dc1eb14 100644 --- a/src/schematic/companies/types/get_plan_change_response.py +++ b/src/schematic/companies/types/get_plan_change_response.py @@ -9,7 +9,7 @@ class GetPlanChangeResponse(UniversalBaseModel): data: PlanChangeResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_plan_trait_response.py b/src/schematic/companies/types/get_plan_trait_response.py index fec26b1..dbf3045 100644 --- a/src/schematic/companies/types/get_plan_trait_response.py +++ b/src/schematic/companies/types/get_plan_trait_response.py @@ -9,7 +9,7 @@ class GetPlanTraitResponse(UniversalBaseModel): data: PlanTraitResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/get_user_response.py b/src/schematic/companies/types/get_user_response.py index d311d5d..69649d4 100644 --- a/src/schematic/companies/types/get_user_response.py +++ b/src/schematic/companies/types/get_user_response.py @@ -9,7 +9,7 @@ class GetUserResponse(UniversalBaseModel): data: UserDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/update_entity_trait_definition_response.py b/src/schematic/companies/types/update_entity_trait_definition_response.py index 7d9426c..e69e40a 100644 --- a/src/schematic/companies/types/update_entity_trait_definition_response.py +++ b/src/schematic/companies/types/update_entity_trait_definition_response.py @@ -9,7 +9,7 @@ class UpdateEntityTraitDefinitionResponse(UniversalBaseModel): data: EntityTraitDefinitionResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/update_plan_trait_response.py b/src/schematic/companies/types/update_plan_trait_response.py index ac74c31..35ce976 100644 --- a/src/schematic/companies/types/update_plan_trait_response.py +++ b/src/schematic/companies/types/update_plan_trait_response.py @@ -9,7 +9,7 @@ class UpdatePlanTraitResponse(UniversalBaseModel): data: PlanTraitResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/update_plan_traits_bulk_response.py b/src/schematic/companies/types/update_plan_traits_bulk_response.py index 667186f..5df41de 100644 --- a/src/schematic/companies/types/update_plan_traits_bulk_response.py +++ b/src/schematic/companies/types/update_plan_traits_bulk_response.py @@ -9,7 +9,7 @@ class UpdatePlanTraitsBulkResponse(UniversalBaseModel): data: typing.List[PlanTraitResponseData] - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/upsert_company_response.py b/src/schematic/companies/types/upsert_company_response.py index 95fa8eb..b7768a4 100644 --- a/src/schematic/companies/types/upsert_company_response.py +++ b/src/schematic/companies/types/upsert_company_response.py @@ -9,7 +9,7 @@ class UpsertCompanyResponse(UniversalBaseModel): data: CompanyDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/upsert_company_trait_response.py b/src/schematic/companies/types/upsert_company_trait_response.py index 5076740..586e937 100644 --- a/src/schematic/companies/types/upsert_company_trait_response.py +++ b/src/schematic/companies/types/upsert_company_trait_response.py @@ -9,7 +9,7 @@ class UpsertCompanyTraitResponse(UniversalBaseModel): data: CompanyDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/upsert_user_response.py b/src/schematic/companies/types/upsert_user_response.py index 273e52f..b6165aa 100644 --- a/src/schematic/companies/types/upsert_user_response.py +++ b/src/schematic/companies/types/upsert_user_response.py @@ -9,7 +9,7 @@ class UpsertUserResponse(UniversalBaseModel): data: UserDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/companies/types/upsert_user_trait_response.py b/src/schematic/companies/types/upsert_user_trait_response.py index 1375052..25f2363 100644 --- a/src/schematic/companies/types/upsert_user_trait_response.py +++ b/src/schematic/companies/types/upsert_user_trait_response.py @@ -9,7 +9,7 @@ class UpsertUserTraitResponse(UniversalBaseModel): data: UserDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/components/types/create_component_response.py b/src/schematic/components/types/create_component_response.py index d66ff08..81ee37d 100644 --- a/src/schematic/components/types/create_component_response.py +++ b/src/schematic/components/types/create_component_response.py @@ -9,7 +9,7 @@ class CreateComponentResponse(UniversalBaseModel): data: ComponentResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/components/types/delete_component_response.py b/src/schematic/components/types/delete_component_response.py index bbca9f1..18c4462 100644 --- a/src/schematic/components/types/delete_component_response.py +++ b/src/schematic/components/types/delete_component_response.py @@ -9,7 +9,7 @@ class DeleteComponentResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/components/types/get_component_response.py b/src/schematic/components/types/get_component_response.py index dc397ac..614271e 100644 --- a/src/schematic/components/types/get_component_response.py +++ b/src/schematic/components/types/get_component_response.py @@ -9,7 +9,7 @@ class GetComponentResponse(UniversalBaseModel): data: ComponentResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/components/types/update_component_response.py b/src/schematic/components/types/update_component_response.py index b09dda6..9bf8b22 100644 --- a/src/schematic/components/types/update_component_response.py +++ b/src/schematic/components/types/update_component_response.py @@ -9,7 +9,7 @@ class UpdateComponentResponse(UniversalBaseModel): data: ComponentResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/core/client_wrapper.py b/src/schematic/core/client_wrapper.py index c2b4506..618be25 100644 --- a/src/schematic/core/client_wrapper.py +++ b/src/schematic/core/client_wrapper.py @@ -22,10 +22,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "schematichq/1.1.4", + "User-Agent": "schematichq/AUTO", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "schematichq", - "X-Fern-SDK-Version": "1.1.4", + "X-Fern-SDK-Version": "1.1.5", **(self.get_custom_headers() or {}), } headers["X-Schematic-Api-Key"] = self.api_key @@ -68,12 +68,22 @@ def __init__( headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, + async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, httpx_client: httpx.AsyncClient, ): super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout) + self._async_token = async_token self.httpx_client = AsyncHttpClient( httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout, base_url=self.get_base_url, + async_base_headers=self.async_get_headers, ) + + async def async_get_headers(self) -> typing.Dict[str, str]: + headers = self.get_headers() + if self._async_token is not None: + token = await self._async_token() + headers["Authorization"] = f"Bearer {token}" + return headers diff --git a/src/schematic/core/http_client.py b/src/schematic/core/http_client.py index e4173f9..fb7cd4e 100644 --- a/src/schematic/core/http_client.py +++ b/src/schematic/core/http_client.py @@ -14,13 +14,13 @@ from .force_multipart import FORCE_MULTIPART from .jsonable_encoder import jsonable_encoder from .query_encoder import encode_query -from .remove_none_from_dict import remove_none_from_dict +from .remove_none_from_dict import remove_none_from_dict as remove_none_from_dict from .request_options import RequestOptions from httpx._types import RequestFiles -INITIAL_RETRY_DELAY_SECONDS = 0.5 -MAX_RETRY_DELAY_SECONDS = 10 -MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 +INITIAL_RETRY_DELAY_SECONDS = 1.0 +MAX_RETRY_DELAY_SECONDS = 60.0 +JITTER_FACTOR = 0.2 # 20% random jitter def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: @@ -64,6 +64,38 @@ def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float return seconds +def _add_positive_jitter(delay: float) -> float: + """Add positive jitter (0-20%) to prevent thundering herd.""" + jitter_multiplier = 1 + random() * JITTER_FACTOR + return delay * jitter_multiplier + + +def _add_symmetric_jitter(delay: float) -> float: + """Add symmetric jitter (±10%) for exponential backoff.""" + jitter_multiplier = 1 + (random() - 0.5) * JITTER_FACTOR + return delay * jitter_multiplier + + +def _parse_x_ratelimit_reset(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + Parse the X-RateLimit-Reset header (Unix timestamp in seconds). + Returns seconds to wait, or None if header is missing/invalid. + """ + reset_time_str = response_headers.get("x-ratelimit-reset") + if reset_time_str is None: + return None + + try: + reset_time = int(reset_time_str) + delay = reset_time - time.time() + if delay > 0: + return delay + except (ValueError, TypeError): + pass + + return None + + def _retry_timeout(response: httpx.Response, retries: int) -> float: """ Determine the amount of time to wait before retrying a request. @@ -71,17 +103,19 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float: with a jitter to determine the number of seconds to wait. """ - # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + # 1. Check Retry-After header first retry_after = _parse_retry_after(response.headers) - if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: - return retry_after + if retry_after is not None and retry_after > 0: + return min(retry_after, MAX_RETRY_DELAY_SECONDS) - # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. - retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + # 2. Check X-RateLimit-Reset header (with positive jitter) + ratelimit_reset = _parse_x_ratelimit_reset(response.headers) + if ratelimit_reset is not None: + return _add_positive_jitter(min(ratelimit_reset, MAX_RETRY_DELAY_SECONDS)) - # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. - timeout = retry_delay * (1 - 0.25 * random()) - return timeout if timeout >= 0 else 0 + # 3. Fall back to exponential backoff (with symmetric jitter) + backoff = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + return _add_symmetric_jitter(backoff) def _should_retry(response: httpx.Response) -> bool: @@ -89,6 +123,21 @@ def _should_retry(response: httpx.Response) -> bool: return response.status_code >= 500 or response.status_code in retryable_400s +def _maybe_filter_none_from_multipart_data( + data: typing.Optional[typing.Any], + request_files: typing.Optional[RequestFiles], + force_multipart: typing.Optional[bool], +) -> typing.Optional[typing.Any]: + """ + Filter None values from data body for multipart/form requests. + This prevents httpx from converting None to empty strings in multipart encoding. + Only applies when files are present or force_multipart is True. + """ + if data is not None and isinstance(data, typing.Mapping) and (request_files or force_multipart): + return remove_none_from_dict(data) + return data + + def remove_omit_from_dict( original: typing.Dict[str, typing.Optional[typing.Any]], omit: typing.Optional[typing.Any], @@ -143,8 +192,19 @@ def get_request_body( # If both data and json are None, we send json data in the event extra properties are specified json_body = maybe_filter_request_body(json, request_options, omit) - # If you have an empty JSON body, you should just send None - return (json_body if json_body != {} else None), data_body if data_body != {} else None + has_additional_body_parameters = bool( + request_options is not None and request_options.get("additional_body_parameters") + ) + + # Only collapse empty dict to None when the body was not explicitly provided + # and there are no additional body parameters. This preserves explicit empty + # bodies (e.g., when an endpoint has a request body type but all fields are optional). + if json_body == {} and json is None and not has_additional_body_parameters: + json_body = None + if data_body == {} and data is None and not has_additional_body_parameters: + data_body = None + + return json_body, data_body class HttpClient: @@ -188,7 +248,7 @@ def request( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> httpx.Response: @@ -210,6 +270,28 @@ def request( if (request_files is None or len(request_files) == 0) and force_multipart: request_files = FORCE_MULTIPART + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + response = self.httpx_client.request( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -222,23 +304,7 @@ def request( } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) or {} - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -246,9 +312,9 @@ def request( timeout=timeout, ) - max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 if _should_retry(response=response): - if max_retries > retries: + if retries < max_retries: time.sleep(_retry_timeout(response=response, retries=retries)) return self.request( path=path, @@ -285,7 +351,7 @@ def stream( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> typing.Iterator[httpx.Response]: @@ -307,6 +373,28 @@ def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -319,23 +407,7 @@ def stream( } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -353,12 +425,19 @@ def __init__( base_timeout: typing.Callable[[], typing.Optional[float]], base_headers: typing.Callable[[], typing.Dict[str, str]], base_url: typing.Optional[typing.Callable[[], str]] = None, + async_base_headers: typing.Optional[typing.Callable[[], typing.Awaitable[typing.Dict[str, str]]]] = None, ): self.base_url = base_url self.base_timeout = base_timeout self.base_headers = base_headers + self.async_base_headers = async_base_headers self.httpx_client = httpx_client + async def _get_headers(self) -> typing.Dict[str, str]: + if self.async_base_headers is not None: + return await self.async_base_headers() + return self.base_headers() + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: base_url = maybe_base_url if self.base_url is not None and base_url is None: @@ -386,7 +465,7 @@ async def request( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> httpx.Response: @@ -408,6 +487,31 @@ async def request( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + # Add the input to each of these and do None-safety checks response = await self.httpx_client.request( method=method, @@ -415,29 +519,13 @@ async def request( headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) or {} - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -445,9 +533,9 @@ async def request( timeout=timeout, ) - max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 if _should_retry(response=response): - if max_retries > retries: + if retries < max_retries: await asyncio.sleep(_retry_timeout(response=response, retries=retries)) return await self.request( path=path, @@ -483,7 +571,7 @@ async def stream( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> typing.AsyncIterator[httpx.Response]: @@ -505,35 +593,44 @@ async def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit=omit, + ) + ) + ) + ) + async with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) if request_options is not None else {}), } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) - if request_options is not None - else {} - ), - }, - omit=omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, diff --git a/src/schematic/core/pydantic_utilities.py b/src/schematic/core/pydantic_utilities.py index 8906cdf..185e5c4 100644 --- a/src/schematic/core/pydantic_utilities.py +++ b/src/schematic/core/pydantic_utilities.py @@ -220,7 +220,9 @@ def universal_root_validator( ) -> Callable[[AnyCallable], AnyCallable]: def decorator(func: AnyCallable) -> AnyCallable: if IS_PYDANTIC_V2: - return cast(AnyCallable, pydantic.model_validator(mode="before" if pre else "after")(func)) # type: ignore[attr-defined] + # In Pydantic v2, for RootModel we always use "before" mode + # The custom validators transform the input value before the model is created + return cast(AnyCallable, pydantic.model_validator(mode="before")(func)) # type: ignore[attr-defined] return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload] return decorator diff --git a/src/schematic/credits/types/create_billing_credit_response.py b/src/schematic/credits/types/create_billing_credit_response.py index 08086e1..d9e0b6e 100644 --- a/src/schematic/credits/types/create_billing_credit_response.py +++ b/src/schematic/credits/types/create_billing_credit_response.py @@ -9,7 +9,7 @@ class CreateBillingCreditResponse(UniversalBaseModel): data: BillingCreditResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/create_billing_plan_credit_grant_response.py b/src/schematic/credits/types/create_billing_plan_credit_grant_response.py index 4f81731..7d6f6ff 100644 --- a/src/schematic/credits/types/create_billing_plan_credit_grant_response.py +++ b/src/schematic/credits/types/create_billing_plan_credit_grant_response.py @@ -9,7 +9,7 @@ class CreateBillingPlanCreditGrantResponse(UniversalBaseModel): data: BillingPlanCreditGrantResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/create_credit_bundle_response.py b/src/schematic/credits/types/create_credit_bundle_response.py index b86f9f7..65332bc 100644 --- a/src/schematic/credits/types/create_credit_bundle_response.py +++ b/src/schematic/credits/types/create_credit_bundle_response.py @@ -9,7 +9,7 @@ class CreateCreditBundleResponse(UniversalBaseModel): data: BillingCreditBundleResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/delete_credit_bundle_response.py b/src/schematic/credits/types/delete_credit_bundle_response.py index cc1ad0c..04ab628 100644 --- a/src/schematic/credits/types/delete_credit_bundle_response.py +++ b/src/schematic/credits/types/delete_credit_bundle_response.py @@ -9,7 +9,7 @@ class DeleteCreditBundleResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/get_credit_bundle_response.py b/src/schematic/credits/types/get_credit_bundle_response.py index 1ae3cfe..fd9f353 100644 --- a/src/schematic/credits/types/get_credit_bundle_response.py +++ b/src/schematic/credits/types/get_credit_bundle_response.py @@ -9,7 +9,7 @@ class GetCreditBundleResponse(UniversalBaseModel): data: BillingCreditBundleResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/get_single_billing_credit_response.py b/src/schematic/credits/types/get_single_billing_credit_response.py index 3223738..673ebbe 100644 --- a/src/schematic/credits/types/get_single_billing_credit_response.py +++ b/src/schematic/credits/types/get_single_billing_credit_response.py @@ -9,7 +9,7 @@ class GetSingleBillingCreditResponse(UniversalBaseModel): data: BillingCreditResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/grant_billing_credits_to_company_response.py b/src/schematic/credits/types/grant_billing_credits_to_company_response.py index decaf23..96406d8 100644 --- a/src/schematic/credits/types/grant_billing_credits_to_company_response.py +++ b/src/schematic/credits/types/grant_billing_credits_to_company_response.py @@ -9,7 +9,7 @@ class GrantBillingCreditsToCompanyResponse(UniversalBaseModel): data: BillingCreditGrantResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/soft_delete_billing_credit_response.py b/src/schematic/credits/types/soft_delete_billing_credit_response.py index 4b910b7..f0d2953 100644 --- a/src/schematic/credits/types/soft_delete_billing_credit_response.py +++ b/src/schematic/credits/types/soft_delete_billing_credit_response.py @@ -9,7 +9,7 @@ class SoftDeleteBillingCreditResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/update_billing_credit_response.py b/src/schematic/credits/types/update_billing_credit_response.py index 52bed43..566fed5 100644 --- a/src/schematic/credits/types/update_billing_credit_response.py +++ b/src/schematic/credits/types/update_billing_credit_response.py @@ -9,7 +9,7 @@ class UpdateBillingCreditResponse(UniversalBaseModel): data: BillingCreditResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/update_billing_plan_credit_grant_response.py b/src/schematic/credits/types/update_billing_plan_credit_grant_response.py index 3f0fda2..0be32a4 100644 --- a/src/schematic/credits/types/update_billing_plan_credit_grant_response.py +++ b/src/schematic/credits/types/update_billing_plan_credit_grant_response.py @@ -9,7 +9,7 @@ class UpdateBillingPlanCreditGrantResponse(UniversalBaseModel): data: BillingPlanCreditGrantResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/update_credit_bundle_details_response.py b/src/schematic/credits/types/update_credit_bundle_details_response.py index a88f62d..9bed3a0 100644 --- a/src/schematic/credits/types/update_credit_bundle_details_response.py +++ b/src/schematic/credits/types/update_credit_bundle_details_response.py @@ -9,7 +9,7 @@ class UpdateCreditBundleDetailsResponse(UniversalBaseModel): data: BillingCreditBundleResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/credits/types/zero_out_grant_response.py b/src/schematic/credits/types/zero_out_grant_response.py index 33a3018..daa1c26 100644 --- a/src/schematic/credits/types/zero_out_grant_response.py +++ b/src/schematic/credits/types/zero_out_grant_response.py @@ -9,7 +9,7 @@ class ZeroOutGrantResponse(UniversalBaseModel): data: BillingCreditGrantResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/crm/__init__.py b/src/schematic/crm/__init__.py deleted file mode 100644 index 29b0fc3..0000000 --- a/src/schematic/crm/__init__.py +++ /dev/null @@ -1,55 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .types import ( - ListCrmProductsParams, - ListCrmProductsResponse, - UpsertCrmDealResponse, - UpsertCrmProductResponse, - UpsertDealLineItemAssociationResponse, - UpsertLineItemResponse, - ) -_dynamic_imports: typing.Dict[str, str] = { - "ListCrmProductsParams": ".types", - "ListCrmProductsResponse": ".types", - "UpsertCrmDealResponse": ".types", - "UpsertCrmProductResponse": ".types", - "UpsertDealLineItemAssociationResponse": ".types", - "UpsertLineItemResponse": ".types", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListCrmProductsParams", - "ListCrmProductsResponse", - "UpsertCrmDealResponse", - "UpsertCrmProductResponse", - "UpsertDealLineItemAssociationResponse", - "UpsertLineItemResponse", -] diff --git a/src/schematic/crm/client.py b/src/schematic/crm/client.py deleted file mode 100644 index d365041..0000000 --- a/src/schematic/crm/client.py +++ /dev/null @@ -1,683 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ..core.request_options import RequestOptions -from .raw_client import AsyncRawCrmClient, RawCrmClient -from .types.list_crm_products_response import ListCrmProductsResponse -from .types.upsert_crm_deal_response import UpsertCrmDealResponse -from .types.upsert_crm_product_response import UpsertCrmProductResponse -from .types.upsert_deal_line_item_association_response import UpsertDealLineItemAssociationResponse -from .types.upsert_line_item_response import UpsertLineItemResponse - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class CrmClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawCrmClient(client_wrapper=client_wrapper) - - @property - def with_raw_response(self) -> RawCrmClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawCrmClient - """ - return self._raw_client - - def upsert_deal_line_item_association( - self, - *, - deal_external_id: str, - line_item_external_id: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertDealLineItemAssociationResponse: - """ - Parameters - ---------- - deal_external_id : str - - line_item_external_id : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertDealLineItemAssociationResponse - Created - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.crm.upsert_deal_line_item_association( - deal_external_id="deal_external_id", - line_item_external_id="line_item_external_id", - ) - """ - _response = self._raw_client.upsert_deal_line_item_association( - deal_external_id=deal_external_id, - line_item_external_id=line_item_external_id, - request_options=request_options, - ) - return _response.data - - def upsert_line_item( - self, - *, - amount: str, - interval: str, - line_item_external_id: str, - product_external_id: str, - quantity: int, - discount_percentage: typing.Optional[str] = OMIT, - term_month: typing.Optional[int] = OMIT, - total_discount: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertLineItemResponse: - """ - Parameters - ---------- - amount : str - - interval : str - - line_item_external_id : str - - product_external_id : str - - quantity : int - - discount_percentage : typing.Optional[str] - - term_month : typing.Optional[int] - - total_discount : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertLineItemResponse - Created - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.crm.upsert_line_item( - amount="amount", - interval="interval", - line_item_external_id="line_item_external_id", - product_external_id="product_external_id", - quantity=1, - ) - """ - _response = self._raw_client.upsert_line_item( - amount=amount, - interval=interval, - line_item_external_id=line_item_external_id, - product_external_id=product_external_id, - quantity=quantity, - discount_percentage=discount_percentage, - term_month=term_month, - total_discount=total_discount, - request_options=request_options, - ) - return _response.data - - def upsert_crm_deal( - self, - *, - crm_company_key: str, - crm_type: str, - deal_external_id: str, - arr: typing.Optional[str] = OMIT, - crm_company_id: typing.Optional[str] = OMIT, - crm_product_id: typing.Optional[str] = OMIT, - deal_name: typing.Optional[str] = OMIT, - deal_stage: typing.Optional[str] = OMIT, - mrr: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertCrmDealResponse: - """ - Parameters - ---------- - crm_company_key : str - - crm_type : str - - deal_external_id : str - - arr : typing.Optional[str] - - crm_company_id : typing.Optional[str] - - crm_product_id : typing.Optional[str] - - deal_name : typing.Optional[str] - - deal_stage : typing.Optional[str] - - mrr : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertCrmDealResponse - Created - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.crm.upsert_crm_deal( - crm_company_key="crm_company_key", - crm_type="crm_type", - deal_external_id="deal_external_id", - ) - """ - _response = self._raw_client.upsert_crm_deal( - crm_company_key=crm_company_key, - crm_type=crm_type, - deal_external_id=deal_external_id, - arr=arr, - crm_company_id=crm_company_id, - crm_product_id=crm_product_id, - deal_name=deal_name, - deal_stage=deal_stage, - mrr=mrr, - request_options=request_options, - ) - return _response.data - - def list_crm_products( - 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, - ) -> ListCrmProductsResponse: - """ - 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 - ------- - ListCrmProductsResponse - OK - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.crm.list_crm_products( - name="name", - limit=1, - offset=1, - ) - """ - _response = self._raw_client.list_crm_products( - ids=ids, name=name, limit=limit, offset=offset, request_options=request_options - ) - return _response.data - - def upsert_crm_product( - self, - *, - currency: str, - description: str, - external_id: str, - interval: str, - name: str, - price: str, - quantity: int, - sku: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertCrmProductResponse: - """ - Parameters - ---------- - currency : str - - description : str - - external_id : str - - interval : str - - name : str - - price : str - - quantity : int - - sku : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertCrmProductResponse - Created - - Examples - -------- - from schematic import Schematic - - client = Schematic( - api_key="YOUR_API_KEY", - ) - client.crm.upsert_crm_product( - currency="currency", - description="description", - external_id="external_id", - interval="interval", - name="name", - price="price", - quantity=1, - sku="sku", - ) - """ - _response = self._raw_client.upsert_crm_product( - currency=currency, - description=description, - external_id=external_id, - interval=interval, - name=name, - price=price, - quantity=quantity, - sku=sku, - request_options=request_options, - ) - return _response.data - - -class AsyncCrmClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawCrmClient(client_wrapper=client_wrapper) - - @property - def with_raw_response(self) -> AsyncRawCrmClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawCrmClient - """ - return self._raw_client - - async def upsert_deal_line_item_association( - self, - *, - deal_external_id: str, - line_item_external_id: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertDealLineItemAssociationResponse: - """ - Parameters - ---------- - deal_external_id : str - - line_item_external_id : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertDealLineItemAssociationResponse - Created - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.crm.upsert_deal_line_item_association( - deal_external_id="deal_external_id", - line_item_external_id="line_item_external_id", - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.upsert_deal_line_item_association( - deal_external_id=deal_external_id, - line_item_external_id=line_item_external_id, - request_options=request_options, - ) - return _response.data - - async def upsert_line_item( - self, - *, - amount: str, - interval: str, - line_item_external_id: str, - product_external_id: str, - quantity: int, - discount_percentage: typing.Optional[str] = OMIT, - term_month: typing.Optional[int] = OMIT, - total_discount: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertLineItemResponse: - """ - Parameters - ---------- - amount : str - - interval : str - - line_item_external_id : str - - product_external_id : str - - quantity : int - - discount_percentage : typing.Optional[str] - - term_month : typing.Optional[int] - - total_discount : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertLineItemResponse - Created - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.crm.upsert_line_item( - amount="amount", - interval="interval", - line_item_external_id="line_item_external_id", - product_external_id="product_external_id", - quantity=1, - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.upsert_line_item( - amount=amount, - interval=interval, - line_item_external_id=line_item_external_id, - product_external_id=product_external_id, - quantity=quantity, - discount_percentage=discount_percentage, - term_month=term_month, - total_discount=total_discount, - request_options=request_options, - ) - return _response.data - - async def upsert_crm_deal( - self, - *, - crm_company_key: str, - crm_type: str, - deal_external_id: str, - arr: typing.Optional[str] = OMIT, - crm_company_id: typing.Optional[str] = OMIT, - crm_product_id: typing.Optional[str] = OMIT, - deal_name: typing.Optional[str] = OMIT, - deal_stage: typing.Optional[str] = OMIT, - mrr: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertCrmDealResponse: - """ - Parameters - ---------- - crm_company_key : str - - crm_type : str - - deal_external_id : str - - arr : typing.Optional[str] - - crm_company_id : typing.Optional[str] - - crm_product_id : typing.Optional[str] - - deal_name : typing.Optional[str] - - deal_stage : typing.Optional[str] - - mrr : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertCrmDealResponse - Created - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.crm.upsert_crm_deal( - crm_company_key="crm_company_key", - crm_type="crm_type", - deal_external_id="deal_external_id", - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.upsert_crm_deal( - crm_company_key=crm_company_key, - crm_type=crm_type, - deal_external_id=deal_external_id, - arr=arr, - crm_company_id=crm_company_id, - crm_product_id=crm_product_id, - deal_name=deal_name, - deal_stage=deal_stage, - mrr=mrr, - request_options=request_options, - ) - return _response.data - - async def list_crm_products( - 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, - ) -> ListCrmProductsResponse: - """ - 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 - ------- - ListCrmProductsResponse - OK - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.crm.list_crm_products( - name="name", - limit=1, - offset=1, - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.list_crm_products( - ids=ids, name=name, limit=limit, offset=offset, request_options=request_options - ) - return _response.data - - async def upsert_crm_product( - self, - *, - currency: str, - description: str, - external_id: str, - interval: str, - name: str, - price: str, - quantity: int, - sku: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> UpsertCrmProductResponse: - """ - Parameters - ---------- - currency : str - - description : str - - external_id : str - - interval : str - - name : str - - price : str - - quantity : int - - sku : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - UpsertCrmProductResponse - Created - - Examples - -------- - import asyncio - - from schematic import AsyncSchematic - - client = AsyncSchematic( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.crm.upsert_crm_product( - currency="currency", - description="description", - external_id="external_id", - interval="interval", - name="name", - price="price", - quantity=1, - sku="sku", - ) - - - asyncio.run(main()) - """ - _response = await self._raw_client.upsert_crm_product( - currency=currency, - description=description, - external_id=external_id, - interval=interval, - name=name, - price=price, - quantity=quantity, - sku=sku, - request_options=request_options, - ) - return _response.data diff --git a/src/schematic/crm/raw_client.py b/src/schematic/crm/raw_client.py deleted file mode 100644 index 2448c07..0000000 --- a/src/schematic/crm/raw_client.py +++ /dev/null @@ -1,1288 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from json.decoder import JSONDecodeError - -from ..core.api_error import ApiError as core_api_error_ApiError -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ..core.http_response import AsyncHttpResponse, HttpResponse -from ..core.pydantic_utilities import parse_obj_as -from ..core.request_options import RequestOptions -from ..errors.bad_request_error import BadRequestError -from ..errors.forbidden_error import ForbiddenError -from ..errors.internal_server_error import InternalServerError -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.list_crm_products_response import ListCrmProductsResponse -from .types.upsert_crm_deal_response import UpsertCrmDealResponse -from .types.upsert_crm_product_response import UpsertCrmProductResponse -from .types.upsert_deal_line_item_association_response import UpsertDealLineItemAssociationResponse -from .types.upsert_line_item_response import UpsertLineItemResponse - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class RawCrmClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def upsert_deal_line_item_association( - self, - *, - deal_external_id: str, - line_item_external_id: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[UpsertDealLineItemAssociationResponse]: - """ - Parameters - ---------- - deal_external_id : str - - line_item_external_id : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[UpsertDealLineItemAssociationResponse] - Created - """ - _response = self._client_wrapper.httpx_client.request( - "crm/associations/deal-line-item", - method="POST", - json={ - "deal_external_id": deal_external_id, - "line_item_external_id": line_item_external_id, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertDealLineItemAssociationResponse, - parse_obj_as( - type_=UpsertDealLineItemAssociationResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - def upsert_line_item( - self, - *, - amount: str, - interval: str, - line_item_external_id: str, - product_external_id: str, - quantity: int, - discount_percentage: typing.Optional[str] = OMIT, - term_month: typing.Optional[int] = OMIT, - total_discount: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[UpsertLineItemResponse]: - """ - Parameters - ---------- - amount : str - - interval : str - - line_item_external_id : str - - product_external_id : str - - quantity : int - - discount_percentage : typing.Optional[str] - - term_month : typing.Optional[int] - - total_discount : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[UpsertLineItemResponse] - Created - """ - _response = self._client_wrapper.httpx_client.request( - "crm/deal-line-item/upsert", - method="POST", - json={ - "amount": amount, - "discount_percentage": discount_percentage, - "interval": interval, - "line_item_external_id": line_item_external_id, - "product_external_id": product_external_id, - "quantity": quantity, - "term_month": term_month, - "total_discount": total_discount, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertLineItemResponse, - parse_obj_as( - type_=UpsertLineItemResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - def upsert_crm_deal( - self, - *, - crm_company_key: str, - crm_type: str, - deal_external_id: str, - arr: typing.Optional[str] = OMIT, - crm_company_id: typing.Optional[str] = OMIT, - crm_product_id: typing.Optional[str] = OMIT, - deal_name: typing.Optional[str] = OMIT, - deal_stage: typing.Optional[str] = OMIT, - mrr: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[UpsertCrmDealResponse]: - """ - Parameters - ---------- - crm_company_key : str - - crm_type : str - - deal_external_id : str - - arr : typing.Optional[str] - - crm_company_id : typing.Optional[str] - - crm_product_id : typing.Optional[str] - - deal_name : typing.Optional[str] - - deal_stage : typing.Optional[str] - - mrr : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[UpsertCrmDealResponse] - Created - """ - _response = self._client_wrapper.httpx_client.request( - "crm/deals/upsert", - method="POST", - json={ - "arr": arr, - "crm_company_id": crm_company_id, - "crm_company_key": crm_company_key, - "crm_product_id": crm_product_id, - "crm_type": crm_type, - "deal_external_id": deal_external_id, - "deal_name": deal_name, - "deal_stage": deal_stage, - "mrr": mrr, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertCrmDealResponse, - parse_obj_as( - type_=UpsertCrmDealResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - def list_crm_products( - 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, - ) -> HttpResponse[ListCrmProductsResponse]: - """ - 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 - ------- - HttpResponse[ListCrmProductsResponse] - OK - """ - _response = self._client_wrapper.httpx_client.request( - "crm/products", - 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( - ListCrmProductsResponse, - parse_obj_as( - type_=ListCrmProductsResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - def upsert_crm_product( - self, - *, - currency: str, - description: str, - external_id: str, - interval: str, - name: str, - price: str, - quantity: int, - sku: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> HttpResponse[UpsertCrmProductResponse]: - """ - Parameters - ---------- - currency : str - - description : str - - external_id : str - - interval : str - - name : str - - price : str - - quantity : int - - sku : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - HttpResponse[UpsertCrmProductResponse] - Created - """ - _response = self._client_wrapper.httpx_client.request( - "crm/products/upsert", - method="POST", - json={ - "currency": currency, - "description": description, - "external_id": external_id, - "interval": interval, - "name": name, - "price": price, - "quantity": quantity, - "sku": sku, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertCrmProductResponse, - parse_obj_as( - type_=UpsertCrmProductResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - -class AsyncRawCrmClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def upsert_deal_line_item_association( - self, - *, - deal_external_id: str, - line_item_external_id: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpsertDealLineItemAssociationResponse]: - """ - Parameters - ---------- - deal_external_id : str - - line_item_external_id : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[UpsertDealLineItemAssociationResponse] - Created - """ - _response = await self._client_wrapper.httpx_client.request( - "crm/associations/deal-line-item", - method="POST", - json={ - "deal_external_id": deal_external_id, - "line_item_external_id": line_item_external_id, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertDealLineItemAssociationResponse, - parse_obj_as( - type_=UpsertDealLineItemAssociationResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - async def upsert_line_item( - self, - *, - amount: str, - interval: str, - line_item_external_id: str, - product_external_id: str, - quantity: int, - discount_percentage: typing.Optional[str] = OMIT, - term_month: typing.Optional[int] = OMIT, - total_discount: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpsertLineItemResponse]: - """ - Parameters - ---------- - amount : str - - interval : str - - line_item_external_id : str - - product_external_id : str - - quantity : int - - discount_percentage : typing.Optional[str] - - term_month : typing.Optional[int] - - total_discount : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[UpsertLineItemResponse] - Created - """ - _response = await self._client_wrapper.httpx_client.request( - "crm/deal-line-item/upsert", - method="POST", - json={ - "amount": amount, - "discount_percentage": discount_percentage, - "interval": interval, - "line_item_external_id": line_item_external_id, - "product_external_id": product_external_id, - "quantity": quantity, - "term_month": term_month, - "total_discount": total_discount, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertLineItemResponse, - parse_obj_as( - type_=UpsertLineItemResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - async def upsert_crm_deal( - self, - *, - crm_company_key: str, - crm_type: str, - deal_external_id: str, - arr: typing.Optional[str] = OMIT, - crm_company_id: typing.Optional[str] = OMIT, - crm_product_id: typing.Optional[str] = OMIT, - deal_name: typing.Optional[str] = OMIT, - deal_stage: typing.Optional[str] = OMIT, - mrr: typing.Optional[str] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpsertCrmDealResponse]: - """ - Parameters - ---------- - crm_company_key : str - - crm_type : str - - deal_external_id : str - - arr : typing.Optional[str] - - crm_company_id : typing.Optional[str] - - crm_product_id : typing.Optional[str] - - deal_name : typing.Optional[str] - - deal_stage : typing.Optional[str] - - mrr : typing.Optional[str] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[UpsertCrmDealResponse] - Created - """ - _response = await self._client_wrapper.httpx_client.request( - "crm/deals/upsert", - method="POST", - json={ - "arr": arr, - "crm_company_id": crm_company_id, - "crm_company_key": crm_company_key, - "crm_product_id": crm_product_id, - "crm_type": crm_type, - "deal_external_id": deal_external_id, - "deal_name": deal_name, - "deal_stage": deal_stage, - "mrr": mrr, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertCrmDealResponse, - parse_obj_as( - type_=UpsertCrmDealResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - async def list_crm_products( - 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[ListCrmProductsResponse]: - """ - 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[ListCrmProductsResponse] - OK - """ - _response = await self._client_wrapper.httpx_client.request( - "crm/products", - 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( - ListCrmProductsResponse, - parse_obj_as( - type_=ListCrmProductsResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) - - async def upsert_crm_product( - self, - *, - currency: str, - description: str, - external_id: str, - interval: str, - name: str, - price: str, - quantity: int, - sku: str, - request_options: typing.Optional[RequestOptions] = None, - ) -> AsyncHttpResponse[UpsertCrmProductResponse]: - """ - Parameters - ---------- - currency : str - - description : str - - external_id : str - - interval : str - - name : str - - price : str - - quantity : int - - sku : str - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncHttpResponse[UpsertCrmProductResponse] - Created - """ - _response = await self._client_wrapper.httpx_client.request( - "crm/products/upsert", - method="POST", - json={ - "currency": currency, - "description": description, - "external_id": external_id, - "interval": interval, - "name": name, - "price": price, - "quantity": quantity, - "sku": sku, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - _data = typing.cast( - UpsertCrmProductResponse, - parse_obj_as( - type_=UpsertCrmProductResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) - if _response.status_code == 400: - raise BadRequestError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 401: - raise UnauthorizedError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 403: - raise ForbiddenError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 404: - raise NotFoundError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - if _response.status_code == 500: - raise InternalServerError( - headers=dict(_response.headers), - body=typing.cast( - types_api_error_ApiError, - parse_obj_as( - type_=types_api_error_ApiError, # type: ignore - object_=_response.json(), - ), - ), - ) - _response_json = _response.json() - except JSONDecodeError: - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response.text - ) - raise core_api_error_ApiError( - status_code=_response.status_code, headers=dict(_response.headers), body=_response_json - ) diff --git a/src/schematic/crm/types/__init__.py b/src/schematic/crm/types/__init__.py deleted file mode 100644 index 42391f1..0000000 --- a/src/schematic/crm/types/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .list_crm_products_params import ListCrmProductsParams - from .list_crm_products_response import ListCrmProductsResponse - from .upsert_crm_deal_response import UpsertCrmDealResponse - from .upsert_crm_product_response import UpsertCrmProductResponse - from .upsert_deal_line_item_association_response import UpsertDealLineItemAssociationResponse - from .upsert_line_item_response import UpsertLineItemResponse -_dynamic_imports: typing.Dict[str, str] = { - "ListCrmProductsParams": ".list_crm_products_params", - "ListCrmProductsResponse": ".list_crm_products_response", - "UpsertCrmDealResponse": ".upsert_crm_deal_response", - "UpsertCrmProductResponse": ".upsert_crm_product_response", - "UpsertDealLineItemAssociationResponse": ".upsert_deal_line_item_association_response", - "UpsertLineItemResponse": ".upsert_line_item_response", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListCrmProductsParams", - "ListCrmProductsResponse", - "UpsertCrmDealResponse", - "UpsertCrmProductResponse", - "UpsertDealLineItemAssociationResponse", - "UpsertLineItemResponse", -] diff --git a/src/schematic/crm/types/list_crm_products_params.py b/src/schematic/crm/types/list_crm_products_params.py deleted file mode 100644 index 3f265bb..0000000 --- a/src/schematic/crm/types/list_crm_products_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListCrmProductsParams(UniversalBaseModel): - """ - Input parameters - """ - - ids: typing.Optional[typing.List[str]] = None - limit: typing.Optional[int] = pydantic.Field(default=None) - """ - Page limit (default 100) - """ - - name: typing.Optional[str] = None - offset: typing.Optional[int] = pydantic.Field(default=None) - """ - Page offset (default 0) - """ - - 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/crm/types/list_crm_products_response.py b/src/schematic/crm/types/list_crm_products_response.py deleted file mode 100644 index 435f06a..0000000 --- a/src/schematic/crm/types/list_crm_products_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.crm_product_response_data import CrmProductResponseData -from .list_crm_products_params import ListCrmProductsParams - - -class ListCrmProductsResponse(UniversalBaseModel): - data: typing.List[CrmProductResponseData] - params: ListCrmProductsParams = 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/crm/types/upsert_crm_deal_response.py b/src/schematic/crm/types/upsert_crm_deal_response.py deleted file mode 100644 index b82f6a9..0000000 --- a/src/schematic/crm/types/upsert_crm_deal_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.crm_deal_response_data import CrmDealResponseData - - -class UpsertCrmDealResponse(UniversalBaseModel): - data: CrmDealResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/crm/types/upsert_crm_product_response.py b/src/schematic/crm/types/upsert_crm_product_response.py deleted file mode 100644 index cd9c87e..0000000 --- a/src/schematic/crm/types/upsert_crm_product_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.crm_product_response_data import CrmProductResponseData - - -class UpsertCrmProductResponse(UniversalBaseModel): - data: CrmProductResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/crm/types/upsert_deal_line_item_association_response.py b/src/schematic/crm/types/upsert_deal_line_item_association_response.py deleted file mode 100644 index b3f0e0f..0000000 --- a/src/schematic/crm/types/upsert_deal_line_item_association_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.crm_line_item_response_data import CrmLineItemResponseData - - -class UpsertDealLineItemAssociationResponse(UniversalBaseModel): - data: CrmLineItemResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/crm/types/upsert_line_item_response.py b/src/schematic/crm/types/upsert_line_item_response.py deleted file mode 100644 index 6a6ec4f..0000000 --- a/src/schematic/crm/types/upsert_line_item_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from ...types.crm_line_item_response_data import CrmLineItemResponseData - - -class UpsertLineItemResponse(UniversalBaseModel): - data: CrmLineItemResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() - """ - Input parameters - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/schematic/dataexports/types/create_data_export_response.py b/src/schematic/dataexports/types/create_data_export_response.py index d2bf929..8cb0325 100644 --- a/src/schematic/dataexports/types/create_data_export_response.py +++ b/src/schematic/dataexports/types/create_data_export_response.py @@ -9,7 +9,7 @@ class CreateDataExportResponse(UniversalBaseModel): data: DataExportResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/client.py b/src/schematic/entitlements/client.py index 2661564..fbd8ad2 100644 --- a/src/schematic/entitlements/client.py +++ b/src/schematic/entitlements/client.py @@ -556,6 +556,7 @@ def list_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -571,6 +572,9 @@ def list_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -598,6 +602,7 @@ def list_feature_usage( ) client.entitlements.list_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -608,6 +613,7 @@ def list_feature_usage( company_id=company_id, company_keys=company_keys, feature_ids=feature_ids, + include_usage_aggregation=include_usage_aggregation, q=q, without_negative_entitlements=without_negative_entitlements, limit=limit, @@ -622,6 +628,7 @@ def count_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -637,6 +644,9 @@ def count_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -664,6 +674,7 @@ def count_feature_usage( ) client.entitlements.count_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -674,6 +685,7 @@ def count_feature_usage( company_id=company_id, company_keys=company_keys, feature_ids=feature_ids, + include_usage_aggregation=include_usage_aggregation, q=q, without_negative_entitlements=without_negative_entitlements, limit=limit, @@ -1916,6 +1928,7 @@ async def list_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -1931,6 +1944,9 @@ async def list_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -1963,6 +1979,7 @@ async def list_feature_usage( async def main() -> None: await client.entitlements.list_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -1976,6 +1993,7 @@ async def main() -> None: company_id=company_id, company_keys=company_keys, feature_ids=feature_ids, + include_usage_aggregation=include_usage_aggregation, q=q, without_negative_entitlements=without_negative_entitlements, limit=limit, @@ -1990,6 +2008,7 @@ async def count_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -2005,6 +2024,9 @@ async def count_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -2037,6 +2059,7 @@ async def count_feature_usage( async def main() -> None: await client.entitlements.count_feature_usage( company_id="company_id", + include_usage_aggregation=True, q="q", without_negative_entitlements=True, limit=1, @@ -2050,6 +2073,7 @@ async def main() -> None: company_id=company_id, company_keys=company_keys, feature_ids=feature_ids, + include_usage_aggregation=include_usage_aggregation, q=q, without_negative_entitlements=without_negative_entitlements, limit=limit, diff --git a/src/schematic/entitlements/raw_client.py b/src/schematic/entitlements/raw_client.py index 7ef2555..51f8dff 100644 --- a/src/schematic/entitlements/raw_client.py +++ b/src/schematic/entitlements/raw_client.py @@ -1061,6 +1061,7 @@ def list_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -1076,6 +1077,9 @@ def list_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -1101,6 +1105,7 @@ def list_feature_usage( "company_id": company_id, "company_keys": company_keys, "feature_ids": feature_ids, + "include_usage_aggregation": include_usage_aggregation, "q": q, "without_negative_entitlements": without_negative_entitlements, "limit": limit, @@ -1188,6 +1193,7 @@ def count_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -1203,6 +1209,9 @@ def count_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -1228,6 +1237,7 @@ def count_feature_usage( "company_id": company_id, "company_keys": company_keys, "feature_ids": feature_ids, + "include_usage_aggregation": include_usage_aggregation, "q": q, "without_negative_entitlements": without_negative_entitlements, "limit": limit, @@ -3625,6 +3635,7 @@ async def list_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -3640,6 +3651,9 @@ async def list_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -3665,6 +3679,7 @@ async def list_feature_usage( "company_id": company_id, "company_keys": company_keys, "feature_ids": feature_ids, + "include_usage_aggregation": include_usage_aggregation, "q": q, "without_negative_entitlements": without_negative_entitlements, "limit": limit, @@ -3752,6 +3767,7 @@ async def count_feature_usage( company_id: typing.Optional[str] = None, company_keys: typing.Optional[typing.Dict[str, str]] = None, feature_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_usage_aggregation: typing.Optional[bool] = None, q: typing.Optional[str] = None, without_negative_entitlements: typing.Optional[bool] = None, limit: typing.Optional[int] = None, @@ -3767,6 +3783,9 @@ async def count_feature_usage( feature_ids : typing.Optional[typing.Union[str, typing.Sequence[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. + q : typing.Optional[str] without_negative_entitlements : typing.Optional[bool] @@ -3792,6 +3811,7 @@ async def count_feature_usage( "company_id": company_id, "company_keys": company_keys, "feature_ids": feature_ids, + "include_usage_aggregation": include_usage_aggregation, "q": q, "without_negative_entitlements": without_negative_entitlements, "limit": limit, diff --git a/src/schematic/entitlements/types/count_feature_usage_params.py b/src/schematic/entitlements/types/count_feature_usage_params.py index 13ec182..715aaa8 100644 --- a/src/schematic/entitlements/types/count_feature_usage_params.py +++ b/src/schematic/entitlements/types/count_feature_usage_params.py @@ -14,6 +14,11 @@ class CountFeatureUsageParams(UniversalBaseModel): company_id: typing.Optional[str] = None company_keys: typing.Optional[typing.Dict[str, str]] = None feature_ids: typing.Optional[typing.List[str]] = None + include_usage_aggregation: typing.Optional[bool] = pydantic.Field(default=None) + """ + Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + """ + limit: typing.Optional[int] = pydantic.Field(default=None) """ Page limit (default 100) diff --git a/src/schematic/entitlements/types/create_company_override_response.py b/src/schematic/entitlements/types/create_company_override_response.py index 21a2c0c..f909206 100644 --- a/src/schematic/entitlements/types/create_company_override_response.py +++ b/src/schematic/entitlements/types/create_company_override_response.py @@ -9,7 +9,7 @@ class CreateCompanyOverrideResponse(UniversalBaseModel): data: CompanyOverrideResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/create_plan_entitlement_response.py b/src/schematic/entitlements/types/create_plan_entitlement_response.py index 5d47b6e..ebe2db2 100644 --- a/src/schematic/entitlements/types/create_plan_entitlement_response.py +++ b/src/schematic/entitlements/types/create_plan_entitlement_response.py @@ -9,7 +9,7 @@ class CreatePlanEntitlementResponse(UniversalBaseModel): data: PlanEntitlementResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/delete_company_override_response.py b/src/schematic/entitlements/types/delete_company_override_response.py index 300c7c0..efe93ec 100644 --- a/src/schematic/entitlements/types/delete_company_override_response.py +++ b/src/schematic/entitlements/types/delete_company_override_response.py @@ -9,7 +9,7 @@ class DeleteCompanyOverrideResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/delete_plan_entitlement_response.py b/src/schematic/entitlements/types/delete_plan_entitlement_response.py index f2a5fe9..bc59b1a 100644 --- a/src/schematic/entitlements/types/delete_plan_entitlement_response.py +++ b/src/schematic/entitlements/types/delete_plan_entitlement_response.py @@ -9,7 +9,7 @@ class DeletePlanEntitlementResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/duplicate_plan_entitlements_response.py b/src/schematic/entitlements/types/duplicate_plan_entitlements_response.py index 6207a12..b9332bf 100644 --- a/src/schematic/entitlements/types/duplicate_plan_entitlements_response.py +++ b/src/schematic/entitlements/types/duplicate_plan_entitlements_response.py @@ -9,7 +9,7 @@ class DuplicatePlanEntitlementsResponse(UniversalBaseModel): data: DuplicatePlanEntitlementsResponseResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/get_company_override_response.py b/src/schematic/entitlements/types/get_company_override_response.py index 13ce9dd..64597b3 100644 --- a/src/schematic/entitlements/types/get_company_override_response.py +++ b/src/schematic/entitlements/types/get_company_override_response.py @@ -9,7 +9,7 @@ class GetCompanyOverrideResponse(UniversalBaseModel): data: CompanyOverrideResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/get_plan_entitlement_response.py b/src/schematic/entitlements/types/get_plan_entitlement_response.py index 25ea4a1..a052e1d 100644 --- a/src/schematic/entitlements/types/get_plan_entitlement_response.py +++ b/src/schematic/entitlements/types/get_plan_entitlement_response.py @@ -9,7 +9,7 @@ class GetPlanEntitlementResponse(UniversalBaseModel): data: PlanEntitlementResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/list_feature_usage_params.py b/src/schematic/entitlements/types/list_feature_usage_params.py index b9d74ea..3a1f160 100644 --- a/src/schematic/entitlements/types/list_feature_usage_params.py +++ b/src/schematic/entitlements/types/list_feature_usage_params.py @@ -14,6 +14,11 @@ class ListFeatureUsageParams(UniversalBaseModel): company_id: typing.Optional[str] = None company_keys: typing.Optional[typing.Dict[str, str]] = None feature_ids: typing.Optional[typing.List[str]] = None + include_usage_aggregation: typing.Optional[bool] = pydantic.Field(default=None) + """ + Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + """ + limit: typing.Optional[int] = pydantic.Field(default=None) """ Page limit (default 100) diff --git a/src/schematic/entitlements/types/update_company_override_response.py b/src/schematic/entitlements/types/update_company_override_response.py index 4b059e6..933f943 100644 --- a/src/schematic/entitlements/types/update_company_override_response.py +++ b/src/schematic/entitlements/types/update_company_override_response.py @@ -9,7 +9,7 @@ class UpdateCompanyOverrideResponse(UniversalBaseModel): data: CompanyOverrideResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/entitlements/types/update_plan_entitlement_response.py b/src/schematic/entitlements/types/update_plan_entitlement_response.py index bf8fdda..46e3b2b 100644 --- a/src/schematic/entitlements/types/update_plan_entitlement_response.py +++ b/src/schematic/entitlements/types/update_plan_entitlement_response.py @@ -9,7 +9,7 @@ class UpdatePlanEntitlementResponse(UniversalBaseModel): data: PlanEntitlementResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/events/types/create_event_batch_response.py b/src/schematic/events/types/create_event_batch_response.py index cb234ba..41e8d12 100644 --- a/src/schematic/events/types/create_event_batch_response.py +++ b/src/schematic/events/types/create_event_batch_response.py @@ -9,7 +9,7 @@ class CreateEventBatchResponse(UniversalBaseModel): data: RawEventBatchResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/events/types/create_event_response.py b/src/schematic/events/types/create_event_response.py index b3032aa..0a006e7 100644 --- a/src/schematic/events/types/create_event_response.py +++ b/src/schematic/events/types/create_event_response.py @@ -9,7 +9,7 @@ class CreateEventResponse(UniversalBaseModel): data: RawEventResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/events/types/get_event_response.py b/src/schematic/events/types/get_event_response.py index af119de..463063c 100644 --- a/src/schematic/events/types/get_event_response.py +++ b/src/schematic/events/types/get_event_response.py @@ -9,7 +9,7 @@ class GetEventResponse(UniversalBaseModel): data: EventDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/events/types/get_segment_integration_status_response.py b/src/schematic/events/types/get_segment_integration_status_response.py index b30d9da..bf20395 100644 --- a/src/schematic/events/types/get_segment_integration_status_response.py +++ b/src/schematic/events/types/get_segment_integration_status_response.py @@ -9,7 +9,7 @@ class GetSegmentIntegrationStatusResponse(UniversalBaseModel): data: SegmentStatusResp - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/check_flag_response.py b/src/schematic/features/types/check_flag_response.py index 35e4cf8..9dfa949 100644 --- a/src/schematic/features/types/check_flag_response.py +++ b/src/schematic/features/types/check_flag_response.py @@ -9,7 +9,7 @@ class CheckFlagResponse(UniversalBaseModel): data: CheckFlagResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/check_flags_bulk_response.py b/src/schematic/features/types/check_flags_bulk_response.py index 60b3478..4418d6d 100644 --- a/src/schematic/features/types/check_flags_bulk_response.py +++ b/src/schematic/features/types/check_flags_bulk_response.py @@ -9,7 +9,7 @@ class CheckFlagsBulkResponse(UniversalBaseModel): data: CheckFlagsBulkResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/check_flags_response.py b/src/schematic/features/types/check_flags_response.py index f13645a..1703197 100644 --- a/src/schematic/features/types/check_flags_response.py +++ b/src/schematic/features/types/check_flags_response.py @@ -9,7 +9,7 @@ class CheckFlagsResponse(UniversalBaseModel): data: CheckFlagsResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/create_feature_response.py b/src/schematic/features/types/create_feature_response.py index e7a807a..5b548c3 100644 --- a/src/schematic/features/types/create_feature_response.py +++ b/src/schematic/features/types/create_feature_response.py @@ -9,7 +9,7 @@ class CreateFeatureResponse(UniversalBaseModel): data: FeatureDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/create_flag_response.py b/src/schematic/features/types/create_flag_response.py index 5db9eb6..1ce683d 100644 --- a/src/schematic/features/types/create_flag_response.py +++ b/src/schematic/features/types/create_flag_response.py @@ -9,7 +9,7 @@ class CreateFlagResponse(UniversalBaseModel): data: FlagDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/delete_feature_response.py b/src/schematic/features/types/delete_feature_response.py index c0dfe5e..fd17741 100644 --- a/src/schematic/features/types/delete_feature_response.py +++ b/src/schematic/features/types/delete_feature_response.py @@ -9,7 +9,7 @@ class DeleteFeatureResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/delete_flag_response.py b/src/schematic/features/types/delete_flag_response.py index cb2f1f9..c2d0270 100644 --- a/src/schematic/features/types/delete_flag_response.py +++ b/src/schematic/features/types/delete_flag_response.py @@ -9,7 +9,7 @@ class DeleteFlagResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/get_feature_response.py b/src/schematic/features/types/get_feature_response.py index aa97fbc..209b874 100644 --- a/src/schematic/features/types/get_feature_response.py +++ b/src/schematic/features/types/get_feature_response.py @@ -9,7 +9,7 @@ class GetFeatureResponse(UniversalBaseModel): data: FeatureDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/get_flag_response.py b/src/schematic/features/types/get_flag_response.py index 8df6f48..17d1967 100644 --- a/src/schematic/features/types/get_flag_response.py +++ b/src/schematic/features/types/get_flag_response.py @@ -9,7 +9,7 @@ class GetFlagResponse(UniversalBaseModel): data: FlagDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/update_feature_response.py b/src/schematic/features/types/update_feature_response.py index 1672326..78909ea 100644 --- a/src/schematic/features/types/update_feature_response.py +++ b/src/schematic/features/types/update_feature_response.py @@ -9,7 +9,7 @@ class UpdateFeatureResponse(UniversalBaseModel): data: FeatureDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/update_flag_response.py b/src/schematic/features/types/update_flag_response.py index 866a4d5..1f595f2 100644 --- a/src/schematic/features/types/update_flag_response.py +++ b/src/schematic/features/types/update_flag_response.py @@ -9,7 +9,7 @@ class UpdateFlagResponse(UniversalBaseModel): data: FlagDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/features/types/update_flag_rules_response.py b/src/schematic/features/types/update_flag_rules_response.py index e65efef..3a95e71 100644 --- a/src/schematic/features/types/update_flag_rules_response.py +++ b/src/schematic/features/types/update_flag_rules_response.py @@ -9,7 +9,7 @@ class UpdateFlagRulesResponse(UniversalBaseModel): data: RulesDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plangroups/types/create_plan_group_response.py b/src/schematic/plangroups/types/create_plan_group_response.py index f5f91df..fc7a292 100644 --- a/src/schematic/plangroups/types/create_plan_group_response.py +++ b/src/schematic/plangroups/types/create_plan_group_response.py @@ -9,7 +9,7 @@ class CreatePlanGroupResponse(UniversalBaseModel): data: PlanGroupResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plangroups/types/get_plan_group_response.py b/src/schematic/plangroups/types/get_plan_group_response.py index 268eef3..14fc254 100644 --- a/src/schematic/plangroups/types/get_plan_group_response.py +++ b/src/schematic/plangroups/types/get_plan_group_response.py @@ -9,7 +9,7 @@ class GetPlanGroupResponse(UniversalBaseModel): data: PlanGroupDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plangroups/types/update_plan_group_response.py b/src/schematic/plangroups/types/update_plan_group_response.py index 832e720..7c85b08 100644 --- a/src/schematic/plangroups/types/update_plan_group_response.py +++ b/src/schematic/plangroups/types/update_plan_group_response.py @@ -9,7 +9,7 @@ class UpdatePlanGroupResponse(UniversalBaseModel): data: PlanGroupResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/create_plan_response.py b/src/schematic/plans/types/create_plan_response.py index fdf1e4d..f365115 100644 --- a/src/schematic/plans/types/create_plan_response.py +++ b/src/schematic/plans/types/create_plan_response.py @@ -9,7 +9,7 @@ class CreatePlanResponse(UniversalBaseModel): data: PlanDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/delete_plan_response.py b/src/schematic/plans/types/delete_plan_response.py index 2c77fc6..85413df 100644 --- a/src/schematic/plans/types/delete_plan_response.py +++ b/src/schematic/plans/types/delete_plan_response.py @@ -9,7 +9,7 @@ class DeletePlanResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/get_plan_response.py b/src/schematic/plans/types/get_plan_response.py index 4bcef61..fc993f7 100644 --- a/src/schematic/plans/types/get_plan_response.py +++ b/src/schematic/plans/types/get_plan_response.py @@ -9,7 +9,7 @@ class GetPlanResponse(UniversalBaseModel): data: PlanDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/update_company_plans_response.py b/src/schematic/plans/types/update_company_plans_response.py index 49fc840..76827bd 100644 --- a/src/schematic/plans/types/update_company_plans_response.py +++ b/src/schematic/plans/types/update_company_plans_response.py @@ -9,7 +9,7 @@ class UpdateCompanyPlansResponse(UniversalBaseModel): data: CompanyDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/update_plan_response.py b/src/schematic/plans/types/update_plan_response.py index 6a55f91..d282e52 100644 --- a/src/schematic/plans/types/update_plan_response.py +++ b/src/schematic/plans/types/update_plan_response.py @@ -9,7 +9,7 @@ class UpdatePlanResponse(UniversalBaseModel): data: PlanDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/plans/types/upsert_billing_product_plan_response.py b/src/schematic/plans/types/upsert_billing_product_plan_response.py index 47a43c3..5fbd3e7 100644 --- a/src/schematic/plans/types/upsert_billing_product_plan_response.py +++ b/src/schematic/plans/types/upsert_billing_product_plan_response.py @@ -9,7 +9,7 @@ class UpsertBillingProductPlanResponse(UniversalBaseModel): data: BillingProductPlanResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/types/__init__.py b/src/schematic/types/__init__.py index f232549..21e5162 100644 --- a/src/schematic/types/__init__.py +++ b/src/schematic/types/__init__.py @@ -46,6 +46,7 @@ from .billing_product_price_tier_response_data import BillingProductPriceTierResponseData from .billing_product_pricing import BillingProductPricing from .billing_product_response_data import BillingProductResponseData + from .billing_provider_type import BillingProviderType from .billing_subscription_discount import BillingSubscriptionDiscount from .billing_subscription_discount_view import BillingSubscriptionDiscountView from .billing_subscription_response_data import BillingSubscriptionResponseData @@ -62,7 +63,6 @@ from .checkout_data_response_data import CheckoutDataResponseData from .checkout_settings_response_data import CheckoutSettingsResponseData from .checkout_subscription import CheckoutSubscription - from .company_crm_deals_response_data import CompanyCrmDealsResponseData from .company_detail_response_data import CompanyDetailResponseData from .company_event_period_metrics_response_data import CompanyEventPeriodMetricsResponseData from .company_ledger_response_data import CompanyLedgerResponseData @@ -123,20 +123,18 @@ from .credit_grant_sort_order import CreditGrantSortOrder from .credit_ledger_enriched_entry_response_data import CreditLedgerEnrichedEntryResponseData from .credit_ledger_period import CreditLedgerPeriod + from .credit_transfer_response_data import CreditTransferResponseData + from .credit_transfer_view import CreditTransferView from .credit_trigger_config import CreditTriggerConfig from .credit_usage import CreditUsage + from .credit_usage_aggregation import CreditUsageAggregation from .credit_usage_response_data import CreditUsageResponseData - from .crm_deal_line_item import CrmDealLineItem - from .crm_deal_response_data import CrmDealResponseData - from .crm_line_item_response_data import CrmLineItemResponseData - from .crm_product_response_data import CrmProductResponseData from .custom_plan_config import CustomPlanConfig from .custom_plan_view_config_response_data import CustomPlanViewConfigResponseData from .data_export_output_file_type import DataExportOutputFileType from .data_export_response_data import DataExportResponseData from .data_export_status import DataExportStatus from .data_export_type import DataExportType - from .decimal import Decimal from .delete_response import DeleteResponse from .duplicate_plan_entitlements_response_response_data import DuplicatePlanEntitlementsResponseResponseData from .entitlement_price_behavior import EntitlementPriceBehavior @@ -330,6 +328,7 @@ "BillingProductPriceTierResponseData": ".billing_product_price_tier_response_data", "BillingProductPricing": ".billing_product_pricing", "BillingProductResponseData": ".billing_product_response_data", + "BillingProviderType": ".billing_provider_type", "BillingSubscriptionDiscount": ".billing_subscription_discount", "BillingSubscriptionDiscountView": ".billing_subscription_discount_view", "BillingSubscriptionResponseData": ".billing_subscription_response_data", @@ -346,7 +345,6 @@ "CheckoutDataResponseData": ".checkout_data_response_data", "CheckoutSettingsResponseData": ".checkout_settings_response_data", "CheckoutSubscription": ".checkout_subscription", - "CompanyCrmDealsResponseData": ".company_crm_deals_response_data", "CompanyDetailResponseData": ".company_detail_response_data", "CompanyEventPeriodMetricsResponseData": ".company_event_period_metrics_response_data", "CompanyLedgerResponseData": ".company_ledger_response_data", @@ -403,20 +401,18 @@ "CreditGrantSortOrder": ".credit_grant_sort_order", "CreditLedgerEnrichedEntryResponseData": ".credit_ledger_enriched_entry_response_data", "CreditLedgerPeriod": ".credit_ledger_period", + "CreditTransferResponseData": ".credit_transfer_response_data", + "CreditTransferView": ".credit_transfer_view", "CreditTriggerConfig": ".credit_trigger_config", "CreditUsage": ".credit_usage", + "CreditUsageAggregation": ".credit_usage_aggregation", "CreditUsageResponseData": ".credit_usage_response_data", - "CrmDealLineItem": ".crm_deal_line_item", - "CrmDealResponseData": ".crm_deal_response_data", - "CrmLineItemResponseData": ".crm_line_item_response_data", - "CrmProductResponseData": ".crm_product_response_data", "CustomPlanConfig": ".custom_plan_config", "CustomPlanViewConfigResponseData": ".custom_plan_view_config_response_data", "DataExportOutputFileType": ".data_export_output_file_type", "DataExportResponseData": ".data_export_response_data", "DataExportStatus": ".data_export_status", "DataExportType": ".data_export_type", - "Decimal": ".decimal", "DeleteResponse": ".delete_response", "DuplicatePlanEntitlementsResponseResponseData": ".duplicate_plan_entitlements_response_response_data", "EntitlementPriceBehavior": ".entitlement_price_behavior", @@ -632,6 +628,7 @@ def __dir__(): "BillingProductPriceTierResponseData", "BillingProductPricing", "BillingProductResponseData", + "BillingProviderType", "BillingSubscriptionDiscount", "BillingSubscriptionDiscountView", "BillingSubscriptionResponseData", @@ -648,7 +645,6 @@ def __dir__(): "CheckoutDataResponseData", "CheckoutSettingsResponseData", "CheckoutSubscription", - "CompanyCrmDealsResponseData", "CompanyDetailResponseData", "CompanyEventPeriodMetricsResponseData", "CompanyLedgerResponseData", @@ -705,20 +701,18 @@ def __dir__(): "CreditGrantSortOrder", "CreditLedgerEnrichedEntryResponseData", "CreditLedgerPeriod", + "CreditTransferResponseData", + "CreditTransferView", "CreditTriggerConfig", "CreditUsage", + "CreditUsageAggregation", "CreditUsageResponseData", - "CrmDealLineItem", - "CrmDealResponseData", - "CrmLineItemResponseData", - "CrmProductResponseData", "CustomPlanConfig", "CustomPlanViewConfigResponseData", "DataExportOutputFileType", "DataExportResponseData", "DataExportStatus", "DataExportType", - "Decimal", "DeleteResponse", "DuplicatePlanEntitlementsResponseResponseData", "EntitlementPriceBehavior", diff --git a/src/schematic/types/billing_coupon_response_data.py b/src/schematic/types/billing_coupon_response_data.py index a93553d..34020e9 100644 --- a/src/schematic/types/billing_coupon_response_data.py +++ b/src/schematic/types/billing_coupon_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class BillingCouponResponseData(UniversalBaseModel): @@ -18,9 +19,10 @@ class BillingCouponResponseData(UniversalBaseModel): id: str is_active: bool max_redemptions: typing.Optional[int] = None - metadata: typing.Dict[str, typing.Optional[typing.Any]] + metadata: typing.Dict[str, typing.Any] name: str percent_off: typing.Optional[float] = None + provider_type: BillingProviderType times_redeemed: int valid_from: typing.Optional[dt.datetime] = None valid_until: typing.Optional[dt.datetime] = None diff --git a/src/schematic/types/billing_credit_grant_response_data.py b/src/schematic/types/billing_credit_grant_response_data.py index 58ff3bf..2402d08 100644 --- a/src/schematic/types/billing_credit_grant_response_data.py +++ b/src/schematic/types/billing_credit_grant_response_data.py @@ -8,6 +8,7 @@ from .billing_credit_grant_reason import BillingCreditGrantReason from .billing_credit_grant_zeroed_out_reason import BillingCreditGrantZeroedOutReason from .billing_price_response_data import BillingPriceResponseData +from .credit_transfer_response_data import CreditTransferResponseData class BillingCreditGrantResponseData(UniversalBaseModel): @@ -27,6 +28,7 @@ class BillingCreditGrantResponseData(UniversalBaseModel): quantity_remaining: float quantity_used: float source_label: str + transfers: typing.Optional[typing.List[CreditTransferResponseData]] = None updated_at: dt.datetime valid_from: typing.Optional[dt.datetime] = None zeroed_out_date: typing.Optional[dt.datetime] = None diff --git a/src/schematic/types/billing_customer_response_data.py b/src/schematic/types/billing_customer_response_data.py index 9c4e03c..2fb0df8 100644 --- a/src/schematic/types/billing_customer_response_data.py +++ b/src/schematic/types/billing_customer_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class BillingCustomerResponseData(UniversalBaseModel): @@ -15,6 +16,7 @@ class BillingCustomerResponseData(UniversalBaseModel): failed_to_import: bool id: str name: str + provider_type: BillingProviderType updated_at: dt.datetime if IS_PYDANTIC_V2: diff --git a/src/schematic/types/billing_customer_with_subscriptions_response_data.py b/src/schematic/types/billing_customer_with_subscriptions_response_data.py index 16c8c98..07612b9 100644 --- a/src/schematic/types/billing_customer_with_subscriptions_response_data.py +++ b/src/schematic/types/billing_customer_with_subscriptions_response_data.py @@ -6,6 +6,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_customer_subscription import BillingCustomerSubscription +from .billing_provider_type import BillingProviderType class BillingCustomerWithSubscriptionsResponseData(UniversalBaseModel): @@ -16,6 +17,7 @@ class BillingCustomerWithSubscriptionsResponseData(UniversalBaseModel): failed_to_import: bool id: str name: str + provider_type: BillingProviderType subscriptions: typing.List[BillingCustomerSubscription] updated_at: dt.datetime diff --git a/src/schematic/types/billing_meter_response_data.py b/src/schematic/types/billing_meter_response_data.py index 3d6eb01..904ac6f 100644 --- a/src/schematic/types/billing_meter_response_data.py +++ b/src/schematic/types/billing_meter_response_data.py @@ -4,6 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class BillingMeterResponseData(UniversalBaseModel): @@ -12,6 +13,7 @@ class BillingMeterResponseData(UniversalBaseModel): event_payload_key: str external_price_id: str id: str + provider_type: BillingProviderType if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/schematic/types/billing_price_response_data.py b/src/schematic/types/billing_price_response_data.py index a724267..dc33607 100644 --- a/src/schematic/types/billing_price_response_data.py +++ b/src/schematic/types/billing_price_response_data.py @@ -6,6 +6,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_price_scheme import BillingPriceScheme from .billing_product_price_interval import BillingProductPriceInterval +from .billing_provider_type import BillingProviderType class BillingPriceResponseData(UniversalBaseModel): @@ -15,6 +16,7 @@ class BillingPriceResponseData(UniversalBaseModel): interval: BillingProductPriceInterval price: int price_decimal: typing.Optional[str] = None + provider_type: BillingProviderType scheme: BillingPriceScheme if IS_PYDANTIC_V2: diff --git a/src/schematic/types/billing_price_view.py b/src/schematic/types/billing_price_view.py index e3c08f5..91c1449 100644 --- a/src/schematic/types/billing_price_view.py +++ b/src/schematic/types/billing_price_view.py @@ -9,6 +9,7 @@ from .billing_price_usage_type import BillingPriceUsageType from .billing_product_price_interval import BillingProductPriceInterval from .billing_product_price_tier_response_data import BillingProductPriceTierResponseData +from .billing_provider_type import BillingProviderType from .billing_tiers_mode import BillingTiersMode @@ -31,6 +32,7 @@ class BillingPriceView(UniversalBaseModel): product_external_id: str product_id: str product_name: str + provider_type: BillingProviderType tiers_mode: typing.Optional[BillingTiersMode] = None updated_at: dt.datetime usage_type: BillingPriceUsageType diff --git a/src/schematic/types/billing_product_detail_response_data.py b/src/schematic/types/billing_product_detail_response_data.py index 7cf1edd..5303f2b 100644 --- a/src/schematic/types/billing_product_detail_response_data.py +++ b/src/schematic/types/billing_product_detail_response_data.py @@ -6,6 +6,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_price_response_data import BillingPriceResponseData +from .billing_provider_type import BillingProviderType class BillingProductDetailResponseData(UniversalBaseModel): @@ -24,6 +25,7 @@ class BillingProductDetailResponseData(UniversalBaseModel): price_decimal: typing.Optional[str] = None prices: typing.List[BillingPriceResponseData] product_id: str + provider_type: BillingProviderType quantity: float subscription_count: int updated_at: dt.datetime diff --git a/src/schematic/types/billing_product_for_subscription_response_data.py b/src/schematic/types/billing_product_for_subscription_response_data.py index 899ea8b..081b1ee 100644 --- a/src/schematic/types/billing_product_for_subscription_response_data.py +++ b/src/schematic/types/billing_product_for_subscription_response_data.py @@ -8,6 +8,7 @@ from .billing_price_scheme import BillingPriceScheme from .billing_price_usage_type import BillingPriceUsageType from .billing_product_price_tier_response_data import BillingProductPriceTierResponseData +from .billing_provider_type import BillingProviderType class BillingProductForSubscriptionResponseData(UniversalBaseModel): @@ -27,6 +28,7 @@ class BillingProductForSubscriptionResponseData(UniversalBaseModel): price_external_id: str price_id: str price_tier: typing.List[BillingProductPriceTierResponseData] + provider_type: BillingProviderType quantity: float subscription_id: str subscription_item_external_id: typing.Optional[str] = None diff --git a/src/schematic/types/billing_product_price_response_data.py b/src/schematic/types/billing_product_price_response_data.py index 4b68ad2..a828a45 100644 --- a/src/schematic/types/billing_product_price_response_data.py +++ b/src/schematic/types/billing_product_price_response_data.py @@ -8,6 +8,7 @@ from .billing_price_scheme import BillingPriceScheme from .billing_price_usage_type import BillingPriceUsageType from .billing_product_price_interval import BillingProductPriceInterval +from .billing_provider_type import BillingProviderType from .billing_tiers_mode import BillingTiersMode @@ -24,6 +25,7 @@ class BillingProductPriceResponseData(UniversalBaseModel): price_decimal: typing.Optional[str] = None price_external_id: str product_external_id: str + provider_type: BillingProviderType tiers_mode: typing.Optional[BillingTiersMode] = None updated_at: dt.datetime usage_type: BillingPriceUsageType diff --git a/src/schematic/types/billing_product_response_data.py b/src/schematic/types/billing_product_response_data.py index f22df85..b0ced88 100644 --- a/src/schematic/types/billing_product_response_data.py +++ b/src/schematic/types/billing_product_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class BillingProductResponseData(UniversalBaseModel): @@ -22,6 +23,7 @@ class BillingProductResponseData(UniversalBaseModel): price: float price_decimal: typing.Optional[str] = None product_id: str + provider_type: BillingProviderType quantity: float updated_at: dt.datetime diff --git a/src/schematic/types/billing_provider_type.py b/src/schematic/types/billing_provider_type.py new file mode 100644 index 0000000..3e9a5a9 --- /dev/null +++ b/src/schematic/types/billing_provider_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BillingProviderType = typing.Union[typing.Literal["schematic", "stripe"], typing.Any] diff --git a/src/schematic/types/billing_subscription_response_data.py b/src/schematic/types/billing_subscription_response_data.py index b939f06..2ea67b3 100644 --- a/src/schematic/types/billing_subscription_response_data.py +++ b/src/schematic/types/billing_subscription_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType from .billing_subscription_trial_end_setting import BillingSubscriptionTrialEndSetting @@ -20,9 +21,10 @@ class BillingSubscriptionResponseData(UniversalBaseModel): expired_at: typing.Optional[dt.datetime] = None id: str interval: str - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = None period_end: int period_start: int + provider_type: BillingProviderType status: str subscription_external_id: str total_price: int diff --git a/src/schematic/types/billing_subscription_view.py b/src/schematic/types/billing_subscription_view.py index 049fb81..c37ea68 100644 --- a/src/schematic/types/billing_subscription_view.py +++ b/src/schematic/types/billing_subscription_view.py @@ -6,6 +6,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_product_for_subscription_response_data import BillingProductForSubscriptionResponseData +from .billing_provider_type import BillingProviderType from .billing_subscription_discount_view import BillingSubscriptionDiscountView from .billing_subscription_trial_end_setting import BillingSubscriptionTrialEndSetting from .invoice_response_data import InvoiceResponseData @@ -26,11 +27,12 @@ class BillingSubscriptionView(UniversalBaseModel): id: str interval: str latest_invoice: typing.Optional[InvoiceResponseData] = None - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = None payment_method: typing.Optional[PaymentMethodResponseData] = None period_end: int period_start: int products: typing.List[BillingProductForSubscriptionResponseData] + provider_type: BillingProviderType status: str subscription_external_id: str total_price: int diff --git a/src/schematic/types/checkout_subscription.py b/src/schematic/types/checkout_subscription.py index 4efacb0..4660af8 100644 --- a/src/schematic/types/checkout_subscription.py +++ b/src/schematic/types/checkout_subscription.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType from .billing_subscription_trial_end_setting import BillingSubscriptionTrialEndSetting @@ -22,9 +23,10 @@ class CheckoutSubscription(UniversalBaseModel): expired_at: typing.Optional[dt.datetime] = None id: str interval: str - metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = None period_end: int period_start: int + provider_type: BillingProviderType status: str subscription_external_id: str total_price: int diff --git a/src/schematic/types/company_crm_deals_response_data.py b/src/schematic/types/company_crm_deals_response_data.py deleted file mode 100644 index 727d5e4..0000000 --- a/src/schematic/types/company_crm_deals_response_data.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .crm_deal_line_item import CrmDealLineItem - - -class CompanyCrmDealsResponseData(UniversalBaseModel): - deal_arr: str - deal_external_id: str - deal_mrr: str - deal_name: typing.Optional[str] = None - line_items: typing.List[CrmDealLineItem] - - 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 48299dc..299a52c 100644 --- a/src/schematic/types/company_detail_response_data.py +++ b/src/schematic/types/company_detail_response_data.py @@ -34,7 +34,7 @@ class CompanyDetailResponseData(UniversalBaseModel): plan: typing.Optional[CompanyPlanWithBillingSubView] = None plans: typing.List[GenericPreviewObject] rules: typing.List[Rule] - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/company_view_with_feature_usage_response_data.py b/src/schematic/types/company_view_with_feature_usage_response_data.py index 935cbd7..8b96b8c 100644 --- a/src/schematic/types/company_view_with_feature_usage_response_data.py +++ b/src/schematic/types/company_view_with_feature_usage_response_data.py @@ -36,7 +36,7 @@ class CompanyViewWithFeatureUsageResponseData(UniversalBaseModel): plan: typing.Optional[CompanyPlanWithBillingSubView] = None plans: typing.List[GenericPreviewObject] rules: typing.List[Rule] - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/create_billing_price_tier_request_body.py b/src/schematic/types/create_billing_price_tier_request_body.py index eeee4a2..7afe6a3 100644 --- a/src/schematic/types/create_billing_price_tier_request_body.py +++ b/src/schematic/types/create_billing_price_tier_request_body.py @@ -4,6 +4,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class CreateBillingPriceTierRequestBody(UniversalBaseModel): @@ -11,6 +12,7 @@ class CreateBillingPriceTierRequestBody(UniversalBaseModel): per_unit_decimal: typing.Optional[str] = None per_unit_price: typing.Optional[int] = None price_external_id: str + provider_type: typing.Optional[BillingProviderType] = None up_to: typing.Optional[int] = None if IS_PYDANTIC_V2: diff --git a/src/schematic/types/create_or_update_condition_request_body_condition_type.py b/src/schematic/types/create_or_update_condition_request_body_condition_type.py index eb620d7..7069e08 100644 --- a/src/schematic/types/create_or_update_condition_request_body_condition_type.py +++ b/src/schematic/types/create_or_update_condition_request_body_condition_type.py @@ -3,6 +3,5 @@ import typing CreateOrUpdateConditionRequestBodyConditionType = typing.Union[ - typing.Literal["company", "metric", "trait", "user", "plan", "billing_product", "crm_product", "base_plan"], - typing.Any, + typing.Literal["company", "metric", "trait", "user", "plan", "billing_product", "base_plan"], typing.Any ] diff --git a/src/schematic/types/credit_company_grant_view.py b/src/schematic/types/credit_company_grant_view.py index 7ec474c..c8b2307 100644 --- a/src/schematic/types/credit_company_grant_view.py +++ b/src/schematic/types/credit_company_grant_view.py @@ -10,6 +10,7 @@ from .billing_credit_grant_reason import BillingCreditGrantReason from .billing_credit_grant_zeroed_out_reason import BillingCreditGrantZeroedOutReason from .billing_product_price_response_data import BillingProductPriceResponseData +from .credit_transfer_view import CreditTransferView class CreditCompanyGrantView(UniversalBaseModel): @@ -37,6 +38,7 @@ class CreditCompanyGrantView(UniversalBaseModel): quantity_used: float singular_name: typing.Optional[str] = None source_label: str + transfers: typing.Optional[typing.List[CreditTransferView]] = None updated_at: dt.datetime valid_from: typing.Optional[dt.datetime] = None zeroed_out_date: typing.Optional[dt.datetime] = None diff --git a/src/schematic/types/crm_line_item_response_data.py b/src/schematic/types/credit_transfer_response_data.py similarity index 70% rename from src/schematic/types/crm_line_item_response_data.py rename to src/schematic/types/credit_transfer_response_data.py index 86054fc..3a26ca4 100644 --- a/src/schematic/types/crm_line_item_response_data.py +++ b/src/schematic/types/credit_transfer_response_data.py @@ -7,13 +7,13 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -class CrmLineItemResponseData(UniversalBaseModel): - account_id: str +class CreditTransferResponseData(UniversalBaseModel): + amount: float created_at: dt.datetime - deal_id: typing.Optional[str] = None - environment_id: str - product_external_id: typing.Optional[str] = None - updated_at: dt.datetime + direction: str + id: str + reason: str + related_grant_id: str if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/schematic/types/crm_product_response_data.py b/src/schematic/types/credit_transfer_view.py similarity index 69% rename from src/schematic/types/crm_product_response_data.py rename to src/schematic/types/credit_transfer_view.py index 910147c..c3ffd64 100644 --- a/src/schematic/types/crm_product_response_data.py +++ b/src/schematic/types/credit_transfer_view.py @@ -7,17 +7,13 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -class CrmProductResponseData(UniversalBaseModel): - account_id: str +class CreditTransferView(UniversalBaseModel): + amount: float created_at: dt.datetime - currency: str - environment_id: str - external_id: str - name: str - price: str - product_id: str - quantity: float - updated_at: dt.datetime + direction: str + id: str + reason: str + related_grant_id: str if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/schematic/types/credit_usage.py b/src/schematic/types/credit_usage.py index 8bdaca3..2cd5c29 100644 --- a/src/schematic/types/credit_usage.py +++ b/src/schematic/types/credit_usage.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .credit_grant_detail import CreditGrantDetail +from .credit_usage_aggregation import CreditUsageAggregation class CreditUsage(UniversalBaseModel): @@ -16,6 +17,7 @@ class CreditUsage(UniversalBaseModel): credit_type_icon: typing.Optional[str] = None credit_type_name: typing.Optional[str] = None credit_used: typing.Optional[float] = None + usage_aggregation: typing.Optional[CreditUsageAggregation] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/schematic/types/credit_usage_aggregation.py b/src/schematic/types/credit_usage_aggregation.py new file mode 100644 index 0000000..dfaa839 --- /dev/null +++ b/src/schematic/types/credit_usage_aggregation.py @@ -0,0 +1,37 @@ +# 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 CreditUsageAggregation(UniversalBaseModel): + usage_this_billing_period: typing.Optional[float] = pydantic.Field(default=None) + """ + Credit usage within the current billing period + """ + + usage_this_calendar_month: typing.Optional[float] = pydantic.Field(default=None) + """ + Credit usage within the current calendar month + """ + + usage_this_week: typing.Optional[float] = pydantic.Field(default=None) + """ + Credit usage within the current calendar week (Monday to Sunday) + """ + + usage_today: typing.Optional[float] = pydantic.Field(default=None) + """ + Credit usage for the current day + """ + + 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_usage_response_data.py b/src/schematic/types/credit_usage_response_data.py index d859cf7..3954e39 100644 --- a/src/schematic/types/credit_usage_response_data.py +++ b/src/schematic/types/credit_usage_response_data.py @@ -12,7 +12,11 @@ class CreditUsageResponseData(UniversalBaseModel): credit_grant_counts: typing.Optional[typing.Dict[str, float]] = None credit_grant_details: typing.List[CreditGrantDetail] credit_remaining: typing.Optional[float] = None - credit_total: typing.Optional[float] = None + credit_total: typing.Optional[float] = pydantic.Field(default=None) + """ + Deprecated: Use credit_remaining instead. + """ + credit_type_icon: typing.Optional[str] = None credit_type_name: typing.Optional[str] = None credit_used: typing.Optional[float] = None diff --git a/src/schematic/types/crm_deal_line_item.py b/src/schematic/types/crm_deal_line_item.py deleted file mode 100644 index 08eda7d..0000000 --- a/src/schematic/types/crm_deal_line_item.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .decimal import Decimal - - -class CrmDealLineItem(UniversalBaseModel): - billing_frequency: str - created_at: dt.datetime - currency: str - description: str - discount_percentage: typing.Optional[Decimal] = None - id: str - name: str - price: float - quantity: int - term_month: typing.Optional[int] = None - total_discount: typing.Optional[Decimal] = None - 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/crm_deal_response_data.py b/src/schematic/types/crm_deal_response_data.py deleted file mode 100644 index 986427a..0000000 --- a/src/schematic/types/crm_deal_response_data.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class CrmDealResponseData(UniversalBaseModel): - account_id: str - arr: str - company_external_id: typing.Optional[str] = None - created_at: dt.datetime - deal_external_id: str - deal_id: str - environment_id: str - mrr: str - name: typing.Optional[str] = None - product_external_id: typing.Optional[str] = None - 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/decimal.py b/src/schematic/types/decimal.py deleted file mode 100644 index ebeb4f8..0000000 --- a/src/schematic/types/decimal.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Decimal = typing.Dict[str, typing.Optional[typing.Any]] diff --git a/src/schematic/types/event_body_identify.py b/src/schematic/types/event_body_identify.py index bfb3fe9..aa06d6c 100644 --- a/src/schematic/types/event_body_identify.py +++ b/src/schematic/types/event_body_identify.py @@ -23,7 +23,7 @@ class EventBodyIdentify(UniversalBaseModel): The display name of the user being identified; required only if it is a new user """ - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/event_body_identify_company.py b/src/schematic/types/event_body_identify_company.py index b6c8a9d..9aeb5c7 100644 --- a/src/schematic/types/event_body_identify_company.py +++ b/src/schematic/types/event_body_identify_company.py @@ -21,7 +21,7 @@ class EventBodyIdentifyCompany(UniversalBaseModel): The display name of the company; required only if it is a new company """ - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/event_body_track.py b/src/schematic/types/event_body_track.py index cdaa757..d8a6f7d 100644 --- a/src/schematic/types/event_body_track.py +++ b/src/schematic/types/event_body_track.py @@ -22,7 +22,7 @@ class EventBodyTrack(UniversalBaseModel): Optionally specify the quantity of the event """ - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/event_detail_response_data.py b/src/schematic/types/event_detail_response_data.py index 8d17d00..c33b84f 100644 --- a/src/schematic/types/event_detail_response_data.py +++ b/src/schematic/types/event_detail_response_data.py @@ -12,7 +12,7 @@ class EventDetailResponseData(UniversalBaseModel): api_key: typing.Optional[str] = None - body: typing.Dict[str, typing.Optional[typing.Any]] + body: typing.Dict[str, typing.Any] body_preview: str captured_at: dt.datetime company: typing.Optional[PreviewObject] = None diff --git a/src/schematic/types/event_response_data.py b/src/schematic/types/event_response_data.py index 1acb4c2..33b6d1c 100644 --- a/src/schematic/types/event_response_data.py +++ b/src/schematic/types/event_response_data.py @@ -11,7 +11,7 @@ class EventResponseData(UniversalBaseModel): api_key: typing.Optional[str] = None - body: typing.Dict[str, typing.Optional[typing.Any]] + body: typing.Dict[str, typing.Any] body_preview: str captured_at: dt.datetime company_id: typing.Optional[str] = None diff --git a/src/schematic/types/feature_company_response_data.py b/src/schematic/types/feature_company_response_data.py index 03be715..51b3da0 100644 --- a/src/schematic/types/feature_company_response_data.py +++ b/src/schematic/types/feature_company_response_data.py @@ -11,6 +11,7 @@ from .company_override_response_data import CompanyOverrideResponseData from .credit_grant_detail import CreditGrantDetail from .credit_usage import CreditUsage +from .credit_usage_aggregation import CreditUsageAggregation from .entitlement_price_behavior import EntitlementPriceBehavior from .entitlement_type import EntitlementType from .entitlement_value_type import EntitlementValueType @@ -27,7 +28,7 @@ class FeatureCompanyResponseData(UniversalBaseModel): allocation: typing.Optional[int] = pydantic.Field(default=None) """ - The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted. + The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead). """ allocation_type: EntitlementValueType @@ -42,13 +43,18 @@ class FeatureCompanyResponseData(UniversalBaseModel): credit_grant_details: typing.Optional[typing.List[CreditGrantDetail]] = None credit_grant_reason: typing.Optional[BillingCreditGrantReason] = None credit_remaining: typing.Optional[float] = None - credit_total: typing.Optional[float] = None + credit_total: typing.Optional[float] = pydantic.Field(default=None) + """ + Deprecated: Use credit_remaining instead. + """ + credit_type_icon: typing.Optional[str] = pydantic.Field(default=None) """ Icon identifier for the credit type """ credit_usage: typing.Optional[CreditUsage] = None + credit_usage_aggregation: typing.Optional[CreditUsageAggregation] = None credit_used: typing.Optional[float] = None effective_limit: typing.Optional[int] = pydantic.Field(default=None) """ @@ -115,7 +121,7 @@ class FeatureCompanyResponseData(UniversalBaseModel): usage: typing.Optional[int] = pydantic.Field(default=None) """ - The amount of usage that has been consumed; a null value indicates that usage is not being measured. + The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead). """ yearly_usage_based_price: typing.Optional[BillingPriceView] = None diff --git a/src/schematic/types/feature_usage_response_data.py b/src/schematic/types/feature_usage_response_data.py index a05931b..c809511 100644 --- a/src/schematic/types/feature_usage_response_data.py +++ b/src/schematic/types/feature_usage_response_data.py @@ -9,6 +9,7 @@ from .billing_price_view import BillingPriceView from .company_override_response_data import CompanyOverrideResponseData from .credit_grant_detail import CreditGrantDetail +from .credit_usage_aggregation import CreditUsageAggregation from .entitlement_price_behavior import EntitlementPriceBehavior from .entitlement_type import EntitlementType from .entitlement_value_type import EntitlementValueType @@ -25,7 +26,7 @@ class FeatureUsageResponseData(UniversalBaseModel): allocation: typing.Optional[int] = pydantic.Field(default=None) """ - The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted. + The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead). """ allocation_type: EntitlementValueType @@ -39,12 +40,17 @@ class FeatureUsageResponseData(UniversalBaseModel): credit_grant_details: typing.Optional[typing.List[CreditGrantDetail]] = None credit_grant_reason: typing.Optional[BillingCreditGrantReason] = None credit_remaining: typing.Optional[float] = None - credit_total: typing.Optional[float] = None + credit_total: typing.Optional[float] = pydantic.Field(default=None) + """ + Deprecated: Use credit_remaining instead. + """ + credit_type_icon: typing.Optional[str] = pydantic.Field(default=None) """ Icon identifier for the credit type """ + credit_usage_aggregation: typing.Optional[CreditUsageAggregation] = None credit_used: typing.Optional[float] = None effective_limit: typing.Optional[int] = pydantic.Field(default=None) """ @@ -111,7 +117,7 @@ class FeatureUsageResponseData(UniversalBaseModel): usage: typing.Optional[int] = pydantic.Field(default=None) """ - The amount of usage that has been consumed; a null value indicates that usage is not being measured. + The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead). """ yearly_usage_based_price: typing.Optional[BillingPriceView] = None diff --git a/src/schematic/types/invoice_response_data.py b/src/schematic/types/invoice_response_data.py index 2bd1846..e158880 100644 --- a/src/schematic/types/invoice_response_data.py +++ b/src/schematic/types/invoice_response_data.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .billing_provider_type import BillingProviderType class InvoiceResponseData(UniversalBaseModel): @@ -21,6 +22,7 @@ class InvoiceResponseData(UniversalBaseModel): external_id: typing.Optional[str] = None id: str payment_method_external_id: typing.Optional[str] = None + provider_type: BillingProviderType subscription_external_id: typing.Optional[str] = None subtotal: int updated_at: dt.datetime diff --git a/src/schematic/types/payment_method_response_data.py b/src/schematic/types/payment_method_response_data.py index 0fc085c..55c2a92 100644 --- a/src/schematic/types/payment_method_response_data.py +++ b/src/schematic/types/payment_method_response_data.py @@ -7,6 +7,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .billing_provider_type import BillingProviderType class PaymentMethodResponseData(UniversalBaseModel): @@ -26,6 +27,7 @@ class PaymentMethodResponseData(UniversalBaseModel): external_id: str id: str payment_method_type: str + provider_type: BillingProviderType updated_at: dt.datetime if IS_PYDANTIC_V2: diff --git a/src/schematic/types/upsert_company_request_body.py b/src/schematic/types/upsert_company_request_body.py index 5454ad3..d2b8b06 100644 --- a/src/schematic/types/upsert_company_request_body.py +++ b/src/schematic/types/upsert_company_request_body.py @@ -20,7 +20,7 @@ class UpsertCompanyRequestBody(UniversalBaseModel): last_seen_at: typing.Optional[dt.datetime] = None name: typing.Optional[str] = None - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/upsert_user_request_body.py b/src/schematic/types/upsert_user_request_body.py index b9d0db3..7c13a84 100644 --- a/src/schematic/types/upsert_user_request_body.py +++ b/src/schematic/types/upsert_user_request_body.py @@ -40,7 +40,7 @@ class UpsertUserRequestBody(UniversalBaseModel): last_seen_at: typing.Optional[dt.datetime] = None name: typing.Optional[str] = None - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/upsert_user_sub_request_body.py b/src/schematic/types/upsert_user_sub_request_body.py index 34615f7..c17913a 100644 --- a/src/schematic/types/upsert_user_sub_request_body.py +++ b/src/schematic/types/upsert_user_sub_request_body.py @@ -30,7 +30,7 @@ class UpsertUserSubRequestBody(UniversalBaseModel): last_seen_at: typing.Optional[dt.datetime] = None name: typing.Optional[str] = None - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/types/user_detail_response_data.py b/src/schematic/types/user_detail_response_data.py index 00fc767..76673ad 100644 --- a/src/schematic/types/user_detail_response_data.py +++ b/src/schematic/types/user_detail_response_data.py @@ -19,7 +19,7 @@ class UserDetailResponseData(UniversalBaseModel): keys: typing.List[EntityKeyDetailResponseData] last_seen_at: typing.Optional[dt.datetime] = None name: str - traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + traits: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ A map of trait names to trait values """ diff --git a/src/schematic/webhooks/types/create_webhook_response.py b/src/schematic/webhooks/types/create_webhook_response.py index 73cc9a8..c6ba428 100644 --- a/src/schematic/webhooks/types/create_webhook_response.py +++ b/src/schematic/webhooks/types/create_webhook_response.py @@ -9,7 +9,7 @@ class CreateWebhookResponse(UniversalBaseModel): data: WebhookResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/webhooks/types/delete_webhook_response.py b/src/schematic/webhooks/types/delete_webhook_response.py index 4817d4f..18ab4d9 100644 --- a/src/schematic/webhooks/types/delete_webhook_response.py +++ b/src/schematic/webhooks/types/delete_webhook_response.py @@ -9,7 +9,7 @@ class DeleteWebhookResponse(UniversalBaseModel): data: DeleteResponse - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/webhooks/types/get_webhook_event_response.py b/src/schematic/webhooks/types/get_webhook_event_response.py index 0db01b8..2e7400c 100644 --- a/src/schematic/webhooks/types/get_webhook_event_response.py +++ b/src/schematic/webhooks/types/get_webhook_event_response.py @@ -9,7 +9,7 @@ class GetWebhookEventResponse(UniversalBaseModel): data: WebhookEventDetailResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/webhooks/types/get_webhook_response.py b/src/schematic/webhooks/types/get_webhook_response.py index 0c05baa..45daf01 100644 --- a/src/schematic/webhooks/types/get_webhook_response.py +++ b/src/schematic/webhooks/types/get_webhook_response.py @@ -9,7 +9,7 @@ class GetWebhookResponse(UniversalBaseModel): data: WebhookResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/src/schematic/webhooks/types/update_webhook_response.py b/src/schematic/webhooks/types/update_webhook_response.py index b340b7e..462b09e 100644 --- a/src/schematic/webhooks/types/update_webhook_response.py +++ b/src/schematic/webhooks/types/update_webhook_response.py @@ -9,7 +9,7 @@ class UpdateWebhookResponse(UniversalBaseModel): data: WebhookResponseData - params: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + params: typing.Dict[str, typing.Any] = pydantic.Field() """ Input parameters """ diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py index a2a5554..609210b 100644 --- a/tests/utils/test_http_client.py +++ b/tests/utils/test_http_client.py @@ -1,13 +1,51 @@ # This file was auto-generated by Fern from our API Definition. -from schematic.core.http_client import get_request_body +from typing import Any, Dict + +import pytest + +from schematic.core.http_client import AsyncHttpClient, HttpClient, get_request_body, remove_none_from_dict from schematic.core.request_options import RequestOptions +# Stub clients for testing HttpClient and AsyncHttpClient +class _DummySyncClient: + """A minimal stub for httpx.Client that records request arguments.""" + + def __init__(self) -> None: + self.last_request_kwargs: Dict[str, Any] = {} + + def request(self, **kwargs: Any) -> "_DummyResponse": + self.last_request_kwargs = kwargs + return _DummyResponse() + + +class _DummyAsyncClient: + """A minimal stub for httpx.AsyncClient that records request arguments.""" + + def __init__(self) -> None: + self.last_request_kwargs: Dict[str, Any] = {} + + async def request(self, **kwargs: Any) -> "_DummyResponse": + self.last_request_kwargs = kwargs + return _DummyResponse() + + +class _DummyResponse: + """A minimal stub for httpx.Response.""" + + status_code = 200 + headers: Dict[str, str] = {} + + def get_request_options() -> RequestOptions: return {"additional_body_parameters": {"see you": "later"}} +def get_request_options_with_none() -> RequestOptions: + return {"additional_body_parameters": {"see you": "later", "optional": None}} + + def test_get_json_request_body() -> None: json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) assert json_body == {"hello": "world"} @@ -48,14 +86,181 @@ def test_get_none_request_body() -> None: def test_get_empty_json_request_body() -> None: + """Test that implicit empty bodies (json=None) are collapsed to None.""" unrelated_request_options: RequestOptions = {"max_retries": 3} json_body, data_body = get_request_body(json=None, data=None, request_options=unrelated_request_options, omit=None) assert json_body is None assert data_body is None - json_body_extras, data_body_extras = get_request_body( - json={}, data=None, request_options=unrelated_request_options, omit=None + +def test_explicit_empty_json_body_is_preserved() -> None: + """Test that explicit empty bodies (json={}) are preserved and sent as {}. + + This is important for endpoints where the request body is required but all + fields are optional. The server expects valid JSON ({}) not an empty body. + """ + unrelated_request_options: RequestOptions = {"max_retries": 3} + + # Explicit json={} should be preserved + json_body, data_body = get_request_body(json={}, data=None, request_options=unrelated_request_options, omit=None) + assert json_body == {} + assert data_body is None + + # Explicit data={} should also be preserved + json_body2, data_body2 = get_request_body(json=None, data={}, request_options=unrelated_request_options, omit=None) + assert json_body2 is None + assert data_body2 == {} + + +def test_json_body_preserves_none_values() -> None: + """Test that JSON bodies preserve None values (they become JSON null).""" + json_body, data_body = get_request_body( + json={"hello": "world", "optional": None}, data=None, request_options=None, omit=None + ) + # JSON bodies should preserve None values + assert json_body == {"hello": "world", "optional": None} + assert data_body is None + + +def test_data_body_preserves_none_values_without_multipart() -> None: + """Test that data bodies preserve None values when not using multipart. + + The filtering of None values happens in HttpClient.request/stream methods, + not in get_request_body. This test verifies get_request_body doesn't filter None. + """ + json_body, data_body = get_request_body( + json=None, data={"hello": "world", "optional": None}, request_options=None, omit=None ) + # get_request_body should preserve None values in data body + # The filtering happens later in HttpClient.request when multipart is detected + assert data_body == {"hello": "world", "optional": None} + assert json_body is None - assert json_body_extras is None - assert data_body_extras is None + +def test_remove_none_from_dict_filters_none_values() -> None: + """Test that remove_none_from_dict correctly filters out None values.""" + original = {"hello": "world", "optional": None, "another": "value", "also_none": None} + filtered = remove_none_from_dict(original) + assert filtered == {"hello": "world", "another": "value"} + # Original should not be modified + assert original == {"hello": "world", "optional": None, "another": "value", "also_none": None} + + +def test_remove_none_from_dict_empty_dict() -> None: + """Test that remove_none_from_dict handles empty dict.""" + assert remove_none_from_dict({}) == {} + + +def test_remove_none_from_dict_all_none() -> None: + """Test that remove_none_from_dict handles dict with all None values.""" + assert remove_none_from_dict({"a": None, "b": None}) == {} + + +def test_http_client_does_not_pass_empty_params_list() -> None: + """Test that HttpClient passes params=None when params are empty. + + This prevents httpx from stripping existing query parameters from the URL, + which happens when params=[] or params={} is passed. + """ + dummy_client = _DummySyncClient() + http_client = HttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com", + ) + + # Use a path with query params (e.g., pagination cursor URL) + http_client.request( + path="resource?after=123", + method="GET", + params=None, + request_options=None, + ) + + # We care that httpx receives params=None, not [] or {} + assert "params" in dummy_client.last_request_kwargs + assert dummy_client.last_request_kwargs["params"] is None + + # Verify the query string in the URL is preserved + url = str(dummy_client.last_request_kwargs["url"]) + assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}" + + +def test_http_client_passes_encoded_params_when_present() -> None: + """Test that HttpClient passes encoded params when params are provided.""" + dummy_client = _DummySyncClient() + http_client = HttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com/resource", + ) + + http_client.request( + path="", + method="GET", + params={"after": "456"}, + request_options=None, + ) + + params = dummy_client.last_request_kwargs["params"] + # For a simple dict, encode_query should give a single (key, value) tuple + assert params == [("after", "456")] + + +@pytest.mark.asyncio +async def test_async_http_client_does_not_pass_empty_params_list() -> None: + """Test that AsyncHttpClient passes params=None when params are empty. + + This prevents httpx from stripping existing query parameters from the URL, + which happens when params=[] or params={} is passed. + """ + dummy_client = _DummyAsyncClient() + http_client = AsyncHttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com", + async_base_headers=None, + ) + + # Use a path with query params (e.g., pagination cursor URL) + await http_client.request( + path="resource?after=123", + method="GET", + params=None, + request_options=None, + ) + + # We care that httpx receives params=None, not [] or {} + assert "params" in dummy_client.last_request_kwargs + assert dummy_client.last_request_kwargs["params"] is None + + # Verify the query string in the URL is preserved + url = str(dummy_client.last_request_kwargs["url"]) + assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}" + + +@pytest.mark.asyncio +async def test_async_http_client_passes_encoded_params_when_present() -> None: + """Test that AsyncHttpClient passes encoded params when params are provided.""" + dummy_client = _DummyAsyncClient() + http_client = AsyncHttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com/resource", + async_base_headers=None, + ) + + await http_client.request( + path="", + method="GET", + params={"after": "456"}, + request_options=None, + ) + + params = dummy_client.last_request_kwargs["params"] + # For a simple dict, encode_query should give a single (key, value) tuple + assert params == [("after", "456")]