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