From 4b07848ecc9d2a4899e20710e121d5cdc984de79 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:19:21 +0000 Subject: [PATCH 01/43] feat(api)!: add semi_annual cadence and remove metadata from update items (#288) --- .stats.yml | 2 +- src/orb/resources/invoices.py | 9 ++ src/orb/resources/items.py | 36 +---- src/orb/resources/prices/prices.py | 76 +++++----- src/orb/resources/subscriptions.py | 16 +++ src/orb/types/invoice.py | 3 + src/orb/types/invoice_create_params.py | 4 + .../types/invoice_fetch_upcoming_response.py | 3 + src/orb/types/item_update_params.py | 9 +- src/orb/types/plan.py | 2 +- src/orb/types/plan_create_params.py | 30 ++-- src/orb/types/price.py | 36 ++--- src/orb/types/price_create_params.py | 36 ++--- src/orb/types/shared_params/__init__.py | 1 + src/orb/types/shared_params/discount.py | 80 +++++++++++ .../subscription_price_intervals_params.py | 134 +++++++++++++++--- tests/api_resources/test_invoices.py | 12 ++ tests/api_resources/test_items.py | 44 ------ tests/api_resources/test_subscriptions.py | 92 ++++++++++++ 19 files changed, 435 insertions(+), 190 deletions(-) create mode 100644 src/orb/types/shared_params/discount.py diff --git a/.stats.yml b/.stats.yml index e7af37ec..b83ed004 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-a6a1b7ffd49d131bfc4a1e8e508ac1fe23875c64b27c99f97dd4df06ea5e3ff5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-6bef7452aabfcad0e298c7e0bbbd90aa6a1d954ad99a04fe756b827fd12a7ce9.yml diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 5da67aa6..e43f9b33 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -10,6 +10,7 @@ from .. import _legacy_response from ..types import ( + shared_params, invoice_list_params, invoice_create_params, invoice_mark_paid_params, @@ -51,6 +52,7 @@ def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, + discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, @@ -81,6 +83,8 @@ def create( customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. + discount: An optional discount to attach to the invoice. + external_customer_id: The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. @@ -112,6 +116,7 @@ def create( "line_items": line_items, "net_terms": net_terms, "customer_id": customer_id, + "discount": discount, "external_customer_id": external_customer_id, "memo": memo, "metadata": metadata, @@ -462,6 +467,7 @@ async def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, + discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, @@ -492,6 +498,8 @@ async def create( customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. + discount: An optional discount to attach to the invoice. + external_customer_id: The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. @@ -523,6 +531,7 @@ async def create( "line_items": line_items, "net_terms": net_terms, "customer_id": customer_id, + "discount": discount, "external_customer_id": external_customer_id, "memo": memo, "metadata": metadata, diff --git a/src/orb/resources/items.py b/src/orb/resources/items.py index 94d76a02..da1358a6 100644 --- a/src/orb/resources/items.py +++ b/src/orb/resources/items.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional import httpx @@ -81,7 +81,6 @@ def update( item_id: str, *, external_connections: Optional[Iterable[item_update_params.ExternalConnection]], - 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, @@ -90,15 +89,10 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Item: - """Update items + """ + Update items Args: - 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 @@ -113,13 +107,7 @@ def update( raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") return self._put( f"/items/{item_id}", - body=maybe_transform( - { - "external_connections": external_connections, - "metadata": metadata, - }, - item_update_params.ItemUpdateParams, - ), + body=maybe_transform({"external_connections": external_connections}, item_update_params.ItemUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -268,7 +256,6 @@ async def update( item_id: str, *, external_connections: Optional[Iterable[item_update_params.ExternalConnection]], - 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, @@ -277,15 +264,10 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Item: - """Update items + """ + Update items Args: - 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 @@ -301,11 +283,7 @@ async def update( return await self._put( f"/items/{item_id}", body=await async_maybe_transform( - { - "external_connections": external_connections, - "metadata": metadata, - }, - item_update_params.ItemUpdateParams, + {"external_connections": external_connections}, item_update_params.ItemUpdateParams ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 60a78c4e..b8885ad6 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -55,7 +55,7 @@ def with_streaming_response(self) -> PricesWithStreamingResponse: def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], @@ -128,7 +128,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], @@ -201,7 +201,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -274,7 +274,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -347,7 +347,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -420,7 +420,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -494,7 +494,7 @@ def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -567,7 +567,7 @@ def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -640,7 +640,7 @@ def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -712,7 +712,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -785,7 +785,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -858,7 +858,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -931,7 +931,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -1004,7 +1004,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -1077,7 +1077,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -1150,7 +1150,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -1223,7 +1223,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -1296,7 +1296,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -1388,7 +1388,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] @@ -1688,7 +1688,7 @@ def with_streaming_response(self) -> AsyncPricesWithStreamingResponse: async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], @@ -1761,7 +1761,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], @@ -1834,7 +1834,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -1907,7 +1907,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -1980,7 +1980,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -2053,7 +2053,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -2127,7 +2127,7 @@ async def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -2200,7 +2200,7 @@ async def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -2273,7 +2273,7 @@ async def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -2345,7 +2345,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -2418,7 +2418,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -2491,7 +2491,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -2564,7 +2564,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -2637,7 +2637,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -2710,7 +2710,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -2783,7 +2783,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -2856,7 +2856,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -2929,7 +2929,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -3021,7 +3021,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index a17ecfa7..e9b8b8bd 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1248,7 +1248,9 @@ def price_intervals( subscription_id: str, *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, + add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN, + edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | 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, @@ -1319,8 +1321,12 @@ def price_intervals( Args: add: A list of price intervals to add to the subscription. + add_adjustments: A list of adjustments to add to the subscription. + edit: A list of price intervals to edit on the subscription. + edit_adjustments: A list of adjustments to edit on the subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1338,7 +1344,9 @@ def price_intervals( body=maybe_transform( { "add": add, + "add_adjustments": add_adjustments, "edit": edit, + "edit_adjustments": edit_adjustments, }, subscription_price_intervals_params.SubscriptionPriceIntervalsParams, ), @@ -2960,7 +2968,9 @@ async def price_intervals( subscription_id: str, *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, + add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN, + edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | 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, @@ -3031,8 +3041,12 @@ async def price_intervals( Args: add: A list of price intervals to add to the subscription. + add_adjustments: A list of adjustments to add to the subscription. + edit: A list of price intervals to edit on the subscription. + edit_adjustments: A list of adjustments to edit on the subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -3050,7 +3064,9 @@ async def price_intervals( body=await async_maybe_transform( { "add": add, + "add_adjustments": add_adjustments, "edit": edit, + "edit_adjustments": edit_adjustments, }, subscription_price_intervals_params.SubscriptionPriceIntervalsParams, ), diff --git a/src/orb/types/invoice.py b/src/orb/types/invoice.py index 23f601ca..b1f6fc02 100644 --- a/src/orb/types/invoice.py +++ b/src/orb/types/invoice.py @@ -50,6 +50,9 @@ class AutoCollection(BaseModel): is not enabled for this invoice, this field will be `null`. """ + num_attempts: Optional[int] = None + """Number of auto-collection payment attempts.""" + previously_attempted_at: Optional[datetime] = None """ If Orb has ever attempted payment auto-collection for this invoice, this field diff --git a/src/orb/types/invoice_create_params.py b/src/orb/types/invoice_create_params.py index aa4b32a2..ffe24569 100644 --- a/src/orb/types/invoice_create_params.py +++ b/src/orb/types/invoice_create_params.py @@ -6,6 +6,7 @@ from datetime import date, datetime from typing_extensions import Literal, Required, Annotated, TypedDict +from ..types import shared_params from .._utils import PropertyInfo __all__ = ["InvoiceCreateParams", "LineItem", "LineItemUnitConfig"] @@ -41,6 +42,9 @@ class InvoiceCreateParams(TypedDict, total=False): One of `customer_id` and `external_customer_id` are required. """ + discount: Optional[shared_params.Discount] + """An optional discount to attach to the invoice.""" + external_customer_id: Optional[str] """The `external_customer_id` of the `Customer` to create this invoice for. diff --git a/src/orb/types/invoice_fetch_upcoming_response.py b/src/orb/types/invoice_fetch_upcoming_response.py index 1de3bebb..bc447274 100644 --- a/src/orb/types/invoice_fetch_upcoming_response.py +++ b/src/orb/types/invoice_fetch_upcoming_response.py @@ -50,6 +50,9 @@ class AutoCollection(BaseModel): is not enabled for this invoice, this field will be `null`. """ + num_attempts: Optional[int] = None + """Number of auto-collection payment attempts.""" + previously_attempted_at: Optional[datetime] = None """ If Orb has ever attempted payment auto-collection for this invoice, this field diff --git a/src/orb/types/item_update_params.py b/src/orb/types/item_update_params.py index fd4e8a38..10c43529 100644 --- a/src/orb/types/item_update_params.py +++ b/src/orb/types/item_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ItemUpdateParams", "ExternalConnection"] @@ -11,13 +11,6 @@ class ItemUpdateParams(TypedDict, total=False): external_connections: Required[Optional[Iterable[ExternalConnection]]] - 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`. - """ - class ExternalConnection(TypedDict, total=False): external_connection_name: Required[ diff --git a/src/orb/types/plan.py b/src/orb/types/plan.py index 66f81cf8..f3b3b805 100644 --- a/src/orb/types/plan.py +++ b/src/orb/types/plan.py @@ -91,7 +91,7 @@ class PlanPhase(BaseModel): If null, this phase is evergreen and active indefinitely """ - duration_unit: Optional[Literal["daily", "monthly", "quarterly", "annual"]] = None + duration_unit: Optional[Literal["daily", "monthly", "quarterly", "semi_annual", "annual"]] = None maximum: Optional[PlanPhaseMaximum] = None diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index 0cf11ec5..bdcbc685 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -82,7 +82,7 @@ class PriceNewPlanUnitPriceUnitConfig(TypedDict, total=False): class PriceNewPlanUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -142,7 +142,7 @@ class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False): class PriceNewPlanPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -213,7 +213,7 @@ class PriceNewPlanMatrixPriceMatrixConfig(TypedDict, total=False): class PriceNewPlanMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -277,7 +277,7 @@ class PriceNewPlanTieredPriceTieredConfig(TypedDict, total=False): class PriceNewPlanTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -347,7 +347,7 @@ class PriceNewPlanTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class PriceNewPlanTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -405,7 +405,7 @@ class PriceNewPlanBpsPriceBpsConfig(TypedDict, total=False): class PriceNewPlanBpsPrice(TypedDict, total=False): bps_config: Required[PriceNewPlanBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -472,7 +472,7 @@ class PriceNewPlanBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class PriceNewPlanBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[PriceNewPlanBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -533,7 +533,7 @@ class PriceNewPlanBulkPriceBulkConfig(TypedDict, total=False): class PriceNewPlanBulkPrice(TypedDict, total=False): bulk_config: Required[PriceNewPlanBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -579,7 +579,7 @@ class PriceNewPlanBulkPrice(TypedDict, total=False): class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -627,7 +627,7 @@ class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): class PriceNewPlanTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -675,7 +675,7 @@ class PriceNewPlanTieredPackagePrice(TypedDict, total=False): class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -723,7 +723,7 @@ class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -771,7 +771,7 @@ class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -819,7 +819,7 @@ class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -867,7 +867,7 @@ class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] diff --git a/src/orb/types/price.py b/src/orb/types/price.py index 7e017b33..d0e1f0a2 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -186,7 +186,7 @@ class UnitPrice(BaseModel): billable_metric: Optional[UnitPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -278,7 +278,7 @@ class PackagePrice(BaseModel): billable_metric: Optional[PackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -381,7 +381,7 @@ class MatrixPrice(BaseModel): billable_metric: Optional[MatrixPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -477,7 +477,7 @@ class TieredPrice(BaseModel): billable_metric: Optional[TieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -579,7 +579,7 @@ class TieredBpsPrice(BaseModel): billable_metric: Optional[TieredBpsPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -669,7 +669,7 @@ class BpsPrice(BaseModel): bps_config: BpsPriceBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -768,7 +768,7 @@ class BulkBpsPrice(BaseModel): bulk_bps_config: BulkBpsPriceBulkBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -861,7 +861,7 @@ class BulkPrice(BaseModel): bulk_config: BulkPriceBulkConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -939,7 +939,7 @@ class ThresholdTotalAmountPrice(BaseModel): billable_metric: Optional[ThresholdTotalAmountPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1019,7 +1019,7 @@ class TieredPackagePrice(BaseModel): billable_metric: Optional[TieredPackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1099,7 +1099,7 @@ class GroupedTieredPrice(BaseModel): billable_metric: Optional[GroupedTieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1179,7 +1179,7 @@ class TieredWithMinimumPrice(BaseModel): billable_metric: Optional[TieredWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1259,7 +1259,7 @@ class TieredPackageWithMinimumPrice(BaseModel): billable_metric: Optional[TieredPackageWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1339,7 +1339,7 @@ class PackageWithAllocationPrice(BaseModel): billable_metric: Optional[PackageWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1419,7 +1419,7 @@ class UnitWithPercentPrice(BaseModel): billable_metric: Optional[UnitWithPercentPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1525,7 +1525,7 @@ class MatrixWithAllocationPrice(BaseModel): billable_metric: Optional[MatrixWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1605,7 +1605,7 @@ class TieredWithProrationPrice(BaseModel): billable_metric: Optional[TieredWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1685,7 +1685,7 @@ class UnitWithProrationPrice(BaseModel): billable_metric: Optional[UnitWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index 5ba3477b..e958358e 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -44,7 +44,7 @@ class NewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -94,7 +94,7 @@ class NewFloatingUnitPriceUnitConfig(TypedDict, total=False): class NewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -151,7 +151,7 @@ class NewFloatingPackagePricePackageConfig(TypedDict, total=False): class NewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -219,7 +219,7 @@ class NewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -290,7 +290,7 @@ class NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(TypedDict, class NewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -351,7 +351,7 @@ class NewFloatingTieredPriceTieredConfig(TypedDict, total=False): class NewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -420,7 +420,7 @@ class NewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class NewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[NewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -473,7 +473,7 @@ class NewFloatingBpsPriceBpsConfig(TypedDict, total=False): class NewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[NewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -537,7 +537,7 @@ class NewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class NewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[NewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -593,7 +593,7 @@ class NewFloatingBulkPriceBulkConfig(TypedDict, total=False): class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -638,7 +638,7 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class NewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -683,7 +683,7 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): class NewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -728,7 +728,7 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -773,7 +773,7 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -818,7 +818,7 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -863,7 +863,7 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class NewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -908,7 +908,7 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): class NewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -953,7 +953,7 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): class NewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] diff --git a/src/orb/types/shared_params/__init__.py b/src/orb/types/shared_params/__init__.py index b5237646..ed0e0225 100644 --- a/src/orb/types/shared_params/__init__.py +++ b/src/orb/types/shared_params/__init__.py @@ -1,3 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .discount import Discount as Discount from .billing_cycle_relative_date import BillingCycleRelativeDate as BillingCycleRelativeDate diff --git a/src/orb/types/shared_params/discount.py b/src/orb/types/shared_params/discount.py new file mode 100644 index 00000000..cab49d43 --- /dev/null +++ b/src/orb/types/shared_params/discount.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["Discount", "PercentageDiscount", "TrialDiscount", "UsageDiscount", "AmountDiscount"] + + +class PercentageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["percentage"]] + + percentage_discount: Required[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + reason: Optional[str] + + +class TrialDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["trial"]] + + reason: Optional[str] + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + trial_percentage_discount: Optional[float] + """Only available if discount_type is `trial`""" + + +class UsageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["usage"]] + + usage_discount: Required[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + reason: Optional[str] + + +class AmountDiscount(TypedDict, total=False): + amount_discount: Required[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["amount"]] + + reason: Optional[str] + + +Discount = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount] diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 3160ae74..7acacca4 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -51,8 +51,15 @@ "AddPriceNewFloatingUnitWithPercentPrice", "AddPriceNewFloatingTieredWithProrationPrice", "AddPriceNewFloatingUnitWithProrationPrice", + "AddAdjustment", + "AddAdjustmentAdjustment", + "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMaximum", "Edit", "EditFixedFeeQuantityTransition", + "EditAdjustment", ] @@ -60,9 +67,15 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): add: Iterable[Add] """A list of price intervals to add to the subscription.""" + add_adjustments: Iterable[AddAdjustment] + """A list of adjustments to add to the subscription.""" + edit: Iterable[Edit] """A list of price intervals to edit on the subscription.""" + edit_adjustments: Iterable[EditAdjustment] + """A list of adjustments to edit on the subscription.""" + class AddDiscountAmountDiscountCreationParams(TypedDict, total=False): amount_discount: Required[float] @@ -112,7 +125,7 @@ class AddPriceNewFloatingUnitPriceUnitConfig(TypedDict, total=False): class AddPriceNewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -169,7 +182,7 @@ class AddPriceNewFloatingPackagePricePackageConfig(TypedDict, total=False): class AddPriceNewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -237,7 +250,7 @@ class AddPriceNewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class AddPriceNewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -308,7 +321,7 @@ class AddPriceNewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(Typ class AddPriceNewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -369,7 +382,7 @@ class AddPriceNewFloatingTieredPriceTieredConfig(TypedDict, total=False): class AddPriceNewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -436,7 +449,7 @@ class AddPriceNewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class AddPriceNewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -491,7 +504,7 @@ class AddPriceNewFloatingBpsPriceBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[AddPriceNewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -555,7 +568,7 @@ class AddPriceNewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[AddPriceNewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -613,7 +626,7 @@ class AddPriceNewFloatingBulkPriceBulkConfig(TypedDict, total=False): class AddPriceNewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[AddPriceNewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -656,7 +669,7 @@ class AddPriceNewFloatingBulkPrice(TypedDict, total=False): class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -701,7 +714,7 @@ class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -746,7 +759,7 @@ class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -791,7 +804,7 @@ class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -836,7 +849,7 @@ class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -881,7 +894,7 @@ class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -926,7 +939,7 @@ class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -971,7 +984,7 @@ class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1016,7 +1029,7 @@ class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1125,6 +1138,74 @@ class Add(TypedDict, total=False): """The id of the price to add to the subscription.""" +class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["percentage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + percentage_discount: Required[float] + + +class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["amount_discount"]] + + amount_discount: Required[str] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + +class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): + adjustment_type: Required[Literal["minimum"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + item_id: Required[str] + """The item ID that revenue from this minimum will be attributed to.""" + + minimum_amount: Required[str] + + +class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): + adjustment_type: Required[Literal["maximum"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + maximum_amount: Required[str] + + +AddAdjustmentAdjustment = Union[ + AddAdjustmentAdjustmentNewPercentageDiscount, + AddAdjustmentAdjustmentNewAmountDiscount, + AddAdjustmentAdjustmentNewMinimum, + AddAdjustmentAdjustmentNewMaximum, +] + + +class AddAdjustment(TypedDict, total=False): + adjustment: Required[AddAdjustmentAdjustment] + """The definition of a new adjustment to create and add to the subscription.""" + + start_date: Required[ + Annotated[Union[Union[str, datetime], BillingCycleRelativeDate], PropertyInfo(format="iso8601")] + ] + """The start date of the adjustment interval. + + This is the date that the adjustment will start affecting prices on the + subscription. + """ + + end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] + """The end date of the adjustment interval. + + This is the date that the adjustment will stop affecting prices on the + subscription. + """ + + class EditFixedFeeQuantityTransition(TypedDict, total=False): effective_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The date that the fixed fee quantity transition should take effect.""" @@ -1162,3 +1243,20 @@ class Edit(TypedDict, total=False): If not specified, the start date will not be updated. """ + + +class EditAdjustment(TypedDict, total=False): + adjustment_interval_id: Required[str] + """The id of the adjustment interval to edit.""" + + end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] + """The updated end date of this adjustment interval. + + If not specified, the start date will not be updated. + """ + + start_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate], PropertyInfo(format="iso8601")] + """The updated start date of this adjustment interval. + + If not specified, the start date will not be updated. + """ diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index a180b838..0d2e2df5 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -96,6 +96,12 @@ def test_method_create_with_all_params(self, client: Orb) -> None: ], net_terms=0, customer_id="4khy3nwzktxv7", + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", metadata={"foo": "string"}, @@ -515,6 +521,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No ], net_terms=0, customer_id="4khy3nwzktxv7", + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", metadata={"foo": "string"}, diff --git a/tests/api_resources/test_items.py b/tests/api_resources/test_items.py index 7561bdb6..87fc7207 100644 --- a/tests/api_resources/test_items.py +++ b/tests/api_resources/test_items.py @@ -70,28 +70,6 @@ def test_method_update(self, client: Orb) -> None: ) assert_matches_type(Item, item, path=["response"]) - @parametrize - def test_method_update_with_all_params(self, client: Orb) -> None: - item = client.items.update( - "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], - metadata={"foo": "string"}, - ) - assert_matches_type(Item, item, path=["response"]) - @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.items.with_raw_response.update( @@ -292,28 +270,6 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: ) assert_matches_type(Item, item, path=["response"]) - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: - item = await async_client.items.update( - "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], - metadata={"foo": "string"}, - ) - assert_matches_type(Item, item, path=["response"]) - @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.items.with_raw_response.update( diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index c8a8dc64..73f116a4 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -635,6 +635,35 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "maximum_amount": 0, }, ], + add_adjustments=[ + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -697,6 +726,23 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "billing_cycle_day": 0, }, ], + edit_adjustments=[ + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1686,6 +1732,35 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "maximum_amount": 0, }, ], + add_adjustments=[ + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -1748,6 +1823,23 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "billing_cycle_day": 0, }, ], + edit_adjustments=[ + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], ) assert_matches_type(Subscription, subscription, path=["response"]) From 4beb9285099ff26ed8ca6a9f178f34daf87f053f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 18:50:03 +0000 Subject: [PATCH 02/43] docs: small updates (#290) --- .stats.yml | 2 +- src/orb/resources/items.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index b83ed004..37cd52bc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-6bef7452aabfcad0e298c7e0bbbd90aa6a1d954ad99a04fe756b827fd12a7ce9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-e688375f844df1851a35656ecef5248e201346b473def0219ac0f5f38b11a409.yml diff --git a/src/orb/resources/items.py b/src/orb/resources/items.py index da1358a6..49d8fc52 100644 --- a/src/orb/resources/items.py +++ b/src/orb/resources/items.py @@ -90,7 +90,7 @@ def update( idempotency_key: str | None = None, ) -> Item: """ - Update items + This endpoint can be used to update properties on the Item. Args: extra_headers: Send extra headers @@ -265,7 +265,7 @@ async def update( idempotency_key: str | None = None, ) -> Item: """ - Update items + This endpoint can be used to update properties on the Item. Args: extra_headers: Send extra headers From 38aaf34361e649e4111f8a4038afe82867c8d4d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:27:45 +0000 Subject: [PATCH 03/43] feat(api): updates (#291) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 37cd52bc..5496ff32 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-e688375f844df1851a35656ecef5248e201346b473def0219ac0f5f38b11a409.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-118146560a9fa63ded63f25dd23f70e37b4c4ff09370c0f484daa320ca9b6b64.yml From 8aa1d7356132d6221b32654616669b8fa1aee9f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:27:47 +0000 Subject: [PATCH 04/43] chore(internal): add a `default_query` method (#292) --- src/orb/_base_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 61905988..d20f585f 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -457,7 +457,7 @@ def _build_request( raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") headers = self._build_headers(options) - params = _merge_mappings(self._custom_query, options.params) + params = _merge_mappings(self.default_query, options.params) content_type = headers.get("Content-Type") # If the given Content-Type header is multipart/form-data then it @@ -593,6 +593,12 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @property + def default_query(self) -> dict[str, object]: + return { + **self._custom_query, + } + def _validate_headers( self, headers: Headers, # noqa: ARG002 From 5aa0f328e70673ff0c928bd2b704b1e3822b480c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:58:36 +0000 Subject: [PATCH 05/43] chore(docs): improve Coupon description (#293) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 5496ff32..2105f66c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-118146560a9fa63ded63f25dd23f70e37b4c4ff09370c0f484daa320ca9b6b64.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d9cc087ece8a2eba847035f3cd8ae44d3401046e01761ab6ad7fd6165d93f0c8.yml From 89f4bfe6516912f25d0bbe6e8ecf3343a2e05300 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:18:49 +0000 Subject: [PATCH 06/43] fix(client/async): avoid blocking io call for platform headers (#294) --- src/orb/_base_client.py | 17 +++++++++++++---- src/orb/_utils/__init__.py | 1 + src/orb/_utils/_reflection.py | 8 ++++++++ src/orb/_utils/_sync.py | 19 ++++++++++++++++++- 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/orb/_utils/_reflection.py diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index d20f585f..07eff308 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -60,7 +60,7 @@ RequestOptions, ModelBuilderProtocol, ) -from ._utils import is_dict, is_list, is_given, lru_cache, is_mapping +from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( @@ -359,6 +359,7 @@ def __init__( self._custom_query = custom_query or {} self._strict_response_validation = _strict_response_validation self._idempotency_header = None + self._platform: Platform | None = None if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( @@ -623,7 +624,10 @@ def base_url(self, url: URL | str) -> None: self._base_url = self._enforce_trailing_slash(url if isinstance(url, URL) else URL(url)) def platform_headers(self) -> Dict[str, str]: - return platform_headers(self._version) + # the actual implementation is in a separate `lru_cache` decorated + # function because adding `lru_cache` to methods will leak memory + # https://github.com/python/cpython/issues/88476 + return platform_headers(self._version, platform=self._platform) def _parse_retry_after_header(self, response_headers: Optional[httpx.Headers] = None) -> float | None: """Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified. @@ -1512,6 +1516,11 @@ async def _request( stream_cls: type[_AsyncStreamT] | None, remaining_retries: int | None, ) -> ResponseT | _AsyncStreamT: + if self._platform is None: + # `get_platform` can make blocking IO calls so we + # execute it earlier while we are in an async context + self._platform = await asyncify(get_platform)() + cast_to = self._maybe_override_cast_to(cast_to, options) await self._prepare_options(options) @@ -1948,11 +1957,11 @@ def get_platform() -> Platform: @lru_cache(maxsize=None) -def platform_headers(version: str) -> Dict[str, str]: +def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]: return { "X-Stainless-Lang": "python", "X-Stainless-Package-Version": version, - "X-Stainless-OS": str(get_platform()), + "X-Stainless-OS": str(platform or get_platform()), "X-Stainless-Arch": str(get_architecture()), "X-Stainless-Runtime": get_python_runtime(), "X-Stainless-Runtime-Version": get_python_version(), diff --git a/src/orb/_utils/__init__.py b/src/orb/_utils/__init__.py index 31b5b227..667e2473 100644 --- a/src/orb/_utils/__init__.py +++ b/src/orb/_utils/__init__.py @@ -49,3 +49,4 @@ maybe_transform as maybe_transform, async_maybe_transform as async_maybe_transform, ) +from ._reflection import function_has_argument as function_has_argument diff --git a/src/orb/_utils/_reflection.py b/src/orb/_utils/_reflection.py new file mode 100644 index 00000000..e134f58e --- /dev/null +++ b/src/orb/_utils/_reflection.py @@ -0,0 +1,8 @@ +import inspect +from typing import Any, Callable + + +def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: + """Returns whether or not the given function has a specific parameter""" + sig = inspect.signature(func) + return arg_name in sig.parameters diff --git a/src/orb/_utils/_sync.py b/src/orb/_utils/_sync.py index 595924e5..d0d81033 100644 --- a/src/orb/_utils/_sync.py +++ b/src/orb/_utils/_sync.py @@ -7,6 +7,8 @@ import anyio import anyio.to_thread +from ._reflection import function_has_argument + T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") @@ -59,6 +61,21 @@ def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: partial_f = functools.partial(function, *args, **kwargs) - return await anyio.to_thread.run_sync(partial_f, cancellable=cancellable, limiter=limiter) + + # In `v4.1.0` anyio added the `abandon_on_cancel` argument and deprecated the old + # `cancellable` argument, so we need to use the new `abandon_on_cancel` to avoid + # surfacing deprecation warnings. + if function_has_argument(anyio.to_thread.run_sync, "abandon_on_cancel"): + return await anyio.to_thread.run_sync( + partial_f, + abandon_on_cancel=cancellable, + limiter=limiter, + ) + + return await anyio.to_thread.run_sync( + partial_f, + cancellable=cancellable, + limiter=limiter, + ) return wrapper From 7e16ef55cd743b63b0ee8f0a9e45052c610998fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:09:42 +0000 Subject: [PATCH 07/43] feat(api): add support for adding allocation price to subscription (#295) --- .stats.yml | 2 +- .../subscription_price_intervals_params.py | 24 +++++++++++++ tests/api_resources/test_subscriptions.py | 36 +++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2105f66c..b6290eb0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d9cc087ece8a2eba847035f3cd8ae44d3401046e01761ab6ad7fd6165d93f0c8.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d08c3c586f46f155358104a907afa8300ce44a25814c1574c0f4344935c1b838.yml diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 7acacca4..a13f70e0 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -12,6 +12,7 @@ __all__ = [ "SubscriptionPriceIntervalsParams", "Add", + "AddAllocationPrice", "AddDiscount", "AddDiscountAmountDiscountCreationParams", "AddDiscountPercentageDiscountCreationParams", @@ -77,6 +78,26 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): """A list of adjustments to edit on the subscription.""" +class AddAllocationPrice(TypedDict, total=False): + amount: Required[float] + """An amount of the currency to allocate to the customer at the specified cadence.""" + + cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"]] + """The cadence at which to allocate the amount to the customer.""" + + currency: Required[str] + """ + An ISO 4217 currency string or a custom pricing unit identifier in which to bill + this price. + """ + + expires_at_end_of_cadence: Required[bool] + """ + Whether the allocated amount should expire at the end of the cadence or roll + over to the next period. + """ + + class AddDiscountAmountDiscountCreationParams(TypedDict, total=False): amount_discount: Required[float] """Only available if discount_type is `amount`.""" @@ -1104,6 +1125,9 @@ class Add(TypedDict, total=False): This is the date that the price will start billing on the subscription. """ + allocation_price: Optional[AddAllocationPrice] + """The definition of a new allocation price to create and add to the subscription.""" + discounts: Optional[Iterable[AddDiscount]] """A list of discounts to initialize on the price interval.""" diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 73f116a4..60df4e75 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -501,6 +501,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -551,6 +557,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -601,6 +613,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1598,6 +1616,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1648,6 +1672,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1698,6 +1728,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ From 9076f38ee750cf1f59d6260befb9931d3f878743 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:14:35 +0000 Subject: [PATCH 08/43] feat(api): external connections made optional when updating items (#296) --- .stats.yml | 2 +- src/orb/resources/items.py | 20 +++- src/orb/resources/plans/external_plan_id.py | 36 +++---- src/orb/types/item_update_params.py | 4 +- tests/api_resources/test_items.py | 100 ++++---------------- 5 files changed, 50 insertions(+), 112 deletions(-) diff --git a/.stats.yml b/.stats.yml index b6290eb0..ca9f9877 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d08c3c586f46f155358104a907afa8300ce44a25814c1574c0f4344935c1b838.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-aebc7faa75113d98ef7b57673cf7fce499c87b96afabe6c2ddc5e22badc3ef33.yml diff --git a/src/orb/resources/items.py b/src/orb/resources/items.py index 49d8fc52..e31356be 100644 --- a/src/orb/resources/items.py +++ b/src/orb/resources/items.py @@ -80,7 +80,8 @@ def update( self, item_id: str, *, - external_connections: Optional[Iterable[item_update_params.ExternalConnection]], + external_connections: Optional[Iterable[item_update_params.ExternalConnection]] | NotGiven = NOT_GIVEN, + name: 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, @@ -107,7 +108,13 @@ def update( raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") return self._put( f"/items/{item_id}", - body=maybe_transform({"external_connections": external_connections}, item_update_params.ItemUpdateParams), + body=maybe_transform( + { + "external_connections": external_connections, + "name": name, + }, + item_update_params.ItemUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +262,8 @@ async def update( self, item_id: str, *, - external_connections: Optional[Iterable[item_update_params.ExternalConnection]], + external_connections: Optional[Iterable[item_update_params.ExternalConnection]] | NotGiven = NOT_GIVEN, + name: 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, @@ -283,7 +291,11 @@ async def update( return await self._put( f"/items/{item_id}", body=await async_maybe_transform( - {"external_connections": external_connections}, item_update_params.ItemUpdateParams + { + "external_connections": external_connections, + "name": name, + }, + item_update_params.ItemUpdateParams, ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/orb/resources/plans/external_plan_id.py b/src/orb/resources/plans/external_plan_id.py index 8c5538bf..a978def7 100644 --- a/src/orb/resources/plans/external_plan_id.py +++ b/src/orb/resources/plans/external_plan_id.py @@ -48,18 +48,10 @@ def update( idempotency_key: str | None = None, ) -> Plan: """ - This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) - details given an external_plan_id identifier. It returns information about the - prices included in the plan and their configuration, as well as the product that - the plan is attached to. + This endpoint can be used to update the `external_plan_id`, and `metadata` of an + existing plan. - ## Serialized prices - - Orb supports a few different pricing models out of the box. Each of these models - is serialized differently in a given [Price](../guides/concepts#plan-and-price) - object. The `model_type` field determines the key for the configuration object - that is present. A detailed explanation of price types can be found in the - [Price schema](../guides/concepts#plan-and-price). + Other fields on a customer are currently immutable. Args: external_plan_id: An optional user-defined ID for this plan resource, used throughout the system @@ -120,6 +112,10 @@ def fetch( prices included in the plan and their configuration, as well as the product that the plan is attached to. + If multiple plans are found to contain the specified external_plan_id, the + active plans will take priority over archived ones, and among those, the + endpoint will return the most recently created plan. + ## Serialized prices Orb supports a few different pricing models out of the box. Each of these models @@ -172,18 +168,10 @@ async def update( idempotency_key: str | None = None, ) -> Plan: """ - This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) - details given an external_plan_id identifier. It returns information about the - prices included in the plan and their configuration, as well as the product that - the plan is attached to. + This endpoint can be used to update the `external_plan_id`, and `metadata` of an + existing plan. - ## Serialized prices - - Orb supports a few different pricing models out of the box. Each of these models - is serialized differently in a given [Price](../guides/concepts#plan-and-price) - object. The `model_type` field determines the key for the configuration object - that is present. A detailed explanation of price types can be found in the - [Price schema](../guides/concepts#plan-and-price). + Other fields on a customer are currently immutable. Args: external_plan_id: An optional user-defined ID for this plan resource, used throughout the system @@ -244,6 +232,10 @@ async def fetch( prices included in the plan and their configuration, as well as the product that the plan is attached to. + If multiple plans are found to contain the specified external_plan_id, the + active plans will take priority over archived ones, and among those, the + endpoint will return the most recently created plan. + ## Serialized prices Orb supports a few different pricing models out of the box. Each of these models diff --git a/src/orb/types/item_update_params.py b/src/orb/types/item_update_params.py index 10c43529..a94f7c59 100644 --- a/src/orb/types/item_update_params.py +++ b/src/orb/types/item_update_params.py @@ -9,7 +9,9 @@ class ItemUpdateParams(TypedDict, total=False): - external_connections: Required[Optional[Iterable[ExternalConnection]]] + external_connections: Optional[Iterable[ExternalConnection]] + + name: Optional[str] class ExternalConnection(TypedDict, total=False): diff --git a/tests/api_resources/test_items.py b/tests/api_resources/test_items.py index 87fc7207..6ef650eb 100644 --- a/tests/api_resources/test_items.py +++ b/tests/api_resources/test_items.py @@ -51,6 +51,13 @@ def test_streaming_response_create(self, client: Orb) -> None: @parametrize def test_method_update(self, client: Orb) -> None: + item = client.items.update( + "string", + ) + assert_matches_type(Item, item, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Orb) -> None: item = client.items.update( "string", external_connections=[ @@ -67,6 +74,7 @@ def test_method_update(self, client: Orb) -> None: "external_entity_id": "string", }, ], + name="string", ) assert_matches_type(Item, item, path=["response"]) @@ -74,20 +82,6 @@ def test_method_update(self, client: Orb) -> None: def test_raw_response_update(self, client: Orb) -> None: response = client.items.with_raw_response.update( "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) assert response.is_closed is True @@ -99,20 +93,6 @@ def test_raw_response_update(self, client: Orb) -> None: def test_streaming_response_update(self, client: Orb) -> None: with client.items.with_streaming_response.update( "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -127,20 +107,6 @@ def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): client.items.with_raw_response.update( "", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) @parametrize @@ -251,6 +217,13 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: + item = await async_client.items.update( + "string", + ) + assert_matches_type(Item, item, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: item = await async_client.items.update( "string", external_connections=[ @@ -267,6 +240,7 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: "external_entity_id": "string", }, ], + name="string", ) assert_matches_type(Item, item, path=["response"]) @@ -274,20 +248,6 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.items.with_raw_response.update( "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) assert response.is_closed is True @@ -299,20 +259,6 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.items.with_streaming_response.update( "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -327,20 +273,6 @@ async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): await async_client.items.with_raw_response.update( "", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], ) @parametrize From cb8992bf23e9639a27d885e110966cb01acc3e61 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 12:44:41 +0000 Subject: [PATCH 09/43] fix(api)!: endpoint expects amount of new allocation price to be a string, not a number (#297) # Migration This change is fixing the SDK to use the correct `string` type expected by the API. The spec was incorrectly specifying a type `number` but the endpoint expected a string. While this change is technically an SDK breaking change the previous types weren't accurately representing the API behaviour. To migrate, be sure to use a string representation of the new allocation price amount. --- .stats.yml | 2 +- src/orb/types/subscription_price_intervals_params.py | 2 +- tests/api_resources/test_subscriptions.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index ca9f9877..020ff6db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-aebc7faa75113d98ef7b57673cf7fce499c87b96afabe6c2ddc5e22badc3ef33.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-2f2e1b9fbe79b0ed97d846a5a26937f421c162e559a2f85a82d7c6e432463f32.yml diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index a13f70e0..47048bbe 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -79,7 +79,7 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): class AddAllocationPrice(TypedDict, total=False): - amount: Required[float] + amount: Required[str] """An amount of the currency to allocate to the customer at the specified cadence.""" cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"]] diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 60df4e75..359c89b3 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -503,7 +503,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, @@ -559,7 +559,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, @@ -615,7 +615,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, @@ -1618,7 +1618,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, @@ -1674,7 +1674,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, @@ -1730,7 +1730,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO }, "allocation_price": { "currency": "USD", - "amount": 0, + "amount": "10.00", "cadence": "monthly", "expires_at_end_of_cadence": True, }, From 55cff139e8175d1dce02004c9715a42006bbb11c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:59:06 +0000 Subject: [PATCH 10/43] fix(docs): fix link to advanced python httpx docs (#298) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d32bf748..e3669531 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c - Support for proxies - Custom transports -- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality +- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality ```python from orb import Orb, DefaultHttpxClient From b0c95aa994d16c17486bbd999115114174fd2eac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:13:30 +0000 Subject: [PATCH 11/43] fix: temporarily patch upstream version to fix broken release flow (#299) --- bin/publish-pypi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/publish-pypi b/bin/publish-pypi index 826054e9..05bfccbb 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -3,4 +3,7 @@ set -eux mkdir -p dist rye build --clean +# Patching importlib-metadata version until upstream library version is updated +# https://github.com/pypa/twine/issues/977#issuecomment-2189800841 +"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN From 922476f4690435b72b12c6a06a92108cf9368d1a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:33:06 +0000 Subject: [PATCH 12/43] fix(build): include more files in sdist builds (#300) --- pyproject.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7220db6b..eb65d364 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,6 +99,21 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["src/orb"] +[tool.hatch.build.targets.sdist] +# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) +include = [ + "/*.toml", + "/*.json", + "/*.lock", + "/*.md", + "/mypy.ini", + "/noxfile.py", + "bin/*", + "examples/*", + "src/*", + "tests/*", +] + [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/markdown" From 1b7b6a3236226bdd7bf7bd00d041a0c0a99f24bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:03:05 +0000 Subject: [PATCH 13/43] feat(api): add support for query param include_all_blocks (#301) --- .stats.yml | 2 +- src/orb/resources/customers/credits/credits.py | 16 ++++++++++++++++ .../credit_list_by_external_id_params.py | 3 +++ .../credit_list_by_external_id_response.py | 2 ++ src/orb/types/customers/credit_list_params.py | 3 +++ src/orb/types/customers/credit_list_response.py | 2 ++ tests/api_resources/customers/test_credits.py | 4 ++++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 020ff6db..bc9671e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-2f2e1b9fbe79b0ed97d846a5a26937f421c162e559a2f85a82d7c6e432463f32.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-2ec02cbf3446827f8bbc949216aec29ff745d79c39f1aa1b7ce2289eab0f338f.yml diff --git a/src/orb/resources/customers/credits/credits.py b/src/orb/resources/customers/credits/credits.py index f2f43bde..4add0e15 100644 --- a/src/orb/resources/customers/credits/credits.py +++ b/src/orb/resources/customers/credits/credits.py @@ -63,6 +63,7 @@ def list( *, currency: Optional[str] | NotGiven = NOT_GIVEN, cursor: Optional[str] | NotGiven = NOT_GIVEN, + include_all_blocks: bool | NotGiven = NOT_GIVEN, limit: int | 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. @@ -83,6 +84,8 @@ def list( cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned from the initial request. + include_all_blocks: Include all blocks, not just active ones. + limit: The number of items to fetch. Defaults to 20. extra_headers: Send extra headers @@ -107,6 +110,7 @@ def list( { "currency": currency, "cursor": cursor, + "include_all_blocks": include_all_blocks, "limit": limit, }, credit_list_params.CreditListParams, @@ -121,6 +125,7 @@ def list_by_external_id( *, currency: Optional[str] | NotGiven = NOT_GIVEN, cursor: Optional[str] | NotGiven = NOT_GIVEN, + include_all_blocks: bool | NotGiven = NOT_GIVEN, limit: int | 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. @@ -141,6 +146,8 @@ def list_by_external_id( cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned from the initial request. + include_all_blocks: Include all blocks, not just active ones. + limit: The number of items to fetch. Defaults to 20. extra_headers: Send extra headers @@ -167,6 +174,7 @@ def list_by_external_id( { "currency": currency, "cursor": cursor, + "include_all_blocks": include_all_blocks, "limit": limit, }, credit_list_by_external_id_params.CreditListByExternalIDParams, @@ -199,6 +207,7 @@ def list( *, currency: Optional[str] | NotGiven = NOT_GIVEN, cursor: Optional[str] | NotGiven = NOT_GIVEN, + include_all_blocks: bool | NotGiven = NOT_GIVEN, limit: int | 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. @@ -219,6 +228,8 @@ def list( cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned from the initial request. + include_all_blocks: Include all blocks, not just active ones. + limit: The number of items to fetch. Defaults to 20. extra_headers: Send extra headers @@ -243,6 +254,7 @@ def list( { "currency": currency, "cursor": cursor, + "include_all_blocks": include_all_blocks, "limit": limit, }, credit_list_params.CreditListParams, @@ -257,6 +269,7 @@ def list_by_external_id( *, currency: Optional[str] | NotGiven = NOT_GIVEN, cursor: Optional[str] | NotGiven = NOT_GIVEN, + include_all_blocks: bool | NotGiven = NOT_GIVEN, limit: int | 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. @@ -277,6 +290,8 @@ def list_by_external_id( cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned from the initial request. + include_all_blocks: Include all blocks, not just active ones. + limit: The number of items to fetch. Defaults to 20. extra_headers: Send extra headers @@ -303,6 +318,7 @@ def list_by_external_id( { "currency": currency, "cursor": cursor, + "include_all_blocks": include_all_blocks, "limit": limit, }, credit_list_by_external_id_params.CreditListByExternalIDParams, diff --git a/src/orb/types/customers/credit_list_by_external_id_params.py b/src/orb/types/customers/credit_list_by_external_id_params.py index b4b3cc5a..b192dc5c 100644 --- a/src/orb/types/customers/credit_list_by_external_id_params.py +++ b/src/orb/types/customers/credit_list_by_external_id_params.py @@ -19,5 +19,8 @@ class CreditListByExternalIDParams(TypedDict, total=False): request. """ + include_all_blocks: bool + """Include all blocks, not just active ones.""" + limit: int """The number of items to fetch. Defaults to 20.""" diff --git a/src/orb/types/customers/credit_list_by_external_id_response.py b/src/orb/types/customers/credit_list_by_external_id_response.py index 7ee5a3d6..d88e900b 100644 --- a/src/orb/types/customers/credit_list_by_external_id_response.py +++ b/src/orb/types/customers/credit_list_by_external_id_response.py @@ -18,6 +18,8 @@ class CreditListByExternalIDResponse(BaseModel): expiry_date: Optional[datetime] = None + maximum_initial_balance: Optional[float] = None + per_unit_cost_basis: Optional[str] = None status: Literal["active", "pending_payment"] diff --git a/src/orb/types/customers/credit_list_params.py b/src/orb/types/customers/credit_list_params.py index 64527331..9e8d7ba7 100644 --- a/src/orb/types/customers/credit_list_params.py +++ b/src/orb/types/customers/credit_list_params.py @@ -19,5 +19,8 @@ class CreditListParams(TypedDict, total=False): request. """ + include_all_blocks: bool + """Include all blocks, not just active ones.""" + limit: int """The number of items to fetch. Defaults to 20.""" diff --git a/src/orb/types/customers/credit_list_response.py b/src/orb/types/customers/credit_list_response.py index 58560b5b..7ccbfcf1 100644 --- a/src/orb/types/customers/credit_list_response.py +++ b/src/orb/types/customers/credit_list_response.py @@ -18,6 +18,8 @@ class CreditListResponse(BaseModel): expiry_date: Optional[datetime] = None + maximum_initial_balance: Optional[float] = None + per_unit_cost_basis: Optional[str] = None status: Literal["active", "pending_payment"] diff --git a/tests/api_resources/customers/test_credits.py b/tests/api_resources/customers/test_credits.py index 85d9b630..04103085 100644 --- a/tests/api_resources/customers/test_credits.py +++ b/tests/api_resources/customers/test_credits.py @@ -34,6 +34,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: "string", currency="string", cursor="string", + include_all_blocks=True, limit=1, ) assert_matches_type(SyncPage[CreditListResponse], credit, path=["response"]) @@ -82,6 +83,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: "string", currency="string", cursor="string", + include_all_blocks=True, limit=1, ) assert_matches_type(SyncPage[CreditListByExternalIDResponse], credit, path=["response"]) @@ -134,6 +136,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None "string", currency="string", cursor="string", + include_all_blocks=True, limit=1, ) assert_matches_type(AsyncPage[CreditListResponse], credit, path=["response"]) @@ -182,6 +185,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As "string", currency="string", cursor="string", + include_all_blocks=True, limit=1, ) assert_matches_type(AsyncPage[CreditListByExternalIDResponse], credit, path=["response"]) From a05b09901baddddec77db515ae7102dec167014e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:47:59 +0000 Subject: [PATCH 14/43] chore(docs): updates price intervals docs (#302) --- .stats.yml | 2 +- src/orb/resources/subscriptions.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bc9671e3..4749834c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-2ec02cbf3446827f8bbc949216aec29ff745d79c39f1aa1b7ce2289eab0f338f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-75733a914692b0abe72ba99d622fc55b20da1c7fa7f73e2bfee30dfe32b66a51.yml diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index e9b8b8bd..cb2dba93 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1286,6 +1286,21 @@ def price_intervals( interval. This will only apply to this price interval, not any other price intervals on the subscription. + ## Adjustment intervals + + An adjustment interval represents the time period that a particular adjustment + (a discount, minimum, or maximum) applies to the prices on a subscription. + Adjustment intervals can be added to a subscription by specifying them in the + `add_adjustments` array, or modified via the `edit_adjustments` array. When + creating an adjustment interval, you'll need to provide the definition of the + new adjustment (the type of adjustment, and which prices it applies to), as well + as the start and end dates for the adjustment interval. The start and end dates + of an existing adjustment interval can be edited via the `edit_adjustments` + field (just like price intervals). (To "change" the amount of a discount, + minimum, or maximum, then, you'll need to end the existing interval, and create + a new adjustment interval with the new amount and a start date that matches the + end date of the previous interval.) + ## Editing price intervals Price intervals can be adjusted by specifying edits to make in the `edit` array. @@ -3006,6 +3021,21 @@ async def price_intervals( interval. This will only apply to this price interval, not any other price intervals on the subscription. + ## Adjustment intervals + + An adjustment interval represents the time period that a particular adjustment + (a discount, minimum, or maximum) applies to the prices on a subscription. + Adjustment intervals can be added to a subscription by specifying them in the + `add_adjustments` array, or modified via the `edit_adjustments` array. When + creating an adjustment interval, you'll need to provide the definition of the + new adjustment (the type of adjustment, and which prices it applies to), as well + as the start and end dates for the adjustment interval. The start and end dates + of an existing adjustment interval can be edited via the `edit_adjustments` + field (just like price intervals). (To "change" the amount of a discount, + minimum, or maximum, then, you'll need to end the existing interval, and create + a new adjustment interval with the new amount and a start date that matches the + end date of the previous interval.) + ## Editing price intervals Price intervals can be adjusted by specifying edits to make in the `edit` array. From e02d74db5b900a2d7a8a3d3bbdb0356ab78db978 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 19:12:39 +0000 Subject: [PATCH 15/43] chore(deps): bump anyio to v4.4.0 (#303) --- requirements-dev.lock | 3 ++- requirements.lock | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 62bebd0d..ca4966eb 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -10,7 +10,7 @@ -e file:. annotated-types==0.6.0 # via pydantic -anyio==4.1.0 +anyio==4.4.0 # via httpx # via orb-billing argcomplete==3.1.2 @@ -86,6 +86,7 @@ tomli==2.0.1 # via mypy # via pytest typing-extensions==4.8.0 + # via anyio # via mypy # via orb-billing # via pydantic diff --git a/requirements.lock b/requirements.lock index 70fec893..1bf4a4f1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -10,7 +10,7 @@ -e file:. annotated-types==0.6.0 # via pydantic -anyio==4.1.0 +anyio==4.4.0 # via httpx # via orb-billing certifi==2023.7.22 @@ -38,6 +38,7 @@ sniffio==1.3.0 # via httpx # via orb-billing typing-extensions==4.8.0 + # via anyio # via orb-billing # via pydantic # via pydantic-core From 986bd84dcb22d9413430f578c28a5adccadaacfd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:43:23 +0000 Subject: [PATCH 16/43] chore(internal): add reflection helper function (#304) --- src/orb/_utils/__init__.py | 5 ++++- src/orb/_utils/_reflection.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/orb/_utils/__init__.py b/src/orb/_utils/__init__.py index 667e2473..3efe66c8 100644 --- a/src/orb/_utils/__init__.py +++ b/src/orb/_utils/__init__.py @@ -49,4 +49,7 @@ maybe_transform as maybe_transform, async_maybe_transform as async_maybe_transform, ) -from ._reflection import function_has_argument as function_has_argument +from ._reflection import ( + function_has_argument as function_has_argument, + assert_signatures_in_sync as assert_signatures_in_sync, +) diff --git a/src/orb/_utils/_reflection.py b/src/orb/_utils/_reflection.py index e134f58e..9a53c7bd 100644 --- a/src/orb/_utils/_reflection.py +++ b/src/orb/_utils/_reflection.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import inspect from typing import Any, Callable @@ -6,3 +8,35 @@ def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: """Returns whether or not the given function has a specific parameter""" sig = inspect.signature(func) return arg_name in sig.parameters + + +def assert_signatures_in_sync( + source_func: Callable[..., Any], + check_func: Callable[..., Any], + *, + exclude_params: set[str] = set(), +) -> None: + """Ensure that the signature of the second function matches the first.""" + + check_sig = inspect.signature(check_func) + source_sig = inspect.signature(source_func) + + errors: list[str] = [] + + for name, source_param in source_sig.parameters.items(): + if name in exclude_params: + continue + + custom_param = check_sig.parameters.get(name) + if not custom_param: + errors.append(f"the `{name}` param is missing") + continue + + if custom_param.annotation != source_param.annotation: + errors.append( + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}" + ) + continue + + if errors: + raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors)) From 9a8b82f869b9bb975920f994b0bf8585196445d4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:13:01 +0000 Subject: [PATCH 17/43] chore: gitignore test server logs (#305) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0f9a66a9..87797408 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.prism.log .vscode _dev From d2a2f3fe411cb3d57b15c7f3bfd102523def0e8f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:38:33 +0000 Subject: [PATCH 18/43] chore(internal): add rich as a dev dependency (#306) it's often very helpful when writing demo scripts --- pyproject.toml | 1 + requirements-dev.lock | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index eb65d364..cc964e3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ dev-dependencies = [ "nox", "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", + "rich>=13.7.1", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index ca4966eb..a58f1973 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -44,6 +44,10 @@ idna==3.4 importlib-metadata==7.0.0 iniconfig==2.0.0 # via pytest +markdown-it-py==3.0.0 + # via rich +mdurl==0.1.2 + # via markdown-it-py mypy==1.7.1 mypy-extensions==1.0.0 # via mypy @@ -63,6 +67,8 @@ pydantic==2.7.1 # via orb-billing pydantic-core==2.18.2 # via pydantic +pygments==2.18.0 + # via rich pyright==1.1.364 pytest==7.1.1 # via pytest-asyncio @@ -72,6 +78,7 @@ python-dateutil==2.8.2 pytz==2023.3.post1 # via dirty-equals respx==0.20.2 +rich==13.7.1 ruff==0.1.9 setuptools==68.2.2 # via nodeenv From 73a4593797c5bbca315f6ed846427e388c0445ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:30:42 +0000 Subject: [PATCH 19/43] chore(internal): add helper method for constructing `BaseModel`s (#307) --- src/orb/_models.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/orb/_models.py b/src/orb/_models.py index 75c68cc7..5d95bb4b 100644 --- a/src/orb/_models.py +++ b/src/orb/_models.py @@ -10,6 +10,7 @@ ClassVar, Protocol, Required, + ParamSpec, TypedDict, TypeGuard, final, @@ -67,6 +68,9 @@ __all__ = ["BaseModel", "GenericModel"] _T = TypeVar("_T") +_BaseModelT = TypeVar("_BaseModelT", bound="BaseModel") + +P = ParamSpec("P") @runtime_checkable @@ -379,6 +383,29 @@ def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericMo return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) +def build( + base_model_cls: Callable[P, _BaseModelT], + *args: P.args, + **kwargs: P.kwargs, +) -> _BaseModelT: + """Construct a BaseModel class without validation. + + This is useful for cases where you need to instantiate a `BaseModel` + from an API response as this provides type-safe params which isn't supported + by helpers like `construct_type()`. + + ```py + build(MyModel, my_field_a="foo", my_field_b=123) + ``` + """ + if args: + raise TypeError( + "Received positional arguments which are not supported; Keyword arguments must be used instead", + ) + + return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. From 9d980dfe52c7e0a9cfdbd9dbed32540589353d1d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 19:14:28 +0000 Subject: [PATCH 20/43] fix(client): always respect content-type multipart/form-data if provided (#308) --- src/orb/_base_client.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 07eff308..7837348a 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -58,6 +58,7 @@ HttpxSendArgs, AsyncTransport, RequestOptions, + HttpxRequestFiles, ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping @@ -460,6 +461,7 @@ def _build_request( headers = self._build_headers(options) params = _merge_mappings(self.default_query, options.params) content_type = headers.get("Content-Type") + files = options.files # If the given Content-Type header is multipart/form-data then it # has to be removed so that httpx can generate the header with @@ -473,7 +475,7 @@ def _build_request( headers.pop("Content-Type") # As we are now sending multipart/form-data instead of application/json - # we need to tell httpx to use it, https://www.python-httpx.org/advanced/#multipart-file-encoding + # we need to tell httpx to use it, https://www.python-httpx.org/advanced/clients/#multipart-file-encoding if json_data: if not is_dict(json_data): raise TypeError( @@ -481,6 +483,15 @@ def _build_request( ) kwargs["data"] = self._serialize_multipartform(json_data) + # httpx determines whether or not to send a "multipart/form-data" + # request based on the truthiness of the "files" argument. + # This gets around that issue by generating a dict value that + # evaluates to true. + # + # https://github.com/encode/httpx/discussions/2399#discussioncomment-3814186 + if not files: + files = cast(HttpxRequestFiles, ForceMultipartDict()) + # TODO: report this error to httpx return self._client.build_request( # pyright: ignore[reportUnknownMemberType] headers=headers, @@ -493,7 +504,7 @@ def _build_request( # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, json=json_data, - files=options.files, + files=files, **kwargs, ) @@ -1890,6 +1901,11 @@ def make_request_options( return options +class ForceMultipartDict(Dict[str, None]): + def __bool__(self) -> bool: + return True + + class OtherPlatform: def __init__(self, name: str) -> None: self.name = name From 540ff3705d0f986577012bde92cfd2a60c45825d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:38:02 +0000 Subject: [PATCH 21/43] chore(ci): update rye to v0.35.0 (#309) --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-pypi.yml | 4 ++-- requirements-dev.lock | 1 + requirements.lock | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 83bca8f7..ac9a2e75 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} USER vscode -RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d88f089e..50f0566a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: 0.24.0 + RYE_VERSION: '0.35.0' RYE_INSTALL_OPTION: '--yes' - name: Install dependencies @@ -42,7 +42,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: 0.24.0 + RYE_VERSION: '0.35.0' RYE_INSTALL_OPTION: '--yes' - name: Bootstrap diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 1b274e06..57974dd5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -21,8 +21,8 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: 0.24.0 - RYE_INSTALL_OPTION: "--yes" + RYE_VERSION: '0.35.0' + RYE_INSTALL_OPTION: '--yes' - name: Publish to PyPI run: | diff --git a/requirements-dev.lock b/requirements-dev.lock index a58f1973..d5307e3a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -6,6 +6,7 @@ # features: [] # all-features: true # with-sources: false +# generate-hashes: false -e file:. annotated-types==0.6.0 diff --git a/requirements.lock b/requirements.lock index 1bf4a4f1..45c1b68d 100644 --- a/requirements.lock +++ b/requirements.lock @@ -6,6 +6,7 @@ # features: [] # all-features: true # with-sources: false +# generate-hashes: false -e file:. annotated-types==0.6.0 From 561898f1fa75d83d83f0c1c50d382d04cbaff7d2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:31:18 +0000 Subject: [PATCH 22/43] feat(api): add 'status' to plan creation params (#310) --- .stats.yml | 2 +- src/orb/resources/plans/plans.py | 10 ++++++++++ src/orb/types/plan_create_params.py | 6 ++++++ tests/api_resources/test_plans.py | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4749834c..3f5becfd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-75733a914692b0abe72ba99d622fc55b20da1c7fa7f73e2bfee30dfe32b66a51.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-3c64831407a4e2d742e93f5ebf78391c83a2ec833e3026518c91515240294e0b.yml diff --git a/src/orb/resources/plans/plans.py b/src/orb/resources/plans/plans.py index 63be744c..b741983d 100644 --- a/src/orb/resources/plans/plans.py +++ b/src/orb/resources/plans/plans.py @@ -59,6 +59,7 @@ def create( external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, net_terms: Optional[int] | NotGiven = NOT_GIVEN, + status: Literal["active", "draft"] | 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, @@ -87,6 +88,9 @@ def create( date for the invoice. If you intend the invoice to be due on issue, set this to 0. + status: The status of the plan to create (either active or draft). If not specified, + this defaults to active. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -108,6 +112,7 @@ def create( "external_plan_id": external_plan_id, "metadata": metadata, "net_terms": net_terms, + "status": status, }, plan_create_params.PlanCreateParams, ), @@ -318,6 +323,7 @@ async def create( external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, net_terms: Optional[int] | NotGiven = NOT_GIVEN, + status: Literal["active", "draft"] | 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, @@ -346,6 +352,9 @@ async def create( date for the invoice. If you intend the invoice to be due on issue, set this to 0. + status: The status of the plan to create (either active or draft). If not specified, + this defaults to active. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -367,6 +376,7 @@ async def create( "external_plan_id": external_plan_id, "metadata": metadata, "net_terms": net_terms, + "status": status, }, plan_create_params.PlanCreateParams, ), diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index bdcbc685..d37a3db0 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -75,6 +75,12 @@ class PlanCreateParams(TypedDict, total=False): to 0. """ + status: Literal["active", "draft"] + """The status of the plan to create (either active or draft). + + If not specified, this defaults to active. + """ + class PriceNewPlanUnitPriceUnitConfig(TypedDict, total=False): unit_amount: Required[str] diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 06948dde..7134af1a 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -61,6 +61,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: external_plan_id="string", metadata={"foo": "string"}, net_terms=0, + status="active", ) assert_matches_type(Plan, plan, path=["response"]) @@ -277,6 +278,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No external_plan_id="string", metadata={"foo": "string"}, net_terms=0, + status="active", ) assert_matches_type(Plan, plan, path=["response"]) From cfcc3ebc299a387decd8812879a8ad851dc7d6da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 15:53:53 +0000 Subject: [PATCH 23/43] chore(internal): minor request options handling changes (#311) --- src/orb/_base_client.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 7837348a..65a22b9f 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -956,6 +956,11 @@ def _request( stream: bool, stream_cls: type[_StreamT] | None, ) -> ResponseT | _StreamT: + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + cast_to = self._maybe_override_cast_to(cast_to, options) self._prepare_options(options) @@ -980,7 +985,7 @@ def _request( if retries > 0: return self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -995,7 +1000,7 @@ def _request( if retries > 0: return self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1023,7 +1028,7 @@ def _request( if retries > 0 and self._should_retry(err.response): err.response.close() return self._retry_request( - options, + input_options, cast_to, retries, err.response.headers, @@ -1532,6 +1537,11 @@ async def _request( # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + cast_to = self._maybe_override_cast_to(cast_to, options) await self._prepare_options(options) @@ -1554,7 +1564,7 @@ async def _request( if retries > 0: return await self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1569,7 +1579,7 @@ async def _request( if retries > 0: return await self._retry_request( - options, + input_options, cast_to, retries, stream=stream, @@ -1592,7 +1602,7 @@ async def _request( if retries > 0 and self._should_retry(err.response): await err.response.aclose() return await self._retry_request( - options, + input_options, cast_to, retries, err.response.headers, From 3d9704eaa3fc9acdd900a0e2357785ac93b18d6a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:38:49 +0000 Subject: [PATCH 24/43] chore(internal): add helper function (#312) --- src/orb/_models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/orb/_models.py b/src/orb/_models.py index 5d95bb4b..eb7ce3bd 100644 --- a/src/orb/_models.py +++ b/src/orb/_models.py @@ -643,6 +643,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T: return cast(_T, _validate_non_model_type(type_=type_, value=value)) +def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: + """Add a pydantic config for the given type. + + Note: this is a no-op on Pydantic v1. + """ + setattr(typ, "__pydantic_config__", config) # noqa: B010 + + # our use of subclasssing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: From e98ba6215dea14581b1d3b54b570a5f176948003 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:22:40 +0000 Subject: [PATCH 25/43] chore(internal): update mypy (#313) --- requirements-dev.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index d5307e3a..640a1a72 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -49,7 +49,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.7.1 +mypy==1.10.1 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 From 4fc3bcb9dc201a36e907a56983cb0cf8498c1f54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:23:32 +0000 Subject: [PATCH 26/43] chore(ci): also run workflows for PRs targeting `next` (#314) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50f0566a..9b865379 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: pull_request: branches: - main + - next jobs: lint: From eeee65e7b30438c9133f47f0aa86b35e54878506 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:38:29 +0000 Subject: [PATCH 27/43] chore(internal): minor import restructuring (#315) --- src/orb/resources/alerts.py | 5 +---- src/orb/resources/coupons/coupons.py | 5 +---- src/orb/resources/coupons/subscriptions.py | 5 +---- src/orb/resources/credit_notes.py | 5 +---- src/orb/resources/customers/balance_transactions.py | 5 +---- src/orb/resources/customers/costs.py | 4 +--- src/orb/resources/customers/credits/credits.py | 5 +---- src/orb/resources/customers/credits/ledger.py | 5 +---- src/orb/resources/customers/credits/top_ups.py | 5 +---- src/orb/resources/customers/customers.py | 5 +---- src/orb/resources/customers/usage.py | 4 +--- src/orb/resources/events/backfills.py | 5 +---- src/orb/resources/events/events.py | 4 +--- src/orb/resources/invoice_line_items.py | 4 +--- src/orb/resources/invoices.py | 5 +---- src/orb/resources/items.py | 5 +---- src/orb/resources/metrics.py | 5 +---- src/orb/resources/plans/external_plan_id.py | 4 +--- src/orb/resources/plans/plans.py | 5 +---- src/orb/resources/prices/external_price_id.py | 4 +--- src/orb/resources/prices/prices.py | 5 +---- src/orb/resources/subscriptions.py | 5 +---- src/orb/resources/top_level.py | 4 +--- 23 files changed, 23 insertions(+), 85 deletions(-) diff --git a/src/orb/resources/alerts.py b/src/orb/resources/alerts.py index c38cddc0..99894754 100644 --- a/src/orb/resources/alerts.py +++ b/src/orb/resources/alerts.py @@ -24,10 +24,7 @@ from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage from ..types.alert import Alert -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options __all__ = ["Alerts", "AsyncAlerts"] diff --git a/src/orb/resources/coupons/coupons.py b/src/orb/resources/coupons/coupons.py index 5f16719a..74d8d9f0 100644 --- a/src/orb/resources/coupons/coupons.py +++ b/src/orb/resources/coupons/coupons.py @@ -25,10 +25,7 @@ SubscriptionsWithStreamingResponse, AsyncSubscriptionsWithStreamingResponse, ) -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from ...types.coupon import Coupon __all__ = ["Coupons", "AsyncCoupons"] diff --git a/src/orb/resources/coupons/subscriptions.py b/src/orb/resources/coupons/subscriptions.py index 3b113ebb..a4184554 100644 --- a/src/orb/resources/coupons/subscriptions.py +++ b/src/orb/resources/coupons/subscriptions.py @@ -13,10 +13,7 @@ from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from ...types.coupons import subscription_list_params from ...types.subscription import Subscription diff --git a/src/orb/resources/credit_notes.py b/src/orb/resources/credit_notes.py index 336dae7c..c4aa0f94 100644 --- a/src/orb/resources/credit_notes.py +++ b/src/orb/resources/credit_notes.py @@ -14,10 +14,7 @@ from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options from ..types.credit_note import CreditNote __all__ = ["CreditNotes", "AsyncCreditNotes"] diff --git a/src/orb/resources/customers/balance_transactions.py b/src/orb/resources/customers/balance_transactions.py index 69dc7c4c..dfc7c425 100644 --- a/src/orb/resources/customers/balance_transactions.py +++ b/src/orb/resources/customers/balance_transactions.py @@ -18,10 +18,7 @@ from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from ...types.customers import balance_transaction_list_params, balance_transaction_create_params from ...types.customers.balance_transaction_list_response import BalanceTransactionListResponse from ...types.customers.balance_transaction_create_response import BalanceTransactionCreateResponse diff --git a/src/orb/resources/customers/costs.py b/src/orb/resources/customers/costs.py index 3485889f..14ce1cb8 100644 --- a/src/orb/resources/customers/costs.py +++ b/src/orb/resources/customers/costs.py @@ -17,9 +17,7 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) +from ..._base_client import make_request_options from ...types.customers import cost_list_params, cost_list_by_external_id_params from ...types.customers.cost_list_response import CostListResponse from ...types.customers.cost_list_by_external_id_response import CostListByExternalIDResponse diff --git a/src/orb/resources/customers/credits/credits.py b/src/orb/resources/customers/credits/credits.py index 4add0e15..6167390b 100644 --- a/src/orb/resources/customers/credits/credits.py +++ b/src/orb/resources/customers/credits/credits.py @@ -29,10 +29,7 @@ from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ....pagination import SyncPage, AsyncPage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) +from ...._base_client import AsyncPaginator, make_request_options from ....types.customers import credit_list_params, credit_list_by_external_id_params from ....types.customers.credit_list_response import CreditListResponse from ....types.customers.credit_list_by_external_id_response import CreditListByExternalIDResponse diff --git a/src/orb/resources/customers/credits/ledger.py b/src/orb/resources/customers/credits/ledger.py index 4abe4edd..f9853958 100644 --- a/src/orb/resources/customers/credits/ledger.py +++ b/src/orb/resources/customers/credits/ledger.py @@ -19,10 +19,7 @@ from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ....pagination import SyncPage, AsyncPage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) +from ...._base_client import AsyncPaginator, make_request_options from ....types.customers.credits import ( ledger_list_params, ledger_create_entry_params, diff --git a/src/orb/resources/customers/credits/top_ups.py b/src/orb/resources/customers/credits/top_ups.py index bf9c7036..111fa566 100644 --- a/src/orb/resources/customers/credits/top_ups.py +++ b/src/orb/resources/customers/credits/top_ups.py @@ -17,10 +17,7 @@ from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ....pagination import SyncPage, AsyncPage -from ...._base_client import ( - AsyncPaginator, - make_request_options, -) +from ...._base_client import AsyncPaginator, make_request_options from ....types.customers.credits import ( top_up_list_params, top_up_create_params, diff --git a/src/orb/resources/customers/customers.py b/src/orb/resources/customers/customers.py index 249f4bf6..5e836780 100644 --- a/src/orb/resources/customers/customers.py +++ b/src/orb/resources/customers/customers.py @@ -48,10 +48,7 @@ from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from .credits.credits import Credits, AsyncCredits from ...types.customer import Customer from .balance_transactions import ( diff --git a/src/orb/resources/customers/usage.py b/src/orb/resources/customers/usage.py index a9522e51..7c0dab35 100644 --- a/src/orb/resources/customers/usage.py +++ b/src/orb/resources/customers/usage.py @@ -16,9 +16,7 @@ from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) +from ..._base_client import make_request_options from ...types.customers import usage_update_params, usage_update_by_external_id_params from ...types.customers.usage_update_response import UsageUpdateResponse from ...types.customers.usage_update_by_external_id_response import UsageUpdateByExternalIDResponse diff --git a/src/orb/resources/events/backfills.py b/src/orb/resources/events/backfills.py index 9654ec26..45e7009f 100644 --- a/src/orb/resources/events/backfills.py +++ b/src/orb/resources/events/backfills.py @@ -17,10 +17,7 @@ from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from ...types.events import backfill_list_params, backfill_create_params from ...types.events.backfill_list_response import BackfillListResponse from ...types.events.backfill_close_response import BackfillCloseResponse diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index 652db24e..738dfb26 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -25,9 +25,7 @@ ) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) +from ..._base_client import make_request_options from ...types.event_ingest_response import EventIngestResponse from ...types.event_search_response import EventSearchResponse from ...types.event_update_response import EventUpdateResponse diff --git a/src/orb/resources/invoice_line_items.py b/src/orb/resources/invoice_line_items.py index bd54c786..3cc42cab 100644 --- a/src/orb/resources/invoice_line_items.py +++ b/src/orb/resources/invoice_line_items.py @@ -17,9 +17,7 @@ from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.invoice_line_item_create_response import InvoiceLineItemCreateResponse __all__ = ["InvoiceLineItems", "AsyncInvoiceLineItems"] diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index e43f9b33..7a87a534 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -25,10 +25,7 @@ from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options from ..types.invoice import Invoice from ..types.invoice_fetch_upcoming_response import InvoiceFetchUpcomingResponse diff --git a/src/orb/resources/items.py b/src/orb/resources/items.py index e31356be..2121f1de 100644 --- a/src/orb/resources/items.py +++ b/src/orb/resources/items.py @@ -18,10 +18,7 @@ from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage from ..types.item import Item -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options __all__ = ["Items", "AsyncItems"] diff --git a/src/orb/resources/metrics.py b/src/orb/resources/metrics.py index 36229db0..7446c956 100644 --- a/src/orb/resources/metrics.py +++ b/src/orb/resources/metrics.py @@ -18,10 +18,7 @@ from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options from ..types.metric_list_response import MetricListResponse from ..types.metric_fetch_response import MetricFetchResponse from ..types.metric_create_response import MetricCreateResponse diff --git a/src/orb/resources/plans/external_plan_id.py b/src/orb/resources/plans/external_plan_id.py index a978def7..9b99ce1d 100644 --- a/src/orb/resources/plans/external_plan_id.py +++ b/src/orb/resources/plans/external_plan_id.py @@ -17,9 +17,7 @@ from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...types.plan import Plan from ...types.plans import external_plan_id_update_params -from ..._base_client import ( - make_request_options, -) +from ..._base_client import make_request_options __all__ = ["ExternalPlanID", "AsyncExternalPlanID"] diff --git a/src/orb/resources/plans/plans.py b/src/orb/resources/plans/plans.py index b741983d..e32f43a5 100644 --- a/src/orb/resources/plans/plans.py +++ b/src/orb/resources/plans/plans.py @@ -20,10 +20,7 @@ from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage from ...types.plan import Plan -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from .external_plan_id import ( ExternalPlanID, AsyncExternalPlanID, diff --git a/src/orb/resources/prices/external_price_id.py b/src/orb/resources/prices/external_price_id.py index 45842875..f574a6b6 100644 --- a/src/orb/resources/prices/external_price_id.py +++ b/src/orb/resources/prices/external_price_id.py @@ -12,9 +12,7 @@ from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...types.price import Price -from ..._base_client import ( - make_request_options, -) +from ..._base_client import make_request_options __all__ = ["ExternalPriceID", "AsyncExternalPriceID"] diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index b8885ad6..5050fe02 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -21,10 +21,7 @@ from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...pagination import SyncPage, AsyncPage from ...types.price import Price -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) +from ..._base_client import AsyncPaginator, make_request_options from .external_price_id import ( ExternalPriceID, AsyncExternalPriceID, diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index cb2dba93..84f46419 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -32,10 +32,7 @@ from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) +from .._base_client import AsyncPaginator, make_request_options from ..types.subscription import Subscription from ..types.subscription_usage import SubscriptionUsage from ..types.subscription_fetch_costs_response import SubscriptionFetchCostsResponse diff --git a/src/orb/resources/top_level.py b/src/orb/resources/top_level.py index 1f02216a..4968a63a 100644 --- a/src/orb/resources/top_level.py +++ b/src/orb/resources/top_level.py @@ -9,9 +9,7 @@ from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from .._base_client import ( - make_request_options, -) +from .._base_client import make_request_options from ..types.top_level_ping_response import TopLevelPingResponse __all__ = ["TopLevel", "AsyncTopLevel"] From a451ed63406c95767251f976805496a1cf300b5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:29:33 +0000 Subject: [PATCH 28/43] docs(examples): use named params more (#316) --- .../coupons/test_subscriptions.py | 24 +- .../customers/credits/test_ledger.py | 448 +++--- .../customers/credits/test_top_ups.py | 328 ++--- .../customers/test_balance_transactions.py | 68 +- tests/api_resources/customers/test_costs.py | 40 +- tests/api_resources/customers/test_credits.py | 56 +- tests/api_resources/customers/test_usage.py | 208 +-- tests/api_resources/events/test_backfills.py | 48 +- .../plans/test_external_plan_id.py | 36 +- .../prices/test_external_price_id.py | 12 +- tests/api_resources/test_alerts.py | 216 +-- tests/api_resources/test_coupons.py | 32 +- tests/api_resources/test_credit_notes.py | 16 +- tests/api_resources/test_customers.py | 396 +++--- tests/api_resources/test_events.py | 184 +-- tests/api_resources/test_invoices.py | 148 +- tests/api_resources/test_items.py | 52 +- tests/api_resources/test_metrics.py | 32 +- tests/api_resources/test_plans.py | 128 +- tests/api_resources/test_prices.py | 1204 +++++++++-------- tests/api_resources/test_subscriptions.py | 540 ++++---- 21 files changed, 2126 insertions(+), 2090 deletions(-) diff --git a/tests/api_resources/coupons/test_subscriptions.py b/tests/api_resources/coupons/test_subscriptions.py index 234271d4..4c190521 100644 --- a/tests/api_resources/coupons/test_subscriptions.py +++ b/tests/api_resources/coupons/test_subscriptions.py @@ -21,15 +21,15 @@ class TestSubscriptions: @parametrize def test_method_list(self, client: Orb) -> None: subscription = client.coupons.subscriptions.list( - "string", + coupon_id="coupon_id", ) assert_matches_type(SyncPage[Subscription], subscription, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: subscription = client.coupons.subscriptions.list( - "string", - cursor="string", + coupon_id="coupon_id", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Subscription], subscription, path=["response"]) @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.coupons.subscriptions.with_raw_response.list( - "string", + coupon_id="coupon_id", ) assert response.is_closed is True @@ -48,7 +48,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.coupons.subscriptions.with_streaming_response.list( - "string", + coupon_id="coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,7 +62,7 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `coupon_id` but received ''"): client.coupons.subscriptions.with_raw_response.list( - "", + coupon_id="", ) @@ -72,15 +72,15 @@ class TestAsyncSubscriptions: @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: subscription = await async_client.coupons.subscriptions.list( - "string", + coupon_id="coupon_id", ) assert_matches_type(AsyncPage[Subscription], subscription, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.coupons.subscriptions.list( - "string", - cursor="string", + coupon_id="coupon_id", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Subscription], subscription, path=["response"]) @@ -88,7 +88,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.coupons.subscriptions.with_raw_response.list( - "string", + coupon_id="coupon_id", ) assert response.is_closed is True @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.coupons.subscriptions.with_streaming_response.list( - "string", + coupon_id="coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -113,5 +113,5 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `coupon_id` but received ''"): await async_client.coupons.subscriptions.with_raw_response.list( - "", + coupon_id="", ) diff --git a/tests/api_resources/customers/credits/test_ledger.py b/tests/api_resources/customers/credits/test_ledger.py index d442ed7a..ff759955 100644 --- a/tests/api_resources/customers/credits/test_ledger.py +++ b/tests/api_resources/customers/credits/test_ledger.py @@ -27,31 +27,31 @@ class TestLedger: @parametrize def test_method_list(self, client: Orb) -> None: ledger = client.customers.credits.ledger.list( - "string", + customer_id="customer_id", ) assert_matches_type(SyncPage[LedgerListResponse], ledger, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: ledger = client.customers.credits.ledger.list( - "string", + customer_id="customer_id", created_at_gt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - currency="string", - cursor="string", + currency="currency", + cursor="cursor", entry_status="committed", entry_type="increment", limit=1, - minimum_amount="string", + minimum_amount="minimum_amount", ) assert_matches_type(SyncPage[LedgerListResponse], ledger, path=["response"]) @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -62,7 +62,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -76,13 +76,13 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.list( - "", + customer_id="", ) @parametrize def test_method_create_entry_overload_1(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) @@ -91,28 +91,28 @@ def test_method_create_entry_overload_1(self, client: Orb) -> None: @parametrize def test_method_create_entry_with_all_params_overload_1(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", - currency="string", - description="string", + currency="currency", + description="description", effective_date=parse_datetime("2019-12-27T18:11:19.117Z"), expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, metadata={"foo": "string"}, - per_unit_cost_basis="string", + per_unit_cost_basis="per_unit_cost_basis", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @parametrize def test_raw_response_create_entry_overload_1(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) @@ -125,7 +125,7 @@ def test_raw_response_create_entry_overload_1(self, client: Orb) -> None: @parametrize def test_streaming_response_create_entry_overload_1(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) as response: @@ -141,7 +141,7 @@ def test_streaming_response_create_entry_overload_1(self, client: Orb) -> None: def test_path_params_create_entry_overload_1(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, entry_type="increment", ) @@ -149,7 +149,7 @@ def test_path_params_create_entry_overload_1(self, client: Orb) -> None: @parametrize def test_method_create_entry_overload_2(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) @@ -158,11 +158,11 @@ def test_method_create_entry_overload_2(self, client: Orb) -> None: @parametrize def test_method_create_entry_with_all_params_overload_2(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -170,7 +170,7 @@ def test_method_create_entry_with_all_params_overload_2(self, client: Orb) -> No @parametrize def test_raw_response_create_entry_overload_2(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) @@ -183,7 +183,7 @@ def test_raw_response_create_entry_overload_2(self, client: Orb) -> None: @parametrize def test_streaming_response_create_entry_overload_2(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) as response: @@ -199,7 +199,7 @@ def test_streaming_response_create_entry_overload_2(self, client: Orb) -> None: def test_path_params_create_entry_overload_2(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, entry_type="decrement", ) @@ -207,7 +207,7 @@ def test_path_params_create_entry_overload_2(self, client: Orb) -> None: @parametrize def test_method_create_entry_overload_3(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -217,14 +217,14 @@ def test_method_create_entry_overload_3(self, client: Orb) -> None: @parametrize def test_method_create_entry_with_all_params_overload_3(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), amount=0, - block_id="string", - currency="string", - description="string", + block_id="block_id", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -232,7 +232,7 @@ def test_method_create_entry_with_all_params_overload_3(self, client: Orb) -> No @parametrize def test_raw_response_create_entry_overload_3(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -246,7 +246,7 @@ def test_raw_response_create_entry_overload_3(self, client: Orb) -> None: @parametrize def test_streaming_response_create_entry_overload_3(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -263,7 +263,7 @@ def test_streaming_response_create_entry_overload_3(self, client: Orb) -> None: def test_path_params_create_entry_overload_3(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -272,9 +272,9 @@ def test_path_params_create_entry_overload_3(self, client: Orb) -> None: @parametrize def test_method_create_entry_overload_4(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -282,12 +282,12 @@ def test_method_create_entry_overload_4(self, client: Orb) -> None: @parametrize def test_method_create_entry_with_all_params_overload_4(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, void_reason="refund", ) @@ -296,9 +296,9 @@ def test_method_create_entry_with_all_params_overload_4(self, client: Orb) -> No @parametrize def test_raw_response_create_entry_overload_4(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @@ -310,9 +310,9 @@ def test_raw_response_create_entry_overload_4(self, client: Orb) -> None: @parametrize def test_streaming_response_create_entry_overload_4(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) as response: assert not response.is_closed @@ -327,18 +327,18 @@ def test_streaming_response_create_entry_overload_4(self, client: Orb) -> None: def test_path_params_create_entry_overload_4(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @parametrize def test_method_create_entry_overload_5(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -346,12 +346,12 @@ def test_method_create_entry_overload_5(self, client: Orb) -> None: @parametrize def test_method_create_entry_with_all_params_overload_5(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -359,9 +359,9 @@ def test_method_create_entry_with_all_params_overload_5(self, client: Orb) -> No @parametrize def test_raw_response_create_entry_overload_5(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @@ -373,9 +373,9 @@ def test_raw_response_create_entry_overload_5(self, client: Orb) -> None: @parametrize def test_streaming_response_create_entry_overload_5(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) as response: assert not response.is_closed @@ -390,16 +390,16 @@ def test_streaming_response_create_entry_overload_5(self, client: Orb) -> None: def test_path_params_create_entry_overload_5(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @parametrize def test_method_create_entry_by_external_id_overload_1(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) @@ -408,28 +408,28 @@ def test_method_create_entry_by_external_id_overload_1(self, client: Orb) -> Non @parametrize def test_method_create_entry_by_external_id_with_all_params_overload_1(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", - currency="string", - description="string", + currency="currency", + description="description", effective_date=parse_datetime("2019-12-27T18:11:19.117Z"), expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, metadata={"foo": "string"}, - per_unit_cost_basis="string", + per_unit_cost_basis="per_unit_cost_basis", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @parametrize def test_raw_response_create_entry_by_external_id_overload_1(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) @@ -442,7 +442,7 @@ def test_raw_response_create_entry_by_external_id_overload_1(self, client: Orb) @parametrize def test_streaming_response_create_entry_by_external_id_overload_1(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) as response: @@ -458,7 +458,7 @@ def test_streaming_response_create_entry_by_external_id_overload_1(self, client: def test_path_params_create_entry_by_external_id_overload_1(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, entry_type="increment", ) @@ -466,7 +466,7 @@ def test_path_params_create_entry_by_external_id_overload_1(self, client: Orb) - @parametrize def test_method_create_entry_by_external_id_overload_2(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) @@ -475,11 +475,11 @@ def test_method_create_entry_by_external_id_overload_2(self, client: Orb) -> Non @parametrize def test_method_create_entry_by_external_id_with_all_params_overload_2(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -487,7 +487,7 @@ def test_method_create_entry_by_external_id_with_all_params_overload_2(self, cli @parametrize def test_raw_response_create_entry_by_external_id_overload_2(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) @@ -500,7 +500,7 @@ def test_raw_response_create_entry_by_external_id_overload_2(self, client: Orb) @parametrize def test_streaming_response_create_entry_by_external_id_overload_2(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) as response: @@ -516,7 +516,7 @@ def test_streaming_response_create_entry_by_external_id_overload_2(self, client: def test_path_params_create_entry_by_external_id_overload_2(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, entry_type="decrement", ) @@ -524,7 +524,7 @@ def test_path_params_create_entry_by_external_id_overload_2(self, client: Orb) - @parametrize def test_method_create_entry_by_external_id_overload_3(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -534,14 +534,14 @@ def test_method_create_entry_by_external_id_overload_3(self, client: Orb) -> Non @parametrize def test_method_create_entry_by_external_id_with_all_params_overload_3(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), amount=0, - block_id="string", - currency="string", - description="string", + block_id="block_id", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -549,7 +549,7 @@ def test_method_create_entry_by_external_id_with_all_params_overload_3(self, cli @parametrize def test_raw_response_create_entry_by_external_id_overload_3(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -563,7 +563,7 @@ def test_raw_response_create_entry_by_external_id_overload_3(self, client: Orb) @parametrize def test_streaming_response_create_entry_by_external_id_overload_3(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -580,7 +580,7 @@ def test_streaming_response_create_entry_by_external_id_overload_3(self, client: def test_path_params_create_entry_by_external_id_overload_3(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -589,9 +589,9 @@ def test_path_params_create_entry_by_external_id_overload_3(self, client: Orb) - @parametrize def test_method_create_entry_by_external_id_overload_4(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -599,12 +599,12 @@ def test_method_create_entry_by_external_id_overload_4(self, client: Orb) -> Non @parametrize def test_method_create_entry_by_external_id_with_all_params_overload_4(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, void_reason="refund", ) @@ -613,9 +613,9 @@ def test_method_create_entry_by_external_id_with_all_params_overload_4(self, cli @parametrize def test_raw_response_create_entry_by_external_id_overload_4(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @@ -627,9 +627,9 @@ def test_raw_response_create_entry_by_external_id_overload_4(self, client: Orb) @parametrize def test_streaming_response_create_entry_by_external_id_overload_4(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) as response: assert not response.is_closed @@ -644,18 +644,18 @@ def test_streaming_response_create_entry_by_external_id_overload_4(self, client: def test_path_params_create_entry_by_external_id_overload_4(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @parametrize def test_method_create_entry_by_external_id_overload_5(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -663,12 +663,12 @@ def test_method_create_entry_by_external_id_overload_5(self, client: Orb) -> Non @parametrize def test_method_create_entry_by_external_id_with_all_params_overload_5(self, client: Orb) -> None: ledger = client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -676,9 +676,9 @@ def test_method_create_entry_by_external_id_with_all_params_overload_5(self, cli @parametrize def test_raw_response_create_entry_by_external_id_overload_5(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @@ -690,9 +690,9 @@ def test_raw_response_create_entry_by_external_id_overload_5(self, client: Orb) @parametrize def test_streaming_response_create_entry_by_external_id_overload_5(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) as response: assert not response.is_closed @@ -707,40 +707,40 @@ def test_streaming_response_create_entry_by_external_id_overload_5(self, client: def test_path_params_create_entry_by_external_id_overload_5(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @parametrize def test_method_list_by_external_id(self, client: Orb) -> None: ledger = client.customers.credits.ledger.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(SyncPage[LedgerListByExternalIDResponse], ledger, path=["response"]) @parametrize def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: ledger = client.customers.credits.ledger.list_by_external_id( - "string", + external_customer_id="external_customer_id", created_at_gt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - currency="string", - cursor="string", + currency="currency", + cursor="cursor", entry_status="committed", entry_type="increment", limit=1, - minimum_amount="string", + minimum_amount="minimum_amount", ) assert_matches_type(SyncPage[LedgerListByExternalIDResponse], ledger, path=["response"]) @parametrize def test_raw_response_list_by_external_id(self, client: Orb) -> None: response = client.customers.credits.ledger.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -751,7 +751,7 @@ def test_raw_response_list_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_list_by_external_id(self, client: Orb) -> None: with client.customers.credits.ledger.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -765,7 +765,7 @@ def test_streaming_response_list_by_external_id(self, client: Orb) -> None: def test_path_params_list_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.ledger.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) @@ -775,31 +775,31 @@ class TestAsyncLedger: @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.list( - "string", + customer_id="customer_id", ) assert_matches_type(AsyncPage[LedgerListResponse], ledger, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.list( - "string", + customer_id="customer_id", created_at_gt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - currency="string", - cursor="string", + currency="currency", + cursor="cursor", entry_status="committed", entry_type="increment", limit=1, - minimum_amount="string", + minimum_amount="minimum_amount", ) assert_matches_type(AsyncPage[LedgerListResponse], ledger, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -810,7 +810,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -824,13 +824,13 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.list( - "", + customer_id="", ) @parametrize async def test_method_create_entry_overload_1(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) @@ -839,28 +839,28 @@ async def test_method_create_entry_overload_1(self, async_client: AsyncOrb) -> N @parametrize async def test_method_create_entry_with_all_params_overload_1(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", - currency="string", - description="string", + currency="currency", + description="description", effective_date=parse_datetime("2019-12-27T18:11:19.117Z"), expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, metadata={"foo": "string"}, - per_unit_cost_basis="string", + per_unit_cost_basis="per_unit_cost_basis", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @parametrize async def test_raw_response_create_entry_overload_1(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) @@ -873,7 +873,7 @@ async def test_raw_response_create_entry_overload_1(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_entry_overload_1(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="increment", ) as response: @@ -889,7 +889,7 @@ async def test_streaming_response_create_entry_overload_1(self, async_client: As async def test_path_params_create_entry_overload_1(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, entry_type="increment", ) @@ -897,7 +897,7 @@ async def test_path_params_create_entry_overload_1(self, async_client: AsyncOrb) @parametrize async def test_method_create_entry_overload_2(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) @@ -906,11 +906,11 @@ async def test_method_create_entry_overload_2(self, async_client: AsyncOrb) -> N @parametrize async def test_method_create_entry_with_all_params_overload_2(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -918,7 +918,7 @@ async def test_method_create_entry_with_all_params_overload_2(self, async_client @parametrize async def test_raw_response_create_entry_overload_2(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) @@ -931,7 +931,7 @@ async def test_raw_response_create_entry_overload_2(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_entry_overload_2(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, entry_type="decrement", ) as response: @@ -947,7 +947,7 @@ async def test_streaming_response_create_entry_overload_2(self, async_client: As async def test_path_params_create_entry_overload_2(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, entry_type="decrement", ) @@ -955,7 +955,7 @@ async def test_path_params_create_entry_overload_2(self, async_client: AsyncOrb) @parametrize async def test_method_create_entry_overload_3(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -965,14 +965,14 @@ async def test_method_create_entry_overload_3(self, async_client: AsyncOrb) -> N @parametrize async def test_method_create_entry_with_all_params_overload_3(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), amount=0, - block_id="string", - currency="string", - description="string", + block_id="block_id", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -980,7 +980,7 @@ async def test_method_create_entry_with_all_params_overload_3(self, async_client @parametrize async def test_raw_response_create_entry_overload_3(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -994,7 +994,7 @@ async def test_raw_response_create_entry_overload_3(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_entry_overload_3(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1011,7 +1011,7 @@ async def test_streaming_response_create_entry_overload_3(self, async_client: As async def test_path_params_create_entry_overload_3(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1020,9 +1020,9 @@ async def test_path_params_create_entry_overload_3(self, async_client: AsyncOrb) @parametrize async def test_method_create_entry_overload_4(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -1030,12 +1030,12 @@ async def test_method_create_entry_overload_4(self, async_client: AsyncOrb) -> N @parametrize async def test_method_create_entry_with_all_params_overload_4(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, void_reason="refund", ) @@ -1044,9 +1044,9 @@ async def test_method_create_entry_with_all_params_overload_4(self, async_client @parametrize async def test_raw_response_create_entry_overload_4(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @@ -1058,9 +1058,9 @@ async def test_raw_response_create_entry_overload_4(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_entry_overload_4(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) as response: assert not response.is_closed @@ -1075,18 +1075,18 @@ async def test_streaming_response_create_entry_overload_4(self, async_client: As async def test_path_params_create_entry_overload_4(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @parametrize async def test_method_create_entry_overload_5(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -1094,12 +1094,12 @@ async def test_method_create_entry_overload_5(self, async_client: AsyncOrb) -> N @parametrize async def test_method_create_entry_with_all_params_overload_5(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryResponse, ledger, path=["response"]) @@ -1107,9 +1107,9 @@ async def test_method_create_entry_with_all_params_overload_5(self, async_client @parametrize async def test_raw_response_create_entry_overload_5(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @@ -1121,9 +1121,9 @@ async def test_raw_response_create_entry_overload_5(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_entry_overload_5(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry( - "string", + customer_id="customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) as response: assert not response.is_closed @@ -1138,16 +1138,16 @@ async def test_streaming_response_create_entry_overload_5(self, async_client: As async def test_path_params_create_entry_overload_5(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry( - "", + customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @parametrize async def test_method_create_entry_by_external_id_overload_1(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) @@ -1156,28 +1156,28 @@ async def test_method_create_entry_by_external_id_overload_1(self, async_client: @parametrize async def test_method_create_entry_by_external_id_with_all_params_overload_1(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", - currency="string", - description="string", + currency="currency", + description="description", effective_date=parse_datetime("2019-12-27T18:11:19.117Z"), expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, metadata={"foo": "string"}, - per_unit_cost_basis="string", + per_unit_cost_basis="per_unit_cost_basis", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @parametrize async def test_raw_response_create_entry_by_external_id_overload_1(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) @@ -1190,7 +1190,7 @@ async def test_raw_response_create_entry_by_external_id_overload_1(self, async_c @parametrize async def test_streaming_response_create_entry_by_external_id_overload_1(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="increment", ) as response: @@ -1206,7 +1206,7 @@ async def test_streaming_response_create_entry_by_external_id_overload_1(self, a async def test_path_params_create_entry_by_external_id_overload_1(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, entry_type="increment", ) @@ -1214,7 +1214,7 @@ async def test_path_params_create_entry_by_external_id_overload_1(self, async_cl @parametrize async def test_method_create_entry_by_external_id_overload_2(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) @@ -1223,11 +1223,11 @@ async def test_method_create_entry_by_external_id_overload_2(self, async_client: @parametrize async def test_method_create_entry_by_external_id_with_all_params_overload_2(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -1235,7 +1235,7 @@ async def test_method_create_entry_by_external_id_with_all_params_overload_2(sel @parametrize async def test_raw_response_create_entry_by_external_id_overload_2(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) @@ -1248,7 +1248,7 @@ async def test_raw_response_create_entry_by_external_id_overload_2(self, async_c @parametrize async def test_streaming_response_create_entry_by_external_id_overload_2(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, entry_type="decrement", ) as response: @@ -1264,7 +1264,7 @@ async def test_streaming_response_create_entry_by_external_id_overload_2(self, a async def test_path_params_create_entry_by_external_id_overload_2(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, entry_type="decrement", ) @@ -1272,7 +1272,7 @@ async def test_path_params_create_entry_by_external_id_overload_2(self, async_cl @parametrize async def test_method_create_entry_by_external_id_overload_3(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1282,14 +1282,14 @@ async def test_method_create_entry_by_external_id_overload_3(self, async_client: @parametrize async def test_method_create_entry_by_external_id_with_all_params_overload_3(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), amount=0, - block_id="string", - currency="string", - description="string", + block_id="block_id", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -1297,7 +1297,7 @@ async def test_method_create_entry_by_external_id_with_all_params_overload_3(sel @parametrize async def test_raw_response_create_entry_by_external_id_overload_3(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1311,7 +1311,7 @@ async def test_raw_response_create_entry_by_external_id_overload_3(self, async_c @parametrize async def test_streaming_response_create_entry_by_external_id_overload_3(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1328,7 +1328,7 @@ async def test_streaming_response_create_entry_by_external_id_overload_3(self, a async def test_path_params_create_entry_by_external_id_overload_3(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", entry_type="expiration_change", expiry_date=parse_datetime("2019-12-27T18:11:19.117Z"), target_expiry_date=parse_date("2019-12-27"), @@ -1337,9 +1337,9 @@ async def test_path_params_create_entry_by_external_id_overload_3(self, async_cl @parametrize async def test_method_create_entry_by_external_id_overload_4(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -1347,12 +1347,12 @@ async def test_method_create_entry_by_external_id_overload_4(self, async_client: @parametrize async def test_method_create_entry_by_external_id_with_all_params_overload_4(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, void_reason="refund", ) @@ -1361,9 +1361,9 @@ async def test_method_create_entry_by_external_id_with_all_params_overload_4(sel @parametrize async def test_raw_response_create_entry_by_external_id_overload_4(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @@ -1375,9 +1375,9 @@ async def test_raw_response_create_entry_by_external_id_overload_4(self, async_c @parametrize async def test_streaming_response_create_entry_by_external_id_overload_4(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) as response: assert not response.is_closed @@ -1392,18 +1392,18 @@ async def test_streaming_response_create_entry_by_external_id_overload_4(self, a async def test_path_params_create_entry_by_external_id_overload_4(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="void", ) @parametrize async def test_method_create_entry_by_external_id_overload_5(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -1411,12 +1411,12 @@ async def test_method_create_entry_by_external_id_overload_5(self, async_client: @parametrize async def test_method_create_entry_by_external_id_with_all_params_overload_5(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", - currency="string", - description="string", + currency="currency", + description="description", metadata={"foo": "string"}, ) assert_matches_type(LedgerCreateEntryByExternalIDResponse, ledger, path=["response"]) @@ -1424,9 +1424,9 @@ async def test_method_create_entry_by_external_id_with_all_params_overload_5(sel @parametrize async def test_raw_response_create_entry_by_external_id_overload_5(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @@ -1438,9 +1438,9 @@ async def test_raw_response_create_entry_by_external_id_overload_5(self, async_c @parametrize async def test_streaming_response_create_entry_by_external_id_overload_5(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.create_entry_by_external_id( - "string", + external_customer_id="external_customer_id", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) as response: assert not response.is_closed @@ -1455,40 +1455,40 @@ async def test_streaming_response_create_entry_by_external_id_overload_5(self, a async def test_path_params_create_entry_by_external_id_overload_5(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.create_entry_by_external_id( - "", + external_customer_id="", amount=0, - block_id="string", + block_id="block_id", entry_type="amendment", ) @parametrize async def test_method_list_by_external_id(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(AsyncPage[LedgerListByExternalIDResponse], ledger, path=["response"]) @parametrize async def test_method_list_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: ledger = await async_client.customers.credits.ledger.list_by_external_id( - "string", + external_customer_id="external_customer_id", created_at_gt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - currency="string", - cursor="string", + currency="currency", + cursor="cursor", entry_status="committed", entry_type="increment", limit=1, - minimum_amount="string", + minimum_amount="minimum_amount", ) assert_matches_type(AsyncPage[LedgerListByExternalIDResponse], ledger, path=["response"]) @parametrize async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.ledger.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -1499,7 +1499,7 @@ async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_list_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.ledger.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1513,5 +1513,5 @@ async def test_streaming_response_list_by_external_id(self, async_client: AsyncO async def test_path_params_list_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.ledger.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) diff --git a/tests/api_resources/customers/credits/test_top_ups.py b/tests/api_resources/customers/credits/test_top_ups.py index b0f01ed8..b830664e 100644 --- a/tests/api_resources/customers/credits/test_top_ups.py +++ b/tests/api_resources/customers/credits/test_top_ups.py @@ -26,32 +26,32 @@ class TestTopUps: @parametrize def test_method_create(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert_matches_type(TopUpCreateResponse, top_up, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", expires_after=0, expires_after_unit="day", ) @@ -60,15 +60,15 @@ def test_method_create_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_create(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert response.is_closed is True @@ -79,15 +79,15 @@ def test_raw_response_create(self, client: Orb) -> None: @parametrize def test_streaming_response_create(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -101,29 +101,29 @@ def test_streaming_response_create(self, client: Orb) -> None: def test_path_params_create(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.create( - "", - amount="string", - currency="string", + customer_id="", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) @parametrize def test_method_list(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.list( - "string", + customer_id="customer_id", ) assert_matches_type(SyncPage[TopUpListResponse], top_up, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.list( - "string", - cursor="string", + customer_id="customer_id", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[TopUpListResponse], top_up, path=["response"]) @@ -131,7 +131,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -142,7 +142,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -156,22 +156,22 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.list( - "", + customer_id="", ) @parametrize def test_method_delete(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) assert top_up is None @parametrize def test_raw_response_delete(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) assert response.is_closed is True @@ -182,8 +182,8 @@ def test_raw_response_delete(self, client: Orb) -> None: @parametrize def test_streaming_response_delete(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -197,45 +197,45 @@ def test_streaming_response_delete(self, client: Orb) -> None: def test_path_params_delete(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.delete( - "string", + top_up_id="top_up_id", customer_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `top_up_id` but received ''"): client.customers.credits.top_ups.with_raw_response.delete( - "", - customer_id="string", + top_up_id="", + customer_id="customer_id", ) @parametrize def test_method_create_by_external_id(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert_matches_type(TopUpCreateByExternalIDResponse, top_up, path=["response"]) @parametrize def test_method_create_by_external_id_with_all_params(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", expires_after=0, expires_after_unit="day", ) @@ -244,15 +244,15 @@ def test_method_create_by_external_id_with_all_params(self, client: Orb) -> None @parametrize def test_raw_response_create_by_external_id(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert response.is_closed is True @@ -263,15 +263,15 @@ def test_raw_response_create_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_create_by_external_id(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -285,30 +285,30 @@ def test_streaming_response_create_by_external_id(self, client: Orb) -> None: def test_path_params_create_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.create_by_external_id( - "", - amount="string", - currency="string", + external_customer_id="", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) @parametrize def test_method_delete_by_external_id(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) assert top_up is None @parametrize def test_raw_response_delete_by_external_id(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -319,8 +319,8 @@ def test_raw_response_delete_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_delete_by_external_id(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -334,28 +334,28 @@ def test_streaming_response_delete_by_external_id(self, client: Orb) -> None: def test_path_params_delete_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "string", + top_up_id="top_up_id", external_customer_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `top_up_id` but received ''"): client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "", - external_customer_id="string", + top_up_id="", + external_customer_id="external_customer_id", ) @parametrize def test_method_list_by_external_id(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(SyncPage[TopUpListByExternalIDResponse], top_up, path=["response"]) @parametrize def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: top_up = client.customers.credits.top_ups.list_by_external_id( - "string", - cursor="string", + external_customer_id="external_customer_id", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[TopUpListByExternalIDResponse], top_up, path=["response"]) @@ -363,7 +363,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list_by_external_id(self, client: Orb) -> None: response = client.customers.credits.top_ups.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -374,7 +374,7 @@ def test_raw_response_list_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_list_by_external_id(self, client: Orb) -> None: with client.customers.credits.top_ups.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -388,7 +388,7 @@ def test_streaming_response_list_by_external_id(self, client: Orb) -> None: def test_path_params_list_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.top_ups.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) @@ -398,32 +398,32 @@ class TestAsyncTopUps: @parametrize async def test_method_create(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert_matches_type(TopUpCreateResponse, top_up, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", expires_after=0, expires_after_unit="day", ) @@ -432,15 +432,15 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert response.is_closed is True @@ -451,15 +451,15 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.create( - "string", - amount="string", - currency="string", + customer_id="customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -473,29 +473,29 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async def test_path_params_create(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.create( - "", - amount="string", - currency="string", + customer_id="", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.list( - "string", + customer_id="customer_id", ) assert_matches_type(AsyncPage[TopUpListResponse], top_up, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.list( - "string", - cursor="string", + customer_id="customer_id", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[TopUpListResponse], top_up, path=["response"]) @@ -503,7 +503,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -514,7 +514,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -528,22 +528,22 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.list( - "", + customer_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) assert top_up is None @parametrize async def test_raw_response_delete(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) assert response.is_closed is True @@ -554,8 +554,8 @@ async def test_raw_response_delete(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.delete( - "string", - customer_id="string", + top_up_id="top_up_id", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -569,45 +569,45 @@ async def test_streaming_response_delete(self, async_client: AsyncOrb) -> None: async def test_path_params_delete(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.delete( - "string", + top_up_id="top_up_id", customer_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `top_up_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.delete( - "", - customer_id="string", + top_up_id="", + customer_id="customer_id", ) @parametrize async def test_method_create_by_external_id(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert_matches_type(TopUpCreateByExternalIDResponse, top_up, path=["response"]) @parametrize async def test_method_create_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, - "memo": "string", + "memo": "memo", "require_successful_payment": True, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", expires_after=0, expires_after_unit="day", ) @@ -616,15 +616,15 @@ async def test_method_create_by_external_id_with_all_params(self, async_client: @parametrize async def test_raw_response_create_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) assert response.is_closed is True @@ -635,15 +635,15 @@ async def test_raw_response_create_by_external_id(self, async_client: AsyncOrb) @parametrize async def test_streaming_response_create_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.create_by_external_id( - "string", - amount="string", - currency="string", + external_customer_id="external_customer_id", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -657,30 +657,30 @@ async def test_streaming_response_create_by_external_id(self, async_client: Asyn async def test_path_params_create_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.create_by_external_id( - "", - amount="string", - currency="string", + external_customer_id="", + amount="amount", + currency="currency", invoice_settings={ "auto_collection": True, "net_terms": 0, }, - per_unit_cost_basis="string", - threshold="string", + per_unit_cost_basis="per_unit_cost_basis", + threshold="threshold", ) @parametrize async def test_method_delete_by_external_id(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) assert top_up is None @parametrize async def test_raw_response_delete_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -691,8 +691,8 @@ async def test_raw_response_delete_by_external_id(self, async_client: AsyncOrb) @parametrize async def test_streaming_response_delete_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.delete_by_external_id( - "string", - external_customer_id="string", + top_up_id="top_up_id", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -706,28 +706,28 @@ async def test_streaming_response_delete_by_external_id(self, async_client: Asyn async def test_path_params_delete_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "string", + top_up_id="top_up_id", external_customer_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `top_up_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.delete_by_external_id( - "", - external_customer_id="string", + top_up_id="", + external_customer_id="external_customer_id", ) @parametrize async def test_method_list_by_external_id(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(AsyncPage[TopUpListByExternalIDResponse], top_up, path=["response"]) @parametrize async def test_method_list_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: top_up = await async_client.customers.credits.top_ups.list_by_external_id( - "string", - cursor="string", + external_customer_id="external_customer_id", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[TopUpListByExternalIDResponse], top_up, path=["response"]) @@ -735,7 +735,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As @parametrize async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.top_ups.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -746,7 +746,7 @@ async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_list_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.top_ups.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -760,5 +760,5 @@ async def test_streaming_response_list_by_external_id(self, async_client: AsyncO async def test_path_params_list_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.top_ups.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) diff --git a/tests/api_resources/customers/test_balance_transactions.py b/tests/api_resources/customers/test_balance_transactions.py index bc62f40b..77d23372 100644 --- a/tests/api_resources/customers/test_balance_transactions.py +++ b/tests/api_resources/customers/test_balance_transactions.py @@ -25,8 +25,8 @@ class TestBalanceTransactions: @parametrize def test_method_create(self, client: Orb) -> None: balance_transaction = client.customers.balance_transactions.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) assert_matches_type(BalanceTransactionCreateResponse, balance_transaction, path=["response"]) @@ -34,18 +34,18 @@ def test_method_create(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params(self, client: Orb) -> None: balance_transaction = client.customers.balance_transactions.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", - description="string", + description="description", ) assert_matches_type(BalanceTransactionCreateResponse, balance_transaction, path=["response"]) @parametrize def test_raw_response_create(self, client: Orb) -> None: response = client.customers.balance_transactions.with_raw_response.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) @@ -57,8 +57,8 @@ def test_raw_response_create(self, client: Orb) -> None: @parametrize def test_streaming_response_create(self, client: Orb) -> None: with client.customers.balance_transactions.with_streaming_response.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) as response: assert not response.is_closed @@ -73,23 +73,23 @@ def test_streaming_response_create(self, client: Orb) -> None: def test_path_params_create(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.balance_transactions.with_raw_response.create( - "", - amount="string", + customer_id="", + amount="amount", type="increment", ) @parametrize def test_method_list(self, client: Orb) -> None: balance_transaction = client.customers.balance_transactions.list( - "string", + customer_id="customer_id", ) assert_matches_type(SyncPage[BalanceTransactionListResponse], balance_transaction, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: balance_transaction = client.customers.balance_transactions.list( - "string", - cursor="string", + customer_id="customer_id", + cursor="cursor", limit=1, operation_time_gt=parse_datetime("2019-12-27T18:11:19.117Z"), operation_time_gte=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -101,7 +101,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.customers.balance_transactions.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -112,7 +112,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.customers.balance_transactions.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,7 +126,7 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.balance_transactions.with_raw_response.list( - "", + customer_id="", ) @@ -136,8 +136,8 @@ class TestAsyncBalanceTransactions: @parametrize async def test_method_create(self, async_client: AsyncOrb) -> None: balance_transaction = await async_client.customers.balance_transactions.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) assert_matches_type(BalanceTransactionCreateResponse, balance_transaction, path=["response"]) @@ -145,18 +145,18 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: balance_transaction = await async_client.customers.balance_transactions.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", - description="string", + description="description", ) assert_matches_type(BalanceTransactionCreateResponse, balance_transaction, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.customers.balance_transactions.with_raw_response.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) @@ -168,8 +168,8 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async with async_client.customers.balance_transactions.with_streaming_response.create( - "string", - amount="string", + customer_id="customer_id", + amount="amount", type="increment", ) as response: assert not response.is_closed @@ -184,23 +184,23 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async def test_path_params_create(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.balance_transactions.with_raw_response.create( - "", - amount="string", + customer_id="", + amount="amount", type="increment", ) @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: balance_transaction = await async_client.customers.balance_transactions.list( - "string", + customer_id="customer_id", ) assert_matches_type(AsyncPage[BalanceTransactionListResponse], balance_transaction, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: balance_transaction = await async_client.customers.balance_transactions.list( - "string", - cursor="string", + customer_id="customer_id", + cursor="cursor", limit=1, operation_time_gt=parse_datetime("2019-12-27T18:11:19.117Z"), operation_time_gte=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -212,7 +212,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.customers.balance_transactions.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -223,7 +223,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.customers.balance_transactions.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -237,5 +237,5 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.balance_transactions.with_raw_response.list( - "", + customer_id="", ) diff --git a/tests/api_resources/customers/test_costs.py b/tests/api_resources/customers/test_costs.py index 9d8fa5e8..e9e1afa2 100644 --- a/tests/api_resources/customers/test_costs.py +++ b/tests/api_resources/customers/test_costs.py @@ -24,14 +24,14 @@ class TestCosts: @parametrize def test_method_list(self, client: Orb) -> None: cost = client.customers.costs.list( - "string", + customer_id="customer_id", ) assert_matches_type(CostListResponse, cost, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: cost = client.customers.costs.list( - "string", + customer_id="customer_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -41,7 +41,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.customers.costs.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -52,7 +52,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.customers.costs.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -66,20 +66,20 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.costs.with_raw_response.list( - "", + customer_id="", ) @parametrize def test_method_list_by_external_id(self, client: Orb) -> None: cost = client.customers.costs.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(CostListByExternalIDResponse, cost, path=["response"]) @parametrize def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: cost = client.customers.costs.list_by_external_id( - "string", + external_customer_id="external_customer_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -89,7 +89,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list_by_external_id(self, client: Orb) -> None: response = client.customers.costs.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -100,7 +100,7 @@ def test_raw_response_list_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_list_by_external_id(self, client: Orb) -> None: with client.customers.costs.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -114,7 +114,7 @@ def test_streaming_response_list_by_external_id(self, client: Orb) -> None: def test_path_params_list_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.costs.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) @@ -124,14 +124,14 @@ class TestAsyncCosts: @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: cost = await async_client.customers.costs.list( - "string", + customer_id="customer_id", ) assert_matches_type(CostListResponse, cost, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: cost = await async_client.customers.costs.list( - "string", + customer_id="customer_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -141,7 +141,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.customers.costs.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -152,7 +152,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.customers.costs.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,20 +166,20 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.costs.with_raw_response.list( - "", + customer_id="", ) @parametrize async def test_method_list_by_external_id(self, async_client: AsyncOrb) -> None: cost = await async_client.customers.costs.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(CostListByExternalIDResponse, cost, path=["response"]) @parametrize async def test_method_list_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: cost = await async_client.customers.costs.list_by_external_id( - "string", + external_customer_id="external_customer_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -189,7 +189,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As @parametrize async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.costs.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -200,7 +200,7 @@ async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_list_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.costs.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -214,5 +214,5 @@ async def test_streaming_response_list_by_external_id(self, async_client: AsyncO async def test_path_params_list_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.costs.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) diff --git a/tests/api_resources/customers/test_credits.py b/tests/api_resources/customers/test_credits.py index 04103085..19de5732 100644 --- a/tests/api_resources/customers/test_credits.py +++ b/tests/api_resources/customers/test_credits.py @@ -24,16 +24,16 @@ class TestCredits: @parametrize def test_method_list(self, client: Orb) -> None: credit = client.customers.credits.list( - "string", + customer_id="customer_id", ) assert_matches_type(SyncPage[CreditListResponse], credit, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: credit = client.customers.credits.list( - "string", - currency="string", - cursor="string", + customer_id="customer_id", + currency="currency", + cursor="cursor", include_all_blocks=True, limit=1, ) @@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list(self, client: Orb) -> None: response = client.customers.credits.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -53,7 +53,7 @@ def test_raw_response_list(self, client: Orb) -> None: @parametrize def test_streaming_response_list(self, client: Orb) -> None: with client.customers.credits.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,22 +67,22 @@ def test_streaming_response_list(self, client: Orb) -> None: def test_path_params_list(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.credits.with_raw_response.list( - "", + customer_id="", ) @parametrize def test_method_list_by_external_id(self, client: Orb) -> None: credit = client.customers.credits.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(SyncPage[CreditListByExternalIDResponse], credit, path=["response"]) @parametrize def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: credit = client.customers.credits.list_by_external_id( - "string", - currency="string", - cursor="string", + external_customer_id="external_customer_id", + currency="currency", + cursor="cursor", include_all_blocks=True, limit=1, ) @@ -91,7 +91,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_list_by_external_id(self, client: Orb) -> None: response = client.customers.credits.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -102,7 +102,7 @@ def test_raw_response_list_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_list_by_external_id(self, client: Orb) -> None: with client.customers.credits.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -116,7 +116,7 @@ def test_streaming_response_list_by_external_id(self, client: Orb) -> None: def test_path_params_list_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.customers.credits.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) @@ -126,16 +126,16 @@ class TestAsyncCredits: @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: credit = await async_client.customers.credits.list( - "string", + customer_id="customer_id", ) assert_matches_type(AsyncPage[CreditListResponse], credit, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: credit = await async_client.customers.credits.list( - "string", - currency="string", - cursor="string", + customer_id="customer_id", + currency="currency", + cursor="cursor", include_all_blocks=True, limit=1, ) @@ -144,7 +144,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None @parametrize async def test_raw_response_list(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.with_raw_response.list( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -155,7 +155,7 @@ async def test_raw_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.with_streaming_response.list( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -169,22 +169,22 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: async def test_path_params_list(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.credits.with_raw_response.list( - "", + customer_id="", ) @parametrize async def test_method_list_by_external_id(self, async_client: AsyncOrb) -> None: credit = await async_client.customers.credits.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert_matches_type(AsyncPage[CreditListByExternalIDResponse], credit, path=["response"]) @parametrize async def test_method_list_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: credit = await async_client.customers.credits.list_by_external_id( - "string", - currency="string", - cursor="string", + external_customer_id="external_customer_id", + currency="currency", + cursor="cursor", include_all_blocks=True, limit=1, ) @@ -193,7 +193,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As @parametrize async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.credits.with_raw_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) assert response.is_closed is True @@ -204,7 +204,7 @@ async def test_raw_response_list_by_external_id(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_list_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.credits.with_streaming_response.list_by_external_id( - "string", + external_customer_id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,5 +218,5 @@ async def test_streaming_response_list_by_external_id(self, async_client: AsyncO async def test_path_params_list_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.customers.credits.with_raw_response.list_by_external_id( - "", + external_customer_id="", ) diff --git a/tests/api_resources/customers/test_usage.py b/tests/api_resources/customers/test_usage.py index b933101e..4d3f7b17 100644 --- a/tests/api_resources/customers/test_usage.py +++ b/tests/api_resources/customers/test_usage.py @@ -24,20 +24,20 @@ class TestUsage: @parametrize def test_method_update(self, client: Orb) -> None: usage = client.customers.usage.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -48,26 +48,26 @@ def test_method_update(self, client: Orb) -> None: @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: usage = client.customers.usage.update( - "string", + id="customer_id", events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -80,20 +80,20 @@ def test_method_update_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.customers.usage.with_raw_response.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -108,20 +108,20 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.customers.usage.with_streaming_response.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -139,20 +139,20 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.customers.usage.with_raw_response.update( - "", + id="", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -162,20 +162,20 @@ def test_path_params_update(self, client: Orb) -> None: @parametrize def test_method_update_by_external_id(self, client: Orb) -> None: usage = client.customers.usage.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -186,26 +186,26 @@ def test_method_update_by_external_id(self, client: Orb) -> None: @parametrize def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None: usage = client.customers.usage.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -218,20 +218,20 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None @parametrize def test_raw_response_update_by_external_id(self, client: Orb) -> None: response = client.customers.usage.with_raw_response.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -246,20 +246,20 @@ def test_raw_response_update_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_update_by_external_id(self, client: Orb) -> None: with client.customers.usage.with_streaming_response.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -277,20 +277,20 @@ def test_streaming_response_update_by_external_id(self, client: Orb) -> None: def test_path_params_update_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.customers.usage.with_raw_response.update_by_external_id( - "", + id="", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -304,20 +304,20 @@ class TestAsyncUsage: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: usage = await async_client.customers.usage.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -328,26 +328,26 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: usage = await async_client.customers.usage.update( - "string", + id="customer_id", events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -360,20 +360,20 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.customers.usage.with_raw_response.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -388,20 +388,20 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.customers.usage.with_streaming_response.update( - "string", + id="customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -419,20 +419,20 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.customers.usage.with_raw_response.update( - "", + id="", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -442,20 +442,20 @@ async def test_path_params_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> None: usage = await async_client.customers.usage.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -466,26 +466,26 @@ async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> Non @parametrize async def test_method_update_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: usage = await async_client.customers.usage.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -498,20 +498,20 @@ async def test_method_update_by_external_id_with_all_params(self, async_client: @parametrize async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.usage.with_raw_response.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -526,20 +526,20 @@ async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) @parametrize async def test_streaming_response_update_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.usage.with_streaming_response.update_by_external_id( - "string", + id="external_customer_id", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, @@ -557,20 +557,20 @@ async def test_streaming_response_update_by_external_id(self, async_client: Asyn async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.customers.usage.with_raw_response.update_by_external_id( - "", + id="", events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, }, diff --git a/tests/api_resources/events/test_backfills.py b/tests/api_resources/events/test_backfills.py index 18e48c9e..02675703 100644 --- a/tests/api_resources/events/test_backfills.py +++ b/tests/api_resources/events/test_backfills.py @@ -39,8 +39,8 @@ def test_method_create_with_all_params(self, client: Orb) -> None: timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), close_time=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", replace_existing_events=True, ) assert_matches_type(BackfillCreateResponse, backfill, path=["response"]) @@ -79,7 +79,7 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: backfill = client.events.backfills.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[BackfillListResponse], backfill, path=["response"]) @@ -107,14 +107,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_close(self, client: Orb) -> None: backfill = client.events.backfills.close( - "string", + "backfill_id", ) assert_matches_type(BackfillCloseResponse, backfill, path=["response"]) @parametrize def test_raw_response_close(self, client: Orb) -> None: response = client.events.backfills.with_raw_response.close( - "string", + "backfill_id", ) assert response.is_closed is True @@ -125,7 +125,7 @@ def test_raw_response_close(self, client: Orb) -> None: @parametrize def test_streaming_response_close(self, client: Orb) -> None: with client.events.backfills.with_streaming_response.close( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -145,14 +145,14 @@ def test_path_params_close(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: backfill = client.events.backfills.fetch( - "string", + "backfill_id", ) assert_matches_type(BackfillFetchResponse, backfill, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.events.backfills.with_raw_response.fetch( - "string", + "backfill_id", ) assert response.is_closed is True @@ -163,7 +163,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.events.backfills.with_streaming_response.fetch( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -183,14 +183,14 @@ def test_path_params_fetch(self, client: Orb) -> None: @parametrize def test_method_revert(self, client: Orb) -> None: backfill = client.events.backfills.revert( - "string", + "backfill_id", ) assert_matches_type(BackfillRevertResponse, backfill, path=["response"]) @parametrize def test_raw_response_revert(self, client: Orb) -> None: response = client.events.backfills.with_raw_response.revert( - "string", + "backfill_id", ) assert response.is_closed is True @@ -201,7 +201,7 @@ def test_raw_response_revert(self, client: Orb) -> None: @parametrize def test_streaming_response_revert(self, client: Orb) -> None: with client.events.backfills.with_streaming_response.revert( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -236,8 +236,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), close_time=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", replace_existing_events=True, ) assert_matches_type(BackfillCreateResponse, backfill, path=["response"]) @@ -276,7 +276,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: backfill = await async_client.events.backfills.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[BackfillListResponse], backfill, path=["response"]) @@ -304,14 +304,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_close(self, async_client: AsyncOrb) -> None: backfill = await async_client.events.backfills.close( - "string", + "backfill_id", ) assert_matches_type(BackfillCloseResponse, backfill, path=["response"]) @parametrize async def test_raw_response_close(self, async_client: AsyncOrb) -> None: response = await async_client.events.backfills.with_raw_response.close( - "string", + "backfill_id", ) assert response.is_closed is True @@ -322,7 +322,7 @@ async def test_raw_response_close(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_close(self, async_client: AsyncOrb) -> None: async with async_client.events.backfills.with_streaming_response.close( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -342,14 +342,14 @@ async def test_path_params_close(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: backfill = await async_client.events.backfills.fetch( - "string", + "backfill_id", ) assert_matches_type(BackfillFetchResponse, backfill, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.events.backfills.with_raw_response.fetch( - "string", + "backfill_id", ) assert response.is_closed is True @@ -360,7 +360,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.events.backfills.with_streaming_response.fetch( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -380,14 +380,14 @@ async def test_path_params_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_revert(self, async_client: AsyncOrb) -> None: backfill = await async_client.events.backfills.revert( - "string", + "backfill_id", ) assert_matches_type(BackfillRevertResponse, backfill, path=["response"]) @parametrize async def test_raw_response_revert(self, async_client: AsyncOrb) -> None: response = await async_client.events.backfills.with_raw_response.revert( - "string", + "backfill_id", ) assert response.is_closed is True @@ -398,7 +398,7 @@ async def test_raw_response_revert(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_revert(self, async_client: AsyncOrb) -> None: async with async_client.events.backfills.with_streaming_response.revert( - "string", + "backfill_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/plans/test_external_plan_id.py b/tests/api_resources/plans/test_external_plan_id.py index f28c7431..a73b26ea 100644 --- a/tests/api_resources/plans/test_external_plan_id.py +++ b/tests/api_resources/plans/test_external_plan_id.py @@ -20,15 +20,15 @@ class TestExternalPlanID: @parametrize def test_method_update(self, client: Orb) -> None: external_plan_id = client.plans.external_plan_id.update( - "string", + other_external_plan_id="external_plan_id", ) assert_matches_type(Plan, external_plan_id, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: external_plan_id = client.plans.external_plan_id.update( - "string", - external_plan_id="string", + other_external_plan_id="external_plan_id", + external_plan_id="external_plan_id", metadata={"foo": "string"}, ) assert_matches_type(Plan, external_plan_id, path=["response"]) @@ -36,7 +36,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.plans.external_plan_id.with_raw_response.update( - "string", + other_external_plan_id="external_plan_id", ) assert response.is_closed is True @@ -47,7 +47,7 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.plans.external_plan_id.with_streaming_response.update( - "string", + other_external_plan_id="external_plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,21 +63,21 @@ def test_path_params_update(self, client: Orb) -> None: ValueError, match=r"Expected a non-empty value for `other_external_plan_id` but received ''" ): client.plans.external_plan_id.with_raw_response.update( - "", + other_external_plan_id="", external_plan_id="", ) @parametrize def test_method_fetch(self, client: Orb) -> None: external_plan_id = client.plans.external_plan_id.fetch( - "string", + "external_plan_id", ) assert_matches_type(Plan, external_plan_id, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.plans.external_plan_id.with_raw_response.fetch( - "string", + "external_plan_id", ) assert response.is_closed is True @@ -88,7 +88,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.plans.external_plan_id.with_streaming_response.fetch( - "string", + "external_plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,15 +112,15 @@ class TestAsyncExternalPlanID: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: external_plan_id = await async_client.plans.external_plan_id.update( - "string", + other_external_plan_id="external_plan_id", ) assert_matches_type(Plan, external_plan_id, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: external_plan_id = await async_client.plans.external_plan_id.update( - "string", - external_plan_id="string", + other_external_plan_id="external_plan_id", + external_plan_id="external_plan_id", metadata={"foo": "string"}, ) assert_matches_type(Plan, external_plan_id, path=["response"]) @@ -128,7 +128,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.plans.external_plan_id.with_raw_response.update( - "string", + other_external_plan_id="external_plan_id", ) assert response.is_closed is True @@ -139,7 +139,7 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.plans.external_plan_id.with_streaming_response.update( - "string", + other_external_plan_id="external_plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -155,21 +155,21 @@ async def test_path_params_update(self, async_client: AsyncOrb) -> None: ValueError, match=r"Expected a non-empty value for `other_external_plan_id` but received ''" ): await async_client.plans.external_plan_id.with_raw_response.update( - "", + other_external_plan_id="", external_plan_id="", ) @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: external_plan_id = await async_client.plans.external_plan_id.fetch( - "string", + "external_plan_id", ) assert_matches_type(Plan, external_plan_id, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.plans.external_plan_id.with_raw_response.fetch( - "string", + "external_plan_id", ) assert response.is_closed is True @@ -180,7 +180,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.plans.external_plan_id.with_streaming_response.fetch( - "string", + "external_plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/prices/test_external_price_id.py b/tests/api_resources/prices/test_external_price_id.py index abd884c2..b3fa48d8 100644 --- a/tests/api_resources/prices/test_external_price_id.py +++ b/tests/api_resources/prices/test_external_price_id.py @@ -20,14 +20,14 @@ class TestExternalPriceID: @parametrize def test_method_fetch(self, client: Orb) -> None: external_price_id = client.prices.external_price_id.fetch( - "string", + "external_price_id", ) assert_matches_type(Price, external_price_id, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.prices.external_price_id.with_raw_response.fetch( - "string", + "external_price_id", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.prices.external_price_id.with_streaming_response.fetch( - "string", + "external_price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,14 +62,14 @@ class TestAsyncExternalPriceID: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: external_price_id = await async_client.prices.external_price_id.fetch( - "string", + "external_price_id", ) assert_matches_type(Price, external_price_id, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.prices.external_price_id.with_raw_response.fetch( - "string", + "external_price_id", ) assert response.is_closed is True @@ -80,7 +80,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.prices.external_price_id.with_streaming_response.fetch( - "string", + "external_price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_alerts.py b/tests/api_resources/test_alerts.py index 0dc7fba1..a96b00b0 100644 --- a/tests/api_resources/test_alerts.py +++ b/tests/api_resources/test_alerts.py @@ -24,14 +24,14 @@ class TestAlerts: @parametrize def test_method_retrieve(self, client: Orb) -> None: alert = client.alerts.retrieve( - "string", + "alert_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Orb) -> None: response = client.alerts.with_raw_response.retrieve( - "string", + "alert_id", ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_retrieve(self, client: Orb) -> None: @parametrize def test_streaming_response_retrieve(self, client: Orb) -> None: with client.alerts.with_streaming_response.retrieve( - "string", + "alert_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -73,11 +73,11 @@ def test_method_list_with_all_params(self, client: Orb) -> None: created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", - customer_id="string", - external_customer_id="string", + cursor="cursor", + customer_id="customer_id", + external_customer_id="external_customer_id", limit=1, - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(SyncPage[Alert], alert, path=["response"]) @@ -106,18 +106,18 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_create_for_customer(self, client: Orb) -> None: alert = client.alerts.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_method_create_for_customer_with_all_params(self, client: Orb) -> None: alert = client.alerts.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -125,9 +125,9 @@ def test_method_create_for_customer_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_create_for_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) assert response.is_closed is True @@ -138,9 +138,9 @@ def test_raw_response_create_for_customer(self, client: Orb) -> None: @parametrize def test_streaming_response_create_for_customer(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -154,26 +154,26 @@ def test_streaming_response_create_for_customer(self, client: Orb) -> None: def test_path_params_create_for_customer(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.alerts.with_raw_response.create_for_customer( - "", - currency="string", - type="string", + customer_id="", + currency="currency", + type="type", ) @parametrize def test_method_create_for_external_customer(self, client: Orb) -> None: alert = client.alerts.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_method_create_for_external_customer_with_all_params(self, client: Orb) -> None: alert = client.alerts.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -181,9 +181,9 @@ def test_method_create_for_external_customer_with_all_params(self, client: Orb) @parametrize def test_raw_response_create_for_external_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) assert response.is_closed is True @@ -194,9 +194,9 @@ def test_raw_response_create_for_external_customer(self, client: Orb) -> None: @parametrize def test_streaming_response_create_for_external_customer(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,36 +210,36 @@ def test_streaming_response_create_for_external_customer(self, client: Orb) -> N def test_path_params_create_for_external_customer(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): client.alerts.with_raw_response.create_for_external_customer( - "", - currency="string", - type="string", + external_customer_id="", + currency="currency", + type="type", ) @parametrize def test_method_create_for_subscription(self, client: Orb) -> None: alert = client.alerts.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_method_create_for_subscription_with_all_params(self, client: Orb) -> None: alert = client.alerts.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", - metric_id="string", + type="type", + metric_id="metric_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_create_for_subscription(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) assert response.is_closed is True @@ -250,9 +250,9 @@ def test_raw_response_create_for_subscription(self, client: Orb) -> None: @parametrize def test_streaming_response_create_for_subscription(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -266,22 +266,22 @@ def test_streaming_response_create_for_subscription(self, client: Orb) -> None: def test_path_params_create_for_subscription(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.alerts.with_raw_response.create_for_subscription( - "", + subscription_id="", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) @parametrize def test_method_disable(self, client: Orb) -> None: alert = client.alerts.disable( - "string", + "alert_configuration_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_disable(self, client: Orb) -> None: response = client.alerts.with_raw_response.disable( - "string", + "alert_configuration_id", ) assert response.is_closed is True @@ -292,7 +292,7 @@ def test_raw_response_disable(self, client: Orb) -> None: @parametrize def test_streaming_response_disable(self, client: Orb) -> None: with client.alerts.with_streaming_response.disable( - "string", + "alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -314,14 +314,14 @@ def test_path_params_disable(self, client: Orb) -> None: @parametrize def test_method_enable(self, client: Orb) -> None: alert = client.alerts.enable( - "string", + "alert_configuration_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_enable(self, client: Orb) -> None: response = client.alerts.with_raw_response.enable( - "string", + "alert_configuration_id", ) assert response.is_closed is True @@ -332,7 +332,7 @@ def test_raw_response_enable(self, client: Orb) -> None: @parametrize def test_streaming_response_enable(self, client: Orb) -> None: with client.alerts.with_streaming_response.enable( - "string", + "alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -358,14 +358,14 @@ class TestAsyncAlerts: @parametrize async def test_method_retrieve(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.retrieve( - "string", + "alert_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.retrieve( - "string", + "alert_id", ) assert response.is_closed is True @@ -376,7 +376,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.retrieve( - "string", + "alert_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -407,11 +407,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", - customer_id="string", - external_customer_id="string", + cursor="cursor", + customer_id="customer_id", + external_customer_id="external_customer_id", limit=1, - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(AsyncPage[Alert], alert, path=["response"]) @@ -440,18 +440,18 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_for_customer(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_method_create_for_customer_with_all_params(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -459,9 +459,9 @@ async def test_method_create_for_customer_with_all_params(self, async_client: As @parametrize async def test_raw_response_create_for_customer(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) assert response.is_closed is True @@ -472,9 +472,9 @@ async def test_raw_response_create_for_customer(self, async_client: AsyncOrb) -> @parametrize async def test_streaming_response_create_for_customer(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.create_for_customer( - "string", - currency="string", - type="string", + customer_id="customer_id", + currency="currency", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -488,26 +488,26 @@ async def test_streaming_response_create_for_customer(self, async_client: AsyncO async def test_path_params_create_for_customer(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.alerts.with_raw_response.create_for_customer( - "", - currency="string", - type="string", + customer_id="", + currency="currency", + type="type", ) @parametrize async def test_method_create_for_external_customer(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_method_create_for_external_customer_with_all_params(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -515,9 +515,9 @@ async def test_method_create_for_external_customer_with_all_params(self, async_c @parametrize async def test_raw_response_create_for_external_customer(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) assert response.is_closed is True @@ -528,9 +528,9 @@ async def test_raw_response_create_for_external_customer(self, async_client: Asy @parametrize async def test_streaming_response_create_for_external_customer(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.create_for_external_customer( - "string", - currency="string", - type="string", + external_customer_id="external_customer_id", + currency="currency", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -544,36 +544,36 @@ async def test_streaming_response_create_for_external_customer(self, async_clien async def test_path_params_create_for_external_customer(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_customer_id` but received ''"): await async_client.alerts.with_raw_response.create_for_external_customer( - "", - currency="string", - type="string", + external_customer_id="", + currency="currency", + type="type", ) @parametrize async def test_method_create_for_subscription(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_method_create_for_subscription_with_all_params(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", - metric_id="string", + type="type", + metric_id="metric_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_create_for_subscription(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) assert response.is_closed is True @@ -584,9 +584,9 @@ async def test_raw_response_create_for_subscription(self, async_client: AsyncOrb @parametrize async def test_streaming_response_create_for_subscription(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.create_for_subscription( - "string", + subscription_id="subscription_id", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -600,22 +600,22 @@ async def test_streaming_response_create_for_subscription(self, async_client: As async def test_path_params_create_for_subscription(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.alerts.with_raw_response.create_for_subscription( - "", + subscription_id="", thresholds=[{"value": 0}, {"value": 0}, {"value": 0}], - type="string", + type="type", ) @parametrize async def test_method_disable(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.disable( - "string", + "alert_configuration_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_disable(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.disable( - "string", + "alert_configuration_id", ) assert response.is_closed is True @@ -626,7 +626,7 @@ async def test_raw_response_disable(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_disable(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.disable( - "string", + "alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -648,14 +648,14 @@ async def test_path_params_disable(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_enable(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.enable( - "string", + "alert_configuration_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_enable(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.enable( - "string", + "alert_configuration_id", ) assert response.is_closed is True @@ -666,7 +666,7 @@ async def test_raw_response_enable(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_enable(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.enable( - "string", + "alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_coupons.py b/tests/api_resources/test_coupons.py index 977bf45d..8d59baa8 100644 --- a/tests/api_resources/test_coupons.py +++ b/tests/api_resources/test_coupons.py @@ -82,9 +82,9 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: coupon = client.coupons.list( - cursor="string", + cursor="cursor", limit=1, - redemption_code="string", + redemption_code="redemption_code", show_archived=True, ) assert_matches_type(SyncPage[Coupon], coupon, path=["response"]) @@ -112,14 +112,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_archive(self, client: Orb) -> None: coupon = client.coupons.archive( - "string", + "coupon_id", ) assert_matches_type(Coupon, coupon, path=["response"]) @parametrize def test_raw_response_archive(self, client: Orb) -> None: response = client.coupons.with_raw_response.archive( - "string", + "coupon_id", ) assert response.is_closed is True @@ -130,7 +130,7 @@ def test_raw_response_archive(self, client: Orb) -> None: @parametrize def test_streaming_response_archive(self, client: Orb) -> None: with client.coupons.with_streaming_response.archive( - "string", + "coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,14 +150,14 @@ def test_path_params_archive(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: coupon = client.coupons.fetch( - "string", + "coupon_id", ) assert_matches_type(Coupon, coupon, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.coupons.with_raw_response.fetch( - "string", + "coupon_id", ) assert response.is_closed is True @@ -168,7 +168,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.coupons.with_streaming_response.fetch( - "string", + "coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -253,9 +253,9 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: coupon = await async_client.coupons.list( - cursor="string", + cursor="cursor", limit=1, - redemption_code="string", + redemption_code="redemption_code", show_archived=True, ) assert_matches_type(AsyncPage[Coupon], coupon, path=["response"]) @@ -283,14 +283,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_archive(self, async_client: AsyncOrb) -> None: coupon = await async_client.coupons.archive( - "string", + "coupon_id", ) assert_matches_type(Coupon, coupon, path=["response"]) @parametrize async def test_raw_response_archive(self, async_client: AsyncOrb) -> None: response = await async_client.coupons.with_raw_response.archive( - "string", + "coupon_id", ) assert response.is_closed is True @@ -301,7 +301,7 @@ async def test_raw_response_archive(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_archive(self, async_client: AsyncOrb) -> None: async with async_client.coupons.with_streaming_response.archive( - "string", + "coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -321,14 +321,14 @@ async def test_path_params_archive(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: coupon = await async_client.coupons.fetch( - "string", + "coupon_id", ) assert_matches_type(Coupon, coupon, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.coupons.with_raw_response.fetch( - "string", + "coupon_id", ) assert response.is_closed is True @@ -339,7 +339,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.coupons.with_streaming_response.fetch( - "string", + "coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_credit_notes.py b/tests/api_resources/test_credit_notes.py index b7d1d62d..b44d927f 100644 --- a/tests/api_resources/test_credit_notes.py +++ b/tests/api_resources/test_credit_notes.py @@ -26,7 +26,7 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: credit_note = client.credit_notes.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[CreditNote], credit_note, path=["response"]) @@ -54,14 +54,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: credit_note = client.credit_notes.fetch( - "string", + "credit_note_id", ) assert_matches_type(CreditNote, credit_note, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.credit_notes.with_raw_response.fetch( - "string", + "credit_note_id", ) assert response.is_closed is True @@ -72,7 +72,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.credit_notes.with_streaming_response.fetch( - "string", + "credit_note_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -101,7 +101,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: credit_note = await async_client.credit_notes.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[CreditNote], credit_note, path=["response"]) @@ -129,14 +129,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: credit_note = await async_client.credit_notes.fetch( - "string", + "credit_note_id", ) assert_matches_type(CreditNote, credit_note, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.credit_notes.with_raw_response.fetch( - "string", + "credit_note_id", ) assert response.is_closed is True @@ -147,7 +147,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.credit_notes.with_streaming_response.fetch( - "string", + "credit_note_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_customers.py b/tests/api_resources/test_customers.py index 83296e9f..89174717 100644 --- a/tests/api_resources/test_customers.py +++ b/tests/api_resources/test_customers.py @@ -24,72 +24,72 @@ class TestCustomers: @parametrize def test_method_create(self, client: Orb) -> None: customer = client.customers.create( - email="string", - name="string", + email="email", + name="name", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Orb) -> None: customer = client.customers.create( - email="string", - name="string", + email="email", + name="name", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string", "string", "string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", + currency="currency", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, - timezone="string", + timezone="timezone", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_raw_response_create(self, client: Orb) -> None: response = client.customers.with_raw_response.create( - email="string", - name="string", + email="email", + name="name", ) assert response.is_closed is True @@ -100,8 +100,8 @@ def test_raw_response_create(self, client: Orb) -> None: @parametrize def test_streaming_response_create(self, client: Orb) -> None: with client.customers.with_streaming_response.create( - email="string", - name="string", + email="email", + name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -114,62 +114,62 @@ def test_streaming_response_create(self, client: Orb) -> None: @parametrize def test_method_update(self, client: Orb) -> None: customer = client.customers.update( - "string", + customer_id="customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: customer = client.customers.update( - "string", + customer_id="customer_id", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", - email="string", + currency="currency", + email="email", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, - name="string", + name="name", payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, ) assert_matches_type(Customer, customer, path=["response"]) @@ -177,7 +177,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.customers.with_raw_response.update( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -188,7 +188,7 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.customers.with_streaming_response.update( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -202,7 +202,7 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): client.customers.with_raw_response.update( - "", + customer_id="", ) @parametrize @@ -217,7 +217,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Customer], customer, path=["response"]) @@ -245,14 +245,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_delete(self, client: Orb) -> None: customer = client.customers.delete( - "string", + "customer_id", ) assert customer is None @parametrize def test_raw_response_delete(self, client: Orb) -> None: response = client.customers.with_raw_response.delete( - "string", + "customer_id", ) assert response.is_closed is True @@ -263,7 +263,7 @@ def test_raw_response_delete(self, client: Orb) -> None: @parametrize def test_streaming_response_delete(self, client: Orb) -> None: with client.customers.with_streaming_response.delete( - "string", + "customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -283,14 +283,14 @@ def test_path_params_delete(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: customer = client.customers.fetch( - "string", + "customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.customers.with_raw_response.fetch( - "string", + "customer_id", ) assert response.is_closed is True @@ -301,7 +301,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.customers.with_streaming_response.fetch( - "string", + "customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -321,14 +321,14 @@ def test_path_params_fetch(self, client: Orb) -> None: @parametrize def test_method_fetch_by_external_id(self, client: Orb) -> None: customer = client.customers.fetch_by_external_id( - "string", + "external_customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_raw_response_fetch_by_external_id(self, client: Orb) -> None: response = client.customers.with_raw_response.fetch_by_external_id( - "string", + "external_customer_id", ) assert response.is_closed is True @@ -339,7 +339,7 @@ def test_raw_response_fetch_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch_by_external_id(self, client: Orb) -> None: with client.customers.with_streaming_response.fetch_by_external_id( - "string", + "external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,62 +359,62 @@ def test_path_params_fetch_by_external_id(self, client: Orb) -> None: @parametrize def test_method_update_by_external_id(self, client: Orb) -> None: customer = client.customers.update_by_external_id( - "string", + id="external_customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None: customer = client.customers.update_by_external_id( - "string", + id="external_customer_id", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", - email="string", + currency="currency", + email="email", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, - name="string", + name="name", payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, ) assert_matches_type(Customer, customer, path=["response"]) @@ -422,7 +422,7 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None @parametrize def test_raw_response_update_by_external_id(self, client: Orb) -> None: response = client.customers.with_raw_response.update_by_external_id( - "string", + id="external_customer_id", ) assert response.is_closed is True @@ -433,7 +433,7 @@ def test_raw_response_update_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_update_by_external_id(self, client: Orb) -> None: with client.customers.with_streaming_response.update_by_external_id( - "string", + id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -447,7 +447,7 @@ def test_streaming_response_update_by_external_id(self, client: Orb) -> None: def test_path_params_update_by_external_id(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.customers.with_raw_response.update_by_external_id( - "", + id="", external_customer_id="", ) @@ -458,72 +458,72 @@ class TestAsyncCustomers: @parametrize async def test_method_create(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.create( - email="string", - name="string", + email="email", + name="name", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.create( - email="string", - name="string", + email="email", + name="name", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string", "string", "string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", + currency="currency", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, - timezone="string", + timezone="timezone", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.create( - email="string", - name="string", + email="email", + name="name", ) assert response.is_closed is True @@ -534,8 +534,8 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.create( - email="string", - name="string", + email="email", + name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -548,62 +548,62 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.update( - "string", + customer_id="customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.update( - "string", + customer_id="customer_id", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", - email="string", + currency="currency", + email="email", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, - name="string", + name="name", payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, ) assert_matches_type(Customer, customer, path=["response"]) @@ -611,7 +611,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.update( - "string", + customer_id="customer_id", ) assert response.is_closed is True @@ -622,7 +622,7 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.update( - "string", + customer_id="customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -636,7 +636,7 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"): await async_client.customers.with_raw_response.update( - "", + customer_id="", ) @parametrize @@ -651,7 +651,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Customer], customer, path=["response"]) @@ -679,14 +679,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_delete(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.delete( - "string", + "customer_id", ) assert customer is None @parametrize async def test_raw_response_delete(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.delete( - "string", + "customer_id", ) assert response.is_closed is True @@ -697,7 +697,7 @@ async def test_raw_response_delete(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.delete( - "string", + "customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -717,14 +717,14 @@ async def test_path_params_delete(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.fetch( - "string", + "customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.fetch( - "string", + "customer_id", ) assert response.is_closed is True @@ -735,7 +735,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.fetch( - "string", + "customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -755,14 +755,14 @@ async def test_path_params_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch_by_external_id(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.fetch_by_external_id( - "string", + "external_customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_raw_response_fetch_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.fetch_by_external_id( - "string", + "external_customer_id", ) assert response.is_closed is True @@ -773,7 +773,7 @@ async def test_raw_response_fetch_by_external_id(self, async_client: AsyncOrb) - @parametrize async def test_streaming_response_fetch_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.fetch_by_external_id( - "string", + "external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -793,62 +793,62 @@ async def test_path_params_fetch_by_external_id(self, async_client: AsyncOrb) -> @parametrize async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.update_by_external_id( - "string", + id="external_customer_id", ) assert_matches_type(Customer, customer, path=["response"]) @parametrize async def test_method_update_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: customer = await async_client.customers.update_by_external_id( - "string", + id="external_customer_id", accounting_sync_configuration={ "excluded": True, "accounting_providers": [ { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, { - "provider_type": "string", - "external_provider_id": "string", + "provider_type": "provider_type", + "external_provider_id": "external_provider_id", }, ], }, additional_emails=["string"], auto_collection=True, billing_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, - currency="string", - email="string", + currency="currency", + email="email", email_delivery=True, - external_customer_id="string", + external_customer_id="external_customer_id", metadata={"foo": "string"}, - name="string", + name="name", payment_provider="quickbooks", - payment_provider_id="string", + payment_provider_id="payment_provider_id", reporting_configuration={"exempt": True}, shipping_address={ - "line1": "string", - "line2": "string", - "city": "string", - "state": "string", - "postal_code": "string", - "country": "string", + "line1": "line1", + "line2": "line2", + "city": "city", + "state": "state", + "postal_code": "postal_code", + "country": "country", }, tax_id={ "country": "AD", "type": "ad_nrt", - "value": "string", + "value": "value", }, ) assert_matches_type(Customer, customer, path=["response"]) @@ -856,7 +856,7 @@ async def test_method_update_by_external_id_with_all_params(self, async_client: @parametrize async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) -> None: response = await async_client.customers.with_raw_response.update_by_external_id( - "string", + id="external_customer_id", ) assert response.is_closed is True @@ -867,7 +867,7 @@ async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) @parametrize async def test_streaming_response_update_by_external_id(self, async_client: AsyncOrb) -> None: async with async_client.customers.with_streaming_response.update_by_external_id( - "string", + id="external_customer_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -881,6 +881,6 @@ async def test_streaming_response_update_by_external_id(self, async_client: Asyn async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.customers.with_raw_response.update_by_external_id( - "", + id="", external_customer_id="", ) diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 1347a5d1..d179e3bf 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -26,8 +26,8 @@ class TestEvents: @parametrize def test_method_update(self, client: Orb) -> None: event = client.events.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -36,20 +36,20 @@ def test_method_update(self, client: Orb) -> None: @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: event = client.events.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", ) assert_matches_type(EventUpdateResponse, event, path=["response"]) @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.events.with_raw_response.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -62,8 +62,8 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.events.with_streaming_response.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) as response: @@ -79,8 +79,8 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): client.events.with_raw_response.update( - "", - event_name="string", + event_id="", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -88,14 +88,14 @@ def test_path_params_update(self, client: Orb) -> None: @parametrize def test_method_deprecate(self, client: Orb) -> None: event = client.events.deprecate( - "string", + "event_id", ) assert_matches_type(EventDeprecateResponse, event, path=["response"]) @parametrize def test_raw_response_deprecate(self, client: Orb) -> None: response = client.events.with_raw_response.deprecate( - "string", + "event_id", ) assert response.is_closed is True @@ -106,7 +106,7 @@ def test_raw_response_deprecate(self, client: Orb) -> None: @parametrize def test_streaming_response_deprecate(self, client: Orb) -> None: with client.events.with_streaming_response.deprecate( - "string", + "event_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -128,22 +128,22 @@ def test_method_ingest(self, client: Orb) -> None: event = client.events.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) @@ -154,31 +154,31 @@ def test_method_ingest_with_all_params(self, client: Orb) -> None: event = client.events.ingest( events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], - backfill_id="string", + backfill_id="backfill_id", debug=True, ) assert_matches_type(EventIngestResponse, event, path=["response"]) @@ -188,22 +188,22 @@ def test_raw_response_ingest(self, client: Orb) -> None: response = client.events.with_raw_response.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) @@ -218,22 +218,22 @@ def test_streaming_response_ingest(self, client: Orb) -> None: with client.events.with_streaming_response.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) as response: @@ -292,8 +292,8 @@ class TestAsyncEvents: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: event = await async_client.events.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -302,20 +302,20 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: event = await async_client.events.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", ) assert_matches_type(EventUpdateResponse, event, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.events.with_raw_response.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -328,8 +328,8 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.events.with_streaming_response.update( - "string", - event_name="string", + event_id="event_id", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) as response: @@ -345,8 +345,8 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): await async_client.events.with_raw_response.update( - "", - event_name="string", + event_id="", + event_name="event_name", properties={}, timestamp=parse_datetime("2020-12-09T16:09:53Z"), ) @@ -354,14 +354,14 @@ async def test_path_params_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_deprecate(self, async_client: AsyncOrb) -> None: event = await async_client.events.deprecate( - "string", + "event_id", ) assert_matches_type(EventDeprecateResponse, event, path=["response"]) @parametrize async def test_raw_response_deprecate(self, async_client: AsyncOrb) -> None: response = await async_client.events.with_raw_response.deprecate( - "string", + "event_id", ) assert response.is_closed is True @@ -372,7 +372,7 @@ async def test_raw_response_deprecate(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_deprecate(self, async_client: AsyncOrb) -> None: async with async_client.events.with_streaming_response.deprecate( - "string", + "event_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -394,22 +394,22 @@ async def test_method_ingest(self, async_client: AsyncOrb) -> None: event = await async_client.events.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) @@ -420,31 +420,31 @@ async def test_method_ingest_with_all_params(self, async_client: AsyncOrb) -> No event = await async_client.events.ingest( events=[ { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "customer_id": "string", - "external_customer_id": "string", - "event_name": "string", + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], - backfill_id="string", + backfill_id="backfill_id", debug=True, ) assert_matches_type(EventIngestResponse, event, path=["response"]) @@ -454,22 +454,22 @@ async def test_raw_response_ingest(self, async_client: AsyncOrb) -> None: response = await async_client.events.with_raw_response.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) @@ -484,22 +484,22 @@ async def test_streaming_response_ingest(self, async_client: AsyncOrb) -> None: async with async_client.events.with_streaming_response.ingest( events=[ { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, { - "event_name": "string", + "event_name": "event_name", "timestamp": parse_datetime("2020-12-09T16:09:53Z"), "properties": {}, - "idempotency_key": "string", + "idempotency_key": "idempotency_key", }, ], ) as response: diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 0d2e2df5..2de0176d 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -35,7 +35,7 @@ def test_method_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -44,7 +44,7 @@ def test_method_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -53,7 +53,7 @@ def test_method_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -73,7 +73,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -82,7 +82,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -91,7 +91,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -99,7 +99,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: discount={ "discount_type": "percentage", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], - "reason": "string", + "reason": "reason", "percentage_discount": 0.15, }, external_customer_id="external-customer-id", @@ -122,7 +122,7 @@ def test_raw_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -131,7 +131,7 @@ def test_raw_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -140,7 +140,7 @@ def test_raw_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -164,7 +164,7 @@ def test_streaming_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -173,7 +173,7 @@ def test_streaming_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -182,7 +182,7 @@ def test_streaming_response_create(self, client: Orb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -203,17 +203,17 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: invoice = client.invoices.list( - amount="string", - amount_gt="string", - amount_lt="string", - cursor="string", - customer_id="string", + amount="amount", + amount_gt="amount[gt]", + amount_lt="amount[lt]", + cursor="cursor", + customer_id="customer_id", date_type="due_date", due_date=parse_date("2019-12-27"), - due_date_window="string", + due_date_window="due_date_window", due_date_gt=parse_date("2019-12-27"), due_date_lt=parse_date("2019-12-27"), - external_customer_id="string", + external_customer_id="external_customer_id", invoice_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -221,7 +221,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: is_recurring=True, limit=1, status=["draft", "issued", "paid"], - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(SyncPage[Invoice], invoice, path=["response"]) @@ -248,14 +248,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: invoice = client.invoices.fetch( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.invoices.with_raw_response.fetch( - "string", + "invoice_id", ) assert response.is_closed is True @@ -266,7 +266,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.invoices.with_streaming_response.fetch( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -291,7 +291,7 @@ def test_method_fetch_upcoming(self, client: Orb) -> None: @parametrize def test_method_fetch_upcoming_with_all_params(self, client: Orb) -> None: invoice = client.invoices.fetch_upcoming( - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(InvoiceFetchUpcomingResponse, invoice, path=["response"]) @@ -318,14 +318,14 @@ def test_streaming_response_fetch_upcoming(self, client: Orb) -> None: @parametrize def test_method_issue(self, client: Orb) -> None: invoice = client.invoices.issue( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize def test_raw_response_issue(self, client: Orb) -> None: response = client.invoices.with_raw_response.issue( - "string", + "invoice_id", ) assert response.is_closed is True @@ -336,7 +336,7 @@ def test_raw_response_issue(self, client: Orb) -> None: @parametrize def test_streaming_response_issue(self, client: Orb) -> None: with client.invoices.with_streaming_response.issue( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -356,7 +356,7 @@ def test_path_params_issue(self, client: Orb) -> None: @parametrize def test_method_mark_paid(self, client: Orb) -> None: invoice = client.invoices.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) assert_matches_type(Invoice, invoice, path=["response"]) @@ -364,17 +364,17 @@ def test_method_mark_paid(self, client: Orb) -> None: @parametrize def test_method_mark_paid_with_all_params(self, client: Orb) -> None: invoice = client.invoices.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), external_id="external_payment_id_123", - notes="string", + notes="notes", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize def test_raw_response_mark_paid(self, client: Orb) -> None: response = client.invoices.with_raw_response.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) @@ -386,7 +386,7 @@ def test_raw_response_mark_paid(self, client: Orb) -> None: @parametrize def test_streaming_response_mark_paid(self, client: Orb) -> None: with client.invoices.with_streaming_response.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) as response: assert not response.is_closed @@ -401,21 +401,21 @@ def test_streaming_response_mark_paid(self, client: Orb) -> None: def test_path_params_mark_paid(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `invoice_id` but received ''"): client.invoices.with_raw_response.mark_paid( - "", + invoice_id="", payment_received_date=parse_date("2023-09-22"), ) @parametrize def test_method_void(self, client: Orb) -> None: invoice = client.invoices.void( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize def test_raw_response_void(self, client: Orb) -> None: response = client.invoices.with_raw_response.void( - "string", + "invoice_id", ) assert response.is_closed is True @@ -426,7 +426,7 @@ def test_raw_response_void(self, client: Orb) -> None: @parametrize def test_streaming_response_void(self, client: Orb) -> None: with client.invoices.with_streaming_response.void( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -460,7 +460,7 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -469,7 +469,7 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -478,7 +478,7 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -498,7 +498,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -507,7 +507,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -516,7 +516,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -524,7 +524,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No discount={ "discount_type": "percentage", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], - "reason": "string", + "reason": "reason", "percentage_discount": 0.15, }, external_customer_id="external-customer-id", @@ -547,7 +547,7 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -556,7 +556,7 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -565,7 +565,7 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -589,7 +589,7 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -598,7 +598,7 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { "start_date": parse_date("2023-09-22"), @@ -607,7 +607,7 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: "name": "Line Item Name", "item_id": "4khy3nwzktxv7", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], net_terms=0, @@ -628,17 +628,17 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.list( - amount="string", - amount_gt="string", - amount_lt="string", - cursor="string", - customer_id="string", + amount="amount", + amount_gt="amount[gt]", + amount_lt="amount[lt]", + cursor="cursor", + customer_id="customer_id", date_type="due_date", due_date=parse_date("2019-12-27"), - due_date_window="string", + due_date_window="due_date_window", due_date_gt=parse_date("2019-12-27"), due_date_lt=parse_date("2019-12-27"), - external_customer_id="string", + external_customer_id="external_customer_id", invoice_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), invoice_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -646,7 +646,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None is_recurring=True, limit=1, status=["draft", "issued", "paid"], - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(AsyncPage[Invoice], invoice, path=["response"]) @@ -673,14 +673,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.fetch( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.invoices.with_raw_response.fetch( - "string", + "invoice_id", ) assert response.is_closed is True @@ -691,7 +691,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.invoices.with_streaming_response.fetch( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -716,7 +716,7 @@ async def test_method_fetch_upcoming(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch_upcoming_with_all_params(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.fetch_upcoming( - subscription_id="string", + subscription_id="subscription_id", ) assert_matches_type(InvoiceFetchUpcomingResponse, invoice, path=["response"]) @@ -743,14 +743,14 @@ async def test_streaming_response_fetch_upcoming(self, async_client: AsyncOrb) - @parametrize async def test_method_issue(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.issue( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize async def test_raw_response_issue(self, async_client: AsyncOrb) -> None: response = await async_client.invoices.with_raw_response.issue( - "string", + "invoice_id", ) assert response.is_closed is True @@ -761,7 +761,7 @@ async def test_raw_response_issue(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_issue(self, async_client: AsyncOrb) -> None: async with async_client.invoices.with_streaming_response.issue( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -781,7 +781,7 @@ async def test_path_params_issue(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_mark_paid(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) assert_matches_type(Invoice, invoice, path=["response"]) @@ -789,17 +789,17 @@ async def test_method_mark_paid(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_mark_paid_with_all_params(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), external_id="external_payment_id_123", - notes="string", + notes="notes", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize async def test_raw_response_mark_paid(self, async_client: AsyncOrb) -> None: response = await async_client.invoices.with_raw_response.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) @@ -811,7 +811,7 @@ async def test_raw_response_mark_paid(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_mark_paid(self, async_client: AsyncOrb) -> None: async with async_client.invoices.with_streaming_response.mark_paid( - "string", + invoice_id="invoice_id", payment_received_date=parse_date("2023-09-22"), ) as response: assert not response.is_closed @@ -826,21 +826,21 @@ async def test_streaming_response_mark_paid(self, async_client: AsyncOrb) -> Non async def test_path_params_mark_paid(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `invoice_id` but received ''"): await async_client.invoices.with_raw_response.mark_paid( - "", + invoice_id="", payment_received_date=parse_date("2023-09-22"), ) @parametrize async def test_method_void(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.void( - "string", + "invoice_id", ) assert_matches_type(Invoice, invoice, path=["response"]) @parametrize async def test_raw_response_void(self, async_client: AsyncOrb) -> None: response = await async_client.invoices.with_raw_response.void( - "string", + "invoice_id", ) assert response.is_closed is True @@ -851,7 +851,7 @@ async def test_raw_response_void(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_void(self, async_client: AsyncOrb) -> None: async with async_client.invoices.with_streaming_response.void( - "string", + "invoice_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_items.py b/tests/api_resources/test_items.py index 6ef650eb..fedf3cc2 100644 --- a/tests/api_resources/test_items.py +++ b/tests/api_resources/test_items.py @@ -52,36 +52,36 @@ def test_streaming_response_create(self, client: Orb) -> None: @parametrize def test_method_update(self, client: Orb) -> None: item = client.items.update( - "string", + item_id="item_id", ) assert_matches_type(Item, item, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: item = client.items.update( - "string", + item_id="item_id", external_connections=[ { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, ], - name="string", + name="name", ) assert_matches_type(Item, item, path=["response"]) @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.items.with_raw_response.update( - "string", + item_id="item_id", ) assert response.is_closed is True @@ -92,7 +92,7 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.items.with_streaming_response.update( - "string", + item_id="item_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,7 +106,7 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): client.items.with_raw_response.update( - "", + item_id="", ) @parametrize @@ -117,7 +117,7 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: item = client.items.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Item], item, path=["response"]) @@ -145,14 +145,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: item = client.items.fetch( - "string", + "item_id", ) assert_matches_type(Item, item, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.items.with_raw_response.fetch( - "string", + "item_id", ) assert response.is_closed is True @@ -163,7 +163,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.items.with_streaming_response.fetch( - "string", + "item_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,36 +218,36 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: item = await async_client.items.update( - "string", + item_id="item_id", ) assert_matches_type(Item, item, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: item = await async_client.items.update( - "string", + item_id="item_id", external_connections=[ { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, { "external_connection_name": "stripe", - "external_entity_id": "string", + "external_entity_id": "external_entity_id", }, ], - name="string", + name="name", ) assert_matches_type(Item, item, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.items.with_raw_response.update( - "string", + item_id="item_id", ) assert response.is_closed is True @@ -258,7 +258,7 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.items.with_streaming_response.update( - "string", + item_id="item_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -272,7 +272,7 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): await async_client.items.with_raw_response.update( - "", + item_id="", ) @parametrize @@ -283,7 +283,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: item = await async_client.items.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Item], item, path=["response"]) @@ -311,14 +311,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: item = await async_client.items.fetch( - "string", + "item_id", ) assert_matches_type(Item, item, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.items.with_raw_response.fetch( - "string", + "item_id", ) assert response.is_closed is True @@ -329,7 +329,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.items.with_streaming_response.fetch( - "string", + "item_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_metrics.py b/tests/api_resources/test_metrics.py index ef2741dd..59a86fab 100644 --- a/tests/api_resources/test_metrics.py +++ b/tests/api_resources/test_metrics.py @@ -27,7 +27,7 @@ class TestMetrics: def test_method_create(self, client: Orb) -> None: metric = client.metrics.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) @@ -37,7 +37,7 @@ def test_method_create(self, client: Orb) -> None: def test_method_create_with_all_params(self, client: Orb) -> None: metric = client.metrics.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", metadata={"foo": "string"}, @@ -48,7 +48,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: def test_raw_response_create(self, client: Orb) -> None: response = client.metrics.with_raw_response.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) @@ -62,7 +62,7 @@ def test_raw_response_create(self, client: Orb) -> None: def test_streaming_response_create(self, client: Orb) -> None: with client.metrics.with_streaming_response.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) as response: @@ -86,7 +86,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[MetricListResponse], metric, path=["response"]) @@ -114,14 +114,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: metric = client.metrics.fetch( - "string", + "metric_id", ) assert_matches_type(MetricFetchResponse, metric, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.metrics.with_raw_response.fetch( - "string", + "metric_id", ) assert response.is_closed is True @@ -132,7 +132,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.metrics.with_streaming_response.fetch( - "string", + "metric_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -157,7 +157,7 @@ class TestAsyncMetrics: async def test_method_create(self, async_client: AsyncOrb) -> None: metric = await async_client.metrics.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) @@ -167,7 +167,7 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: metric = await async_client.metrics.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", metadata={"foo": "string"}, @@ -178,7 +178,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.metrics.with_raw_response.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) @@ -192,7 +192,7 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async with async_client.metrics.with_streaming_response.create( description="Sum of bytes downloaded in fast mode", - item_id="string", + item_id="item_id", name="Bytes downloaded", sql="SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'", ) as response: @@ -216,7 +216,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[MetricListResponse], metric, path=["response"]) @@ -244,14 +244,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: metric = await async_client.metrics.fetch( - "string", + "metric_id", ) assert_matches_type(MetricFetchResponse, metric, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.metrics.with_raw_response.fetch( - "string", + "metric_id", ) assert response.is_closed is True @@ -262,7 +262,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.metrics.with_streaming_response.fetch( - "string", + "metric_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 7134af1a..9e247f89 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -22,15 +22,15 @@ class TestPlans: @parametrize def test_method_create(self, client: Orb) -> None: plan = client.plans.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) @@ -39,26 +39,26 @@ def test_method_create(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params(self, client: Orb) -> None: plan = client.plans.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", } ], - default_invoice_memo="string", - external_plan_id="string", + default_invoice_memo="default_invoice_memo", + external_plan_id="external_plan_id", metadata={"foo": "string"}, net_terms=0, status="active", @@ -68,15 +68,15 @@ def test_method_create_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_create(self, client: Orb) -> None: response = client.plans.with_raw_response.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) @@ -89,15 +89,15 @@ def test_raw_response_create(self, client: Orb) -> None: @parametrize def test_streaming_response_create(self, client: Orb) -> None: with client.plans.with_streaming_response.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) as response: @@ -112,15 +112,15 @@ def test_streaming_response_create(self, client: Orb) -> None: @parametrize def test_method_update(self, client: Orb) -> None: plan = client.plans.update( - "string", + plan_id="plan_id", ) assert_matches_type(Plan, plan, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: plan = client.plans.update( - "string", - external_plan_id="string", + plan_id="plan_id", + external_plan_id="external_plan_id", metadata={"foo": "string"}, ) assert_matches_type(Plan, plan, path=["response"]) @@ -128,7 +128,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.plans.with_raw_response.update( - "string", + plan_id="plan_id", ) assert response.is_closed is True @@ -139,7 +139,7 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.plans.with_streaming_response.update( - "string", + plan_id="plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,7 +153,7 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `plan_id` but received ''"): client.plans.with_raw_response.update( - "", + plan_id="", ) @parametrize @@ -168,7 +168,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, status="active", ) @@ -197,14 +197,14 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: plan = client.plans.fetch( - "string", + "plan_id", ) assert_matches_type(Plan, plan, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.plans.with_raw_response.fetch( - "string", + "plan_id", ) assert response.is_closed is True @@ -215,7 +215,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.plans.with_streaming_response.fetch( - "string", + "plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -239,15 +239,15 @@ class TestAsyncPlans: @parametrize async def test_method_create(self, async_client: AsyncOrb) -> None: plan = await async_client.plans.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) @@ -256,26 +256,26 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: plan = await async_client.plans.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", } ], - default_invoice_memo="string", - external_plan_id="string", + default_invoice_memo="default_invoice_memo", + external_plan_id="external_plan_id", metadata={"foo": "string"}, net_terms=0, status="active", @@ -285,15 +285,15 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.plans.with_raw_response.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) @@ -306,15 +306,15 @@ async def test_raw_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: async with async_client.plans.with_streaming_response.create( - currency="string", - name="string", + currency="currency", + name="name", prices=[ { "name": "Annual fee", - "item_id": "string", + "item_id": "item_id", "cadence": "annual", "model_type": "unit", - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, } ], ) as response: @@ -329,15 +329,15 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: plan = await async_client.plans.update( - "string", + plan_id="plan_id", ) assert_matches_type(Plan, plan, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: plan = await async_client.plans.update( - "string", - external_plan_id="string", + plan_id="plan_id", + external_plan_id="external_plan_id", metadata={"foo": "string"}, ) assert_matches_type(Plan, plan, path=["response"]) @@ -345,7 +345,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.plans.with_raw_response.update( - "string", + plan_id="plan_id", ) assert response.is_closed is True @@ -356,7 +356,7 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.plans.with_streaming_response.update( - "string", + plan_id="plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -370,7 +370,7 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `plan_id` but received ''"): await async_client.plans.with_raw_response.update( - "", + plan_id="", ) @parametrize @@ -385,7 +385,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", + cursor="cursor", limit=1, status="active", ) @@ -414,14 +414,14 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: plan = await async_client.plans.fetch( - "string", + "plan_id", ) assert_matches_type(Plan, plan, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.plans.with_raw_response.fetch( - "string", + "plan_id", ) assert response.is_closed is True @@ -432,7 +432,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.plans.with_streaming_response.fetch( - "string", + "plan_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index 69d065d7..eba58c84 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -23,11 +23,11 @@ class TestPrices: def test_method_create_overload_1(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) assert_matches_type(Price, price, path=["response"]) @@ -35,17 +35,17 @@ def test_method_create_overload_1(self, client: Orb) -> None: def test_method_create_with_all_params_overload_1(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, - billable_metric_id="string", + unit_config={"unit_amount": "unit_amount"}, + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -53,11 +53,11 @@ def test_method_create_with_all_params_overload_1(self, client: Orb) -> None: def test_raw_response_create_overload_1(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) assert response.is_closed is True @@ -69,11 +69,11 @@ def test_raw_response_create_overload_1(self, client: Orb) -> None: def test_streaming_response_create_overload_1(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -87,12 +87,12 @@ def test_streaming_response_create_overload_1(self, client: Orb) -> None: def test_method_create_overload_2(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) @@ -102,20 +102,20 @@ def test_method_create_overload_2(self, client: Orb) -> None: def test_method_create_with_all_params_overload_2(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -123,12 +123,12 @@ def test_method_create_with_all_params_overload_2(self, client: Orb) -> None: def test_raw_response_create_overload_2(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) @@ -142,12 +142,12 @@ def test_raw_response_create_overload_2(self, client: Orb) -> None: def test_streaming_response_create_overload_2(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) as response: @@ -163,22 +163,22 @@ def test_streaming_response_create_overload_2(self, client: Orb) -> None: def test_method_create_overload_3(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -192,34 +192,34 @@ def test_method_create_overload_3(self, client: Orb) -> None: def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], }, model_type="matrix", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -227,22 +227,22 @@ def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: def test_raw_response_create_overload_3(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -260,22 +260,22 @@ def test_raw_response_create_overload_3(self, client: Orb) -> None: def test_streaming_response_create_overload_3(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -295,22 +295,22 @@ def test_streaming_response_create_overload_3(self, client: Orb) -> None: def test_method_create_overload_4(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -325,22 +325,22 @@ def test_method_create_overload_4(self, client: Orb) -> None: def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -348,12 +348,12 @@ def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: }, model_type="matrix_with_allocation", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -361,22 +361,22 @@ def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: def test_raw_response_create_overload_4(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -395,22 +395,22 @@ def test_raw_response_create_overload_4(self, client: Orb) -> None: def test_streaming_response_create_overload_4(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -431,23 +431,23 @@ def test_streaming_response_create_overload_4(self, client: Orb) -> None: def test_method_create_overload_5(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -458,8 +458,8 @@ def test_method_create_overload_5(self, client: Orb) -> None: def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ @@ -467,26 +467,26 @@ def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -494,23 +494,23 @@ def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: def test_raw_response_create_overload_5(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -525,23 +525,23 @@ def test_raw_response_create_overload_5(self, client: Orb) -> None: def test_streaming_response_create_overload_5(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -558,22 +558,22 @@ def test_streaming_response_create_overload_5(self, client: Orb) -> None: def test_method_create_overload_6(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -585,38 +585,38 @@ def test_method_create_overload_6(self, client: Orb) -> None: def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, ] }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -624,22 +624,22 @@ def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: def test_raw_response_create_overload_6(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -655,22 +655,22 @@ def test_raw_response_create_overload_6(self, client: Orb) -> None: def test_streaming_response_create_overload_6(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -689,8 +689,8 @@ def test_method_create_overload_7(self, client: Orb) -> None: price = client.prices.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) @@ -701,19 +701,19 @@ def test_method_create_with_all_params_overload_7(self, client: Orb) -> None: price = client.prices.create( bps_config={ "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -722,8 +722,8 @@ def test_raw_response_create_overload_7(self, client: Orb) -> None: response = client.prices.with_raw_response.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) @@ -738,8 +738,8 @@ def test_streaming_response_create_overload_7(self, client: Orb) -> None: with client.prices.with_streaming_response.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) as response: @@ -756,8 +756,8 @@ def test_method_create_overload_8(self, client: Orb) -> None: price = client.prices.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) @@ -769,33 +769,33 @@ def test_method_create_with_all_params_overload_8(self, client: Orb) -> None: bulk_bps_config={ "tiers": [ { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, ] }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -804,8 +804,8 @@ def test_raw_response_create_overload_8(self, client: Orb) -> None: response = client.prices.with_raw_response.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) @@ -820,8 +820,8 @@ def test_streaming_response_create_overload_8(self, client: Orb) -> None: with client.prices.with_streaming_response.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) as response: @@ -836,10 +836,16 @@ def test_streaming_response_create_overload_8(self, client: Orb) -> None: @parametrize def test_method_create_overload_9(self, client: Orb) -> None: price = client.prices.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) @@ -852,39 +858,45 @@ def test_method_create_with_all_params_overload_9(self, client: Orb) -> None: "tiers": [ { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @parametrize def test_raw_response_create_overload_9(self, client: Orb) -> None: response = client.prices.with_raw_response.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) @@ -897,10 +909,16 @@ def test_raw_response_create_overload_9(self, client: Orb) -> None: @parametrize def test_streaming_response_create_overload_9(self, client: Orb) -> None: with client.prices.with_streaming_response.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) as response: @@ -916,8 +934,8 @@ def test_streaming_response_create_overload_9(self, client: Orb) -> None: def test_method_create_overload_10(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -928,17 +946,17 @@ def test_method_create_overload_10(self, client: Orb) -> None: def test_method_create_with_all_params_overload_10(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -946,8 +964,8 @@ def test_method_create_with_all_params_overload_10(self, client: Orb) -> None: def test_raw_response_create_overload_10(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -962,8 +980,8 @@ def test_raw_response_create_overload_10(self, client: Orb) -> None: def test_streaming_response_create_overload_10(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -980,8 +998,8 @@ def test_streaming_response_create_overload_10(self, client: Orb) -> None: def test_method_create_overload_11(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -992,17 +1010,17 @@ def test_method_create_overload_11(self, client: Orb) -> None: def test_method_create_with_all_params_overload_11(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1010,8 +1028,8 @@ def test_method_create_with_all_params_overload_11(self, client: Orb) -> None: def test_raw_response_create_overload_11(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -1026,8 +1044,8 @@ def test_raw_response_create_overload_11(self, client: Orb) -> None: def test_streaming_response_create_overload_11(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -1044,9 +1062,9 @@ def test_streaming_response_create_overload_11(self, client: Orb) -> None: def test_method_create_overload_12(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) @@ -1056,17 +1074,17 @@ def test_method_create_overload_12(self, client: Orb) -> None: def test_method_create_with_all_params_overload_12(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1074,9 +1092,9 @@ def test_method_create_with_all_params_overload_12(self, client: Orb) -> None: def test_raw_response_create_overload_12(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) @@ -1090,9 +1108,9 @@ def test_raw_response_create_overload_12(self, client: Orb) -> None: def test_streaming_response_create_overload_12(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) as response: @@ -1108,8 +1126,8 @@ def test_streaming_response_create_overload_12(self, client: Orb) -> None: def test_method_create_overload_13(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -1120,17 +1138,17 @@ def test_method_create_overload_13(self, client: Orb) -> None: def test_method_create_with_all_params_overload_13(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1138,8 +1156,8 @@ def test_method_create_with_all_params_overload_13(self, client: Orb) -> None: def test_raw_response_create_overload_13(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -1154,8 +1172,8 @@ def test_raw_response_create_overload_13(self, client: Orb) -> None: def test_streaming_response_create_overload_13(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -1172,8 +1190,8 @@ def test_streaming_response_create_overload_13(self, client: Orb) -> None: def test_method_create_overload_14(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -1184,17 +1202,17 @@ def test_method_create_overload_14(self, client: Orb) -> None: def test_method_create_with_all_params_overload_14(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1202,8 +1220,8 @@ def test_method_create_with_all_params_overload_14(self, client: Orb) -> None: def test_raw_response_create_overload_14(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -1218,8 +1236,8 @@ def test_raw_response_create_overload_14(self, client: Orb) -> None: def test_streaming_response_create_overload_14(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -1236,8 +1254,8 @@ def test_streaming_response_create_overload_14(self, client: Orb) -> None: def test_method_create_overload_15(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -1248,17 +1266,17 @@ def test_method_create_overload_15(self, client: Orb) -> None: def test_method_create_with_all_params_overload_15(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1266,8 +1284,8 @@ def test_method_create_with_all_params_overload_15(self, client: Orb) -> None: def test_raw_response_create_overload_15(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -1282,8 +1300,8 @@ def test_raw_response_create_overload_15(self, client: Orb) -> None: def test_streaming_response_create_overload_15(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -1300,8 +1318,8 @@ def test_streaming_response_create_overload_15(self, client: Orb) -> None: def test_method_create_overload_16(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -1312,17 +1330,17 @@ def test_method_create_overload_16(self, client: Orb) -> None: def test_method_create_with_all_params_overload_16(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1330,8 +1348,8 @@ def test_method_create_with_all_params_overload_16(self, client: Orb) -> None: def test_raw_response_create_overload_16(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -1346,8 +1364,8 @@ def test_raw_response_create_overload_16(self, client: Orb) -> None: def test_streaming_response_create_overload_16(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -1364,8 +1382,8 @@ def test_streaming_response_create_overload_16(self, client: Orb) -> None: def test_method_create_overload_17(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -1376,17 +1394,17 @@ def test_method_create_overload_17(self, client: Orb) -> None: def test_method_create_with_all_params_overload_17(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1394,8 +1412,8 @@ def test_method_create_with_all_params_overload_17(self, client: Orb) -> None: def test_raw_response_create_overload_17(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -1410,8 +1428,8 @@ def test_raw_response_create_overload_17(self, client: Orb) -> None: def test_streaming_response_create_overload_17(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -1428,8 +1446,8 @@ def test_streaming_response_create_overload_17(self, client: Orb) -> None: def test_method_create_overload_18(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -1440,17 +1458,17 @@ def test_method_create_overload_18(self, client: Orb) -> None: def test_method_create_with_all_params_overload_18(self, client: Orb) -> None: price = client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1458,8 +1476,8 @@ def test_method_create_with_all_params_overload_18(self, client: Orb) -> None: def test_raw_response_create_overload_18(self, client: Orb) -> None: response = client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -1474,8 +1492,8 @@ def test_raw_response_create_overload_18(self, client: Orb) -> None: def test_streaming_response_create_overload_18(self, client: Orb) -> None: with client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -1496,7 +1514,7 @@ def test_method_list(self, client: Orb) -> None: @parametrize def test_method_list_with_all_params(self, client: Orb) -> None: price = client.prices.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Price], price, path=["response"]) @@ -1524,7 +1542,7 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_evaluate(self, client: Orb) -> None: price = client.prices.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -1533,11 +1551,11 @@ def test_method_evaluate(self, client: Orb) -> None: @parametrize def test_method_evaluate_with_all_params(self, client: Orb) -> None: price = client.prices.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", filter="my_numeric_property > 100 AND my_other_property = 'bar'", grouping_keys=["case when my_event_type = 'foo' then true else false end"], ) @@ -1546,7 +1564,7 @@ def test_method_evaluate_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_evaluate(self, client: Orb) -> None: response = client.prices.with_raw_response.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -1559,7 +1577,7 @@ def test_raw_response_evaluate(self, client: Orb) -> None: @parametrize def test_streaming_response_evaluate(self, client: Orb) -> None: with client.prices.with_streaming_response.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: @@ -1575,7 +1593,7 @@ def test_streaming_response_evaluate(self, client: Orb) -> None: def test_path_params_evaluate(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `price_id` but received ''"): client.prices.with_raw_response.evaluate( - "", + price_id="", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -1583,14 +1601,14 @@ def test_path_params_evaluate(self, client: Orb) -> None: @parametrize def test_method_fetch(self, client: Orb) -> None: price = client.prices.fetch( - "string", + "price_id", ) assert_matches_type(Price, price, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.prices.with_raw_response.fetch( - "string", + "price_id", ) assert response.is_closed is True @@ -1601,7 +1619,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.prices.with_streaming_response.fetch( - "string", + "price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1626,11 +1644,11 @@ class TestAsyncPrices: async def test_method_create_overload_1(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1638,17 +1656,17 @@ async def test_method_create_overload_1(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_1(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, - billable_metric_id="string", + unit_config={"unit_amount": "unit_amount"}, + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1656,11 +1674,11 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn async def test_raw_response_create_overload_1(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) assert response.is_closed is True @@ -1672,11 +1690,11 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_1(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "string"}, + unit_config={"unit_amount": "unit_amount"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1690,12 +1708,12 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncOrb async def test_method_create_overload_2(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) @@ -1705,20 +1723,20 @@ async def test_method_create_overload_2(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_2(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1726,12 +1744,12 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn async def test_raw_response_create_overload_2(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) @@ -1745,12 +1763,12 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_2(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package", name="Annual fee", package_config={ - "package_amount": "string", + "package_amount": "package_amount", "package_size": 0, }, ) as response: @@ -1766,22 +1784,22 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncOrb async def test_method_create_overload_3(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1795,34 +1813,34 @@ async def test_method_create_overload_3(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_3(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], }, model_type="matrix", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1830,22 +1848,22 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn async def test_raw_response_create_overload_3(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1863,22 +1881,22 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_3(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1898,22 +1916,22 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncOrb async def test_method_create_overload_4(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1928,22 +1946,22 @@ async def test_method_create_overload_4(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_4(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1951,12 +1969,12 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn }, model_type="matrix_with_allocation", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -1964,22 +1982,22 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn async def test_raw_response_create_overload_4(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -1998,22 +2016,22 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_4(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", matrix_with_allocation_config={ "dimensions": ["string", "string", "string"], - "default_unit_amount": "string", + "default_unit_amount": "default_unit_amount", "matrix_values": [ { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, { - "unit_amount": "string", + "unit_amount": "unit_amount", "dimension_values": ["string", "string", "string"], }, ], @@ -2034,23 +2052,23 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncOrb async def test_method_create_overload_5(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -2061,8 +2079,8 @@ async def test_method_create_overload_5(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_5(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ @@ -2070,26 +2088,26 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, "last_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2097,23 +2115,23 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn async def test_raw_response_create_overload_5(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -2128,23 +2146,23 @@ async def test_raw_response_create_overload_5(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_5(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered", name="Annual fee", tiered_config={ "tiers": [ { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "first_unit": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, @@ -2161,22 +2179,22 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncOrb async def test_method_create_overload_6(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -2188,38 +2206,38 @@ async def test_method_create_overload_6(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_6(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "minimum_amount": "string", - "maximum_amount": "string", + "minimum_amount": "minimum_amount", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, ] }, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2227,22 +2245,22 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn async def test_raw_response_create_overload_6(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -2258,22 +2276,22 @@ async def test_raw_response_create_overload_6(self, async_client: AsyncOrb) -> N async def test_streaming_response_create_overload_6(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_bps", name="Annual fee", tiered_bps_config={ "tiers": [ { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, { - "minimum_amount": "string", + "minimum_amount": "minimum_amount", "bps": 0, }, ] @@ -2292,8 +2310,8 @@ async def test_method_create_overload_7(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) @@ -2304,19 +2322,19 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn price = await async_client.prices.create( bps_config={ "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2325,8 +2343,8 @@ async def test_raw_response_create_overload_7(self, async_client: AsyncOrb) -> N response = await async_client.prices.with_raw_response.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) @@ -2341,8 +2359,8 @@ async def test_streaming_response_create_overload_7(self, async_client: AsyncOrb async with async_client.prices.with_streaming_response.create( bps_config={"bps": 0}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bps", name="Annual fee", ) as response: @@ -2359,8 +2377,8 @@ async def test_method_create_overload_8(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) @@ -2372,33 +2390,33 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn bulk_bps_config={ "tiers": [ { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, { - "maximum_amount": "string", + "maximum_amount": "maximum_amount", "bps": 0, - "per_unit_maximum": "string", + "per_unit_maximum": "per_unit_maximum", }, ] }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2407,8 +2425,8 @@ async def test_raw_response_create_overload_8(self, async_client: AsyncOrb) -> N response = await async_client.prices.with_raw_response.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) @@ -2423,8 +2441,8 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncOrb async with async_client.prices.with_streaming_response.create( bulk_bps_config={"tiers": [{"bps": 0}, {"bps": 0}, {"bps": 0}]}, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk_bps", name="Annual fee", ) as response: @@ -2439,10 +2457,16 @@ async def test_streaming_response_create_overload_8(self, async_client: AsyncOrb @parametrize async def test_method_create_overload_9(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) @@ -2455,39 +2479,45 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn "tiers": [ { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, { "maximum_units": 0, - "unit_amount": "string", + "unit_amount": "unit_amount", }, ] }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @parametrize async def test_raw_response_create_overload_9(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) @@ -2500,10 +2530,16 @@ async def test_raw_response_create_overload_9(self, async_client: AsyncOrb) -> N @parametrize async def test_streaming_response_create_overload_9(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( - bulk_config={"tiers": [{"unit_amount": "string"}, {"unit_amount": "string"}, {"unit_amount": "string"}]}, + bulk_config={ + "tiers": [ + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + {"unit_amount": "unit_amount"}, + ] + }, cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="bulk", name="Annual fee", ) as response: @@ -2519,8 +2555,8 @@ async def test_streaming_response_create_overload_9(self, async_client: AsyncOrb async def test_method_create_overload_10(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -2531,17 +2567,17 @@ async def test_method_create_overload_10(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_10(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2549,8 +2585,8 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy async def test_raw_response_create_overload_10(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -2565,8 +2601,8 @@ async def test_raw_response_create_overload_10(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_10(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="threshold_total_amount", name="Annual fee", threshold_total_amount_config={"foo": "bar"}, @@ -2583,8 +2619,8 @@ async def test_streaming_response_create_overload_10(self, async_client: AsyncOr async def test_method_create_overload_11(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -2595,17 +2631,17 @@ async def test_method_create_overload_11(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_11(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2613,8 +2649,8 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy async def test_raw_response_create_overload_11(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -2629,8 +2665,8 @@ async def test_raw_response_create_overload_11(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_11(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package", name="Annual fee", tiered_package_config={"foo": "bar"}, @@ -2647,9 +2683,9 @@ async def test_streaming_response_create_overload_11(self, async_client: AsyncOr async def test_method_create_overload_12(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) @@ -2659,17 +2695,17 @@ async def test_method_create_overload_12(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_12(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2677,9 +2713,9 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy async def test_raw_response_create_overload_12(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) @@ -2693,9 +2729,9 @@ async def test_raw_response_create_overload_12(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_12(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", + currency="currency", grouped_tiered_config={"foo": "bar"}, - item_id="string", + item_id="item_id", model_type="grouped_tiered", name="Annual fee", ) as response: @@ -2711,8 +2747,8 @@ async def test_streaming_response_create_overload_12(self, async_client: AsyncOr async def test_method_create_overload_13(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -2723,17 +2759,17 @@ async def test_method_create_overload_13(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_13(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2741,8 +2777,8 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy async def test_raw_response_create_overload_13(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -2757,8 +2793,8 @@ async def test_raw_response_create_overload_13(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_13(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_minimum", name="Annual fee", tiered_with_minimum_config={"foo": "bar"}, @@ -2775,8 +2811,8 @@ async def test_streaming_response_create_overload_13(self, async_client: AsyncOr async def test_method_create_overload_14(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -2787,17 +2823,17 @@ async def test_method_create_overload_14(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_14(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2805,8 +2841,8 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy async def test_raw_response_create_overload_14(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -2821,8 +2857,8 @@ async def test_raw_response_create_overload_14(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_14(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="package_with_allocation", name="Annual fee", package_with_allocation_config={"foo": "bar"}, @@ -2839,8 +2875,8 @@ async def test_streaming_response_create_overload_14(self, async_client: AsyncOr async def test_method_create_overload_15(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -2851,17 +2887,17 @@ async def test_method_create_overload_15(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_15(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2869,8 +2905,8 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy async def test_raw_response_create_overload_15(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -2885,8 +2921,8 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_15(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_package_with_minimum", name="Annual fee", tiered_package_with_minimum_config={"foo": "bar"}, @@ -2903,8 +2939,8 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncOr async def test_method_create_overload_16(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -2915,17 +2951,17 @@ async def test_method_create_overload_16(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_16(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2933,8 +2969,8 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy async def test_raw_response_create_overload_16(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -2949,8 +2985,8 @@ async def test_raw_response_create_overload_16(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_16(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_percent", name="Annual fee", unit_with_percent_config={"foo": "bar"}, @@ -2967,8 +3003,8 @@ async def test_streaming_response_create_overload_16(self, async_client: AsyncOr async def test_method_create_overload_17(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -2979,17 +3015,17 @@ async def test_method_create_overload_17(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_17(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -2997,8 +3033,8 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy async def test_raw_response_create_overload_17(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -3013,8 +3049,8 @@ async def test_raw_response_create_overload_17(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_17(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="tiered_with_proration", name="Annual fee", tiered_with_proration_config={"foo": "bar"}, @@ -3031,8 +3067,8 @@ async def test_streaming_response_create_overload_17(self, async_client: AsyncOr async def test_method_create_overload_18(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -3043,17 +3079,17 @@ async def test_method_create_overload_18(self, async_client: AsyncOrb) -> None: async def test_method_create_with_all_params_overload_18(self, async_client: AsyncOrb) -> None: price = await async_client.prices.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, - billable_metric_id="string", + billable_metric_id="billable_metric_id", billed_in_advance=True, conversion_rate=0, - external_price_id="string", + external_price_id="external_price_id", fixed_price_quantity=0, - invoice_grouping_key="string", + invoice_grouping_key="invoice_grouping_key", ) assert_matches_type(Price, price, path=["response"]) @@ -3061,8 +3097,8 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy async def test_raw_response_create_overload_18(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -3077,8 +3113,8 @@ async def test_raw_response_create_overload_18(self, async_client: AsyncOrb) -> async def test_streaming_response_create_overload_18(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.create( cadence="annual", - currency="string", - item_id="string", + currency="currency", + item_id="item_id", model_type="unit_with_proration", name="Annual fee", unit_with_proration_config={"foo": "bar"}, @@ -3099,7 +3135,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: price = await async_client.prices.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Price], price, path=["response"]) @@ -3127,7 +3163,7 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_evaluate(self, async_client: AsyncOrb) -> None: price = await async_client.prices.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -3136,11 +3172,11 @@ async def test_method_evaluate(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_evaluate_with_all_params(self, async_client: AsyncOrb) -> None: price = await async_client.prices.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", + customer_id="customer_id", + external_customer_id="external_customer_id", filter="my_numeric_property > 100 AND my_other_property = 'bar'", grouping_keys=["case when my_event_type = 'foo' then true else false end"], ) @@ -3149,7 +3185,7 @@ async def test_method_evaluate_with_all_params(self, async_client: AsyncOrb) -> @parametrize async def test_raw_response_evaluate(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -3162,7 +3198,7 @@ async def test_raw_response_evaluate(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_evaluate(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.evaluate( - "string", + price_id="price_id", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: @@ -3178,7 +3214,7 @@ async def test_streaming_response_evaluate(self, async_client: AsyncOrb) -> None async def test_path_params_evaluate(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `price_id` but received ''"): await async_client.prices.with_raw_response.evaluate( - "", + price_id="", timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -3186,14 +3222,14 @@ async def test_path_params_evaluate(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: price = await async_client.prices.fetch( - "string", + "price_id", ) assert_matches_type(Price, price, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.prices.with_raw_response.fetch( - "string", + "price_id", ) assert response.is_closed is True @@ -3204,7 +3240,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.prices.with_streaming_response.fetch( - "string", + "price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 359c89b3..b38be425 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -34,76 +34,76 @@ def test_method_create_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.create( align_billing_with_subscription_start_date=True, auto_collection=True, - aws_region="string", - coupon_redemption_code="string", + aws_region="aws_region", + coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, - customer_id="string", - default_invoice_memo="string", + customer_id="customer_id", + default_invoice_memo="default_invoice_memo", end_date=parse_datetime("2019-12-27T18:11:19.117Z"), - external_customer_id="string", + external_customer_id="external_customer_id", external_marketplace="google", - external_marketplace_reporting_id="string", + external_marketplace_reporting_id="external_marketplace_reporting_id", external_plan_id="ZMwNQefe7J3ecf7W", initial_phase_order=0, - invoicing_threshold="string", + invoicing_threshold="invoicing_threshold", metadata={"foo": "string"}, net_terms=0, per_credit_overage_amount=0, plan_id="ZMwNQefe7J3ecf7W", price_overrides=[ { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], start_date=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -133,16 +133,16 @@ def test_streaming_response_create(self, client: Orb) -> None: @parametrize def test_method_update(self, client: Orb) -> None: subscription = client.subscriptions.update( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.update( - "string", + subscription_id="subscription_id", auto_collection=True, - default_invoice_memo="string", + default_invoice_memo="default_invoice_memo", invoicing_threshold="10.00", metadata={"foo": "string"}, net_terms=0, @@ -152,7 +152,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.update( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -163,7 +163,7 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.update( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -177,7 +177,7 @@ def test_streaming_response_update(self, client: Orb) -> None: def test_path_params_update(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.update( - "", + subscription_id="", ) @parametrize @@ -192,9 +192,9 @@ def test_method_list_with_all_params(self, client: Orb) -> None: created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", - customer_id="string", - external_customer_id="string", + cursor="cursor", + customer_id="customer_id", + external_customer_id="external_customer_id", limit=1, status="active", ) @@ -223,7 +223,7 @@ def test_streaming_response_list(self, client: Orb) -> None: @parametrize def test_method_cancel(self, client: Orb) -> None: subscription = client.subscriptions.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -231,7 +231,7 @@ def test_method_cancel(self, client: Orb) -> None: @parametrize def test_method_cancel_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -240,7 +240,7 @@ def test_method_cancel_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_cancel(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) @@ -252,7 +252,7 @@ def test_raw_response_cancel(self, client: Orb) -> None: @parametrize def test_streaming_response_cancel(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) as response: assert not response.is_closed @@ -267,21 +267,21 @@ def test_streaming_response_cancel(self, client: Orb) -> None: def test_path_params_cancel(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.cancel( - "", + subscription_id="", cancel_option="end_of_subscription_term", ) @parametrize def test_method_fetch(self, client: Orb) -> None: subscription = client.subscriptions.fetch( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_raw_response_fetch(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.fetch( - "string", + "subscription_id", ) assert response.is_closed is True @@ -292,7 +292,7 @@ def test_raw_response_fetch(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.fetch( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -312,14 +312,14 @@ def test_path_params_fetch(self, client: Orb) -> None: @parametrize def test_method_fetch_costs(self, client: Orb) -> None: subscription = client.subscriptions.fetch_costs( - "string", + subscription_id="subscription_id", ) assert_matches_type(SubscriptionFetchCostsResponse, subscription, path=["response"]) @parametrize def test_method_fetch_costs_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.fetch_costs( - "string", + subscription_id="subscription_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -329,7 +329,7 @@ def test_method_fetch_costs_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_fetch_costs(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.fetch_costs( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -340,7 +340,7 @@ def test_raw_response_fetch_costs(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch_costs(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.fetch_costs( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -354,21 +354,21 @@ def test_streaming_response_fetch_costs(self, client: Orb) -> None: def test_path_params_fetch_costs(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.fetch_costs( - "", + subscription_id="", ) @parametrize def test_method_fetch_schedule(self, client: Orb) -> None: subscription = client.subscriptions.fetch_schedule( - "string", + subscription_id="subscription_id", ) assert_matches_type(SyncPage[SubscriptionFetchScheduleResponse], subscription, path=["response"]) @parametrize def test_method_fetch_schedule_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.fetch_schedule( - "string", - cursor="string", + subscription_id="subscription_id", + cursor="cursor", limit=1, start_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), start_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -380,7 +380,7 @@ def test_method_fetch_schedule_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_fetch_schedule(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.fetch_schedule( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -391,7 +391,7 @@ def test_raw_response_fetch_schedule(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch_schedule(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.fetch_schedule( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -405,14 +405,14 @@ def test_streaming_response_fetch_schedule(self, client: Orb) -> None: def test_path_params_fetch_schedule(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.fetch_schedule( - "", + subscription_id="", ) @pytest.mark.skip(reason="Incorrect example breaks Prism") @parametrize def test_method_fetch_usage(self, client: Orb) -> None: subscription = client.subscriptions.fetch_usage( - "string", + subscription_id="subscription_id", ) assert_matches_type(SubscriptionUsage, subscription, path=["response"]) @@ -420,16 +420,16 @@ def test_method_fetch_usage(self, client: Orb) -> None: @parametrize def test_method_fetch_usage_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.fetch_usage( - "string", - billable_metric_id="string", - cursor="string", - first_dimension_key="string", - first_dimension_value="string", + subscription_id="subscription_id", + billable_metric_id="billable_metric_id", + cursor="cursor", + first_dimension_key="first_dimension_key", + first_dimension_value="first_dimension_value", granularity="day", - group_by="string", + group_by="group_by", limit=0, - second_dimension_key="string", - second_dimension_value="string", + second_dimension_key="second_dimension_key", + second_dimension_value="second_dimension_value", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -440,7 +440,7 @@ def test_method_fetch_usage_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_fetch_usage(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.fetch_usage( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -452,7 +452,7 @@ def test_raw_response_fetch_usage(self, client: Orb) -> None: @parametrize def test_streaming_response_fetch_usage(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.fetch_usage( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -467,14 +467,14 @@ def test_streaming_response_fetch_usage(self, client: Orb) -> None: def test_path_params_fetch_usage(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.fetch_usage( - "", + subscription_id="", ) @pytest.mark.skip(reason="Incorrect example breaks Prism") @parametrize def test_method_price_intervals(self, client: Orb) -> None: subscription = client.subscriptions.price_intervals( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -482,24 +482,24 @@ def test_method_price_intervals(self, client: Orb) -> None: @parametrize def test_method_price_intervals_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.price_intervals( - "string", + subscription_id="subscription_id", add=[ { "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -544,18 +544,18 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -600,18 +600,18 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -768,7 +768,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_price_intervals(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.price_intervals( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -780,7 +780,7 @@ def test_raw_response_price_intervals(self, client: Orb) -> None: @parametrize def test_streaming_response_price_intervals(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.price_intervals( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -795,13 +795,13 @@ def test_streaming_response_price_intervals(self, client: Orb) -> None: def test_path_params_price_intervals(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.price_intervals( - "", + subscription_id="", ) @parametrize def test_method_schedule_plan_change(self, client: Orb) -> None: subscription = client.subscriptions.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -809,12 +809,12 @@ def test_method_schedule_plan_change(self, client: Orb) -> None: @parametrize def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", align_billing_with_plan_change_date=True, billing_cycle_alignment="unchanged", change_date="2017-07-21T17:32:28Z", - coupon_redemption_code="string", + coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, external_plan_id="ZMwNQefe7J3ecf7W", initial_phase_order=2, @@ -823,58 +823,58 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: plan_id="ZMwNQefe7J3ecf7W", price_overrides=[ { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], ) @@ -883,7 +883,7 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_schedule_plan_change(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) @@ -895,7 +895,7 @@ def test_raw_response_schedule_plan_change(self, client: Orb) -> None: @parametrize def test_streaming_response_schedule_plan_change(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) as response: assert not response.is_closed @@ -910,21 +910,21 @@ def test_streaming_response_schedule_plan_change(self, client: Orb) -> None: def test_path_params_schedule_plan_change(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.schedule_plan_change( - "", + subscription_id="", change_option="requested_date", ) @parametrize def test_method_trigger_phase(self, client: Orb) -> None: subscription = client.subscriptions.trigger_phase( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_method_trigger_phase_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.trigger_phase( - "string", + subscription_id="subscription_id", effective_date=parse_date("2019-12-27"), ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -932,7 +932,7 @@ def test_method_trigger_phase_with_all_params(self, client: Orb) -> None: @parametrize def test_raw_response_trigger_phase(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.trigger_phase( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -943,7 +943,7 @@ def test_raw_response_trigger_phase(self, client: Orb) -> None: @parametrize def test_streaming_response_trigger_phase(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.trigger_phase( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -957,20 +957,20 @@ def test_streaming_response_trigger_phase(self, client: Orb) -> None: def test_path_params_trigger_phase(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.trigger_phase( - "", + subscription_id="", ) @parametrize def test_method_unschedule_cancellation(self, client: Orb) -> None: subscription = client.subscriptions.unschedule_cancellation( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_raw_response_unschedule_cancellation(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.unschedule_cancellation( - "string", + "subscription_id", ) assert response.is_closed is True @@ -981,7 +981,7 @@ def test_raw_response_unschedule_cancellation(self, client: Orb) -> None: @parametrize def test_streaming_response_unschedule_cancellation(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.unschedule_cancellation( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1001,16 +1001,16 @@ def test_path_params_unschedule_cancellation(self, client: Orb) -> None: @parametrize def test_method_unschedule_fixed_fee_quantity_updates(self, client: Orb) -> None: subscription = client.subscriptions.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_raw_response_unschedule_fixed_fee_quantity_updates(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) assert response.is_closed is True @@ -1021,8 +1021,8 @@ def test_raw_response_unschedule_fixed_fee_quantity_updates(self, client: Orb) - @parametrize def test_streaming_response_unschedule_fixed_fee_quantity_updates(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1036,21 +1036,21 @@ def test_streaming_response_unschedule_fixed_fee_quantity_updates(self, client: def test_path_params_unschedule_fixed_fee_quantity_updates(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.unschedule_fixed_fee_quantity_updates( - "", - price_id="string", + subscription_id="", + price_id="price_id", ) @parametrize def test_method_unschedule_pending_plan_changes(self, client: Orb) -> None: subscription = client.subscriptions.unschedule_pending_plan_changes( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize def test_raw_response_unschedule_pending_plan_changes(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.unschedule_pending_plan_changes( - "string", + "subscription_id", ) assert response.is_closed is True @@ -1061,7 +1061,7 @@ def test_raw_response_unschedule_pending_plan_changes(self, client: Orb) -> None @parametrize def test_streaming_response_unschedule_pending_plan_changes(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.unschedule_pending_plan_changes( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1081,8 +1081,8 @@ def test_path_params_unschedule_pending_plan_changes(self, client: Orb) -> None: @parametrize def test_method_update_fixed_fee_quantity(self, client: Orb) -> None: subscription = client.subscriptions.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1090,8 +1090,8 @@ def test_method_update_fixed_fee_quantity(self, client: Orb) -> None: @parametrize def test_method_update_fixed_fee_quantity_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, change_option="immediate", effective_date=parse_date("2022-12-21"), @@ -1101,8 +1101,8 @@ def test_method_update_fixed_fee_quantity_with_all_params(self, client: Orb) -> @parametrize def test_raw_response_update_fixed_fee_quantity(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) @@ -1114,8 +1114,8 @@ def test_raw_response_update_fixed_fee_quantity(self, client: Orb) -> None: @parametrize def test_streaming_response_update_fixed_fee_quantity(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) as response: assert not response.is_closed @@ -1130,8 +1130,8 @@ def test_streaming_response_update_fixed_fee_quantity(self, client: Orb) -> None def test_path_params_update_fixed_fee_quantity(self, client: Orb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): client.subscriptions.with_raw_response.update_fixed_fee_quantity( - "", - price_id="string", + subscription_id="", + price_id="price_id", quantity=0, ) @@ -1149,76 +1149,76 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No subscription = await async_client.subscriptions.create( align_billing_with_subscription_start_date=True, auto_collection=True, - aws_region="string", - coupon_redemption_code="string", + aws_region="aws_region", + coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, - customer_id="string", - default_invoice_memo="string", + customer_id="customer_id", + default_invoice_memo="default_invoice_memo", end_date=parse_datetime("2019-12-27T18:11:19.117Z"), - external_customer_id="string", + external_customer_id="external_customer_id", external_marketplace="google", - external_marketplace_reporting_id="string", + external_marketplace_reporting_id="external_marketplace_reporting_id", external_plan_id="ZMwNQefe7J3ecf7W", initial_phase_order=0, - invoicing_threshold="string", + invoicing_threshold="invoicing_threshold", metadata={"foo": "string"}, net_terms=0, per_credit_overage_amount=0, plan_id="ZMwNQefe7J3ecf7W", price_overrides=[ { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], start_date=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1248,16 +1248,16 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.update( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.update( - "string", + subscription_id="subscription_id", auto_collection=True, - default_invoice_memo="string", + default_invoice_memo="default_invoice_memo", invoicing_threshold="10.00", metadata={"foo": "string"}, net_terms=0, @@ -1267,7 +1267,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.update( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -1278,7 +1278,7 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.update( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1292,7 +1292,7 @@ async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: async def test_path_params_update(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.update( - "", + subscription_id="", ) @parametrize @@ -1307,9 +1307,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None created_at_gte=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"), created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"), - cursor="string", - customer_id="string", - external_customer_id="string", + cursor="cursor", + customer_id="customer_id", + external_customer_id="external_customer_id", limit=1, status="active", ) @@ -1338,7 +1338,7 @@ async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_cancel(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1346,7 +1346,7 @@ async def test_method_cancel(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_cancel_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -1355,7 +1355,7 @@ async def test_method_cancel_with_all_params(self, async_client: AsyncOrb) -> No @parametrize async def test_raw_response_cancel(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) @@ -1367,7 +1367,7 @@ async def test_raw_response_cancel(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_cancel(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.cancel( - "string", + subscription_id="subscription_id", cancel_option="end_of_subscription_term", ) as response: assert not response.is_closed @@ -1382,21 +1382,21 @@ async def test_streaming_response_cancel(self, async_client: AsyncOrb) -> None: async def test_path_params_cancel(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.cancel( - "", + subscription_id="", cancel_option="end_of_subscription_term", ) @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.fetch( - "string", + "subscription_id", ) assert response.is_closed is True @@ -1407,7 +1407,7 @@ async def test_raw_response_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.fetch( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1427,14 +1427,14 @@ async def test_path_params_fetch(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch_costs(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_costs( - "string", + subscription_id="subscription_id", ) assert_matches_type(SubscriptionFetchCostsResponse, subscription, path=["response"]) @parametrize async def test_method_fetch_costs_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_costs( - "string", + subscription_id="subscription_id", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -1444,7 +1444,7 @@ async def test_method_fetch_costs_with_all_params(self, async_client: AsyncOrb) @parametrize async def test_raw_response_fetch_costs(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.fetch_costs( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -1455,7 +1455,7 @@ async def test_raw_response_fetch_costs(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch_costs(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.fetch_costs( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1469,21 +1469,21 @@ async def test_streaming_response_fetch_costs(self, async_client: AsyncOrb) -> N async def test_path_params_fetch_costs(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.fetch_costs( - "", + subscription_id="", ) @parametrize async def test_method_fetch_schedule(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_schedule( - "string", + subscription_id="subscription_id", ) assert_matches_type(AsyncPage[SubscriptionFetchScheduleResponse], subscription, path=["response"]) @parametrize async def test_method_fetch_schedule_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_schedule( - "string", - cursor="string", + subscription_id="subscription_id", + cursor="cursor", limit=1, start_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), start_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1495,7 +1495,7 @@ async def test_method_fetch_schedule_with_all_params(self, async_client: AsyncOr @parametrize async def test_raw_response_fetch_schedule(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.fetch_schedule( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -1506,7 +1506,7 @@ async def test_raw_response_fetch_schedule(self, async_client: AsyncOrb) -> None @parametrize async def test_streaming_response_fetch_schedule(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.fetch_schedule( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1520,14 +1520,14 @@ async def test_streaming_response_fetch_schedule(self, async_client: AsyncOrb) - async def test_path_params_fetch_schedule(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.fetch_schedule( - "", + subscription_id="", ) @pytest.mark.skip(reason="Incorrect example breaks Prism") @parametrize async def test_method_fetch_usage(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_usage( - "string", + subscription_id="subscription_id", ) assert_matches_type(SubscriptionUsage, subscription, path=["response"]) @@ -1535,16 +1535,16 @@ async def test_method_fetch_usage(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_fetch_usage_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.fetch_usage( - "string", - billable_metric_id="string", - cursor="string", - first_dimension_key="string", - first_dimension_value="string", + subscription_id="subscription_id", + billable_metric_id="billable_metric_id", + cursor="cursor", + first_dimension_key="first_dimension_key", + first_dimension_value="first_dimension_value", granularity="day", - group_by="string", + group_by="group_by", limit=0, - second_dimension_key="string", - second_dimension_value="string", + second_dimension_key="second_dimension_key", + second_dimension_value="second_dimension_value", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), timeframe_start=parse_datetime("2022-02-01T05:00:00Z"), view_mode="periodic", @@ -1555,7 +1555,7 @@ async def test_method_fetch_usage_with_all_params(self, async_client: AsyncOrb) @parametrize async def test_raw_response_fetch_usage(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.fetch_usage( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -1567,7 +1567,7 @@ async def test_raw_response_fetch_usage(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_fetch_usage(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.fetch_usage( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1582,14 +1582,14 @@ async def test_streaming_response_fetch_usage(self, async_client: AsyncOrb) -> N async def test_path_params_fetch_usage(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.fetch_usage( - "", + subscription_id="", ) @pytest.mark.skip(reason="Incorrect example breaks Prism") @parametrize async def test_method_price_intervals(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.price_intervals( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1597,24 +1597,24 @@ async def test_method_price_intervals(self, async_client: AsyncOrb) -> None: @parametrize async def test_method_price_intervals_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.price_intervals( - "string", + subscription_id="subscription_id", add=[ { "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -1659,18 +1659,18 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -1715,18 +1715,18 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { - "external_price_id": "string", + "external_price_id": "external_price_id", "name": "Annual fee", - "billable_metric_id": "string", - "item_id": "string", + "billable_metric_id": "billable_metric_id", + "item_id": "item_id", "billed_in_advance": True, "fixed_price_quantity": 0, - "invoice_grouping_key": "string", + "invoice_grouping_key": "invoice_grouping_key", "cadence": "annual", "conversion_rate": 0, "model_type": "unit", - "unit_config": {"unit_amount": "string"}, - "currency": "string", + "unit_config": {"unit_amount": "unit_amount"}, + "currency": "currency", }, "allocation_price": { "currency": "USD", @@ -1883,7 +1883,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO @parametrize async def test_raw_response_price_intervals(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.price_intervals( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -1895,7 +1895,7 @@ async def test_raw_response_price_intervals(self, async_client: AsyncOrb) -> Non @parametrize async def test_streaming_response_price_intervals(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.price_intervals( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1910,13 +1910,13 @@ async def test_streaming_response_price_intervals(self, async_client: AsyncOrb) async def test_path_params_price_intervals(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.price_intervals( - "", + subscription_id="", ) @parametrize async def test_method_schedule_plan_change(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1924,12 +1924,12 @@ async def test_method_schedule_plan_change(self, async_client: AsyncOrb) -> None @parametrize async def test_method_schedule_plan_change_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", align_billing_with_plan_change_date=True, billing_cycle_alignment="unchanged", change_date="2017-07-21T17:32:28Z", - coupon_redemption_code="string", + coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, external_plan_id="ZMwNQefe7J3ecf7W", initial_phase_order=2, @@ -1938,58 +1938,58 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A plan_id="ZMwNQefe7J3ecf7W", price_overrides=[ { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, { - "id": "string", + "id": "id", "model_type": "unit", "minimum_amount": "1.23", "maximum_amount": "1.23", - "currency": "string", + "currency": "currency", "conversion_rate": 0, "discount": { "discount_type": "percentage", "percentage_discount": 0.15, - "trial_amount_discount": "string", + "trial_amount_discount": "trial_amount_discount", "usage_discount": 0, - "amount_discount": "string", + "amount_discount": "amount_discount", "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], }, "fixed_price_quantity": 2, - "unit_config": {"unit_amount": "string"}, + "unit_config": {"unit_amount": "unit_amount"}, }, ], ) @@ -1998,7 +1998,7 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A @parametrize async def test_raw_response_schedule_plan_change(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) @@ -2010,7 +2010,7 @@ async def test_raw_response_schedule_plan_change(self, async_client: AsyncOrb) - @parametrize async def test_streaming_response_schedule_plan_change(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.schedule_plan_change( - "string", + subscription_id="subscription_id", change_option="requested_date", ) as response: assert not response.is_closed @@ -2025,21 +2025,21 @@ async def test_streaming_response_schedule_plan_change(self, async_client: Async async def test_path_params_schedule_plan_change(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.schedule_plan_change( - "", + subscription_id="", change_option="requested_date", ) @parametrize async def test_method_trigger_phase(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.trigger_phase( - "string", + subscription_id="subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_method_trigger_phase_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.trigger_phase( - "string", + subscription_id="subscription_id", effective_date=parse_date("2019-12-27"), ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -2047,7 +2047,7 @@ async def test_method_trigger_phase_with_all_params(self, async_client: AsyncOrb @parametrize async def test_raw_response_trigger_phase(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.trigger_phase( - "string", + subscription_id="subscription_id", ) assert response.is_closed is True @@ -2058,7 +2058,7 @@ async def test_raw_response_trigger_phase(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_trigger_phase(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.trigger_phase( - "string", + subscription_id="subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2072,20 +2072,20 @@ async def test_streaming_response_trigger_phase(self, async_client: AsyncOrb) -> async def test_path_params_trigger_phase(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.trigger_phase( - "", + subscription_id="", ) @parametrize async def test_method_unschedule_cancellation(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.unschedule_cancellation( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_raw_response_unschedule_cancellation(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.unschedule_cancellation( - "string", + "subscription_id", ) assert response.is_closed is True @@ -2096,7 +2096,7 @@ async def test_raw_response_unschedule_cancellation(self, async_client: AsyncOrb @parametrize async def test_streaming_response_unschedule_cancellation(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.unschedule_cancellation( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2116,16 +2116,16 @@ async def test_path_params_unschedule_cancellation(self, async_client: AsyncOrb) @parametrize async def test_method_unschedule_fixed_fee_quantity_updates(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_raw_response_unschedule_fixed_fee_quantity_updates(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) assert response.is_closed is True @@ -2136,8 +2136,8 @@ async def test_raw_response_unschedule_fixed_fee_quantity_updates(self, async_cl @parametrize async def test_streaming_response_unschedule_fixed_fee_quantity_updates(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.unschedule_fixed_fee_quantity_updates( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2151,21 +2151,21 @@ async def test_streaming_response_unschedule_fixed_fee_quantity_updates(self, as async def test_path_params_unschedule_fixed_fee_quantity_updates(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.unschedule_fixed_fee_quantity_updates( - "", - price_id="string", + subscription_id="", + price_id="price_id", ) @parametrize async def test_method_unschedule_pending_plan_changes(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.unschedule_pending_plan_changes( - "string", + "subscription_id", ) assert_matches_type(Subscription, subscription, path=["response"]) @parametrize async def test_raw_response_unschedule_pending_plan_changes(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.unschedule_pending_plan_changes( - "string", + "subscription_id", ) assert response.is_closed is True @@ -2176,7 +2176,7 @@ async def test_raw_response_unschedule_pending_plan_changes(self, async_client: @parametrize async def test_streaming_response_unschedule_pending_plan_changes(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.unschedule_pending_plan_changes( - "string", + "subscription_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2196,8 +2196,8 @@ async def test_path_params_unschedule_pending_plan_changes(self, async_client: A @parametrize async def test_method_update_fixed_fee_quantity(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -2205,8 +2205,8 @@ async def test_method_update_fixed_fee_quantity(self, async_client: AsyncOrb) -> @parametrize async def test_method_update_fixed_fee_quantity_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, change_option="immediate", effective_date=parse_date("2022-12-21"), @@ -2216,8 +2216,8 @@ async def test_method_update_fixed_fee_quantity_with_all_params(self, async_clie @parametrize async def test_raw_response_update_fixed_fee_quantity(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) @@ -2229,8 +2229,8 @@ async def test_raw_response_update_fixed_fee_quantity(self, async_client: AsyncO @parametrize async def test_streaming_response_update_fixed_fee_quantity(self, async_client: AsyncOrb) -> None: async with async_client.subscriptions.with_streaming_response.update_fixed_fee_quantity( - "string", - price_id="string", + subscription_id="subscription_id", + price_id="price_id", quantity=0, ) as response: assert not response.is_closed @@ -2245,7 +2245,7 @@ async def test_streaming_response_update_fixed_fee_quantity(self, async_client: async def test_path_params_update_fixed_fee_quantity(self, async_client: AsyncOrb) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `subscription_id` but received ''"): await async_client.subscriptions.with_raw_response.update_fixed_fee_quantity( - "", - price_id="string", + subscription_id="", + price_id="price_id", quantity=0, ) From 2a05873d80ae4e8bebdbcd2adb7cd1817377cc11 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:11:22 +0000 Subject: [PATCH 29/43] chore(internal): minor options / compat functions updates (#317) --- src/orb/_base_client.py | 12 ++++++------ src/orb/_compat.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 65a22b9f..877fb424 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -880,9 +880,9 @@ def __exit__( def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options def _prepare_request( self, @@ -962,7 +962,7 @@ def _request( input_options = model_copy(options) cast_to = self._maybe_override_cast_to(cast_to, options) - self._prepare_options(options) + options = self._prepare_options(options) retries = self._remaining_retries(remaining_retries, options) request = self._build_request(options) @@ -1456,9 +1456,9 @@ async def __aexit__( async def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options async def _prepare_request( self, @@ -1543,7 +1543,7 @@ async def _request( input_options = model_copy(options) cast_to = self._maybe_override_cast_to(cast_to, options) - await self._prepare_options(options) + options = await self._prepare_options(options) retries = self._remaining_retries(remaining_retries, options) request = self._build_request(options) diff --git a/src/orb/_compat.py b/src/orb/_compat.py index 74c7639b..c919b5ad 100644 --- a/src/orb/_compat.py +++ b/src/orb/_compat.py @@ -118,10 +118,10 @@ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: return model.__fields__ # type: ignore -def model_copy(model: _ModelT) -> _ModelT: +def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: if PYDANTIC_V2: - return model.model_copy() - return model.copy() # type: ignore + return model.model_copy(deep=deep) + return model.copy(deep=deep) # type: ignore def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: From 67d26e4c49d1a0e3b482e660c50ad1bfe99c434f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:21:00 +0000 Subject: [PATCH 30/43] chore(docs): minor update to formatting of API link in README (#318) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3669531..7de75001 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ and offers both synchronous and asynchronous clients powered by [httpx](https:// ## Documentation -The REST API documentation can be found [on docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](api.md). ## Installation From f212cc89ee7b8b783e0fad9fb09d3e772abdf1f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:58:13 +0000 Subject: [PATCH 31/43] chore(internal): update formatting (#319) --- src/orb/types/event_deprecate_response.py | 1 - src/orb/types/event_update_response.py | 1 - src/orb/types/top_level_ping_response.py | 1 - 3 files changed, 3 deletions(-) diff --git a/src/orb/types/event_deprecate_response.py b/src/orb/types/event_deprecate_response.py index 08b4aecb..1ef11446 100644 --- a/src/orb/types/event_deprecate_response.py +++ b/src/orb/types/event_deprecate_response.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel __all__ = ["EventDeprecateResponse"] diff --git a/src/orb/types/event_update_response.py b/src/orb/types/event_update_response.py index aa91fd81..5c79e769 100644 --- a/src/orb/types/event_update_response.py +++ b/src/orb/types/event_update_response.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel __all__ = ["EventUpdateResponse"] diff --git a/src/orb/types/top_level_ping_response.py b/src/orb/types/top_level_ping_response.py index 43ce3b3c..b7ab100c 100644 --- a/src/orb/types/top_level_ping_response.py +++ b/src/orb/types/top_level_ping_response.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel __all__ = ["TopLevelPingResponse"] From 6dc313bc36ba258ae2522b649387ff6f42cee818 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 22:35:27 +0000 Subject: [PATCH 32/43] chore(internal): update formatting (#320) --- src/orb/types/event_deprecate_response.py | 1 + src/orb/types/event_update_response.py | 1 + src/orb/types/top_level_ping_response.py | 1 + 3 files changed, 3 insertions(+) diff --git a/src/orb/types/event_deprecate_response.py b/src/orb/types/event_deprecate_response.py index 1ef11446..08b4aecb 100644 --- a/src/orb/types/event_deprecate_response.py +++ b/src/orb/types/event_deprecate_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from .._models import BaseModel __all__ = ["EventDeprecateResponse"] diff --git a/src/orb/types/event_update_response.py b/src/orb/types/event_update_response.py index 5c79e769..aa91fd81 100644 --- a/src/orb/types/event_update_response.py +++ b/src/orb/types/event_update_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from .._models import BaseModel __all__ = ["EventUpdateResponse"] diff --git a/src/orb/types/top_level_ping_response.py b/src/orb/types/top_level_ping_response.py index b7ab100c..43ce3b3c 100644 --- a/src/orb/types/top_level_ping_response.py +++ b/src/orb/types/top_level_ping_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from .._models import BaseModel __all__ = ["TopLevelPingResponse"] From 0eaba5fe665bf54bd02748587153bb42b080dc2d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:22:36 +0000 Subject: [PATCH 33/43] feat(api): add methods to prices and invoices (#321) --- .stats.yml | 4 +- api.md | 3 + src/orb/resources/invoices.py | 115 +++++++ src/orb/resources/prices/external_price_id.py | 127 +++++++- src/orb/resources/prices/prices.py | 302 +++++++++++++++++- src/orb/types/__init__.py | 2 + src/orb/types/invoice_update_params.py | 17 + src/orb/types/plan_create_params.py | 105 ++++++ src/orb/types/price.py | 144 +++++++++ src/orb/types/price_create_params.py | 126 ++++++++ src/orb/types/price_update_params.py | 17 + src/orb/types/prices/__init__.py | 2 + .../prices/external_price_id_update_params.py | 17 + .../subscription_price_intervals_params.py | 126 ++++++++ .../prices/test_external_price_id.py | 92 ++++++ tests/api_resources/test_invoices.py | 92 ++++++ tests/api_resources/test_plans.py | 2 + tests/api_resources/test_prices.py | 133 +++++++- tests/api_resources/test_subscriptions.py | 6 + 19 files changed, 1427 insertions(+), 5 deletions(-) create mode 100644 src/orb/types/invoice_update_params.py create mode 100644 src/orb/types/price_update_params.py create mode 100644 src/orb/types/prices/external_price_id_update_params.py diff --git a/.stats.yml b/.stats.yml index 3f5becfd..7dadcc65 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-3c64831407a4e2d742e93f5ebf78391c83a2ec833e3026518c91515240294e0b.yml +configured_endpoints: 93 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-36672419987ce3762474f5fe41ded634068ca8780d7e2a835943ff294a88d031.yml diff --git a/api.md b/api.md index e4d5c98d..0c83f194 100644 --- a/api.md +++ b/api.md @@ -227,6 +227,7 @@ from orb.types import Invoice, InvoiceFetchUpcomingResponse Methods: - client.invoices.create(\*\*params) -> Invoice +- client.invoices.update(invoice_id, \*\*params) -> Invoice - client.invoices.list(\*\*params) -> SyncPage[Invoice] - client.invoices.fetch(invoice_id) -> Invoice - client.invoices.fetch_upcoming(\*\*params) -> InvoiceFetchUpcomingResponse @@ -296,6 +297,7 @@ from orb.types import EvaluatePriceGroup, Price, PriceEvaluateResponse Methods: - client.prices.create(\*\*params) -> Price +- client.prices.update(price_id, \*\*params) -> Price - client.prices.list(\*\*params) -> SyncPage[Price] - client.prices.evaluate(price_id, \*\*params) -> PriceEvaluateResponse - client.prices.fetch(price_id) -> Price @@ -304,6 +306,7 @@ Methods: Methods: +- client.prices.external_price_id.update(external_price_id, \*\*params) -> Price - client.prices.external_price_id.fetch(external_price_id) -> Price # Subscriptions diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 7a87a534..85c0ac8c 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -13,6 +13,7 @@ shared_params, invoice_list_params, invoice_create_params, + invoice_update_params, invoice_mark_paid_params, invoice_fetch_upcoming_params, ) @@ -131,6 +132,57 @@ def create( cast_to=Invoice, ) + def update( + self, + invoice_id: str, + *, + 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, + ) -> Invoice: + """This endpoint allows you to update the `metadata` property on an invoice. + + If you + pass null for the metadata value, it will clear any existing metadata for that + invoice. + + `metadata` can be modified regardless of invoice state. + + Args: + 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 + """ + if not invoice_id: + raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}") + return self._put( + f"/invoices/{invoice_id}", + body=maybe_transform({"metadata": metadata}, invoice_update_params.InvoiceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Invoice, + ) + def list( self, *, @@ -546,6 +598,57 @@ async def create( cast_to=Invoice, ) + async def update( + self, + invoice_id: str, + *, + 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, + ) -> Invoice: + """This endpoint allows you to update the `metadata` property on an invoice. + + If you + pass null for the metadata value, it will clear any existing metadata for that + invoice. + + `metadata` can be modified regardless of invoice state. + + Args: + 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 + """ + if not invoice_id: + raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}") + return await self._put( + f"/invoices/{invoice_id}", + body=await async_maybe_transform({"metadata": metadata}, invoice_update_params.InvoiceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Invoice, + ) + def list( self, *, @@ -869,6 +972,9 @@ def __init__(self, invoices: Invoices) -> None: self.create = _legacy_response.to_raw_response_wrapper( invoices.create, ) + self.update = _legacy_response.to_raw_response_wrapper( + invoices.update, + ) self.list = _legacy_response.to_raw_response_wrapper( invoices.list, ) @@ -896,6 +1002,9 @@ def __init__(self, invoices: AsyncInvoices) -> None: self.create = _legacy_response.async_to_raw_response_wrapper( invoices.create, ) + self.update = _legacy_response.async_to_raw_response_wrapper( + invoices.update, + ) self.list = _legacy_response.async_to_raw_response_wrapper( invoices.list, ) @@ -923,6 +1032,9 @@ def __init__(self, invoices: Invoices) -> None: self.create = to_streamed_response_wrapper( invoices.create, ) + self.update = to_streamed_response_wrapper( + invoices.update, + ) self.list = to_streamed_response_wrapper( invoices.list, ) @@ -950,6 +1062,9 @@ def __init__(self, invoices: AsyncInvoices) -> None: self.create = async_to_streamed_response_wrapper( invoices.create, ) + self.update = async_to_streamed_response_wrapper( + invoices.update, + ) self.list = async_to_streamed_response_wrapper( invoices.list, ) diff --git a/src/orb/resources/prices/external_price_id.py b/src/orb/resources/prices/external_price_id.py index f574a6b6..e2ba2682 100644 --- a/src/orb/resources/prices/external_price_id.py +++ b/src/orb/resources/prices/external_price_id.py @@ -2,17 +2,22 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Dict, Optional, cast import httpx from ... import _legacy_response from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ...types.price import Price from ..._base_client import make_request_options +from ...types.prices import external_price_id_update_params __all__ = ["ExternalPriceID", "AsyncExternalPriceID"] @@ -26,6 +31,60 @@ def with_raw_response(self) -> ExternalPriceIDWithRawResponse: def with_streaming_response(self) -> ExternalPriceIDWithStreamingResponse: return ExternalPriceIDWithStreamingResponse(self) + def update( + self, + external_price_id: str, + *, + 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 allows you to update the `metadata` property on a price. + + If you + pass null for the metadata value, it will clear any existing metadata for that + price. + + Args: + 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 + """ + if not external_price_id: + raise ValueError(f"Expected a non-empty value for `external_price_id` but received {external_price_id!r}") + return cast( + Price, + self._put( + f"/prices/external_price_id/{external_price_id}", + body=maybe_transform( + {"metadata": metadata}, external_price_id_update_params.ExternalPriceIDUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=cast(Any, Price), # Union types cannot be passed in as arguments in the type system + ), + ) + def fetch( self, external_price_id: str, @@ -75,6 +134,60 @@ def with_raw_response(self) -> AsyncExternalPriceIDWithRawResponse: def with_streaming_response(self) -> AsyncExternalPriceIDWithStreamingResponse: return AsyncExternalPriceIDWithStreamingResponse(self) + async def update( + self, + external_price_id: str, + *, + 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 allows you to update the `metadata` property on a price. + + If you + pass null for the metadata value, it will clear any existing metadata for that + price. + + Args: + 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 + """ + if not external_price_id: + raise ValueError(f"Expected a non-empty value for `external_price_id` but received {external_price_id!r}") + return cast( + Price, + await self._put( + f"/prices/external_price_id/{external_price_id}", + body=await async_maybe_transform( + {"metadata": metadata}, external_price_id_update_params.ExternalPriceIDUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=cast(Any, Price), # Union types cannot be passed in as arguments in the type system + ), + ) + async def fetch( self, external_price_id: str, @@ -119,6 +232,9 @@ class ExternalPriceIDWithRawResponse: def __init__(self, external_price_id: ExternalPriceID) -> None: self._external_price_id = external_price_id + self.update = _legacy_response.to_raw_response_wrapper( + external_price_id.update, + ) self.fetch = _legacy_response.to_raw_response_wrapper( external_price_id.fetch, ) @@ -128,6 +244,9 @@ class AsyncExternalPriceIDWithRawResponse: def __init__(self, external_price_id: AsyncExternalPriceID) -> None: self._external_price_id = external_price_id + self.update = _legacy_response.async_to_raw_response_wrapper( + external_price_id.update, + ) self.fetch = _legacy_response.async_to_raw_response_wrapper( external_price_id.fetch, ) @@ -137,6 +256,9 @@ class ExternalPriceIDWithStreamingResponse: def __init__(self, external_price_id: ExternalPriceID) -> None: self._external_price_id = external_price_id + self.update = to_streamed_response_wrapper( + external_price_id.update, + ) self.fetch = to_streamed_response_wrapper( external_price_id.fetch, ) @@ -146,6 +268,9 @@ class AsyncExternalPriceIDWithStreamingResponse: def __init__(self, external_price_id: AsyncExternalPriceID) -> None: self._external_price_id = external_price_id + self.update = async_to_streamed_response_wrapper( + external_price_id.update, + ) self.fetch = async_to_streamed_response_wrapper( external_price_id.fetch, ) diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 5050fe02..2b9f3d6f 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -9,7 +9,7 @@ import httpx from ... import _legacy_response -from ...types import price_list_params, price_create_params, price_evaluate_params +from ...types import price_list_params, price_create_params, price_update_params, price_evaluate_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( required_args, @@ -64,6 +64,7 @@ def create( 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, @@ -109,6 +110,10 @@ def create( 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 @@ -137,6 +142,7 @@ def create( 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, @@ -182,6 +188,10 @@ def create( 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 @@ -210,6 +220,7 @@ def create( 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, @@ -255,6 +266,10 @@ def create( 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 @@ -283,6 +298,7 @@ def create( 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, @@ -328,6 +344,10 @@ def create( 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 @@ -356,6 +376,7 @@ def create( 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, @@ -401,6 +422,10 @@ def create( 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 @@ -429,6 +454,7 @@ def create( 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, @@ -474,6 +500,10 @@ def create( 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 @@ -502,6 +532,7 @@ def create( 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, @@ -547,6 +578,10 @@ def create( 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 @@ -575,6 +610,7 @@ def create( 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, @@ -620,6 +656,10 @@ def create( 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 @@ -648,6 +688,7 @@ def create( 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, @@ -693,6 +734,10 @@ def create( 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 @@ -721,6 +766,7 @@ def create( 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, @@ -766,6 +812,10 @@ def create( 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 @@ -794,6 +844,7 @@ def create( 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, @@ -839,6 +890,10 @@ def create( 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 @@ -867,6 +922,7 @@ def create( 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, @@ -912,6 +968,10 @@ def create( 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 @@ -940,6 +1000,7 @@ def create( 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, @@ -985,6 +1046,10 @@ def create( 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 @@ -1013,6 +1078,7 @@ def create( 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, @@ -1058,6 +1124,10 @@ def create( 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 @@ -1086,6 +1156,7 @@ def create( 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, @@ -1131,6 +1202,10 @@ def create( 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 @@ -1159,6 +1234,7 @@ def create( 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, @@ -1204,6 +1280,10 @@ def create( 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 @@ -1232,6 +1312,7 @@ def create( 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, @@ -1277,6 +1358,10 @@ def create( 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 @@ -1305,6 +1390,7 @@ def create( 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, @@ -1350,6 +1436,10 @@ def create( 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 @@ -1414,6 +1504,7 @@ def create( 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, package_config: price_create_params.NewFloatingPackagePricePackageConfig | NotGiven = NOT_GIVEN, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig @@ -1458,6 +1549,7 @@ def create( "external_price_id": external_price_id, "fixed_price_quantity": fixed_price_quantity, "invoice_grouping_key": invoice_grouping_key, + "metadata": metadata, "package_config": package_config, "matrix_config": matrix_config, "matrix_with_allocation_config": matrix_with_allocation_config, @@ -1489,6 +1581,58 @@ def create( ), ) + def update( + self, + price_id: str, + *, + 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 allows you to update the `metadata` property on a price. + + If you + pass null for the metadata value, it will clear any existing metadata for that + price. + + Args: + 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 + """ + if not price_id: + raise ValueError(f"Expected a non-empty value for `price_id` but received {price_id!r}") + return cast( + Price, + self._put( + f"/prices/{price_id}", + body=maybe_transform({"metadata": metadata}, price_update_params.PriceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=cast(Any, Price), # Union types cannot be passed in as arguments in the type system + ), + ) + def list( self, *, @@ -1697,6 +1841,7 @@ async def create( 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, @@ -1742,6 +1887,10 @@ async def create( 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 @@ -1770,6 +1919,7 @@ async def create( 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, @@ -1815,6 +1965,10 @@ async def create( 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 @@ -1843,6 +1997,7 @@ async def create( 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, @@ -1888,6 +2043,10 @@ async def create( 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 @@ -1916,6 +2075,7 @@ async def create( 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, @@ -1961,6 +2121,10 @@ async def create( 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 @@ -1989,6 +2153,7 @@ async def create( 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, @@ -2034,6 +2199,10 @@ async def create( 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 @@ -2062,6 +2231,7 @@ async def create( 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, @@ -2107,6 +2277,10 @@ async def create( 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 @@ -2135,6 +2309,7 @@ async def create( 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, @@ -2180,6 +2355,10 @@ async def create( 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 @@ -2208,6 +2387,7 @@ async def create( 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, @@ -2253,6 +2433,10 @@ async def create( 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 @@ -2281,6 +2465,7 @@ async def create( 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, @@ -2326,6 +2511,10 @@ async def create( 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 @@ -2354,6 +2543,7 @@ async def create( 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, @@ -2399,6 +2589,10 @@ async def create( 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 @@ -2427,6 +2621,7 @@ async def create( 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, @@ -2472,6 +2667,10 @@ async def create( 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 @@ -2500,6 +2699,7 @@ async def create( 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, @@ -2545,6 +2745,10 @@ async def create( 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 @@ -2573,6 +2777,7 @@ async def create( 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, @@ -2618,6 +2823,10 @@ async def create( 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 @@ -2646,6 +2855,7 @@ async def create( 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, @@ -2691,6 +2901,10 @@ async def create( 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 @@ -2719,6 +2933,7 @@ async def create( 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, @@ -2764,6 +2979,10 @@ async def create( 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 @@ -2792,6 +3011,7 @@ async def create( 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, @@ -2837,6 +3057,10 @@ async def create( 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 @@ -2865,6 +3089,7 @@ async def create( 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, @@ -2910,6 +3135,10 @@ async def create( 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 @@ -2938,6 +3167,7 @@ async def create( 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, @@ -2983,6 +3213,10 @@ async def create( 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 @@ -3047,6 +3281,7 @@ async def create( 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, package_config: price_create_params.NewFloatingPackagePricePackageConfig | NotGiven = NOT_GIVEN, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig @@ -3091,6 +3326,7 @@ async def create( "external_price_id": external_price_id, "fixed_price_quantity": fixed_price_quantity, "invoice_grouping_key": invoice_grouping_key, + "metadata": metadata, "package_config": package_config, "matrix_config": matrix_config, "matrix_with_allocation_config": matrix_with_allocation_config, @@ -3122,6 +3358,58 @@ async def create( ), ) + async def update( + self, + price_id: str, + *, + 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 allows you to update the `metadata` property on a price. + + If you + pass null for the metadata value, it will clear any existing metadata for that + price. + + Args: + 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 + """ + if not price_id: + raise ValueError(f"Expected a non-empty value for `price_id` but received {price_id!r}") + return cast( + Price, + await self._put( + f"/prices/{price_id}", + body=await async_maybe_transform({"metadata": metadata}, price_update_params.PriceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=cast(Any, Price), # Union types cannot be passed in as arguments in the type system + ), + ) + def list( self, *, @@ -3308,6 +3596,9 @@ def __init__(self, prices: Prices) -> None: self.create = _legacy_response.to_raw_response_wrapper( prices.create, ) + self.update = _legacy_response.to_raw_response_wrapper( + prices.update, + ) self.list = _legacy_response.to_raw_response_wrapper( prices.list, ) @@ -3330,6 +3621,9 @@ def __init__(self, prices: AsyncPrices) -> None: self.create = _legacy_response.async_to_raw_response_wrapper( prices.create, ) + self.update = _legacy_response.async_to_raw_response_wrapper( + prices.update, + ) self.list = _legacy_response.async_to_raw_response_wrapper( prices.list, ) @@ -3352,6 +3646,9 @@ def __init__(self, prices: Prices) -> None: self.create = to_streamed_response_wrapper( prices.create, ) + self.update = to_streamed_response_wrapper( + prices.update, + ) self.list = to_streamed_response_wrapper( prices.list, ) @@ -3374,6 +3671,9 @@ def __init__(self, prices: AsyncPrices) -> None: self.create = async_to_streamed_response_wrapper( prices.create, ) + self.update = async_to_streamed_response_wrapper( + prices.update, + ) self.list = async_to_streamed_response_wrapper( prices.list, ) diff --git a/src/orb/types/__init__.py b/src/orb/types/__init__.py index f5b4cce4..54dde7e1 100644 --- a/src/orb/types/__init__.py +++ b/src/orb/types/__init__.py @@ -33,6 +33,7 @@ from .event_update_params import EventUpdateParams as EventUpdateParams from .invoice_list_params import InvoiceListParams as InvoiceListParams from .price_create_params import PriceCreateParams as PriceCreateParams +from .price_update_params import PriceUpdateParams as PriceUpdateParams from .coupon_create_params import CouponCreateParams as CouponCreateParams from .customer_list_params import CustomerListParams as CustomerListParams from .evaluate_price_group import EvaluatePriceGroup as EvaluatePriceGroup @@ -42,6 +43,7 @@ from .event_search_response import EventSearchResponse as EventSearchResponse from .event_update_response import EventUpdateResponse as EventUpdateResponse from .invoice_create_params import InvoiceCreateParams as InvoiceCreateParams +from .invoice_update_params import InvoiceUpdateParams as InvoiceUpdateParams from .metric_fetch_response import MetricFetchResponse as MetricFetchResponse from .price_evaluate_params import PriceEvaluateParams as PriceEvaluateParams from .customer_create_params import CustomerCreateParams as CustomerCreateParams diff --git a/src/orb/types/invoice_update_params.py b/src/orb/types/invoice_update_params.py new file mode 100644 index 00000000..e0e5c347 --- /dev/null +++ b/src/orb/types/invoice_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["InvoiceUpdateParams"] + + +class InvoiceUpdateParams(TypedDict, total=False): + 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`. + """ diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index d37a3db0..bb6b1a88 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -134,6 +134,13 @@ class PriceNewPlanUnitPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False): package_amount: Required[str] @@ -194,6 +201,13 @@ class PriceNewPlanPackagePrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] @@ -265,6 +279,13 @@ class PriceNewPlanMatrixPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanTieredPriceTieredConfigTier(TypedDict, total=False): first_unit: Required[float] @@ -329,6 +350,13 @@ class PriceNewPlanTieredPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -399,6 +427,13 @@ class PriceNewPlanTieredBpsPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanBpsPriceBpsConfig(TypedDict, total=False): bps: Required[float] @@ -455,6 +490,13 @@ class PriceNewPlanBpsPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -522,6 +564,13 @@ class PriceNewPlanBulkBpsPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanBulkPriceBulkConfigTier(TypedDict, total=False): unit_amount: Required[str] @@ -583,6 +632,13 @@ class PriceNewPlanBulkPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -631,6 +687,13 @@ class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -679,6 +742,13 @@ class PriceNewPlanTieredPackagePrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -727,6 +797,13 @@ class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -775,6 +852,13 @@ class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -823,6 +907,13 @@ class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -871,6 +962,13 @@ class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): 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`. + """ + class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -919,6 +1017,13 @@ class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False): 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 = Union[ PriceNewPlanUnitPrice, diff --git a/src/orb/types/price.py b/src/orb/types/price.py index d0e1f0a2..d32b7bce 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -208,6 +208,14 @@ class UnitPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[UnitPriceMinimum] = None minimum_amount: Optional[str] = None @@ -300,6 +308,14 @@ class PackagePrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[PackagePriceMinimum] = None minimum_amount: Optional[str] = None @@ -405,6 +421,14 @@ class MatrixPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[MatrixPriceMinimum] = None minimum_amount: Optional[str] = None @@ -499,6 +523,14 @@ class TieredPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredPriceMinimum] = None minimum_amount: Optional[str] = None @@ -601,6 +633,14 @@ class TieredBpsPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredBpsPriceMinimum] = None minimum_amount: Optional[str] = None @@ -691,6 +731,14 @@ class BpsPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[BpsPriceMinimum] = None minimum_amount: Optional[str] = None @@ -790,6 +838,14 @@ class BulkBpsPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[BulkBpsPriceMinimum] = None minimum_amount: Optional[str] = None @@ -883,6 +939,14 @@ class BulkPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[BulkPriceMinimum] = None minimum_amount: Optional[str] = None @@ -961,6 +1025,14 @@ class ThresholdTotalAmountPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[ThresholdTotalAmountPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1041,6 +1113,14 @@ class TieredPackagePrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredPackagePriceMinimum] = None minimum_amount: Optional[str] = None @@ -1123,6 +1203,14 @@ class GroupedTieredPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[GroupedTieredPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1201,6 +1289,14 @@ class TieredWithMinimumPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredWithMinimumPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1281,6 +1377,14 @@ class TieredPackageWithMinimumPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredPackageWithMinimumPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1361,6 +1465,14 @@ class PackageWithAllocationPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[PackageWithAllocationPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1441,6 +1553,14 @@ class UnitWithPercentPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[UnitWithPercentPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1549,6 +1669,14 @@ class MatrixWithAllocationPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[MatrixWithAllocationPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1627,6 +1755,14 @@ class TieredWithProrationPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[TieredWithProrationPriceMinimum] = None minimum_amount: Optional[str] = None @@ -1707,6 +1843,14 @@ class UnitWithProrationPrice(BaseModel): maximum_amount: Optional[str] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + minimum: Optional[UnitWithProrationPriceMinimum] = None minimum_amount: Optional[str] = None diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index e958358e..27357dca 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -87,6 +87,13 @@ class NewFloatingUnitPrice(TypedDict, total=False): 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`. + """ + class NewFloatingUnitPriceUnitConfig(TypedDict, total=False): unit_amount: Required[str] @@ -137,6 +144,13 @@ class NewFloatingPackagePrice(TypedDict, total=False): 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`. + """ + class NewFloatingPackagePricePackageConfig(TypedDict, total=False): package_amount: Required[str] @@ -194,6 +208,13 @@ class NewFloatingMatrixPrice(TypedDict, total=False): 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`. + """ + class NewFloatingMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] @@ -262,6 +283,13 @@ class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): 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`. + """ + class NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] @@ -333,6 +361,13 @@ class NewFloatingTieredPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredPriceTieredConfigTier(TypedDict, total=False): first_unit: Required[float] @@ -394,6 +429,13 @@ class NewFloatingTieredBpsPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -461,6 +503,13 @@ class NewFloatingBpsPrice(TypedDict, total=False): 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`. + """ + class NewFloatingBpsPriceBpsConfig(TypedDict, total=False): bps: Required[float] @@ -514,6 +563,13 @@ class NewFloatingBulkBpsPrice(TypedDict, total=False): 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`. + """ + class NewFloatingBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -578,6 +634,13 @@ class NewFloatingBulkPrice(TypedDict, total=False): 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`. + """ + class NewFloatingBulkPriceBulkConfigTier(TypedDict, total=False): unit_amount: Required[str] @@ -636,6 +699,13 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -681,6 +751,13 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): 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`. + """ + class NewFloatingGroupedTieredPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -726,6 +803,13 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -771,6 +855,13 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): 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`. + """ + class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -816,6 +907,13 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -861,6 +959,13 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): 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`. + """ + class NewFloatingUnitWithPercentPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -906,6 +1011,13 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): 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`. + """ + class NewFloatingTieredWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -951,6 +1063,13 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): 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`. + """ + class NewFloatingUnitWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -996,6 +1115,13 @@ class NewFloatingUnitWithProrationPrice(TypedDict, total=False): 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`. + """ + PriceCreateParams = Union[ NewFloatingUnitPrice, diff --git a/src/orb/types/price_update_params.py b/src/orb/types/price_update_params.py new file mode 100644 index 00000000..d6396a1b --- /dev/null +++ b/src/orb/types/price_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["PriceUpdateParams"] + + +class PriceUpdateParams(TypedDict, total=False): + 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`. + """ diff --git a/src/orb/types/prices/__init__.py b/src/orb/types/prices/__init__.py index f8ee8b14..1c214087 100644 --- a/src/orb/types/prices/__init__.py +++ b/src/orb/types/prices/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .external_price_id_update_params import ExternalPriceIDUpdateParams as ExternalPriceIDUpdateParams diff --git a/src/orb/types/prices/external_price_id_update_params.py b/src/orb/types/prices/external_price_id_update_params.py new file mode 100644 index 00000000..9b431435 --- /dev/null +++ b/src/orb/types/prices/external_price_id_update_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["ExternalPriceIDUpdateParams"] + + +class ExternalPriceIDUpdateParams(TypedDict, total=False): + 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`. + """ diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 47048bbe..a09b9474 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -189,6 +189,13 @@ class AddPriceNewFloatingUnitPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingPackagePricePackageConfig(TypedDict, total=False): package_amount: Required[str] @@ -246,6 +253,13 @@ class AddPriceNewFloatingPackagePrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] @@ -314,6 +328,13 @@ class AddPriceNewFloatingMatrixPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] @@ -385,6 +406,13 @@ class AddPriceNewFloatingMatrixWithAllocationPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredPriceTieredConfigTier(TypedDict, total=False): first_unit: Required[float] @@ -446,6 +474,13 @@ class AddPriceNewFloatingTieredPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -513,6 +548,13 @@ class AddPriceNewFloatingTieredBpsPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingBpsPriceBpsConfig(TypedDict, total=False): bps: Required[float] @@ -566,6 +608,13 @@ class AddPriceNewFloatingBpsPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): bps: Required[float] @@ -630,6 +679,13 @@ class AddPriceNewFloatingBulkBpsPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingBulkPriceBulkConfigTier(TypedDict, total=False): unit_amount: Required[str] @@ -688,6 +744,13 @@ class AddPriceNewFloatingBulkPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -733,6 +796,13 @@ class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -778,6 +848,13 @@ class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -823,6 +900,13 @@ class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -868,6 +952,13 @@ class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -913,6 +1004,13 @@ class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -958,6 +1056,13 @@ class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -1003,6 +1108,13 @@ class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -1048,6 +1160,13 @@ class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): 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`. + """ + class AddPriceNewFloatingUnitWithProrationPrice(TypedDict, total=False): cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] @@ -1093,6 +1212,13 @@ class AddPriceNewFloatingUnitWithProrationPrice(TypedDict, total=False): 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`. + """ + AddPrice = Union[ AddPriceNewFloatingUnitPrice, diff --git a/tests/api_resources/prices/test_external_price_id.py b/tests/api_resources/prices/test_external_price_id.py index b3fa48d8..cfee75ae 100644 --- a/tests/api_resources/prices/test_external_price_id.py +++ b/tests/api_resources/prices/test_external_price_id.py @@ -17,6 +17,52 @@ class TestExternalPriceID: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_update(self, client: Orb) -> None: + external_price_id = client.prices.external_price_id.update( + external_price_id="external_price_id", + ) + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Orb) -> None: + external_price_id = client.prices.external_price_id.update( + external_price_id="external_price_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Orb) -> None: + response = client.prices.external_price_id.with_raw_response.update( + external_price_id="external_price_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_price_id = response.parse() + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Orb) -> None: + with client.prices.external_price_id.with_streaming_response.update( + external_price_id="external_price_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_price_id = response.parse() + assert_matches_type(Price, external_price_id, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Orb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_price_id` but received ''"): + client.prices.external_price_id.with_raw_response.update( + external_price_id="", + ) + @parametrize def test_method_fetch(self, client: Orb) -> None: external_price_id = client.prices.external_price_id.fetch( @@ -59,6 +105,52 @@ def test_path_params_fetch(self, client: Orb) -> None: class TestAsyncExternalPriceID: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + async def test_method_update(self, async_client: AsyncOrb) -> None: + external_price_id = await async_client.prices.external_price_id.update( + external_price_id="external_price_id", + ) + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: + external_price_id = await async_client.prices.external_price_id.update( + external_price_id="external_price_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncOrb) -> None: + response = await async_client.prices.external_price_id.with_raw_response.update( + external_price_id="external_price_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_price_id = response.parse() + assert_matches_type(Price, external_price_id, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: + async with async_client.prices.external_price_id.with_streaming_response.update( + external_price_id="external_price_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_price_id = await response.parse() + assert_matches_type(Price, external_price_id, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncOrb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_price_id` but received ''"): + await async_client.prices.external_price_id.with_raw_response.update( + external_price_id="", + ) + @parametrize async def test_method_fetch(self, async_client: AsyncOrb) -> None: external_price_id = await async_client.prices.external_price_id.fetch( diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 2de0176d..01747b5f 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -195,6 +195,52 @@ def test_streaming_response_create(self, client: Orb) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Orb) -> None: + invoice = client.invoices.update( + invoice_id="invoice_id", + ) + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Orb) -> None: + invoice = client.invoices.update( + invoice_id="invoice_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Orb) -> None: + response = client.invoices.with_raw_response.update( + invoice_id="invoice_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invoice = response.parse() + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Orb) -> None: + with client.invoices.with_streaming_response.update( + invoice_id="invoice_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invoice = response.parse() + assert_matches_type(Invoice, invoice, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Orb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `invoice_id` but received ''"): + client.invoices.with_raw_response.update( + invoice_id="", + ) + @parametrize def test_method_list(self, client: Orb) -> None: invoice = client.invoices.list() @@ -620,6 +666,52 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncOrb) -> None: + invoice = await async_client.invoices.update( + invoice_id="invoice_id", + ) + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: + invoice = await async_client.invoices.update( + invoice_id="invoice_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncOrb) -> None: + response = await async_client.invoices.with_raw_response.update( + invoice_id="invoice_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invoice = response.parse() + assert_matches_type(Invoice, invoice, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: + async with async_client.invoices.with_streaming_response.update( + invoice_id="invoice_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invoice = await response.parse() + assert_matches_type(Invoice, invoice, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncOrb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `invoice_id` but received ''"): + await async_client.invoices.with_raw_response.update( + invoice_id="", + ) + @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: invoice = await async_client.invoices.list() diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 9e247f89..5588af1e 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -43,6 +43,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: name="name", prices=[ { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -260,6 +261,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No name="name", prices=[ { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index eba58c84..3605de89 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -8,7 +8,10 @@ import pytest from orb import Orb, AsyncOrb -from orb.types import Price, PriceEvaluateResponse +from orb.types import ( + Price, + PriceEvaluateResponse, +) from orb._utils import parse_datetime from tests.utils import assert_matches_type from orb.pagination import SyncPage, AsyncPage @@ -46,6 +49,7 @@ def test_method_create_with_all_params_overload_1(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -116,6 +120,7 @@ def test_method_create_with_all_params_overload_2(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -220,6 +225,7 @@ def test_method_create_with_all_params_overload_3(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -354,6 +360,7 @@ def test_method_create_with_all_params_overload_4(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -487,6 +494,7 @@ def test_method_create_with_all_params_overload_5(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -617,6 +625,7 @@ def test_method_create_with_all_params_overload_6(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -714,6 +723,7 @@ def test_method_create_with_all_params_overload_7(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -796,6 +806,7 @@ def test_method_create_with_all_params_overload_8(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -881,6 +892,7 @@ def test_method_create_with_all_params_overload_9(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -957,6 +969,7 @@ def test_method_create_with_all_params_overload_10(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1021,6 +1034,7 @@ def test_method_create_with_all_params_overload_11(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1085,6 +1099,7 @@ def test_method_create_with_all_params_overload_12(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1149,6 +1164,7 @@ def test_method_create_with_all_params_overload_13(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1213,6 +1229,7 @@ def test_method_create_with_all_params_overload_14(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1277,6 +1294,7 @@ def test_method_create_with_all_params_overload_15(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1341,6 +1359,7 @@ def test_method_create_with_all_params_overload_16(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1405,6 +1424,7 @@ def test_method_create_with_all_params_overload_17(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1469,6 +1489,7 @@ def test_method_create_with_all_params_overload_18(self, client: Orb) -> None: external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1506,6 +1527,52 @@ def test_streaming_response_create_overload_18(self, client: Orb) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Orb) -> None: + price = client.prices.update( + price_id="price_id", + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Orb) -> None: + price = client.prices.update( + price_id="price_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Orb) -> None: + response = client.prices.with_raw_response.update( + price_id="price_id", + ) + + 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"]) + + @parametrize + def test_streaming_response_update(self, client: Orb) -> None: + with client.prices.with_streaming_response.update( + price_id="price_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + price = response.parse() + assert_matches_type(Price, price, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Orb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `price_id` but received ''"): + client.prices.with_raw_response.update( + price_id="", + ) + @parametrize def test_method_list(self, client: Orb) -> None: price = client.prices.list() @@ -1667,6 +1734,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1737,6 +1805,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1841,6 +1910,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -1975,6 +2045,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2108,6 +2179,7 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2238,6 +2310,7 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2335,6 +2408,7 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2417,6 +2491,7 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2502,6 +2577,7 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2578,6 +2654,7 @@ async def test_method_create_with_all_params_overload_10(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2642,6 +2719,7 @@ async def test_method_create_with_all_params_overload_11(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2706,6 +2784,7 @@ async def test_method_create_with_all_params_overload_12(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2770,6 +2849,7 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2834,6 +2914,7 @@ async def test_method_create_with_all_params_overload_14(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2898,6 +2979,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -2962,6 +3044,7 @@ async def test_method_create_with_all_params_overload_16(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -3026,6 +3109,7 @@ async def test_method_create_with_all_params_overload_17(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -3090,6 +3174,7 @@ async def test_method_create_with_all_params_overload_18(self, async_client: Asy external_price_id="external_price_id", fixed_price_quantity=0, invoice_grouping_key="invoice_grouping_key", + metadata={"foo": "string"}, ) assert_matches_type(Price, price, path=["response"]) @@ -3127,6 +3212,52 @@ async def test_streaming_response_create_overload_18(self, async_client: AsyncOr assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncOrb) -> None: + price = await async_client.prices.update( + price_id="price_id", + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: + price = await async_client.prices.update( + price_id="price_id", + metadata={"foo": "string"}, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncOrb) -> None: + response = await async_client.prices.with_raw_response.update( + price_id="price_id", + ) + + 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"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: + async with async_client.prices.with_streaming_response.update( + price_id="price_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + price = await response.parse() + assert_matches_type(Price, price, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncOrb) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `price_id` but received ''"): + await async_client.prices.with_raw_response.update( + price_id="", + ) + @parametrize async def test_method_list(self, async_client: AsyncOrb) -> None: price = await async_client.prices.list() diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index b38be425..0f730378 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -488,6 +488,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -544,6 +545,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -600,6 +602,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -1603,6 +1606,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -1659,6 +1663,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", @@ -1715,6 +1720,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "price_id": "h74gfhdjvn7ujokd", "external_price_id": "external_price_id", "price": { + "metadata": {"foo": "string"}, "external_price_id": "external_price_id", "name": "Annual fee", "billable_metric_id": "billable_metric_id", From 30320ae1074928dc95ee1e23ed6aea8bf47759fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:54:52 +0000 Subject: [PATCH 34/43] chore(docs): document how to do per-request http client customization (#322) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7de75001..9a057c6e 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,12 @@ client = Orb( ) ``` +You can also customize the client on a per-request basis by using `with_options()`: + +```python +client.with_options(http_client=DefaultHttpxClient(...)) +``` + ### Managing HTTP resources By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. From fdf2291d68f4d0e119ff8ae4c6022f2ed95ca071 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:27:27 +0000 Subject: [PATCH 35/43] chore(ci): limit release doctor target branches (#323) --- .github/workflows/release-doctor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 6aaaeff8..34250833 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,6 +1,8 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: jobs: From 47e954df9d22f1b9cef2883b72479bd10a6a6b69 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:37:21 +0000 Subject: [PATCH 36/43] docs(readme): fix example snippet imports (#324) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a057c6e..3936ac2c 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ List methods in the Orb API are paginated. This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: ```python -import orb +from orb import Orb client = Orb() @@ -102,7 +102,7 @@ Or, asynchronously: ```python import asyncio -import orb +from orb import AsyncOrb client = AsyncOrb() From a26627c3b271916424bdd72b4087a51e3b36fc72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:36:14 +0000 Subject: [PATCH 37/43] chore(tests): update prism version (#325) --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index fe89a1d0..f5861576 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" fi From 4993ac4368cfe41249931e45aa7b030c0dceddce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:57:39 +0000 Subject: [PATCH 38/43] chore: fix error message import example (#326) --- src/orb/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 877fb424..859bc01f 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -364,7 +364,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `orb-billing.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `orb.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: From e1df500b8f268eef2a0a8d65851ce903919f8bd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:19:06 +0000 Subject: [PATCH 39/43] feat(api): add cadence enum value 'custom' (#327) --- .stats.yml | 2 +- src/orb/types/price.py | 36 +++++++++---------- .../subscription_price_intervals_params.py | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7dadcc65..70f3e6e9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 93 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-36672419987ce3762474f5fe41ded634068ca8780d7e2a835943ff294a88d031.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-e620baef7c2e237e0f03f462c688ba7bb1215d6481139b56b0074b6022d0ce6e.yml diff --git a/src/orb/types/price.py b/src/orb/types/price.py index d32b7bce..38ea6f2f 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -186,7 +186,7 @@ class UnitPrice(BaseModel): billable_metric: Optional[UnitPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -286,7 +286,7 @@ class PackagePrice(BaseModel): billable_metric: Optional[PackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -397,7 +397,7 @@ class MatrixPrice(BaseModel): billable_metric: Optional[MatrixPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -501,7 +501,7 @@ class TieredPrice(BaseModel): billable_metric: Optional[TieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -611,7 +611,7 @@ class TieredBpsPrice(BaseModel): billable_metric: Optional[TieredBpsPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -709,7 +709,7 @@ class BpsPrice(BaseModel): bps_config: BpsPriceBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -816,7 +816,7 @@ class BulkBpsPrice(BaseModel): bulk_bps_config: BulkBpsPriceBulkBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -917,7 +917,7 @@ class BulkPrice(BaseModel): bulk_config: BulkPriceBulkConfig - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1003,7 +1003,7 @@ class ThresholdTotalAmountPrice(BaseModel): billable_metric: Optional[ThresholdTotalAmountPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1091,7 +1091,7 @@ class TieredPackagePrice(BaseModel): billable_metric: Optional[TieredPackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1179,7 +1179,7 @@ class GroupedTieredPrice(BaseModel): billable_metric: Optional[GroupedTieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1267,7 +1267,7 @@ class TieredWithMinimumPrice(BaseModel): billable_metric: Optional[TieredWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1355,7 +1355,7 @@ class TieredPackageWithMinimumPrice(BaseModel): billable_metric: Optional[TieredPackageWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1443,7 +1443,7 @@ class PackageWithAllocationPrice(BaseModel): billable_metric: Optional[PackageWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1531,7 +1531,7 @@ class UnitWithPercentPrice(BaseModel): billable_metric: Optional[UnitWithPercentPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1645,7 +1645,7 @@ class MatrixWithAllocationPrice(BaseModel): billable_metric: Optional[MatrixWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1733,7 +1733,7 @@ class TieredWithProrationPrice(BaseModel): billable_metric: Optional[TieredWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1821,7 +1821,7 @@ class UnitWithProrationPrice(BaseModel): billable_metric: Optional[UnitWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index a09b9474..84e7ab85 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -82,7 +82,7 @@ class AddAllocationPrice(TypedDict, total=False): amount: Required[str] """An amount of the currency to allocate to the customer at the specified cadence.""" - cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"]] + cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"]] """The cadence at which to allocate the amount to the customer.""" currency: Required[str] From 60940163e63ef9798cfb7f177088892933000844 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:58:37 +0000 Subject: [PATCH 40/43] chore(internal): add type construction helper (#328) --- src/orb/_models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/orb/_models.py b/src/orb/_models.py index eb7ce3bd..5148d5a7 100644 --- a/src/orb/_models.py +++ b/src/orb/_models.py @@ -406,6 +406,15 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. From 1cc12f133f42ef99910ed4bf5f8e7bf0b42ab34e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:45:01 +0000 Subject: [PATCH 41/43] feat(api): deprecate methods 'customers.usage.create' and 'customers.usage.update_by_external_id' (#329) Please use the 'events.backfills.create' instead. See https://docs.withorb.com/reference/create-backfill for more details. --- src/orb/resources/customers/usage.py | 61 +- tests/api_resources/customers/test_usage.py | 830 ++++++++++---------- 2 files changed, 475 insertions(+), 416 deletions(-) diff --git a/src/orb/resources/customers/usage.py b/src/orb/resources/customers/usage.py index 7c0dab35..269c6104 100644 --- a/src/orb/resources/customers/usage.py +++ b/src/orb/resources/customers/usage.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Union, Iterable from datetime import datetime @@ -33,6 +34,9 @@ def with_raw_response(self) -> UsageWithRawResponse: def with_streaming_response(self) -> UsageWithStreamingResponse: return UsageWithStreamingResponse(self) + @typing_extensions.deprecated( + "This method will be removed in a future release. Please use the 'events.backfills.create' instead." + ) def update( self, id: str, @@ -186,6 +190,9 @@ def update( cast_to=UsageUpdateResponse, ) + @typing_extensions.deprecated( + "This method will be removed in a future release. Please use the 'events.backfills.create' instead." + ) def update_by_external_id( self, id: str, @@ -349,6 +356,9 @@ def with_raw_response(self) -> AsyncUsageWithRawResponse: def with_streaming_response(self) -> AsyncUsageWithStreamingResponse: return AsyncUsageWithStreamingResponse(self) + @typing_extensions.deprecated( + "This method will be removed in a future release. Please use the 'events.backfills.create' instead." + ) async def update( self, id: str, @@ -502,6 +512,9 @@ async def update( cast_to=UsageUpdateResponse, ) + @typing_extensions.deprecated( + "This method will be removed in a future release. Please use the 'events.backfills.create' instead." + ) async def update_by_external_id( self, id: str, @@ -662,11 +675,15 @@ class UsageWithRawResponse: def __init__(self, usage: Usage) -> None: self._usage = usage - self.update = _legacy_response.to_raw_response_wrapper( - usage.update, + self.update = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + usage.update # pyright: ignore[reportDeprecated], + ) ) - self.update_by_external_id = _legacy_response.to_raw_response_wrapper( - usage.update_by_external_id, + self.update_by_external_id = ( # pyright: ignore[reportDeprecated] + _legacy_response.to_raw_response_wrapper( + usage.update_by_external_id # pyright: ignore[reportDeprecated], + ) ) @@ -674,11 +691,15 @@ class AsyncUsageWithRawResponse: def __init__(self, usage: AsyncUsage) -> None: self._usage = usage - self.update = _legacy_response.async_to_raw_response_wrapper( - usage.update, + self.update = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + usage.update # pyright: ignore[reportDeprecated], + ) ) - self.update_by_external_id = _legacy_response.async_to_raw_response_wrapper( - usage.update_by_external_id, + self.update_by_external_id = ( # pyright: ignore[reportDeprecated] + _legacy_response.async_to_raw_response_wrapper( + usage.update_by_external_id # pyright: ignore[reportDeprecated], + ) ) @@ -686,11 +707,15 @@ class UsageWithStreamingResponse: def __init__(self, usage: Usage) -> None: self._usage = usage - self.update = to_streamed_response_wrapper( - usage.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + usage.update # pyright: ignore[reportDeprecated], + ) ) - self.update_by_external_id = to_streamed_response_wrapper( - usage.update_by_external_id, + self.update_by_external_id = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + usage.update_by_external_id # pyright: ignore[reportDeprecated], + ) ) @@ -698,9 +723,13 @@ class AsyncUsageWithStreamingResponse: def __init__(self, usage: AsyncUsage) -> None: self._usage = usage - self.update = async_to_streamed_response_wrapper( - usage.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + usage.update # pyright: ignore[reportDeprecated], + ) ) - self.update_by_external_id = async_to_streamed_response_wrapper( - usage.update_by_external_id, + self.update_by_external_id = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + usage.update_by_external_id # pyright: ignore[reportDeprecated], + ) ) diff --git a/tests/api_resources/customers/test_usage.py b/tests/api_resources/customers/test_usage.py index 4d3f7b17..dbb63212 100644 --- a/tests/api_resources/customers/test_usage.py +++ b/tests/api_resources/customers/test_usage.py @@ -15,6 +15,8 @@ UsageUpdateByExternalIDResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,82 +25,87 @@ class TestUsage: @parametrize def test_method_update(self, client: Orb) -> None: - usage = client.customers.usage.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + usage = client.customers.usage.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Orb) -> None: - usage = client.customers.usage.update( - id="customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + with pytest.warns(DeprecationWarning): + usage = client.customers.usage.update( + id="customer_id", + events=[ + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), + timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @parametrize def test_raw_response_update(self, client: Orb) -> None: - response = client.customers.usage.with_raw_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + response = client.customers.usage.with_raw_response.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -107,39 +114,65 @@ def test_raw_response_update(self, client: Orb) -> None: @parametrize def test_streaming_response_update(self, client: Orb) -> None: - with client.customers.usage.with_streaming_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.customers.usage.with_streaming_response.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = response.parse() + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Orb) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.customers.usage.with_raw_response.update( - id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.customers.usage.with_raw_response.update( + id="", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) + + @parametrize + def test_method_update_by_external_id(self, client: Orb) -> None: + with pytest.warns(DeprecationWarning): + usage = client.customers.usage.update_by_external_id( + id="external_customer_id", events=[ { "event_name": "event_name", @@ -159,84 +192,65 @@ def test_path_params_update(self, client: Orb) -> None: ], ) - @parametrize - def test_method_update_by_external_id(self, client: Orb) -> None: - usage = client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @parametrize def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None: - usage = client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + with pytest.warns(DeprecationWarning): + usage = client.customers.usage.update_by_external_id( + id="external_customer_id", + events=[ + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), + timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @parametrize def test_raw_response_update_by_external_id(self, client: Orb) -> None: - response = client.customers.usage.with_raw_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + response = client.customers.usage.with_raw_response.update_by_external_id( + id="external_customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -245,39 +259,9 @@ def test_raw_response_update_by_external_id(self, client: Orb) -> None: @parametrize def test_streaming_response_update_by_external_id(self, client: Orb) -> None: - with client.customers.usage.with_streaming_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update_by_external_id(self, client: Orb) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.customers.usage.with_raw_response.update_by_external_id( - id="", + with pytest.warns(DeprecationWarning): + with client.customers.usage.with_streaming_response.update_by_external_id( + id="external_customer_id", events=[ { "event_name": "event_name", @@ -295,7 +279,39 @@ def test_path_params_update_by_external_id(self, client: Orb) -> None: "properties": {}, }, ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = response.parse() + assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_by_external_id(self, client: Orb) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.customers.usage.with_raw_response.update_by_external_id( + id="", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) class TestAsyncUsage: @@ -303,82 +319,87 @@ class TestAsyncUsage: @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: - usage = await async_client.customers.usage.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + usage = await async_client.customers.usage.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: - usage = await async_client.customers.usage.update( - id="customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + with pytest.warns(DeprecationWarning): + usage = await async_client.customers.usage.update( + id="customer_id", + events=[ + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), + timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: - response = await async_client.customers.usage.with_raw_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + response = await async_client.customers.usage.with_raw_response.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -387,39 +408,65 @@ async def test_raw_response_update(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: - async with async_client.customers.usage.with_streaming_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = await response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.customers.usage.with_streaming_response.update( + id="customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = await response.parse() + assert_matches_type(UsageUpdateResponse, usage, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncOrb) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.customers.usage.with_raw_response.update( - id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.customers.usage.with_raw_response.update( + id="", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) + + @parametrize + async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> None: + with pytest.warns(DeprecationWarning): + usage = await async_client.customers.usage.update_by_external_id( + id="external_customer_id", events=[ { "event_name": "event_name", @@ -439,84 +486,65 @@ async def test_path_params_update(self, async_client: AsyncOrb) -> None: ], ) - @parametrize - async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> None: - usage = await async_client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @parametrize async def test_method_update_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: - usage = await async_client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + with pytest.warns(DeprecationWarning): + usage = await async_client.customers.usage.update_by_external_id( + id="external_customer_id", + events=[ + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "customer_id", + "external_customer_id": "external_customer_id", + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), + timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @parametrize async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) -> None: - response = await async_client.customers.usage.with_raw_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) + with pytest.warns(DeprecationWarning): + response = await async_client.customers.usage.with_raw_response.update_by_external_id( + id="external_customer_id", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -525,39 +553,9 @@ async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) @parametrize async def test_streaming_response_update_by_external_id(self, async_client: AsyncOrb) -> None: - async with async_client.customers.usage.with_streaming_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = await response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.customers.usage.with_raw_response.update_by_external_id( - id="", + with pytest.warns(DeprecationWarning): + async with async_client.customers.usage.with_streaming_response.update_by_external_id( + id="external_customer_id", events=[ { "event_name": "event_name", @@ -575,4 +573,36 @@ async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) - "properties": {}, }, ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = await response.parse() + assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.customers.usage.with_raw_response.update_by_external_id( + id="", + events=[ + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "event_name", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], + ) From 62e5158e1febd96d28081bd2c7faf023a410088d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:20:57 +0000 Subject: [PATCH 42/43] feat(api)!: remove methods 'customers.usage.create' and 'customers.usage.update_by_external_id' (#330) ## Migration The two methods `customers.usage.create` and `customers.usage.update_by_external_id` have been removed from the SDK and the API. Please use 'events.backfills.create' instead. More details for this endpoint can be found at https://docs.withorb.com/reference/create-backfill --- .stats.yml | 4 +- api.md | 13 - src/orb/resources/customers/__init__.py | 14 - src/orb/resources/customers/customers.py | 32 - src/orb/resources/customers/usage.py | 735 ------------------ src/orb/resources/events/events.py | 18 +- src/orb/resources/prices/prices.py | 76 +- src/orb/resources/subscriptions.py | 24 +- src/orb/types/customers/__init__.py | 4 - .../usage_update_by_external_id_params.py | 53 -- .../usage_update_by_external_id_response.py | 21 - .../types/customers/usage_update_params.py | 53 -- .../types/customers/usage_update_response.py | 21 - src/orb/types/plan_create_params.py | 30 +- src/orb/types/price.py | 162 ++++ src/orb/types/price_create_params.py | 36 +- .../types/subscription_fetch_usage_params.py | 13 - .../subscription_price_intervals_params.py | 36 +- ...ubscription_schedule_plan_change_params.py | 7 +- tests/api_resources/customers/test_usage.py | 608 --------------- tests/api_resources/test_subscriptions.py | 8 +- 21 files changed, 276 insertions(+), 1692 deletions(-) delete mode 100644 src/orb/resources/customers/usage.py delete mode 100644 src/orb/types/customers/usage_update_by_external_id_params.py delete mode 100644 src/orb/types/customers/usage_update_by_external_id_response.py delete mode 100644 src/orb/types/customers/usage_update_params.py delete mode 100644 src/orb/types/customers/usage_update_response.py delete mode 100644 tests/api_resources/customers/test_usage.py diff --git a/.stats.yml b/.stats.yml index 70f3e6e9..f069adb9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 93 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-e620baef7c2e237e0f03f462c688ba7bb1215d6481139b56b0074b6022d0ce6e.yml +configured_endpoints: 91 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-83ae433113181f3839cc63db01cc7c815de1fff597a1cbaf8ffda48ba98268c9.yml diff --git a/api.md b/api.md index 0c83f194..a62678a9 100644 --- a/api.md +++ b/api.md @@ -81,19 +81,6 @@ Methods: - client.customers.costs.list(customer_id, \*\*params) -> CostListResponse - client.customers.costs.list_by_external_id(external_customer_id, \*\*params) -> CostListByExternalIDResponse -## Usage - -Types: - -```python -from orb.types.customers import UsageUpdateResponse, UsageUpdateByExternalIDResponse -``` - -Methods: - -- client.customers.usage.update(id, \*\*params) -> UsageUpdateResponse -- client.customers.usage.update_by_external_id(id, \*\*params) -> UsageUpdateByExternalIDResponse - ## Credits Types: diff --git a/src/orb/resources/customers/__init__.py b/src/orb/resources/customers/__init__.py index 4c6ee7aa..ffe4db5c 100644 --- a/src/orb/resources/customers/__init__.py +++ b/src/orb/resources/customers/__init__.py @@ -8,14 +8,6 @@ CostsWithStreamingResponse, AsyncCostsWithStreamingResponse, ) -from .usage import ( - Usage, - AsyncUsage, - UsageWithRawResponse, - AsyncUsageWithRawResponse, - UsageWithStreamingResponse, - AsyncUsageWithStreamingResponse, -) from .credits import ( Credits, AsyncCredits, @@ -48,12 +40,6 @@ "AsyncCostsWithRawResponse", "CostsWithStreamingResponse", "AsyncCostsWithStreamingResponse", - "Usage", - "AsyncUsage", - "UsageWithRawResponse", - "AsyncUsageWithRawResponse", - "UsageWithStreamingResponse", - "AsyncUsageWithStreamingResponse", "Credits", "AsyncCredits", "CreditsWithRawResponse", diff --git a/src/orb/resources/customers/customers.py b/src/orb/resources/customers/customers.py index 5e836780..b8603320 100644 --- a/src/orb/resources/customers/customers.py +++ b/src/orb/resources/customers/customers.py @@ -17,14 +17,6 @@ CostsWithStreamingResponse, AsyncCostsWithStreamingResponse, ) -from .usage import ( - Usage, - AsyncUsage, - UsageWithRawResponse, - AsyncUsageWithRawResponse, - UsageWithStreamingResponse, - AsyncUsageWithStreamingResponse, -) from ...types import ( customer_list_params, customer_create_params, @@ -68,10 +60,6 @@ class Customers(SyncAPIResource): def costs(self) -> Costs: return Costs(self._client) - @cached_property - def usage(self) -> Usage: - return Usage(self._client) - @cached_property def credits(self) -> Credits: return Credits(self._client) @@ -953,10 +941,6 @@ class AsyncCustomers(AsyncAPIResource): def costs(self) -> AsyncCosts: return AsyncCosts(self._client) - @cached_property - def usage(self) -> AsyncUsage: - return AsyncUsage(self._client) - @cached_property def credits(self) -> AsyncCredits: return AsyncCredits(self._client) @@ -1863,10 +1847,6 @@ def __init__(self, customers: Customers) -> None: def costs(self) -> CostsWithRawResponse: return CostsWithRawResponse(self._customers.costs) - @cached_property - def usage(self) -> UsageWithRawResponse: - return UsageWithRawResponse(self._customers.usage) - @cached_property def credits(self) -> CreditsWithRawResponse: return CreditsWithRawResponse(self._customers.credits) @@ -1906,10 +1886,6 @@ def __init__(self, customers: AsyncCustomers) -> None: def costs(self) -> AsyncCostsWithRawResponse: return AsyncCostsWithRawResponse(self._customers.costs) - @cached_property - def usage(self) -> AsyncUsageWithRawResponse: - return AsyncUsageWithRawResponse(self._customers.usage) - @cached_property def credits(self) -> AsyncCreditsWithRawResponse: return AsyncCreditsWithRawResponse(self._customers.credits) @@ -1949,10 +1925,6 @@ def __init__(self, customers: Customers) -> None: def costs(self) -> CostsWithStreamingResponse: return CostsWithStreamingResponse(self._customers.costs) - @cached_property - def usage(self) -> UsageWithStreamingResponse: - return UsageWithStreamingResponse(self._customers.usage) - @cached_property def credits(self) -> CreditsWithStreamingResponse: return CreditsWithStreamingResponse(self._customers.credits) @@ -1992,10 +1964,6 @@ def __init__(self, customers: AsyncCustomers) -> None: def costs(self) -> AsyncCostsWithStreamingResponse: return AsyncCostsWithStreamingResponse(self._customers.costs) - @cached_property - def usage(self) -> AsyncUsageWithStreamingResponse: - return AsyncUsageWithStreamingResponse(self._customers.usage) - @cached_property def credits(self) -> AsyncCreditsWithStreamingResponse: return AsyncCreditsWithStreamingResponse(self._customers.credits) diff --git a/src/orb/resources/customers/usage.py b/src/orb/resources/customers/usage.py deleted file mode 100644 index 269c6104..00000000 --- a/src/orb/resources/customers/usage.py +++ /dev/null @@ -1,735 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import typing_extensions -from typing import Union, Iterable -from datetime import datetime - -import httpx - -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import make_request_options -from ...types.customers import usage_update_params, usage_update_by_external_id_params -from ...types.customers.usage_update_response import UsageUpdateResponse -from ...types.customers.usage_update_by_external_id_response import UsageUpdateByExternalIDResponse - -__all__ = ["Usage", "AsyncUsage"] - - -class Usage(SyncAPIResource): - @cached_property - def with_raw_response(self) -> UsageWithRawResponse: - return UsageWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsageWithStreamingResponse: - return UsageWithStreamingResponse(self) - - @typing_extensions.deprecated( - "This method will be removed in a future release. Please use the 'events.backfills.create' instead." - ) - def update( - self, - id: str, - *, - events: Iterable[usage_update_params.Event], - timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - timeframe_start: Union[str, datetime] | 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, - ) -> UsageUpdateResponse: - """ - This endpoint is used to amend usage within a timeframe for a customer that has - an active subscription. - - This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb - will only use the _new_ events passed in the body of this request as the source - of truth for that timeframe moving forwards. Note that a given time period can - be amended any number of times, so events can be overwritten in subsequent calls - to th is endpoint. - - This is a powerful and audit-safe mechanism to retroactively change usage data - in cases where you need to: - - - decrease historical usage consumption because of degraded service availability - in your systems - - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while retaining the - original time of usage and associated metadata. This amendment API is designed - with two explicit goals: - - 1. Amendments are **always audit-safe**. The amendment process will still retain - original events in the timeframe, though they will be ignored for billing - calculations. For auditing a nd data fidelity purposes, Orb never overwrites - or permanently deletes ingested usage data. - 2. Amendments always preserve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for the - timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important property, Orb prevents _partial event - ingestion_ on this endpoint. - - ## Response semantics - - - Either all events are ingested successfully, or all fail to ingest (returning - a `4xx` or `5xx` response code). - - Any event that fails schema validation will lead to a `4xx` response. In this - case, to maintain data consistency, Orb will not ingest any events and will - also not deprecate existing events in the time period. - - You can assume that the amendment is successful on receipt of a `2xx` - response.While a successful response from this endpoint indicates that the new - events have been ingested, updating usage totals happens asynchronously and - may be delayed by a few minutes. - - As emphasized above, Orb will never show an inconsistent state (e.g. in invoice - previews or dashboards); either it will show the existing state (before the - amendment) or the new state (with new events in the requested timeframe). - - ## Sample request body - - ```json - { - "events": [ - { - "event_name": "payment_processed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - }, - { - "event_name": "payment_failed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - } - ] - } - ``` - - ## Request Validation - - - The `timestamp` of each event reported must fall within the bounds of - `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must - be sent in ISO8601 format with UTC timezone offset. - - Orb **does not accept an `idempotency_key`** with each event in this endpoint, - since the entirety of the event list must be ingested to ensure consistency. - On retryable errors , you should retry the request in its entirety, and assume - that the amendment operation has not succeeded until receipt of a `2xx`. - - - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. - Furthermore, Orb will genera lly validate that the `timeframe_start` and - `timeframe_end` fall within the customer's _current_ subscription billing pe - riod. However, Orb does allow amendments while in the grace period of the - previous billing period; in this instance, the timeframe can start before the - current period. - - ## API Limits - - Note that Orb does not currently enforce a hard rate- limit for API usage or a - maximum request payload size. Similar to the event ingestion API, this API is - architected for h igh-throughput ingestion. It is also safe to - _programmatically_ call this endpoint if your system can automatically dete ct a - need for historical amendment. - - In order to overwrite timeframes with a very large number of events, we suggest - using multiple calls with small adjacent (e.g. every hour) timeframes. - - Args: - events: Events to update - - timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) - - timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will - be updated) - - 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 - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._patch( - f"/customers/{id}/usage", - body=maybe_transform({"events": events}, usage_update_params.UsageUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - query=maybe_transform( - { - "timeframe_end": timeframe_end, - "timeframe_start": timeframe_start, - }, - usage_update_params.UsageUpdateParams, - ), - ), - cast_to=UsageUpdateResponse, - ) - - @typing_extensions.deprecated( - "This method will be removed in a future release. Please use the 'events.backfills.create' instead." - ) - def update_by_external_id( - self, - id: str, - *, - events: Iterable[usage_update_by_external_id_params.Event], - timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - timeframe_start: Union[str, datetime] | 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, - ) -> UsageUpdateByExternalIDResponse: - """ - This endpoint is used to amend usage within a timeframe for a customer that has - an active subscription. - - This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb - will only use the _new_ events passed in the body of this request as the source - of truth for that timeframe moving forwards. Note that a given time period can - be amended any number of times, so events can be overwritten in subsequent calls - to th is endpoint. - - This is a powerful and audit-safe mechanism to retroactively change usage data - in cases where you need to: - - - decrease historical usage consumption because of degraded service availability - in your systems - - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while retaining the - original time of usage and associated metadata. This amendment API is designed - with two explicit goals: - - 1. Amendments are **always audit-safe**. The amendment process will still retain - original events in the timeframe, though they will be ignored for billing - calculations. For auditing a nd data fidelity purposes, Orb never overwrites - or permanently deletes ingested usage data. - 2. Amendments always preserve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for the - timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important property, Orb prevents _partial event - ingestion_ on this endpoint. - - ## Response semantics - - - Either all events are ingested successfully, or all fail to ingest (returning - a `4xx` or `5xx` response code). - - Any event that fails schema validation will lead to a `4xx` response. In this - case, to maintain data consistency, Orb will not ingest any events and will - also not deprecate existing events in the time period. - - You can assume that the amendment is successful on receipt of a `2xx` - response.While a successful response from this endpoint indicates that the new - events have been ingested, updating usage totals happens asynchronously and - may be delayed by a few minutes. - - As emphasized above, Orb will never show an inconsistent state (e.g. in invoice - previews or dashboards); either it will show the existing state (before the - amendment) or the new state (with new events in the requested timeframe). - - ## Sample request body - - ```json - { - "events": [ - { - "event_name": "payment_processed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - }, - { - "event_name": "payment_failed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - } - ] - } - ``` - - ## Request Validation - - - The `timestamp` of each event reported must fall within the bounds of - `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must - be sent in ISO8601 format with UTC timezone offset. - - Orb **does not accept an `idempotency_key`** with each event in this endpoint, - since the entirety of the event list must be ingested to ensure consistency. - On retryable errors , you should retry the request in its entirety, and assume - that the amendment operation has not succeeded until receipt of a `2xx`. - - - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. - Furthermore, Orb will genera lly validate that the `timeframe_start` and - `timeframe_end` fall within the customer's _current_ subscription billing pe - riod. However, Orb does allow amendments while in the grace period of the - previous billing period; in this instance, the timeframe can start before the - current period. - - ## API Limits - - Note that Orb does not currently enforce a hard rate- limit for API usage or a - maximum request payload size. Similar to the event ingestion API, this API is - architected for h igh-throughput ingestion. It is also safe to - _programmatically_ call this endpoint if your system can automatically dete ct a - need for historical amendment. - - In order to overwrite timeframes with a very large number of events, we suggest - using multiple calls with small adjacent (e.g. every hour) timeframes. - - Args: - events: Events to update - - timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) - - timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will - be updated) - - 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 - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._patch( - f"/customers/external_customer_id/{id}/usage", - body=maybe_transform({"events": events}, usage_update_by_external_id_params.UsageUpdateByExternalIDParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - query=maybe_transform( - { - "timeframe_end": timeframe_end, - "timeframe_start": timeframe_start, - }, - usage_update_by_external_id_params.UsageUpdateByExternalIDParams, - ), - ), - cast_to=UsageUpdateByExternalIDResponse, - ) - - -class AsyncUsage(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncUsageWithRawResponse: - return AsyncUsageWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsageWithStreamingResponse: - return AsyncUsageWithStreamingResponse(self) - - @typing_extensions.deprecated( - "This method will be removed in a future release. Please use the 'events.backfills.create' instead." - ) - async def update( - self, - id: str, - *, - events: Iterable[usage_update_params.Event], - timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - timeframe_start: Union[str, datetime] | 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, - ) -> UsageUpdateResponse: - """ - This endpoint is used to amend usage within a timeframe for a customer that has - an active subscription. - - This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb - will only use the _new_ events passed in the body of this request as the source - of truth for that timeframe moving forwards. Note that a given time period can - be amended any number of times, so events can be overwritten in subsequent calls - to th is endpoint. - - This is a powerful and audit-safe mechanism to retroactively change usage data - in cases where you need to: - - - decrease historical usage consumption because of degraded service availability - in your systems - - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while retaining the - original time of usage and associated metadata. This amendment API is designed - with two explicit goals: - - 1. Amendments are **always audit-safe**. The amendment process will still retain - original events in the timeframe, though they will be ignored for billing - calculations. For auditing a nd data fidelity purposes, Orb never overwrites - or permanently deletes ingested usage data. - 2. Amendments always preserve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for the - timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important property, Orb prevents _partial event - ingestion_ on this endpoint. - - ## Response semantics - - - Either all events are ingested successfully, or all fail to ingest (returning - a `4xx` or `5xx` response code). - - Any event that fails schema validation will lead to a `4xx` response. In this - case, to maintain data consistency, Orb will not ingest any events and will - also not deprecate existing events in the time period. - - You can assume that the amendment is successful on receipt of a `2xx` - response.While a successful response from this endpoint indicates that the new - events have been ingested, updating usage totals happens asynchronously and - may be delayed by a few minutes. - - As emphasized above, Orb will never show an inconsistent state (e.g. in invoice - previews or dashboards); either it will show the existing state (before the - amendment) or the new state (with new events in the requested timeframe). - - ## Sample request body - - ```json - { - "events": [ - { - "event_name": "payment_processed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - }, - { - "event_name": "payment_failed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - } - ] - } - ``` - - ## Request Validation - - - The `timestamp` of each event reported must fall within the bounds of - `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must - be sent in ISO8601 format with UTC timezone offset. - - Orb **does not accept an `idempotency_key`** with each event in this endpoint, - since the entirety of the event list must be ingested to ensure consistency. - On retryable errors , you should retry the request in its entirety, and assume - that the amendment operation has not succeeded until receipt of a `2xx`. - - - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. - Furthermore, Orb will genera lly validate that the `timeframe_start` and - `timeframe_end` fall within the customer's _current_ subscription billing pe - riod. However, Orb does allow amendments while in the grace period of the - previous billing period; in this instance, the timeframe can start before the - current period. - - ## API Limits - - Note that Orb does not currently enforce a hard rate- limit for API usage or a - maximum request payload size. Similar to the event ingestion API, this API is - architected for h igh-throughput ingestion. It is also safe to - _programmatically_ call this endpoint if your system can automatically dete ct a - need for historical amendment. - - In order to overwrite timeframes with a very large number of events, we suggest - using multiple calls with small adjacent (e.g. every hour) timeframes. - - Args: - events: Events to update - - timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) - - timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will - be updated) - - 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 - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._patch( - f"/customers/{id}/usage", - body=await async_maybe_transform({"events": events}, usage_update_params.UsageUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - query=await async_maybe_transform( - { - "timeframe_end": timeframe_end, - "timeframe_start": timeframe_start, - }, - usage_update_params.UsageUpdateParams, - ), - ), - cast_to=UsageUpdateResponse, - ) - - @typing_extensions.deprecated( - "This method will be removed in a future release. Please use the 'events.backfills.create' instead." - ) - async def update_by_external_id( - self, - id: str, - *, - events: Iterable[usage_update_by_external_id_params.Event], - timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - timeframe_start: Union[str, datetime] | 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, - ) -> UsageUpdateByExternalIDResponse: - """ - This endpoint is used to amend usage within a timeframe for a customer that has - an active subscription. - - This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb - will only use the _new_ events passed in the body of this request as the source - of truth for that timeframe moving forwards. Note that a given time period can - be amended any number of times, so events can be overwritten in subsequent calls - to th is endpoint. - - This is a powerful and audit-safe mechanism to retroactively change usage data - in cases where you need to: - - - decrease historical usage consumption because of degraded service availability - in your systems - - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while retaining the - original time of usage and associated metadata. This amendment API is designed - with two explicit goals: - - 1. Amendments are **always audit-safe**. The amendment process will still retain - original events in the timeframe, though they will be ignored for billing - calculations. For auditing a nd data fidelity purposes, Orb never overwrites - or permanently deletes ingested usage data. - 2. Amendments always preserve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for the - timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important property, Orb prevents _partial event - ingestion_ on this endpoint. - - ## Response semantics - - - Either all events are ingested successfully, or all fail to ingest (returning - a `4xx` or `5xx` response code). - - Any event that fails schema validation will lead to a `4xx` response. In this - case, to maintain data consistency, Orb will not ingest any events and will - also not deprecate existing events in the time period. - - You can assume that the amendment is successful on receipt of a `2xx` - response.While a successful response from this endpoint indicates that the new - events have been ingested, updating usage totals happens asynchronously and - may be delayed by a few minutes. - - As emphasized above, Orb will never show an inconsistent state (e.g. in invoice - previews or dashboards); either it will show the existing state (before the - amendment) or the new state (with new events in the requested timeframe). - - ## Sample request body - - ```json - { - "events": [ - { - "event_name": "payment_processed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - }, - { - "event_name": "payment_failed", - "timestamp": "2022-03-24T07:15:00Z", - "properties": { - "amount": 100 - } - } - ] - } - ``` - - ## Request Validation - - - The `timestamp` of each event reported must fall within the bounds of - `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must - be sent in ISO8601 format with UTC timezone offset. - - Orb **does not accept an `idempotency_key`** with each event in this endpoint, - since the entirety of the event list must be ingested to ensure consistency. - On retryable errors , you should retry the request in its entirety, and assume - that the amendment operation has not succeeded until receipt of a `2xx`. - - - Both `timeframe_start` and `timeframe_end` must be timestamps in the past. - Furthermore, Orb will genera lly validate that the `timeframe_start` and - `timeframe_end` fall within the customer's _current_ subscription billing pe - riod. However, Orb does allow amendments while in the grace period of the - previous billing period; in this instance, the timeframe can start before the - current period. - - ## API Limits - - Note that Orb does not currently enforce a hard rate- limit for API usage or a - maximum request payload size. Similar to the event ingestion API, this API is - architected for h igh-throughput ingestion. It is also safe to - _programmatically_ call this endpoint if your system can automatically dete ct a - need for historical amendment. - - In order to overwrite timeframes with a very large number of events, we suggest - using multiple calls with small adjacent (e.g. every hour) timeframes. - - Args: - events: Events to update - - timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) - - timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will - be updated) - - 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 - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._patch( - f"/customers/external_customer_id/{id}/usage", - body=await async_maybe_transform( - {"events": events}, usage_update_by_external_id_params.UsageUpdateByExternalIDParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - query=await async_maybe_transform( - { - "timeframe_end": timeframe_end, - "timeframe_start": timeframe_start, - }, - usage_update_by_external_id_params.UsageUpdateByExternalIDParams, - ), - ), - cast_to=UsageUpdateByExternalIDResponse, - ) - - -class UsageWithRawResponse: - def __init__(self, usage: Usage) -> None: - self._usage = usage - - self.update = ( # pyright: ignore[reportDeprecated] - _legacy_response.to_raw_response_wrapper( - usage.update # pyright: ignore[reportDeprecated], - ) - ) - self.update_by_external_id = ( # pyright: ignore[reportDeprecated] - _legacy_response.to_raw_response_wrapper( - usage.update_by_external_id # pyright: ignore[reportDeprecated], - ) - ) - - -class AsyncUsageWithRawResponse: - def __init__(self, usage: AsyncUsage) -> None: - self._usage = usage - - self.update = ( # pyright: ignore[reportDeprecated] - _legacy_response.async_to_raw_response_wrapper( - usage.update # pyright: ignore[reportDeprecated], - ) - ) - self.update_by_external_id = ( # pyright: ignore[reportDeprecated] - _legacy_response.async_to_raw_response_wrapper( - usage.update_by_external_id # pyright: ignore[reportDeprecated], - ) - ) - - -class UsageWithStreamingResponse: - def __init__(self, usage: Usage) -> None: - self._usage = usage - - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - usage.update # pyright: ignore[reportDeprecated], - ) - ) - self.update_by_external_id = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - usage.update_by_external_id # pyright: ignore[reportDeprecated], - ) - ) - - -class AsyncUsageWithStreamingResponse: - def __init__(self, usage: AsyncUsage) -> None: - self._usage = usage - - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - usage.update # pyright: ignore[reportDeprecated], - ) - ) - self.update_by_external_id = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - usage.update_by_external_id # pyright: ignore[reportDeprecated], - ) - ) diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index 738dfb26..ae719e3e 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -72,8 +72,7 @@ def update( This endpoint will mark the existing event as ignored, and Orb will only use the new event passed in the body of this request as the source of truth for that `event_id`. Note that a single event can be amended any number of times, so the - same event can be overwritten in subsequent calls to this endpoint, or - overwritten using the [Amend customer usage](amend-usage) endpoint. Only a + same event can be overwritten in subsequent calls to this endpoint. Only a single event with a given `event_id` will be considered the source of truth at any given time. @@ -108,6 +107,9 @@ def update( - The event's `timestamp` must fall within the customer's current subscription's billing period, or within the grace period of the customer's current subscription's previous billing period. + - By default, no more than 100 events can be amended for a single customer in a + 100 day period. For higher volume updates, consider using the + [event backfill](create-backfill) endpoint. Args: event_name: A name to meaningfully identify the action or event type. @@ -208,6 +210,9 @@ def deprecate( ingestion request must identify a Customer resource within Orb, even if this event was ingested during the initial integration period. We do not allow deprecating events for customers not in the Orb system. + - By default, no more than 100 events can be deprecated for a single customer in + a 100 day period. For higher volume updates, consider using the + [event backfill](create-backfill) endpoint. Args: extra_headers: Send extra headers @@ -597,8 +602,7 @@ async def update( This endpoint will mark the existing event as ignored, and Orb will only use the new event passed in the body of this request as the source of truth for that `event_id`. Note that a single event can be amended any number of times, so the - same event can be overwritten in subsequent calls to this endpoint, or - overwritten using the [Amend customer usage](amend-usage) endpoint. Only a + same event can be overwritten in subsequent calls to this endpoint. Only a single event with a given `event_id` will be considered the source of truth at any given time. @@ -633,6 +637,9 @@ async def update( - The event's `timestamp` must fall within the customer's current subscription's billing period, or within the grace period of the customer's current subscription's previous billing period. + - By default, no more than 100 events can be amended for a single customer in a + 100 day period. For higher volume updates, consider using the + [event backfill](create-backfill) endpoint. Args: event_name: A name to meaningfully identify the action or event type. @@ -733,6 +740,9 @@ async def deprecate( ingestion request must identify a Customer resource within Orb, even if this event was ingested during the initial integration period. We do not allow deprecating events for customers not in the Orb system. + - By default, no more than 100 events can be deprecated for a single customer in + a 100 day period. For higher volume updates, consider using the + [event backfill](create-backfill) endpoint. Args: extra_headers: Send extra headers diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 2b9f3d6f..bd12131b 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -52,7 +52,7 @@ def with_streaming_response(self) -> PricesWithStreamingResponse: def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit"], @@ -130,7 +130,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["package"], @@ -208,7 +208,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -286,7 +286,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -364,7 +364,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -442,7 +442,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -521,7 +521,7 @@ def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bps"], @@ -599,7 +599,7 @@ def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -677,7 +677,7 @@ def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -754,7 +754,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -832,7 +832,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -910,7 +910,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -988,7 +988,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -1066,7 +1066,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -1144,7 +1144,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -1222,7 +1222,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -1300,7 +1300,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -1378,7 +1378,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -1475,7 +1475,7 @@ def create( def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit"] @@ -1829,7 +1829,7 @@ def with_streaming_response(self) -> AsyncPricesWithStreamingResponse: async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit"], @@ -1907,7 +1907,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["package"], @@ -1985,7 +1985,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -2063,7 +2063,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -2141,7 +2141,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -2219,7 +2219,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -2298,7 +2298,7 @@ async def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bps"], @@ -2376,7 +2376,7 @@ async def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -2454,7 +2454,7 @@ async def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -2531,7 +2531,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -2609,7 +2609,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -2687,7 +2687,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -2765,7 +2765,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -2843,7 +2843,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -2921,7 +2921,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -2999,7 +2999,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -3077,7 +3077,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -3155,7 +3155,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -3252,7 +3252,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], currency: str, item_id: str, model_type: Literal["unit"] diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index 84f46419..c8e9d7a1 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -960,12 +960,10 @@ def fetch_usage( subscription_id: str, *, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, - cursor: Optional[str] | NotGiven = NOT_GIVEN, first_dimension_key: Optional[str] | NotGiven = NOT_GIVEN, first_dimension_value: Optional[str] | NotGiven = NOT_GIVEN, granularity: Optional[Literal["day"]] | NotGiven = NOT_GIVEN, group_by: Optional[str] | NotGiven = NOT_GIVEN, - limit: Optional[int] | NotGiven = NOT_GIVEN, second_dimension_key: Optional[str] | NotGiven = NOT_GIVEN, second_dimension_value: Optional[str] | NotGiven = NOT_GIVEN, timeframe_end: Union[str, datetime, None] | NotGiven = NOT_GIVEN, @@ -1180,16 +1178,10 @@ def fetch_usage( single billable metric. Note that both `group_by` and `billable_metric_id` must be specified together. - cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned - from the initial request. - granularity: This determines the windowing of usage reporting. group_by: Groups per-price usage by the key provided. - limit: If including a `group_by`, the number of groups to fetch data for. Defaults - to 1000. - timeframe_end: Usage returned is exclusive of `timeframe_end`. timeframe_start: Usage returned is inclusive of `timeframe_start`. @@ -1221,12 +1213,10 @@ def fetch_usage( query=maybe_transform( { "billable_metric_id": billable_metric_id, - "cursor": cursor, "first_dimension_key": first_dimension_key, "first_dimension_value": first_dimension_value, "granularity": granularity, "group_by": group_by, - "limit": limit, "second_dimension_key": second_dimension_key, "second_dimension_value": second_dimension_value, "timeframe_end": timeframe_end, @@ -1380,7 +1370,7 @@ def schedule_plan_change( align_billing_with_plan_change_date: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_alignment: Optional[Literal["unchanged", "plan_change_date", "start_of_month"]] | NotGiven = NOT_GIVEN, - change_date: Optional[str] | NotGiven = NOT_GIVEN, + change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, credits_overage_rate: Optional[float] | NotGiven = NOT_GIVEN, external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -2695,12 +2685,10 @@ async def fetch_usage( subscription_id: str, *, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, - cursor: Optional[str] | NotGiven = NOT_GIVEN, first_dimension_key: Optional[str] | NotGiven = NOT_GIVEN, first_dimension_value: Optional[str] | NotGiven = NOT_GIVEN, granularity: Optional[Literal["day"]] | NotGiven = NOT_GIVEN, group_by: Optional[str] | NotGiven = NOT_GIVEN, - limit: Optional[int] | NotGiven = NOT_GIVEN, second_dimension_key: Optional[str] | NotGiven = NOT_GIVEN, second_dimension_value: Optional[str] | NotGiven = NOT_GIVEN, timeframe_end: Union[str, datetime, None] | NotGiven = NOT_GIVEN, @@ -2915,16 +2903,10 @@ async def fetch_usage( single billable metric. Note that both `group_by` and `billable_metric_id` must be specified together. - cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned - from the initial request. - granularity: This determines the windowing of usage reporting. group_by: Groups per-price usage by the key provided. - limit: If including a `group_by`, the number of groups to fetch data for. Defaults - to 1000. - timeframe_end: Usage returned is exclusive of `timeframe_end`. timeframe_start: Usage returned is inclusive of `timeframe_start`. @@ -2956,12 +2938,10 @@ async def fetch_usage( query=await async_maybe_transform( { "billable_metric_id": billable_metric_id, - "cursor": cursor, "first_dimension_key": first_dimension_key, "first_dimension_value": first_dimension_value, "granularity": granularity, "group_by": group_by, - "limit": limit, "second_dimension_key": second_dimension_key, "second_dimension_value": second_dimension_value, "timeframe_end": timeframe_end, @@ -3115,7 +3095,7 @@ async def schedule_plan_change( align_billing_with_plan_change_date: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_alignment: Optional[Literal["unchanged", "plan_change_date", "start_of_month"]] | NotGiven = NOT_GIVEN, - change_date: Optional[str] | NotGiven = NOT_GIVEN, + change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, credits_overage_rate: Optional[float] | NotGiven = NOT_GIVEN, external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, diff --git a/src/orb/types/customers/__init__.py b/src/orb/types/customers/__init__.py index c144cc46..ba43a9b2 100644 --- a/src/orb/types/customers/__init__.py +++ b/src/orb/types/customers/__init__.py @@ -5,16 +5,12 @@ from .cost_list_params import CostListParams as CostListParams from .cost_list_response import CostListResponse as CostListResponse from .credit_list_params import CreditListParams as CreditListParams -from .usage_update_params import UsageUpdateParams as UsageUpdateParams from .credit_list_response import CreditListResponse as CreditListResponse -from .usage_update_response import UsageUpdateResponse as UsageUpdateResponse from .balance_transaction_list_params import BalanceTransactionListParams as BalanceTransactionListParams from .cost_list_by_external_id_params import CostListByExternalIDParams as CostListByExternalIDParams from .balance_transaction_create_params import BalanceTransactionCreateParams as BalanceTransactionCreateParams from .balance_transaction_list_response import BalanceTransactionListResponse as BalanceTransactionListResponse from .cost_list_by_external_id_response import CostListByExternalIDResponse as CostListByExternalIDResponse from .credit_list_by_external_id_params import CreditListByExternalIDParams as CreditListByExternalIDParams -from .usage_update_by_external_id_params import UsageUpdateByExternalIDParams as UsageUpdateByExternalIDParams from .balance_transaction_create_response import BalanceTransactionCreateResponse as BalanceTransactionCreateResponse from .credit_list_by_external_id_response import CreditListByExternalIDResponse as CreditListByExternalIDResponse -from .usage_update_by_external_id_response import UsageUpdateByExternalIDResponse as UsageUpdateByExternalIDResponse diff --git a/src/orb/types/customers/usage_update_by_external_id_params.py b/src/orb/types/customers/usage_update_by_external_id_params.py deleted file mode 100644 index 8458d6fd..00000000 --- a/src/orb/types/customers/usage_update_by_external_id_params.py +++ /dev/null @@ -1,53 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["UsageUpdateByExternalIDParams", "Event"] - - -class UsageUpdateByExternalIDParams(TypedDict, total=False): - events: Required[Iterable[Event]] - """Events to update""" - - timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is exclusive (i.e. events before this timestamp will be updated)""" - - timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is inclusive (i.e. - - events with this timestamp onward, inclusive will be updated) - """ - - -class Event(TypedDict, total=False): - event_name: Required[str] - """A name to meaningfully identify the action or event type.""" - - properties: Required[object] - """A dictionary of custom properties. - - Values in this dictionary must be numeric, boolean, or strings. Nested - dictionaries are disallowed. - """ - - timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """An ISO 8601 format date with no timezone offset (i.e. - - UTC). This should represent the time that usage was recorded, and is - particularly important to attribute usage to a given billing period. - """ - - customer_id: Optional[str] - """The Orb Customer identifier""" - - external_customer_id: Optional[str] - """ - An alias for the Orb customer, whose mapping is specified when creating the - customer - """ diff --git a/src/orb/types/customers/usage_update_by_external_id_response.py b/src/orb/types/customers/usage_update_by_external_id_response.py deleted file mode 100644 index 62e93cfa..00000000 --- a/src/orb/types/customers/usage_update_by_external_id_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["UsageUpdateByExternalIDResponse"] - - -class UsageUpdateByExternalIDResponse(BaseModel): - duplicate: List[str] - """ - An array of strings, corresponding to idempotency_key's marked as duplicates - (previously ingested) - """ - - ingested: List[str] - """ - An array of strings, corresponding to idempotency_key's which were successfully - ingested. - """ diff --git a/src/orb/types/customers/usage_update_params.py b/src/orb/types/customers/usage_update_params.py deleted file mode 100644 index b664e189..00000000 --- a/src/orb/types/customers/usage_update_params.py +++ /dev/null @@ -1,53 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["UsageUpdateParams", "Event"] - - -class UsageUpdateParams(TypedDict, total=False): - events: Required[Iterable[Event]] - """Events to update""" - - timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is exclusive (i.e. events before this timestamp will be updated)""" - - timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is inclusive (i.e. - - events with this timestamp onward, inclusive will be updated) - """ - - -class Event(TypedDict, total=False): - event_name: Required[str] - """A name to meaningfully identify the action or event type.""" - - properties: Required[object] - """A dictionary of custom properties. - - Values in this dictionary must be numeric, boolean, or strings. Nested - dictionaries are disallowed. - """ - - timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """An ISO 8601 format date with no timezone offset (i.e. - - UTC). This should represent the time that usage was recorded, and is - particularly important to attribute usage to a given billing period. - """ - - customer_id: Optional[str] - """The Orb Customer identifier""" - - external_customer_id: Optional[str] - """ - An alias for the Orb customer, whose mapping is specified when creating the - customer - """ diff --git a/src/orb/types/customers/usage_update_response.py b/src/orb/types/customers/usage_update_response.py deleted file mode 100644 index fdc2f023..00000000 --- a/src/orb/types/customers/usage_update_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["UsageUpdateResponse"] - - -class UsageUpdateResponse(BaseModel): - duplicate: List[str] - """ - An array of strings, corresponding to idempotency_key's marked as duplicates - (previously ingested) - """ - - ingested: List[str] - """ - An array of strings, corresponding to idempotency_key's which were successfully - ingested. - """ diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index bb6b1a88..6aa80bd3 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -88,7 +88,7 @@ class PriceNewPlanUnitPriceUnitConfig(TypedDict, total=False): class PriceNewPlanUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -155,7 +155,7 @@ class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False): class PriceNewPlanPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -233,7 +233,7 @@ class PriceNewPlanMatrixPriceMatrixConfig(TypedDict, total=False): class PriceNewPlanMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -304,7 +304,7 @@ class PriceNewPlanTieredPriceTieredConfig(TypedDict, total=False): class PriceNewPlanTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -381,7 +381,7 @@ class PriceNewPlanTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class PriceNewPlanTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -446,7 +446,7 @@ class PriceNewPlanBpsPriceBpsConfig(TypedDict, total=False): class PriceNewPlanBpsPrice(TypedDict, total=False): bps_config: Required[PriceNewPlanBpsPriceBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -520,7 +520,7 @@ class PriceNewPlanBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class PriceNewPlanBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[PriceNewPlanBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -588,7 +588,7 @@ class PriceNewPlanBulkPriceBulkConfig(TypedDict, total=False): class PriceNewPlanBulkPrice(TypedDict, total=False): bulk_config: Required[PriceNewPlanBulkPriceBulkConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -641,7 +641,7 @@ class PriceNewPlanBulkPrice(TypedDict, total=False): class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -696,7 +696,7 @@ class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): class PriceNewPlanTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -751,7 +751,7 @@ class PriceNewPlanTieredPackagePrice(TypedDict, total=False): class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -806,7 +806,7 @@ class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -861,7 +861,7 @@ class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -916,7 +916,7 @@ class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -971,7 +971,7 @@ class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" item_id: Required[str] diff --git a/src/orb/types/price.py b/src/orb/types/price.py index 38ea6f2f..e3cfe232 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -14,6 +14,7 @@ "Price", "UnitPrice", "UnitPriceBillableMetric", + "UnitPriceBillingCycleConfiguration", "UnitPriceCreditAllocation", "UnitPriceItem", "UnitPriceMaximum", @@ -21,6 +22,7 @@ "UnitPriceUnitConfig", "PackagePrice", "PackagePriceBillableMetric", + "PackagePriceBillingCycleConfiguration", "PackagePriceCreditAllocation", "PackagePriceItem", "PackagePriceMaximum", @@ -28,6 +30,7 @@ "PackagePricePackageConfig", "MatrixPrice", "MatrixPriceBillableMetric", + "MatrixPriceBillingCycleConfiguration", "MatrixPriceCreditAllocation", "MatrixPriceItem", "MatrixPriceMatrixConfig", @@ -36,6 +39,7 @@ "MatrixPriceMinimum", "TieredPrice", "TieredPriceBillableMetric", + "TieredPriceBillingCycleConfiguration", "TieredPriceCreditAllocation", "TieredPriceItem", "TieredPriceMaximum", @@ -44,6 +48,7 @@ "TieredPriceTieredConfigTier", "TieredBpsPrice", "TieredBpsPriceBillableMetric", + "TieredBpsPriceBillingCycleConfiguration", "TieredBpsPriceCreditAllocation", "TieredBpsPriceItem", "TieredBpsPriceMaximum", @@ -52,6 +57,7 @@ "TieredBpsPriceTieredBpsConfigTier", "BpsPrice", "BpsPriceBillableMetric", + "BpsPriceBillingCycleConfiguration", "BpsPriceBpsConfig", "BpsPriceCreditAllocation", "BpsPriceItem", @@ -59,6 +65,7 @@ "BpsPriceMinimum", "BulkBpsPrice", "BulkBpsPriceBillableMetric", + "BulkBpsPriceBillingCycleConfiguration", "BulkBpsPriceBulkBpsConfig", "BulkBpsPriceBulkBpsConfigTier", "BulkBpsPriceCreditAllocation", @@ -67,6 +74,7 @@ "BulkBpsPriceMinimum", "BulkPrice", "BulkPriceBillableMetric", + "BulkPriceBillingCycleConfiguration", "BulkPriceBulkConfig", "BulkPriceBulkConfigTier", "BulkPriceCreditAllocation", @@ -75,48 +83,56 @@ "BulkPriceMinimum", "ThresholdTotalAmountPrice", "ThresholdTotalAmountPriceBillableMetric", + "ThresholdTotalAmountPriceBillingCycleConfiguration", "ThresholdTotalAmountPriceCreditAllocation", "ThresholdTotalAmountPriceItem", "ThresholdTotalAmountPriceMaximum", "ThresholdTotalAmountPriceMinimum", "TieredPackagePrice", "TieredPackagePriceBillableMetric", + "TieredPackagePriceBillingCycleConfiguration", "TieredPackagePriceCreditAllocation", "TieredPackagePriceItem", "TieredPackagePriceMaximum", "TieredPackagePriceMinimum", "GroupedTieredPrice", "GroupedTieredPriceBillableMetric", + "GroupedTieredPriceBillingCycleConfiguration", "GroupedTieredPriceCreditAllocation", "GroupedTieredPriceItem", "GroupedTieredPriceMaximum", "GroupedTieredPriceMinimum", "TieredWithMinimumPrice", "TieredWithMinimumPriceBillableMetric", + "TieredWithMinimumPriceBillingCycleConfiguration", "TieredWithMinimumPriceCreditAllocation", "TieredWithMinimumPriceItem", "TieredWithMinimumPriceMaximum", "TieredWithMinimumPriceMinimum", "TieredPackageWithMinimumPrice", "TieredPackageWithMinimumPriceBillableMetric", + "TieredPackageWithMinimumPriceBillingCycleConfiguration", "TieredPackageWithMinimumPriceCreditAllocation", "TieredPackageWithMinimumPriceItem", "TieredPackageWithMinimumPriceMaximum", "TieredPackageWithMinimumPriceMinimum", "PackageWithAllocationPrice", "PackageWithAllocationPriceBillableMetric", + "PackageWithAllocationPriceBillingCycleConfiguration", "PackageWithAllocationPriceCreditAllocation", "PackageWithAllocationPriceItem", "PackageWithAllocationPriceMaximum", "PackageWithAllocationPriceMinimum", "UnitWithPercentPrice", "UnitWithPercentPriceBillableMetric", + "UnitWithPercentPriceBillingCycleConfiguration", "UnitWithPercentPriceCreditAllocation", "UnitWithPercentPriceItem", "UnitWithPercentPriceMaximum", "UnitWithPercentPriceMinimum", "MatrixWithAllocationPrice", "MatrixWithAllocationPriceBillableMetric", + "MatrixWithAllocationPriceBillingCycleConfiguration", "MatrixWithAllocationPriceCreditAllocation", "MatrixWithAllocationPriceItem", "MatrixWithAllocationPriceMatrixWithAllocationConfig", @@ -125,12 +141,14 @@ "MatrixWithAllocationPriceMinimum", "TieredWithProrationPrice", "TieredWithProrationPriceBillableMetric", + "TieredWithProrationPriceBillingCycleConfiguration", "TieredWithProrationPriceCreditAllocation", "TieredWithProrationPriceItem", "TieredWithProrationPriceMaximum", "TieredWithProrationPriceMinimum", "UnitWithProrationPrice", "UnitWithProrationPriceBillableMetric", + "UnitWithProrationPriceBillingCycleConfiguration", "UnitWithProrationPriceCreditAllocation", "UnitWithProrationPriceItem", "UnitWithProrationPriceMaximum", @@ -142,6 +160,12 @@ class UnitPriceBillableMetric(BaseModel): id: str +class UnitPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class UnitPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -186,6 +210,8 @@ class UnitPrice(BaseModel): billable_metric: Optional[UnitPriceBillableMetric] = None + billing_cycle_configuration: Optional[UnitPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -235,6 +261,12 @@ class PackagePriceBillableMetric(BaseModel): id: str +class PackagePriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class PackagePriceCreditAllocation(BaseModel): allows_rollover: bool @@ -286,6 +318,8 @@ class PackagePrice(BaseModel): billable_metric: Optional[PackagePriceBillableMetric] = None + billing_cycle_configuration: Optional[PackagePriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -335,6 +369,12 @@ class MatrixPriceBillableMetric(BaseModel): id: str +class MatrixPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class MatrixPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -397,6 +437,8 @@ class MatrixPrice(BaseModel): billable_metric: Optional[MatrixPriceBillableMetric] = None + billing_cycle_configuration: Optional[MatrixPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -446,6 +488,12 @@ class TieredPriceBillableMetric(BaseModel): id: str +class TieredPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -501,6 +549,8 @@ class TieredPrice(BaseModel): billable_metric: Optional[TieredPriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -550,6 +600,12 @@ class TieredBpsPriceBillableMetric(BaseModel): id: str +class TieredBpsPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredBpsPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -611,6 +667,8 @@ class TieredBpsPrice(BaseModel): billable_metric: Optional[TieredBpsPriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredBpsPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -660,6 +718,12 @@ class BpsPriceBillableMetric(BaseModel): id: str +class BpsPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class BpsPriceBpsConfig(BaseModel): bps: float """Basis point take rate per event""" @@ -707,6 +771,8 @@ class BpsPrice(BaseModel): billable_metric: Optional[BpsPriceBillableMetric] = None + billing_cycle_configuration: Optional[BpsPriceBillingCycleConfiguration] = None + bps_config: BpsPriceBpsConfig cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] @@ -756,6 +822,12 @@ class BulkBpsPriceBillableMetric(BaseModel): id: str +class BulkBpsPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class BulkBpsPriceBulkBpsConfigTier(BaseModel): bps: float """Basis points to rate on""" @@ -814,6 +886,8 @@ class BulkBpsPrice(BaseModel): billable_metric: Optional[BulkBpsPriceBillableMetric] = None + billing_cycle_configuration: Optional[BulkBpsPriceBillingCycleConfiguration] = None + bulk_bps_config: BulkBpsPriceBulkBpsConfig cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] @@ -863,6 +937,12 @@ class BulkPriceBillableMetric(BaseModel): id: str +class BulkPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class BulkPriceBulkConfigTier(BaseModel): unit_amount: str """Amount per unit""" @@ -915,6 +995,8 @@ class BulkPrice(BaseModel): billable_metric: Optional[BulkPriceBillableMetric] = None + billing_cycle_configuration: Optional[BulkPriceBillingCycleConfiguration] = None + bulk_config: BulkPriceBulkConfig cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] @@ -964,6 +1046,12 @@ class ThresholdTotalAmountPriceBillableMetric(BaseModel): id: str +class ThresholdTotalAmountPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class ThresholdTotalAmountPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1003,6 +1091,8 @@ class ThresholdTotalAmountPrice(BaseModel): billable_metric: Optional[ThresholdTotalAmountPriceBillableMetric] = None + billing_cycle_configuration: Optional[ThresholdTotalAmountPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1052,6 +1142,12 @@ class TieredPackagePriceBillableMetric(BaseModel): id: str +class TieredPackagePriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredPackagePriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1091,6 +1187,8 @@ class TieredPackagePrice(BaseModel): billable_metric: Optional[TieredPackagePriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredPackagePriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1140,6 +1238,12 @@ class GroupedTieredPriceBillableMetric(BaseModel): id: str +class GroupedTieredPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class GroupedTieredPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1179,6 +1283,8 @@ class GroupedTieredPrice(BaseModel): billable_metric: Optional[GroupedTieredPriceBillableMetric] = None + billing_cycle_configuration: Optional[GroupedTieredPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1228,6 +1334,12 @@ class TieredWithMinimumPriceBillableMetric(BaseModel): id: str +class TieredWithMinimumPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredWithMinimumPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1267,6 +1379,8 @@ class TieredWithMinimumPrice(BaseModel): billable_metric: Optional[TieredWithMinimumPriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredWithMinimumPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1316,6 +1430,12 @@ class TieredPackageWithMinimumPriceBillableMetric(BaseModel): id: str +class TieredPackageWithMinimumPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredPackageWithMinimumPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1355,6 +1475,8 @@ class TieredPackageWithMinimumPrice(BaseModel): billable_metric: Optional[TieredPackageWithMinimumPriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredPackageWithMinimumPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1404,6 +1526,12 @@ class PackageWithAllocationPriceBillableMetric(BaseModel): id: str +class PackageWithAllocationPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class PackageWithAllocationPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1443,6 +1571,8 @@ class PackageWithAllocationPrice(BaseModel): billable_metric: Optional[PackageWithAllocationPriceBillableMetric] = None + billing_cycle_configuration: Optional[PackageWithAllocationPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1492,6 +1622,12 @@ class UnitWithPercentPriceBillableMetric(BaseModel): id: str +class UnitWithPercentPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class UnitWithPercentPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1531,6 +1667,8 @@ class UnitWithPercentPrice(BaseModel): billable_metric: Optional[UnitWithPercentPriceBillableMetric] = None + billing_cycle_configuration: Optional[UnitWithPercentPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1580,6 +1718,12 @@ class MatrixWithAllocationPriceBillableMetric(BaseModel): id: str +class MatrixWithAllocationPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class MatrixWithAllocationPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1645,6 +1789,8 @@ class MatrixWithAllocationPrice(BaseModel): billable_metric: Optional[MatrixWithAllocationPriceBillableMetric] = None + billing_cycle_configuration: Optional[MatrixWithAllocationPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1694,6 +1840,12 @@ class TieredWithProrationPriceBillableMetric(BaseModel): id: str +class TieredWithProrationPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class TieredWithProrationPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1733,6 +1885,8 @@ class TieredWithProrationPrice(BaseModel): billable_metric: Optional[TieredWithProrationPriceBillableMetric] = None + billing_cycle_configuration: Optional[TieredWithProrationPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None @@ -1782,6 +1936,12 @@ class UnitWithProrationPriceBillableMetric(BaseModel): id: str +class UnitWithProrationPriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + class UnitWithProrationPriceCreditAllocation(BaseModel): allows_rollover: bool @@ -1821,6 +1981,8 @@ class UnitWithProrationPrice(BaseModel): billable_metric: Optional[UnitWithProrationPriceBillableMetric] = None + billing_cycle_configuration: Optional[UnitWithProrationPriceBillingCycleConfiguration] = None + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] conversion_rate: Optional[float] = None diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index 27357dca..fd9f4775 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -44,7 +44,7 @@ class NewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -101,7 +101,7 @@ class NewFloatingUnitPriceUnitConfig(TypedDict, total=False): class NewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -165,7 +165,7 @@ class NewFloatingPackagePricePackageConfig(TypedDict, total=False): class NewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -240,7 +240,7 @@ class NewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -318,7 +318,7 @@ class NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(TypedDict, class NewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -386,7 +386,7 @@ class NewFloatingTieredPriceTieredConfig(TypedDict, total=False): class NewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -462,7 +462,7 @@ class NewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class NewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[NewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -522,7 +522,7 @@ class NewFloatingBpsPriceBpsConfig(TypedDict, total=False): class NewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[NewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -593,7 +593,7 @@ class NewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class NewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[NewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -656,7 +656,7 @@ class NewFloatingBulkPriceBulkConfig(TypedDict, total=False): class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -708,7 +708,7 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class NewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -760,7 +760,7 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): class NewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -812,7 +812,7 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -864,7 +864,7 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -916,7 +916,7 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -968,7 +968,7 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class NewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1020,7 +1020,7 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): class NewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1072,7 +1072,7 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): class NewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] diff --git a/src/orb/types/subscription_fetch_usage_params.py b/src/orb/types/subscription_fetch_usage_params.py index 08c7800f..6728382e 100644 --- a/src/orb/types/subscription_fetch_usage_params.py +++ b/src/orb/types/subscription_fetch_usage_params.py @@ -19,13 +19,6 @@ class SubscriptionFetchUsageParams(TypedDict, total=False): be specified together. """ - cursor: Optional[str] - """Cursor for pagination. - - This can be populated by the `next_cursor` value returned from the initial - request. - """ - first_dimension_key: Optional[str] first_dimension_value: Optional[str] @@ -36,12 +29,6 @@ class SubscriptionFetchUsageParams(TypedDict, total=False): group_by: Optional[str] """Groups per-price usage by the key provided.""" - limit: Optional[int] - """If including a `group_by`, the number of groups to fetch data for. - - Defaults to 1000. - """ - second_dimension_key: Optional[str] second_dimension_value: Optional[str] diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 84e7ab85..b3a746df 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -146,7 +146,7 @@ class AddPriceNewFloatingUnitPriceUnitConfig(TypedDict, total=False): class AddPriceNewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -210,7 +210,7 @@ class AddPriceNewFloatingPackagePricePackageConfig(TypedDict, total=False): class AddPriceNewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -285,7 +285,7 @@ class AddPriceNewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class AddPriceNewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -363,7 +363,7 @@ class AddPriceNewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(Typ class AddPriceNewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -431,7 +431,7 @@ class AddPriceNewFloatingTieredPriceTieredConfig(TypedDict, total=False): class AddPriceNewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -505,7 +505,7 @@ class AddPriceNewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class AddPriceNewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -567,7 +567,7 @@ class AddPriceNewFloatingBpsPriceBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[AddPriceNewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -638,7 +638,7 @@ class AddPriceNewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[AddPriceNewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -703,7 +703,7 @@ class AddPriceNewFloatingBulkPriceBulkConfig(TypedDict, total=False): class AddPriceNewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[AddPriceNewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -753,7 +753,7 @@ class AddPriceNewFloatingBulkPrice(TypedDict, total=False): class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -805,7 +805,7 @@ class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -857,7 +857,7 @@ class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -909,7 +909,7 @@ class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -961,7 +961,7 @@ class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1013,7 +1013,7 @@ class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1065,7 +1065,7 @@ class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1117,7 +1117,7 @@ class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1169,7 +1169,7 @@ class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] """The cadence to bill for this price on.""" currency: Required[str] diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index 978aa861..4e9daa26 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -3,7 +3,10 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, TypedDict +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = [ "SubscriptionSchedulePlanChangeParams", @@ -66,7 +69,7 @@ class SubscriptionSchedulePlanChangeParams(TypedDict, total=False): billing cycle alignment. """ - change_date: Optional[str] + change_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The date that the plan change should take effect. This parameter can only be passed if the `change_option` is `requested_date`. diff --git a/tests/api_resources/customers/test_usage.py b/tests/api_resources/customers/test_usage.py deleted file mode 100644 index dbb63212..00000000 --- a/tests/api_resources/customers/test_usage.py +++ /dev/null @@ -1,608 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from orb import Orb, AsyncOrb -from orb._utils import parse_datetime -from tests.utils import assert_matches_type -from orb.types.customers import ( - UsageUpdateResponse, - UsageUpdateByExternalIDResponse, -) - -# pyright: reportDeprecated=false - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_update(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - usage = client.customers.usage.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - usage = client.customers.usage.update( - id="customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - response = client.customers.usage.with_raw_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage = response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - with client.customers.usage.with_streaming_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.customers.usage.with_raw_response.update( - id="", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - @parametrize - def test_method_update_by_external_id(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - usage = client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - usage = client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - def test_raw_response_update_by_external_id(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - response = client.customers.usage.with_raw_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage = response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - def test_streaming_response_update_by_external_id(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - with client.customers.usage.with_streaming_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update_by_external_id(self, client: Orb) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.customers.usage.with_raw_response.update_by_external_id( - id="", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - -class TestAsyncUsage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_update(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - usage = await async_client.customers.usage.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - usage = await async_client.customers.usage.update( - id="customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.customers.usage.with_raw_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage = response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.customers.usage.with_streaming_response.update( - id="customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = await response.parse() - assert_matches_type(UsageUpdateResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.customers.usage.with_raw_response.update( - id="", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - @parametrize - async def test_method_update_by_external_id(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - usage = await async_client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - async def test_method_update_by_external_id_with_all_params(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - usage = await async_client.customers.usage.update_by_external_id( - id="external_customer_id", - events=[ - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "customer_id": "customer_id", - "external_customer_id": "external_customer_id", - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), - timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - async def test_raw_response_update_by_external_id(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.customers.usage.with_raw_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - usage = response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - @parametrize - async def test_streaming_response_update_by_external_id(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.customers.usage.with_streaming_response.update_by_external_id( - id="external_customer_id", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - usage = await response.parse() - assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.customers.usage.with_raw_response.update_by_external_id( - id="", - events=[ - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - { - "event_name": "event_name", - "timestamp": parse_datetime("2020-12-09T16:09:53Z"), - "properties": {}, - }, - ], - ) diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 0f730378..51b93500 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -422,12 +422,10 @@ def test_method_fetch_usage_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.fetch_usage( subscription_id="subscription_id", billable_metric_id="billable_metric_id", - cursor="cursor", first_dimension_key="first_dimension_key", first_dimension_value="first_dimension_value", granularity="day", group_by="group_by", - limit=0, second_dimension_key="second_dimension_key", second_dimension_value="second_dimension_value", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), @@ -816,7 +814,7 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: change_option="requested_date", align_billing_with_plan_change_date=True, billing_cycle_alignment="unchanged", - change_date="2017-07-21T17:32:28Z", + change_date=parse_datetime("2017-07-21T17:32:28Z"), coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, external_plan_id="ZMwNQefe7J3ecf7W", @@ -1540,12 +1538,10 @@ async def test_method_fetch_usage_with_all_params(self, async_client: AsyncOrb) subscription = await async_client.subscriptions.fetch_usage( subscription_id="subscription_id", billable_metric_id="billable_metric_id", - cursor="cursor", first_dimension_key="first_dimension_key", first_dimension_value="first_dimension_value", granularity="day", group_by="group_by", - limit=0, second_dimension_key="second_dimension_key", second_dimension_value="second_dimension_value", timeframe_end=parse_datetime("2022-03-01T05:00:00Z"), @@ -1934,7 +1930,7 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A change_option="requested_date", align_billing_with_plan_change_date=True, billing_cycle_alignment="unchanged", - change_date="2017-07-21T17:32:28Z", + change_date=parse_datetime("2017-07-21T17:32:28Z"), coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, external_plan_id="ZMwNQefe7J3ecf7W", From 815cd358e8911ae141ca550f6afd618b5b3f0ddd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:21:26 +0000 Subject: [PATCH 43/43] release: 2.0.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 67 +++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/orb/_version.py | 2 +- 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 24b1176f..65f558e7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.56.0" + ".": "2.0.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 484f83ed..abebbc1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,72 @@ # Changelog +## 2.0.0 (2024-08-02) + +Full Changelog: [v1.56.0...v2.0.0](https://github.com/orbcorp/orb-python/compare/v1.56.0...v2.0.0) + +### ⚠ BREAKING CHANGES + +* **api:** remove methods 'customers.usage.create' and 'customers.usage.update_by_external_id' ([#330](https://github.com/orbcorp/orb-python/issues/330)) +* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#297](https://github.com/orbcorp/orb-python/issues/297)) +* **api:** add semi_annual cadence and remove metadata from update items ([#288](https://github.com/orbcorp/orb-python/issues/288)) + +### Features + +* **api:** add 'status' to plan creation params ([#310](https://github.com/orbcorp/orb-python/issues/310)) ([561898f](https://github.com/orbcorp/orb-python/commit/561898f1fa75d83d83f0c1c50d382d04cbaff7d2)) +* **api:** add cadence enum value 'custom' ([#327](https://github.com/orbcorp/orb-python/issues/327)) ([e1df500](https://github.com/orbcorp/orb-python/commit/e1df500b8f268eef2a0a8d65851ce903919f8bd2)) +* **api:** add methods to prices and invoices ([#321](https://github.com/orbcorp/orb-python/issues/321)) ([0eaba5f](https://github.com/orbcorp/orb-python/commit/0eaba5fe665bf54bd02748587153bb42b080dc2d)) +* **api:** add semi_annual cadence and remove metadata from update items ([#288](https://github.com/orbcorp/orb-python/issues/288)) ([4b07848](https://github.com/orbcorp/orb-python/commit/4b07848ecc9d2a4899e20710e121d5cdc984de79)) +* **api:** add support for adding allocation price to subscription ([#295](https://github.com/orbcorp/orb-python/issues/295)) ([7e16ef5](https://github.com/orbcorp/orb-python/commit/7e16ef55cd743b63b0ee8f0a9e45052c610998fb)) +* **api:** add support for query param include_all_blocks ([#301](https://github.com/orbcorp/orb-python/issues/301)) ([1b7b6a3](https://github.com/orbcorp/orb-python/commit/1b7b6a3236226bdd7bf7bd00d041a0c0a99f24bf)) +* **api:** deprecate methods 'customers.usage.create' and 'customers.usage.update_by_external_id' ([#329](https://github.com/orbcorp/orb-python/issues/329)) ([1cc12f1](https://github.com/orbcorp/orb-python/commit/1cc12f133f42ef99910ed4bf5f8e7bf0b42ab34e)) +* **api:** external connections made optional when updating items ([#296](https://github.com/orbcorp/orb-python/issues/296)) ([9076f38](https://github.com/orbcorp/orb-python/commit/9076f38ee750cf1f59d6260befb9931d3f878743)) +* **api:** remove methods 'customers.usage.create' and 'customers.usage.update_by_external_id' ([#330](https://github.com/orbcorp/orb-python/issues/330)) ([62e5158](https://github.com/orbcorp/orb-python/commit/62e5158e1febd96d28081bd2c7faf023a410088d)) +* **api:** updates ([#291](https://github.com/orbcorp/orb-python/issues/291)) ([38aaf34](https://github.com/orbcorp/orb-python/commit/38aaf34361e649e4111f8a4038afe82867c8d4d8)) + + +### Bug Fixes + +* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#297](https://github.com/orbcorp/orb-python/issues/297)) ([cb8992b](https://github.com/orbcorp/orb-python/commit/cb8992bf23e9639a27d885e110966cb01acc3e61)) +* **build:** include more files in sdist builds ([#300](https://github.com/orbcorp/orb-python/issues/300)) ([922476f](https://github.com/orbcorp/orb-python/commit/922476f4690435b72b12c6a06a92108cf9368d1a)) +* **client/async:** avoid blocking io call for platform headers ([#294](https://github.com/orbcorp/orb-python/issues/294)) ([89f4bfe](https://github.com/orbcorp/orb-python/commit/89f4bfe6516912f25d0bbe6e8ecf3343a2e05300)) +* **client:** always respect content-type multipart/form-data if provided ([#308](https://github.com/orbcorp/orb-python/issues/308)) ([9d980df](https://github.com/orbcorp/orb-python/commit/9d980dfe52c7e0a9cfdbd9dbed32540589353d1d)) +* **docs:** fix link to advanced python httpx docs ([#298](https://github.com/orbcorp/orb-python/issues/298)) ([55cff13](https://github.com/orbcorp/orb-python/commit/55cff139e8175d1dce02004c9715a42006bbb11c)) +* temporarily patch upstream version to fix broken release flow ([#299](https://github.com/orbcorp/orb-python/issues/299)) ([b0c95aa](https://github.com/orbcorp/orb-python/commit/b0c95aa994d16c17486bbd999115114174fd2eac)) + + +### Chores + +* **ci:** also run workflows for PRs targeting `next` ([#314](https://github.com/orbcorp/orb-python/issues/314)) ([4fc3bcb](https://github.com/orbcorp/orb-python/commit/4fc3bcb9dc201a36e907a56983cb0cf8498c1f54)) +* **ci:** limit release doctor target branches ([#323](https://github.com/orbcorp/orb-python/issues/323)) ([fdf2291](https://github.com/orbcorp/orb-python/commit/fdf2291d68f4d0e119ff8ae4c6022f2ed95ca071)) +* **ci:** update rye to v0.35.0 ([#309](https://github.com/orbcorp/orb-python/issues/309)) ([540ff37](https://github.com/orbcorp/orb-python/commit/540ff3705d0f986577012bde92cfd2a60c45825d)) +* **deps:** bump anyio to v4.4.0 ([#303](https://github.com/orbcorp/orb-python/issues/303)) ([e02d74d](https://github.com/orbcorp/orb-python/commit/e02d74db5b900a2d7a8a3d3bbdb0356ab78db978)) +* **docs:** document how to do per-request http client customization ([#322](https://github.com/orbcorp/orb-python/issues/322)) ([30320ae](https://github.com/orbcorp/orb-python/commit/30320ae1074928dc95ee1e23ed6aea8bf47759fd)) +* **docs:** improve Coupon description ([#293](https://github.com/orbcorp/orb-python/issues/293)) ([5aa0f32](https://github.com/orbcorp/orb-python/commit/5aa0f328e70673ff0c928bd2b704b1e3822b480c)) +* **docs:** minor update to formatting of API link in README ([#318](https://github.com/orbcorp/orb-python/issues/318)) ([67d26e4](https://github.com/orbcorp/orb-python/commit/67d26e4c49d1a0e3b482e660c50ad1bfe99c434f)) +* **docs:** updates price intervals docs ([#302](https://github.com/orbcorp/orb-python/issues/302)) ([a05b099](https://github.com/orbcorp/orb-python/commit/a05b09901baddddec77db515ae7102dec167014e)) +* fix error message import example ([#326](https://github.com/orbcorp/orb-python/issues/326)) ([4993ac4](https://github.com/orbcorp/orb-python/commit/4993ac4368cfe41249931e45aa7b030c0dceddce)) +* gitignore test server logs ([#305](https://github.com/orbcorp/orb-python/issues/305)) ([9a8b82f](https://github.com/orbcorp/orb-python/commit/9a8b82f869b9bb975920f994b0bf8585196445d4)) +* **internal:** add a `default_query` method ([#292](https://github.com/orbcorp/orb-python/issues/292)) ([8aa1d73](https://github.com/orbcorp/orb-python/commit/8aa1d7356132d6221b32654616669b8fa1aee9f7)) +* **internal:** add helper function ([#312](https://github.com/orbcorp/orb-python/issues/312)) ([3d9704e](https://github.com/orbcorp/orb-python/commit/3d9704eaa3fc9acdd900a0e2357785ac93b18d6a)) +* **internal:** add helper method for constructing `BaseModel`s ([#307](https://github.com/orbcorp/orb-python/issues/307)) ([73a4593](https://github.com/orbcorp/orb-python/commit/73a4593797c5bbca315f6ed846427e388c0445ec)) +* **internal:** add reflection helper function ([#304](https://github.com/orbcorp/orb-python/issues/304)) ([986bd84](https://github.com/orbcorp/orb-python/commit/986bd84dcb22d9413430f578c28a5adccadaacfd)) +* **internal:** add rich as a dev dependency ([#306](https://github.com/orbcorp/orb-python/issues/306)) ([d2a2f3f](https://github.com/orbcorp/orb-python/commit/d2a2f3fe411cb3d57b15c7f3bfd102523def0e8f)) +* **internal:** add type construction helper ([#328](https://github.com/orbcorp/orb-python/issues/328)) ([6094016](https://github.com/orbcorp/orb-python/commit/60940163e63ef9798cfb7f177088892933000844)) +* **internal:** minor import restructuring ([#315](https://github.com/orbcorp/orb-python/issues/315)) ([eeee65e](https://github.com/orbcorp/orb-python/commit/eeee65e7b30438c9133f47f0aa86b35e54878506)) +* **internal:** minor options / compat functions updates ([#317](https://github.com/orbcorp/orb-python/issues/317)) ([2a05873](https://github.com/orbcorp/orb-python/commit/2a05873d80ae4e8bebdbcd2adb7cd1817377cc11)) +* **internal:** minor request options handling changes ([#311](https://github.com/orbcorp/orb-python/issues/311)) ([cfcc3eb](https://github.com/orbcorp/orb-python/commit/cfcc3ebc299a387decd8812879a8ad851dc7d6da)) +* **internal:** update formatting ([#319](https://github.com/orbcorp/orb-python/issues/319)) ([f212cc8](https://github.com/orbcorp/orb-python/commit/f212cc89ee7b8b783e0fad9fb09d3e772abdf1f4)) +* **internal:** update formatting ([#320](https://github.com/orbcorp/orb-python/issues/320)) ([6dc313b](https://github.com/orbcorp/orb-python/commit/6dc313bc36ba258ae2522b649387ff6f42cee818)) +* **internal:** update mypy ([#313](https://github.com/orbcorp/orb-python/issues/313)) ([e98ba62](https://github.com/orbcorp/orb-python/commit/e98ba6215dea14581b1d3b54b570a5f176948003)) +* **tests:** update prism version ([#325](https://github.com/orbcorp/orb-python/issues/325)) ([a26627c](https://github.com/orbcorp/orb-python/commit/a26627c3b271916424bdd72b4087a51e3b36fc72)) + + +### Documentation + +* **examples:** use named params more ([#316](https://github.com/orbcorp/orb-python/issues/316)) ([a451ed6](https://github.com/orbcorp/orb-python/commit/a451ed63406c95767251f976805496a1cf300b5d)) +* **readme:** fix example snippet imports ([#324](https://github.com/orbcorp/orb-python/issues/324)) ([47e954d](https://github.com/orbcorp/orb-python/commit/47e954df9d22f1b9cef2883b72479bd10a6a6b69)) +* small updates ([#290](https://github.com/orbcorp/orb-python/issues/290)) ([4beb928](https://github.com/orbcorp/orb-python/commit/4beb9285099ff26ed8ca6a9f178f34daf87f053f)) + ## 1.56.0 (2024-05-29) Full Changelog: [v1.55.0...v1.56.0](https://github.com/orbcorp/orb-python/compare/v1.55.0...v1.56.0) diff --git a/pyproject.toml b/pyproject.toml index cc964e3c..45592108 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "1.56.0" +version = "2.0.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_version.py b/src/orb/_version.py index 511696b8..72aa4e1e 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "1.56.0" # x-release-please-version +__version__ = "2.0.0" # x-release-please-version