Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 17, 2024
1 parent 47116d4 commit 899a10f
Show file tree
Hide file tree
Showing 7 changed files with 566 additions and 3 deletions.
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-8cdbf902afe6295b1eee73576b55f8461c36179fd59e5f12cfeb6a3372c08904.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5083c44a1414120feda9b5c06490ce6e3125836645b45c6d2cca6ed73897288e.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 @@ -1530,6 +1530,84 @@ def create(
"""
...

@overload
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"],
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 @@ -1550,6 +1628,7 @@ def create(
["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"],
)
def create(
self,
Expand All @@ -1575,7 +1654,8 @@ def create(
| Literal["unit_with_percent"]
| Literal["tiered_with_proration"]
| Literal["unit_with_proration"]
| Literal["grouped_allocation"],
| Literal["grouped_allocation"]
| Literal["bulk_with_proration"],
name: str,
unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1604,6 +1684,7 @@ def create(
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,
bulk_with_proration_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 @@ -1649,6 +1730,7 @@ def create(
"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,
},
price_create_params.PriceCreateParams,
),
Expand Down Expand Up @@ -3389,6 +3471,84 @@ async def create(
"""
...

@overload
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"],
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 @@ -3409,6 +3569,7 @@ async def create(
["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"],
)
async def create(
self,
Expand All @@ -3434,7 +3595,8 @@ async def create(
| Literal["unit_with_percent"]
| Literal["tiered_with_proration"]
| Literal["unit_with_proration"]
| Literal["grouped_allocation"],
| Literal["grouped_allocation"]
| Literal["bulk_with_proration"],
name: str,
unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN,
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -3463,6 +3625,7 @@ async def create(
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,
bulk_with_proration_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 @@ -3508,6 +3671,7 @@ async def create(
"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,
},
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 @@ -37,6 +37,7 @@
"PriceNewPlanTierWithProrationPrice",
"PriceNewPlanUnitWithProrationPrice",
"PriceNewPlanGroupedAllocationPrice",
"PriceNewPlanBulkWithProrationPrice",
]


Expand Down Expand Up @@ -1081,6 +1082,61 @@ class PriceNewPlanGroupedAllocationPrice(TypedDict, total=False):
"""


class PriceNewPlanBulkWithProrationPrice(TypedDict, total=False):
bulk_with_proration_config: Required[Dict[str, object]]

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

model_type: Required[Literal["bulk_with_proration"]]

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 @@ -1098,4 +1154,5 @@ class PriceNewPlanGroupedAllocationPrice(TypedDict, total=False):
PriceNewPlanTierWithProrationPrice,
PriceNewPlanUnitWithProrationPrice,
PriceNewPlanGroupedAllocationPrice,
PriceNewPlanBulkWithProrationPrice,
]
Loading

0 comments on commit 899a10f

Please sign in to comment.