diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 03276cfb..809fed12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.12.0" + ".": "4.13.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5c39bf21..9f1d47fd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6b2550b95f82872b3825619c109352352b9c92281c8b2470fce158e971142881.yml -openapi_spec_hash: 379df18de1af6a9d0b50d3653aab4d44 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-9dda3e74d276c581c08bea0cad47ae390143d94640f267d827caf234301f2721.yml +openapi_spec_hash: 60daf7a378cdf7dd1f7338c303e2d661 config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 27124322..01fedede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.13.0 (2025-09-03) + +Full Changelog: [v4.12.0...v4.13.0](https://github.com/orbcorp/orb-python/compare/v4.12.0...v4.13.0) + +### Features + +* **api:** api update ([2d0fee8](https://github.com/orbcorp/orb-python/commit/2d0fee8abad781f852eea8a081418626f27db1a1)) +* improve future compat with pydantic v3 ([28610aa](https://github.com/orbcorp/orb-python/commit/28610aa75f6e33ef94f8baa6b9618b5741050e2a)) + ## 4.12.0 (2025-09-03) Full Changelog: [v4.11.1...v4.12.0](https://github.com/orbcorp/orb-python/compare/v4.11.1...v4.12.0) diff --git a/api.md b/api.md index 46581a39..7da7b873 100644 --- a/api.md +++ b/api.md @@ -96,7 +96,6 @@ from orb.types import ( NewPlanScalableMatrixWithTieredPricingPrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanThresholdTotalAmountPrice, - NewPlanTierWithProrationPrice, NewPlanTieredPackagePrice, NewPlanTieredPackageWithMinimumPrice, NewPlanTieredPrice, @@ -125,7 +124,6 @@ from orb.types import ( SubscriptionTrialInfo, TaxAmount, Tier, - TierConfig, TierSubLineItem, TieredConfig, TieredConversionRateConfig, @@ -515,7 +513,6 @@ from orb.types import ( NewSubscriptionScalableMatrixWithTieredPricingPrice, NewSubscriptionScalableMatrixWithUnitPricingPrice, NewSubscriptionThresholdTotalAmountPrice, - NewSubscriptionTierWithProrationPrice, NewSubscriptionTieredPackagePrice, NewSubscriptionTieredPackageWithMinimumPrice, NewSubscriptionTieredPrice, diff --git a/pyproject.toml b/pyproject.toml index 362f2c31..e9fde043 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.12.0" +version = "4.13.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index d355fc69..2aa10a03 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -59,7 +59,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._compat import PYDANTIC_V1, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -233,7 +233,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -321,7 +321,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model diff --git a/src/orb/_compat.py b/src/orb/_compat.py index 92d9ee61..bdef67f0 100644 --- a/src/orb/_compat.py +++ b/src/orb/_compat.py @@ -12,14 +12,13 @@ _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) -# --------------- Pydantic v2 compatibility --------------- +# --------------- Pydantic v2, v3 compatibility --------------- # Pyright incorrectly reports some of our functions as overriding a method when they don't # pyright: reportIncompatibleMethodOverride=false -PYDANTIC_V2 = pydantic.VERSION.startswith("2.") +PYDANTIC_V1 = pydantic.VERSION.startswith("1.") -# v1 re-exports if TYPE_CHECKING: def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 @@ -44,90 +43,92 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 ... else: - if PYDANTIC_V2: - from pydantic.v1.typing import ( + # v1 re-exports + if PYDANTIC_V1: + from pydantic.typing import ( get_args as get_args, is_union as is_union, get_origin as get_origin, is_typeddict as is_typeddict, is_literal_type as is_literal_type, ) - from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import ( + from ._utils import ( get_args as get_args, is_union as is_union, get_origin as get_origin, + parse_date as parse_date, is_typeddict as is_typeddict, + parse_datetime as parse_datetime, is_literal_type as is_literal_type, ) - from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config if TYPE_CHECKING: from pydantic import ConfigDict as ConfigDict else: - if PYDANTIC_V2: - from pydantic import ConfigDict - else: + if PYDANTIC_V1: # TODO: provide an error message here? ConfigDict = None + else: + from pydantic import ConfigDict as ConfigDict # renamed methods / properties def parse_obj(model: type[_ModelT], value: object) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(value) - else: + if PYDANTIC_V1: return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + else: + return model.model_validate(value) def field_is_required(field: FieldInfo) -> bool: - if PYDANTIC_V2: - return field.is_required() - return field.required # type: ignore + if PYDANTIC_V1: + return field.required # type: ignore + return field.is_required() def field_get_default(field: FieldInfo) -> Any: value = field.get_default() - if PYDANTIC_V2: - from pydantic_core import PydanticUndefined - - if value == PydanticUndefined: - return None + if PYDANTIC_V1: return value + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None return value def field_outer_type(field: FieldInfo) -> Any: - if PYDANTIC_V2: - return field.annotation - return field.outer_type_ # type: ignore + if PYDANTIC_V1: + return field.outer_type_ # type: ignore + return field.annotation def get_model_config(model: type[pydantic.BaseModel]) -> Any: - if PYDANTIC_V2: - return model.model_config - return model.__config__ # type: ignore + if PYDANTIC_V1: + return model.__config__ # type: ignore + return model.model_config def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: - if PYDANTIC_V2: - return model.model_fields - return model.__fields__ # type: ignore + if PYDANTIC_V1: + return model.__fields__ # type: ignore + return model.model_fields def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: - if PYDANTIC_V2: - return model.model_copy(deep=deep) - return model.copy(deep=deep) # type: ignore + if PYDANTIC_V1: + return model.copy(deep=deep) # type: ignore + return model.model_copy(deep=deep) def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: - if PYDANTIC_V2: - return model.model_dump_json(indent=indent) - return model.json(indent=indent) # type: ignore + if PYDANTIC_V1: + return model.json(indent=indent) # type: ignore + return model.model_dump_json(indent=indent) def model_dump( @@ -139,14 +140,14 @@ def model_dump( warnings: bool = True, mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2 or hasattr(model, "model_dump"): + if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 - warnings=warnings if PYDANTIC_V2 else True, + warnings=True if PYDANTIC_V1 else warnings, ) return cast( "dict[str, Any]", @@ -159,9 +160,9 @@ def model_dump( def model_parse(model: type[_ModelT], data: Any) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(data) - return model.parse_obj(data) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + return model.model_validate(data) # generic models @@ -170,17 +171,16 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: class GenericModel(pydantic.BaseModel): ... else: - if PYDANTIC_V2: + if PYDANTIC_V1: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + else: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors class GenericModel(pydantic.BaseModel): ... - else: - import pydantic.generics - - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... - # cached properties if TYPE_CHECKING: diff --git a/src/orb/_models.py b/src/orb/_models.py index 92f7c10b..3a6017ef 100644 --- a/src/orb/_models.py +++ b/src/orb/_models.py @@ -50,7 +50,7 @@ strip_annotated_type, ) from ._compat import ( - PYDANTIC_V2, + PYDANTIC_V1, ConfigDict, GenericModel as BaseGenericModel, get_args, @@ -81,11 +81,7 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict( - extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) - ) - else: + if PYDANTIC_V1: @property @override @@ -95,6 +91,10 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + else: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) def to_dict( self, @@ -215,25 +215,25 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if key not in model_fields: parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value - if PYDANTIC_V2: - _extra[key] = parsed - else: + if PYDANTIC_V1: _fields_set.add(key) fields_values[key] = parsed + else: + _extra[key] = parsed object.__setattr__(m, "__dict__", fields_values) - if PYDANTIC_V2: - # these properties are copied from Pydantic's `model_construct()` method - object.__setattr__(m, "__pydantic_private__", None) - object.__setattr__(m, "__pydantic_extra__", _extra) - object.__setattr__(m, "__pydantic_fields_set__", _fields_set) - else: + if PYDANTIC_V1: # init_private_attributes() does not exist in v2 m._init_private_attributes() # type: ignore # copied from Pydantic v1's `construct()` method object.__setattr__(m, "__fields_set__", _fields_set) + else: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) return m @@ -243,7 +243,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] # although not in practice model_construct = construct - if not PYDANTIC_V2: + if PYDANTIC_V1: # we define aliases for some of the new pydantic v2 methods so # that we can just document these methods without having to specify # a specific pydantic version as some users may not know which @@ -363,10 +363,10 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if value is None: return field_get_default(field) - if PYDANTIC_V2: - type_ = field.annotation - else: + if PYDANTIC_V1: type_ = cast(type, field.outer_type_) # type: ignore + else: + type_ = field.annotation # type: ignore if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") @@ -375,7 +375,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: - if not PYDANTIC_V2: + if PYDANTIC_V1: # TODO return None @@ -628,30 +628,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, for variant in get_args(union): variant = strip_annotated_type(variant) if is_basemodel_type(variant): - if PYDANTIC_V2: - field = _extract_field_schema_pv2(variant, discriminator_field_name) - if not field: + if PYDANTIC_V1: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field.get("serialization_alias") - - field_schema = field["schema"] + discriminator_alias = field_info.alias - if field_schema["type"] == "literal": - for entry in cast("LiteralSchema", field_schema)["expected"]: + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant else: - field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - if not field_info: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field_info.alias + discriminator_alias = field.get("serialization_alias") - if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): - for entry in get_args(annotation): + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant @@ -714,7 +714,7 @@ class GenericModel(BaseGenericModel, BaseModel): pass -if PYDANTIC_V2: +if not PYDANTIC_V1: from pydantic import TypeAdapter as _TypeAdapter _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) @@ -782,12 +782,12 @@ class FinalRequestOptions(pydantic.BaseModel): json_data: Union[Body, None] = None extra_json: Union[AnyMapping, None] = None - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) - else: + if PYDANTIC_V1: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] arbitrary_types_allowed: bool = True + else: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) def get_max_retries(self, max_retries: int) -> int: if isinstance(self.max_retries, NotGiven): @@ -820,9 +820,9 @@ def construct( # type: ignore key: strip_not_given(value) for key, value in values.items() } - if PYDANTIC_V2: - return super().model_construct(_fields_set, **kwargs) - return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + return super().model_construct(_fields_set, **kwargs) if not TYPE_CHECKING: # type checkers incorrectly complain about this assignment diff --git a/src/orb/_utils/__init__.py b/src/orb/_utils/__init__.py index ca547ce5..dc64e29a 100644 --- a/src/orb/_utils/__init__.py +++ b/src/orb/_utils/__init__.py @@ -10,7 +10,6 @@ lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, - parse_date as parse_date, is_iterable as is_iterable, is_sequence as is_sequence, coerce_float as coerce_float, @@ -23,7 +22,6 @@ coerce_boolean as coerce_boolean, coerce_integer as coerce_integer, file_from_path as file_from_path, - parse_datetime as parse_datetime, strip_not_given as strip_not_given, deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, @@ -32,6 +30,13 @@ maybe_coerce_boolean as maybe_coerce_boolean, maybe_coerce_integer as maybe_coerce_integer, ) +from ._compat import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, +) from ._typing import ( is_list_type as is_list_type, is_union_type as is_union_type, @@ -56,3 +61,4 @@ function_has_argument as function_has_argument, assert_signatures_in_sync as assert_signatures_in_sync, ) +from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime diff --git a/src/orb/_utils/_compat.py b/src/orb/_utils/_compat.py new file mode 100644 index 00000000..dd703233 --- /dev/null +++ b/src/orb/_utils/_compat.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import sys +import typing_extensions +from typing import Any, Type, Union, Literal, Optional +from datetime import date, datetime +from typing_extensions import get_args as _get_args, get_origin as _get_origin + +from .._types import StrBytesIntFloat +from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime + +_LITERAL_TYPES = {Literal, typing_extensions.Literal} + + +def get_args(tp: type[Any]) -> tuple[Any, ...]: + return _get_args(tp) + + +def get_origin(tp: type[Any]) -> type[Any] | None: + return _get_origin(tp) + + +def is_union(tp: Optional[Type[Any]]) -> bool: + if sys.version_info < (3, 10): + return tp is Union # type: ignore[comparison-overlap] + else: + import types + + return tp is Union or tp is types.UnionType + + +def is_typeddict(tp: Type[Any]) -> bool: + return typing_extensions.is_typeddict(tp) + + +def is_literal_type(tp: Type[Any]) -> bool: + return get_origin(tp) in _LITERAL_TYPES + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + return _parse_date(value) + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + return _parse_datetime(value) diff --git a/src/orb/_utils/_datetime_parse.py b/src/orb/_utils/_datetime_parse.py new file mode 100644 index 00000000..7cb9d9e6 --- /dev/null +++ b/src/orb/_utils/_datetime_parse.py @@ -0,0 +1,136 @@ +""" +This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py +without the Pydantic v1 specific errors. +""" + +from __future__ import annotations + +import re +from typing import Dict, Union, Optional +from datetime import date, datetime, timezone, timedelta + +from .._types import StrBytesIntFloat + +date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})" +time_expr = ( + r"(?P\d{1,2}):(?P\d{1,2})" + r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?" + r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$" +) + +date_re = re.compile(f"{date_expr}$") +datetime_re = re.compile(f"{date_expr}[T ]{time_expr}") + + +EPOCH = datetime(1970, 1, 1) +# if greater than this, the number is in ms, if less than or equal it's in seconds +# (in seconds this is 11th October 2603, in ms it's 20th August 1970) +MS_WATERSHED = int(2e10) +# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9 +MAX_NUMBER = int(3e20) + + +def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: + if isinstance(value, (int, float)): + return value + try: + return float(value) + except ValueError: + return None + except TypeError: + raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None + + +def _from_unix_seconds(seconds: Union[int, float]) -> datetime: + if seconds > MAX_NUMBER: + return datetime.max + elif seconds < -MAX_NUMBER: + return datetime.min + + while abs(seconds) > MS_WATERSHED: + seconds /= 1000 + dt = EPOCH + timedelta(seconds=seconds) + return dt.replace(tzinfo=timezone.utc) + + +def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]: + if value == "Z": + return timezone.utc + elif value is not None: + offset_mins = int(value[-2:]) if len(value) > 3 else 0 + offset = 60 * int(value[1:3]) + offset_mins + if value[0] == "-": + offset = -offset + return timezone(timedelta(minutes=offset)) + else: + return None + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + """ + Parse a datetime/int/float/string and return a datetime.datetime. + + This function supports time zone offsets. When the input contains one, + the output uses a timezone with a fixed offset from UTC. + + Raise ValueError if the input is well formatted but not a valid datetime. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, datetime): + return value + + number = _get_numeric(value, "datetime") + if number is not None: + return _from_unix_seconds(number) + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + + match = datetime_re.match(value) + if match is None: + raise ValueError("invalid datetime format") + + kw = match.groupdict() + if kw["microsecond"]: + kw["microsecond"] = kw["microsecond"].ljust(6, "0") + + tzinfo = _parse_timezone(kw.pop("tzinfo")) + kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None} + kw_["tzinfo"] = tzinfo + + return datetime(**kw_) # type: ignore + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + """ + Parse a date/int/float/string and return a datetime.date. + + Raise ValueError if the input is well formatted but not a valid date. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, date): + if isinstance(value, datetime): + return value.date() + else: + return value + + number = _get_numeric(value, "date") + if number is not None: + return _from_unix_seconds(number).date() + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + match = date_re.match(value) + if match is None: + raise ValueError("invalid date format") + + kw = {k: int(v) for k, v in match.groupdict().items()} + + try: + return date(**kw) + except ValueError: + raise ValueError("invalid date format") from None diff --git a/src/orb/_utils/_transform.py b/src/orb/_utils/_transform.py index f0bcefd4..c19124f0 100644 --- a/src/orb/_utils/_transform.py +++ b/src/orb/_utils/_transform.py @@ -19,6 +19,7 @@ is_sequence, ) from .._files import is_base64_file_input +from ._compat import get_origin, is_typeddict from ._typing import ( is_list_type, is_union_type, @@ -29,7 +30,6 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -169,6 +169,8 @@ def _transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation @@ -333,6 +335,8 @@ async def _async_transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation diff --git a/src/orb/_utils/_typing.py b/src/orb/_utils/_typing.py index 845cd6b2..193109f3 100644 --- a/src/orb/_utils/_typing.py +++ b/src/orb/_utils/_typing.py @@ -15,7 +15,7 @@ from ._utils import lru_cache from .._types import InheritsGeneric -from .._compat import is_union as _is_union +from ._compat import is_union as _is_union def is_annotated_type(typ: type) -> bool: diff --git a/src/orb/_utils/_utils.py b/src/orb/_utils/_utils.py index ea3cf3f2..f0818595 100644 --- a/src/orb/_utils/_utils.py +++ b/src/orb/_utils/_utils.py @@ -22,7 +22,6 @@ import sniffio from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) diff --git a/src/orb/_version.py b/src/orb/_version.py index 1dea7b44..9f63931e 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__ = "4.12.0" # x-release-please-version +__version__ = "4.13.0" # x-release-please-version diff --git a/src/orb/resources/customers/customers.py b/src/orb/resources/customers/customers.py index b50ad5c1..db73331b 100644 --- a/src/orb/resources/customers/customers.py +++ b/src/orb/resources/customers/customers.py @@ -141,7 +141,8 @@ def create( name: The full name of the customer additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` @@ -407,7 +408,8 @@ def update( Args: additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` @@ -965,7 +967,8 @@ def update_by_external_id( Args: additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` @@ -1284,7 +1287,8 @@ async def create( name: The full name of the customer additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` @@ -1550,7 +1554,8 @@ async def update( Args: additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` @@ -2108,7 +2113,8 @@ async def update_by_external_id( Args: additional_emails: Additional email addresses for this customer. If populated, these email - addresses will be CC'd for customer communications. + addresses will be CC'd for customer communications. The total number of email + addresses (including the primary email) cannot exceed 50. auto_collection: Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to `True` diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index d1f87cb8..6c27b2a3 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -121,8 +121,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_config: Configuration for unit pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -171,14 +175,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["package"], + model_type: Literal["tiered"], name: str, - package_config: PackageConfig, + tiered_config: TieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -213,8 +217,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_config: Configuration for tiered pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -260,17 +268,17 @@ def create( def create( self, *, + bulk_config: BulkConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - matrix_config: MatrixConfig, - model_type: Literal["matrix"], + model_type: Literal["bulk"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -299,12 +307,16 @@ def create( specification of different price model configurations possible in this endpoint. Args: + bulk_config: Configuration for bulk pricing + cadence: The cadence to bill for this price on. currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -355,14 +367,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - matrix_with_allocation_config: MatrixWithAllocationConfig, - model_type: Literal["matrix_with_allocation"], + model_type: Literal["package"], name: str, + package_config: PackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -397,8 +409,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + package_config: Configuration for package pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -447,14 +463,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered"], + matrix_config: MatrixConfig, + model_type: Literal["matrix"], name: str, - tiered_config: TieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -489,6 +505,10 @@ def create( item_id: The id of the item the price will be associated with. + matrix_config: Configuration for matrix pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -536,17 +556,17 @@ def create( def create( self, *, - bulk_config: BulkConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["bulk"], + model_type: Literal["threshold_total_amount"], name: str, + threshold_total_amount_config: price_create_params.NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -581,8 +601,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + threshold_total_amount_config: Configuration for threshold_total_amount pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -631,14 +655,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["threshold_total_amount"], + model_type: Literal["tiered_package"], name: str, - threshold_total_amount_config: Dict[str, object], + tiered_package_config: price_create_params.NewFloatingTieredPackagePriceTieredPackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -673,8 +697,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_package_config: Configuration for tiered_package pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -723,14 +751,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_package"], + model_type: Literal["tiered_with_minimum"], name: str, - tiered_package_config: Dict[str, object], + tiered_with_minimum_config: price_create_params.NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -765,8 +793,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_with_minimum_config: Configuration for tiered_with_minimum pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -814,7 +846,7 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_tiered_config: Dict[str, object], + grouped_tiered_config: price_create_params.NewFloatingGroupedTieredPriceGroupedTieredConfig, item_id: str, model_type: Literal["grouped_tiered"], name: str, @@ -855,8 +887,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_tiered_config: Configuration for grouped_tiered pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -907,14 +943,16 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - max_group_tiered_package_config: Dict[str, object], - model_type: Literal["max_group_tiered_package"], + model_type: Literal["tiered_package_with_minimum"], name: str, + tiered_package_with_minimum_config: price_create_params.NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -949,8 +987,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_package_with_minimum_config: Configuration for tiered_package_with_minimum pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -999,14 +1041,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_with_minimum"], + model_type: Literal["package_with_allocation"], name: str, - tiered_with_minimum_config: Dict[str, object], + package_with_allocation_config: price_create_params.NewFloatingPackageWithAllocationPricePackageWithAllocationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1041,8 +1083,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + package_with_allocation_config: Configuration for package_with_allocation pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -1091,14 +1137,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["package_with_allocation"], + model_type: Literal["unit_with_percent"], name: str, - package_with_allocation_config: Dict[str, object], + unit_with_percent_config: price_create_params.NewFloatingUnitWithPercentPriceUnitWithPercentConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1133,8 +1179,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_with_percent_config: Configuration for unit_with_percent pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -1183,16 +1233,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_package_with_minimum"], + matrix_with_allocation_config: MatrixWithAllocationConfig, + model_type: Literal["matrix_with_allocation"], name: str, - tiered_package_with_minimum_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1227,6 +1275,10 @@ def create( item_id: The id of the item the price will be associated with. + matrix_with_allocation_config: Configuration for matrix_with_allocation pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1277,14 +1329,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["unit_with_percent"], + model_type: Literal["tiered_with_proration"], name: str, - unit_with_percent_config: Dict[str, object], + tiered_with_proration_config: price_create_params.NewFloatingTieredWithProrationPriceTieredWithProrationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1319,8 +1371,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_with_proration_config: Configuration for tiered_with_proration pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -1369,14 +1425,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_with_proration"], + model_type: Literal["unit_with_proration"], name: str, - tiered_with_proration_config: Dict[str, object], + unit_with_proration_config: price_create_params.NewFloatingUnitWithProrationPriceUnitWithProrationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1411,8 +1467,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_with_proration_config: Configuration for unit_with_proration pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -1460,15 +1520,15 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, + grouped_allocation_config: price_create_params.NewFloatingGroupedAllocationPriceGroupedAllocationConfig, item_id: str, - model_type: Literal["unit_with_proration"], + model_type: Literal["grouped_allocation"], name: str, - unit_with_proration_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1501,8 +1561,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_allocation_config: Configuration for grouped_allocation pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1550,17 +1614,17 @@ def create( def create( self, *, + bulk_with_proration_config: price_create_params.NewFloatingBulkWithProrationPriceBulkWithProrationConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_allocation_config: Dict[str, object], item_id: str, - model_type: Literal["grouped_allocation"], + model_type: Literal["bulk_with_proration"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1589,12 +1653,16 @@ def create( specification of different price model configurations possible in this endpoint. Args: + bulk_with_proration_config: Configuration for bulk_with_proration pricing + cadence: The cadence to bill for this price on. currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1644,7 +1712,7 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_with_prorated_minimum_config: Dict[str, object], + grouped_with_prorated_minimum_config: price_create_params.NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig, item_id: str, model_type: Literal["grouped_with_prorated_minimum"], name: str, @@ -1687,8 +1755,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_prorated_minimum_config: Configuration for grouped_with_prorated_minimum pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1738,7 +1810,7 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_with_metered_minimum_config: Dict[str, object], + grouped_with_metered_minimum_config: price_create_params.NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig, item_id: str, model_type: Literal["grouped_with_metered_minimum"], name: str, @@ -1781,8 +1853,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_metered_minimum_config: Configuration for grouped_with_metered_minimum pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1832,15 +1908,17 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, + grouped_with_min_max_thresholds_config: price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig, item_id: str, - matrix_with_display_name_config: Dict[str, object], - model_type: Literal["matrix_with_display_name"], + model_type: Literal["grouped_with_min_max_thresholds"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1873,8 +1951,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_min_max_thresholds_config: Configuration for grouped_with_min_max_thresholds pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -1922,17 +2004,17 @@ def create( def create( self, *, - bulk_with_proration_config: Dict[str, object], cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["bulk_with_proration"], + matrix_with_display_name_config: price_create_params.NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig, + model_type: Literal["matrix_with_display_name"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1967,6 +2049,10 @@ def create( item_id: The id of the item the price will be associated with. + matrix_with_display_name_config: Configuration for matrix_with_display_name pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -2016,7 +2102,7 @@ def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_tiered_package_config: Dict[str, object], + grouped_tiered_package_config: price_create_params.NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig, item_id: str, model_type: Literal["grouped_tiered_package"], name: str, @@ -2057,8 +2143,12 @@ def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_tiered_package_config: Configuration for grouped_tiered_package pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -2109,16 +2199,14 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["scalable_matrix_with_unit_pricing"], + max_group_tiered_package_config: price_create_params.NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig, + model_type: Literal["max_group_tiered_package"], name: str, - scalable_matrix_with_unit_pricing_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -2153,6 +2241,10 @@ def create( item_id: The id of the item the price will be associated with. + max_group_tiered_package_config: Configuration for max_group_tiered_package pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -2203,15 +2295,15 @@ def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["scalable_matrix_with_tiered_pricing"], + model_type: Literal["scalable_matrix_with_unit_pricing"], name: str, - scalable_matrix_with_tiered_pricing_config: Dict[str, object], + scalable_matrix_with_unit_pricing_config: price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, conversion_rate_config: Optional[ - price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig + price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, @@ -2247,8 +2339,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + scalable_matrix_with_unit_pricing_config: Configuration for scalable_matrix_with_unit_pricing pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -2295,16 +2391,18 @@ def create( self, *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], - cumulative_grouped_bulk_config: Dict[str, object], currency: str, item_id: str, - model_type: Literal["cumulative_grouped_bulk"], + model_type: Literal["scalable_matrix_with_tiered_pricing"], name: str, + scalable_matrix_with_tiered_pricing_config: price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -2339,8 +2437,12 @@ def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + scalable_matrix_with_tiered_pricing_config: Configuration for scalable_matrix_with_tiered_pricing pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -2387,18 +2489,16 @@ def create( self, *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], + cumulative_grouped_bulk_config: price_create_params.NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig, currency: str, - grouped_with_min_max_thresholds_config: Dict[str, object], item_id: str, - model_type: Literal["grouped_with_min_max_thresholds"], + model_type: Literal["cumulative_grouped_bulk"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -2429,10 +2529,14 @@ def create( Args: cadence: The cadence to bill for this price on. + cumulative_grouped_bulk_config: Configuration for cumulative_grouped_bulk pricing + currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -2525,6 +2629,10 @@ def create( item_id: The id of the item the price will be associated with. + minimum_config: Configuration for minimum pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -2570,31 +2678,31 @@ def create( @required_args( ["cadence", "currency", "item_id", "model_type", "name", "unit_config"], - ["cadence", "currency", "item_id", "model_type", "name", "package_config"], - ["cadence", "currency", "item_id", "matrix_config", "model_type", "name"], - ["cadence", "currency", "item_id", "matrix_with_allocation_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_config"], ["bulk_config", "cadence", "currency", "item_id", "model_type", "name"], + ["cadence", "currency", "item_id", "model_type", "name", "package_config"], + ["cadence", "currency", "item_id", "matrix_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "threshold_total_amount_config"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_package_config"], - ["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"], - ["cadence", "currency", "item_id", "max_group_tiered_package_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_with_minimum_config"], - ["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"], + ["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_package_with_minimum_config"], + ["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"], ["cadence", "currency", "item_id", "model_type", "name", "unit_with_percent_config"], + ["cadence", "currency", "item_id", "matrix_with_allocation_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_with_proration_config"], ["cadence", "currency", "item_id", "model_type", "name", "unit_with_proration_config"], ["cadence", "currency", "grouped_allocation_config", "item_id", "model_type", "name"], + ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_prorated_minimum_config", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_metered_minimum_config", "item_id", "model_type", "name"], + ["cadence", "currency", "grouped_with_min_max_thresholds_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "matrix_with_display_name_config", "model_type", "name"], - ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_tiered_package_config", "item_id", "model_type", "name"], + ["cadence", "currency", "item_id", "max_group_tiered_package_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "scalable_matrix_with_unit_pricing_config"], ["cadence", "currency", "item_id", "model_type", "name", "scalable_matrix_with_tiered_pricing_config"], ["cadence", "cumulative_grouped_bulk_config", "currency", "item_id", "model_type", "name"], - ["cadence", "currency", "grouped_with_min_max_thresholds_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "minimum_config", "model_type", "name"], ) def create( @@ -2604,31 +2712,31 @@ def create( currency: str, item_id: str, model_type: Literal["unit"] - | Literal["package"] - | Literal["matrix"] - | Literal["matrix_with_allocation"] | Literal["tiered"] | Literal["bulk"] + | Literal["package"] + | Literal["matrix"] | Literal["threshold_total_amount"] | Literal["tiered_package"] - | Literal["grouped_tiered"] - | Literal["max_group_tiered_package"] | Literal["tiered_with_minimum"] - | Literal["package_with_allocation"] + | Literal["grouped_tiered"] | Literal["tiered_package_with_minimum"] + | Literal["package_with_allocation"] | Literal["unit_with_percent"] + | Literal["matrix_with_allocation"] | Literal["tiered_with_proration"] | Literal["unit_with_proration"] | Literal["grouped_allocation"] + | Literal["bulk_with_proration"] | Literal["grouped_with_prorated_minimum"] | Literal["grouped_with_metered_minimum"] + | Literal["grouped_with_min_max_thresholds"] | Literal["matrix_with_display_name"] - | Literal["bulk_with_proration"] | Literal["grouped_tiered_package"] + | Literal["max_group_tiered_package"] | Literal["scalable_matrix_with_unit_pricing"] | Literal["scalable_matrix_with_tiered_pricing"] | Literal["cumulative_grouped_bulk"] - | Literal["grouped_with_min_max_thresholds"] | Literal["minimum"], name: str, unit_config: UnitConfig | NotGiven = NOT_GIVEN, @@ -2644,31 +2752,51 @@ def create( invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, + tiered_config: TieredConfig | NotGiven = NOT_GIVEN, + bulk_config: BulkConfig | NotGiven = NOT_GIVEN, package_config: PackageConfig | NotGiven = NOT_GIVEN, matrix_config: MatrixConfig | NotGiven = NOT_GIVEN, + threshold_total_amount_config: price_create_params.NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig + | NotGiven = NOT_GIVEN, + tiered_package_config: price_create_params.NewFloatingTieredPackagePriceTieredPackageConfig + | NotGiven = NOT_GIVEN, + tiered_with_minimum_config: price_create_params.NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_tiered_config: price_create_params.NewFloatingGroupedTieredPriceGroupedTieredConfig + | NotGiven = NOT_GIVEN, + tiered_package_with_minimum_config: price_create_params.NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig + | NotGiven = NOT_GIVEN, + package_with_allocation_config: price_create_params.NewFloatingPackageWithAllocationPricePackageWithAllocationConfig + | NotGiven = NOT_GIVEN, + unit_with_percent_config: price_create_params.NewFloatingUnitWithPercentPriceUnitWithPercentConfig + | NotGiven = NOT_GIVEN, matrix_with_allocation_config: MatrixWithAllocationConfig | NotGiven = NOT_GIVEN, - tiered_config: TieredConfig | NotGiven = NOT_GIVEN, - bulk_config: BulkConfig | NotGiven = NOT_GIVEN, - threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN, - max_group_tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - package_with_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_package_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - unit_with_percent_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - unit_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_prorated_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_metered_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - matrix_with_display_name_config: Dict[str, object] | NotGiven = NOT_GIVEN, - bulk_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - scalable_matrix_with_unit_pricing_config: Dict[str, object] | NotGiven = NOT_GIVEN, - scalable_matrix_with_tiered_pricing_config: Dict[str, object] | NotGiven = NOT_GIVEN, - cumulative_grouped_bulk_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_min_max_thresholds_config: Dict[str, object] | NotGiven = NOT_GIVEN, + tiered_with_proration_config: price_create_params.NewFloatingTieredWithProrationPriceTieredWithProrationConfig + | NotGiven = NOT_GIVEN, + unit_with_proration_config: price_create_params.NewFloatingUnitWithProrationPriceUnitWithProrationConfig + | NotGiven = NOT_GIVEN, + grouped_allocation_config: price_create_params.NewFloatingGroupedAllocationPriceGroupedAllocationConfig + | NotGiven = NOT_GIVEN, + bulk_with_proration_config: price_create_params.NewFloatingBulkWithProrationPriceBulkWithProrationConfig + | NotGiven = NOT_GIVEN, + grouped_with_prorated_minimum_config: price_create_params.NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_with_metered_minimum_config: price_create_params.NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_with_min_max_thresholds_config: price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + | NotGiven = NOT_GIVEN, + matrix_with_display_name_config: price_create_params.NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig + | NotGiven = NOT_GIVEN, + grouped_tiered_package_config: price_create_params.NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig + | NotGiven = NOT_GIVEN, + max_group_tiered_package_config: price_create_params.NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig + | NotGiven = NOT_GIVEN, + scalable_matrix_with_unit_pricing_config: price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig + | NotGiven = NOT_GIVEN, + scalable_matrix_with_tiered_pricing_config: price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig + | NotGiven = NOT_GIVEN, + cumulative_grouped_bulk_config: price_create_params.NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig + | NotGiven = NOT_GIVEN, minimum_config: price_create_params.NewFloatingMinimumCompositePriceMinimumConfig | 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. @@ -2701,31 +2829,31 @@ def create( "invoice_grouping_key": invoice_grouping_key, "invoicing_cycle_configuration": invoicing_cycle_configuration, "metadata": metadata, - "package_config": package_config, - "matrix_config": matrix_config, - "matrix_with_allocation_config": matrix_with_allocation_config, "tiered_config": tiered_config, "bulk_config": bulk_config, + "package_config": package_config, + "matrix_config": matrix_config, "threshold_total_amount_config": threshold_total_amount_config, "tiered_package_config": tiered_package_config, - "grouped_tiered_config": grouped_tiered_config, - "max_group_tiered_package_config": max_group_tiered_package_config, "tiered_with_minimum_config": tiered_with_minimum_config, - "package_with_allocation_config": package_with_allocation_config, + "grouped_tiered_config": grouped_tiered_config, "tiered_package_with_minimum_config": tiered_package_with_minimum_config, + "package_with_allocation_config": package_with_allocation_config, "unit_with_percent_config": unit_with_percent_config, + "matrix_with_allocation_config": matrix_with_allocation_config, "tiered_with_proration_config": tiered_with_proration_config, "unit_with_proration_config": unit_with_proration_config, "grouped_allocation_config": grouped_allocation_config, + "bulk_with_proration_config": bulk_with_proration_config, "grouped_with_prorated_minimum_config": grouped_with_prorated_minimum_config, "grouped_with_metered_minimum_config": grouped_with_metered_minimum_config, + "grouped_with_min_max_thresholds_config": grouped_with_min_max_thresholds_config, "matrix_with_display_name_config": matrix_with_display_name_config, - "bulk_with_proration_config": bulk_with_proration_config, "grouped_tiered_package_config": grouped_tiered_package_config, + "max_group_tiered_package_config": max_group_tiered_package_config, "scalable_matrix_with_unit_pricing_config": scalable_matrix_with_unit_pricing_config, "scalable_matrix_with_tiered_pricing_config": scalable_matrix_with_tiered_pricing_config, "cumulative_grouped_bulk_config": cumulative_grouped_bulk_config, - "grouped_with_min_max_thresholds_config": grouped_with_min_max_thresholds_config, "minimum_config": minimum_config, }, price_create_params.PriceCreateParams, @@ -3222,8 +3350,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_config: Configuration for unit pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3272,14 +3404,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["package"], + model_type: Literal["tiered"], name: str, - package_config: PackageConfig, + tiered_config: TieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3314,8 +3446,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_config: Configuration for tiered pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3361,17 +3497,17 @@ async def create( async def create( self, *, + bulk_config: BulkConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - matrix_config: MatrixConfig, - model_type: Literal["matrix"], + model_type: Literal["bulk"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3400,12 +3536,16 @@ async def create( specification of different price model configurations possible in this endpoint. Args: + bulk_config: Configuration for bulk pricing + cadence: The cadence to bill for this price on. currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -3456,14 +3596,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - matrix_with_allocation_config: MatrixWithAllocationConfig, - model_type: Literal["matrix_with_allocation"], + model_type: Literal["package"], name: str, + package_config: PackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3498,8 +3638,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + package_config: Configuration for package pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3548,14 +3692,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered"], + matrix_config: MatrixConfig, + model_type: Literal["matrix"], name: str, - tiered_config: TieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3590,6 +3734,10 @@ async def create( item_id: The id of the item the price will be associated with. + matrix_config: Configuration for matrix pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -3637,17 +3785,17 @@ async def create( async def create( self, *, - bulk_config: BulkConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["bulk"], + model_type: Literal["threshold_total_amount"], name: str, + threshold_total_amount_config: price_create_params.NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3682,8 +3830,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + threshold_total_amount_config: Configuration for threshold_total_amount pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3732,14 +3884,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["threshold_total_amount"], + model_type: Literal["tiered_package"], name: str, - threshold_total_amount_config: Dict[str, object], + tiered_package_config: price_create_params.NewFloatingTieredPackagePriceTieredPackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3774,8 +3926,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_package_config: Configuration for tiered_package pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3824,14 +3980,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_package"], + model_type: Literal["tiered_with_minimum"], name: str, - tiered_package_config: Dict[str, object], + tiered_with_minimum_config: price_create_params.NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -3866,8 +4022,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_with_minimum_config: Configuration for tiered_with_minimum pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -3915,7 +4075,7 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_tiered_config: Dict[str, object], + grouped_tiered_config: price_create_params.NewFloatingGroupedTieredPriceGroupedTieredConfig, item_id: str, model_type: Literal["grouped_tiered"], name: str, @@ -3956,8 +4116,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_tiered_config: Configuration for grouped_tiered pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4008,14 +4172,16 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - max_group_tiered_package_config: Dict[str, object], - model_type: Literal["max_group_tiered_package"], + model_type: Literal["tiered_package_with_minimum"], name: str, + tiered_package_with_minimum_config: price_create_params.NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4050,8 +4216,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_package_with_minimum_config: Configuration for tiered_package_with_minimum pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -4100,14 +4270,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_with_minimum"], + model_type: Literal["package_with_allocation"], name: str, - tiered_with_minimum_config: Dict[str, object], + package_with_allocation_config: price_create_params.NewFloatingPackageWithAllocationPricePackageWithAllocationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4142,8 +4312,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + package_with_allocation_config: Configuration for package_with_allocation pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -4192,14 +4366,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["package_with_allocation"], + model_type: Literal["unit_with_percent"], name: str, - package_with_allocation_config: Dict[str, object], + unit_with_percent_config: price_create_params.NewFloatingUnitWithPercentPriceUnitWithPercentConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4234,8 +4408,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_with_percent_config: Configuration for unit_with_percent pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -4284,16 +4462,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_package_with_minimum"], + matrix_with_allocation_config: MatrixWithAllocationConfig, + model_type: Literal["matrix_with_allocation"], name: str, - tiered_package_with_minimum_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4328,6 +4504,10 @@ async def create( item_id: The id of the item the price will be associated with. + matrix_with_allocation_config: Configuration for matrix_with_allocation pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4378,14 +4558,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["unit_with_percent"], + model_type: Literal["tiered_with_proration"], name: str, - unit_with_percent_config: Dict[str, object], + tiered_with_proration_config: price_create_params.NewFloatingTieredWithProrationPriceTieredWithProrationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4420,8 +4600,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + tiered_with_proration_config: Configuration for tiered_with_proration pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -4470,14 +4654,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["tiered_with_proration"], + model_type: Literal["unit_with_proration"], name: str, - tiered_with_proration_config: Dict[str, object], + unit_with_proration_config: price_create_params.NewFloatingUnitWithProrationPriceUnitWithProrationConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4512,8 +4696,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + unit_with_proration_config: Configuration for unit_with_proration pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -4561,15 +4749,15 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, + grouped_allocation_config: price_create_params.NewFloatingGroupedAllocationPriceGroupedAllocationConfig, item_id: str, - model_type: Literal["unit_with_proration"], + model_type: Literal["grouped_allocation"], name: str, - unit_with_proration_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4602,8 +4790,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_allocation_config: Configuration for grouped_allocation pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4651,17 +4843,17 @@ async def create( async def create( self, *, + bulk_with_proration_config: price_create_params.NewFloatingBulkWithProrationPriceBulkWithProrationConfig, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_allocation_config: Dict[str, object], item_id: str, - model_type: Literal["grouped_allocation"], + model_type: Literal["bulk_with_proration"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4690,12 +4882,16 @@ async def create( specification of different price model configurations possible in this endpoint. Args: + bulk_with_proration_config: Configuration for bulk_with_proration pricing + cadence: The cadence to bill for this price on. currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4745,7 +4941,7 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_with_prorated_minimum_config: Dict[str, object], + grouped_with_prorated_minimum_config: price_create_params.NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig, item_id: str, model_type: Literal["grouped_with_prorated_minimum"], name: str, @@ -4788,8 +4984,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_prorated_minimum_config: Configuration for grouped_with_prorated_minimum pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4839,7 +5039,7 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_with_metered_minimum_config: Dict[str, object], + grouped_with_metered_minimum_config: price_create_params.NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig, item_id: str, model_type: Literal["grouped_with_metered_minimum"], name: str, @@ -4882,8 +5082,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_metered_minimum_config: Configuration for grouped_with_metered_minimum pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -4933,15 +5137,17 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, + grouped_with_min_max_thresholds_config: price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig, item_id: str, - matrix_with_display_name_config: Dict[str, object], - model_type: Literal["matrix_with_display_name"], + model_type: Literal["grouped_with_min_max_thresholds"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4974,8 +5180,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_with_min_max_thresholds_config: Configuration for grouped_with_min_max_thresholds pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5023,17 +5233,17 @@ async def create( async def create( self, *, - bulk_with_proration_config: Dict[str, object], cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["bulk_with_proration"], + matrix_with_display_name_config: price_create_params.NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig, + model_type: Literal["matrix_with_display_name"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -5068,6 +5278,10 @@ async def create( item_id: The id of the item the price will be associated with. + matrix_with_display_name_config: Configuration for matrix_with_display_name pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5117,7 +5331,7 @@ async def create( *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, - grouped_tiered_package_config: Dict[str, object], + grouped_tiered_package_config: price_create_params.NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig, item_id: str, model_type: Literal["grouped_tiered_package"], name: str, @@ -5158,8 +5372,12 @@ async def create( currency: An ISO 4217 currency string for which this price is billed in. + grouped_tiered_package_config: Configuration for grouped_tiered_package pricing + item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5210,16 +5428,14 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["scalable_matrix_with_unit_pricing"], + max_group_tiered_package_config: price_create_params.NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig, + model_type: Literal["max_group_tiered_package"], name: str, - scalable_matrix_with_unit_pricing_config: Dict[str, object], billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -5254,6 +5470,10 @@ async def create( item_id: The id of the item the price will be associated with. + max_group_tiered_package_config: Configuration for max_group_tiered_package pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5304,15 +5524,15 @@ async def create( cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, - model_type: Literal["scalable_matrix_with_tiered_pricing"], + model_type: Literal["scalable_matrix_with_unit_pricing"], name: str, - scalable_matrix_with_tiered_pricing_config: Dict[str, object], + scalable_matrix_with_unit_pricing_config: price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, conversion_rate_config: Optional[ - price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig + price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, @@ -5348,8 +5568,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + scalable_matrix_with_unit_pricing_config: Configuration for scalable_matrix_with_unit_pricing pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -5396,16 +5620,18 @@ async def create( self, *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], - cumulative_grouped_bulk_config: Dict[str, object], currency: str, item_id: str, - model_type: Literal["cumulative_grouped_bulk"], + model_type: Literal["scalable_matrix_with_tiered_pricing"], name: str, + scalable_matrix_with_tiered_pricing_config: price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] + conversion_rate_config: Optional[ + price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig + ] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -5440,8 +5666,12 @@ async def create( item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. + scalable_matrix_with_tiered_pricing_config: Configuration for scalable_matrix_with_tiered_pricing pricing + billable_metric_id: The id of the billable metric for the price. Only needed if the price is usage-based. @@ -5488,18 +5718,16 @@ async def create( self, *, cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], + cumulative_grouped_bulk_config: price_create_params.NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig, currency: str, - grouped_with_min_max_thresholds_config: Dict[str, object], item_id: str, - model_type: Literal["grouped_with_min_max_thresholds"], + model_type: Literal["cumulative_grouped_bulk"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, - conversion_rate_config: Optional[ - price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig - ] + conversion_rate_config: Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] | NotGiven = NOT_GIVEN, dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -5530,10 +5758,14 @@ async def create( Args: cadence: The cadence to bill for this price on. + cumulative_grouped_bulk_config: Configuration for cumulative_grouped_bulk pricing + currency: An ISO 4217 currency string for which this price is billed in. item_id: The id of the item the price will be associated with. + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5626,6 +5858,10 @@ async def create( item_id: The id of the item the price will be associated with. + minimum_config: Configuration for minimum pricing + + model_type: The pricing model type + name: The name of the price. billable_metric_id: The id of the billable metric for the price. Only needed if the price is @@ -5671,31 +5907,31 @@ async def create( @required_args( ["cadence", "currency", "item_id", "model_type", "name", "unit_config"], - ["cadence", "currency", "item_id", "model_type", "name", "package_config"], - ["cadence", "currency", "item_id", "matrix_config", "model_type", "name"], - ["cadence", "currency", "item_id", "matrix_with_allocation_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_config"], ["bulk_config", "cadence", "currency", "item_id", "model_type", "name"], + ["cadence", "currency", "item_id", "model_type", "name", "package_config"], + ["cadence", "currency", "item_id", "matrix_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "threshold_total_amount_config"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_package_config"], - ["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"], - ["cadence", "currency", "item_id", "max_group_tiered_package_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_with_minimum_config"], - ["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"], + ["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_package_with_minimum_config"], + ["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"], ["cadence", "currency", "item_id", "model_type", "name", "unit_with_percent_config"], + ["cadence", "currency", "item_id", "matrix_with_allocation_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "tiered_with_proration_config"], ["cadence", "currency", "item_id", "model_type", "name", "unit_with_proration_config"], ["cadence", "currency", "grouped_allocation_config", "item_id", "model_type", "name"], + ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_prorated_minimum_config", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_metered_minimum_config", "item_id", "model_type", "name"], + ["cadence", "currency", "grouped_with_min_max_thresholds_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "matrix_with_display_name_config", "model_type", "name"], - ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_tiered_package_config", "item_id", "model_type", "name"], + ["cadence", "currency", "item_id", "max_group_tiered_package_config", "model_type", "name"], ["cadence", "currency", "item_id", "model_type", "name", "scalable_matrix_with_unit_pricing_config"], ["cadence", "currency", "item_id", "model_type", "name", "scalable_matrix_with_tiered_pricing_config"], ["cadence", "cumulative_grouped_bulk_config", "currency", "item_id", "model_type", "name"], - ["cadence", "currency", "grouped_with_min_max_thresholds_config", "item_id", "model_type", "name"], ["cadence", "currency", "item_id", "minimum_config", "model_type", "name"], ) async def create( @@ -5705,31 +5941,31 @@ async def create( currency: str, item_id: str, model_type: Literal["unit"] - | Literal["package"] - | Literal["matrix"] - | Literal["matrix_with_allocation"] | Literal["tiered"] | Literal["bulk"] + | Literal["package"] + | Literal["matrix"] | Literal["threshold_total_amount"] | Literal["tiered_package"] - | Literal["grouped_tiered"] - | Literal["max_group_tiered_package"] | Literal["tiered_with_minimum"] - | Literal["package_with_allocation"] + | Literal["grouped_tiered"] | Literal["tiered_package_with_minimum"] + | Literal["package_with_allocation"] | Literal["unit_with_percent"] + | Literal["matrix_with_allocation"] | Literal["tiered_with_proration"] | Literal["unit_with_proration"] | Literal["grouped_allocation"] + | Literal["bulk_with_proration"] | Literal["grouped_with_prorated_minimum"] | Literal["grouped_with_metered_minimum"] + | Literal["grouped_with_min_max_thresholds"] | Literal["matrix_with_display_name"] - | Literal["bulk_with_proration"] | Literal["grouped_tiered_package"] + | Literal["max_group_tiered_package"] | Literal["scalable_matrix_with_unit_pricing"] | Literal["scalable_matrix_with_tiered_pricing"] | Literal["cumulative_grouped_bulk"] - | Literal["grouped_with_min_max_thresholds"] | Literal["minimum"], name: str, unit_config: UnitConfig | NotGiven = NOT_GIVEN, @@ -5745,31 +5981,51 @@ async def create( invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, + tiered_config: TieredConfig | NotGiven = NOT_GIVEN, + bulk_config: BulkConfig | NotGiven = NOT_GIVEN, package_config: PackageConfig | NotGiven = NOT_GIVEN, matrix_config: MatrixConfig | NotGiven = NOT_GIVEN, + threshold_total_amount_config: price_create_params.NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig + | NotGiven = NOT_GIVEN, + tiered_package_config: price_create_params.NewFloatingTieredPackagePriceTieredPackageConfig + | NotGiven = NOT_GIVEN, + tiered_with_minimum_config: price_create_params.NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_tiered_config: price_create_params.NewFloatingGroupedTieredPriceGroupedTieredConfig + | NotGiven = NOT_GIVEN, + tiered_package_with_minimum_config: price_create_params.NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig + | NotGiven = NOT_GIVEN, + package_with_allocation_config: price_create_params.NewFloatingPackageWithAllocationPricePackageWithAllocationConfig + | NotGiven = NOT_GIVEN, + unit_with_percent_config: price_create_params.NewFloatingUnitWithPercentPriceUnitWithPercentConfig + | NotGiven = NOT_GIVEN, matrix_with_allocation_config: MatrixWithAllocationConfig | NotGiven = NOT_GIVEN, - tiered_config: TieredConfig | NotGiven = NOT_GIVEN, - bulk_config: BulkConfig | NotGiven = NOT_GIVEN, - threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN, - max_group_tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - package_with_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_package_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - unit_with_percent_config: Dict[str, object] | NotGiven = NOT_GIVEN, - tiered_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - unit_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_prorated_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_metered_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, - matrix_with_display_name_config: Dict[str, object] | NotGiven = NOT_GIVEN, - bulk_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, - scalable_matrix_with_unit_pricing_config: Dict[str, object] | NotGiven = NOT_GIVEN, - scalable_matrix_with_tiered_pricing_config: Dict[str, object] | NotGiven = NOT_GIVEN, - cumulative_grouped_bulk_config: Dict[str, object] | NotGiven = NOT_GIVEN, - grouped_with_min_max_thresholds_config: Dict[str, object] | NotGiven = NOT_GIVEN, + tiered_with_proration_config: price_create_params.NewFloatingTieredWithProrationPriceTieredWithProrationConfig + | NotGiven = NOT_GIVEN, + unit_with_proration_config: price_create_params.NewFloatingUnitWithProrationPriceUnitWithProrationConfig + | NotGiven = NOT_GIVEN, + grouped_allocation_config: price_create_params.NewFloatingGroupedAllocationPriceGroupedAllocationConfig + | NotGiven = NOT_GIVEN, + bulk_with_proration_config: price_create_params.NewFloatingBulkWithProrationPriceBulkWithProrationConfig + | NotGiven = NOT_GIVEN, + grouped_with_prorated_minimum_config: price_create_params.NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_with_metered_minimum_config: price_create_params.NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig + | NotGiven = NOT_GIVEN, + grouped_with_min_max_thresholds_config: price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + | NotGiven = NOT_GIVEN, + matrix_with_display_name_config: price_create_params.NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig + | NotGiven = NOT_GIVEN, + grouped_tiered_package_config: price_create_params.NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig + | NotGiven = NOT_GIVEN, + max_group_tiered_package_config: price_create_params.NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig + | NotGiven = NOT_GIVEN, + scalable_matrix_with_unit_pricing_config: price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig + | NotGiven = NOT_GIVEN, + scalable_matrix_with_tiered_pricing_config: price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig + | NotGiven = NOT_GIVEN, + cumulative_grouped_bulk_config: price_create_params.NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig + | NotGiven = NOT_GIVEN, minimum_config: price_create_params.NewFloatingMinimumCompositePriceMinimumConfig | 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. @@ -5802,31 +6058,31 @@ async def create( "invoice_grouping_key": invoice_grouping_key, "invoicing_cycle_configuration": invoicing_cycle_configuration, "metadata": metadata, - "package_config": package_config, - "matrix_config": matrix_config, - "matrix_with_allocation_config": matrix_with_allocation_config, "tiered_config": tiered_config, "bulk_config": bulk_config, + "package_config": package_config, + "matrix_config": matrix_config, "threshold_total_amount_config": threshold_total_amount_config, "tiered_package_config": tiered_package_config, - "grouped_tiered_config": grouped_tiered_config, - "max_group_tiered_package_config": max_group_tiered_package_config, "tiered_with_minimum_config": tiered_with_minimum_config, - "package_with_allocation_config": package_with_allocation_config, + "grouped_tiered_config": grouped_tiered_config, "tiered_package_with_minimum_config": tiered_package_with_minimum_config, + "package_with_allocation_config": package_with_allocation_config, "unit_with_percent_config": unit_with_percent_config, + "matrix_with_allocation_config": matrix_with_allocation_config, "tiered_with_proration_config": tiered_with_proration_config, "unit_with_proration_config": unit_with_proration_config, "grouped_allocation_config": grouped_allocation_config, + "bulk_with_proration_config": bulk_with_proration_config, "grouped_with_prorated_minimum_config": grouped_with_prorated_minimum_config, "grouped_with_metered_minimum_config": grouped_with_metered_minimum_config, + "grouped_with_min_max_thresholds_config": grouped_with_min_max_thresholds_config, "matrix_with_display_name_config": matrix_with_display_name_config, - "bulk_with_proration_config": bulk_with_proration_config, "grouped_tiered_package_config": grouped_tiered_package_config, + "max_group_tiered_package_config": max_group_tiered_package_config, "scalable_matrix_with_unit_pricing_config": scalable_matrix_with_unit_pricing_config, "scalable_matrix_with_tiered_pricing_config": scalable_matrix_with_tiered_pricing_config, "cumulative_grouped_bulk_config": cumulative_grouped_bulk_config, - "grouped_with_min_max_thresholds_config": grouped_with_min_max_thresholds_config, "minimum_config": minimum_config, }, price_create_params.PriceCreateParams, diff --git a/src/orb/types/__init__.py b/src/orb/types/__init__.py index 867be819..eff5c583 100644 --- a/src/orb/types/__init__.py +++ b/src/orb/types/__init__.py @@ -22,7 +22,6 @@ CreditNote as CreditNote, NewMaximum as NewMaximum, NewMinimum as NewMinimum, - TierConfig as TierConfig, UnitConfig as UnitConfig, InvoiceTiny as InvoiceTiny, MatrixValue as MatrixValue, @@ -99,7 +98,6 @@ NewPlanBulkWithProrationPrice as NewPlanBulkWithProrationPrice, NewPlanGroupedAllocationPrice as NewPlanGroupedAllocationPrice, NewPlanTieredWithMinimumPrice as NewPlanTieredWithMinimumPrice, - NewPlanTierWithProrationPrice as NewPlanTierWithProrationPrice, NewPlanUnitWithProrationPrice as NewPlanUnitWithProrationPrice, BillingCycleAnchorConfiguration as BillingCycleAnchorConfiguration, MonetaryUsageDiscountAdjustment as MonetaryUsageDiscountAdjustment, @@ -276,9 +274,6 @@ from .new_subscription_bulk_with_proration_price_param import ( NewSubscriptionBulkWithProrationPriceParam as NewSubscriptionBulkWithProrationPriceParam, ) -from .new_subscription_tier_with_proration_price_param import ( - NewSubscriptionTierWithProrationPriceParam as NewSubscriptionTierWithProrationPriceParam, -) from .new_subscription_tiered_with_minimum_price_param import ( NewSubscriptionTieredWithMinimumPriceParam as NewSubscriptionTieredWithMinimumPriceParam, ) diff --git a/src/orb/types/beta/external_plan_id_create_plan_version_params.py b/src/orb/types/beta/external_plan_id_create_plan_version_params.py index 565489e6..bb5abaca 100644 --- a/src/orb/types/beta/external_plan_id_create_plan_version_params.py +++ b/src/orb/types/beta/external_plan_id_create_plan_version_params.py @@ -25,7 +25,6 @@ from ..shared_params.new_plan_unit_with_percent_price import NewPlanUnitWithPercentPrice from ..shared_params.new_plan_grouped_allocation_price import NewPlanGroupedAllocationPrice from ..shared_params.new_plan_bulk_with_proration_price import NewPlanBulkWithProrationPrice -from ..shared_params.new_plan_tier_with_proration_price import NewPlanTierWithProrationPrice from ..shared_params.new_plan_tiered_with_minimum_price import NewPlanTieredWithMinimumPrice from ..shared_params.new_plan_unit_with_proration_price import NewPlanUnitWithProrationPrice from ..shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration @@ -50,7 +49,12 @@ "AddAdjustmentAdjustment", "AddPrice", "AddPricePrice", + "AddPricePriceNewPlanTieredWithProrationPrice", + "AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig", + "AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier", + "AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig", "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice", + "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig", "RemoveAdjustment", "RemovePrice", @@ -58,7 +62,12 @@ "ReplaceAdjustmentAdjustment", "ReplacePrice", "ReplacePricePrice", + "ReplacePricePriceNewPlanTieredWithProrationPrice", + "ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig", + "ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier", + "ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig", "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice", + "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -102,6 +111,122 @@ class AddAdjustment(TypedDict, total=False): """The phase to add this adjustment to.""" +class AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class AddPricePriceNewPlanTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -111,12 +236,16 @@ class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=Fals cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -188,31 +317,31 @@ class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=Fals AddPricePrice: TypeAlias = Union[ NewPlanUnitPrice, - NewPlanPackagePrice, - NewPlanMatrixPrice, NewPlanTieredPrice, NewPlanBulkPrice, + NewPlanPackagePrice, + NewPlanMatrixPrice, NewPlanThresholdTotalAmountPrice, NewPlanTieredPackagePrice, NewPlanTieredWithMinimumPrice, - NewPlanUnitWithPercentPrice, + NewPlanGroupedTieredPrice, + NewPlanTieredPackageWithMinimumPrice, NewPlanPackageWithAllocationPrice, - NewPlanTierWithProrationPrice, + NewPlanUnitWithPercentPrice, + NewPlanMatrixWithAllocationPrice, + AddPricePriceNewPlanTieredWithProrationPrice, NewPlanUnitWithProrationPrice, NewPlanGroupedAllocationPrice, + NewPlanBulkWithProrationPrice, NewPlanGroupedWithProratedMinimumPrice, NewPlanGroupedWithMeteredMinimumPrice, AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice, NewPlanMatrixWithDisplayNamePrice, - NewPlanBulkWithProrationPrice, NewPlanGroupedTieredPackagePrice, NewPlanMaxGroupTieredPackagePrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanScalableMatrixWithTieredPricingPrice, NewPlanCumulativeGroupedBulkPrice, - NewPlanTieredPackageWithMinimumPrice, - NewPlanMatrixWithAllocationPrice, - NewPlanGroupedTieredPrice, NewPlanMinimumCompositePrice, ] @@ -225,7 +354,7 @@ class AddPrice(TypedDict, total=False): """The phase to add this price to.""" price: Optional[AddPricePrice] - """The price to add to the plan""" + """New plan price request body params.""" class RemoveAdjustment(TypedDict, total=False): @@ -260,6 +389,122 @@ class ReplaceAdjustment(TypedDict, total=False): """The phase to replace this adjustment from.""" +class ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class ReplacePricePriceNewPlanTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -269,12 +514,16 @@ class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total= cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -346,31 +595,31 @@ class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total= ReplacePricePrice: TypeAlias = Union[ NewPlanUnitPrice, - NewPlanPackagePrice, - NewPlanMatrixPrice, NewPlanTieredPrice, NewPlanBulkPrice, + NewPlanPackagePrice, + NewPlanMatrixPrice, NewPlanThresholdTotalAmountPrice, NewPlanTieredPackagePrice, NewPlanTieredWithMinimumPrice, - NewPlanUnitWithPercentPrice, + NewPlanGroupedTieredPrice, + NewPlanTieredPackageWithMinimumPrice, NewPlanPackageWithAllocationPrice, - NewPlanTierWithProrationPrice, + NewPlanUnitWithPercentPrice, + NewPlanMatrixWithAllocationPrice, + ReplacePricePriceNewPlanTieredWithProrationPrice, NewPlanUnitWithProrationPrice, NewPlanGroupedAllocationPrice, + NewPlanBulkWithProrationPrice, NewPlanGroupedWithProratedMinimumPrice, NewPlanGroupedWithMeteredMinimumPrice, ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice, NewPlanMatrixWithDisplayNamePrice, - NewPlanBulkWithProrationPrice, NewPlanGroupedTieredPackagePrice, NewPlanMaxGroupTieredPackagePrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanScalableMatrixWithTieredPricingPrice, NewPlanCumulativeGroupedBulkPrice, - NewPlanTieredPackageWithMinimumPrice, - NewPlanMatrixWithAllocationPrice, - NewPlanGroupedTieredPrice, NewPlanMinimumCompositePrice, ] @@ -386,4 +635,4 @@ class ReplacePrice(TypedDict, total=False): """The phase to replace this price from.""" price: Optional[ReplacePricePrice] - """The price to add to the plan""" + """New plan price request body params.""" diff --git a/src/orb/types/beta_create_plan_version_params.py b/src/orb/types/beta_create_plan_version_params.py index 5907c133..2fbc9076 100644 --- a/src/orb/types/beta_create_plan_version_params.py +++ b/src/orb/types/beta_create_plan_version_params.py @@ -25,7 +25,6 @@ from .shared_params.new_plan_unit_with_percent_price import NewPlanUnitWithPercentPrice from .shared_params.new_plan_grouped_allocation_price import NewPlanGroupedAllocationPrice from .shared_params.new_plan_bulk_with_proration_price import NewPlanBulkWithProrationPrice -from .shared_params.new_plan_tier_with_proration_price import NewPlanTierWithProrationPrice from .shared_params.new_plan_tiered_with_minimum_price import NewPlanTieredWithMinimumPrice from .shared_params.new_plan_unit_with_proration_price import NewPlanUnitWithProrationPrice from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration @@ -50,7 +49,12 @@ "AddAdjustmentAdjustment", "AddPrice", "AddPricePrice", + "AddPricePriceNewPlanTieredWithProrationPrice", + "AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig", + "AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier", + "AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig", "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice", + "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig", "RemoveAdjustment", "RemovePrice", @@ -58,7 +62,12 @@ "ReplaceAdjustmentAdjustment", "ReplacePrice", "ReplacePricePrice", + "ReplacePricePriceNewPlanTieredWithProrationPrice", + "ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig", + "ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier", + "ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig", "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice", + "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -102,6 +111,122 @@ class AddAdjustment(TypedDict, total=False): """The phase to add this adjustment to.""" +class AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class AddPricePriceNewPlanTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[AddPricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[AddPricePriceNewPlanTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -111,12 +236,16 @@ class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=Fals cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + AddPricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -188,31 +317,31 @@ class AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=Fals AddPricePrice: TypeAlias = Union[ NewPlanUnitPrice, - NewPlanPackagePrice, - NewPlanMatrixPrice, NewPlanTieredPrice, NewPlanBulkPrice, + NewPlanPackagePrice, + NewPlanMatrixPrice, NewPlanThresholdTotalAmountPrice, NewPlanTieredPackagePrice, NewPlanTieredWithMinimumPrice, - NewPlanUnitWithPercentPrice, + NewPlanGroupedTieredPrice, + NewPlanTieredPackageWithMinimumPrice, NewPlanPackageWithAllocationPrice, - NewPlanTierWithProrationPrice, + NewPlanUnitWithPercentPrice, + NewPlanMatrixWithAllocationPrice, + AddPricePriceNewPlanTieredWithProrationPrice, NewPlanUnitWithProrationPrice, NewPlanGroupedAllocationPrice, + NewPlanBulkWithProrationPrice, NewPlanGroupedWithProratedMinimumPrice, NewPlanGroupedWithMeteredMinimumPrice, AddPricePriceNewPlanGroupedWithMinMaxThresholdsPrice, NewPlanMatrixWithDisplayNamePrice, - NewPlanBulkWithProrationPrice, NewPlanGroupedTieredPackagePrice, NewPlanMaxGroupTieredPackagePrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanScalableMatrixWithTieredPricingPrice, NewPlanCumulativeGroupedBulkPrice, - NewPlanTieredPackageWithMinimumPrice, - NewPlanMatrixWithAllocationPrice, - NewPlanGroupedTieredPrice, NewPlanMinimumCompositePrice, ] @@ -225,7 +354,7 @@ class AddPrice(TypedDict, total=False): """The phase to add this price to.""" price: Optional[AddPricePrice] - """The price to add to the plan""" + """New plan price request body params.""" class RemoveAdjustment(TypedDict, total=False): @@ -260,6 +389,122 @@ class ReplaceAdjustment(TypedDict, total=False): """The phase to replace this adjustment from.""" +class ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class ReplacePricePriceNewPlanTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ReplacePricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[ReplacePricePriceNewPlanTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -269,12 +514,16 @@ class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total= cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -346,31 +595,31 @@ class ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total= ReplacePricePrice: TypeAlias = Union[ NewPlanUnitPrice, - NewPlanPackagePrice, - NewPlanMatrixPrice, NewPlanTieredPrice, NewPlanBulkPrice, + NewPlanPackagePrice, + NewPlanMatrixPrice, NewPlanThresholdTotalAmountPrice, NewPlanTieredPackagePrice, NewPlanTieredWithMinimumPrice, - NewPlanUnitWithPercentPrice, + NewPlanGroupedTieredPrice, + NewPlanTieredPackageWithMinimumPrice, NewPlanPackageWithAllocationPrice, - NewPlanTierWithProrationPrice, + NewPlanUnitWithPercentPrice, + NewPlanMatrixWithAllocationPrice, + ReplacePricePriceNewPlanTieredWithProrationPrice, NewPlanUnitWithProrationPrice, NewPlanGroupedAllocationPrice, + NewPlanBulkWithProrationPrice, NewPlanGroupedWithProratedMinimumPrice, NewPlanGroupedWithMeteredMinimumPrice, ReplacePricePriceNewPlanGroupedWithMinMaxThresholdsPrice, NewPlanMatrixWithDisplayNamePrice, - NewPlanBulkWithProrationPrice, NewPlanGroupedTieredPackagePrice, NewPlanMaxGroupTieredPackagePrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanScalableMatrixWithTieredPricingPrice, NewPlanCumulativeGroupedBulkPrice, - NewPlanTieredPackageWithMinimumPrice, - NewPlanMatrixWithAllocationPrice, - NewPlanGroupedTieredPrice, NewPlanMinimumCompositePrice, ] @@ -386,4 +635,4 @@ class ReplacePrice(TypedDict, total=False): """The phase to replace this price from.""" price: Optional[ReplacePricePrice] - """The price to add to the plan""" + """New plan price request body params.""" diff --git a/src/orb/types/customer_create_params.py b/src/orb/types/customer_create_params.py index 4d40ad94..fe8decbd 100644 --- a/src/orb/types/customer_create_params.py +++ b/src/orb/types/customer_create_params.py @@ -15,7 +15,7 @@ from .new_avalara_tax_configuration_param import NewAvalaraTaxConfigurationParam from .new_accounting_sync_configuration_param import NewAccountingSyncConfigurationParam -__all__ = ["CustomerCreateParams", "TaxConfiguration"] +__all__ = ["CustomerCreateParams", "TaxConfiguration", "TaxConfigurationNewNumeralConfiguration"] class CustomerCreateParams(TypedDict, total=False): @@ -35,6 +35,8 @@ class CustomerCreateParams(TypedDict, total=False): """Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. + The total number of email addresses (including the primary email) cannot + exceed 50. """ auto_collection: Optional[bool] @@ -254,6 +256,15 @@ class CustomerCreateParams(TypedDict, total=False): """ +class TaxConfigurationNewNumeralConfiguration(TypedDict, total=False): + tax_exempt: Required[bool] + + tax_provider: Required[Literal["numeral"]] + + TaxConfiguration: TypeAlias = Union[ - NewAvalaraTaxConfigurationParam, NewTaxJarConfigurationParam, NewSphereConfigurationParam + NewAvalaraTaxConfigurationParam, + NewTaxJarConfigurationParam, + NewSphereConfigurationParam, + TaxConfigurationNewNumeralConfiguration, ] diff --git a/src/orb/types/customer_update_by_external_id_params.py b/src/orb/types/customer_update_by_external_id_params.py index e0958916..6681db58 100644 --- a/src/orb/types/customer_update_by_external_id_params.py +++ b/src/orb/types/customer_update_by_external_id_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union, Optional -from typing_extensions import Literal, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr from .address_input_param import AddressInputParam @@ -15,7 +15,7 @@ from .new_avalara_tax_configuration_param import NewAvalaraTaxConfigurationParam from .new_accounting_sync_configuration_param import NewAccountingSyncConfigurationParam -__all__ = ["CustomerUpdateByExternalIDParams", "TaxConfiguration"] +__all__ = ["CustomerUpdateByExternalIDParams", "TaxConfiguration", "TaxConfigurationNewNumeralConfiguration"] class CustomerUpdateByExternalIDParams(TypedDict, total=False): @@ -25,6 +25,8 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False): """Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. + The total number of email addresses (including the primary email) cannot + exceed 50. """ auto_collection: Optional[bool] @@ -249,6 +251,15 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False): """ +class TaxConfigurationNewNumeralConfiguration(TypedDict, total=False): + tax_exempt: Required[bool] + + tax_provider: Required[Literal["numeral"]] + + TaxConfiguration: TypeAlias = Union[ - NewAvalaraTaxConfigurationParam, NewTaxJarConfigurationParam, NewSphereConfigurationParam + NewAvalaraTaxConfigurationParam, + NewTaxJarConfigurationParam, + NewSphereConfigurationParam, + TaxConfigurationNewNumeralConfiguration, ] diff --git a/src/orb/types/customer_update_params.py b/src/orb/types/customer_update_params.py index d3f0617c..0dff5b64 100644 --- a/src/orb/types/customer_update_params.py +++ b/src/orb/types/customer_update_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Union, Optional -from typing_extensions import Literal, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr from .address_input_param import AddressInputParam @@ -15,7 +15,7 @@ from .new_avalara_tax_configuration_param import NewAvalaraTaxConfigurationParam from .new_accounting_sync_configuration_param import NewAccountingSyncConfigurationParam -__all__ = ["CustomerUpdateParams", "TaxConfiguration"] +__all__ = ["CustomerUpdateParams", "TaxConfiguration", "TaxConfigurationNewNumeralConfiguration"] class CustomerUpdateParams(TypedDict, total=False): @@ -25,6 +25,8 @@ class CustomerUpdateParams(TypedDict, total=False): """Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. + The total number of email addresses (including the primary email) cannot + exceed 50. """ auto_collection: Optional[bool] @@ -249,6 +251,15 @@ class CustomerUpdateParams(TypedDict, total=False): """ +class TaxConfigurationNewNumeralConfiguration(TypedDict, total=False): + tax_exempt: Required[bool] + + tax_provider: Required[Literal["numeral"]] + + TaxConfiguration: TypeAlias = Union[ - NewAvalaraTaxConfigurationParam, NewTaxJarConfigurationParam, NewSphereConfigurationParam + NewAvalaraTaxConfigurationParam, + NewTaxJarConfigurationParam, + NewSphereConfigurationParam, + TaxConfigurationNewNumeralConfiguration, ] diff --git a/src/orb/types/invoice_create_params.py b/src/orb/types/invoice_create_params.py index c6cacf24..92ae0229 100644 --- a/src/orb/types/invoice_create_params.py +++ b/src/orb/types/invoice_create_params.py @@ -99,3 +99,4 @@ class LineItem(TypedDict, total=False): """A date string to specify the line item's start date in the customer's timezone.""" unit_config: Required[UnitConfig] + """Configuration for unit pricing""" diff --git a/src/orb/types/new_subscription_bulk_price_param.py b/src/orb/types/new_subscription_bulk_price_param.py index a7e05cd9..6f4b4747 100644 --- a/src/orb/types/new_subscription_bulk_price_param.py +++ b/src/orb/types/new_subscription_bulk_price_param.py @@ -18,6 +18,7 @@ class NewSubscriptionBulkPriceParam(TypedDict, total=False): bulk_config: Required[BulkConfig] + """Configuration for bulk pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -26,6 +27,7 @@ class NewSubscriptionBulkPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_bulk_with_proration_price_param.py b/src/orb/types/new_subscription_bulk_with_proration_price_param.py index 1d58b20c..018b15f4 100644 --- a/src/orb/types/new_subscription_bulk_with_proration_price_param.py +++ b/src/orb/types/new_subscription_bulk_with_proration_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,13 +10,33 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionBulkWithProrationPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionBulkWithProrationPriceParam", + "BulkWithProrationConfig", + "BulkWithProrationConfigTier", + "ConversionRateConfig", +] + + +class BulkWithProrationConfigTier(TypedDict, total=False): + unit_amount: Required[str] + """Cost per unit""" + + tier_lower_bound: Optional[str] + """The lower bound for this tier""" + + +class BulkWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[BulkWithProrationConfigTier]] + """Bulk tiers for rating based on total usage volume""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] class NewSubscriptionBulkWithProrationPriceParam(TypedDict, total=False): - bulk_with_proration_config: Required[Dict[str, object]] + bulk_with_proration_config: Required[BulkWithProrationConfig] + """Configuration for bulk_with_proration pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -25,6 +45,7 @@ class NewSubscriptionBulkWithProrationPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_cumulative_grouped_bulk_price_param.py b/src/orb/types/new_subscription_cumulative_grouped_bulk_price_param.py index 55325a03..4b91391a 100644 --- a/src/orb/types/new_subscription_cumulative_grouped_bulk_price_param.py +++ b/src/orb/types/new_subscription_cumulative_grouped_bulk_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionCumulativeGroupedBulkPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionCumulativeGroupedBulkPriceParam", + "CumulativeGroupedBulkConfig", + "CumulativeGroupedBulkConfigDimensionValue", + "ConversionRateConfig", +] + + +class CumulativeGroupedBulkConfigDimensionValue(TypedDict, total=False): + grouping_key: Required[str] + """Grouping key value""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Unit amount for this combination""" + + +class CumulativeGroupedBulkConfig(TypedDict, total=False): + dimension_values: Required[Iterable[CumulativeGroupedBulkConfigDimensionValue]] + """Each tier lower bound must have the same group of values.""" + + group: Required[str] + """Grouping key name""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +44,14 @@ class NewSubscriptionCumulativeGroupedBulkPriceParam(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Required[Dict[str, object]] + cumulative_grouped_bulk_config: Required[CumulativeGroupedBulkConfig] + """Configuration for cumulative_grouped_bulk pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["cumulative_grouped_bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_grouped_allocation_price_param.py b/src/orb/types/new_subscription_grouped_allocation_price_param.py index cdde4361..1c73bc8c 100644 --- a/src/orb/types/new_subscription_grouped_allocation_price_param.py +++ b/src/orb/types/new_subscription_grouped_allocation_price_param.py @@ -10,7 +10,19 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionGroupedAllocationPriceParam", "ConversionRateConfig"] +__all__ = ["NewSubscriptionGroupedAllocationPriceParam", "GroupedAllocationConfig", "ConversionRateConfig"] + + +class GroupedAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation per group""" + + grouping_key: Required[str] + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: Required[str] + """Unit rate for post-allocation""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +31,14 @@ class NewSubscriptionGroupedAllocationPriceParam(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_allocation_config: Required[Dict[str, object]] + grouped_allocation_config: Required[GroupedAllocationConfig] + """Configuration for grouped_allocation pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_grouped_tiered_package_price_param.py b/src/orb/types/new_subscription_grouped_tiered_package_price_param.py index 31c9533f..8f1e0f90 100644 --- a/src/orb/types/new_subscription_grouped_tiered_package_price_param.py +++ b/src/orb/types/new_subscription_grouped_tiered_package_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionGroupedTieredPackagePriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionGroupedTieredPackagePriceParam", + "GroupedTieredPackageConfig", + "GroupedTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class GroupedTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before tiering""" + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[GroupedTieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +47,14 @@ class NewSubscriptionGroupedTieredPackagePriceParam(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_tiered_package_config: Required[Dict[str, object]] + grouped_tiered_package_config: Required[GroupedTieredPackageConfig] + """Configuration for grouped_tiered_package pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_grouped_tiered_price_param.py b/src/orb/types/new_subscription_grouped_tiered_price_param.py index 57598cdd..0e79dadd 100644 --- a/src/orb/types/new_subscription_grouped_tiered_price_param.py +++ b/src/orb/types/new_subscription_grouped_tiered_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionGroupedTieredPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionGroupedTieredPriceParam", + "GroupedTieredConfig", + "GroupedTieredConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedTieredConfig(TypedDict, total=False): + grouping_key: Required[str] + """The billable metric property used to group before tiering""" + + tiers: Required[Iterable[GroupedTieredConfigTier]] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +44,14 @@ class NewSubscriptionGroupedTieredPriceParam(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_tiered_config: Required[Dict[str, object]] + grouped_tiered_config: Required[GroupedTieredConfig] + """Configuration for grouped_tiered pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_grouped_with_metered_minimum_price_param.py b/src/orb/types/new_subscription_grouped_with_metered_minimum_price_param.py index f69e3e40..1652fe37 100644 --- a/src/orb/types/new_subscription_grouped_with_metered_minimum_price_param.py +++ b/src/orb/types/new_subscription_grouped_with_metered_minimum_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,56 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionGroupedWithMeteredMinimumPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionGroupedWithMeteredMinimumPriceParam", + "GroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumConfigUnitAmount", + "ConversionRateConfig", +] + + +class GroupedWithMeteredMinimumConfigScalingFactor(TypedDict, total=False): + scaling_factor: Required[str] + """Scaling factor""" + + scaling_value: Required[str] + """Scaling value""" + + +class GroupedWithMeteredMinimumConfigUnitAmount(TypedDict, total=False): + pricing_value: Required[str] + """Pricing value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedWithMeteredMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: Required[str] + """The minimum amount to charge per group per unit""" + + pricing_key: Required[str] + """Used to determine the unit rate""" + + scaling_factors: Required[Iterable[GroupedWithMeteredMinimumConfigScalingFactor]] + """Scale the unit rates by the scaling factor.""" + + scaling_key: Required[str] + """Used to determine the unit rate scaling factor""" + + unit_amounts: Required[Iterable[GroupedWithMeteredMinimumConfigUnitAmount]] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +68,14 @@ class NewSubscriptionGroupedWithMeteredMinimumPriceParam(TypedDict, total=False) cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_metered_minimum_config: Required[Dict[str, object]] + grouped_with_metered_minimum_config: Required[GroupedWithMeteredMinimumConfig] + """Configuration for grouped_with_metered_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_metered_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_grouped_with_prorated_minimum_price_param.py b/src/orb/types/new_subscription_grouped_with_prorated_minimum_price_param.py index 314a21c2..9dbc811b 100644 --- a/src/orb/types/new_subscription_grouped_with_prorated_minimum_price_param.py +++ b/src/orb/types/new_subscription_grouped_with_prorated_minimum_price_param.py @@ -10,7 +10,23 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionGroupedWithProratedMinimumPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionGroupedWithProratedMinimumPriceParam", + "GroupedWithProratedMinimumConfig", + "ConversionRateConfig", +] + + +class GroupedWithProratedMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """How to determine the groups that should each have a minimum""" + + minimum: Required[str] + """The minimum amount to charge per group""" + + unit_rate: Required[str] + """The amount to charge per unit""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +35,14 @@ class NewSubscriptionGroupedWithProratedMinimumPriceParam(TypedDict, total=False cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_prorated_minimum_config: Required[Dict[str, object]] + grouped_with_prorated_minimum_config: Required[GroupedWithProratedMinimumConfig] + """Configuration for grouped_with_prorated_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_prorated_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_matrix_price_param.py b/src/orb/types/new_subscription_matrix_price_param.py index cf708860..94188ad3 100644 --- a/src/orb/types/new_subscription_matrix_price_param.py +++ b/src/orb/types/new_subscription_matrix_price_param.py @@ -24,8 +24,10 @@ class NewSubscriptionMatrixPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_config: Required[MatrixConfig] + """Configuration for matrix pricing""" model_type: Required[Literal["matrix"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_matrix_with_allocation_price_param.py b/src/orb/types/new_subscription_matrix_with_allocation_price_param.py index c0d81f0c..4bd592a4 100644 --- a/src/orb/types/new_subscription_matrix_with_allocation_price_param.py +++ b/src/orb/types/new_subscription_matrix_with_allocation_price_param.py @@ -24,8 +24,10 @@ class NewSubscriptionMatrixWithAllocationPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_with_allocation_config: Required[MatrixWithAllocationConfig] + """Configuration for matrix_with_allocation pricing""" model_type: Required[Literal["matrix_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_matrix_with_display_name_price_param.py b/src/orb/types/new_subscription_matrix_with_display_name_price_param.py index ba6156b2..4a436e96 100644 --- a/src/orb/types/new_subscription_matrix_with_display_name_price_param.py +++ b/src/orb/types/new_subscription_matrix_with_display_name_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionMatrixWithDisplayNamePriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionMatrixWithDisplayNamePriceParam", + "MatrixWithDisplayNameConfig", + "MatrixWithDisplayNameConfigUnitAmount", + "ConversionRateConfig", +] + + +class MatrixWithDisplayNameConfigUnitAmount(TypedDict, total=False): + dimension_value: Required[str] + """The dimension value""" + + display_name: Required[str] + """Display name for this dimension value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MatrixWithDisplayNameConfig(TypedDict, total=False): + dimension: Required[str] + """Used to determine the unit rate""" + + unit_amounts: Required[Iterable[MatrixWithDisplayNameConfigUnitAmount]] + """Apply per unit pricing to each dimension value""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,9 +47,11 @@ class NewSubscriptionMatrixWithDisplayNamePriceParam(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Required[Dict[str, object]] + matrix_with_display_name_config: Required[MatrixWithDisplayNameConfig] + """Configuration for matrix_with_display_name pricing""" model_type: Required[Literal["matrix_with_display_name"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_max_group_tiered_package_price_param.py b/src/orb/types/new_subscription_max_group_tiered_package_price_param.py index c035e463..4849ba34 100644 --- a/src/orb/types/new_subscription_max_group_tiered_package_price_param.py +++ b/src/orb/types/new_subscription_max_group_tiered_package_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,34 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionMaxGroupTieredPackagePriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionMaxGroupTieredPackagePriceParam", + "MaxGroupTieredPackageConfig", + "MaxGroupTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class MaxGroupTieredPackageConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MaxGroupTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[MaxGroupTieredPackageConfigTier]] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,9 +49,11 @@ class NewSubscriptionMaxGroupTieredPackagePriceParam(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Required[Dict[str, object]] + max_group_tiered_package_config: Required[MaxGroupTieredPackageConfig] + """Configuration for max_group_tiered_package pricing""" model_type: Required[Literal["max_group_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_minimum_composite_price_param.py b/src/orb/types/new_subscription_minimum_composite_price_param.py index e7ad72db..81a29249 100644 --- a/src/orb/types/new_subscription_minimum_composite_price_param.py +++ b/src/orb/types/new_subscription_minimum_composite_price_param.py @@ -17,11 +17,8 @@ class MinimumConfig(TypedDict, total=False): minimum_amount: Required[str] """The minimum amount to apply""" - prorated: Optional[bool] - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -35,8 +32,10 @@ class NewSubscriptionMinimumCompositePriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" minimum_config: Required[MinimumConfig] + """Configuration for minimum pricing""" model_type: Required[Literal["minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/new_subscription_package_price_param.py b/src/orb/types/new_subscription_package_price_param.py index 73c55ef2..a5243635 100644 --- a/src/orb/types/new_subscription_package_price_param.py +++ b/src/orb/types/new_subscription_package_price_param.py @@ -24,11 +24,13 @@ class NewSubscriptionPackagePriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" package_config: Required[PackageConfig] + """Configuration for package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_package_with_allocation_price_param.py b/src/orb/types/new_subscription_package_with_allocation_price_param.py index 3a27d1b2..c6f1d709 100644 --- a/src/orb/types/new_subscription_package_with_allocation_price_param.py +++ b/src/orb/types/new_subscription_package_with_allocation_price_param.py @@ -10,7 +10,19 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionPackageWithAllocationPriceParam", "ConversionRateConfig"] +__all__ = ["NewSubscriptionPackageWithAllocationPriceParam", "PackageWithAllocationConfig", "ConversionRateConfig"] + + +class PackageWithAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation""" + + package_amount: Required[str] + """Price per package""" + + package_size: Required[str] + """Package size""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +35,13 @@ class NewSubscriptionPackageWithAllocationPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - package_with_allocation_config: Required[Dict[str, object]] + package_with_allocation_config: Required[PackageWithAllocationConfig] + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_scalable_matrix_with_tiered_pricing_price_param.py b/src/orb/types/new_subscription_scalable_matrix_with_tiered_pricing_price_param.py index e1e176cf..57a8793b 100644 --- a/src/orb/types/new_subscription_scalable_matrix_with_tiered_pricing_price_param.py +++ b/src/orb/types/new_subscription_scalable_matrix_with_tiered_pricing_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,47 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionScalableMatrixWithTieredPricingPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionScalableMatrixWithTieredPricingPriceParam", + "ScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingConfigTier", + "ConversionRateConfig", +] + + +class ScalableMatrixWithTieredPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithTieredPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + tiers: Required[Iterable[ScalableMatrixWithTieredPricingConfigTier]] + """Tier pricing structure""" + + second_dimension: Optional[str] + """Used for the scalable matrix second dimension (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +63,13 @@ class NewSubscriptionScalableMatrixWithTieredPricingPriceParam(TypedDict, total= """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_tiered_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_tiered_pricing_config: Required[ScalableMatrixWithTieredPricingConfig] + """Configuration for scalable_matrix_with_tiered_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_scalable_matrix_with_unit_pricing_price_param.py b/src/orb/types/new_subscription_scalable_matrix_with_unit_pricing_price_param.py index b97dc6bb..031d2b22 100644 --- a/src/orb/types/new_subscription_scalable_matrix_with_unit_pricing_price_param.py +++ b/src/orb/types/new_subscription_scalable_matrix_with_unit_pricing_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,41 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionScalableMatrixWithUnitPricingPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionScalableMatrixWithUnitPricingPriceParam", + "ScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingConfigMatrixScalingFactor", + "ConversionRateConfig", +] + + +class ScalableMatrixWithUnitPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used to determine the unit rate""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithUnitPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + unit_price: Required[str] + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] + """Used to determine the unit rate (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +57,13 @@ class NewSubscriptionScalableMatrixWithUnitPricingPriceParam(TypedDict, total=Fa """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_unit_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_unit_pricing_config: Required[ScalableMatrixWithUnitPricingConfig] + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_threshold_total_amount_price_param.py b/src/orb/types/new_subscription_threshold_total_amount_price_param.py index 3f50beab..eecc9c10 100644 --- a/src/orb/types/new_subscription_threshold_total_amount_price_param.py +++ b/src/orb/types/new_subscription_threshold_total_amount_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionThresholdTotalAmountPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionThresholdTotalAmountPriceParam", + "ThresholdTotalAmountConfig", + "ThresholdTotalAmountConfigConsumptionTable", + "ConversionRateConfig", +] + + +class ThresholdTotalAmountConfigConsumptionTable(TypedDict, total=False): + threshold: Required[str] + """Quantity threshold""" + + total_amount: Required[str] + """Total amount for this threshold""" + + +class ThresholdTotalAmountConfig(TypedDict, total=False): + consumption_table: Required[Iterable[ThresholdTotalAmountConfigConsumptionTable]] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +48,13 @@ class NewSubscriptionThresholdTotalAmountPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["threshold_total_amount"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - threshold_total_amount_config: Required[Dict[str, object]] + threshold_total_amount_config: Required[ThresholdTotalAmountConfig] + """Configuration for threshold_total_amount pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_tier_with_proration_price_param.py b/src/orb/types/new_subscription_tier_with_proration_price_param.py deleted file mode 100644 index d686ac14..00000000 --- a/src/orb/types/new_subscription_tier_with_proration_price_param.py +++ /dev/null @@ -1,94 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig -from .shared_params.tiered_conversion_rate_config import TieredConversionRateConfig -from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration -from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration - -__all__ = ["NewSubscriptionTierWithProrationPriceParam", "ConversionRateConfig"] - -ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] - - -class NewSubscriptionTierWithProrationPriceParam(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] - """The cadence to bill for this price on.""" - - item_id: Required[str] - """The id of the item the price will be associated with.""" - - model_type: Required[Literal["tiered_with_proration"]] - - name: Required[str] - """The name of the price.""" - - tiered_with_proration_config: Required[Dict[str, object]] - - billable_metric_id: Optional[str] - """The id of the billable metric for the price. - - Only needed if the price is usage-based. - """ - - billed_in_advance: Optional[bool] - """ - If the Price represents a fixed cost, the price will be billed in-advance if - this is true, and in-arrears if this is false. - """ - - billing_cycle_configuration: Optional[NewBillingCycleConfiguration] - """ - For custom cadence: specifies the duration of the billing period in days or - months. - """ - - conversion_rate: Optional[float] - """The per unit conversion rate of the price currency to the invoicing currency.""" - - conversion_rate_config: Optional[ConversionRateConfig] - """The configuration for the rate of the price currency to the invoicing currency.""" - - currency: Optional[str] - """ - An ISO 4217 currency string, or custom pricing unit identifier, in which this - price is billed. - """ - - dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] - """For dimensional price: specifies a price group and dimension values""" - - external_price_id: Optional[str] - """An alias for the price.""" - - fixed_price_quantity: Optional[float] - """ - If the Price represents a fixed cost, this represents the quantity of units - applied. - """ - - invoice_grouping_key: Optional[str] - """The property used to group this price on an invoice""" - - invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] - """Within each billing cycle, specifies the cadence at which invoices are produced. - - If unspecified, a single invoice is produced per billing cycle. - """ - - metadata: Optional[Dict[str, Optional[str]]] - """User-specified key/value pairs for the resource. - - Individual keys can be removed by setting the value to `null`, and the entire - metadata mapping can be cleared by setting `metadata` to `null`. - """ - - reference_id: Optional[str] - """ - A transient ID that can be used to reference this price when adding adjustments - in the same API call. - """ diff --git a/src/orb/types/new_subscription_tiered_package_price_param.py b/src/orb/types/new_subscription_tiered_package_price_param.py index 2e1ac7bb..8e83b798 100644 --- a/src/orb/types/new_subscription_tiered_package_price_param.py +++ b/src/orb/types/new_subscription_tiered_package_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionTieredPackagePriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionTieredPackagePriceParam", + "TieredPackageConfig", + "TieredPackageConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageConfig(TypedDict, total=False): + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[TieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +48,13 @@ class NewSubscriptionTieredPackagePriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_config: Required[Dict[str, object]] + tiered_package_config: Required[TieredPackageConfig] + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_tiered_package_with_minimum_price_param.py b/src/orb/types/new_subscription_tiered_package_with_minimum_price_param.py index adf32200..6ab22397 100644 --- a/src/orb/types/new_subscription_tiered_package_with_minimum_price_param.py +++ b/src/orb/types/new_subscription_tiered_package_with_minimum_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionTieredPackageWithMinimumPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionTieredPackageWithMinimumPriceParam", + "TieredPackageWithMinimumConfig", + "TieredPackageWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageWithMinimumConfig(TypedDict, total=False): + package_size: Required[float] + """Package size""" + + tiers: Required[Iterable[TieredPackageWithMinimumConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +51,13 @@ class NewSubscriptionTieredPackageWithMinimumPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_with_minimum_config: Required[Dict[str, object]] + tiered_package_with_minimum_config: Required[TieredPackageWithMinimumConfig] + """Configuration for tiered_package_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_tiered_price_param.py b/src/orb/types/new_subscription_tiered_price_param.py index dc6362b8..e62c64dd 100644 --- a/src/orb/types/new_subscription_tiered_price_param.py +++ b/src/orb/types/new_subscription_tiered_price_param.py @@ -24,11 +24,13 @@ class NewSubscriptionTieredPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" tiered_config: Required[TieredConfig] + """Configuration for tiered pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_tiered_with_minimum_price_param.py b/src/orb/types/new_subscription_tiered_with_minimum_price_param.py index 177ecb69..9c7dfbe4 100644 --- a/src/orb/types/new_subscription_tiered_with_minimum_price_param.py +++ b/src/orb/types/new_subscription_tiered_with_minimum_price_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,38 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionTieredWithMinimumPriceParam", "ConversionRateConfig"] +__all__ = [ + "NewSubscriptionTieredWithMinimumPriceParam", + "TieredWithMinimumConfig", + "TieredWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class TieredWithMinimumConfig(TypedDict, total=False): + tiers: Required[Iterable[TieredWithMinimumConfigTier]] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: bool + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: bool + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +54,13 @@ class NewSubscriptionTieredWithMinimumPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_minimum_config: Required[Dict[str, object]] + tiered_with_minimum_config: Required[TieredWithMinimumConfig] + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_unit_price_param.py b/src/orb/types/new_subscription_unit_price_param.py index c89c05f2..b4da6fb3 100644 --- a/src/orb/types/new_subscription_unit_price_param.py +++ b/src/orb/types/new_subscription_unit_price_param.py @@ -24,11 +24,13 @@ class NewSubscriptionUnitPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit"]] + """The pricing model type""" name: Required[str] """The name of the price.""" unit_config: Required[UnitConfig] + """Configuration for unit pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_unit_with_percent_price_param.py b/src/orb/types/new_subscription_unit_with_percent_price_param.py index 4cec16a9..2a0d1c6e 100644 --- a/src/orb/types/new_subscription_unit_with_percent_price_param.py +++ b/src/orb/types/new_subscription_unit_with_percent_price_param.py @@ -10,7 +10,16 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionUnitWithPercentPriceParam", "ConversionRateConfig"] +__all__ = ["NewSubscriptionUnitWithPercentPriceParam", "UnitWithPercentConfig", "ConversionRateConfig"] + + +class UnitWithPercentConfig(TypedDict, total=False): + percent: Required[str] + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +32,13 @@ class NewSubscriptionUnitWithPercentPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_percent"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_percent_config: Required[Dict[str, object]] + unit_with_percent_config: Required[UnitWithPercentConfig] + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/new_subscription_unit_with_proration_price_param.py b/src/orb/types/new_subscription_unit_with_proration_price_param.py index 587d9b96..30220c0a 100644 --- a/src/orb/types/new_subscription_unit_with_proration_price_param.py +++ b/src/orb/types/new_subscription_unit_with_proration_price_param.py @@ -10,7 +10,13 @@ from .shared_params.new_billing_cycle_configuration import NewBillingCycleConfiguration from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewSubscriptionUnitWithProrationPriceParam", "ConversionRateConfig"] +__all__ = ["NewSubscriptionUnitWithProrationPriceParam", "UnitWithProrationConfig", "ConversionRateConfig"] + + +class UnitWithProrationConfig(TypedDict, total=False): + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +29,13 @@ class NewSubscriptionUnitWithProrationPriceParam(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_proration_config: Required[Dict[str, object]] + unit_with_proration_config: Required[UnitWithProrationConfig] + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index d4f9598c..090d4c20 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -25,7 +25,6 @@ from .shared_params.new_plan_unit_with_percent_price import NewPlanUnitWithPercentPrice from .shared_params.new_plan_grouped_allocation_price import NewPlanGroupedAllocationPrice from .shared_params.new_plan_bulk_with_proration_price import NewPlanBulkWithProrationPrice -from .shared_params.new_plan_tier_with_proration_price import NewPlanTierWithProrationPrice from .shared_params.new_plan_tiered_with_minimum_price import NewPlanTieredWithMinimumPrice from .shared_params.new_plan_unit_with_proration_price import NewPlanUnitWithProrationPrice from .shared_params.new_dimensional_price_configuration import NewDimensionalPriceConfiguration @@ -48,7 +47,12 @@ "PlanCreateParams", "Price", "PricePrice", + "PricePriceNewPlanTieredWithProrationPrice", + "PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig", + "PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier", + "PricePriceNewPlanTieredWithProrationPriceConversionRateConfig", "PricePriceNewPlanGroupedWithMinMaxThresholdsPrice", + "PricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "PricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig", "Adjustment", "AdjustmentAdjustment", @@ -111,6 +115,122 @@ class PlanCreateParams(TypedDict, total=False): """ +class PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +PricePriceNewPlanTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class PricePriceNewPlanTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[PricePriceNewPlanTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[PricePriceNewPlanTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class PricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + PricePriceNewPlanGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -120,12 +240,16 @@ class PricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + PricePriceNewPlanGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -197,31 +321,31 @@ class PricePriceNewPlanGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): PricePrice: TypeAlias = Union[ NewPlanUnitPrice, - NewPlanPackagePrice, - NewPlanMatrixPrice, NewPlanTieredPrice, NewPlanBulkPrice, + NewPlanPackagePrice, + NewPlanMatrixPrice, NewPlanThresholdTotalAmountPrice, NewPlanTieredPackagePrice, NewPlanTieredWithMinimumPrice, - NewPlanUnitWithPercentPrice, + NewPlanGroupedTieredPrice, + NewPlanTieredPackageWithMinimumPrice, NewPlanPackageWithAllocationPrice, - NewPlanTierWithProrationPrice, + NewPlanUnitWithPercentPrice, + NewPlanMatrixWithAllocationPrice, + PricePriceNewPlanTieredWithProrationPrice, NewPlanUnitWithProrationPrice, NewPlanGroupedAllocationPrice, + NewPlanBulkWithProrationPrice, NewPlanGroupedWithProratedMinimumPrice, NewPlanGroupedWithMeteredMinimumPrice, PricePriceNewPlanGroupedWithMinMaxThresholdsPrice, NewPlanMatrixWithDisplayNamePrice, - NewPlanBulkWithProrationPrice, NewPlanGroupedTieredPackagePrice, NewPlanMaxGroupTieredPackagePrice, NewPlanScalableMatrixWithUnitPricingPrice, NewPlanScalableMatrixWithTieredPricingPrice, NewPlanCumulativeGroupedBulkPrice, - NewPlanTieredPackageWithMinimumPrice, - NewPlanMatrixWithAllocationPrice, - NewPlanGroupedTieredPrice, NewPlanMinimumCompositePrice, ] @@ -234,7 +358,7 @@ class Price(TypedDict, total=False): """The phase to add this price to.""" price: Optional[PricePrice] - """The price to add to the plan""" + """New plan price request body params.""" AdjustmentAdjustment: TypeAlias = Union[ diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index 07d04453..7b7d502f 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .shared_params.bulk_config import BulkConfig @@ -20,56 +20,92 @@ "PriceCreateParams", "NewFloatingUnitPrice", "NewFloatingUnitPriceConversionRateConfig", - "NewFloatingPackagePrice", - "NewFloatingPackagePriceConversionRateConfig", - "NewFloatingMatrixPrice", - "NewFloatingMatrixPriceConversionRateConfig", - "NewFloatingMatrixWithAllocationPrice", - "NewFloatingMatrixWithAllocationPriceConversionRateConfig", "NewFloatingTieredPrice", "NewFloatingTieredPriceConversionRateConfig", "NewFloatingBulkPrice", "NewFloatingBulkPriceConversionRateConfig", + "NewFloatingPackagePrice", + "NewFloatingPackagePriceConversionRateConfig", + "NewFloatingMatrixPrice", + "NewFloatingMatrixPriceConversionRateConfig", "NewFloatingThresholdTotalAmountPrice", + "NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig", + "NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable", "NewFloatingThresholdTotalAmountPriceConversionRateConfig", "NewFloatingTieredPackagePrice", + "NewFloatingTieredPackagePriceTieredPackageConfig", + "NewFloatingTieredPackagePriceTieredPackageConfigTier", "NewFloatingTieredPackagePriceConversionRateConfig", - "NewFloatingGroupedTieredPrice", - "NewFloatingGroupedTieredPriceConversionRateConfig", - "NewFloatingMaxGroupTieredPackagePrice", - "NewFloatingMaxGroupTieredPackagePriceConversionRateConfig", "NewFloatingTieredWithMinimumPrice", + "NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig", + "NewFloatingTieredWithMinimumPriceTieredWithMinimumConfigTier", "NewFloatingTieredWithMinimumPriceConversionRateConfig", - "NewFloatingPackageWithAllocationPrice", - "NewFloatingPackageWithAllocationPriceConversionRateConfig", + "NewFloatingGroupedTieredPrice", + "NewFloatingGroupedTieredPriceGroupedTieredConfig", + "NewFloatingGroupedTieredPriceGroupedTieredConfigTier", + "NewFloatingGroupedTieredPriceConversionRateConfig", "NewFloatingTieredPackageWithMinimumPrice", + "NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig", + "NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier", "NewFloatingTieredPackageWithMinimumPriceConversionRateConfig", + "NewFloatingPackageWithAllocationPrice", + "NewFloatingPackageWithAllocationPricePackageWithAllocationConfig", + "NewFloatingPackageWithAllocationPriceConversionRateConfig", "NewFloatingUnitWithPercentPrice", + "NewFloatingUnitWithPercentPriceUnitWithPercentConfig", "NewFloatingUnitWithPercentPriceConversionRateConfig", + "NewFloatingMatrixWithAllocationPrice", + "NewFloatingMatrixWithAllocationPriceConversionRateConfig", "NewFloatingTieredWithProrationPrice", + "NewFloatingTieredWithProrationPriceTieredWithProrationConfig", + "NewFloatingTieredWithProrationPriceTieredWithProrationConfigTier", "NewFloatingTieredWithProrationPriceConversionRateConfig", "NewFloatingUnitWithProrationPrice", + "NewFloatingUnitWithProrationPriceUnitWithProrationConfig", "NewFloatingUnitWithProrationPriceConversionRateConfig", "NewFloatingGroupedAllocationPrice", + "NewFloatingGroupedAllocationPriceGroupedAllocationConfig", "NewFloatingGroupedAllocationPriceConversionRateConfig", + "NewFloatingBulkWithProrationPrice", + "NewFloatingBulkWithProrationPriceBulkWithProrationConfig", + "NewFloatingBulkWithProrationPriceBulkWithProrationConfigTier", + "NewFloatingBulkWithProrationPriceConversionRateConfig", "NewFloatingGroupedWithProratedMinimumPrice", + "NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig", "NewFloatingGroupedWithProratedMinimumPriceConversionRateConfig", "NewFloatingGroupedWithMeteredMinimumPrice", + "NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig", + "NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor", + "NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount", "NewFloatingGroupedWithMeteredMinimumPriceConversionRateConfig", + "NewFloatingGroupedWithMinMaxThresholdsPrice", + "NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", + "NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig", "NewFloatingMatrixWithDisplayNamePrice", + "NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig", + "NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount", "NewFloatingMatrixWithDisplayNamePriceConversionRateConfig", - "NewFloatingBulkWithProrationPrice", - "NewFloatingBulkWithProrationPriceConversionRateConfig", "NewFloatingGroupedTieredPackagePrice", + "NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig", + "NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfigTier", "NewFloatingGroupedTieredPackagePriceConversionRateConfig", + "NewFloatingMaxGroupTieredPackagePrice", + "NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig", + "NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier", + "NewFloatingMaxGroupTieredPackagePriceConversionRateConfig", "NewFloatingScalableMatrixWithUnitPricingPrice", + "NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig", + "NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor", "NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig", "NewFloatingScalableMatrixWithTieredPricingPrice", + "NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig", + "NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier", "NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig", "NewFloatingCumulativeGroupedBulkPrice", + "NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig", + "NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue", "NewFloatingCumulativeGroupedBulkPriceConversionRateConfig", - "NewFloatingGroupedWithMinMaxThresholdsPrice", - "NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig", "NewFloatingMinimumCompositePrice", "NewFloatingMinimumCompositePriceMinimumConfig", "NewFloatingMinimumCompositePriceConversionRateConfig", @@ -87,11 +123,13 @@ class NewFloatingUnitPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit"]] + """The pricing model type""" name: Required[str] """The name of the price.""" unit_config: Required[UnitConfig] + """Configuration for unit pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -149,7 +187,7 @@ class NewFloatingUnitPrice(TypedDict, total=False): NewFloatingUnitPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] -class NewFloatingPackagePrice(TypedDict, total=False): +class NewFloatingTieredPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -159,12 +197,14 @@ class NewFloatingPackagePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["package"]] + model_type: Required[Literal["tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - package_config: Required[PackageConfig] + tiered_config: Required[TieredConfig] + """Configuration for tiered pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -187,7 +227,7 @@ class NewFloatingPackagePrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingPackagePriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingTieredPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -219,10 +259,13 @@ class NewFloatingPackagePrice(TypedDict, total=False): """ -NewFloatingPackagePriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] +NewFloatingTieredPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] -class NewFloatingMatrixPrice(TypedDict, total=False): +class NewFloatingBulkPrice(TypedDict, total=False): + bulk_config: Required[BulkConfig] + """Configuration for bulk pricing""" + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -232,9 +275,8 @@ class NewFloatingMatrixPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_config: Required[MatrixConfig] - - model_type: Required[Literal["matrix"]] + model_type: Required[Literal["bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -260,7 +302,7 @@ class NewFloatingMatrixPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingMatrixPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingBulkPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -292,10 +334,10 @@ class NewFloatingMatrixPrice(TypedDict, total=False): """ -NewFloatingMatrixPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] +NewFloatingBulkPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] -class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): +class NewFloatingPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -305,13 +347,15 @@ class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_with_allocation_config: Required[MatrixWithAllocationConfig] - - model_type: Required[Literal["matrix_with_allocation"]] + model_type: Required[Literal["package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" + package_config: Required[PackageConfig] + """Configuration for package pricing""" + billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -333,7 +377,7 @@ class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingMatrixWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingPackagePriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -365,12 +409,10 @@ class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): """ -NewFloatingMatrixWithAllocationPriceConversionRateConfig: TypeAlias = Union[ - UnitConversionRateConfig, TieredConversionRateConfig -] +NewFloatingPackagePriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] -class NewFloatingTieredPrice(TypedDict, total=False): +class NewFloatingMatrixPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -380,13 +422,15 @@ class NewFloatingTieredPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["tiered"]] + matrix_config: Required[MatrixConfig] + """Configuration for matrix pricing""" + + model_type: Required[Literal["matrix"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_config: Required[TieredConfig] - billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -408,7 +452,7 @@ class NewFloatingTieredPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingTieredPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingMatrixPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -440,12 +484,10 @@ class NewFloatingTieredPrice(TypedDict, total=False): """ -NewFloatingTieredPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] +NewFloatingMatrixPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] -class NewFloatingBulkPrice(TypedDict, total=False): - bulk_config: Required[BulkConfig] - +class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -455,11 +497,15 @@ class NewFloatingBulkPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["bulk"]] + model_type: Required[Literal["threshold_total_amount"]] + """The pricing model type""" name: Required[str] """The name of the price.""" + threshold_total_amount_config: Required[NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig] + """Configuration for threshold_total_amount pricing""" + billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -481,7 +527,7 @@ class NewFloatingBulkPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingBulkPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingThresholdTotalAmountPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -513,10 +559,33 @@ class NewFloatingBulkPrice(TypedDict, total=False): """ -NewFloatingBulkPriceConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] +class NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable(TypedDict, total=False): + threshold: Required[str] + """Quantity threshold""" + total_amount: Required[str] + """Total amount for this threshold""" -class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): + +class NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfig(TypedDict, total=False): + consumption_table: Required[ + Iterable[NewFloatingThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable] + ] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + + +NewFloatingThresholdTotalAmountPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class NewFloatingTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -526,12 +595,14 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["threshold_total_amount"]] + model_type: Required[Literal["tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - threshold_total_amount_config: Required[Dict[str, object]] + tiered_package_config: Required[NewFloatingTieredPackagePriceTieredPackageConfig] + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -554,7 +625,7 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingThresholdTotalAmountPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingTieredPackagePriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -586,12 +657,31 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): """ -NewFloatingThresholdTotalAmountPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingTieredPackagePriceTieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class NewFloatingTieredPackagePriceTieredPackageConfig(TypedDict, total=False): + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[NewFloatingTieredPackagePriceTieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + +NewFloatingTieredPackagePriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingTieredPackagePrice(TypedDict, total=False): +class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -601,12 +691,14 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["tiered_package"]] + model_type: Required[Literal["tiered_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_config: Required[Dict[str, object]] + tiered_with_minimum_config: Required[NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig] + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -629,7 +721,7 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingTieredWithMinimumPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -661,7 +753,32 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): """ -NewFloatingTieredPackagePriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingTieredWithMinimumPriceTieredWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingTieredWithMinimumPriceTieredWithMinimumConfig(TypedDict, total=False): + tiers: Required[Iterable[NewFloatingTieredWithMinimumPriceTieredWithMinimumConfigTier]] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: bool + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: bool + """If true, the unit price will be prorated to the billing period""" + + +NewFloatingTieredWithMinimumPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -673,12 +790,14 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_config: Required[Dict[str, object]] + grouped_tiered_config: Required[NewFloatingGroupedTieredPriceGroupedTieredConfig] + """Configuration for grouped_tiered pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -736,12 +855,31 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): """ +class NewFloatingGroupedTieredPriceGroupedTieredConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingGroupedTieredPriceGroupedTieredConfig(TypedDict, total=False): + grouping_key: Required[str] + """The billable metric property used to group before tiering""" + + tiers: Required[Iterable[NewFloatingGroupedTieredPriceGroupedTieredConfigTier]] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + + NewFloatingGroupedTieredPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): +class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -751,13 +889,15 @@ class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Required[Dict[str, object]] - - model_type: Required[Literal["max_group_tiered_package"]] + model_type: Required[Literal["tiered_package_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" + tiered_package_with_minimum_config: Required[NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig] + """Configuration for tiered_package_with_minimum pricing""" + billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -779,7 +919,7 @@ class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingTieredPackageWithMinimumPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -811,12 +951,34 @@ class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): """ -NewFloatingMaxGroupTieredPackagePriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfig(TypedDict, total=False): + package_size: Required[float] + """Package size""" + + tiers: Required[Iterable[NewFloatingTieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + +NewFloatingTieredPackageWithMinimumPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): +class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -826,12 +988,14 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["tiered_with_minimum"]] + model_type: Required[Literal["package_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_minimum_config: Required[Dict[str, object]] + package_with_allocation_config: Required[NewFloatingPackageWithAllocationPricePackageWithAllocationConfig] + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -854,7 +1018,7 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingTieredWithMinimumPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingPackageWithAllocationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -886,12 +1050,23 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): """ -NewFloatingTieredWithMinimumPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingPackageWithAllocationPricePackageWithAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation""" + + package_amount: Required[str] + """Price per package""" + + package_size: Required[str] + """Package size""" + + +NewFloatingPackageWithAllocationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): +class NewFloatingUnitWithPercentPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -901,12 +1076,14 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["package_with_allocation"]] + model_type: Required[Literal["unit_with_percent"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - package_with_allocation_config: Required[Dict[str, object]] + unit_with_percent_config: Required[NewFloatingUnitWithPercentPriceUnitWithPercentConfig] + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -929,7 +1106,7 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingPackageWithAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingUnitWithPercentPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -961,12 +1138,20 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): """ -NewFloatingPackageWithAllocationPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingUnitWithPercentPriceUnitWithPercentConfig(TypedDict, total=False): + percent: Required[str] + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: Required[str] + """Rate per unit of usage""" + + +NewFloatingUnitWithPercentPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): +class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -976,13 +1161,15 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["tiered_package_with_minimum"]] + matrix_with_allocation_config: Required[MatrixWithAllocationConfig] + """Configuration for matrix_with_allocation pricing""" + + model_type: Required[Literal["matrix_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_with_minimum_config: Required[Dict[str, object]] - billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1004,7 +1191,7 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingTieredPackageWithMinimumPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingMatrixWithAllocationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1036,12 +1223,12 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): """ -NewFloatingTieredPackageWithMinimumPriceConversionRateConfig: TypeAlias = Union[ +NewFloatingMatrixWithAllocationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingUnitWithPercentPrice(TypedDict, total=False): +class NewFloatingTieredWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -1051,12 +1238,14 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["unit_with_percent"]] + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_percent_config: Required[Dict[str, object]] + tiered_with_proration_config: Required[NewFloatingTieredWithProrationPriceTieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1079,7 +1268,7 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingUnitWithPercentPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingTieredWithProrationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1111,12 +1300,28 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): """ -NewFloatingUnitWithPercentPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class NewFloatingTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[NewFloatingTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +NewFloatingTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingTieredWithProrationPrice(TypedDict, total=False): +class NewFloatingUnitWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -1126,12 +1331,14 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["tiered_with_proration"]] + model_type: Required[Literal["unit_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_proration_config: Required[Dict[str, object]] + unit_with_proration_config: Required[NewFloatingUnitWithProrationPriceUnitWithProrationConfig] + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1154,7 +1361,7 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingTieredWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingUnitWithProrationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1186,28 +1393,35 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): """ -NewFloatingTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingUnitWithProrationPriceUnitWithProrationConfig(TypedDict, total=False): + unit_amount: Required[str] + """Rate per unit of usage""" + + +NewFloatingUnitWithProrationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingUnitWithProrationPrice(TypedDict, total=False): +class NewFloatingGroupedAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" + grouped_allocation_config: Required[NewFloatingGroupedAllocationPriceGroupedAllocationConfig] + """Configuration for grouped_allocation pricing""" + item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["unit_with_proration"]] + model_type: Required[Literal["grouped_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_proration_config: Required[Dict[str, object]] - billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1229,7 +1443,7 @@ class NewFloatingUnitWithProrationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingUnitWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingGroupedAllocationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1261,24 +1475,37 @@ class NewFloatingUnitWithProrationPrice(TypedDict, total=False): """ -NewFloatingUnitWithProrationPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingGroupedAllocationPriceGroupedAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation per group""" + + grouping_key: Required[str] + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: Required[str] + """Unit rate for post-allocation""" + + +NewFloatingGroupedAllocationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingGroupedAllocationPrice(TypedDict, total=False): +class NewFloatingBulkWithProrationPrice(TypedDict, total=False): + bulk_with_proration_config: Required[NewFloatingBulkWithProrationPriceBulkWithProrationConfig] + """Configuration for bulk_with_proration pricing""" + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_allocation_config: Required[Dict[str, object]] - item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["grouped_allocation"]] + model_type: Required[Literal["bulk_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1304,7 +1531,7 @@ class NewFloatingGroupedAllocationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingGroupedAllocationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingBulkWithProrationPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1336,7 +1563,20 @@ class NewFloatingGroupedAllocationPrice(TypedDict, total=False): """ -NewFloatingGroupedAllocationPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingBulkWithProrationPriceBulkWithProrationConfigTier(TypedDict, total=False): + unit_amount: Required[str] + """Cost per unit""" + + tier_lower_bound: Optional[str] + """The lower bound for this tier""" + + +class NewFloatingBulkWithProrationPriceBulkWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[NewFloatingBulkWithProrationPriceBulkWithProrationConfigTier]] + """Bulk tiers for rating based on total usage volume""" + + +NewFloatingBulkWithProrationPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -1348,12 +1588,16 @@ class NewFloatingGroupedWithProratedMinimumPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_prorated_minimum_config: Required[Dict[str, object]] + grouped_with_prorated_minimum_config: Required[ + NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig + ] + """Configuration for grouped_with_prorated_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_prorated_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1411,6 +1655,17 @@ class NewFloatingGroupedWithProratedMinimumPrice(TypedDict, total=False): """ +class NewFloatingGroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """How to determine the groups that should each have a minimum""" + + minimum: Required[str] + """The minimum amount to charge per group""" + + unit_rate: Required[str] + """The amount to charge per unit""" + + NewFloatingGroupedWithProratedMinimumPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -1423,12 +1678,16 @@ class NewFloatingGroupedWithMeteredMinimumPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_metered_minimum_config: Required[Dict[str, object]] + grouped_with_metered_minimum_config: Required[ + NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig + ] + """Configuration for grouped_with_metered_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_metered_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1486,24 +1745,72 @@ class NewFloatingGroupedWithMeteredMinimumPrice(TypedDict, total=False): """ +class NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor(TypedDict, total=False): + scaling_factor: Required[str] + """Scaling factor""" + + scaling_value: Required[str] + """Scaling value""" + + +class NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount(TypedDict, total=False): + pricing_value: Required[str] + """Pricing value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: Required[str] + """The minimum amount to charge per group per unit""" + + pricing_key: Required[str] + """Used to determine the unit rate""" + + scaling_factors: Required[ + Iterable[NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor] + ] + """Scale the unit rates by the scaling factor.""" + + scaling_key: Required[str] + """Used to determine the unit rate scaling factor""" + + unit_amounts: Required[Iterable[NewFloatingGroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount]] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + + NewFloatingGroupedWithMeteredMinimumPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingMatrixWithDisplayNamePrice(TypedDict, total=False): +class NewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" + grouped_with_min_max_thresholds_config: Required[ + NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" + item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Required[Dict[str, object]] - - model_type: Required[Literal["matrix_with_display_name"]] + model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1529,7 +1836,7 @@ class NewFloatingMatrixWithDisplayNamePrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1561,14 +1868,26 @@ class NewFloatingMatrixWithDisplayNamePrice(TypedDict, total=False): """ -NewFloatingMatrixWithDisplayNamePriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + +NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingBulkWithProrationPrice(TypedDict, total=False): - bulk_with_proration_config: Required[Dict[str, object]] - +class NewFloatingMatrixWithDisplayNamePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -1578,7 +1897,11 @@ class NewFloatingBulkWithProrationPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["bulk_with_proration"]] + matrix_with_display_name_config: Required[NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig] + """Configuration for matrix_with_display_name pricing""" + + model_type: Required[Literal["matrix_with_display_name"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1604,7 +1927,7 @@ class NewFloatingBulkWithProrationPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingBulkWithProrationPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingMatrixWithDisplayNamePriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1636,7 +1959,26 @@ class NewFloatingBulkWithProrationPrice(TypedDict, total=False): """ -NewFloatingBulkWithProrationPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount(TypedDict, total=False): + dimension_value: Required[str] + """The dimension value""" + + display_name: Required[str] + """Display name for this dimension value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfig(TypedDict, total=False): + dimension: Required[str] + """Used to determine the unit rate""" + + unit_amounts: Required[Iterable[NewFloatingMatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount]] + """Apply per unit pricing to each dimension value""" + + +NewFloatingMatrixWithDisplayNamePriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -1648,12 +1990,14 @@ class NewFloatingGroupedTieredPackagePrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_package_config: Required[Dict[str, object]] + grouped_tiered_package_config: Required[NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig] + """Configuration for grouped_tiered_package pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1711,12 +2055,34 @@ class NewFloatingGroupedTieredPackagePrice(TypedDict, total=False): """ +class NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before tiering""" + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[NewFloatingGroupedTieredPackagePriceGroupedTieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + NewFloatingGroupedTieredPackagePriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): +class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -1726,13 +2092,15 @@ class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["scalable_matrix_with_unit_pricing"]] + max_group_tiered_package_config: Required[NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig] + """Configuration for max_group_tiered_package pricing""" + + model_type: Required[Literal["max_group_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Required[Dict[str, object]] - billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1754,7 +2122,7 @@ class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingMaxGroupTieredPackagePriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1786,12 +2154,33 @@ class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): """ -NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[NewFloatingMaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier]] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + + +NewFloatingMaxGroupTieredPackagePriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): +class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -1801,12 +2190,16 @@ class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["scalable_matrix_with_tiered_pricing"]] + model_type: Required[Literal["scalable_matrix_with_unit_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_unit_pricing_config: Required[ + NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig + ] + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1829,7 +2222,7 @@ class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1861,28 +2254,64 @@ class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): """ -NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor( + TypedDict, total=False +): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used to determine the unit rate""" + + matrix_scaling_factors: Required[ + Iterable[NewFloatingScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor] + ] + """Apply a scaling factor to each dimension""" + + unit_price: Required[str] + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] + """Used to determine the unit rate (optional)""" + + +NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): +class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Required[Dict[str, object]] - currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["cumulative_grouped_bulk"]] + model_type: Required[Literal["scalable_matrix_with_tiered_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" + scalable_matrix_with_tiered_pricing_config: Required[ + NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig + ] + """Configuration for scalable_matrix_with_tiered_pricing pricing""" + billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -1904,7 +2333,7 @@ class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -1936,24 +2365,65 @@ class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): """ -NewFloatingCumulativeGroupedBulkPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor( + TypedDict, total=False +): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: Required[ + Iterable[ + NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor + ] + ] + """Apply a scaling factor to each dimension""" + + tiers: Required[Iterable[NewFloatingScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier]] + """Tier pricing structure""" + + second_dimension: Optional[str] + """Used for the scalable matrix second dimension (optional)""" + + +NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] -class NewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): +class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" + cumulative_grouped_bulk_config: Required[NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig] + """Configuration for cumulative_grouped_bulk pricing""" + currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] - item_id: Required[str] """The id of the item the price will be associated with.""" - model_type: Required[Literal["grouped_with_min_max_thresholds"]] + model_type: Required[Literal["cumulative_grouped_bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -1979,7 +2449,7 @@ class NewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): conversion_rate: Optional[float] """The per unit conversion rate of the price currency to the invoicing currency.""" - conversion_rate_config: Optional[NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig] + conversion_rate_config: Optional[NewFloatingCumulativeGroupedBulkPriceConversionRateConfig] """The configuration for the rate of the price currency to the invoicing currency.""" dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] @@ -2011,7 +2481,26 @@ class NewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False): """ -NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ +class NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue(TypedDict, total=False): + grouping_key: Required[str] + """Grouping key value""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Unit amount for this combination""" + + +class NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfig(TypedDict, total=False): + dimension_values: Required[Iterable[NewFloatingCumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue]] + """Each tier lower bound must have the same group of values.""" + + group: Required[str] + """Grouping key name""" + + +NewFloatingCumulativeGroupedBulkPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -2027,8 +2516,10 @@ class NewFloatingMinimumCompositePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" minimum_config: Required[NewFloatingMinimumCompositePriceMinimumConfig] + """Configuration for minimum pricing""" model_type: Required[Literal["minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -2090,11 +2581,8 @@ class NewFloatingMinimumCompositePriceMinimumConfig(TypedDict, total=False): minimum_amount: Required[str] """The minimum amount to apply""" - prorated: Optional[bool] - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" NewFloatingMinimumCompositePriceConversionRateConfig: TypeAlias = Union[ @@ -2103,30 +2591,30 @@ class NewFloatingMinimumCompositePriceMinimumConfig(TypedDict, total=False): PriceCreateParams: TypeAlias = Union[ NewFloatingUnitPrice, - NewFloatingPackagePrice, - NewFloatingMatrixPrice, - NewFloatingMatrixWithAllocationPrice, NewFloatingTieredPrice, NewFloatingBulkPrice, + NewFloatingPackagePrice, + NewFloatingMatrixPrice, NewFloatingThresholdTotalAmountPrice, NewFloatingTieredPackagePrice, - NewFloatingGroupedTieredPrice, - NewFloatingMaxGroupTieredPackagePrice, NewFloatingTieredWithMinimumPrice, - NewFloatingPackageWithAllocationPrice, + NewFloatingGroupedTieredPrice, NewFloatingTieredPackageWithMinimumPrice, + NewFloatingPackageWithAllocationPrice, NewFloatingUnitWithPercentPrice, + NewFloatingMatrixWithAllocationPrice, NewFloatingTieredWithProrationPrice, NewFloatingUnitWithProrationPrice, NewFloatingGroupedAllocationPrice, + NewFloatingBulkWithProrationPrice, NewFloatingGroupedWithProratedMinimumPrice, NewFloatingGroupedWithMeteredMinimumPrice, + NewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMatrixWithDisplayNamePrice, - NewFloatingBulkWithProrationPrice, NewFloatingGroupedTieredPackagePrice, + NewFloatingMaxGroupTieredPackagePrice, NewFloatingScalableMatrixWithUnitPricingPrice, NewFloatingScalableMatrixWithTieredPricingPrice, NewFloatingCumulativeGroupedBulkPrice, - NewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMinimumCompositePrice, ] diff --git a/src/orb/types/price_evaluate_multiple_params.py b/src/orb/types/price_evaluate_multiple_params.py index 0610f565..3cf2bc6d 100644 --- a/src/orb/types/price_evaluate_multiple_params.py +++ b/src/orb/types/price_evaluate_multiple_params.py @@ -48,6 +48,7 @@ "PriceEvaluation", "PriceEvaluationPrice", "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice", + "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -69,6 +70,22 @@ class PriceEvaluateMultipleParams(TypedDict, total=False): """List of prices to evaluate (max 100)""" +class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -81,12 +98,16 @@ class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -148,31 +169,31 @@ class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, PriceEvaluationPrice: TypeAlias = Union[ NewFloatingUnitPrice, - NewFloatingPackagePrice, - NewFloatingMatrixPrice, - NewFloatingMatrixWithAllocationPrice, NewFloatingTieredPrice, NewFloatingBulkPrice, + NewFloatingPackagePrice, + NewFloatingMatrixPrice, NewFloatingThresholdTotalAmountPrice, NewFloatingTieredPackagePrice, - NewFloatingGroupedTieredPrice, - NewFloatingMaxGroupTieredPackagePrice, NewFloatingTieredWithMinimumPrice, - NewFloatingPackageWithAllocationPrice, + NewFloatingGroupedTieredPrice, NewFloatingTieredPackageWithMinimumPrice, + NewFloatingPackageWithAllocationPrice, NewFloatingUnitWithPercentPrice, + NewFloatingMatrixWithAllocationPrice, NewFloatingTieredWithProrationPrice, NewFloatingUnitWithProrationPrice, NewFloatingGroupedAllocationPrice, + NewFloatingBulkWithProrationPrice, NewFloatingGroupedWithProratedMinimumPrice, NewFloatingGroupedWithMeteredMinimumPrice, + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMatrixWithDisplayNamePrice, - NewFloatingBulkWithProrationPrice, NewFloatingGroupedTieredPackagePrice, + NewFloatingMaxGroupTieredPackagePrice, NewFloatingScalableMatrixWithUnitPricingPrice, NewFloatingScalableMatrixWithTieredPricingPrice, NewFloatingCumulativeGroupedBulkPrice, - PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMinimumCompositePrice, ] @@ -196,10 +217,7 @@ class PriceEvaluation(TypedDict, total=False): """ price: Optional[PriceEvaluationPrice] - """ - An inline price definition to evaluate, allowing you to test price - configurations before adding them to Orb. - """ + """New floating price request body params.""" price_id: Optional[str] """The ID of a price to evaluate that exists in your Orb account.""" diff --git a/src/orb/types/price_evaluate_preview_events_params.py b/src/orb/types/price_evaluate_preview_events_params.py index f1843234..8838236c 100644 --- a/src/orb/types/price_evaluate_preview_events_params.py +++ b/src/orb/types/price_evaluate_preview_events_params.py @@ -49,6 +49,7 @@ "PriceEvaluation", "PriceEvaluationPrice", "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice", + "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -101,6 +102,22 @@ class Event(TypedDict, total=False): """ +class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -113,12 +130,16 @@ class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -180,31 +201,31 @@ class PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, PriceEvaluationPrice: TypeAlias = Union[ NewFloatingUnitPrice, - NewFloatingPackagePrice, - NewFloatingMatrixPrice, - NewFloatingMatrixWithAllocationPrice, NewFloatingTieredPrice, NewFloatingBulkPrice, + NewFloatingPackagePrice, + NewFloatingMatrixPrice, NewFloatingThresholdTotalAmountPrice, NewFloatingTieredPackagePrice, - NewFloatingGroupedTieredPrice, - NewFloatingMaxGroupTieredPackagePrice, NewFloatingTieredWithMinimumPrice, - NewFloatingPackageWithAllocationPrice, + NewFloatingGroupedTieredPrice, NewFloatingTieredPackageWithMinimumPrice, + NewFloatingPackageWithAllocationPrice, NewFloatingUnitWithPercentPrice, + NewFloatingMatrixWithAllocationPrice, NewFloatingTieredWithProrationPrice, NewFloatingUnitWithProrationPrice, NewFloatingGroupedAllocationPrice, + NewFloatingBulkWithProrationPrice, NewFloatingGroupedWithProratedMinimumPrice, NewFloatingGroupedWithMeteredMinimumPrice, + PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMatrixWithDisplayNamePrice, - NewFloatingBulkWithProrationPrice, NewFloatingGroupedTieredPackagePrice, + NewFloatingMaxGroupTieredPackagePrice, NewFloatingScalableMatrixWithUnitPricingPrice, NewFloatingScalableMatrixWithTieredPricingPrice, NewFloatingCumulativeGroupedBulkPrice, - PriceEvaluationPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMinimumCompositePrice, ] @@ -228,10 +249,7 @@ class PriceEvaluation(TypedDict, total=False): """ price: Optional[PriceEvaluationPrice] - """ - An inline price definition to evaluate, allowing you to test price - configurations before adding them to Orb. - """ + """New floating price request body params.""" price_id: Optional[str] """The ID of a price to evaluate that exists in your Orb account.""" diff --git a/src/orb/types/shared/__init__.py b/src/orb/types/shared/__init__.py index 2744f465..cd4d6376 100644 --- a/src/orb/types/shared/__init__.py +++ b/src/orb/types/shared/__init__.py @@ -15,7 +15,6 @@ from .credit_note import CreditNote as CreditNote from .new_maximum import NewMaximum as NewMaximum from .new_minimum import NewMinimum as NewMinimum -from .tier_config import TierConfig as TierConfig from .unit_config import UnitConfig as UnitConfig from .invoice_tiny import InvoiceTiny as InvoiceTiny from .matrix_value import MatrixValue as MatrixValue @@ -93,7 +92,6 @@ from .billing_cycle_anchor_configuration import BillingCycleAnchorConfiguration as BillingCycleAnchorConfiguration from .monetary_usage_discount_adjustment import MonetaryUsageDiscountAdjustment as MonetaryUsageDiscountAdjustment from .new_plan_bulk_with_proration_price import NewPlanBulkWithProrationPrice as NewPlanBulkWithProrationPrice -from .new_plan_tier_with_proration_price import NewPlanTierWithProrationPrice as NewPlanTierWithProrationPrice from .new_plan_tiered_with_minimum_price import NewPlanTieredWithMinimumPrice as NewPlanTieredWithMinimumPrice from .new_plan_unit_with_proration_price import NewPlanUnitWithProrationPrice as NewPlanUnitWithProrationPrice from .monetary_amount_discount_adjustment import MonetaryAmountDiscountAdjustment as MonetaryAmountDiscountAdjustment diff --git a/src/orb/types/shared/matrix_config.py b/src/orb/types/shared/matrix_config.py index dafa4699..718ab94d 100644 --- a/src/orb/types/shared/matrix_config.py +++ b/src/orb/types/shared/matrix_config.py @@ -16,4 +16,4 @@ class MatrixConfig(BaseModel): """One or two event property values to evaluate matrix groups by""" matrix_values: List[MatrixValue] - """Matrix values for specified matrix grouping keys""" + """Matrix values configuration""" diff --git a/src/orb/types/shared/matrix_value.py b/src/orb/types/shared/matrix_value.py index 4a9e9707..1f808898 100644 --- a/src/orb/types/shared/matrix_value.py +++ b/src/orb/types/shared/matrix_value.py @@ -9,11 +9,7 @@ class MatrixValue(BaseModel): dimension_values: List[Optional[str]] - """One or two matrix keys to filter usage to this Matrix value by. - - For example, ["region", "tier"] could be used to filter cloud usage by a cloud - region and an instance tier. - """ + """One or two matrix keys to filter usage to this Matrix value by""" unit_amount: str """Unit price for the specified dimension_values""" diff --git a/src/orb/types/shared/matrix_with_allocation_config.py b/src/orb/types/shared/matrix_with_allocation_config.py index ef196223..bc935fe9 100644 --- a/src/orb/types/shared/matrix_with_allocation_config.py +++ b/src/orb/types/shared/matrix_with_allocation_config.py @@ -3,14 +3,25 @@ from typing import List, Optional from ..._models import BaseModel -from .matrix_value import MatrixValue -__all__ = ["MatrixWithAllocationConfig"] +__all__ = ["MatrixWithAllocationConfig", "MatrixValue"] + + +class MatrixValue(BaseModel): + dimension_values: List[Optional[str]] + """One or two matrix keys to filter usage to this Matrix value by. + + For example, ["region", "tier"] could be used to filter cloud usage by a cloud + region and an instance tier. + """ + + unit_amount: str + """Unit price for the specified dimension_values""" class MatrixWithAllocationConfig(BaseModel): - allocation: float - """Allocation to be used to calculate the price""" + allocation: str + """Usage allocation""" default_unit_amount: str """Default per unit rate for any usage not bucketed into a specified matrix_value""" @@ -19,4 +30,4 @@ class MatrixWithAllocationConfig(BaseModel): """One or two event property values to evaluate matrix groups by""" matrix_values: List[MatrixValue] - """Matrix values for specified matrix grouping keys""" + """Matrix values configuration""" diff --git a/src/orb/types/shared/new_floating_bulk_price.py b/src/orb/types/shared/new_floating_bulk_price.py index b87725ee..cdeb808b 100644 --- a/src/orb/types/shared/new_floating_bulk_price.py +++ b/src/orb/types/shared/new_floating_bulk_price.py @@ -22,6 +22,7 @@ class NewFloatingBulkPrice(BaseModel): bulk_config: BulkConfig + """Configuration for bulk pricing""" cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" @@ -33,6 +34,7 @@ class NewFloatingBulkPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_bulk_with_proration_price.py b/src/orb/types/shared/new_floating_bulk_with_proration_price.py index a54b7025..39253426 100644 --- a/src/orb/types/shared/new_floating_bulk_with_proration_price.py +++ b/src/orb/types/shared/new_floating_bulk_with_proration_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,26 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingBulkWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingBulkWithProrationPrice", + "BulkWithProrationConfig", + "BulkWithProrationConfigTier", + "ConversionRateConfig", +] + + +class BulkWithProrationConfigTier(BaseModel): + unit_amount: str + """Cost per unit""" + + tier_lower_bound: Optional[str] = None + """The lower bound for this tier""" + + +class BulkWithProrationConfig(BaseModel): + tiers: List[BulkWithProrationConfigTier] + """Bulk tiers for rating based on total usage volume""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -20,7 +39,8 @@ class NewFloatingBulkWithProrationPrice(BaseModel): - bulk_with_proration_config: Dict[str, object] + bulk_with_proration_config: BulkWithProrationConfig + """Configuration for bulk_with_proration pricing""" cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" @@ -32,6 +52,7 @@ class NewFloatingBulkWithProrationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["bulk_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_cumulative_grouped_bulk_price.py b/src/orb/types/shared/new_floating_cumulative_grouped_bulk_price.py index 7e9e9ff1..21bdd4f6 100644 --- a/src/orb/types/shared/new_floating_cumulative_grouped_bulk_price.py +++ b/src/orb/types/shared/new_floating_cumulative_grouped_bulk_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingCumulativeGroupedBulkPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingCumulativeGroupedBulkPrice", + "CumulativeGroupedBulkConfig", + "CumulativeGroupedBulkConfigDimensionValue", + "ConversionRateConfig", +] + + +class CumulativeGroupedBulkConfigDimensionValue(BaseModel): + grouping_key: str + """Grouping key value""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Unit amount for this combination""" + + +class CumulativeGroupedBulkConfig(BaseModel): + dimension_values: List[CumulativeGroupedBulkConfigDimensionValue] + """Each tier lower bound must have the same group of values.""" + + group: str + """Grouping key name""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,7 +48,8 @@ class NewFloatingCumulativeGroupedBulkPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Dict[str, object] + cumulative_grouped_bulk_config: CumulativeGroupedBulkConfig + """Configuration for cumulative_grouped_bulk pricing""" currency: str """An ISO 4217 currency string for which this price is billed in.""" @@ -32,6 +58,7 @@ class NewFloatingCumulativeGroupedBulkPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["cumulative_grouped_bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_grouped_allocation_price.py b/src/orb/types/shared/new_floating_grouped_allocation_price.py index 40b9c8e1..66b0ab81 100644 --- a/src/orb/types/shared/new_floating_grouped_allocation_price.py +++ b/src/orb/types/shared/new_floating_grouped_allocation_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedAllocationPrice", "GroupedAllocationConfig", "ConversionRateConfig"] + + +class GroupedAllocationConfig(BaseModel): + allocation: str + """Usage allocation per group""" + + grouping_key: str + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: str + """Unit rate for post-allocation""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,12 +38,14 @@ class NewFloatingGroupedAllocationPrice(BaseModel): currency: str """An ISO 4217 currency string for which this price is billed in.""" - grouped_allocation_config: Dict[str, object] + grouped_allocation_config: GroupedAllocationConfig + """Configuration for grouped_allocation pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_grouped_tiered_package_price.py b/src/orb/types/shared/new_floating_grouped_tiered_package_price.py index b62a6346..559fd9e3 100644 --- a/src/orb/types/shared/new_floating_grouped_tiered_package_price.py +++ b/src/orb/types/shared/new_floating_grouped_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingGroupedTieredPackagePrice", + "GroupedTieredPackageConfig", + "GroupedTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class GroupedTieredPackageConfig(BaseModel): + grouping_key: str + """The event property used to group before tiering""" + + package_size: str + """Package size""" + + tiers: List[GroupedTieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,12 +54,14 @@ class NewFloatingGroupedTieredPackagePrice(BaseModel): currency: str """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_package_config: Dict[str, object] + grouped_tiered_package_config: GroupedTieredPackageConfig + """Configuration for grouped_tiered_package pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_grouped_tiered_price.py b/src/orb/types/shared/new_floating_grouped_tiered_price.py index b50d846f..90821412 100644 --- a/src/orb/types/shared/new_floating_grouped_tiered_price.py +++ b/src/orb/types/shared/new_floating_grouped_tiered_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedTieredPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedTieredPrice", "GroupedTieredConfig", "GroupedTieredConfigTier", "ConversionRateConfig"] + + +class GroupedTieredConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class GroupedTieredConfig(BaseModel): + grouping_key: str + """The billable metric property used to group before tiering""" + + tiers: List[GroupedTieredConfigTier] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,12 +46,14 @@ class NewFloatingGroupedTieredPrice(BaseModel): currency: str """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_config: Dict[str, object] + grouped_tiered_config: GroupedTieredConfig + """Configuration for grouped_tiered pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_grouped_with_metered_minimum_price.py b/src/orb/types/shared/new_floating_grouped_with_metered_minimum_price.py index cb1bf6e1..da6d97d2 100644 --- a/src/orb/types/shared/new_floating_grouped_with_metered_minimum_price.py +++ b/src/orb/types/shared/new_floating_grouped_with_metered_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,56 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedWithMeteredMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingGroupedWithMeteredMinimumPrice", + "GroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumConfigUnitAmount", + "ConversionRateConfig", +] + + +class GroupedWithMeteredMinimumConfigScalingFactor(BaseModel): + scaling_factor: str + """Scaling factor""" + + scaling_value: str + """Scaling value""" + + +class GroupedWithMeteredMinimumConfigUnitAmount(BaseModel): + pricing_value: str + """Pricing value""" + + unit_amount: str + """Per unit amount""" + + +class GroupedWithMeteredMinimumConfig(BaseModel): + grouping_key: str + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: str + """The minimum amount to charge per group per unit""" + + pricing_key: str + """Used to determine the unit rate""" + + scaling_factors: List[GroupedWithMeteredMinimumConfigScalingFactor] + """Scale the unit rates by the scaling factor.""" + + scaling_key: str + """Used to determine the unit rate scaling factor""" + + unit_amounts: List[GroupedWithMeteredMinimumConfigUnitAmount] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,12 +75,14 @@ class NewFloatingGroupedWithMeteredMinimumPrice(BaseModel): currency: str """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_metered_minimum_config: Dict[str, object] + grouped_with_metered_minimum_config: GroupedWithMeteredMinimumConfig + """Configuration for grouped_with_metered_minimum pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_with_metered_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_grouped_with_prorated_minimum_price.py b/src/orb/types/shared/new_floating_grouped_with_prorated_minimum_price.py index 9168a0ff..e3705b23 100644 --- a/src/orb/types/shared/new_floating_grouped_with_prorated_minimum_price.py +++ b/src/orb/types/shared/new_floating_grouped_with_prorated_minimum_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedWithProratedMinimumPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedWithProratedMinimumPrice", "GroupedWithProratedMinimumConfig", "ConversionRateConfig"] + + +class GroupedWithProratedMinimumConfig(BaseModel): + grouping_key: str + """How to determine the groups that should each have a minimum""" + + minimum: str + """The minimum amount to charge per group""" + + unit_rate: str + """The amount to charge per unit""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,12 +38,14 @@ class NewFloatingGroupedWithProratedMinimumPrice(BaseModel): currency: str """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_prorated_minimum_config: Dict[str, object] + grouped_with_prorated_minimum_config: GroupedWithProratedMinimumConfig + """Configuration for grouped_with_prorated_minimum pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_with_prorated_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_matrix_price.py b/src/orb/types/shared/new_floating_matrix_price.py index 84a0936c..7eea7957 100644 --- a/src/orb/types/shared/new_floating_matrix_price.py +++ b/src/orb/types/shared/new_floating_matrix_price.py @@ -31,8 +31,10 @@ class NewFloatingMatrixPrice(BaseModel): """The id of the item the price will be associated with.""" matrix_config: MatrixConfig + """Configuration for matrix pricing""" price_model_type: Literal["matrix"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_matrix_with_allocation_price.py b/src/orb/types/shared/new_floating_matrix_with_allocation_price.py index c93e20d0..78a1cb0d 100644 --- a/src/orb/types/shared/new_floating_matrix_with_allocation_price.py +++ b/src/orb/types/shared/new_floating_matrix_with_allocation_price.py @@ -31,8 +31,10 @@ class NewFloatingMatrixWithAllocationPrice(BaseModel): """The id of the item the price will be associated with.""" matrix_with_allocation_config: MatrixWithAllocationConfig + """Configuration for matrix_with_allocation pricing""" price_model_type: Literal["matrix_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_matrix_with_display_name_price.py b/src/orb/types/shared/new_floating_matrix_with_display_name_price.py index 13da424f..2ccdbccc 100644 --- a/src/orb/types/shared/new_floating_matrix_with_display_name_price.py +++ b/src/orb/types/shared/new_floating_matrix_with_display_name_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingMatrixWithDisplayNamePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingMatrixWithDisplayNamePrice", + "MatrixWithDisplayNameConfig", + "MatrixWithDisplayNameConfigUnitAmount", + "ConversionRateConfig", +] + + +class MatrixWithDisplayNameConfigUnitAmount(BaseModel): + dimension_value: str + """The dimension value""" + + display_name: str + """Display name for this dimension value""" + + unit_amount: str + """Per unit amount""" + + +class MatrixWithDisplayNameConfig(BaseModel): + dimension: str + """Used to determine the unit rate""" + + unit_amounts: List[MatrixWithDisplayNameConfigUnitAmount] + """Apply per unit pricing to each dimension value""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -29,9 +54,11 @@ class NewFloatingMatrixWithDisplayNamePrice(BaseModel): item_id: str """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Dict[str, object] + matrix_with_display_name_config: MatrixWithDisplayNameConfig + """Configuration for matrix_with_display_name pricing""" price_model_type: Literal["matrix_with_display_name"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_max_group_tiered_package_price.py b/src/orb/types/shared/new_floating_max_group_tiered_package_price.py index e78e3cc7..abf19951 100644 --- a/src/orb/types/shared/new_floating_max_group_tiered_package_price.py +++ b/src/orb/types/shared/new_floating_max_group_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,34 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingMaxGroupTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingMaxGroupTieredPackagePrice", + "MaxGroupTieredPackageConfig", + "MaxGroupTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class MaxGroupTieredPackageConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class MaxGroupTieredPackageConfig(BaseModel): + grouping_key: str + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: str + """Package size""" + + tiers: List[MaxGroupTieredPackageConfigTier] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -29,9 +56,11 @@ class NewFloatingMaxGroupTieredPackagePrice(BaseModel): item_id: str """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Dict[str, object] + max_group_tiered_package_config: MaxGroupTieredPackageConfig + """Configuration for max_group_tiered_package pricing""" price_model_type: Literal["max_group_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_minimum_composite_price.py b/src/orb/types/shared/new_floating_minimum_composite_price.py index d83f3e5b..b8d1db20 100644 --- a/src/orb/types/shared/new_floating_minimum_composite_price.py +++ b/src/orb/types/shared/new_floating_minimum_composite_price.py @@ -20,10 +20,7 @@ class MinimumConfig(BaseModel): """The minimum amount to apply""" prorated: Optional[bool] = None - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + """If true, subtotals from this price are prorated based on the service period""" ConversionRateConfig: TypeAlias = Annotated[ @@ -42,8 +39,10 @@ class NewFloatingMinimumCompositePrice(BaseModel): """The id of the item the price will be associated with.""" minimum_config: MinimumConfig + """Configuration for minimum pricing""" price_model_type: Literal["minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_floating_package_price.py b/src/orb/types/shared/new_floating_package_price.py index 4972c4e3..3548de3e 100644 --- a/src/orb/types/shared/new_floating_package_price.py +++ b/src/orb/types/shared/new_floating_package_price.py @@ -31,11 +31,13 @@ class NewFloatingPackagePrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" package_config: PackageConfig + """Configuration for package pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_package_with_allocation_price.py b/src/orb/types/shared/new_floating_package_with_allocation_price.py index 4b750911..a0aadb96 100644 --- a/src/orb/types/shared/new_floating_package_with_allocation_price.py +++ b/src/orb/types/shared/new_floating_package_with_allocation_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingPackageWithAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingPackageWithAllocationPrice", "PackageWithAllocationConfig", "ConversionRateConfig"] + + +class PackageWithAllocationConfig(BaseModel): + allocation: str + """Usage allocation""" + + package_amount: str + """Price per package""" + + package_size: str + """Package size""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +42,13 @@ class NewFloatingPackageWithAllocationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["package_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - package_with_allocation_config: Dict[str, object] + package_with_allocation_config: PackageWithAllocationConfig + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_scalable_matrix_with_tiered_pricing_price.py b/src/orb/types/shared/new_floating_scalable_matrix_with_tiered_pricing_price.py index 8eaae8d0..6278f0b6 100644 --- a/src/orb/types/shared/new_floating_scalable_matrix_with_tiered_pricing_price.py +++ b/src/orb/types/shared/new_floating_scalable_matrix_with_tiered_pricing_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,47 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingScalableMatrixWithTieredPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingScalableMatrixWithTieredPricingPrice", + "ScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingConfigTier", + "ConversionRateConfig", +] + + +class ScalableMatrixWithTieredPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingConfig(BaseModel): + first_dimension: str + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: List[ScalableMatrixWithTieredPricingConfigMatrixScalingFactor] + """Apply a scaling factor to each dimension""" + + tiers: List[ScalableMatrixWithTieredPricingConfigTier] + """Tier pricing structure""" + + second_dimension: Optional[str] = None + """Used for the scalable matrix second dimension (optional)""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +70,13 @@ class NewFloatingScalableMatrixWithTieredPricingPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["scalable_matrix_with_tiered_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Dict[str, object] + scalable_matrix_with_tiered_pricing_config: ScalableMatrixWithTieredPricingConfig + """Configuration for scalable_matrix_with_tiered_pricing pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_scalable_matrix_with_unit_pricing_price.py b/src/orb/types/shared/new_floating_scalable_matrix_with_unit_pricing_price.py index 0f5fc4d0..37e6d755 100644 --- a/src/orb/types/shared/new_floating_scalable_matrix_with_unit_pricing_price.py +++ b/src/orb/types/shared/new_floating_scalable_matrix_with_unit_pricing_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,41 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingScalableMatrixWithUnitPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingScalableMatrixWithUnitPricingPrice", + "ScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingConfigMatrixScalingFactor", + "ConversionRateConfig", +] + + +class ScalableMatrixWithUnitPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingConfig(BaseModel): + first_dimension: str + """Used to determine the unit rate""" + + matrix_scaling_factors: List[ScalableMatrixWithUnitPricingConfigMatrixScalingFactor] + """Apply a scaling factor to each dimension""" + + unit_price: str + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] = None + """Used to determine the unit rate (optional)""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +64,13 @@ class NewFloatingScalableMatrixWithUnitPricingPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["scalable_matrix_with_unit_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Dict[str, object] + scalable_matrix_with_unit_pricing_config: ScalableMatrixWithUnitPricingConfig + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_threshold_total_amount_price.py b/src/orb/types/shared/new_floating_threshold_total_amount_price.py index 525addf2..66ed6c64 100644 --- a/src/orb/types/shared/new_floating_threshold_total_amount_price.py +++ b/src/orb/types/shared/new_floating_threshold_total_amount_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingThresholdTotalAmountPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingThresholdTotalAmountPrice", + "ThresholdTotalAmountConfig", + "ThresholdTotalAmountConfigConsumptionTable", + "ConversionRateConfig", +] + + +class ThresholdTotalAmountConfigConsumptionTable(BaseModel): + threshold: str + """Quantity threshold""" + + total_amount: str + """Total amount for this threshold""" + + +class ThresholdTotalAmountConfig(BaseModel): + consumption_table: List[ThresholdTotalAmountConfigConsumptionTable] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +55,13 @@ class NewFloatingThresholdTotalAmountPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["threshold_total_amount"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - threshold_total_amount_config: Dict[str, object] + threshold_total_amount_config: ThresholdTotalAmountConfig + """Configuration for threshold_total_amount pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_tiered_package_price.py b/src/orb/types/shared/new_floating_tiered_package_price.py index 4aae6693..2786b84c 100644 --- a/src/orb/types/shared/new_floating_tiered_package_price.py +++ b/src/orb/types/shared/new_floating_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredPackagePrice", "ConversionRateConfig"] +__all__ = ["NewFloatingTieredPackagePrice", "TieredPackageConfig", "TieredPackageConfigTier", "ConversionRateConfig"] + + +class TieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackageConfig(BaseModel): + package_size: str + """Package size""" + + tiers: List[TieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +50,13 @@ class NewFloatingTieredPackagePrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_package_config: Dict[str, object] + tiered_package_config: TieredPackageConfig + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_tiered_package_with_minimum_price.py b/src/orb/types/shared/new_floating_tiered_package_with_minimum_price.py index 7ddac55a..03412314 100644 --- a/src/orb/types/shared/new_floating_tiered_package_with_minimum_price.py +++ b/src/orb/types/shared/new_floating_tiered_package_with_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredPackageWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredPackageWithMinimumPrice", + "TieredPackageWithMinimumConfig", + "TieredPackageWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackageWithMinimumConfig(BaseModel): + package_size: float + """Package size""" + + tiers: List[TieredPackageWithMinimumConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +58,13 @@ class NewFloatingTieredPackageWithMinimumPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_package_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_package_with_minimum_config: Dict[str, object] + tiered_package_with_minimum_config: TieredPackageWithMinimumConfig + """Configuration for tiered_package_with_minimum pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_tiered_price.py b/src/orb/types/shared/new_floating_tiered_price.py index 02d75772..54b6d852 100644 --- a/src/orb/types/shared/new_floating_tiered_price.py +++ b/src/orb/types/shared/new_floating_tiered_price.py @@ -31,11 +31,13 @@ class NewFloatingTieredPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" tiered_config: TieredConfig + """Configuration for tiered pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_tiered_with_minimum_price.py b/src/orb/types/shared/new_floating_tiered_with_minimum_price.py index 21aae358..5be0fdb0 100644 --- a/src/orb/types/shared/new_floating_tiered_with_minimum_price.py +++ b/src/orb/types/shared/new_floating_tiered_with_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,38 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredWithMinimumPrice", + "TieredWithMinimumConfig", + "TieredWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class TieredWithMinimumConfig(BaseModel): + tiers: List[TieredWithMinimumConfigTier] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: Optional[bool] = None + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +61,13 @@ class NewFloatingTieredWithMinimumPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_with_minimum_config: Dict[str, object] + tiered_with_minimum_config: TieredWithMinimumConfig + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_tiered_with_proration_price.py b/src/orb/types/shared/new_floating_tiered_with_proration_price.py index 673f2eba..7122a96c 100644 --- a/src/orb/types/shared/new_floating_tiered_with_proration_price.py +++ b/src/orb/types/shared/new_floating_tiered_with_proration_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,29 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredWithProrationPrice", + "TieredWithProrationConfig", + "TieredWithProrationConfigTier", + "ConversionRateConfig", +] + + +class TieredWithProrationConfigTier(BaseModel): + tier_lower_bound: str + """Inclusive tier starting value""" + + unit_amount: str + """Amount per unit""" + + +class TieredWithProrationConfig(BaseModel): + tiers: List[TieredWithProrationConfigTier] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +52,13 @@ class NewFloatingTieredWithProrationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_with_proration_config: Dict[str, object] + tiered_with_proration_config: TieredWithProrationConfig + """Configuration for tiered_with_proration pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_unit_price.py b/src/orb/types/shared/new_floating_unit_price.py index 0fcbdc39..cbba5406 100644 --- a/src/orb/types/shared/new_floating_unit_price.py +++ b/src/orb/types/shared/new_floating_unit_price.py @@ -31,11 +31,13 @@ class NewFloatingUnitPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" unit_config: UnitConfig + """Configuration for unit pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_unit_with_percent_price.py b/src/orb/types/shared/new_floating_unit_with_percent_price.py index 6b8a9259..1d00c9c7 100644 --- a/src/orb/types/shared/new_floating_unit_with_percent_price.py +++ b/src/orb/types/shared/new_floating_unit_with_percent_price.py @@ -12,7 +12,16 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingUnitWithPercentPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingUnitWithPercentPrice", "UnitWithPercentConfig", "ConversionRateConfig"] + + +class UnitWithPercentConfig(BaseModel): + percent: str + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: str + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +39,13 @@ class NewFloatingUnitWithPercentPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit_with_percent"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - unit_with_percent_config: Dict[str, object] + unit_with_percent_config: UnitWithPercentConfig + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_floating_unit_with_proration_price.py b/src/orb/types/shared/new_floating_unit_with_proration_price.py index a23ef532..ced5474d 100644 --- a/src/orb/types/shared/new_floating_unit_with_proration_price.py +++ b/src/orb/types/shared/new_floating_unit_with_proration_price.py @@ -12,7 +12,13 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingUnitWithProrationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingUnitWithProrationPrice", "UnitWithProrationConfig", "ConversionRateConfig"] + + +class UnitWithProrationConfig(BaseModel): + unit_amount: str + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -30,11 +36,13 @@ class NewFloatingUnitWithProrationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - unit_with_proration_config: Dict[str, object] + unit_with_proration_config: UnitWithProrationConfig + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_bulk_price.py b/src/orb/types/shared/new_plan_bulk_price.py index 8a333ec5..8a3ffd71 100644 --- a/src/orb/types/shared/new_plan_bulk_price.py +++ b/src/orb/types/shared/new_plan_bulk_price.py @@ -22,6 +22,7 @@ class NewPlanBulkPrice(BaseModel): bulk_config: BulkConfig + """Configuration for bulk pricing""" cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" @@ -30,6 +31,7 @@ class NewPlanBulkPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_bulk_with_proration_price.py b/src/orb/types/shared/new_plan_bulk_with_proration_price.py index e87bf88a..67d53efa 100644 --- a/src/orb/types/shared/new_plan_bulk_with_proration_price.py +++ b/src/orb/types/shared/new_plan_bulk_with_proration_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,26 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanBulkWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanBulkWithProrationPrice", + "BulkWithProrationConfig", + "BulkWithProrationConfigTier", + "ConversionRateConfig", +] + + +class BulkWithProrationConfigTier(BaseModel): + unit_amount: str + """Cost per unit""" + + tier_lower_bound: Optional[str] = None + """The lower bound for this tier""" + + +class BulkWithProrationConfig(BaseModel): + tiers: List[BulkWithProrationConfigTier] + """Bulk tiers for rating based on total usage volume""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -20,7 +39,8 @@ class NewPlanBulkWithProrationPrice(BaseModel): - bulk_with_proration_config: Dict[str, object] + bulk_with_proration_config: BulkWithProrationConfig + """Configuration for bulk_with_proration pricing""" cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" @@ -29,6 +49,7 @@ class NewPlanBulkWithProrationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["bulk_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_cumulative_grouped_bulk_price.py b/src/orb/types/shared/new_plan_cumulative_grouped_bulk_price.py index e0956b53..0a0903f0 100644 --- a/src/orb/types/shared/new_plan_cumulative_grouped_bulk_price.py +++ b/src/orb/types/shared/new_plan_cumulative_grouped_bulk_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanCumulativeGroupedBulkPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanCumulativeGroupedBulkPrice", + "CumulativeGroupedBulkConfig", + "CumulativeGroupedBulkConfigDimensionValue", + "ConversionRateConfig", +] + + +class CumulativeGroupedBulkConfigDimensionValue(BaseModel): + grouping_key: str + """Grouping key value""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Unit amount for this combination""" + + +class CumulativeGroupedBulkConfig(BaseModel): + dimension_values: List[CumulativeGroupedBulkConfigDimensionValue] + """Each tier lower bound must have the same group of values.""" + + group: str + """Grouping key name""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +48,14 @@ class NewPlanCumulativeGroupedBulkPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Dict[str, object] + cumulative_grouped_bulk_config: CumulativeGroupedBulkConfig + """Configuration for cumulative_grouped_bulk pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["cumulative_grouped_bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_grouped_allocation_price.py b/src/orb/types/shared/new_plan_grouped_allocation_price.py index a48509af..9dab4cd9 100644 --- a/src/orb/types/shared/new_plan_grouped_allocation_price.py +++ b/src/orb/types/shared/new_plan_grouped_allocation_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedAllocationPrice", "GroupedAllocationConfig", "ConversionRateConfig"] + + +class GroupedAllocationConfig(BaseModel): + allocation: str + """Usage allocation per group""" + + grouping_key: str + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: str + """Unit rate for post-allocation""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +35,14 @@ class NewPlanGroupedAllocationPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - grouped_allocation_config: Dict[str, object] + grouped_allocation_config: GroupedAllocationConfig + """Configuration for grouped_allocation pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_grouped_tiered_package_price.py b/src/orb/types/shared/new_plan_grouped_tiered_package_price.py index 0d1cc760..73b62d2d 100644 --- a/src/orb/types/shared/new_plan_grouped_tiered_package_price.py +++ b/src/orb/types/shared/new_plan_grouped_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanGroupedTieredPackagePrice", + "GroupedTieredPackageConfig", + "GroupedTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class GroupedTieredPackageConfig(BaseModel): + grouping_key: str + """The event property used to group before tiering""" + + package_size: str + """Package size""" + + tiers: List[GroupedTieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +51,14 @@ class NewPlanGroupedTieredPackagePrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - grouped_tiered_package_config: Dict[str, object] + grouped_tiered_package_config: GroupedTieredPackageConfig + """Configuration for grouped_tiered_package pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_grouped_tiered_price.py b/src/orb/types/shared/new_plan_grouped_tiered_price.py index a2b42317..43d4be8d 100644 --- a/src/orb/types/shared/new_plan_grouped_tiered_price.py +++ b/src/orb/types/shared/new_plan_grouped_tiered_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedTieredPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedTieredPrice", "GroupedTieredConfig", "GroupedTieredConfigTier", "ConversionRateConfig"] + + +class GroupedTieredConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class GroupedTieredConfig(BaseModel): + grouping_key: str + """The billable metric property used to group before tiering""" + + tiers: List[GroupedTieredConfigTier] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +43,14 @@ class NewPlanGroupedTieredPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - grouped_tiered_config: Dict[str, object] + grouped_tiered_config: GroupedTieredConfig + """Configuration for grouped_tiered pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_grouped_with_metered_minimum_price.py b/src/orb/types/shared/new_plan_grouped_with_metered_minimum_price.py index 2fd66cbd..a668c08a 100644 --- a/src/orb/types/shared/new_plan_grouped_with_metered_minimum_price.py +++ b/src/orb/types/shared/new_plan_grouped_with_metered_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,56 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedWithMeteredMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanGroupedWithMeteredMinimumPrice", + "GroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumConfigUnitAmount", + "ConversionRateConfig", +] + + +class GroupedWithMeteredMinimumConfigScalingFactor(BaseModel): + scaling_factor: str + """Scaling factor""" + + scaling_value: str + """Scaling value""" + + +class GroupedWithMeteredMinimumConfigUnitAmount(BaseModel): + pricing_value: str + """Pricing value""" + + unit_amount: str + """Per unit amount""" + + +class GroupedWithMeteredMinimumConfig(BaseModel): + grouping_key: str + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: str + """The minimum amount to charge per group per unit""" + + pricing_key: str + """Used to determine the unit rate""" + + scaling_factors: List[GroupedWithMeteredMinimumConfigScalingFactor] + """Scale the unit rates by the scaling factor.""" + + scaling_key: str + """Used to determine the unit rate scaling factor""" + + unit_amounts: List[GroupedWithMeteredMinimumConfigUnitAmount] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +72,14 @@ class NewPlanGroupedWithMeteredMinimumPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - grouped_with_metered_minimum_config: Dict[str, object] + grouped_with_metered_minimum_config: GroupedWithMeteredMinimumConfig + """Configuration for grouped_with_metered_minimum pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_with_metered_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_grouped_with_prorated_minimum_price.py b/src/orb/types/shared/new_plan_grouped_with_prorated_minimum_price.py index e31fb822..8a241807 100644 --- a/src/orb/types/shared/new_plan_grouped_with_prorated_minimum_price.py +++ b/src/orb/types/shared/new_plan_grouped_with_prorated_minimum_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedWithProratedMinimumPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedWithProratedMinimumPrice", "GroupedWithProratedMinimumConfig", "ConversionRateConfig"] + + +class GroupedWithProratedMinimumConfig(BaseModel): + grouping_key: str + """How to determine the groups that should each have a minimum""" + + minimum: str + """The minimum amount to charge per group""" + + unit_rate: str + """The amount to charge per unit""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -23,12 +35,14 @@ class NewPlanGroupedWithProratedMinimumPrice(BaseModel): cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] """The cadence to bill for this price on.""" - grouped_with_prorated_minimum_config: Dict[str, object] + grouped_with_prorated_minimum_config: GroupedWithProratedMinimumConfig + """Configuration for grouped_with_prorated_minimum pricing""" item_id: str """The id of the item the price will be associated with.""" price_model_type: Literal["grouped_with_prorated_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_matrix_price.py b/src/orb/types/shared/new_plan_matrix_price.py index d377305d..5c7538e4 100644 --- a/src/orb/types/shared/new_plan_matrix_price.py +++ b/src/orb/types/shared/new_plan_matrix_price.py @@ -28,8 +28,10 @@ class NewPlanMatrixPrice(BaseModel): """The id of the item the price will be associated with.""" matrix_config: MatrixConfig + """Configuration for matrix pricing""" price_model_type: Literal["matrix"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_matrix_with_allocation_price.py b/src/orb/types/shared/new_plan_matrix_with_allocation_price.py index ef2ca887..07d73a12 100644 --- a/src/orb/types/shared/new_plan_matrix_with_allocation_price.py +++ b/src/orb/types/shared/new_plan_matrix_with_allocation_price.py @@ -28,8 +28,10 @@ class NewPlanMatrixWithAllocationPrice(BaseModel): """The id of the item the price will be associated with.""" matrix_with_allocation_config: MatrixWithAllocationConfig + """Configuration for matrix_with_allocation pricing""" price_model_type: Literal["matrix_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_matrix_with_display_name_price.py b/src/orb/types/shared/new_plan_matrix_with_display_name_price.py index f0e34144..53c1649f 100644 --- a/src/orb/types/shared/new_plan_matrix_with_display_name_price.py +++ b/src/orb/types/shared/new_plan_matrix_with_display_name_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanMatrixWithDisplayNamePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanMatrixWithDisplayNamePrice", + "MatrixWithDisplayNameConfig", + "MatrixWithDisplayNameConfigUnitAmount", + "ConversionRateConfig", +] + + +class MatrixWithDisplayNameConfigUnitAmount(BaseModel): + dimension_value: str + """The dimension value""" + + display_name: str + """Display name for this dimension value""" + + unit_amount: str + """Per unit amount""" + + +class MatrixWithDisplayNameConfig(BaseModel): + dimension: str + """Used to determine the unit rate""" + + unit_amounts: List[MatrixWithDisplayNameConfigUnitAmount] + """Apply per unit pricing to each dimension value""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,9 +51,11 @@ class NewPlanMatrixWithDisplayNamePrice(BaseModel): item_id: str """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Dict[str, object] + matrix_with_display_name_config: MatrixWithDisplayNameConfig + """Configuration for matrix_with_display_name pricing""" price_model_type: Literal["matrix_with_display_name"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_max_group_tiered_package_price.py b/src/orb/types/shared/new_plan_max_group_tiered_package_price.py index 8465b6ea..cf0ff3f9 100644 --- a/src/orb/types/shared/new_plan_max_group_tiered_package_price.py +++ b/src/orb/types/shared/new_plan_max_group_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,34 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanMaxGroupTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanMaxGroupTieredPackagePrice", + "MaxGroupTieredPackageConfig", + "MaxGroupTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class MaxGroupTieredPackageConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class MaxGroupTieredPackageConfig(BaseModel): + grouping_key: str + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: str + """Package size""" + + tiers: List[MaxGroupTieredPackageConfigTier] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -26,9 +53,11 @@ class NewPlanMaxGroupTieredPackagePrice(BaseModel): item_id: str """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Dict[str, object] + max_group_tiered_package_config: MaxGroupTieredPackageConfig + """Configuration for max_group_tiered_package pricing""" price_model_type: Literal["max_group_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_minimum_composite_price.py b/src/orb/types/shared/new_plan_minimum_composite_price.py index 52174359..7888c81c 100644 --- a/src/orb/types/shared/new_plan_minimum_composite_price.py +++ b/src/orb/types/shared/new_plan_minimum_composite_price.py @@ -20,10 +20,7 @@ class MinimumConfig(BaseModel): """The minimum amount to apply""" prorated: Optional[bool] = None - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + """If true, subtotals from this price are prorated based on the service period""" ConversionRateConfig: TypeAlias = Annotated[ @@ -39,8 +36,10 @@ class NewPlanMinimumCompositePrice(BaseModel): """The id of the item the price will be associated with.""" minimum_config: MinimumConfig + """Configuration for minimum pricing""" price_model_type: Literal["minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" diff --git a/src/orb/types/shared/new_plan_package_price.py b/src/orb/types/shared/new_plan_package_price.py index 8c4b92b1..a14a5c95 100644 --- a/src/orb/types/shared/new_plan_package_price.py +++ b/src/orb/types/shared/new_plan_package_price.py @@ -28,11 +28,13 @@ class NewPlanPackagePrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" package_config: PackageConfig + """Configuration for package pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_package_with_allocation_price.py b/src/orb/types/shared/new_plan_package_with_allocation_price.py index ee22d1fd..86fa1476 100644 --- a/src/orb/types/shared/new_plan_package_with_allocation_price.py +++ b/src/orb/types/shared/new_plan_package_with_allocation_price.py @@ -12,7 +12,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanPackageWithAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanPackageWithAllocationPrice", "PackageWithAllocationConfig", "ConversionRateConfig"] + + +class PackageWithAllocationConfig(BaseModel): + allocation: str + """Usage allocation""" + + package_amount: str + """Price per package""" + + package_size: str + """Package size""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +39,13 @@ class NewPlanPackageWithAllocationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["package_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - package_with_allocation_config: Dict[str, object] + package_with_allocation_config: PackageWithAllocationConfig + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_scalable_matrix_with_tiered_pricing_price.py b/src/orb/types/shared/new_plan_scalable_matrix_with_tiered_pricing_price.py index 5a346af7..69b0a537 100644 --- a/src/orb/types/shared/new_plan_scalable_matrix_with_tiered_pricing_price.py +++ b/src/orb/types/shared/new_plan_scalable_matrix_with_tiered_pricing_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,47 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanScalableMatrixWithTieredPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanScalableMatrixWithTieredPricingPrice", + "ScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingConfigTier", + "ConversionRateConfig", +] + + +class ScalableMatrixWithTieredPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingConfig(BaseModel): + first_dimension: str + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: List[ScalableMatrixWithTieredPricingConfigMatrixScalingFactor] + """Apply a scaling factor to each dimension""" + + tiers: List[ScalableMatrixWithTieredPricingConfigTier] + """Tier pricing structure""" + + second_dimension: Optional[str] = None + """Used for the scalable matrix second dimension (optional)""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +67,13 @@ class NewPlanScalableMatrixWithTieredPricingPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["scalable_matrix_with_tiered_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Dict[str, object] + scalable_matrix_with_tiered_pricing_config: ScalableMatrixWithTieredPricingConfig + """Configuration for scalable_matrix_with_tiered_pricing pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_scalable_matrix_with_unit_pricing_price.py b/src/orb/types/shared/new_plan_scalable_matrix_with_unit_pricing_price.py index 3320f626..91608c5d 100644 --- a/src/orb/types/shared/new_plan_scalable_matrix_with_unit_pricing_price.py +++ b/src/orb/types/shared/new_plan_scalable_matrix_with_unit_pricing_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,41 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanScalableMatrixWithUnitPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanScalableMatrixWithUnitPricingPrice", + "ScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingConfigMatrixScalingFactor", + "ConversionRateConfig", +] + + +class ScalableMatrixWithUnitPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingConfig(BaseModel): + first_dimension: str + """Used to determine the unit rate""" + + matrix_scaling_factors: List[ScalableMatrixWithUnitPricingConfigMatrixScalingFactor] + """Apply a scaling factor to each dimension""" + + unit_price: str + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] = None + """Used to determine the unit rate (optional)""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +61,13 @@ class NewPlanScalableMatrixWithUnitPricingPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["scalable_matrix_with_unit_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Dict[str, object] + scalable_matrix_with_unit_pricing_config: ScalableMatrixWithUnitPricingConfig + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_threshold_total_amount_price.py b/src/orb/types/shared/new_plan_threshold_total_amount_price.py index 2dcc1c28..d66b222c 100644 --- a/src/orb/types/shared/new_plan_threshold_total_amount_price.py +++ b/src/orb/types/shared/new_plan_threshold_total_amount_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanThresholdTotalAmountPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanThresholdTotalAmountPrice", + "ThresholdTotalAmountConfig", + "ThresholdTotalAmountConfigConsumptionTable", + "ConversionRateConfig", +] + + +class ThresholdTotalAmountConfigConsumptionTable(BaseModel): + threshold: str + """Quantity threshold""" + + total_amount: str + """Total amount for this threshold""" + + +class ThresholdTotalAmountConfig(BaseModel): + consumption_table: List[ThresholdTotalAmountConfigConsumptionTable] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +52,13 @@ class NewPlanThresholdTotalAmountPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["threshold_total_amount"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - threshold_total_amount_config: Dict[str, object] + threshold_total_amount_config: ThresholdTotalAmountConfig + """Configuration for threshold_total_amount pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_tier_with_proration_price.py b/src/orb/types/shared/new_plan_tier_with_proration_price.py deleted file mode 100644 index 143d66dc..00000000 --- a/src/orb/types/shared/new_plan_tier_with_proration_price.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from pydantic import Field as FieldInfo - -from ..._utils import PropertyInfo -from ..._models import BaseModel -from .unit_conversion_rate_config import UnitConversionRateConfig -from .tiered_conversion_rate_config import TieredConversionRateConfig -from .new_billing_cycle_configuration import NewBillingCycleConfiguration -from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration - -__all__ = ["NewPlanTierWithProrationPrice", "ConversionRateConfig"] - -ConversionRateConfig: TypeAlias = Annotated[ - Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") -] - - -class NewPlanTierWithProrationPrice(BaseModel): - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"] - """The cadence to bill for this price on.""" - - item_id: str - """The id of the item the price will be associated with.""" - - price_model_type: Literal["tiered_with_proration"] = FieldInfo(alias="model_type") - - name: str - """The name of the price.""" - - tiered_with_proration_config: Dict[str, object] - - billable_metric_id: Optional[str] = None - """The id of the billable metric for the price. - - Only needed if the price is usage-based. - """ - - billed_in_advance: Optional[bool] = None - """ - If the Price represents a fixed cost, the price will be billed in-advance if - this is true, and in-arrears if this is false. - """ - - billing_cycle_configuration: Optional[NewBillingCycleConfiguration] = None - """ - For custom cadence: specifies the duration of the billing period in days or - months. - """ - - conversion_rate: Optional[float] = None - """The per unit conversion rate of the price currency to the invoicing currency.""" - - conversion_rate_config: Optional[ConversionRateConfig] = None - """The configuration for the rate of the price currency to the invoicing currency.""" - - currency: Optional[str] = None - """ - An ISO 4217 currency string, or custom pricing unit identifier, in which this - price is billed. - """ - - dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] = None - """For dimensional price: specifies a price group and dimension values""" - - external_price_id: Optional[str] = None - """An alias for the price.""" - - fixed_price_quantity: Optional[float] = None - """ - If the Price represents a fixed cost, this represents the quantity of units - applied. - """ - - invoice_grouping_key: Optional[str] = None - """The property used to group this price on an invoice""" - - invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] = None - """Within each billing cycle, specifies the cadence at which invoices are produced. - - If unspecified, a single invoice is produced per billing cycle. - """ - - metadata: Optional[Dict[str, Optional[str]]] = None - """User-specified key/value pairs for the resource. - - Individual keys can be removed by setting the value to `null`, and the entire - metadata mapping can be cleared by setting `metadata` to `null`. - """ - - reference_id: Optional[str] = None - """ - A transient ID that can be used to reference this price when adding adjustments - in the same API call. - """ diff --git a/src/orb/types/shared/new_plan_tiered_package_price.py b/src/orb/types/shared/new_plan_tiered_package_price.py index 342c4ae4..cc652ad3 100644 --- a/src/orb/types/shared/new_plan_tiered_package_price.py +++ b/src/orb/types/shared/new_plan_tiered_package_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredPackagePrice", "ConversionRateConfig"] +__all__ = ["NewPlanTieredPackagePrice", "TieredPackageConfig", "TieredPackageConfigTier", "ConversionRateConfig"] + + +class TieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackageConfig(BaseModel): + package_size: str + """Package size""" + + tiers: List[TieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +47,13 @@ class NewPlanTieredPackagePrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_package_config: Dict[str, object] + tiered_package_config: TieredPackageConfig + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_tiered_package_with_minimum_price.py b/src/orb/types/shared/new_plan_tiered_package_with_minimum_price.py index 745b22f7..1f063109 100644 --- a/src/orb/types/shared/new_plan_tiered_package_with_minimum_price.py +++ b/src/orb/types/shared/new_plan_tiered_package_with_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredPackageWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanTieredPackageWithMinimumPrice", + "TieredPackageWithMinimumConfig", + "TieredPackageWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackageWithMinimumConfig(BaseModel): + package_size: float + """Package size""" + + tiers: List[TieredPackageWithMinimumConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +55,13 @@ class NewPlanTieredPackageWithMinimumPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_package_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_package_with_minimum_config: Dict[str, object] + tiered_package_with_minimum_config: TieredPackageWithMinimumConfig + """Configuration for tiered_package_with_minimum pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_tiered_price.py b/src/orb/types/shared/new_plan_tiered_price.py index c163c9dc..0923106e 100644 --- a/src/orb/types/shared/new_plan_tiered_price.py +++ b/src/orb/types/shared/new_plan_tiered_price.py @@ -28,11 +28,13 @@ class NewPlanTieredPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" tiered_config: TieredConfig + """Configuration for tiered pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_tiered_with_minimum_price.py b/src/orb/types/shared/new_plan_tiered_with_minimum_price.py index 3fa1db28..36bafb4a 100644 --- a/src/orb/types/shared/new_plan_tiered_with_minimum_price.py +++ b/src/orb/types/shared/new_plan_tiered_with_minimum_price.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional +from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from pydantic import Field as FieldInfo @@ -12,7 +12,38 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanTieredWithMinimumPrice", + "TieredWithMinimumConfig", + "TieredWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class TieredWithMinimumConfig(BaseModel): + tiers: List[TieredWithMinimumConfigTier] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: Optional[bool] = None + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +58,13 @@ class NewPlanTieredWithMinimumPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["tiered_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - tiered_with_minimum_config: Dict[str, object] + tiered_with_minimum_config: TieredWithMinimumConfig + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_unit_price.py b/src/orb/types/shared/new_plan_unit_price.py index 12bf5759..32f8d781 100644 --- a/src/orb/types/shared/new_plan_unit_price.py +++ b/src/orb/types/shared/new_plan_unit_price.py @@ -28,11 +28,13 @@ class NewPlanUnitPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" unit_config: UnitConfig + """Configuration for unit pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_unit_with_percent_price.py b/src/orb/types/shared/new_plan_unit_with_percent_price.py index 1a433372..b7f2fcb9 100644 --- a/src/orb/types/shared/new_plan_unit_with_percent_price.py +++ b/src/orb/types/shared/new_plan_unit_with_percent_price.py @@ -12,7 +12,16 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanUnitWithPercentPrice", "ConversionRateConfig"] +__all__ = ["NewPlanUnitWithPercentPrice", "UnitWithPercentConfig", "ConversionRateConfig"] + + +class UnitWithPercentConfig(BaseModel): + percent: str + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: str + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +36,13 @@ class NewPlanUnitWithPercentPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit_with_percent"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - unit_with_percent_config: Dict[str, object] + unit_with_percent_config: UnitWithPercentConfig + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/new_plan_unit_with_proration_price.py b/src/orb/types/shared/new_plan_unit_with_proration_price.py index 909e8229..dadd7917 100644 --- a/src/orb/types/shared/new_plan_unit_with_proration_price.py +++ b/src/orb/types/shared/new_plan_unit_with_proration_price.py @@ -12,7 +12,13 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanUnitWithProrationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanUnitWithProrationPrice", "UnitWithProrationConfig", "ConversionRateConfig"] + + +class UnitWithProrationConfig(BaseModel): + unit_amount: str + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") @@ -27,11 +33,13 @@ class NewPlanUnitWithProrationPrice(BaseModel): """The id of the item the price will be associated with.""" price_model_type: Literal["unit_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str """The name of the price.""" - unit_with_proration_config: Dict[str, object] + unit_with_proration_config: UnitWithProrationConfig + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] = None """The id of the billable metric for the price. diff --git a/src/orb/types/shared/price.py b/src/orb/types/shared/price.py index 2beebf9a..add25613 100644 --- a/src/orb/types/shared/price.py +++ b/src/orb/types/shared/price.py @@ -30,56 +30,92 @@ "Price", "UnitPrice", "UnitPriceConversionRateConfig", - "PackagePrice", - "PackagePriceConversionRateConfig", - "MatrixPrice", - "MatrixPriceConversionRateConfig", "TieredPrice", "TieredPriceConversionRateConfig", "BulkPrice", "BulkPriceConversionRateConfig", + "PackagePrice", + "PackagePriceConversionRateConfig", + "MatrixPrice", + "MatrixPriceConversionRateConfig", "ThresholdTotalAmountPrice", "ThresholdTotalAmountPriceConversionRateConfig", + "ThresholdTotalAmountPriceThresholdTotalAmountConfig", + "ThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable", "TieredPackagePrice", "TieredPackagePriceConversionRateConfig", - "GroupedTieredPrice", - "GroupedTieredPriceConversionRateConfig", + "TieredPackagePriceTieredPackageConfig", + "TieredPackagePriceTieredPackageConfigTier", "TieredWithMinimumPrice", "TieredWithMinimumPriceConversionRateConfig", + "TieredWithMinimumPriceTieredWithMinimumConfig", + "TieredWithMinimumPriceTieredWithMinimumConfigTier", + "GroupedTieredPrice", + "GroupedTieredPriceConversionRateConfig", + "GroupedTieredPriceGroupedTieredConfig", + "GroupedTieredPriceGroupedTieredConfigTier", "TieredPackageWithMinimumPrice", "TieredPackageWithMinimumPriceConversionRateConfig", + "TieredPackageWithMinimumPriceTieredPackageWithMinimumConfig", + "TieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier", "PackageWithAllocationPrice", "PackageWithAllocationPriceConversionRateConfig", + "PackageWithAllocationPricePackageWithAllocationConfig", "UnitWithPercentPrice", "UnitWithPercentPriceConversionRateConfig", + "UnitWithPercentPriceUnitWithPercentConfig", "MatrixWithAllocationPrice", "MatrixWithAllocationPriceConversionRateConfig", "TieredWithProrationPrice", "TieredWithProrationPriceConversionRateConfig", + "TieredWithProrationPriceTieredWithProrationConfig", + "TieredWithProrationPriceTieredWithProrationConfigTier", "UnitWithProrationPrice", "UnitWithProrationPriceConversionRateConfig", + "UnitWithProrationPriceUnitWithProrationConfig", "GroupedAllocationPrice", "GroupedAllocationPriceConversionRateConfig", + "GroupedAllocationPriceGroupedAllocationConfig", + "BulkWithProrationPrice", + "BulkWithProrationPriceBulkWithProrationConfig", + "BulkWithProrationPriceBulkWithProrationConfigTier", + "BulkWithProrationPriceConversionRateConfig", "GroupedWithProratedMinimumPrice", "GroupedWithProratedMinimumPriceConversionRateConfig", + "GroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig", "GroupedWithMeteredMinimumPrice", "GroupedWithMeteredMinimumPriceConversionRateConfig", + "GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount", + "GroupedWithMinMaxThresholdsPrice", + "GroupedWithMinMaxThresholdsPriceConversionRateConfig", + "GroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "MatrixWithDisplayNamePrice", "MatrixWithDisplayNamePriceConversionRateConfig", - "BulkWithProrationPrice", - "BulkWithProrationPriceConversionRateConfig", + "MatrixWithDisplayNamePriceMatrixWithDisplayNameConfig", + "MatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount", "GroupedTieredPackagePrice", "GroupedTieredPackagePriceConversionRateConfig", + "GroupedTieredPackagePriceGroupedTieredPackageConfig", + "GroupedTieredPackagePriceGroupedTieredPackageConfigTier", "MaxGroupTieredPackagePrice", "MaxGroupTieredPackagePriceConversionRateConfig", + "MaxGroupTieredPackagePriceMaxGroupTieredPackageConfig", + "MaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier", "ScalableMatrixWithUnitPricingPrice", "ScalableMatrixWithUnitPricingPriceConversionRateConfig", + "ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor", "ScalableMatrixWithTieredPricingPrice", "ScalableMatrixWithTieredPricingPriceConversionRateConfig", + "ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier", "CumulativeGroupedBulkPrice", "CumulativeGroupedBulkPriceConversionRateConfig", - "GroupedWithMinMaxThresholdsPrice", - "GroupedWithMinMaxThresholdsPriceConversionRateConfig", + "CumulativeGroupedBulkPriceCumulativeGroupedBulkConfig", + "CumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue", "MinimumCompositePrice", "MinimumCompositePriceConversionRateConfig", "MinimumCompositePriceMinimumConfig", @@ -138,6 +174,7 @@ class UnitPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["unit"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -152,16 +189,17 @@ class UnitPrice(BaseModel): """ unit_config: UnitConfig + """Configuration for unit pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -PackagePriceConversionRateConfig: TypeAlias = Annotated[ +TieredPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class PackagePrice(BaseModel): +class TieredPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -174,7 +212,7 @@ class PackagePrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[PackagePriceConversionRateConfig] = None + conversion_rate_config: Optional[TieredPriceConversionRateConfig] = None created_at: datetime @@ -208,12 +246,11 @@ class PackagePrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["package"] = FieldInfo(alias="model_type") + price_model_type: Literal["tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str - package_config: PackageConfig - plan_phase_order: Optional[int] = None price_type: Literal["usage_price", "fixed_price"] @@ -224,28 +261,34 @@ class PackagePrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ + tiered_config: TieredConfig + """Configuration for tiered pricing""" + dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -MatrixPriceConversionRateConfig: TypeAlias = Annotated[ +BulkPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class MatrixPrice(BaseModel): +class BulkPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None billing_cycle_configuration: BillingCycleConfiguration + bulk_config: BulkConfig + """Configuration for bulk pricing""" + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] composite_price_filters: Optional[List[TransformPriceFilter]] = None conversion_rate: Optional[float] = None - conversion_rate_config: Optional[MatrixPriceConversionRateConfig] = None + conversion_rate_config: Optional[BulkPriceConversionRateConfig] = None created_at: datetime @@ -263,8 +306,6 @@ class MatrixPrice(BaseModel): item: ItemSlim - matrix_config: MatrixConfig - maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -281,7 +322,8 @@ class MatrixPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["matrix"] = FieldInfo(alias="model_type") + price_model_type: Literal["bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -298,12 +340,12 @@ class MatrixPrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -TieredPriceConversionRateConfig: TypeAlias = Annotated[ +PackagePriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class TieredPrice(BaseModel): +class PackagePrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -316,7 +358,7 @@ class TieredPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[TieredPriceConversionRateConfig] = None + conversion_rate_config: Optional[PackagePriceConversionRateConfig] = None created_at: datetime @@ -350,10 +392,14 @@ class TieredPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["tiered"] = FieldInfo(alias="model_type") + price_model_type: Literal["package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str + package_config: PackageConfig + """Configuration for package pricing""" + plan_phase_order: Optional[int] = None price_type: Literal["usage_price", "fixed_price"] @@ -364,32 +410,28 @@ class TieredPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - tiered_config: TieredConfig - dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -BulkPriceConversionRateConfig: TypeAlias = Annotated[ +MatrixPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class BulkPrice(BaseModel): +class MatrixPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None billing_cycle_configuration: BillingCycleConfiguration - bulk_config: BulkConfig - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] composite_price_filters: Optional[List[TransformPriceFilter]] = None conversion_rate: Optional[float] = None - conversion_rate_config: Optional[BulkPriceConversionRateConfig] = None + conversion_rate_config: Optional[MatrixPriceConversionRateConfig] = None created_at: datetime @@ -407,6 +449,9 @@ class BulkPrice(BaseModel): item: ItemSlim + matrix_config: MatrixConfig + """Configuration for matrix pricing""" + maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -423,7 +468,8 @@ class BulkPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["bulk"] = FieldInfo(alias="model_type") + price_model_type: Literal["matrix"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -445,6 +491,25 @@ class BulkPrice(BaseModel): ] +class ThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable(BaseModel): + threshold: str + """Quantity threshold""" + + total_amount: str + """Total amount for this threshold""" + + +class ThresholdTotalAmountPriceThresholdTotalAmountConfig(BaseModel): + consumption_table: List[ThresholdTotalAmountPriceThresholdTotalAmountConfigConsumptionTable] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + + class ThresholdTotalAmountPrice(BaseModel): id: str @@ -493,6 +558,7 @@ class ThresholdTotalAmountPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["threshold_total_amount"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -506,7 +572,8 @@ class ThresholdTotalAmountPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - threshold_total_amount_config: Dict[str, object] + threshold_total_amount_config: ThresholdTotalAmountPriceThresholdTotalAmountConfig + """Configuration for threshold_total_amount pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -516,6 +583,25 @@ class ThresholdTotalAmountPrice(BaseModel): ] +class TieredPackagePriceTieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackagePriceTieredPackageConfig(BaseModel): + package_size: str + """Package size""" + + tiers: List[TieredPackagePriceTieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + class TieredPackagePrice(BaseModel): id: str @@ -564,6 +650,7 @@ class TieredPackagePrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -577,17 +664,43 @@ class TieredPackagePrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - tiered_package_config: Dict[str, object] + tiered_package_config: TieredPackagePriceTieredPackageConfig + """Configuration for tiered_package pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -GroupedTieredPriceConversionRateConfig: TypeAlias = Annotated[ +TieredWithMinimumPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class GroupedTieredPrice(BaseModel): +class TieredWithMinimumPriceTieredWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class TieredWithMinimumPriceTieredWithMinimumConfig(BaseModel): + tiers: List[TieredWithMinimumPriceTieredWithMinimumConfigTier] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: Optional[bool] = None + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + + +class TieredWithMinimumPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -600,7 +713,7 @@ class GroupedTieredPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[GroupedTieredPriceConversionRateConfig] = None + conversion_rate_config: Optional[TieredWithMinimumPriceConversionRateConfig] = None created_at: datetime @@ -614,8 +727,6 @@ class GroupedTieredPrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_tiered_config: Dict[str, object] - invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim @@ -636,7 +747,8 @@ class GroupedTieredPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["grouped_tiered"] = FieldInfo(alias="model_type") + price_model_type: Literal["tiered_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -650,15 +762,37 @@ class GroupedTieredPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ + tiered_with_minimum_config: TieredWithMinimumPriceTieredWithMinimumConfig + """Configuration for tiered_with_minimum pricing""" + dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -TieredWithMinimumPriceConversionRateConfig: TypeAlias = Annotated[ +GroupedTieredPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class TieredWithMinimumPrice(BaseModel): +class GroupedTieredPriceGroupedTieredConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class GroupedTieredPriceGroupedTieredConfig(BaseModel): + grouping_key: str + """The billable metric property used to group before tiering""" + + tiers: List[GroupedTieredPriceGroupedTieredConfigTier] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + + +class GroupedTieredPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -671,7 +805,7 @@ class TieredWithMinimumPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[TieredWithMinimumPriceConversionRateConfig] = None + conversion_rate_config: Optional[GroupedTieredPriceConversionRateConfig] = None created_at: datetime @@ -685,6 +819,9 @@ class TieredWithMinimumPrice(BaseModel): fixed_price_quantity: Optional[float] = None + grouped_tiered_config: GroupedTieredPriceGroupedTieredConfig + """Configuration for grouped_tiered pricing""" + invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim @@ -705,7 +842,8 @@ class TieredWithMinimumPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["tiered_with_minimum"] = FieldInfo(alias="model_type") + price_model_type: Literal["grouped_tiered"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -719,8 +857,6 @@ class TieredWithMinimumPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - tiered_with_minimum_config: Dict[str, object] - dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -729,6 +865,28 @@ class TieredWithMinimumPrice(BaseModel): ] +class TieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier(BaseModel): + minimum_amount: str + """Minimum amount""" + + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class TieredPackageWithMinimumPriceTieredPackageWithMinimumConfig(BaseModel): + package_size: float + """Package size""" + + tiers: List[TieredPackageWithMinimumPriceTieredPackageWithMinimumConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + class TieredPackageWithMinimumPrice(BaseModel): id: str @@ -777,6 +935,7 @@ class TieredPackageWithMinimumPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["tiered_package_with_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -790,7 +949,8 @@ class TieredPackageWithMinimumPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - tiered_package_with_minimum_config: Dict[str, object] + tiered_package_with_minimum_config: TieredPackageWithMinimumPriceTieredPackageWithMinimumConfig + """Configuration for tiered_package_with_minimum pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -800,6 +960,17 @@ class TieredPackageWithMinimumPrice(BaseModel): ] +class PackageWithAllocationPricePackageWithAllocationConfig(BaseModel): + allocation: str + """Usage allocation""" + + package_amount: str + """Price per package""" + + package_size: str + """Package size""" + + class PackageWithAllocationPrice(BaseModel): id: str @@ -848,10 +1019,12 @@ class PackageWithAllocationPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["package_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str - package_with_allocation_config: Dict[str, object] + package_with_allocation_config: PackageWithAllocationPricePackageWithAllocationConfig + """Configuration for package_with_allocation pricing""" plan_phase_order: Optional[int] = None @@ -871,6 +1044,14 @@ class PackageWithAllocationPrice(BaseModel): ] +class UnitWithPercentPriceUnitWithPercentConfig(BaseModel): + percent: str + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: str + """Rate per unit of usage""" + + class UnitWithPercentPrice(BaseModel): id: str @@ -919,6 +1100,7 @@ class UnitWithPercentPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["unit_with_percent"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -932,7 +1114,8 @@ class UnitWithPercentPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - unit_with_percent_config: Dict[str, object] + unit_with_percent_config: UnitWithPercentPriceUnitWithPercentConfig + """Configuration for unit_with_percent pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -974,6 +1157,7 @@ class MatrixWithAllocationPrice(BaseModel): item: ItemSlim matrix_with_allocation_config: MatrixWithAllocationConfig + """Configuration for matrix_with_allocation pricing""" maximum: Optional[Maximum] = None @@ -992,6 +1176,7 @@ class MatrixWithAllocationPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["matrix_with_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1013,6 +1198,22 @@ class MatrixWithAllocationPrice(BaseModel): ] +class TieredWithProrationPriceTieredWithProrationConfigTier(BaseModel): + tier_lower_bound: str + """Inclusive tier starting value""" + + unit_amount: str + """Amount per unit""" + + +class TieredWithProrationPriceTieredWithProrationConfig(BaseModel): + tiers: List[TieredWithProrationPriceTieredWithProrationConfigTier] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + class TieredWithProrationPrice(BaseModel): id: str @@ -1061,6 +1262,7 @@ class TieredWithProrationPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["tiered_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1074,7 +1276,8 @@ class TieredWithProrationPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - tiered_with_proration_config: Dict[str, object] + tiered_with_proration_config: TieredWithProrationPriceTieredWithProrationConfig + """Configuration for tiered_with_proration pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -1084,6 +1287,11 @@ class TieredWithProrationPrice(BaseModel): ] +class UnitWithProrationPriceUnitWithProrationConfig(BaseModel): + unit_amount: str + """Rate per unit of usage""" + + class UnitWithProrationPrice(BaseModel): id: str @@ -1132,6 +1340,7 @@ class UnitWithProrationPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["unit_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1145,7 +1354,8 @@ class UnitWithProrationPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - unit_with_proration_config: Dict[str, object] + unit_with_proration_config: UnitWithProrationPriceUnitWithProrationConfig + """Configuration for unit_with_proration pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None @@ -1155,6 +1365,17 @@ class UnitWithProrationPrice(BaseModel): ] +class GroupedAllocationPriceGroupedAllocationConfig(BaseModel): + allocation: str + """Usage allocation per group""" + + grouping_key: str + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: str + """Unit rate for post-allocation""" + + class GroupedAllocationPrice(BaseModel): id: str @@ -1182,7 +1403,8 @@ class GroupedAllocationPrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_allocation_config: Dict[str, object] + grouped_allocation_config: GroupedAllocationPriceGroupedAllocationConfig + """Configuration for grouped_allocation pricing""" invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None @@ -1205,6 +1427,7 @@ class GroupedAllocationPrice(BaseModel): minimum_amount: Optional[str] = None price_model_type: Literal["grouped_allocation"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1221,25 +1444,41 @@ class GroupedAllocationPrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -GroupedWithProratedMinimumPriceConversionRateConfig: TypeAlias = Annotated[ +class BulkWithProrationPriceBulkWithProrationConfigTier(BaseModel): + unit_amount: str + """Cost per unit""" + + tier_lower_bound: Optional[str] = None + """The lower bound for this tier""" + + +class BulkWithProrationPriceBulkWithProrationConfig(BaseModel): + tiers: List[BulkWithProrationPriceBulkWithProrationConfigTier] + """Bulk tiers for rating based on total usage volume""" + + +BulkWithProrationPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class GroupedWithProratedMinimumPrice(BaseModel): +class BulkWithProrationPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None billing_cycle_configuration: BillingCycleConfiguration + bulk_with_proration_config: BulkWithProrationPriceBulkWithProrationConfig + """Configuration for bulk_with_proration pricing""" + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] composite_price_filters: Optional[List[TransformPriceFilter]] = None conversion_rate: Optional[float] = None - conversion_rate_config: Optional[GroupedWithProratedMinimumPriceConversionRateConfig] = None + conversion_rate_config: Optional[BulkWithProrationPriceConversionRateConfig] = None created_at: datetime @@ -1253,8 +1492,6 @@ class GroupedWithProratedMinimumPrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_with_prorated_minimum_config: Dict[str, object] - invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim @@ -1275,7 +1512,8 @@ class GroupedWithProratedMinimumPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["grouped_with_prorated_minimum"] = FieldInfo(alias="model_type") + price_model_type: Literal["bulk_with_proration"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1292,12 +1530,23 @@ class GroupedWithProratedMinimumPrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -GroupedWithMeteredMinimumPriceConversionRateConfig: TypeAlias = Annotated[ +GroupedWithProratedMinimumPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class GroupedWithMeteredMinimumPrice(BaseModel): +class GroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig(BaseModel): + grouping_key: str + """How to determine the groups that should each have a minimum""" + + minimum: str + """The minimum amount to charge per group""" + + unit_rate: str + """The amount to charge per unit""" + + +class GroupedWithProratedMinimumPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1310,7 +1559,7 @@ class GroupedWithMeteredMinimumPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[GroupedWithMeteredMinimumPriceConversionRateConfig] = None + conversion_rate_config: Optional[GroupedWithProratedMinimumPriceConversionRateConfig] = None created_at: datetime @@ -1324,7 +1573,8 @@ class GroupedWithMeteredMinimumPrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_with_metered_minimum_config: Dict[str, object] + grouped_with_prorated_minimum_config: GroupedWithProratedMinimumPriceGroupedWithProratedMinimumConfig + """Configuration for grouped_with_prorated_minimum pricing""" invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None @@ -1346,7 +1596,8 @@ class GroupedWithMeteredMinimumPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["grouped_with_metered_minimum"] = FieldInfo(alias="model_type") + price_model_type: Literal["grouped_with_prorated_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1363,12 +1614,54 @@ class GroupedWithMeteredMinimumPrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -MatrixWithDisplayNamePriceConversionRateConfig: TypeAlias = Annotated[ +GroupedWithMeteredMinimumPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class MatrixWithDisplayNamePrice(BaseModel): +class GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor(BaseModel): + scaling_factor: str + """Scaling factor""" + + scaling_value: str + """Scaling value""" + + +class GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount(BaseModel): + pricing_value: str + """Pricing value""" + + unit_amount: str + """Per unit amount""" + + +class GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig(BaseModel): + grouping_key: str + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: str + """The minimum amount to charge per group per unit""" + + pricing_key: str + """Used to determine the unit rate""" + + scaling_factors: List[GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigScalingFactor] + """Scale the unit rates by the scaling factor.""" + + scaling_key: str + """Used to determine the unit rate scaling factor""" + + unit_amounts: List[GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfigUnitAmount] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + + +class GroupedWithMeteredMinimumPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1381,7 +1674,7 @@ class MatrixWithDisplayNamePrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[MatrixWithDisplayNamePriceConversionRateConfig] = None + conversion_rate_config: Optional[GroupedWithMeteredMinimumPriceConversionRateConfig] = None created_at: datetime @@ -1395,12 +1688,13 @@ class MatrixWithDisplayNamePrice(BaseModel): fixed_price_quantity: Optional[float] = None + grouped_with_metered_minimum_config: GroupedWithMeteredMinimumPriceGroupedWithMeteredMinimumConfig + """Configuration for grouped_with_metered_minimum pricing""" + invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim - matrix_with_display_name_config: Dict[str, object] - maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -1417,7 +1711,8 @@ class MatrixWithDisplayNamePrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["matrix_with_display_name"] = FieldInfo(alias="model_type") + price_model_type: Literal["grouped_with_metered_minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1434,27 +1729,39 @@ class MatrixWithDisplayNamePrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -BulkWithProrationPriceConversionRateConfig: TypeAlias = Annotated[ +GroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class BulkWithProrationPrice(BaseModel): +class GroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(BaseModel): + grouping_key: str + """The event property used to group before applying thresholds""" + + maximum_charge: str + """The maximum amount to charge each group""" + + minimum_charge: str + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: str + """The base price charged per group""" + + +class GroupedWithMinMaxThresholdsPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None billing_cycle_configuration: BillingCycleConfiguration - bulk_with_proration_config: Dict[str, object] - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] composite_price_filters: Optional[List[TransformPriceFilter]] = None conversion_rate: Optional[float] = None - conversion_rate_config: Optional[BulkWithProrationPriceConversionRateConfig] = None + conversion_rate_config: Optional[GroupedWithMinMaxThresholdsPriceConversionRateConfig] = None created_at: datetime @@ -1468,6 +1775,9 @@ class BulkWithProrationPrice(BaseModel): fixed_price_quantity: Optional[float] = None + grouped_with_min_max_thresholds_config: GroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + """Configuration for grouped_with_min_max_thresholds pricing""" + invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim @@ -1488,7 +1798,8 @@ class BulkWithProrationPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["bulk_with_proration"] = FieldInfo(alias="model_type") + price_model_type: Literal["grouped_with_min_max_thresholds"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1505,12 +1816,31 @@ class BulkWithProrationPrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -GroupedTieredPackagePriceConversionRateConfig: TypeAlias = Annotated[ +MatrixWithDisplayNamePriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class GroupedTieredPackagePrice(BaseModel): +class MatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount(BaseModel): + dimension_value: str + """The dimension value""" + + display_name: str + """Display name for this dimension value""" + + unit_amount: str + """Per unit amount""" + + +class MatrixWithDisplayNamePriceMatrixWithDisplayNameConfig(BaseModel): + dimension: str + """Used to determine the unit rate""" + + unit_amounts: List[MatrixWithDisplayNamePriceMatrixWithDisplayNameConfigUnitAmount] + """Apply per unit pricing to each dimension value""" + + +class MatrixWithDisplayNamePrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1523,7 +1853,7 @@ class GroupedTieredPackagePrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[GroupedTieredPackagePriceConversionRateConfig] = None + conversion_rate_config: Optional[MatrixWithDisplayNamePriceConversionRateConfig] = None created_at: datetime @@ -1537,12 +1867,13 @@ class GroupedTieredPackagePrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_tiered_package_config: Dict[str, object] - invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim + matrix_with_display_name_config: MatrixWithDisplayNamePriceMatrixWithDisplayNameConfig + """Configuration for matrix_with_display_name pricing""" + maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -1559,7 +1890,8 @@ class GroupedTieredPackagePrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["grouped_tiered_package"] = FieldInfo(alias="model_type") + price_model_type: Literal["matrix_with_display_name"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1576,12 +1908,34 @@ class GroupedTieredPackagePrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -MaxGroupTieredPackagePriceConversionRateConfig: TypeAlias = Annotated[ +GroupedTieredPackagePriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class MaxGroupTieredPackagePrice(BaseModel): +class GroupedTieredPackagePriceGroupedTieredPackageConfigTier(BaseModel): + per_unit: str + """Price per package""" + + tier_lower_bound: str + """Tier lower bound""" + + +class GroupedTieredPackagePriceGroupedTieredPackageConfig(BaseModel): + grouping_key: str + """The event property used to group before tiering""" + + package_size: str + """Package size""" + + tiers: List[GroupedTieredPackagePriceGroupedTieredPackageConfigTier] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + + +class GroupedTieredPackagePrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1594,7 +1948,7 @@ class MaxGroupTieredPackagePrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[MaxGroupTieredPackagePriceConversionRateConfig] = None + conversion_rate_config: Optional[GroupedTieredPackagePriceConversionRateConfig] = None created_at: datetime @@ -1608,12 +1962,13 @@ class MaxGroupTieredPackagePrice(BaseModel): fixed_price_quantity: Optional[float] = None + grouped_tiered_package_config: GroupedTieredPackagePriceGroupedTieredPackageConfig + """Configuration for grouped_tiered_package pricing""" + invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim - max_group_tiered_package_config: Dict[str, object] - maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -1630,7 +1985,8 @@ class MaxGroupTieredPackagePrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["max_group_tiered_package"] = FieldInfo(alias="model_type") + price_model_type: Literal["grouped_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1647,12 +2003,33 @@ class MaxGroupTieredPackagePrice(BaseModel): dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -ScalableMatrixWithUnitPricingPriceConversionRateConfig: TypeAlias = Annotated[ +MaxGroupTieredPackagePriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class ScalableMatrixWithUnitPricingPrice(BaseModel): +class MaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class MaxGroupTieredPackagePriceMaxGroupTieredPackageConfig(BaseModel): + grouping_key: str + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: str + """Package size""" + + tiers: List[MaxGroupTieredPackagePriceMaxGroupTieredPackageConfigTier] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + + +class MaxGroupTieredPackagePrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1665,7 +2042,7 @@ class ScalableMatrixWithUnitPricingPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[ScalableMatrixWithUnitPricingPriceConversionRateConfig] = None + conversion_rate_config: Optional[MaxGroupTieredPackagePriceConversionRateConfig] = None created_at: datetime @@ -1683,6 +2060,9 @@ class ScalableMatrixWithUnitPricingPrice(BaseModel): item: ItemSlim + max_group_tiered_package_config: MaxGroupTieredPackagePriceMaxGroupTieredPackageConfig + """Configuration for max_group_tiered_package pricing""" + maximum: Optional[Maximum] = None maximum_amount: Optional[str] = None @@ -1699,7 +2079,8 @@ class ScalableMatrixWithUnitPricingPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["scalable_matrix_with_unit_pricing"] = FieldInfo(alias="model_type") + price_model_type: Literal["max_group_tiered_package"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1713,17 +2094,45 @@ class ScalableMatrixWithUnitPricingPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - scalable_matrix_with_unit_pricing_config: Dict[str, object] - dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -ScalableMatrixWithTieredPricingPriceConversionRateConfig: TypeAlias = Annotated[ +ScalableMatrixWithUnitPricingPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class ScalableMatrixWithTieredPricingPrice(BaseModel): +class ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig(BaseModel): + first_dimension: str + """Used to determine the unit rate""" + + matrix_scaling_factors: List[ + ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfigMatrixScalingFactor + ] + """Apply a scaling factor to each dimension""" + + unit_price: str + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] = None + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] = None + """Used to determine the unit rate (optional)""" + + +class ScalableMatrixWithUnitPricingPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1736,7 +2145,7 @@ class ScalableMatrixWithTieredPricingPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[ScalableMatrixWithTieredPricingPriceConversionRateConfig] = None + conversion_rate_config: Optional[ScalableMatrixWithUnitPricingPriceConversionRateConfig] = None created_at: datetime @@ -1770,7 +2179,8 @@ class ScalableMatrixWithTieredPricingPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["scalable_matrix_with_tiered_pricing"] = FieldInfo(alias="model_type") + price_model_type: Literal["scalable_matrix_with_unit_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1784,17 +2194,53 @@ class ScalableMatrixWithTieredPricingPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ - scalable_matrix_with_tiered_pricing_config: Dict[str, object] + scalable_matrix_with_unit_pricing_config: ScalableMatrixWithUnitPricingPriceScalableMatrixWithUnitPricingConfig + """Configuration for scalable_matrix_with_unit_pricing pricing""" dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -CumulativeGroupedBulkPriceConversionRateConfig: TypeAlias = Annotated[ +ScalableMatrixWithTieredPricingPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class CumulativeGroupedBulkPrice(BaseModel): +class ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor(BaseModel): + first_dimension_value: str + """First dimension value""" + + scaling_factor: str + """Scaling factor""" + + second_dimension_value: Optional[str] = None + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier(BaseModel): + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig(BaseModel): + first_dimension: str + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: List[ + ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigMatrixScalingFactor + ] + """Apply a scaling factor to each dimension""" + + tiers: List[ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfigTier] + """Tier pricing structure""" + + second_dimension: Optional[str] = None + """Used for the scalable matrix second dimension (optional)""" + + +class ScalableMatrixWithTieredPricingPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1807,14 +2253,12 @@ class CumulativeGroupedBulkPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[CumulativeGroupedBulkPriceConversionRateConfig] = None + conversion_rate_config: Optional[ScalableMatrixWithTieredPricingPriceConversionRateConfig] = None created_at: datetime credit_allocation: Optional[Allocation] = None - cumulative_grouped_bulk_config: Dict[str, object] - currency: str discount: Optional[Discount] = None @@ -1843,7 +2287,8 @@ class CumulativeGroupedBulkPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["cumulative_grouped_bulk"] = FieldInfo(alias="model_type") + price_model_type: Literal["scalable_matrix_with_tiered_pricing"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1857,15 +2302,39 @@ class CumulativeGroupedBulkPrice(BaseModel): This price will take the place of the replaced price in plan version migrations. """ + scalable_matrix_with_tiered_pricing_config: ( + ScalableMatrixWithTieredPricingPriceScalableMatrixWithTieredPricingConfig + ) + """Configuration for scalable_matrix_with_tiered_pricing pricing""" + dimensional_price_configuration: Optional[DimensionalPriceConfiguration] = None -GroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Annotated[ +CumulativeGroupedBulkPriceConversionRateConfig: TypeAlias = Annotated[ Union[UnitConversionRateConfig, TieredConversionRateConfig], PropertyInfo(discriminator="conversion_rate_type") ] -class GroupedWithMinMaxThresholdsPrice(BaseModel): +class CumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue(BaseModel): + grouping_key: str + """Grouping key value""" + + tier_lower_bound: str + """Tier lower bound""" + + unit_amount: str + """Unit amount for this combination""" + + +class CumulativeGroupedBulkPriceCumulativeGroupedBulkConfig(BaseModel): + dimension_values: List[CumulativeGroupedBulkPriceCumulativeGroupedBulkConfigDimensionValue] + """Each tier lower bound must have the same group of values.""" + + group: str + """Grouping key name""" + + +class CumulativeGroupedBulkPrice(BaseModel): id: str billable_metric: Optional[BillableMetricTiny] = None @@ -1878,12 +2347,15 @@ class GroupedWithMinMaxThresholdsPrice(BaseModel): conversion_rate: Optional[float] = None - conversion_rate_config: Optional[GroupedWithMinMaxThresholdsPriceConversionRateConfig] = None + conversion_rate_config: Optional[CumulativeGroupedBulkPriceConversionRateConfig] = None created_at: datetime credit_allocation: Optional[Allocation] = None + cumulative_grouped_bulk_config: CumulativeGroupedBulkPriceCumulativeGroupedBulkConfig + """Configuration for cumulative_grouped_bulk pricing""" + currency: str discount: Optional[Discount] = None @@ -1892,8 +2364,6 @@ class GroupedWithMinMaxThresholdsPrice(BaseModel): fixed_price_quantity: Optional[float] = None - grouped_with_min_max_thresholds_config: Dict[str, object] - invoicing_cycle_configuration: Optional[BillingCycleConfiguration] = None item: ItemSlim @@ -1914,7 +2384,8 @@ class GroupedWithMinMaxThresholdsPrice(BaseModel): minimum_amount: Optional[str] = None - price_model_type: Literal["grouped_with_min_max_thresholds"] = FieldInfo(alias="model_type") + price_model_type: Literal["cumulative_grouped_bulk"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -1941,10 +2412,7 @@ class MinimumCompositePriceMinimumConfig(BaseModel): """The minimum amount to apply""" prorated: Optional[bool] = None - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + """If true, subtotals from this price are prorated based on the service period""" class MinimumCompositePrice(BaseModel): @@ -1995,8 +2463,10 @@ class MinimumCompositePrice(BaseModel): minimum_amount: Optional[str] = None minimum_config: MinimumCompositePriceMinimumConfig + """Configuration for minimum pricing""" price_model_type: Literal["minimum"] = FieldInfo(alias="model_type") + """The pricing model type""" name: str @@ -2016,14 +2486,14 @@ class MinimumCompositePrice(BaseModel): Price: TypeAlias = Annotated[ Union[ UnitPrice, - PackagePrice, - MatrixPrice, TieredPrice, BulkPrice, + PackagePrice, + MatrixPrice, ThresholdTotalAmountPrice, TieredPackagePrice, - GroupedTieredPrice, TieredWithMinimumPrice, + GroupedTieredPrice, TieredPackageWithMinimumPrice, PackageWithAllocationPrice, UnitWithPercentPrice, @@ -2031,16 +2501,16 @@ class MinimumCompositePrice(BaseModel): TieredWithProrationPrice, UnitWithProrationPrice, GroupedAllocationPrice, + BulkWithProrationPrice, GroupedWithProratedMinimumPrice, GroupedWithMeteredMinimumPrice, + GroupedWithMinMaxThresholdsPrice, MatrixWithDisplayNamePrice, - BulkWithProrationPrice, GroupedTieredPackagePrice, MaxGroupTieredPackagePrice, ScalableMatrixWithUnitPricingPrice, ScalableMatrixWithTieredPricingPrice, CumulativeGroupedBulkPrice, - GroupedWithMinMaxThresholdsPrice, MinimumCompositePrice, ], PropertyInfo(discriminator="price_model_type"), diff --git a/src/orb/types/shared/tier.py b/src/orb/types/shared/tier.py index 28d0de52..f0874550 100644 --- a/src/orb/types/shared/tier.py +++ b/src/orb/types/shared/tier.py @@ -15,4 +15,7 @@ class Tier(BaseModel): """Amount per unit""" last_unit: Optional[float] = None - """Inclusive tier ending value. If null, this is treated as the last tier""" + """Inclusive tier ending value. + + This value is null if and only if this is the last tier. + """ diff --git a/src/orb/types/shared/tier_config.py b/src/orb/types/shared/tier_config.py deleted file mode 100644 index 0c6f71dc..00000000 --- a/src/orb/types/shared/tier_config.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["TierConfig"] - - -class TierConfig(BaseModel): - first_unit: float - - last_unit: Optional[float] = None - - unit_amount: str diff --git a/src/orb/types/shared/tier_sub_line_item.py b/src/orb/types/shared/tier_sub_line_item.py index 9f9388cb..246a38ba 100644 --- a/src/orb/types/shared/tier_sub_line_item.py +++ b/src/orb/types/shared/tier_sub_line_item.py @@ -4,10 +4,17 @@ from typing_extensions import Literal from ..._models import BaseModel -from .tier_config import TierConfig from .sub_line_item_grouping import SubLineItemGrouping -__all__ = ["TierSubLineItem"] +__all__ = ["TierSubLineItem", "TierConfig"] + + +class TierConfig(BaseModel): + first_unit: float + + last_unit: Optional[float] = None + + unit_amount: str class TierSubLineItem(BaseModel): diff --git a/src/orb/types/shared/unit_config.py b/src/orb/types/shared/unit_config.py index 6c5cc436..51275c6c 100644 --- a/src/orb/types/shared/unit_config.py +++ b/src/orb/types/shared/unit_config.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from ..._models import BaseModel __all__ = ["UnitConfig"] @@ -8,3 +10,6 @@ class UnitConfig(BaseModel): unit_amount: str """Rate per unit of usage""" + + scaling_factor: Optional[float] = None + """Multiplier to scale rated quantity by""" diff --git a/src/orb/types/shared_params/__init__.py b/src/orb/types/shared_params/__init__.py index 4e40fc33..96706705 100644 --- a/src/orb/types/shared_params/__init__.py +++ b/src/orb/types/shared_params/__init__.py @@ -49,7 +49,6 @@ from .new_plan_grouped_allocation_price import NewPlanGroupedAllocationPrice as NewPlanGroupedAllocationPrice from .billing_cycle_anchor_configuration import BillingCycleAnchorConfiguration as BillingCycleAnchorConfiguration from .new_plan_bulk_with_proration_price import NewPlanBulkWithProrationPrice as NewPlanBulkWithProrationPrice -from .new_plan_tier_with_proration_price import NewPlanTierWithProrationPrice as NewPlanTierWithProrationPrice from .new_plan_tiered_with_minimum_price import NewPlanTieredWithMinimumPrice as NewPlanTieredWithMinimumPrice from .new_plan_unit_with_proration_price import NewPlanUnitWithProrationPrice as NewPlanUnitWithProrationPrice from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration as NewDimensionalPriceConfiguration diff --git a/src/orb/types/shared_params/matrix_config.py b/src/orb/types/shared_params/matrix_config.py index 915f3f7d..1a182af6 100644 --- a/src/orb/types/shared_params/matrix_config.py +++ b/src/orb/types/shared_params/matrix_config.py @@ -19,4 +19,4 @@ class MatrixConfig(TypedDict, total=False): """One or two event property values to evaluate matrix groups by""" matrix_values: Required[Iterable[MatrixValue]] - """Matrix values for specified matrix grouping keys""" + """Matrix values configuration""" diff --git a/src/orb/types/shared_params/matrix_value.py b/src/orb/types/shared_params/matrix_value.py index 530ecbab..8c01e7b9 100644 --- a/src/orb/types/shared_params/matrix_value.py +++ b/src/orb/types/shared_params/matrix_value.py @@ -12,11 +12,7 @@ class MatrixValue(TypedDict, total=False): dimension_values: Required[SequenceNotStr[Optional[str]]] - """One or two matrix keys to filter usage to this Matrix value by. - - For example, ["region", "tier"] could be used to filter cloud usage by a cloud - region and an instance tier. - """ + """One or two matrix keys to filter usage to this Matrix value by""" unit_amount: Required[str] """Unit price for the specified dimension_values""" diff --git a/src/orb/types/shared_params/matrix_with_allocation_config.py b/src/orb/types/shared_params/matrix_with_allocation_config.py index eb9ff0ea..4da9383e 100644 --- a/src/orb/types/shared_params/matrix_with_allocation_config.py +++ b/src/orb/types/shared_params/matrix_with_allocation_config.py @@ -6,14 +6,25 @@ from typing_extensions import Required, TypedDict from ..._types import SequenceNotStr -from .matrix_value import MatrixValue -__all__ = ["MatrixWithAllocationConfig"] +__all__ = ["MatrixWithAllocationConfig", "MatrixValue"] + + +class MatrixValue(TypedDict, total=False): + dimension_values: Required[SequenceNotStr[Optional[str]]] + """One or two matrix keys to filter usage to this Matrix value by. + + For example, ["region", "tier"] could be used to filter cloud usage by a cloud + region and an instance tier. + """ + + unit_amount: Required[str] + """Unit price for the specified dimension_values""" class MatrixWithAllocationConfig(TypedDict, total=False): - allocation: Required[float] - """Allocation to be used to calculate the price""" + allocation: Required[str] + """Usage allocation""" default_unit_amount: Required[str] """Default per unit rate for any usage not bucketed into a specified matrix_value""" @@ -22,4 +33,4 @@ class MatrixWithAllocationConfig(TypedDict, total=False): """One or two event property values to evaluate matrix groups by""" matrix_values: Required[Iterable[MatrixValue]] - """Matrix values for specified matrix grouping keys""" + """Matrix values configuration""" diff --git a/src/orb/types/shared_params/new_floating_bulk_price.py b/src/orb/types/shared_params/new_floating_bulk_price.py index 8dd8368f..22b80af3 100644 --- a/src/orb/types/shared_params/new_floating_bulk_price.py +++ b/src/orb/types/shared_params/new_floating_bulk_price.py @@ -18,6 +18,7 @@ class NewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[BulkConfig] + """Configuration for bulk pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -29,6 +30,7 @@ class NewFloatingBulkPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_bulk_with_proration_price.py b/src/orb/types/shared_params/new_floating_bulk_with_proration_price.py index 9730e26d..d558b2c9 100644 --- a/src/orb/types/shared_params/new_floating_bulk_with_proration_price.py +++ b/src/orb/types/shared_params/new_floating_bulk_with_proration_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,13 +10,33 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingBulkWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingBulkWithProrationPrice", + "BulkWithProrationConfig", + "BulkWithProrationConfigTier", + "ConversionRateConfig", +] + + +class BulkWithProrationConfigTier(TypedDict, total=False): + unit_amount: Required[str] + """Cost per unit""" + + tier_lower_bound: Optional[str] + """The lower bound for this tier""" + + +class BulkWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[BulkWithProrationConfigTier]] + """Bulk tiers for rating based on total usage volume""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] class NewFloatingBulkWithProrationPrice(TypedDict, total=False): - bulk_with_proration_config: Required[Dict[str, object]] + bulk_with_proration_config: Required[BulkWithProrationConfig] + """Configuration for bulk_with_proration pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -28,6 +48,7 @@ class NewFloatingBulkWithProrationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_cumulative_grouped_bulk_price.py b/src/orb/types/shared_params/new_floating_cumulative_grouped_bulk_price.py index 643c1192..c366e61c 100644 --- a/src/orb/types/shared_params/new_floating_cumulative_grouped_bulk_price.py +++ b/src/orb/types/shared_params/new_floating_cumulative_grouped_bulk_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingCumulativeGroupedBulkPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingCumulativeGroupedBulkPrice", + "CumulativeGroupedBulkConfig", + "CumulativeGroupedBulkConfigDimensionValue", + "ConversionRateConfig", +] + + +class CumulativeGroupedBulkConfigDimensionValue(TypedDict, total=False): + grouping_key: Required[str] + """Grouping key value""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Unit amount for this combination""" + + +class CumulativeGroupedBulkConfig(TypedDict, total=False): + dimension_values: Required[Iterable[CumulativeGroupedBulkConfigDimensionValue]] + """Each tier lower bound must have the same group of values.""" + + group: Required[str] + """Grouping key name""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,7 +44,8 @@ class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Required[Dict[str, object]] + cumulative_grouped_bulk_config: Required[CumulativeGroupedBulkConfig] + """Configuration for cumulative_grouped_bulk pricing""" currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" @@ -28,6 +54,7 @@ class NewFloatingCumulativeGroupedBulkPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["cumulative_grouped_bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_grouped_allocation_price.py b/src/orb/types/shared_params/new_floating_grouped_allocation_price.py index d5d8ae7e..f4eab386 100644 --- a/src/orb/types/shared_params/new_floating_grouped_allocation_price.py +++ b/src/orb/types/shared_params/new_floating_grouped_allocation_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedAllocationPrice", "GroupedAllocationConfig", "ConversionRateConfig"] + + +class GroupedAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation per group""" + + grouping_key: Required[str] + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: Required[str] + """Unit rate for post-allocation""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,12 +34,14 @@ class NewFloatingGroupedAllocationPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_allocation_config: Required[Dict[str, object]] + grouped_allocation_config: Required[GroupedAllocationConfig] + """Configuration for grouped_allocation pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_grouped_tiered_package_price.py b/src/orb/types/shared_params/new_floating_grouped_tiered_package_price.py index 3ea5c778..b13138ee 100644 --- a/src/orb/types/shared_params/new_floating_grouped_tiered_package_price.py +++ b/src/orb/types/shared_params/new_floating_grouped_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingGroupedTieredPackagePrice", + "GroupedTieredPackageConfig", + "GroupedTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class GroupedTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before tiering""" + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[GroupedTieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,12 +50,14 @@ class NewFloatingGroupedTieredPackagePrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_package_config: Required[Dict[str, object]] + grouped_tiered_package_config: Required[GroupedTieredPackageConfig] + """Configuration for grouped_tiered_package pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_grouped_tiered_price.py b/src/orb/types/shared_params/new_floating_grouped_tiered_price.py index e3982b75..2f2d7c92 100644 --- a/src/orb/types/shared_params/new_floating_grouped_tiered_price.py +++ b/src/orb/types/shared_params/new_floating_grouped_tiered_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedTieredPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedTieredPrice", "GroupedTieredConfig", "GroupedTieredConfigTier", "ConversionRateConfig"] + + +class GroupedTieredConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedTieredConfig(TypedDict, total=False): + grouping_key: Required[str] + """The billable metric property used to group before tiering""" + + tiers: Required[Iterable[GroupedTieredConfigTier]] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,12 +42,14 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_tiered_config: Required[Dict[str, object]] + grouped_tiered_config: Required[GroupedTieredConfig] + """Configuration for grouped_tiered pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_grouped_with_metered_minimum_price.py b/src/orb/types/shared_params/new_floating_grouped_with_metered_minimum_price.py index 5a13cbd2..09cc4afc 100644 --- a/src/orb/types/shared_params/new_floating_grouped_with_metered_minimum_price.py +++ b/src/orb/types/shared_params/new_floating_grouped_with_metered_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,56 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedWithMeteredMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingGroupedWithMeteredMinimumPrice", + "GroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumConfigUnitAmount", + "ConversionRateConfig", +] + + +class GroupedWithMeteredMinimumConfigScalingFactor(TypedDict, total=False): + scaling_factor: Required[str] + """Scaling factor""" + + scaling_value: Required[str] + """Scaling value""" + + +class GroupedWithMeteredMinimumConfigUnitAmount(TypedDict, total=False): + pricing_value: Required[str] + """Pricing value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedWithMeteredMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: Required[str] + """The minimum amount to charge per group per unit""" + + pricing_key: Required[str] + """Used to determine the unit rate""" + + scaling_factors: Required[Iterable[GroupedWithMeteredMinimumConfigScalingFactor]] + """Scale the unit rates by the scaling factor.""" + + scaling_key: Required[str] + """Used to determine the unit rate scaling factor""" + + unit_amounts: Required[Iterable[GroupedWithMeteredMinimumConfigUnitAmount]] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,12 +71,14 @@ class NewFloatingGroupedWithMeteredMinimumPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_metered_minimum_config: Required[Dict[str, object]] + grouped_with_metered_minimum_config: Required[GroupedWithMeteredMinimumConfig] + """Configuration for grouped_with_metered_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_metered_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_grouped_with_prorated_minimum_price.py b/src/orb/types/shared_params/new_floating_grouped_with_prorated_minimum_price.py index 17a28adf..489dcaaf 100644 --- a/src/orb/types/shared_params/new_floating_grouped_with_prorated_minimum_price.py +++ b/src/orb/types/shared_params/new_floating_grouped_with_prorated_minimum_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingGroupedWithProratedMinimumPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingGroupedWithProratedMinimumPrice", "GroupedWithProratedMinimumConfig", "ConversionRateConfig"] + + +class GroupedWithProratedMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """How to determine the groups that should each have a minimum""" + + minimum: Required[str] + """The minimum amount to charge per group""" + + unit_rate: Required[str] + """The amount to charge per unit""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,12 +34,14 @@ class NewFloatingGroupedWithProratedMinimumPrice(TypedDict, total=False): currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_prorated_minimum_config: Required[Dict[str, object]] + grouped_with_prorated_minimum_config: Required[GroupedWithProratedMinimumConfig] + """Configuration for grouped_with_prorated_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_prorated_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_matrix_price.py b/src/orb/types/shared_params/new_floating_matrix_price.py index 0d385711..86f08561 100644 --- a/src/orb/types/shared_params/new_floating_matrix_price.py +++ b/src/orb/types/shared_params/new_floating_matrix_price.py @@ -27,8 +27,10 @@ class NewFloatingMatrixPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_config: Required[MatrixConfig] + """Configuration for matrix pricing""" model_type: Required[Literal["matrix"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_matrix_with_allocation_price.py b/src/orb/types/shared_params/new_floating_matrix_with_allocation_price.py index c0cb4fca..a5e7e7df 100644 --- a/src/orb/types/shared_params/new_floating_matrix_with_allocation_price.py +++ b/src/orb/types/shared_params/new_floating_matrix_with_allocation_price.py @@ -27,8 +27,10 @@ class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_with_allocation_config: Required[MatrixWithAllocationConfig] + """Configuration for matrix_with_allocation pricing""" model_type: Required[Literal["matrix_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_matrix_with_display_name_price.py b/src/orb/types/shared_params/new_floating_matrix_with_display_name_price.py index ed2c78be..3afbf5a0 100644 --- a/src/orb/types/shared_params/new_floating_matrix_with_display_name_price.py +++ b/src/orb/types/shared_params/new_floating_matrix_with_display_name_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingMatrixWithDisplayNamePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingMatrixWithDisplayNamePrice", + "MatrixWithDisplayNameConfig", + "MatrixWithDisplayNameConfigUnitAmount", + "ConversionRateConfig", +] + + +class MatrixWithDisplayNameConfigUnitAmount(TypedDict, total=False): + dimension_value: Required[str] + """The dimension value""" + + display_name: Required[str] + """Display name for this dimension value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MatrixWithDisplayNameConfig(TypedDict, total=False): + dimension: Required[str] + """Used to determine the unit rate""" + + unit_amounts: Required[Iterable[MatrixWithDisplayNameConfigUnitAmount]] + """Apply per unit pricing to each dimension value""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -25,9 +50,11 @@ class NewFloatingMatrixWithDisplayNamePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Required[Dict[str, object]] + matrix_with_display_name_config: Required[MatrixWithDisplayNameConfig] + """Configuration for matrix_with_display_name pricing""" model_type: Required[Literal["matrix_with_display_name"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_max_group_tiered_package_price.py b/src/orb/types/shared_params/new_floating_max_group_tiered_package_price.py index 69aa79d2..6fce2b51 100644 --- a/src/orb/types/shared_params/new_floating_max_group_tiered_package_price.py +++ b/src/orb/types/shared_params/new_floating_max_group_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,34 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingMaxGroupTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingMaxGroupTieredPackagePrice", + "MaxGroupTieredPackageConfig", + "MaxGroupTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class MaxGroupTieredPackageConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MaxGroupTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[MaxGroupTieredPackageConfigTier]] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -25,9 +52,11 @@ class NewFloatingMaxGroupTieredPackagePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Required[Dict[str, object]] + max_group_tiered_package_config: Required[MaxGroupTieredPackageConfig] + """Configuration for max_group_tiered_package pricing""" model_type: Required[Literal["max_group_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_minimum_composite_price.py b/src/orb/types/shared_params/new_floating_minimum_composite_price.py index d47e923a..1c8e4bc5 100644 --- a/src/orb/types/shared_params/new_floating_minimum_composite_price.py +++ b/src/orb/types/shared_params/new_floating_minimum_composite_price.py @@ -17,11 +17,8 @@ class MinimumConfig(TypedDict, total=False): minimum_amount: Required[str] """The minimum amount to apply""" - prorated: Optional[bool] - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -38,8 +35,10 @@ class NewFloatingMinimumCompositePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" minimum_config: Required[MinimumConfig] + """Configuration for minimum pricing""" model_type: Required[Literal["minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_floating_package_price.py b/src/orb/types/shared_params/new_floating_package_price.py index 81d880ae..e35b0490 100644 --- a/src/orb/types/shared_params/new_floating_package_price.py +++ b/src/orb/types/shared_params/new_floating_package_price.py @@ -27,11 +27,13 @@ class NewFloatingPackagePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" package_config: Required[PackageConfig] + """Configuration for package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_package_with_allocation_price.py b/src/orb/types/shared_params/new_floating_package_with_allocation_price.py index c80a6a9c..7728b3d2 100644 --- a/src/orb/types/shared_params/new_floating_package_with_allocation_price.py +++ b/src/orb/types/shared_params/new_floating_package_with_allocation_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingPackageWithAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingPackageWithAllocationPrice", "PackageWithAllocationConfig", "ConversionRateConfig"] + + +class PackageWithAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation""" + + package_amount: Required[str] + """Price per package""" + + package_size: Required[str] + """Package size""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +38,13 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - package_with_allocation_config: Required[Dict[str, object]] + package_with_allocation_config: Required[PackageWithAllocationConfig] + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_scalable_matrix_with_tiered_pricing_price.py b/src/orb/types/shared_params/new_floating_scalable_matrix_with_tiered_pricing_price.py index 62b6a382..02ec608c 100644 --- a/src/orb/types/shared_params/new_floating_scalable_matrix_with_tiered_pricing_price.py +++ b/src/orb/types/shared_params/new_floating_scalable_matrix_with_tiered_pricing_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,47 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingScalableMatrixWithTieredPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingScalableMatrixWithTieredPricingPrice", + "ScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingConfigTier", + "ConversionRateConfig", +] + + +class ScalableMatrixWithTieredPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithTieredPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + tiers: Required[Iterable[ScalableMatrixWithTieredPricingConfigTier]] + """Tier pricing structure""" + + second_dimension: Optional[str] + """Used for the scalable matrix second dimension (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +66,13 @@ class NewFloatingScalableMatrixWithTieredPricingPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_tiered_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_tiered_pricing_config: Required[ScalableMatrixWithTieredPricingConfig] + """Configuration for scalable_matrix_with_tiered_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_scalable_matrix_with_unit_pricing_price.py b/src/orb/types/shared_params/new_floating_scalable_matrix_with_unit_pricing_price.py index cc01eaa7..03f0bde2 100644 --- a/src/orb/types/shared_params/new_floating_scalable_matrix_with_unit_pricing_price.py +++ b/src/orb/types/shared_params/new_floating_scalable_matrix_with_unit_pricing_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,41 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingScalableMatrixWithUnitPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingScalableMatrixWithUnitPricingPrice", + "ScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingConfigMatrixScalingFactor", + "ConversionRateConfig", +] + + +class ScalableMatrixWithUnitPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used to determine the unit rate""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithUnitPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + unit_price: Required[str] + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] + """Used to determine the unit rate (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +60,13 @@ class NewFloatingScalableMatrixWithUnitPricingPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_unit_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_unit_pricing_config: Required[ScalableMatrixWithUnitPricingConfig] + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_threshold_total_amount_price.py b/src/orb/types/shared_params/new_floating_threshold_total_amount_price.py index 0518b963..dd2407c4 100644 --- a/src/orb/types/shared_params/new_floating_threshold_total_amount_price.py +++ b/src/orb/types/shared_params/new_floating_threshold_total_amount_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingThresholdTotalAmountPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingThresholdTotalAmountPrice", + "ThresholdTotalAmountConfig", + "ThresholdTotalAmountConfigConsumptionTable", + "ConversionRateConfig", +] + + +class ThresholdTotalAmountConfigConsumptionTable(TypedDict, total=False): + threshold: Required[str] + """Quantity threshold""" + + total_amount: Required[str] + """Total amount for this threshold""" + + +class ThresholdTotalAmountConfig(TypedDict, total=False): + consumption_table: Required[Iterable[ThresholdTotalAmountConfigConsumptionTable]] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +51,13 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["threshold_total_amount"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - threshold_total_amount_config: Required[Dict[str, object]] + threshold_total_amount_config: Required[ThresholdTotalAmountConfig] + """Configuration for threshold_total_amount pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_tiered_package_price.py b/src/orb/types/shared_params/new_floating_tiered_package_price.py index 685cb715..ab0f71da 100644 --- a/src/orb/types/shared_params/new_floating_tiered_package_price.py +++ b/src/orb/types/shared_params/new_floating_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredPackagePrice", "ConversionRateConfig"] +__all__ = ["NewFloatingTieredPackagePrice", "TieredPackageConfig", "TieredPackageConfigTier", "ConversionRateConfig"] + + +class TieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageConfig(TypedDict, total=False): + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[TieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +46,13 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_config: Required[Dict[str, object]] + tiered_package_config: Required[TieredPackageConfig] + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_tiered_package_with_minimum_price.py b/src/orb/types/shared_params/new_floating_tiered_package_with_minimum_price.py index 9acd9994..192557db 100644 --- a/src/orb/types/shared_params/new_floating_tiered_package_with_minimum_price.py +++ b/src/orb/types/shared_params/new_floating_tiered_package_with_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredPackageWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredPackageWithMinimumPrice", + "TieredPackageWithMinimumConfig", + "TieredPackageWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageWithMinimumConfig(TypedDict, total=False): + package_size: Required[float] + """Package size""" + + tiers: Required[Iterable[TieredPackageWithMinimumConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +54,13 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_with_minimum_config: Required[Dict[str, object]] + tiered_package_with_minimum_config: Required[TieredPackageWithMinimumConfig] + """Configuration for tiered_package_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_tiered_price.py b/src/orb/types/shared_params/new_floating_tiered_price.py index cf67d2f0..5444fb79 100644 --- a/src/orb/types/shared_params/new_floating_tiered_price.py +++ b/src/orb/types/shared_params/new_floating_tiered_price.py @@ -27,11 +27,13 @@ class NewFloatingTieredPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" tiered_config: Required[TieredConfig] + """Configuration for tiered pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_tiered_with_minimum_price.py b/src/orb/types/shared_params/new_floating_tiered_with_minimum_price.py index 0999c68b..b7af73ee 100644 --- a/src/orb/types/shared_params/new_floating_tiered_with_minimum_price.py +++ b/src/orb/types/shared_params/new_floating_tiered_with_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,38 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredWithMinimumPrice", + "TieredWithMinimumConfig", + "TieredWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class TieredWithMinimumConfig(TypedDict, total=False): + tiers: Required[Iterable[TieredWithMinimumConfigTier]] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: bool + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: bool + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +57,13 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_minimum_config: Required[Dict[str, object]] + tiered_with_minimum_config: Required[TieredWithMinimumConfig] + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_tiered_with_proration_price.py b/src/orb/types/shared_params/new_floating_tiered_with_proration_price.py index 0e281ad6..6a668abb 100644 --- a/src/orb/types/shared_params/new_floating_tiered_with_proration_price.py +++ b/src/orb/types/shared_params/new_floating_tiered_with_proration_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,29 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingTieredWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewFloatingTieredWithProrationPrice", + "TieredWithProrationConfig", + "TieredWithProrationConfigTier", + "ConversionRateConfig", +] + + +class TieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class TieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[TieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +48,13 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_proration_config: Required[Dict[str, object]] + tiered_with_proration_config: Required[TieredWithProrationConfig] + """Configuration for tiered_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_unit_price.py b/src/orb/types/shared_params/new_floating_unit_price.py index 8c77f12b..9680510a 100644 --- a/src/orb/types/shared_params/new_floating_unit_price.py +++ b/src/orb/types/shared_params/new_floating_unit_price.py @@ -27,11 +27,13 @@ class NewFloatingUnitPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit"]] + """The pricing model type""" name: Required[str] """The name of the price.""" unit_config: Required[UnitConfig] + """Configuration for unit pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_unit_with_percent_price.py b/src/orb/types/shared_params/new_floating_unit_with_percent_price.py index 5af3737e..f4c3f97f 100644 --- a/src/orb/types/shared_params/new_floating_unit_with_percent_price.py +++ b/src/orb/types/shared_params/new_floating_unit_with_percent_price.py @@ -10,7 +10,16 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingUnitWithPercentPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingUnitWithPercentPrice", "UnitWithPercentConfig", "ConversionRateConfig"] + + +class UnitWithPercentConfig(TypedDict, total=False): + percent: Required[str] + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +35,13 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_percent"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_percent_config: Required[Dict[str, object]] + unit_with_percent_config: Required[UnitWithPercentConfig] + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_floating_unit_with_proration_price.py b/src/orb/types/shared_params/new_floating_unit_with_proration_price.py index 49351964..9be1a23b 100644 --- a/src/orb/types/shared_params/new_floating_unit_with_proration_price.py +++ b/src/orb/types/shared_params/new_floating_unit_with_proration_price.py @@ -10,7 +10,13 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewFloatingUnitWithProrationPrice", "ConversionRateConfig"] +__all__ = ["NewFloatingUnitWithProrationPrice", "UnitWithProrationConfig", "ConversionRateConfig"] + + +class UnitWithProrationConfig(TypedDict, total=False): + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -26,11 +32,13 @@ class NewFloatingUnitWithProrationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_proration_config: Required[Dict[str, object]] + unit_with_proration_config: Required[UnitWithProrationConfig] + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_bulk_price.py b/src/orb/types/shared_params/new_plan_bulk_price.py index 436cb117..05e8b90f 100644 --- a/src/orb/types/shared_params/new_plan_bulk_price.py +++ b/src/orb/types/shared_params/new_plan_bulk_price.py @@ -18,6 +18,7 @@ class NewPlanBulkPrice(TypedDict, total=False): bulk_config: Required[BulkConfig] + """Configuration for bulk pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -26,6 +27,7 @@ class NewPlanBulkPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_bulk_with_proration_price.py b/src/orb/types/shared_params/new_plan_bulk_with_proration_price.py index d316caa0..a64dd3ae 100644 --- a/src/orb/types/shared_params/new_plan_bulk_with_proration_price.py +++ b/src/orb/types/shared_params/new_plan_bulk_with_proration_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,13 +10,33 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanBulkWithProrationPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanBulkWithProrationPrice", + "BulkWithProrationConfig", + "BulkWithProrationConfigTier", + "ConversionRateConfig", +] + + +class BulkWithProrationConfigTier(TypedDict, total=False): + unit_amount: Required[str] + """Cost per unit""" + + tier_lower_bound: Optional[str] + """The lower bound for this tier""" + + +class BulkWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[BulkWithProrationConfigTier]] + """Bulk tiers for rating based on total usage volume""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] class NewPlanBulkWithProrationPrice(TypedDict, total=False): - bulk_with_proration_config: Required[Dict[str, object]] + bulk_with_proration_config: Required[BulkWithProrationConfig] + """Configuration for bulk_with_proration pricing""" cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" @@ -25,6 +45,7 @@ class NewPlanBulkWithProrationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["bulk_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_cumulative_grouped_bulk_price.py b/src/orb/types/shared_params/new_plan_cumulative_grouped_bulk_price.py index 35baaf81..52e6ec62 100644 --- a/src/orb/types/shared_params/new_plan_cumulative_grouped_bulk_price.py +++ b/src/orb/types/shared_params/new_plan_cumulative_grouped_bulk_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanCumulativeGroupedBulkPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanCumulativeGroupedBulkPrice", + "CumulativeGroupedBulkConfig", + "CumulativeGroupedBulkConfigDimensionValue", + "ConversionRateConfig", +] + + +class CumulativeGroupedBulkConfigDimensionValue(TypedDict, total=False): + grouping_key: Required[str] + """Grouping key value""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Unit amount for this combination""" + + +class CumulativeGroupedBulkConfig(TypedDict, total=False): + dimension_values: Required[Iterable[CumulativeGroupedBulkConfigDimensionValue]] + """Each tier lower bound must have the same group of values.""" + + group: Required[str] + """Grouping key name""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +44,14 @@ class NewPlanCumulativeGroupedBulkPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - cumulative_grouped_bulk_config: Required[Dict[str, object]] + cumulative_grouped_bulk_config: Required[CumulativeGroupedBulkConfig] + """Configuration for cumulative_grouped_bulk pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["cumulative_grouped_bulk"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_grouped_allocation_price.py b/src/orb/types/shared_params/new_plan_grouped_allocation_price.py index 19a387c9..67b7c72f 100644 --- a/src/orb/types/shared_params/new_plan_grouped_allocation_price.py +++ b/src/orb/types/shared_params/new_plan_grouped_allocation_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedAllocationPrice", "GroupedAllocationConfig", "ConversionRateConfig"] + + +class GroupedAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation per group""" + + grouping_key: Required[str] + """How to determine the groups that should each be allocated some quantity""" + + overage_unit_rate: Required[str] + """Unit rate for post-allocation""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +31,14 @@ class NewPlanGroupedAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_allocation_config: Required[Dict[str, object]] + grouped_allocation_config: Required[GroupedAllocationConfig] + """Configuration for grouped_allocation pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_grouped_tiered_package_price.py b/src/orb/types/shared_params/new_plan_grouped_tiered_package_price.py index fbb0d525..26d663eb 100644 --- a/src/orb/types/shared_params/new_plan_grouped_tiered_package_price.py +++ b/src/orb/types/shared_params/new_plan_grouped_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanGroupedTieredPackagePrice", + "GroupedTieredPackageConfig", + "GroupedTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class GroupedTieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class GroupedTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before tiering""" + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[GroupedTieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +47,14 @@ class NewPlanGroupedTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_tiered_package_config: Required[Dict[str, object]] + grouped_tiered_package_config: Required[GroupedTieredPackageConfig] + """Configuration for grouped_tiered_package pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_grouped_tiered_price.py b/src/orb/types/shared_params/new_plan_grouped_tiered_price.py index bee29ec2..3bc086e4 100644 --- a/src/orb/types/shared_params/new_plan_grouped_tiered_price.py +++ b/src/orb/types/shared_params/new_plan_grouped_tiered_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedTieredPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedTieredPrice", "GroupedTieredConfig", "GroupedTieredConfigTier", "ConversionRateConfig"] + + +class GroupedTieredConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedTieredConfig(TypedDict, total=False): + grouping_key: Required[str] + """The billable metric property used to group before tiering""" + + tiers: Required[Iterable[GroupedTieredConfigTier]] + """ + Apply tiered pricing to each segment generated after grouping with the provided + key + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +39,14 @@ class NewPlanGroupedTieredPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_tiered_config: Required[Dict[str, object]] + grouped_tiered_config: Required[GroupedTieredConfig] + """Configuration for grouped_tiered pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_grouped_with_metered_minimum_price.py b/src/orb/types/shared_params/new_plan_grouped_with_metered_minimum_price.py index 24147e08..27dbc416 100644 --- a/src/orb/types/shared_params/new_plan_grouped_with_metered_minimum_price.py +++ b/src/orb/types/shared_params/new_plan_grouped_with_metered_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,56 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedWithMeteredMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanGroupedWithMeteredMinimumPrice", + "GroupedWithMeteredMinimumConfig", + "GroupedWithMeteredMinimumConfigScalingFactor", + "GroupedWithMeteredMinimumConfigUnitAmount", + "ConversionRateConfig", +] + + +class GroupedWithMeteredMinimumConfigScalingFactor(TypedDict, total=False): + scaling_factor: Required[str] + """Scaling factor""" + + scaling_value: Required[str] + """Scaling value""" + + +class GroupedWithMeteredMinimumConfigUnitAmount(TypedDict, total=False): + pricing_value: Required[str] + """Pricing value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class GroupedWithMeteredMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """Used to partition the usage into groups. + + The minimum amount is applied to each group. + """ + + minimum_unit_amount: Required[str] + """The minimum amount to charge per group per unit""" + + pricing_key: Required[str] + """Used to determine the unit rate""" + + scaling_factors: Required[Iterable[GroupedWithMeteredMinimumConfigScalingFactor]] + """Scale the unit rates by the scaling factor.""" + + scaling_key: Required[str] + """Used to determine the unit rate scaling factor""" + + unit_amounts: Required[Iterable[GroupedWithMeteredMinimumConfigUnitAmount]] + """Apply per unit pricing to each pricing value. + + The minimum amount is applied any unmatched usage. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +68,14 @@ class NewPlanGroupedWithMeteredMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_metered_minimum_config: Required[Dict[str, object]] + grouped_with_metered_minimum_config: Required[GroupedWithMeteredMinimumConfig] + """Configuration for grouped_with_metered_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_metered_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_grouped_with_prorated_minimum_price.py b/src/orb/types/shared_params/new_plan_grouped_with_prorated_minimum_price.py index c32d54a9..b358bade 100644 --- a/src/orb/types/shared_params/new_plan_grouped_with_prorated_minimum_price.py +++ b/src/orb/types/shared_params/new_plan_grouped_with_prorated_minimum_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanGroupedWithProratedMinimumPrice", "ConversionRateConfig"] +__all__ = ["NewPlanGroupedWithProratedMinimumPrice", "GroupedWithProratedMinimumConfig", "ConversionRateConfig"] + + +class GroupedWithProratedMinimumConfig(TypedDict, total=False): + grouping_key: Required[str] + """How to determine the groups that should each have a minimum""" + + minimum: Required[str] + """The minimum amount to charge per group""" + + unit_rate: Required[str] + """The amount to charge per unit""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -19,12 +31,14 @@ class NewPlanGroupedWithProratedMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_prorated_minimum_config: Required[Dict[str, object]] + grouped_with_prorated_minimum_config: Required[GroupedWithProratedMinimumConfig] + """Configuration for grouped_with_prorated_minimum pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_prorated_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_matrix_price.py b/src/orb/types/shared_params/new_plan_matrix_price.py index d3f4452d..e0d8d2a3 100644 --- a/src/orb/types/shared_params/new_plan_matrix_price.py +++ b/src/orb/types/shared_params/new_plan_matrix_price.py @@ -24,8 +24,10 @@ class NewPlanMatrixPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_config: Required[MatrixConfig] + """Configuration for matrix pricing""" model_type: Required[Literal["matrix"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_matrix_with_allocation_price.py b/src/orb/types/shared_params/new_plan_matrix_with_allocation_price.py index 112a5a3c..2a704358 100644 --- a/src/orb/types/shared_params/new_plan_matrix_with_allocation_price.py +++ b/src/orb/types/shared_params/new_plan_matrix_with_allocation_price.py @@ -24,8 +24,10 @@ class NewPlanMatrixWithAllocationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" matrix_with_allocation_config: Required[MatrixWithAllocationConfig] + """Configuration for matrix_with_allocation pricing""" model_type: Required[Literal["matrix_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_matrix_with_display_name_price.py b/src/orb/types/shared_params/new_plan_matrix_with_display_name_price.py index dd420961..7822f6ee 100644 --- a/src/orb/types/shared_params/new_plan_matrix_with_display_name_price.py +++ b/src/orb/types/shared_params/new_plan_matrix_with_display_name_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanMatrixWithDisplayNamePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanMatrixWithDisplayNamePrice", + "MatrixWithDisplayNameConfig", + "MatrixWithDisplayNameConfigUnitAmount", + "ConversionRateConfig", +] + + +class MatrixWithDisplayNameConfigUnitAmount(TypedDict, total=False): + dimension_value: Required[str] + """The dimension value""" + + display_name: Required[str] + """Display name for this dimension value""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MatrixWithDisplayNameConfig(TypedDict, total=False): + dimension: Required[str] + """Used to determine the unit rate""" + + unit_amounts: Required[Iterable[MatrixWithDisplayNameConfigUnitAmount]] + """Apply per unit pricing to each dimension value""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,9 +47,11 @@ class NewPlanMatrixWithDisplayNamePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - matrix_with_display_name_config: Required[Dict[str, object]] + matrix_with_display_name_config: Required[MatrixWithDisplayNameConfig] + """Configuration for matrix_with_display_name pricing""" model_type: Required[Literal["matrix_with_display_name"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_max_group_tiered_package_price.py b/src/orb/types/shared_params/new_plan_max_group_tiered_package_price.py index 3d05613a..4c574233 100644 --- a/src/orb/types/shared_params/new_plan_max_group_tiered_package_price.py +++ b/src/orb/types/shared_params/new_plan_max_group_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,34 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanMaxGroupTieredPackagePrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanMaxGroupTieredPackagePrice", + "MaxGroupTieredPackageConfig", + "MaxGroupTieredPackageConfigTier", + "ConversionRateConfig", +] + + +class MaxGroupTieredPackageConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class MaxGroupTieredPackageConfig(TypedDict, total=False): + grouping_key: Required[str] + """ + The event property used to group before tiering the group with the highest value + """ + + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[MaxGroupTieredPackageConfigTier]] + """Apply tiered pricing to the largest group after grouping with the provided key.""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -22,9 +49,11 @@ class NewPlanMaxGroupTieredPackagePrice(TypedDict, total=False): item_id: Required[str] """The id of the item the price will be associated with.""" - max_group_tiered_package_config: Required[Dict[str, object]] + max_group_tiered_package_config: Required[MaxGroupTieredPackageConfig] + """Configuration for max_group_tiered_package pricing""" model_type: Required[Literal["max_group_tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_minimum_composite_price.py b/src/orb/types/shared_params/new_plan_minimum_composite_price.py index a488fe23..45fe6b83 100644 --- a/src/orb/types/shared_params/new_plan_minimum_composite_price.py +++ b/src/orb/types/shared_params/new_plan_minimum_composite_price.py @@ -17,11 +17,8 @@ class MinimumConfig(TypedDict, total=False): minimum_amount: Required[str] """The minimum amount to apply""" - prorated: Optional[bool] - """ - By default, subtotals from minimum composite prices are prorated based on the - service period. Set to false to disable proration. - """ + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -35,8 +32,10 @@ class NewPlanMinimumCompositePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" minimum_config: Required[MinimumConfig] + """Configuration for minimum pricing""" model_type: Required[Literal["minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" diff --git a/src/orb/types/shared_params/new_plan_package_price.py b/src/orb/types/shared_params/new_plan_package_price.py index 5d67fda5..ad018a13 100644 --- a/src/orb/types/shared_params/new_plan_package_price.py +++ b/src/orb/types/shared_params/new_plan_package_price.py @@ -24,11 +24,13 @@ class NewPlanPackagePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" package_config: Required[PackageConfig] + """Configuration for package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_package_with_allocation_price.py b/src/orb/types/shared_params/new_plan_package_with_allocation_price.py index db47c1e0..430f5861 100644 --- a/src/orb/types/shared_params/new_plan_package_with_allocation_price.py +++ b/src/orb/types/shared_params/new_plan_package_with_allocation_price.py @@ -10,7 +10,19 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanPackageWithAllocationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanPackageWithAllocationPrice", "PackageWithAllocationConfig", "ConversionRateConfig"] + + +class PackageWithAllocationConfig(TypedDict, total=False): + allocation: Required[str] + """Usage allocation""" + + package_amount: Required[str] + """Price per package""" + + package_size: Required[str] + """Package size""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +35,13 @@ class NewPlanPackageWithAllocationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["package_with_allocation"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - package_with_allocation_config: Required[Dict[str, object]] + package_with_allocation_config: Required[PackageWithAllocationConfig] + """Configuration for package_with_allocation pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_scalable_matrix_with_tiered_pricing_price.py b/src/orb/types/shared_params/new_plan_scalable_matrix_with_tiered_pricing_price.py index 4bb3987f..4d02a548 100644 --- a/src/orb/types/shared_params/new_plan_scalable_matrix_with_tiered_pricing_price.py +++ b/src/orb/types/shared_params/new_plan_scalable_matrix_with_tiered_pricing_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,47 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanScalableMatrixWithTieredPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanScalableMatrixWithTieredPricingPrice", + "ScalableMatrixWithTieredPricingConfig", + "ScalableMatrixWithTieredPricingConfigMatrixScalingFactor", + "ScalableMatrixWithTieredPricingConfigTier", + "ConversionRateConfig", +] + + +class ScalableMatrixWithTieredPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithTieredPricingConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class ScalableMatrixWithTieredPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used for the scalable matrix first dimension""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithTieredPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + tiers: Required[Iterable[ScalableMatrixWithTieredPricingConfigTier]] + """Tier pricing structure""" + + second_dimension: Optional[str] + """Used for the scalable matrix second dimension (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +63,13 @@ class NewPlanScalableMatrixWithTieredPricingPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_tiered_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_tiered_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_tiered_pricing_config: Required[ScalableMatrixWithTieredPricingConfig] + """Configuration for scalable_matrix_with_tiered_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_scalable_matrix_with_unit_pricing_price.py b/src/orb/types/shared_params/new_plan_scalable_matrix_with_unit_pricing_price.py index 650a6882..6fd976c6 100644 --- a/src/orb/types/shared_params/new_plan_scalable_matrix_with_unit_pricing_price.py +++ b/src/orb/types/shared_params/new_plan_scalable_matrix_with_unit_pricing_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,41 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanScalableMatrixWithUnitPricingPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanScalableMatrixWithUnitPricingPrice", + "ScalableMatrixWithUnitPricingConfig", + "ScalableMatrixWithUnitPricingConfigMatrixScalingFactor", + "ConversionRateConfig", +] + + +class ScalableMatrixWithUnitPricingConfigMatrixScalingFactor(TypedDict, total=False): + first_dimension_value: Required[str] + """First dimension value""" + + scaling_factor: Required[str] + """Scaling factor""" + + second_dimension_value: Optional[str] + """Second dimension value (optional)""" + + +class ScalableMatrixWithUnitPricingConfig(TypedDict, total=False): + first_dimension: Required[str] + """Used to determine the unit rate""" + + matrix_scaling_factors: Required[Iterable[ScalableMatrixWithUnitPricingConfigMatrixScalingFactor]] + """Apply a scaling factor to each dimension""" + + unit_price: Required[str] + """The final unit price to rate against the output of the matrix""" + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + + second_dimension: Optional[str] + """Used to determine the unit rate (optional)""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +57,13 @@ class NewPlanScalableMatrixWithUnitPricingPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["scalable_matrix_with_unit_pricing"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - scalable_matrix_with_unit_pricing_config: Required[Dict[str, object]] + scalable_matrix_with_unit_pricing_config: Required[ScalableMatrixWithUnitPricingConfig] + """Configuration for scalable_matrix_with_unit_pricing pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_threshold_total_amount_price.py b/src/orb/types/shared_params/new_plan_threshold_total_amount_price.py index 9bd75b47..ef1e9330 100644 --- a/src/orb/types/shared_params/new_plan_threshold_total_amount_price.py +++ b/src/orb/types/shared_params/new_plan_threshold_total_amount_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,32 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanThresholdTotalAmountPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanThresholdTotalAmountPrice", + "ThresholdTotalAmountConfig", + "ThresholdTotalAmountConfigConsumptionTable", + "ConversionRateConfig", +] + + +class ThresholdTotalAmountConfigConsumptionTable(TypedDict, total=False): + threshold: Required[str] + """Quantity threshold""" + + total_amount: Required[str] + """Total amount for this threshold""" + + +class ThresholdTotalAmountConfig(TypedDict, total=False): + consumption_table: Required[Iterable[ThresholdTotalAmountConfigConsumptionTable]] + """ + When the quantity consumed passes a provided threshold, the configured total + will be charged + """ + + prorate: Optional[bool] + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +48,13 @@ class NewPlanThresholdTotalAmountPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["threshold_total_amount"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - threshold_total_amount_config: Required[Dict[str, object]] + threshold_total_amount_config: Required[ThresholdTotalAmountConfig] + """Configuration for threshold_total_amount pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_tier_with_proration_price.py b/src/orb/types/shared_params/new_plan_tier_with_proration_price.py deleted file mode 100644 index a9414209..00000000 --- a/src/orb/types/shared_params/new_plan_tier_with_proration_price.py +++ /dev/null @@ -1,94 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from .unit_conversion_rate_config import UnitConversionRateConfig -from .tiered_conversion_rate_config import TieredConversionRateConfig -from .new_billing_cycle_configuration import NewBillingCycleConfiguration -from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration - -__all__ = ["NewPlanTierWithProrationPrice", "ConversionRateConfig"] - -ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] - - -class NewPlanTierWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] - """The cadence to bill for this price on.""" - - item_id: Required[str] - """The id of the item the price will be associated with.""" - - model_type: Required[Literal["tiered_with_proration"]] - - name: Required[str] - """The name of the price.""" - - tiered_with_proration_config: Required[Dict[str, object]] - - billable_metric_id: Optional[str] - """The id of the billable metric for the price. - - Only needed if the price is usage-based. - """ - - billed_in_advance: Optional[bool] - """ - If the Price represents a fixed cost, the price will be billed in-advance if - this is true, and in-arrears if this is false. - """ - - billing_cycle_configuration: Optional[NewBillingCycleConfiguration] - """ - For custom cadence: specifies the duration of the billing period in days or - months. - """ - - conversion_rate: Optional[float] - """The per unit conversion rate of the price currency to the invoicing currency.""" - - conversion_rate_config: Optional[ConversionRateConfig] - """The configuration for the rate of the price currency to the invoicing currency.""" - - currency: Optional[str] - """ - An ISO 4217 currency string, or custom pricing unit identifier, in which this - price is billed. - """ - - dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] - """For dimensional price: specifies a price group and dimension values""" - - external_price_id: Optional[str] - """An alias for the price.""" - - fixed_price_quantity: Optional[float] - """ - If the Price represents a fixed cost, this represents the quantity of units - applied. - """ - - invoice_grouping_key: Optional[str] - """The property used to group this price on an invoice""" - - invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] - """Within each billing cycle, specifies the cadence at which invoices are produced. - - If unspecified, a single invoice is produced per billing cycle. - """ - - metadata: Optional[Dict[str, Optional[str]]] - """User-specified key/value pairs for the resource. - - Individual keys can be removed by setting the value to `null`, and the entire - metadata mapping can be cleared by setting `metadata` to `null`. - """ - - reference_id: Optional[str] - """ - A transient ID that can be used to reference this price when adding adjustments - in the same API call. - """ diff --git a/src/orb/types/shared_params/new_plan_tiered_package_price.py b/src/orb/types/shared_params/new_plan_tiered_package_price.py index 00e50d44..714812d0 100644 --- a/src/orb/types/shared_params/new_plan_tiered_package_price.py +++ b/src/orb/types/shared_params/new_plan_tiered_package_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,27 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredPackagePrice", "ConversionRateConfig"] +__all__ = ["NewPlanTieredPackagePrice", "TieredPackageConfig", "TieredPackageConfigTier", "ConversionRateConfig"] + + +class TieredPackageConfigTier(TypedDict, total=False): + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageConfig(TypedDict, total=False): + package_size: Required[str] + """Package size""" + + tiers: Required[Iterable[TieredPackageConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +43,13 @@ class NewPlanTieredPackagePrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_config: Required[Dict[str, object]] + tiered_package_config: Required[TieredPackageConfig] + """Configuration for tiered_package pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_tiered_package_with_minimum_price.py b/src/orb/types/shared_params/new_plan_tiered_package_with_minimum_price.py index fef575b7..8dc0826c 100644 --- a/src/orb/types/shared_params/new_plan_tiered_package_with_minimum_price.py +++ b/src/orb/types/shared_params/new_plan_tiered_package_with_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,35 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredPackageWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanTieredPackageWithMinimumPrice", + "TieredPackageWithMinimumConfig", + "TieredPackageWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredPackageWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + per_unit: Required[str] + """Price per package""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + +class TieredPackageWithMinimumConfig(TypedDict, total=False): + package_size: Required[float] + """Package size""" + + tiers: Required[Iterable[TieredPackageWithMinimumConfigTier]] + """Apply tiered pricing after rounding up the quantity to the package size. + + Tiers are defined using exclusive lower bounds. + """ + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +51,13 @@ class NewPlanTieredPackageWithMinimumPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_package_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_package_with_minimum_config: Required[Dict[str, object]] + tiered_package_with_minimum_config: Required[TieredPackageWithMinimumConfig] + """Configuration for tiered_package_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_tiered_price.py b/src/orb/types/shared_params/new_plan_tiered_price.py index 37d03944..8a77a04b 100644 --- a/src/orb/types/shared_params/new_plan_tiered_price.py +++ b/src/orb/types/shared_params/new_plan_tiered_price.py @@ -24,11 +24,13 @@ class NewPlanTieredPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered"]] + """The pricing model type""" name: Required[str] """The name of the price.""" tiered_config: Required[TieredConfig] + """Configuration for tiered pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_tiered_with_minimum_price.py b/src/orb/types/shared_params/new_plan_tiered_with_minimum_price.py index 946bd174..2089ad16 100644 --- a/src/orb/types/shared_params/new_plan_tiered_with_minimum_price.py +++ b/src/orb/types/shared_params/new_plan_tiered_with_minimum_price.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .unit_conversion_rate_config import UnitConversionRateConfig @@ -10,7 +10,38 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanTieredWithMinimumPrice", "ConversionRateConfig"] +__all__ = [ + "NewPlanTieredWithMinimumPrice", + "TieredWithMinimumConfig", + "TieredWithMinimumConfigTier", + "ConversionRateConfig", +] + + +class TieredWithMinimumConfigTier(TypedDict, total=False): + minimum_amount: Required[str] + """Minimum amount""" + + tier_lower_bound: Required[str] + """Tier lower bound""" + + unit_amount: Required[str] + """Per unit amount""" + + +class TieredWithMinimumConfig(TypedDict, total=False): + tiers: Required[Iterable[TieredWithMinimumConfigTier]] + """Tiered pricing with a minimum amount dependent on the volume tier. + + Tiers are defined using exclusive lower bounds. + """ + + hide_zero_amount_tiers: bool + """If true, tiers with an accrued amount of 0 will not be included in the rating.""" + + prorate: bool + """If true, the unit price will be prorated to the billing period""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +54,13 @@ class NewPlanTieredWithMinimumPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["tiered_with_minimum"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - tiered_with_minimum_config: Required[Dict[str, object]] + tiered_with_minimum_config: Required[TieredWithMinimumConfig] + """Configuration for tiered_with_minimum pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_unit_price.py b/src/orb/types/shared_params/new_plan_unit_price.py index 1fd39a1a..b1c660d0 100644 --- a/src/orb/types/shared_params/new_plan_unit_price.py +++ b/src/orb/types/shared_params/new_plan_unit_price.py @@ -24,11 +24,13 @@ class NewPlanUnitPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit"]] + """The pricing model type""" name: Required[str] """The name of the price.""" unit_config: Required[UnitConfig] + """Configuration for unit pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_unit_with_percent_price.py b/src/orb/types/shared_params/new_plan_unit_with_percent_price.py index 9999bd7b..8b6eafe8 100644 --- a/src/orb/types/shared_params/new_plan_unit_with_percent_price.py +++ b/src/orb/types/shared_params/new_plan_unit_with_percent_price.py @@ -10,7 +10,16 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanUnitWithPercentPrice", "ConversionRateConfig"] +__all__ = ["NewPlanUnitWithPercentPrice", "UnitWithPercentConfig", "ConversionRateConfig"] + + +class UnitWithPercentConfig(TypedDict, total=False): + percent: Required[str] + """What percent, out of 100, of the calculated total to charge""" + + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +32,13 @@ class NewPlanUnitWithPercentPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_percent"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_percent_config: Required[Dict[str, object]] + unit_with_percent_config: Required[UnitWithPercentConfig] + """Configuration for unit_with_percent pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/new_plan_unit_with_proration_price.py b/src/orb/types/shared_params/new_plan_unit_with_proration_price.py index d7ffe5ff..0c72b3f7 100644 --- a/src/orb/types/shared_params/new_plan_unit_with_proration_price.py +++ b/src/orb/types/shared_params/new_plan_unit_with_proration_price.py @@ -10,7 +10,13 @@ from .new_billing_cycle_configuration import NewBillingCycleConfiguration from .new_dimensional_price_configuration import NewDimensionalPriceConfiguration -__all__ = ["NewPlanUnitWithProrationPrice", "ConversionRateConfig"] +__all__ = ["NewPlanUnitWithProrationPrice", "UnitWithProrationConfig", "ConversionRateConfig"] + + +class UnitWithProrationConfig(TypedDict, total=False): + unit_amount: Required[str] + """Rate per unit of usage""" + ConversionRateConfig: TypeAlias = Union[UnitConversionRateConfig, TieredConversionRateConfig] @@ -23,11 +29,13 @@ class NewPlanUnitWithProrationPrice(TypedDict, total=False): """The id of the item the price will be associated with.""" model_type: Required[Literal["unit_with_proration"]] + """The pricing model type""" name: Required[str] """The name of the price.""" - unit_with_proration_config: Required[Dict[str, object]] + unit_with_proration_config: Required[UnitWithProrationConfig] + """Configuration for unit_with_proration pricing""" billable_metric_id: Optional[str] """The id of the billable metric for the price. diff --git a/src/orb/types/shared_params/tier.py b/src/orb/types/shared_params/tier.py index e8583e37..23fa0b61 100644 --- a/src/orb/types/shared_params/tier.py +++ b/src/orb/types/shared_params/tier.py @@ -16,4 +16,7 @@ class Tier(TypedDict, total=False): """Amount per unit""" last_unit: Optional[float] - """Inclusive tier ending value. If null, this is treated as the last tier""" + """Inclusive tier ending value. + + This value is null if and only if this is the last tier. + """ diff --git a/src/orb/types/shared_params/unit_config.py b/src/orb/types/shared_params/unit_config.py index a677a6dc..d4947639 100644 --- a/src/orb/types/shared_params/unit_config.py +++ b/src/orb/types/shared_params/unit_config.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["UnitConfig"] @@ -10,3 +11,6 @@ class UnitConfig(TypedDict, total=False): unit_amount: Required[str] """Rate per unit of usage""" + + scaling_factor: Optional[float] + """Multiplier to scale rated quantity by""" diff --git a/src/orb/types/subscription_create_params.py b/src/orb/types/subscription_create_params.py index 851cd62e..93fe7d74 100644 --- a/src/orb/types/subscription_create_params.py +++ b/src/orb/types/subscription_create_params.py @@ -29,7 +29,6 @@ from .new_subscription_unit_with_percent_price_param import NewSubscriptionUnitWithPercentPriceParam from .new_subscription_grouped_allocation_price_param import NewSubscriptionGroupedAllocationPriceParam from .new_subscription_bulk_with_proration_price_param import NewSubscriptionBulkWithProrationPriceParam -from .new_subscription_tier_with_proration_price_param import NewSubscriptionTierWithProrationPriceParam from .new_subscription_tiered_with_minimum_price_param import NewSubscriptionTieredWithMinimumPriceParam from .new_subscription_unit_with_proration_price_param import NewSubscriptionUnitWithProrationPriceParam from .shared_params.billing_cycle_anchor_configuration import BillingCycleAnchorConfiguration @@ -61,7 +60,12 @@ "AddAdjustmentAdjustment", "AddPrice", "AddPricePrice", + "AddPricePriceNewSubscriptionTieredWithProrationPrice", + "AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig", + "AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier", + "AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig", "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice", + "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig", "RemoveAdjustment", "RemovePrice", @@ -69,7 +73,12 @@ "ReplaceAdjustmentAdjustment", "ReplacePrice", "ReplacePricePrice", + "ReplacePricePriceNewSubscriptionTieredWithProrationPrice", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig", "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice", + "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -271,6 +280,126 @@ class AddAdjustment(TypedDict, total=False): """ +class AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class AddPricePriceNewSubscriptionTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ + AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig + ] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -280,12 +409,16 @@ class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict, to cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -357,31 +490,31 @@ class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict, to AddPricePrice: TypeAlias = Union[ NewSubscriptionUnitPriceParam, - NewSubscriptionPackagePriceParam, - NewSubscriptionMatrixPriceParam, NewSubscriptionTieredPriceParam, NewSubscriptionBulkPriceParam, + NewSubscriptionPackagePriceParam, + NewSubscriptionMatrixPriceParam, NewSubscriptionThresholdTotalAmountPriceParam, NewSubscriptionTieredPackagePriceParam, NewSubscriptionTieredWithMinimumPriceParam, - NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionGroupedTieredPriceParam, + NewSubscriptionTieredPackageWithMinimumPriceParam, NewSubscriptionPackageWithAllocationPriceParam, - NewSubscriptionTierWithProrationPriceParam, + NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionMatrixWithAllocationPriceParam, + AddPricePriceNewSubscriptionTieredWithProrationPrice, NewSubscriptionUnitWithProrationPriceParam, NewSubscriptionGroupedAllocationPriceParam, - NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionBulkWithProrationPriceParam, - NewSubscriptionScalableMatrixWithUnitPricingPriceParam, - NewSubscriptionScalableMatrixWithTieredPricingPriceParam, - NewSubscriptionCumulativeGroupedBulkPriceParam, - NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionGroupedWithMeteredMinimumPriceParam, + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, NewSubscriptionMatrixWithDisplayNamePriceParam, NewSubscriptionGroupedTieredPackagePriceParam, - NewSubscriptionMatrixWithAllocationPriceParam, - NewSubscriptionTieredPackageWithMinimumPriceParam, - NewSubscriptionGroupedTieredPriceParam, - AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, + NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionScalableMatrixWithUnitPricingPriceParam, + NewSubscriptionScalableMatrixWithTieredPricingPriceParam, + NewSubscriptionCumulativeGroupedBulkPriceParam, NewSubscriptionMinimumCompositePriceParam, ] @@ -422,7 +555,7 @@ class AddPrice(TypedDict, total=False): """The phase to add this price to.""" price: Optional[AddPricePrice] - """The definition of a new price to create and add to the subscription.""" + """New subscription price request body params.""" price_id: Optional[str] """The id of the price to add to the subscription.""" @@ -461,6 +594,126 @@ class ReplaceAdjustment(TypedDict, total=False): """The id of the adjustment on the plan to replace in the subscription.""" +class ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class ReplacePricePriceNewSubscriptionTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ + ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig + ] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -470,12 +723,16 @@ class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -549,31 +806,31 @@ class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict ReplacePricePrice: TypeAlias = Union[ NewSubscriptionUnitPriceParam, - NewSubscriptionPackagePriceParam, - NewSubscriptionMatrixPriceParam, NewSubscriptionTieredPriceParam, NewSubscriptionBulkPriceParam, + NewSubscriptionPackagePriceParam, + NewSubscriptionMatrixPriceParam, NewSubscriptionThresholdTotalAmountPriceParam, NewSubscriptionTieredPackagePriceParam, NewSubscriptionTieredWithMinimumPriceParam, - NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionGroupedTieredPriceParam, + NewSubscriptionTieredPackageWithMinimumPriceParam, NewSubscriptionPackageWithAllocationPriceParam, - NewSubscriptionTierWithProrationPriceParam, + NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionMatrixWithAllocationPriceParam, + ReplacePricePriceNewSubscriptionTieredWithProrationPrice, NewSubscriptionUnitWithProrationPriceParam, NewSubscriptionGroupedAllocationPriceParam, - NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionBulkWithProrationPriceParam, - NewSubscriptionScalableMatrixWithUnitPricingPriceParam, - NewSubscriptionScalableMatrixWithTieredPricingPriceParam, - NewSubscriptionCumulativeGroupedBulkPriceParam, - NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionGroupedWithMeteredMinimumPriceParam, + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, NewSubscriptionMatrixWithDisplayNamePriceParam, NewSubscriptionGroupedTieredPackagePriceParam, - NewSubscriptionMatrixWithAllocationPriceParam, - NewSubscriptionTieredPackageWithMinimumPriceParam, - NewSubscriptionGroupedTieredPriceParam, - ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, + NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionScalableMatrixWithUnitPricingPriceParam, + NewSubscriptionScalableMatrixWithTieredPricingPriceParam, + NewSubscriptionCumulativeGroupedBulkPriceParam, NewSubscriptionMinimumCompositePriceParam, ] @@ -610,7 +867,7 @@ class ReplacePrice(TypedDict, total=False): """ price: Optional[ReplacePricePrice] - """The definition of a new price to create and add to the subscription.""" + """New subscription price request body params.""" price_id: Optional[str] """The id of the price to add to the subscription.""" diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 39461d58..88e5e50e 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -60,6 +60,7 @@ "AddFixedFeeQuantityTransition", "AddPrice", "AddPriceNewFloatingGroupedWithMinMaxThresholdsPrice", + "AddPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "AddPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig", "AddAdjustment", "AddAdjustmentAdjustment", @@ -132,6 +133,20 @@ class AddFixedFeeQuantityTransition(TypedDict, total=False): """The quantity of the fixed fee quantity transition.""" +class AddPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig(TypedDict, total=False): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + AddPriceNewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -144,12 +159,16 @@ class AddPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False currency: Required[str] """An ISO 4217 currency string for which this price is billed in.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + AddPriceNewFloatingGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -209,31 +228,31 @@ class AddPriceNewFloatingGroupedWithMinMaxThresholdsPrice(TypedDict, total=False AddPrice: TypeAlias = Union[ NewFloatingUnitPrice, - NewFloatingPackagePrice, - NewFloatingMatrixPrice, - NewFloatingMatrixWithAllocationPrice, NewFloatingTieredPrice, NewFloatingBulkPrice, + NewFloatingPackagePrice, + NewFloatingMatrixPrice, NewFloatingThresholdTotalAmountPrice, NewFloatingTieredPackagePrice, - NewFloatingGroupedTieredPrice, - NewFloatingMaxGroupTieredPackagePrice, NewFloatingTieredWithMinimumPrice, - NewFloatingPackageWithAllocationPrice, + NewFloatingGroupedTieredPrice, NewFloatingTieredPackageWithMinimumPrice, + NewFloatingPackageWithAllocationPrice, NewFloatingUnitWithPercentPrice, + NewFloatingMatrixWithAllocationPrice, NewFloatingTieredWithProrationPrice, NewFloatingUnitWithProrationPrice, NewFloatingGroupedAllocationPrice, + NewFloatingBulkWithProrationPrice, NewFloatingGroupedWithProratedMinimumPrice, NewFloatingGroupedWithMeteredMinimumPrice, + AddPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMatrixWithDisplayNamePrice, - NewFloatingBulkWithProrationPrice, NewFloatingGroupedTieredPackagePrice, + NewFloatingMaxGroupTieredPackagePrice, NewFloatingScalableMatrixWithUnitPricingPrice, NewFloatingScalableMatrixWithTieredPricingPrice, NewFloatingCumulativeGroupedBulkPrice, - AddPriceNewFloatingGroupedWithMinMaxThresholdsPrice, NewFloatingMinimumCompositePrice, ] @@ -286,7 +305,7 @@ class Add(TypedDict, total=False): """ price: Optional[AddPrice] - """The definition of a new price to create and add to the subscription.""" + """New floating price request body params.""" price_id: Optional[str] """The id of the price to add to the subscription.""" diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index ef98f326..cfc32943 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -29,7 +29,6 @@ from .new_subscription_unit_with_percent_price_param import NewSubscriptionUnitWithPercentPriceParam from .new_subscription_grouped_allocation_price_param import NewSubscriptionGroupedAllocationPriceParam from .new_subscription_bulk_with_proration_price_param import NewSubscriptionBulkWithProrationPriceParam -from .new_subscription_tier_with_proration_price_param import NewSubscriptionTierWithProrationPriceParam from .new_subscription_tiered_with_minimum_price_param import NewSubscriptionTieredWithMinimumPriceParam from .new_subscription_unit_with_proration_price_param import NewSubscriptionUnitWithProrationPriceParam from .shared_params.billing_cycle_anchor_configuration import BillingCycleAnchorConfiguration @@ -61,7 +60,12 @@ "AddAdjustmentAdjustment", "AddPrice", "AddPricePrice", + "AddPricePriceNewSubscriptionTieredWithProrationPrice", + "AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig", + "AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier", + "AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig", "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice", + "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig", "RemoveAdjustment", "RemovePrice", @@ -69,7 +73,12 @@ "ReplaceAdjustmentAdjustment", "ReplacePrice", "ReplacePricePrice", + "ReplacePricePriceNewSubscriptionTieredWithProrationPrice", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier", + "ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig", "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice", + "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig", "ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig", ] @@ -259,6 +268,126 @@ class AddAdjustment(TypedDict, total=False): """ +class AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class AddPricePriceNewSubscriptionTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ + AddPricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig + ] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[AddPricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -268,12 +397,16 @@ class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict, to cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -345,31 +478,31 @@ class AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict, to AddPricePrice: TypeAlias = Union[ NewSubscriptionUnitPriceParam, - NewSubscriptionPackagePriceParam, - NewSubscriptionMatrixPriceParam, NewSubscriptionTieredPriceParam, NewSubscriptionBulkPriceParam, + NewSubscriptionPackagePriceParam, + NewSubscriptionMatrixPriceParam, NewSubscriptionThresholdTotalAmountPriceParam, NewSubscriptionTieredPackagePriceParam, NewSubscriptionTieredWithMinimumPriceParam, - NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionGroupedTieredPriceParam, + NewSubscriptionTieredPackageWithMinimumPriceParam, NewSubscriptionPackageWithAllocationPriceParam, - NewSubscriptionTierWithProrationPriceParam, + NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionMatrixWithAllocationPriceParam, + AddPricePriceNewSubscriptionTieredWithProrationPrice, NewSubscriptionUnitWithProrationPriceParam, NewSubscriptionGroupedAllocationPriceParam, - NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionBulkWithProrationPriceParam, - NewSubscriptionScalableMatrixWithUnitPricingPriceParam, - NewSubscriptionScalableMatrixWithTieredPricingPriceParam, - NewSubscriptionCumulativeGroupedBulkPriceParam, - NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionGroupedWithMeteredMinimumPriceParam, + AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, NewSubscriptionMatrixWithDisplayNamePriceParam, NewSubscriptionGroupedTieredPackagePriceParam, - NewSubscriptionMatrixWithAllocationPriceParam, - NewSubscriptionTieredPackageWithMinimumPriceParam, - NewSubscriptionGroupedTieredPriceParam, - AddPricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, + NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionScalableMatrixWithUnitPricingPriceParam, + NewSubscriptionScalableMatrixWithTieredPricingPriceParam, + NewSubscriptionCumulativeGroupedBulkPriceParam, NewSubscriptionMinimumCompositePriceParam, ] @@ -410,7 +543,7 @@ class AddPrice(TypedDict, total=False): """The phase to add this price to.""" price: Optional[AddPricePrice] - """The definition of a new price to create and add to the subscription.""" + """New subscription price request body params.""" price_id: Optional[str] """The id of the price to add to the subscription.""" @@ -449,6 +582,126 @@ class ReplaceAdjustment(TypedDict, total=False): """The id of the adjustment on the plan to replace in the subscription.""" +class ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier(TypedDict, total=False): + tier_lower_bound: Required[str] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + +class ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig(TypedDict, total=False): + tiers: Required[Iterable[ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfigTier]] + """ + Tiers for rating based on total usage quantities into the specified tier with + proration + """ + + +ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig: TypeAlias = Union[ + UnitConversionRateConfig, TieredConversionRateConfig +] + + +class ReplacePricePriceNewSubscriptionTieredWithProrationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the price will be associated with.""" + + model_type: Required[Literal["tiered_with_proration"]] + """The pricing model type""" + + name: Required[str] + """The name of the price.""" + + tiered_with_proration_config: Required[ + ReplacePricePriceNewSubscriptionTieredWithProrationPriceTieredWithProrationConfig + ] + """Configuration for tiered_with_proration pricing""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + conversion_rate_config: Optional[ReplacePricePriceNewSubscriptionTieredWithProrationPriceConversionRateConfig] + """The configuration for the rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] + """For dimensional price: specifies a price group and dimension values""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewBillingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + metadata: Optional[Dict[str, Optional[str]]] + """User-specified key/value pairs for the resource. + + Individual keys can be removed by setting the value to `null`, and the entire + metadata mapping can be cleared by setting `metadata` to `null`. + """ + + reference_id: Optional[str] + """ + A transient ID that can be used to reference this price when adding adjustments + in the same API call. + """ + + +class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig( + TypedDict, total=False +): + grouping_key: Required[str] + """The event property used to group before applying thresholds""" + + maximum_charge: Required[str] + """The maximum amount to charge each group""" + + minimum_charge: Required[str] + """The minimum amount to charge each group, regardless of usage""" + + per_unit_rate: Required[str] + """The base price charged per group""" + + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceConversionRateConfig: TypeAlias = Union[ UnitConversionRateConfig, TieredConversionRateConfig ] @@ -458,12 +711,16 @@ class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" - grouped_with_min_max_thresholds_config: Required[Dict[str, object]] + grouped_with_min_max_thresholds_config: Required[ + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPriceGroupedWithMinMaxThresholdsConfig + ] + """Configuration for grouped_with_min_max_thresholds pricing""" item_id: Required[str] """The id of the item the price will be associated with.""" model_type: Required[Literal["grouped_with_min_max_thresholds"]] + """The pricing model type""" name: Required[str] """The name of the price.""" @@ -537,31 +794,31 @@ class ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice(TypedDict ReplacePricePrice: TypeAlias = Union[ NewSubscriptionUnitPriceParam, - NewSubscriptionPackagePriceParam, - NewSubscriptionMatrixPriceParam, NewSubscriptionTieredPriceParam, NewSubscriptionBulkPriceParam, + NewSubscriptionPackagePriceParam, + NewSubscriptionMatrixPriceParam, NewSubscriptionThresholdTotalAmountPriceParam, NewSubscriptionTieredPackagePriceParam, NewSubscriptionTieredWithMinimumPriceParam, - NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionGroupedTieredPriceParam, + NewSubscriptionTieredPackageWithMinimumPriceParam, NewSubscriptionPackageWithAllocationPriceParam, - NewSubscriptionTierWithProrationPriceParam, + NewSubscriptionUnitWithPercentPriceParam, + NewSubscriptionMatrixWithAllocationPriceParam, + ReplacePricePriceNewSubscriptionTieredWithProrationPrice, NewSubscriptionUnitWithProrationPriceParam, NewSubscriptionGroupedAllocationPriceParam, - NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionBulkWithProrationPriceParam, - NewSubscriptionScalableMatrixWithUnitPricingPriceParam, - NewSubscriptionScalableMatrixWithTieredPricingPriceParam, - NewSubscriptionCumulativeGroupedBulkPriceParam, - NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionGroupedWithProratedMinimumPriceParam, NewSubscriptionGroupedWithMeteredMinimumPriceParam, + ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, NewSubscriptionMatrixWithDisplayNamePriceParam, NewSubscriptionGroupedTieredPackagePriceParam, - NewSubscriptionMatrixWithAllocationPriceParam, - NewSubscriptionTieredPackageWithMinimumPriceParam, - NewSubscriptionGroupedTieredPriceParam, - ReplacePricePriceNewSubscriptionGroupedWithMinMaxThresholdsPrice, + NewSubscriptionMaxGroupTieredPackagePriceParam, + NewSubscriptionScalableMatrixWithUnitPricingPriceParam, + NewSubscriptionScalableMatrixWithTieredPricingPriceParam, + NewSubscriptionCumulativeGroupedBulkPriceParam, NewSubscriptionMinimumCompositePriceParam, ] @@ -598,7 +855,7 @@ class ReplacePrice(TypedDict, total=False): """ price: Optional[ReplacePricePrice] - """The definition of a new price to create and add to the subscription.""" + """New subscription price request body params.""" price_id: Optional[str] """The id of the price to add to the subscription.""" diff --git a/tests/api_resources/beta/test_external_plan_id.py b/tests/api_resources/beta/test_external_plan_id.py index 920332bf..8e848574 100644 --- a/tests/api_resources/beta/test_external_plan_id.py +++ b/tests/api_resources/beta/test_external_plan_id.py @@ -70,7 +70,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -154,7 +157,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -371,7 +377,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -455,7 +464,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_beta.py b/tests/api_resources/test_beta.py index 5b2987f2..10556dab 100644 --- a/tests/api_resources/test_beta.py +++ b/tests/api_resources/test_beta.py @@ -70,7 +70,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -154,7 +157,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -371,7 +377,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -455,7 +464,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index f7304550..d6363779 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -54,7 +54,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "name": "Line Item Name", "quantity": 1, "start_date": parse_date("2023-09-22"), - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, } ], customer_id="4khy3nwzktxv7", @@ -507,7 +510,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "name": "Line Item Name", "quantity": 1, "start_date": parse_date("2023-09-22"), - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, } ], customer_id="4khy3nwzktxv7", diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 590f1e77..c4d7d6c2 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -51,7 +51,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -308,7 +311,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index 6aacdd52..68f250db 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -44,7 +44,10 @@ def test_method_create_with_all_params_overload_1(self, client: Orb) -> None: item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "unit_amount"}, + unit_config={ + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -112,11 +115,15 @@ def test_method_create_overload_2(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) assert_matches_type(Price, price, path=["response"]) @@ -127,11 +134,16 @@ def test_method_create_with_all_params_overload_2(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + "last_unit": 0, + } + ] }, billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -166,11 +178,15 @@ def test_raw_response_create_overload_2(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) @@ -185,11 +201,15 @@ def test_streaming_response_create_overload_2(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) as response: assert not response.is_closed @@ -203,20 +223,11 @@ def test_streaming_response_create_overload_2(self, client: Orb) -> None: @parametrize def test_method_create_overload_3(self, client: Orb) -> None: price = client.prices.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -224,20 +235,18 @@ def test_method_create_overload_3(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: price = client.prices.create( - cadence="annual", - currency="currency", - item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ + bulk_config={ + "tiers": [ { - "dimension_values": ["string"], "unit_amount": "unit_amount", + "maximum_units": 0, } - ], + ] }, - model_type="matrix", + cadence="annual", + currency="currency", + item_id="item_id", + model_type="bulk", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -269,20 +278,11 @@ def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: @parametrize def test_raw_response_create_overload_3(self, client: Orb) -> None: response = client.prices.with_raw_response.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) @@ -294,20 +294,11 @@ def test_raw_response_create_overload_3(self, client: Orb) -> None: @parametrize def test_streaming_response_create_overload_3(self, client: Orb) -> None: with client.prices.with_streaming_response.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) as response: assert not response.is_closed @@ -324,19 +315,12 @@ def test_method_create_overload_4(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) assert_matches_type(Price, price, path=["response"]) @@ -346,19 +330,12 @@ def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -392,19 +369,12 @@ def test_raw_response_create_overload_4(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) assert response.is_closed is True @@ -418,19 +388,12 @@ def test_streaming_response_create_overload_4(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -446,16 +409,18 @@ def test_method_create_overload_5(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -465,17 +430,18 @@ def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", - "last_unit": 0, } - ] + ], }, + model_type="matrix", + name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -509,16 +475,18 @@ def test_raw_response_create_overload_5(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) assert response.is_closed is True @@ -532,16 +500,18 @@ def test_streaming_response_create_overload_5(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -554,31 +524,47 @@ def test_streaming_response_create_overload_5(self, client: Orb) -> None: @parametrize def test_method_create_overload_6(self, client: Orb) -> None: price = client.prices.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, ) assert_matches_type(Price, price, path=["response"]) @parametrize def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: price = client.prices.create( - bulk_config={ - "tiers": [ - { - "unit_amount": "unit_amount", - "maximum_units": 0, - } - ] - }, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ], + "prorate": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -609,15 +595,26 @@ def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: @parametrize def test_raw_response_create_overload_6(self, client: Orb) -> None: response = client.prices.with_raw_response.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", - ) - - assert response.is_closed is True + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, + ) + + assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" price = response.parse() assert_matches_type(Price, price, path=["response"]) @@ -625,12 +622,23 @@ def test_raw_response_create_overload_6(self, client: Orb) -> None: @parametrize def test_streaming_response_create_overload_6(self, client: Orb) -> None: with client.prices.with_streaming_response.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -646,9 +654,21 @@ def test_method_create_overload_7(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert_matches_type(Price, price, path=["response"]) @@ -658,9 +678,21 @@ def test_method_create_with_all_params_overload_7(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -694,9 +726,21 @@ def test_raw_response_create_overload_7(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert response.is_closed is True @@ -710,9 +754,21 @@ def test_streaming_response_create_overload_7(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -728,9 +784,22 @@ def test_method_create_overload_8(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) assert_matches_type(Price, price, path=["response"]) @@ -740,9 +809,24 @@ def test_method_create_with_all_params_overload_8(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + "hide_zero_amount_tiers": True, + "prorate": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -776,9 +860,22 @@ def test_raw_response_create_overload_8(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) assert response.is_closed is True @@ -792,9 +889,22 @@ def test_streaming_response_create_overload_8(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -809,7 +919,19 @@ def test_method_create_overload_9(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -821,7 +943,19 @@ def test_method_create_with_all_params_overload_9(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -857,7 +991,19 @@ def test_raw_response_create_overload_9(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -873,7 +1019,19 @@ def test_streaming_response_create_overload_9(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -892,9 +1050,23 @@ def test_method_create_overload_10(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert_matches_type(Price, price, path=["response"]) @@ -904,9 +1076,23 @@ def test_method_create_with_all_params_overload_10(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -940,9 +1126,23 @@ def test_raw_response_create_overload_10(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert response.is_closed is True @@ -956,9 +1156,23 @@ def test_streaming_response_create_overload_10(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -974,9 +1188,13 @@ def test_method_create_overload_11(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -986,9 +1204,13 @@ def test_method_create_with_all_params_overload_11(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1022,9 +1244,13 @@ def test_raw_response_create_overload_11(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) assert response.is_closed is True @@ -1038,9 +1264,13 @@ def test_streaming_response_create_overload_11(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1056,9 +1286,12 @@ def test_method_create_overload_12(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -1068,9 +1301,12 @@ def test_method_create_with_all_params_overload_12(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1104,9 +1340,12 @@ def test_raw_response_create_overload_12(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) assert response.is_closed is True @@ -1120,9 +1359,12 @@ def test_streaming_response_create_overload_12(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1138,9 +1380,19 @@ def test_method_create_overload_13(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1150,9 +1402,19 @@ def test_method_create_with_all_params_overload_13(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1186,9 +1448,19 @@ def test_raw_response_create_overload_13(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) assert response.is_closed is True @@ -1202,9 +1474,19 @@ def test_streaming_response_create_overload_13(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1220,21 +1502,35 @@ def test_method_create_overload_14(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, - ) - assert_matches_type(Price, price, path=["response"]) - - @parametrize + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize def test_method_create_with_all_params_overload_14(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1268,9 +1564,16 @@ def test_raw_response_create_overload_14(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, ) assert response.is_closed is True @@ -1284,9 +1587,16 @@ def test_streaming_response_create_overload_14(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1302,9 +1612,9 @@ def test_method_create_overload_15(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1314,9 +1624,9 @@ def test_method_create_with_all_params_overload_15(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1350,9 +1660,9 @@ def test_raw_response_create_overload_15(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) assert response.is_closed is True @@ -1366,9 +1676,9 @@ def test_streaming_response_create_overload_15(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1383,10 +1693,14 @@ def test_method_create_overload_16(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1395,10 +1709,14 @@ def test_method_create_with_all_params_overload_16(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -1431,10 +1749,14 @@ def test_raw_response_create_overload_16(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) assert response.is_closed is True @@ -1447,10 +1769,14 @@ def test_streaming_response_create_overload_16(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1463,11 +1789,11 @@ def test_streaming_response_create_overload_16(self, client: Orb) -> None: @parametrize def test_method_create_overload_17(self, client: Orb) -> None: price = client.prices.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -1475,11 +1801,22 @@ def test_method_create_overload_17(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params_overload_17(self, client: Orb) -> None: price = client.prices.create( + bulk_with_proration_config={ + "tiers": [ + { + "unit_amount": "unit_amount", + "tier_lower_bound": "tier_lower_bound", + }, + { + "unit_amount": "unit_amount", + "tier_lower_bound": "tier_lower_bound", + }, + ] + }, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -1511,11 +1848,11 @@ def test_method_create_with_all_params_overload_17(self, client: Orb) -> None: @parametrize def test_raw_response_create_overload_17(self, client: Orb) -> None: response = client.prices.with_raw_response.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) @@ -1527,11 +1864,11 @@ def test_raw_response_create_overload_17(self, client: Orb) -> None: @parametrize def test_streaming_response_create_overload_17(self, client: Orb) -> None: with client.prices.with_streaming_response.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) as response: assert not response.is_closed @@ -1547,7 +1884,11 @@ def test_method_create_overload_18(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -1559,7 +1900,11 @@ def test_method_create_with_all_params_overload_18(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -1595,7 +1940,11 @@ def test_raw_response_create_overload_18(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -1611,7 +1960,11 @@ def test_streaming_response_create_overload_18(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -1629,7 +1982,24 @@ def test_method_create_overload_19(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -1641,7 +2011,24 @@ def test_method_create_with_all_params_overload_19(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -1677,7 +2064,24 @@ def test_raw_response_create_overload_19(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -1693,7 +2097,24 @@ def test_streaming_response_create_overload_19(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -1711,9 +2132,14 @@ def test_method_create_overload_20(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -1723,9 +2149,14 @@ def test_method_create_with_all_params_overload_20(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -1759,9 +2190,14 @@ def test_raw_response_create_overload_20(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) @@ -1775,9 +2211,14 @@ def test_streaming_response_create_overload_20(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) as response: assert not response.is_closed @@ -1791,11 +2232,20 @@ def test_streaming_response_create_overload_20(self, client: Orb) -> None: @parametrize def test_method_create_overload_21(self, client: Orb) -> None: price = client.prices.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -1803,11 +2253,20 @@ def test_method_create_overload_21(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params_overload_21(self, client: Orb) -> None: price = client.prices.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -1839,11 +2298,20 @@ def test_method_create_with_all_params_overload_21(self, client: Orb) -> None: @parametrize def test_raw_response_create_overload_21(self, client: Orb) -> None: response = client.prices.with_raw_response.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) @@ -1855,11 +2323,20 @@ def test_raw_response_create_overload_21(self, client: Orb) -> None: @parametrize def test_streaming_response_create_overload_21(self, client: Orb) -> None: with client.prices.with_streaming_response.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) as response: assert not response.is_closed @@ -1875,7 +2352,20 @@ def test_method_create_overload_22(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -1887,7 +2377,20 @@ def test_method_create_with_all_params_overload_22(self, client: Orb) -> None: price = client.prices.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -1923,7 +2426,20 @@ def test_raw_response_create_overload_22(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -1939,7 +2455,20 @@ def test_streaming_response_create_overload_22(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -1958,9 +2487,22 @@ def test_method_create_overload_23(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1970,9 +2512,22 @@ def test_method_create_with_all_params_overload_23(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -2006,9 +2561,22 @@ def test_raw_response_create_overload_23(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) assert response.is_closed is True @@ -2022,9 +2590,22 @@ def test_streaming_response_create_overload_23(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2040,9 +2621,18 @@ def test_method_create_overload_24(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -2052,9 +2642,21 @@ def test_method_create_with_all_params_overload_24(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + "second_dimension_value": "second_dimension_value", + } + ], + "unit_price": "unit_price", + "prorate": True, + "second_dimension": "second_dimension", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -2088,9 +2690,18 @@ def test_raw_response_create_overload_24(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) assert response.is_closed is True @@ -2104,9 +2715,18 @@ def test_streaming_response_create_overload_24(self, client: Orb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2120,23 +2740,61 @@ def test_streaming_response_create_overload_24(self, client: Orb) -> None: def test_method_create_overload_25(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, - currency="currency", - item_id="item_id", - model_type="cumulative_grouped_bulk", - name="Annual fee", - ) - assert_matches_type(Price, price, path=["response"]) - - @parametrize - def test_method_create_with_all_params_overload_25(self, client: Orb) -> None: - price = client.prices.create( - cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_25(self, client: Orb) -> None: + price = client.prices.create( + cadence="annual", + currency="currency", + item_id="item_id", + model_type="scalable_matrix_with_tiered_pricing", + name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + "second_dimension_value": "second_dimension_value", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + "second_dimension": "second_dimension", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -2168,11 +2826,29 @@ def test_method_create_with_all_params_overload_25(self, client: Orb) -> None: def test_raw_response_create_overload_25(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, ) assert response.is_closed is True @@ -2184,11 +2860,29 @@ def test_raw_response_create_overload_25(self, client: Orb) -> None: def test_streaming_response_create_overload_25(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2202,10 +2896,19 @@ def test_streaming_response_create_overload_25(self, client: Orb) -> None: def test_method_create_overload_26(self, client: Orb) -> None: price = client.prices.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -2214,10 +2917,19 @@ def test_method_create_overload_26(self, client: Orb) -> None: def test_method_create_with_all_params_overload_26(self, client: Orb) -> None: price = client.prices.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -2250,10 +2962,19 @@ def test_method_create_with_all_params_overload_26(self, client: Orb) -> None: def test_raw_response_create_overload_26(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) @@ -2266,10 +2987,19 @@ def test_raw_response_create_overload_26(self, client: Orb) -> None: def test_streaming_response_create_overload_26(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) as response: assert not response.is_closed @@ -2529,7 +3259,10 @@ def test_method_evaluate_multiple_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2622,7 +3355,10 @@ def test_method_evaluate_preview_events_with_all_params(self, client: Orb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2744,7 +3480,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "unit_amount"}, + unit_config={ + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -2812,11 +3551,15 @@ async def test_method_create_overload_2(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) assert_matches_type(Price, price, path=["response"]) @@ -2827,11 +3570,16 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + "last_unit": 0, + } + ] }, billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -2866,11 +3614,15 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncOrb) -> N cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) @@ -2885,11 +3637,15 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncOrb cadence="annual", currency="currency", item_id="item_id", - model_type="package", + model_type="tiered", name="Annual fee", - package_config={ - "package_amount": "package_amount", - "package_size": 0, + tiered_config={ + "tiers": [ + { + "first_unit": 0, + "unit_amount": "unit_amount", + } + ] }, ) as response: assert not response.is_closed @@ -2903,20 +3659,11 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncOrb @parametrize async def test_method_create_overload_3(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -2924,20 +3671,18 @@ async def test_method_create_overload_3(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params_overload_3(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - cadence="annual", - currency="currency", - item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ + bulk_config={ + "tiers": [ { - "dimension_values": ["string"], "unit_amount": "unit_amount", + "maximum_units": 0, } - ], + ] }, - model_type="matrix", + cadence="annual", + currency="currency", + item_id="item_id", + model_type="bulk", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -2969,20 +3714,11 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn @parametrize async def test_raw_response_create_overload_3(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) @@ -2994,20 +3730,11 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncOrb) -> N @parametrize async def test_streaming_response_create_overload_3(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( + bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - matrix_config={ - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix", + model_type="bulk", name="Annual fee", ) as response: assert not response.is_closed @@ -3024,19 +3751,12 @@ async def test_method_create_overload_4(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3046,19 +3766,12 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3092,19 +3805,12 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncOrb) -> N cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) assert response.is_closed is True @@ -3118,19 +3824,12 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncOrb cadence="annual", currency="currency", item_id="item_id", - matrix_with_allocation_config={ - "allocation": 0, - "default_unit_amount": "default_unit_amount", - "dimensions": ["string"], - "matrix_values": [ - { - "dimension_values": ["string"], - "unit_amount": "unit_amount", - } - ], - }, - model_type="matrix_with_allocation", + model_type="package", name="Annual fee", + package_config={ + "package_amount": "package_amount", + "package_size": 1, + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3146,16 +3845,18 @@ async def test_method_create_overload_5(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -3165,17 +3866,18 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", - "last_unit": 0, } - ] + ], }, + model_type="matrix", + name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3209,16 +3911,18 @@ async def test_raw_response_create_overload_5(self, async_client: AsyncOrb) -> N cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) assert response.is_closed is True @@ -3232,16 +3936,18 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncOrb cadence="annual", currency="currency", item_id="item_id", - model_type="tiered", - name="Annual fee", - tiered_config={ - "tiers": [ + matrix_config={ + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ { - "first_unit": 0, + "dimension_values": ["string"], "unit_amount": "unit_amount", } - ] + ], }, + model_type="matrix", + name="Annual fee", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3254,31 +3960,47 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncOrb @parametrize async def test_method_create_overload_6(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, ) assert_matches_type(Price, price, path=["response"]) @parametrize async def test_method_create_with_all_params_overload_6(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - bulk_config={ - "tiers": [ - { - "unit_amount": "unit_amount", - "maximum_units": 0, - } - ] - }, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ], + "prorate": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3309,12 +4031,23 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn @parametrize async def test_raw_response_create_overload_6(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, ) assert response.is_closed is True @@ -3325,12 +4058,23 @@ async def test_raw_response_create_overload_6(self, async_client: AsyncOrb) -> N @parametrize async def test_streaming_response_create_overload_6(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( - bulk_config={"tiers": [{"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk", + model_type="threshold_total_amount", name="Annual fee", + threshold_total_amount_config={ + "consumption_table": [ + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + { + "threshold": "threshold", + "total_amount": "total_amount", + }, + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3346,9 +4090,21 @@ async def test_method_create_overload_7(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3358,9 +4114,21 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3394,9 +4162,21 @@ async def test_raw_response_create_overload_7(self, async_client: AsyncOrb) -> N cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert response.is_closed is True @@ -3410,9 +4190,21 @@ async def test_streaming_response_create_overload_7(self, async_client: AsyncOrb cadence="annual", currency="currency", item_id="item_id", - model_type="threshold_total_amount", + model_type="tiered_package", name="Annual fee", - threshold_total_amount_config={"foo": "bar"}, + tiered_package_config={ + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3428,9 +4220,22 @@ async def test_method_create_overload_8(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3440,9 +4245,24 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + "hide_zero_amount_tiers": True, + "prorate": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3476,9 +4296,22 @@ async def test_raw_response_create_overload_8(self, async_client: AsyncOrb) -> N cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) assert response.is_closed is True @@ -3492,9 +4325,22 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncOrb cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package", + model_type="tiered_with_minimum", name="Annual fee", - tiered_package_config={"foo": "bar"}, + tiered_with_minimum_config={ + "tiers": [ + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "minimum_amount": "minimum_amount", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3509,7 +4355,19 @@ async def test_method_create_overload_9(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -3521,7 +4379,19 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -3557,7 +4427,19 @@ async def test_raw_response_create_overload_9(self, async_client: AsyncOrb) -> N response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -3573,7 +4455,19 @@ async def test_streaming_response_create_overload_9(self, async_client: AsyncOrb async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_tiered_config={"foo": "bar"}, + grouped_tiered_config={ + "grouping_key": "x", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, item_id="item_id", model_type="grouped_tiered", name="Annual fee", @@ -3592,9 +4486,23 @@ async def test_method_create_overload_10(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3604,9 +4512,23 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3640,9 +4562,23 @@ async def test_raw_response_create_overload_10(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) assert response.is_closed is True @@ -3656,9 +4592,23 @@ async def test_streaming_response_create_overload_10(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - max_group_tiered_package_config={"foo": "bar"}, - model_type="max_group_tiered_package", + model_type="tiered_package_with_minimum", name="Annual fee", + tiered_package_with_minimum_config={ + "package_size": 0, + "tiers": [ + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "minimum_amount": "minimum_amount", + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3674,9 +4624,13 @@ async def test_method_create_overload_11(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3686,9 +4640,13 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3722,9 +4680,13 @@ async def test_raw_response_create_overload_11(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) assert response.is_closed is True @@ -3738,9 +4700,13 @@ async def test_streaming_response_create_overload_11(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_minimum", + model_type="package_with_allocation", name="Annual fee", - tiered_with_minimum_config={"foo": "bar"}, + package_with_allocation_config={ + "allocation": "allocation", + "package_amount": "package_amount", + "package_size": "package_size", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3756,9 +4722,12 @@ async def test_method_create_overload_12(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3768,9 +4737,12 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3804,9 +4776,12 @@ async def test_raw_response_create_overload_12(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) assert response.is_closed is True @@ -3820,9 +4795,12 @@ async def test_streaming_response_create_overload_12(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="package_with_allocation", + model_type="unit_with_percent", name="Annual fee", - package_with_allocation_config={"foo": "bar"}, + unit_with_percent_config={ + "percent": "percent", + "unit_amount": "unit_amount", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3838,9 +4816,19 @@ async def test_method_create_overload_13(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -3850,9 +4838,19 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3886,9 +4884,19 @@ async def test_raw_response_create_overload_13(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) assert response.is_closed is True @@ -3902,9 +4910,19 @@ async def test_streaming_response_create_overload_13(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_package_with_minimum", + matrix_with_allocation_config={ + "allocation": "allocation", + "default_unit_amount": "default_unit_amount", + "dimensions": ["string"], + "matrix_values": [ + { + "dimension_values": ["string"], + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_allocation", name="Annual fee", - tiered_package_with_minimum_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -3920,9 +4938,16 @@ async def test_method_create_overload_14(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, ) assert_matches_type(Price, price, path=["response"]) @@ -3932,9 +4957,16 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3968,9 +5000,16 @@ async def test_raw_response_create_overload_14(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, ) assert response.is_closed is True @@ -3984,9 +5023,16 @@ async def test_streaming_response_create_overload_14(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="unit_with_percent", + model_type="tiered_with_proration", name="Annual fee", - unit_with_percent_config={"foo": "bar"}, + tiered_with_proration_config={ + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ] + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4002,9 +5048,9 @@ async def test_method_create_overload_15(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) assert_matches_type(Price, price, path=["response"]) @@ -4014,9 +5060,9 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -4050,9 +5096,9 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) assert response.is_closed is True @@ -4066,9 +5112,9 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="tiered_with_proration", + model_type="unit_with_proration", name="Annual fee", - tiered_with_proration_config={"foo": "bar"}, + unit_with_proration_config={"unit_amount": "unit_amount"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4083,10 +5129,14 @@ async def test_method_create_overload_16(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -4095,10 +5145,14 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy price = await async_client.prices.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -4131,10 +5185,14 @@ async def test_raw_response_create_overload_16(self, async_client: AsyncOrb) -> response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) assert response.is_closed is True @@ -4147,10 +5205,14 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncOr async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", + grouped_allocation_config={ + "allocation": "allocation", + "grouping_key": "x", + "overage_unit_rate": "overage_unit_rate", + }, item_id="item_id", - model_type="unit_with_proration", + model_type="grouped_allocation", name="Annual fee", - unit_with_proration_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4163,11 +5225,11 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncOr @parametrize async def test_method_create_overload_17(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -4175,11 +5237,22 @@ async def test_method_create_overload_17(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params_overload_17(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( + bulk_with_proration_config={ + "tiers": [ + { + "unit_amount": "unit_amount", + "tier_lower_bound": "tier_lower_bound", + }, + { + "unit_amount": "unit_amount", + "tier_lower_bound": "tier_lower_bound", + }, + ] + }, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -4211,11 +5284,11 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy @parametrize async def test_raw_response_create_overload_17(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) @@ -4227,11 +5300,11 @@ async def test_raw_response_create_overload_17(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_create_overload_17(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( + bulk_with_proration_config={"tiers": [{"unit_amount": "unit_amount"}, {"unit_amount": "unit_amount"}]}, cadence="annual", currency="currency", - grouped_allocation_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_allocation", + model_type="bulk_with_proration", name="Annual fee", ) as response: assert not response.is_closed @@ -4247,7 +5320,11 @@ async def test_method_create_overload_18(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -4259,7 +5336,11 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -4295,7 +5376,11 @@ async def test_raw_response_create_overload_18(self, async_client: AsyncOrb) -> response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -4311,7 +5396,11 @@ async def test_streaming_response_create_overload_18(self, async_client: AsyncOr async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_with_prorated_minimum_config={"foo": "bar"}, + grouped_with_prorated_minimum_config={ + "grouping_key": "x", + "minimum": "minimum", + "unit_rate": "unit_rate", + }, item_id="item_id", model_type="grouped_with_prorated_minimum", name="Annual fee", @@ -4329,7 +5418,24 @@ async def test_method_create_overload_19(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -4341,7 +5447,24 @@ async def test_method_create_with_all_params_overload_19(self, async_client: Asy price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -4377,7 +5500,24 @@ async def test_raw_response_create_overload_19(self, async_client: AsyncOrb) -> response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -4393,7 +5533,24 @@ async def test_streaming_response_create_overload_19(self, async_client: AsyncOr async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_with_metered_minimum_config={"foo": "bar"}, + grouped_with_metered_minimum_config={ + "grouping_key": "x", + "minimum_unit_amount": "minimum_unit_amount", + "pricing_key": "pricing_key", + "scaling_factors": [ + { + "scaling_factor": "scaling_factor", + "scaling_value": "scaling_value", + } + ], + "scaling_key": "scaling_key", + "unit_amounts": [ + { + "pricing_value": "pricing_value", + "unit_amount": "unit_amount", + } + ], + }, item_id="item_id", model_type="grouped_with_metered_minimum", name="Annual fee", @@ -4411,9 +5568,14 @@ async def test_method_create_overload_20(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -4423,9 +5585,14 @@ async def test_method_create_with_all_params_overload_20(self, async_client: Asy price = await async_client.prices.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -4459,9 +5626,14 @@ async def test_raw_response_create_overload_20(self, async_client: AsyncOrb) -> response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) @@ -4475,9 +5647,14 @@ async def test_streaming_response_create_overload_20(self, async_client: AsyncOr async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", + grouped_with_min_max_thresholds_config={ + "grouping_key": "x", + "maximum_charge": "maximum_charge", + "minimum_charge": "minimum_charge", + "per_unit_rate": "per_unit_rate", + }, item_id="item_id", - matrix_with_display_name_config={"foo": "bar"}, - model_type="matrix_with_display_name", + model_type="grouped_with_min_max_thresholds", name="Annual fee", ) as response: assert not response.is_closed @@ -4491,11 +5668,20 @@ async def test_streaming_response_create_overload_20(self, async_client: AsyncOr @parametrize async def test_method_create_overload_21(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -4503,11 +5689,20 @@ async def test_method_create_overload_21(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params_overload_21(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -4539,11 +5734,20 @@ async def test_method_create_with_all_params_overload_21(self, async_client: Asy @parametrize async def test_raw_response_create_overload_21(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) @@ -4555,11 +5759,20 @@ async def test_raw_response_create_overload_21(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_create_overload_21(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( - bulk_with_proration_config={"foo": "bar"}, cadence="annual", currency="currency", item_id="item_id", - model_type="bulk_with_proration", + matrix_with_display_name_config={ + "dimension": "dimension", + "unit_amounts": [ + { + "dimension_value": "dimension_value", + "display_name": "display_name", + "unit_amount": "unit_amount", + } + ], + }, + model_type="matrix_with_display_name", name="Annual fee", ) as response: assert not response.is_closed @@ -4575,7 +5788,20 @@ async def test_method_create_overload_22(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -4587,7 +5813,20 @@ async def test_method_create_with_all_params_overload_22(self, async_client: Asy price = await async_client.prices.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -4623,7 +5862,20 @@ async def test_raw_response_create_overload_22(self, async_client: AsyncOrb) -> response = await async_client.prices.with_raw_response.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -4639,7 +5891,20 @@ async def test_streaming_response_create_overload_22(self, async_client: AsyncOr async with async_client.prices.with_streaming_response.create( cadence="annual", currency="currency", - grouped_tiered_package_config={"foo": "bar"}, + grouped_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + { + "per_unit": "per_unit", + "tier_lower_bound": "tier_lower_bound", + }, + ], + }, item_id="item_id", model_type="grouped_tiered_package", name="Annual fee", @@ -4658,9 +5923,22 @@ async def test_method_create_overload_23(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) assert_matches_type(Price, price, path=["response"]) @@ -4670,9 +5948,22 @@ async def test_method_create_with_all_params_overload_23(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -4706,9 +5997,22 @@ async def test_raw_response_create_overload_23(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) assert response.is_closed is True @@ -4722,9 +6026,22 @@ async def test_streaming_response_create_overload_23(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_unit_pricing", + max_group_tiered_package_config={ + "grouping_key": "x", + "package_size": "package_size", + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, + model_type="max_group_tiered_package", name="Annual fee", - scalable_matrix_with_unit_pricing_config={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4740,9 +6057,18 @@ async def test_method_create_overload_24(self, async_client: AsyncOrb) -> None: cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) assert_matches_type(Price, price, path=["response"]) @@ -4752,9 +6078,21 @@ async def test_method_create_with_all_params_overload_24(self, async_client: Asy cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + "second_dimension_value": "second_dimension_value", + } + ], + "unit_price": "unit_price", + "prorate": True, + "second_dimension": "second_dimension", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -4788,9 +6126,18 @@ async def test_raw_response_create_overload_24(self, async_client: AsyncOrb) -> cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) assert response.is_closed is True @@ -4804,9 +6151,18 @@ async def test_streaming_response_create_overload_24(self, async_client: AsyncOr cadence="annual", currency="currency", item_id="item_id", - model_type="scalable_matrix_with_tiered_pricing", + model_type="scalable_matrix_with_unit_pricing", name="Annual fee", - scalable_matrix_with_tiered_pricing_config={"foo": "bar"}, + scalable_matrix_with_unit_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "unit_price": "unit_price", + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4820,11 +6176,29 @@ async def test_streaming_response_create_overload_24(self, async_client: AsyncOr async def test_method_create_overload_25(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, ) assert_matches_type(Price, price, path=["response"]) @@ -4832,11 +6206,31 @@ async def test_method_create_overload_25(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_25(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + "second_dimension_value": "second_dimension_value", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + "second_dimension": "second_dimension", + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -4868,11 +6262,29 @@ async def test_method_create_with_all_params_overload_25(self, async_client: Asy async def test_raw_response_create_overload_25(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, ) assert response.is_closed is True @@ -4884,11 +6296,29 @@ async def test_raw_response_create_overload_25(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_25(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - cumulative_grouped_bulk_config={"foo": "bar"}, currency="currency", item_id="item_id", - model_type="cumulative_grouped_bulk", + model_type="scalable_matrix_with_tiered_pricing", name="Annual fee", + scalable_matrix_with_tiered_pricing_config={ + "first_dimension": "first_dimension", + "matrix_scaling_factors": [ + { + "first_dimension_value": "first_dimension_value", + "scaling_factor": "scaling_factor", + } + ], + "tiers": [ + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + { + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + }, + ], + }, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -4902,10 +6332,19 @@ async def test_streaming_response_create_overload_25(self, async_client: AsyncOr async def test_method_create_overload_26(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) assert_matches_type(Price, price, path=["response"]) @@ -4914,10 +6353,19 @@ async def test_method_create_overload_26(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_26(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -4950,10 +6398,19 @@ async def test_method_create_with_all_params_overload_26(self, async_client: Asy async def test_raw_response_create_overload_26(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) @@ -4966,10 +6423,19 @@ async def test_raw_response_create_overload_26(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_26(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", + cumulative_grouped_bulk_config={ + "dimension_values": [ + { + "grouping_key": "x", + "tier_lower_bound": "tier_lower_bound", + "unit_amount": "unit_amount", + } + ], + "group": "group", + }, currency="currency", - grouped_with_min_max_thresholds_config={"foo": "bar"}, item_id="item_id", - model_type="grouped_with_min_max_thresholds", + model_type="cumulative_grouped_bulk", name="Annual fee", ) as response: assert not response.is_closed @@ -5229,7 +6695,10 @@ async def test_method_evaluate_multiple_with_all_params(self, async_client: Asyn "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -5322,7 +6791,10 @@ async def test_method_evaluate_preview_events_with_all_params(self, async_client "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 473162db..9e57a529 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -87,7 +87,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -206,7 +209,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -652,7 +658,10 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -888,7 +897,10 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1000,7 +1012,10 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1412,7 +1427,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1531,7 +1549,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1977,7 +1998,10 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2213,7 +2237,10 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2325,7 +2352,10 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "scaling_factor": 0, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/test_models.py b/tests/test_models.py index dbf441e1..c35d58e0 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -8,7 +8,7 @@ from pydantic import Field from orb._utils import PropertyInfo -from orb._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from orb._compat import PYDANTIC_V1, parse_obj, model_dump, model_json from orb._models import BaseModel, construct_type @@ -294,12 +294,12 @@ class Model(BaseModel): assert cast(bool, m.foo) is True m = Model.construct(foo={"name": 3}) - if PYDANTIC_V2: - assert isinstance(m.foo, Submodel1) - assert m.foo.name == 3 # type: ignore - else: + if PYDANTIC_V1: assert isinstance(m.foo, Submodel2) assert m.foo.name == "3" + else: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore def test_list_of_unions() -> None: @@ -426,10 +426,10 @@ class Model(BaseModel): expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) - if PYDANTIC_V2: - expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' - else: + if PYDANTIC_V1: expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + else: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' model = Model.construct(created_at="2019-12-27T18:11:19.117Z") assert model.created_at == expected @@ -531,7 +531,7 @@ class Model2(BaseModel): assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} assert m4.to_dict(mode="json") == {"created_at": time_str} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -556,7 +556,7 @@ class Model(BaseModel): assert m3.model_dump() == {"foo": None} assert m3.model_dump(exclude_none=True) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) @@ -580,10 +580,10 @@ class Model(BaseModel): assert json.loads(m.to_json()) == {"FOO": "hello"} assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} - if PYDANTIC_V2: - assert m.to_json(indent=None) == '{"FOO":"hello"}' - else: + if PYDANTIC_V1: assert m.to_json(indent=None) == '{"FOO": "hello"}' + else: + assert m.to_json(indent=None) == '{"FOO":"hello"}' m2 = Model() assert json.loads(m2.to_json()) == {} @@ -595,7 +595,7 @@ class Model(BaseModel): assert json.loads(m3.to_json()) == {"FOO": None} assert json.loads(m3.to_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_json(warnings=False) @@ -622,7 +622,7 @@ class Model(BaseModel): assert json.loads(m3.model_dump_json()) == {"foo": None} assert json.loads(m3.model_dump_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump_json(round_trip=True) @@ -679,12 +679,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_unknown_variant() -> None: @@ -768,12 +768,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.foo_type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: @@ -833,7 +833,7 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) # pyright: ignore @@ -849,7 +849,7 @@ class Model(BaseModel): assert m.union == "bar" -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_field_named_cls() -> None: class Model(BaseModel): cls: str @@ -936,7 +936,7 @@ class Type2(BaseModel): assert isinstance(model.value, InnerType2) -@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2 for now") def test_extra_properties() -> None: class Item(BaseModel): prop: int diff --git a/tests/test_transform.py b/tests/test_transform.py index 828a693e..ac4c3452 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -15,7 +15,7 @@ parse_datetime, async_transform as _async_transform, ) -from orb._compat import PYDANTIC_V2 +from orb._compat import PYDANTIC_V1 from orb._models import BaseModel _T = TypeVar("_T") @@ -189,7 +189,7 @@ class DateModel(BaseModel): @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") - tz = "Z" if PYDANTIC_V2 else "+00:00" + tz = "+00:00" if PYDANTIC_V1 else "Z" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] @@ -297,11 +297,11 @@ async def test_pydantic_unknown_field(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_types(use_async: bool) -> None: model = MyModel.construct(foo=True) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": True} @@ -309,11 +309,11 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_object_type(use_async: bool) -> None: model = MyModel.construct(foo=MyModel.construct(hello="world")) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": {"hello": "world"}} diff --git a/tests/test_utils/test_datetime_parse.py b/tests/test_utils/test_datetime_parse.py new file mode 100644 index 00000000..57c331ff --- /dev/null +++ b/tests/test_utils/test_datetime_parse.py @@ -0,0 +1,110 @@ +""" +Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py +with modifications so it works without pydantic v1 imports. +""" + +from typing import Type, Union +from datetime import date, datetime, timezone, timedelta + +import pytest + +from orb._utils import parse_date, parse_datetime + + +def create_tz(minutes: int) -> timezone: + return timezone(timedelta(minutes=minutes)) + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + ("1494012444.883309", date(2017, 5, 5)), + (b"1494012444.883309", date(2017, 5, 5)), + (1_494_012_444.883_309, date(2017, 5, 5)), + ("1494012444", date(2017, 5, 5)), + (1_494_012_444, date(2017, 5, 5)), + (0, date(1970, 1, 1)), + ("2012-04-23", date(2012, 4, 23)), + (b"2012-04-23", date(2012, 4, 23)), + ("2012-4-9", date(2012, 4, 9)), + (date(2012, 4, 9), date(2012, 4, 9)), + (datetime(2012, 4, 9, 12, 15), date(2012, 4, 9)), + # Invalid inputs + ("x20120423", ValueError), + ("2012-04-56", ValueError), + (19_999_999_999, date(2603, 10, 11)), # just before watershed + (20_000_000_001, date(1970, 8, 20)), # just after watershed + (1_549_316_052, date(2019, 2, 4)), # nowish in s + (1_549_316_052_104, date(2019, 2, 4)), # nowish in ms + (1_549_316_052_104_324, date(2019, 2, 4)), # nowish in μs + (1_549_316_052_104_324_096, date(2019, 2, 4)), # nowish in ns + ("infinity", date(9999, 12, 31)), + ("inf", date(9999, 12, 31)), + (float("inf"), date(9999, 12, 31)), + ("infinity ", date(9999, 12, 31)), + (int("1" + "0" * 100), date(9999, 12, 31)), + (1e1000, date(9999, 12, 31)), + ("-infinity", date(1, 1, 1)), + ("-inf", date(1, 1, 1)), + ("nan", ValueError), + ], +) +def test_date_parsing(value: Union[str, bytes, int, float], result: Union[date, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_date(value) + else: + assert parse_date(value) == result + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + # values in seconds + ("1494012444.883309", datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + (1_494_012_444.883_309, datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + ("1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (b"1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (1_494_012_444, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + # values in ms + ("1494012444000.883309", datetime(2017, 5, 5, 19, 27, 24, 883, tzinfo=timezone.utc)), + ("-1494012444000.883309", datetime(1922, 8, 29, 4, 32, 35, 999117, tzinfo=timezone.utc)), + (1_494_012_444_000, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + ("2012-04-23T09:15:00", datetime(2012, 4, 23, 9, 15)), + ("2012-4-9 4:8:16", datetime(2012, 4, 9, 4, 8, 16)), + ("2012-04-23T09:15:00Z", datetime(2012, 4, 23, 9, 15, 0, 0, timezone.utc)), + ("2012-4-9 4:8:16-0320", datetime(2012, 4, 9, 4, 8, 16, 0, create_tz(-200))), + ("2012-04-23T10:20:30.400+02:30", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(150))), + ("2012-04-23T10:20:30.400+02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(120))), + ("2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (b"2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (datetime(2017, 5, 5), datetime(2017, 5, 5)), + (0, datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)), + # Invalid inputs + ("x20120423091500", ValueError), + ("2012-04-56T09:15:90", ValueError), + ("2012-04-23T11:05:00-25:00", ValueError), + (19_999_999_999, datetime(2603, 10, 11, 11, 33, 19, tzinfo=timezone.utc)), # just before watershed + (20_000_000_001, datetime(1970, 8, 20, 11, 33, 20, 1000, tzinfo=timezone.utc)), # just after watershed + (1_549_316_052, datetime(2019, 2, 4, 21, 34, 12, 0, tzinfo=timezone.utc)), # nowish in s + (1_549_316_052_104, datetime(2019, 2, 4, 21, 34, 12, 104_000, tzinfo=timezone.utc)), # nowish in ms + (1_549_316_052_104_324, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in μs + (1_549_316_052_104_324_096, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in ns + ("infinity", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf ", datetime(9999, 12, 31, 23, 59, 59, 999999)), + (1e50, datetime(9999, 12, 31, 23, 59, 59, 999999)), + (float("inf"), datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("-infinity", datetime(1, 1, 1, 0, 0)), + ("-inf", datetime(1, 1, 1, 0, 0)), + ("nan", ValueError), + ], +) +def test_datetime_parsing(value: Union[str, bytes, int, float], result: Union[datetime, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_datetime(value) + else: + assert parse_datetime(value) == result diff --git a/tests/utils.py b/tests/utils.py index da8e194f..db0cb1be 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -19,7 +19,7 @@ is_annotated_type, is_type_alias_type, ) -from orb._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from orb._compat import PYDANTIC_V1, field_outer_type, get_model_fields from orb._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) @@ -28,12 +28,12 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: for name, field in get_model_fields(model).items(): field_value = getattr(value, name) - if PYDANTIC_V2: - allow_none = False - else: + if PYDANTIC_V1: # in v1 nullability was structured differently # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields allow_none = getattr(field, "allow_none", False) + else: + allow_none = False assert_matches_type( field_outer_type(field),