diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b865379..40293964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: name: lint runs-on: ubuntu-latest - if: github.repository == 'orbcorp/orb-python' + steps: - uses: actions/checkout@v4 @@ -33,7 +33,6 @@ jobs: test: name: test runs-on: ubuntu-latest - if: github.repository == 'orbcorp/orb-python' steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 43515db3..65f558e7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.50.1" + ".": "2.0.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f069adb9..16809d9a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 91 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-83ae433113181f3839cc63db01cc7c815de1fff597a1cbaf8ffda48ba98268c9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-67c238400cda65d40994581c7d37ad182a7d737e8abf3accfbc5ac5b04f64f07.yml diff --git a/pyproject.toml b/pyproject.toml index 36bfc2ff..2e02d835 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "1.50.1" +version = "2.0.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" @@ -76,10 +76,13 @@ format = { chain = [ "lint" = { chain = [ "check:ruff", "typecheck", + "check:importable", ]} "check:ruff" = "ruff check ." "fix:ruff" = "ruff check --fix ." +"check:importable" = "python -c 'import orb'" + typecheck = { chain = [ "typecheck:pyright", "typecheck:mypy" @@ -195,7 +198,6 @@ unfixable = [ "T201", "T203", ] -ignore-init-module-imports = true [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" @@ -207,7 +209,7 @@ combine-as-imports = true extra-standard-library = ["typing_extensions"] known-first-party = ["orb", "tests"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "bin/**.py" = ["T201", "T203"] "scripts/**.py" = ["T201", "T203"] "tests/**.py" = ["T201", "T203"] diff --git a/scripts/mock b/scripts/mock index f5861576..d2814ae6 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" fi diff --git a/src/orb/_version.py b/src/orb/_version.py index fb6773b7..72aa4e1e 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "1.50.1" # x-release-please-version +__version__ = "2.0.0" # x-release-please-version diff --git a/src/orb/resources/alerts.py b/src/orb/resources/alerts.py index 99894754..38f5a820 100644 --- a/src/orb/resources/alerts.py +++ b/src/orb/resources/alerts.py @@ -4,6 +4,7 @@ from typing import Union, Iterable, Optional from datetime import datetime +from typing_extensions import Literal import httpx @@ -154,7 +155,13 @@ def create_for_customer( customer_id: str, *, currency: str, - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -179,9 +186,9 @@ def create_for_customer( Args: currency: The case sensitive currency or custom pricing unit to use for this alert. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. extra_headers: Send extra headers @@ -220,7 +227,13 @@ def create_for_external_customer( external_customer_id: str, *, currency: str, - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -245,9 +258,9 @@ def create_for_external_customer( Args: currency: The case sensitive currency or custom pricing unit to use for this alert. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. extra_headers: Send extra headers @@ -288,7 +301,13 @@ def create_for_subscription( subscription_id: str, *, thresholds: Iterable[alert_create_for_subscription_params.Threshold], - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], metric_id: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -312,9 +331,9 @@ def create_for_subscription( usage or cost conditions met during the current billing cycle. Args: - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. metric_id: The metric to track usage for. @@ -560,7 +579,13 @@ async def create_for_customer( customer_id: str, *, currency: str, - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -585,9 +610,9 @@ async def create_for_customer( Args: currency: The case sensitive currency or custom pricing unit to use for this alert. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. extra_headers: Send extra headers @@ -626,7 +651,13 @@ async def create_for_external_customer( external_customer_id: str, *, currency: str, - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -651,9 +682,9 @@ async def create_for_external_customer( Args: currency: The case sensitive currency or custom pricing unit to use for this alert. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. extra_headers: Send extra headers @@ -694,7 +725,13 @@ async def create_for_subscription( subscription_id: str, *, thresholds: Iterable[alert_create_for_subscription_params.Threshold], - type: str, + type: Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ], metric_id: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -718,9 +755,9 @@ async def create_for_subscription( usage or cost conditions met during the current billing cycle. Args: - thresholds: The thresholds for the alert. + thresholds: The thresholds that define the values at which the alert will be triggered. - type: The thresholds that define the values at which the alert will be triggered. + type: The type of alert to create. This must be a valid alert type. metric_id: The metric to track usage for. diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index ae719e3e..0c7edc7b 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -367,6 +367,10 @@ def ingest( accurately map usage to the correct billing cycle and ensure that all usage is billed for in the corresponding billing period. + In general, Orb does not expect events with future dated timestamps. In cases + where the timestamp is at least 24 hours ahead of the current time, the event + will not be accepted as a valid event, and will throw validation errors. + ## Event validation Orb’s validation ensures that you recognize errors in your events as quickly as @@ -897,6 +901,10 @@ async def ingest( accurately map usage to the correct billing cycle and ensure that all usage is billed for in the corresponding billing period. + In general, Orb does not expect events with future dated timestamps. In cases + where the timestamp is at least 24 hours ahead of the current time, the event + will not be accepted as a valid event, and will throw validation errors. + ## Event validation Orb’s validation ensures that you recognize errors in your events as quickly as diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 85c0ac8c..f522e06f 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -10,7 +10,6 @@ from .. import _legacy_response from ..types import ( - shared_params, invoice_list_params, invoice_create_params, invoice_update_params, @@ -28,6 +27,7 @@ from ..pagination import SyncPage, AsyncPage from .._base_client import AsyncPaginator, make_request_options from ..types.invoice import Invoice +from ..types.shared_params.discount import Discount from ..types.invoice_fetch_upcoming_response import InvoiceFetchUpcomingResponse __all__ = ["Invoices", "AsyncInvoices"] @@ -50,7 +50,7 @@ def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, - discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, + discount: Optional[Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, @@ -516,7 +516,7 @@ async def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, - discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, + discount: Optional[Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, diff --git a/src/orb/types/alert_create_for_customer_params.py b/src/orb/types/alert_create_for_customer_params.py index 4cf86a52..5eeec557 100644 --- a/src/orb/types/alert_create_for_customer_params.py +++ b/src/orb/types/alert_create_for_customer_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["AlertCreateForCustomerParams", "Threshold"] @@ -12,11 +12,19 @@ class AlertCreateForCustomerParams(TypedDict, total=False): currency: Required[str] """The case sensitive currency or custom pricing unit to use for this alert.""" - type: Required[str] - """The thresholds that define the values at which the alert will be triggered.""" + type: Required[ + Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ] + ] + """The type of alert to create. This must be a valid alert type.""" thresholds: Optional[Iterable[Threshold]] - """The thresholds for the alert.""" + """The thresholds that define the values at which the alert will be triggered.""" class Threshold(TypedDict, total=False): diff --git a/src/orb/types/alert_create_for_external_customer_params.py b/src/orb/types/alert_create_for_external_customer_params.py index b03e287f..6732f61c 100644 --- a/src/orb/types/alert_create_for_external_customer_params.py +++ b/src/orb/types/alert_create_for_external_customer_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["AlertCreateForExternalCustomerParams", "Threshold"] @@ -12,11 +12,19 @@ class AlertCreateForExternalCustomerParams(TypedDict, total=False): currency: Required[str] """The case sensitive currency or custom pricing unit to use for this alert.""" - type: Required[str] - """The thresholds that define the values at which the alert will be triggered.""" + type: Required[ + Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ] + ] + """The type of alert to create. This must be a valid alert type.""" thresholds: Optional[Iterable[Threshold]] - """The thresholds for the alert.""" + """The thresholds that define the values at which the alert will be triggered.""" class Threshold(TypedDict, total=False): diff --git a/src/orb/types/alert_create_for_subscription_params.py b/src/orb/types/alert_create_for_subscription_params.py index a84a7bd1..767408dc 100644 --- a/src/orb/types/alert_create_for_subscription_params.py +++ b/src/orb/types/alert_create_for_subscription_params.py @@ -3,18 +3,26 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["AlertCreateForSubscriptionParams", "Threshold"] class AlertCreateForSubscriptionParams(TypedDict, total=False): thresholds: Required[Iterable[Threshold]] - """The thresholds for the alert.""" - - type: Required[str] """The thresholds that define the values at which the alert will be triggered.""" + type: Required[ + Literal[ + "usage_exceeded", + "cost_exceeded", + "credit_balance_depleted", + "credit_balance_dropped", + "credit_balance_recovered", + ] + ] + """The type of alert to create. This must be a valid alert type.""" + metric_id: Optional[str] """The metric to track usage for.""" diff --git a/src/orb/types/invoice_create_params.py b/src/orb/types/invoice_create_params.py index ffe24569..78e22ea8 100644 --- a/src/orb/types/invoice_create_params.py +++ b/src/orb/types/invoice_create_params.py @@ -6,8 +6,8 @@ from datetime import date, datetime from typing_extensions import Literal, Required, Annotated, TypedDict -from ..types import shared_params from .._utils import PropertyInfo +from .shared_params.discount import Discount __all__ = ["InvoiceCreateParams", "LineItem", "LineItemUnitConfig"] @@ -42,7 +42,7 @@ class InvoiceCreateParams(TypedDict, total=False): One of `customer_id` and `external_customer_id` are required. """ - discount: Optional[shared_params.Discount] + discount: Optional[Discount] """An optional discount to attach to the invoice.""" external_customer_id: Optional[str] diff --git a/tests/api_resources/test_alerts.py b/tests/api_resources/test_alerts.py index a96b00b0..d1caa338 100644 --- a/tests/api_resources/test_alerts.py +++ b/tests/api_resources/test_alerts.py @@ -108,7 +108,7 @@ def test_method_create_for_customer(self, client: Orb) -> None: alert = client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -117,7 +117,7 @@ def test_method_create_for_customer_with_all_params(self, client: Orb) -> None: alert = client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -127,7 +127,7 @@ def test_raw_response_create_for_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -140,7 +140,7 @@ def test_streaming_response_create_for_customer(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -156,7 +156,7 @@ def test_path_params_create_for_customer(self, client: Orb) -> None: client.alerts.with_raw_response.create_for_customer( customer_id="", currency="currency", - type="type", + type="usage_exceeded", ) @parametrize @@ -164,7 +164,7 @@ def test_method_create_for_external_customer(self, client: Orb) -> None: alert = client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -173,7 +173,7 @@ def test_method_create_for_external_customer_with_all_params(self, client: Orb) alert = client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -183,7 +183,7 @@ def test_raw_response_create_for_external_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -196,7 +196,7 @@ def test_streaming_response_create_for_external_customer(self, client: Orb) -> N with client.alerts.with_streaming_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -212,7 +212,7 @@ def test_path_params_create_for_external_customer(self, client: Orb) -> None: client.alerts.with_raw_response.create_for_external_customer( external_customer_id="", currency="currency", - type="type", + type="usage_exceeded", ) @parametrize @@ -220,7 +220,7 @@ def test_method_create_for_subscription(self, client: Orb) -> None: alert = client.alerts.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -229,7 +229,7 @@ def test_method_create_for_subscription_with_all_params(self, client: Orb) -> No alert = client.alerts.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", metric_id="metric_id", ) assert_matches_type(Alert, alert, path=["response"]) @@ -239,7 +239,7 @@ def test_raw_response_create_for_subscription(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -252,7 +252,7 @@ def test_streaming_response_create_for_subscription(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -268,7 +268,7 @@ def test_path_params_create_for_subscription(self, client: Orb) -> None: client.alerts.with_raw_response.create_for_subscription( subscription_id="", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) @parametrize @@ -442,7 +442,7 @@ async def test_method_create_for_customer(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -451,7 +451,7 @@ async def test_method_create_for_customer_with_all_params(self, async_client: As alert = await async_client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -461,7 +461,7 @@ async def test_raw_response_create_for_customer(self, async_client: AsyncOrb) -> response = await async_client.alerts.with_raw_response.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -474,7 +474,7 @@ async def test_streaming_response_create_for_customer(self, async_client: AsyncO async with async_client.alerts.with_streaming_response.create_for_customer( customer_id="customer_id", currency="currency", - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -490,7 +490,7 @@ async def test_path_params_create_for_customer(self, async_client: AsyncOrb) -> await async_client.alerts.with_raw_response.create_for_customer( customer_id="", currency="currency", - type="type", + type="usage_exceeded", ) @parametrize @@ -498,7 +498,7 @@ async def test_method_create_for_external_customer(self, async_client: AsyncOrb) alert = await async_client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -507,7 +507,7 @@ async def test_method_create_for_external_customer_with_all_params(self, async_c alert = await async_client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -517,7 +517,7 @@ async def test_raw_response_create_for_external_customer(self, async_client: Asy response = await async_client.alerts.with_raw_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -530,7 +530,7 @@ async def test_streaming_response_create_for_external_customer(self, async_clien async with async_client.alerts.with_streaming_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -546,7 +546,7 @@ async def test_path_params_create_for_external_customer(self, async_client: Asyn await async_client.alerts.with_raw_response.create_for_external_customer( external_customer_id="", currency="currency", - type="type", + type="usage_exceeded", ) @parametrize @@ -554,7 +554,7 @@ async def test_method_create_for_subscription(self, async_client: AsyncOrb) -> N alert = await async_client.alerts.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) assert_matches_type(Alert, alert, path=["response"]) @@ -563,7 +563,7 @@ async def test_method_create_for_subscription_with_all_params(self, async_client alert = await async_client.alerts.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", metric_id="metric_id", ) assert_matches_type(Alert, alert, path=["response"]) @@ -573,7 +573,7 @@ async def test_raw_response_create_for_subscription(self, async_client: AsyncOrb response = await async_client.alerts.with_raw_response.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) assert response.is_closed is True @@ -586,7 +586,7 @@ async def test_streaming_response_create_for_subscription(self, async_client: As async with async_client.alerts.with_streaming_response.create_for_subscription( subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -602,7 +602,7 @@ async def test_path_params_create_for_subscription(self, async_client: AsyncOrb) await async_client.alerts.with_raw_response.create_for_subscription( subscription_id="", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="type", + type="usage_exceeded", ) @parametrize diff --git a/tests/api_resources/test_customers.py b/tests/api_resources/test_customers.py index 89174717..11ab9253 100644 --- a/tests/api_resources/test_customers.py +++ b/tests/api_resources/test_customers.py @@ -35,31 +35,31 @@ def test_method_create_with_all_params(self, client: Orb) -> None: email="email", name="name", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string", "string", "string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email_delivery=True, @@ -69,12 +69,12 @@ def test_method_create_with_all_params(self, client: Orb) -> None: payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", @@ -123,31 +123,31 @@ def test_method_update_with_all_params(self, client: Orb) -> None: customer = client.customers.update( customer_id="customer_id", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email="email", @@ -159,12 +159,12 @@ def test_method_update_with_all_params(self, client: Orb) -> None: payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", @@ -368,31 +368,31 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None customer = client.customers.update_by_external_id( id="external_customer_id", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email="email", @@ -404,12 +404,12 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", @@ -469,31 +469,31 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No email="email", name="name", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string", "string", "string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email_delivery=True, @@ -503,12 +503,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", @@ -557,31 +557,31 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No customer = await async_client.customers.update( customer_id="customer_id", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email="email", @@ -593,12 +593,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", @@ -802,31 +802,31 @@ async def test_method_update_by_external_id_with_all_params(self, async_client: customer = await async_client.customers.update_by_external_id( id="external_customer_id", accounting_sync_configuration={ - "excluded": True, "accounting_providers": [ { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, { - "provider_type": "provider_type", "external_provider_id": "external_provider_id", + "provider_type": "provider_type", }, ], + "excluded": True, }, additional_emails=["string"], auto_collection=True, billing_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, currency="currency", email="email", @@ -838,12 +838,12 @@ async def test_method_update_by_external_id_with_all_params(self, async_client: payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ + "city": "city", + "country": "country", "line1": "line1", "line2": "line2", - "city": "city", - "state": "state", "postal_code": "postal_code", - "country": "country", + "state": "state", }, tax_id={ "country": "AD", diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index d179e3bf..7e77f4b4 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -129,21 +129,21 @@ def test_method_ingest(self, client: Orb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) @@ -154,28 +154,28 @@ def test_method_ingest_with_all_params(self, client: Orb) -> None: event = client.events.ingest( events=[ { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", - }, - { + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "customer_id": "customer_id", "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - "idempotency_key": "idempotency_key", }, { + "event_name": "event_name", + "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "customer_id": "customer_id", "external_customer_id": "external_customer_id", + }, + { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", }, ], backfill_id="backfill_id", @@ -189,21 +189,21 @@ def test_raw_response_ingest(self, client: Orb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) @@ -219,21 +219,21 @@ def test_streaming_response_ingest(self, client: Orb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) as response: @@ -395,21 +395,21 @@ async def test_method_ingest(self, async_client: AsyncOrb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) @@ -420,28 +420,28 @@ async def test_method_ingest_with_all_params(self, async_client: AsyncOrb) -> No event = await async_client.events.ingest( events=[ { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", - }, - { + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "customer_id": "customer_id", "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - "idempotency_key": "idempotency_key", }, { + "event_name": "event_name", + "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "customer_id": "customer_id", "external_customer_id": "external_customer_id", + }, + { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", }, ], backfill_id="backfill_id", @@ -455,21 +455,21 @@ async def test_raw_response_ingest(self, async_client: AsyncOrb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) @@ -485,21 +485,21 @@ async def test_streaming_response_ingest(self, async_client: AsyncOrb) -> None: events=[ { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, { "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, "idempotency_key": "idempotency_key", + "properties": {}, + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), }, ], ) as response: diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 01747b5f..c4394fce 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -29,30 +29,30 @@ def test_method_create(self, client: Orb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], @@ -67,40 +67,40 @@ def test_method_create_with_all_params(self, client: Orb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, customer_id="4khy3nwzktxv7", discount={ - "discount_type": "percentage", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], - "reason": "reason", + "discount_type": "percentage", "percentage_discount": 0.15, + "reason": "reason", }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", @@ -116,30 +116,30 @@ def test_raw_response_create(self, client: Orb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], @@ -158,30 +158,30 @@ def test_streaming_response_create(self, client: Orb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], @@ -500,30 +500,30 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], @@ -538,40 +538,40 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, customer_id="4khy3nwzktxv7", discount={ - "discount_type": "percentage", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], - "reason": "reason", + "discount_type": "percentage", "percentage_discount": 0.15, + "reason": "reason", }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", @@ -587,30 +587,30 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], @@ -629,30 +629,30 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, { - "start_date": parse_date("2023-09-22"), "end_date": parse_date("2023-09-22"), - "quantity": 1, - "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", + "name": "Line Item Name", + "quantity": 1, + "start_date": parse_date("2023-09-22"), "unit_config": {"unit_amount": "unit_amount"}, }, ], diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 5588af1e..d0dec0a4 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -26,10 +26,10 @@ def test_method_create(self, client: Orb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], @@ -43,19 +43,19 @@ def test_method_create_with_all_params(self, client: Orb) -> None: name="name", prices=[ { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, - "fixed_price_quantity": 0, - "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, "currency": "currency", + "external_price_id": "external_price_id", + "fixed_price_quantity": 0, + "invoice_grouping_key": "invoice_grouping_key", + "metadata": {"foo": "string"}, } ], default_invoice_memo="default_invoice_memo", @@ -73,10 +73,10 @@ def test_raw_response_create(self, client: Orb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], @@ -94,10 +94,10 @@ def test_streaming_response_create(self, client: Orb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], @@ -244,10 +244,10 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], @@ -261,19 +261,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No name="name", prices=[ { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, - "fixed_price_quantity": 0, - "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, "currency": "currency", + "external_price_id": "external_price_id", + "fixed_price_quantity": 0, + "invoice_grouping_key": "invoice_grouping_key", + "metadata": {"foo": "string"}, } ], default_invoice_memo="default_invoice_memo", @@ -291,10 +291,10 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], @@ -312,10 +312,10 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: name="name", prices=[ { - "name": "Annual fee", - "item_id": "item_id", "cadence": "annual", + "item_id": "item_id", "model_type": "unit", + "name": "Annual fee", "unit_config": {"unit_amount": "unit_amount"}, } ], diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index 3605de89..0999b97f 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -171,20 +171,20 @@ def test_method_create_overload_3(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -200,20 +200,20 @@ def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -236,20 +236,20 @@ def test_raw_response_create_overload_3(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -269,20 +269,20 @@ def test_streaming_response_create_overload_3(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -304,23 +304,23 @@ def test_method_create_overload_4(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -334,23 +334,23 @@ def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -371,23 +371,23 @@ def test_raw_response_create_overload_4(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -405,23 +405,23 @@ def test_streaming_response_create_overload_4(self, client: Orb) -> None: currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -473,18 +473,18 @@ def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: "tiers": [ { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, ] }, @@ -573,16 +573,16 @@ def test_method_create_overload_6(self, client: Orb) -> None: tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -600,21 +600,21 @@ def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: tiered_bps_config={ "tiers": [ { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, ] @@ -640,16 +640,16 @@ def test_raw_response_create_overload_6(self, client: Orb) -> None: tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -671,16 +671,16 @@ def test_streaming_response_create_overload_6(self, client: Orb) -> None: tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -779,18 +779,18 @@ def test_method_create_with_all_params_overload_8(self, client: Orb) -> None: bulk_bps_config={ "tiers": [ { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, ] @@ -868,16 +868,16 @@ def test_method_create_with_all_params_overload_9(self, client: Orb) -> None: bulk_config={ "tiers": [ { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, ] }, @@ -1856,20 +1856,20 @@ async def test_method_create_overload_3(self, async_client: AsyncOrb) -> None: currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -1885,20 +1885,20 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -1921,20 +1921,20 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncOrb) -> N currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -1954,20 +1954,20 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncOrb currency="currency", item_id="item_id", matrix_config={ - "dimensions": ["string", "string", "string"], "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], }, @@ -1989,23 +1989,23 @@ async def test_method_create_overload_4(self, async_client: AsyncOrb) -> None: currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -2019,23 +2019,23 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -2056,23 +2056,23 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncOrb) -> N currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -2090,23 +2090,23 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncOrb currency="currency", item_id="item_id", matrix_with_allocation_config={ - "dimensions": ["string", "string", "string"], + "allocation": 0, "default_unit_amount": "default_unit_amount", + "dimensions": ["string", "string", "string"], "matrix_values": [ { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, { - "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], + "unit_amount": "unit_amount", }, ], - "allocation": 0, }, model_type="matrix_with_allocation", name="Annual fee", @@ -2158,18 +2158,18 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn "tiers": [ { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, { "first_unit": 0, - "last_unit": 0, "unit_amount": "unit_amount", + "last_unit": 0, }, ] }, @@ -2258,16 +2258,16 @@ async def test_method_create_overload_6(self, async_client: AsyncOrb) -> None: tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -2285,21 +2285,21 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn tiered_bps_config={ "tiers": [ { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, { + "bps": 0, "minimum_amount": "minimum_amount", "maximum_amount": "maximum_amount", - "bps": 0, "per_unit_maximum": "per_unit_maximum", }, ] @@ -2325,16 +2325,16 @@ async def test_raw_response_create_overload_6(self, async_client: AsyncOrb) -> N tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -2356,16 +2356,16 @@ async def test_streaming_response_create_overload_6(self, async_client: AsyncOrb tiered_bps_config={ "tiers": [ { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, { - "minimum_amount": "minimum_amount", "bps": 0, + "minimum_amount": "minimum_amount", }, ] }, @@ -2464,18 +2464,18 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn bulk_bps_config={ "tiers": [ { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "maximum_amount", "bps": 0, + "maximum_amount": "maximum_amount", "per_unit_maximum": "per_unit_maximum", }, ] @@ -2553,16 +2553,16 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn bulk_config={ "tiers": [ { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, { - "maximum_units": 0, "unit_amount": "unit_amount", + "maximum_units": 0, }, ] }, diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 51b93500..2e7e9a7d 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -54,56 +54,56 @@ def test_method_create_with_all_params(self, client: Orb) -> None: { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, ], start_date=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -483,182 +483,182 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: subscription_id="subscription_id", add=[ { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", - "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", - "name": "Annual fee", - "billable_metric_id": "billable_metric_id", - "item_id": "item_id", - "billed_in_advance": True, - "fixed_price_quantity": 0, - "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", - }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, - }, - { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", + "minimum_amount": 0, "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", "fixed_price_quantity": 0, "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", + "metadata": {"foo": "string"}, }, + "price_id": "h74gfhdjvn7ujokd", + }, + { + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, - }, - { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", + "minimum_amount": 0, "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", "fixed_price_quantity": 0, "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", + "metadata": {"foo": "string"}, }, + "price_id": "h74gfhdjvn7ujokd", + }, + { + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, + "minimum_amount": 0, + "price": { + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", + "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, + "billable_metric_id": "billable_metric_id", + "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", + "fixed_price_quantity": 0, + "invoice_grouping_key": "invoice_grouping_key", + "metadata": {"foo": "string"}, + }, + "price_id": "h74gfhdjvn7ujokd", }, ], add_adjustments=[ { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -666,8 +666,8 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: }, { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -675,8 +675,8 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: }, { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -686,80 +686,80 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, ], edit_adjustments=[ { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, ], ) @@ -826,56 +826,56 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, ], ) @@ -1170,56 +1170,56 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, ], start_date=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1599,182 +1599,182 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO subscription_id="subscription_id", add=[ { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", - "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", - "name": "Annual fee", - "billable_metric_id": "billable_metric_id", - "item_id": "item_id", - "billed_in_advance": True, - "fixed_price_quantity": 0, - "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", - }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, - }, - { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", + "minimum_amount": 0, "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", "fixed_price_quantity": 0, "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", + "metadata": {"foo": "string"}, }, + "price_id": "h74gfhdjvn7ujokd", + }, + { + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, - }, - { - "price_id": "h74gfhdjvn7ujokd", - "external_price_id": "external_price_id", + "minimum_amount": 0, "price": { - "metadata": {"foo": "string"}, - "external_price_id": "external_price_id", + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, "billable_metric_id": "billable_metric_id", - "item_id": "item_id", "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", "fixed_price_quantity": 0, "invoice_grouping_key": "invoice_grouping_key", - "cadence": "annual", - "conversion_rate": 0, - "model_type": "unit", - "unit_config": {"unit_amount": "unit_amount"}, - "currency": "currency", + "metadata": {"foo": "string"}, }, + "price_id": "h74gfhdjvn7ujokd", + }, + { + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "allocation_price": { - "currency": "USD", "amount": "10.00", - "cadence": "monthly", + "cadence": "one_time", + "currency": "USD", "expires_at_end_of_cadence": True, }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "fixed_fee_quantity_transitions": [ + "discounts": [ { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, { - "quantity": 5, - "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "amount_discount": 0, + "discount_type": "amount", }, ], - "discounts": [ + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "external_price_id": "external_price_id", + "fixed_fee_quantity_transitions": [ { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "discount_type": "amount", - "amount_discount": 0, + "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "minimum_amount": 0, "maximum_amount": 0, + "minimum_amount": 0, + "price": { + "cadence": "annual", + "currency": "currency", + "item_id": "item_id", + "model_type": "unit", + "name": "Annual fee", + "unit_config": {"unit_amount": "unit_amount"}, + "billable_metric_id": "billable_metric_id", + "billed_in_advance": True, + "conversion_rate": 0, + "external_price_id": "external_price_id", + "fixed_price_quantity": 0, + "invoice_grouping_key": "invoice_grouping_key", + "metadata": {"foo": "string"}, + }, + "price_id": "h74gfhdjvn7ujokd", }, ], add_adjustments=[ { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1782,8 +1782,8 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO }, { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1791,8 +1791,8 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO }, { "adjustment": { - "applies_to_price_ids": ["price_1", "price_2"], "adjustment_type": "percentage_discount", + "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1802,80 +1802,80 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "price_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "billing_cycle_day": 0, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, { - "quantity": 5, "effective_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "quantity": 5, }, ], - "billing_cycle_day": 0, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, ], edit_adjustments=[ { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, { "adjustment_interval_id": "sdfs6wdjvn7ujokd", - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), }, ], ) @@ -1942,56 +1942,56 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, { "id": "id", "model_type": "unit", - "minimum_amount": "1.23", - "maximum_amount": "1.23", - "currency": "currency", + "unit_config": {"unit_amount": "unit_amount"}, "conversion_rate": 0, + "currency": "currency", "discount": { "discount_type": "percentage", + "amount_discount": "amount_discount", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], "percentage_discount": 0.15, "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "amount_discount", - "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "unit_amount"}, + "maximum_amount": "1.23", + "minimum_amount": "1.23", }, ], )