Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 91
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-303379b9db577b964d46fe908e8226e95c60435b11ddd8685bf2fa99c57f4320.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-8cdbf902afe6295b1eee73576b55f8461c36179fd59e5f12cfeb6a3372c08904.yml
168 changes: 166 additions & 2 deletions src/orb/resources/prices/prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,84 @@ def create(
"""
...

@overload
def create(
self,
*,
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"],
name: str,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN,
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN,
invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Price:
"""This endpoint is used to create a [price](../reference/price).

A price created
using this endpoint is always an add-on, meaning that it’s not associated with a
specific plan and can instead be individually added to subscriptions, including
subscriptions on different plans.

An `external_price_id` can be optionally specified as an alias to allow
ergonomic interaction with prices in the Orb API.

See the [Price resource](../reference/price) for the specification of different
price model configurations possible in this endpoint.

Args:
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 plan will be associated with.

name: The name of the price.

billable_metric_id: The id of the billable metric for the price. Only needed if the price is
usage-based.

billed_in_advance: 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.

conversion_rate: The per unit conversion rate of the price currency to the invoicing currency.

external_price_id: An alias for the price.

fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units
applied.

invoice_grouping_key: The property used to group this price on an invoice

metadata: 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`.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
...

@required_args(
["cadence", "currency", "item_id", "model_type", "name", "unit_config"],
["cadence", "currency", "item_id", "model_type", "name", "package_config"],
Expand All @@ -1471,6 +1549,7 @@ def create(
["cadence", "currency", "item_id", "model_type", "name", "unit_with_percent_config"],
["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"],
)
def create(
self,
Expand All @@ -1495,7 +1574,8 @@ def create(
| Literal["tiered_package_with_minimum"]
| Literal["unit_with_percent"]
| Literal["tiered_with_proration"]
| Literal["unit_with_proration"],
| Literal["unit_with_proration"]
| Literal["grouped_allocation"],
name: str,
unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1523,6 +1603,7 @@ def create(
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,
# 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.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -1567,6 +1648,7 @@ def create(
"unit_with_percent_config": unit_with_percent_config,
"tiered_with_proration_config": tiered_with_proration_config,
"unit_with_proration_config": unit_with_proration_config,
"grouped_allocation_config": grouped_allocation_config,
},
price_create_params.PriceCreateParams,
),
Expand Down Expand Up @@ -3229,6 +3311,84 @@ async def create(
"""
...

@overload
async def create(
self,
*,
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"],
name: str,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN,
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN,
invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Price:
"""This endpoint is used to create a [price](../reference/price).

A price created
using this endpoint is always an add-on, meaning that it’s not associated with a
specific plan and can instead be individually added to subscriptions, including
subscriptions on different plans.

An `external_price_id` can be optionally specified as an alias to allow
ergonomic interaction with prices in the Orb API.

See the [Price resource](../reference/price) for the specification of different
price model configurations possible in this endpoint.

Args:
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 plan will be associated with.

name: The name of the price.

billable_metric_id: The id of the billable metric for the price. Only needed if the price is
usage-based.

billed_in_advance: 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.

conversion_rate: The per unit conversion rate of the price currency to the invoicing currency.

external_price_id: An alias for the price.

fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units
applied.

invoice_grouping_key: The property used to group this price on an invoice

metadata: 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`.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
...

@required_args(
["cadence", "currency", "item_id", "model_type", "name", "unit_config"],
["cadence", "currency", "item_id", "model_type", "name", "package_config"],
Expand All @@ -3248,6 +3408,7 @@ async def create(
["cadence", "currency", "item_id", "model_type", "name", "unit_with_percent_config"],
["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"],
)
async def create(
self,
Expand All @@ -3272,7 +3433,8 @@ async def create(
| Literal["tiered_package_with_minimum"]
| Literal["unit_with_percent"]
| Literal["tiered_with_proration"]
| Literal["unit_with_proration"],
| Literal["unit_with_proration"]
| Literal["grouped_allocation"],
name: str,
unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -3300,6 +3462,7 @@ async def create(
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,
# 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.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -3344,6 +3507,7 @@ async def create(
"unit_with_percent_config": unit_with_percent_config,
"tiered_with_proration_config": tiered_with_proration_config,
"unit_with_proration_config": unit_with_proration_config,
"grouped_allocation_config": grouped_allocation_config,
},
price_create_params.PriceCreateParams,
),
Expand Down
57 changes: 57 additions & 0 deletions src/orb/types/plan_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"PriceNewPlanPackageWithAllocationPrice",
"PriceNewPlanTierWithProrationPrice",
"PriceNewPlanUnitWithProrationPrice",
"PriceNewPlanGroupedAllocationPrice",
]


Expand Down Expand Up @@ -1025,6 +1026,61 @@ class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False):
"""


class PriceNewPlanGroupedAllocationPrice(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]]

item_id: Required[str]
"""The id of the item the plan will be associated with."""

model_type: Required[Literal["grouped_allocation"]]

name: Required[str]
"""The name of the price."""

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.
"""

conversion_rate: Optional[float]
"""The per unit conversion 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.
"""

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"""

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`.
"""


Price: TypeAlias = Union[
PriceNewPlanUnitPrice,
PriceNewPlanPackagePrice,
Expand All @@ -1041,4 +1097,5 @@ class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False):
PriceNewPlanPackageWithAllocationPrice,
PriceNewPlanTierWithProrationPrice,
PriceNewPlanUnitWithProrationPrice,
PriceNewPlanGroupedAllocationPrice,
]
Loading