diff --git a/.stats.yml b/.stats.yml index 09794c42..c963fb86 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-77f4e8cf0fc3b3f18c894408f322af7988ae90606235fe5058442409142a33e1.yml +configured_endpoints: 101 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-726c25fdf0fdd4b7c5a9c36d30e33990d2a4b63c4260be340400f8ded23b578f.yml diff --git a/api.md b/api.md index c4dc1320..802a1860 100644 --- a/api.md +++ b/api.md @@ -380,3 +380,23 @@ Methods: - client.alerts.create_for_subscription(subscription_id, \*\*params) -> Alert - client.alerts.disable(alert_configuration_id, \*\*params) -> Alert - client.alerts.enable(alert_configuration_id, \*\*params) -> Alert + +# DimensionalPriceGroups + +Types: + +```python +from orb.types import DimensionalPriceGroup, DimensionalPriceGroups +``` + +Methods: + +- client.dimensional_price_groups.create(\*\*params) -> DimensionalPriceGroup +- client.dimensional_price_groups.retrieve(dimensional_price_group_id) -> DimensionalPriceGroup +- client.dimensional_price_groups.list(\*\*params) -> SyncPage[DimensionalPriceGroup] + +## ExternalDimensionalPriceGroupID + +Methods: + +- client.dimensional_price_groups.external_dimensional_price_group_id.retrieve(external_dimensional_price_group_id) -> DimensionalPriceGroup diff --git a/src/orb/_client.py b/src/orb/_client.py index 6f218993..e4a28e6a 100644 --- a/src/orb/_client.py +++ b/src/orb/_client.py @@ -38,6 +38,7 @@ from .resources.prices import prices from .resources.coupons import coupons from .resources.customers import customers +from .resources.dimensional_price_groups import dimensional_price_groups __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Orb", "AsyncOrb", "Client", "AsyncClient"] @@ -56,6 +57,7 @@ class Orb(SyncAPIClient): prices: prices.Prices subscriptions: subscriptions.Subscriptions alerts: alerts.Alerts + dimensional_price_groups: dimensional_price_groups.DimensionalPriceGroups with_raw_response: OrbWithRawResponse with_streaming_response: OrbWithStreamedResponse @@ -136,6 +138,7 @@ def __init__( self.prices = prices.Prices(self) self.subscriptions = subscriptions.Subscriptions(self) self.alerts = alerts.Alerts(self) + self.dimensional_price_groups = dimensional_price_groups.DimensionalPriceGroups(self) self.with_raw_response = OrbWithRawResponse(self) self.with_streaming_response = OrbWithStreamedResponse(self) @@ -308,6 +311,7 @@ class AsyncOrb(AsyncAPIClient): prices: prices.AsyncPrices subscriptions: subscriptions.AsyncSubscriptions alerts: alerts.AsyncAlerts + dimensional_price_groups: dimensional_price_groups.AsyncDimensionalPriceGroups with_raw_response: AsyncOrbWithRawResponse with_streaming_response: AsyncOrbWithStreamedResponse @@ -388,6 +392,7 @@ def __init__( self.prices = prices.AsyncPrices(self) self.subscriptions = subscriptions.AsyncSubscriptions(self) self.alerts = alerts.AsyncAlerts(self) + self.dimensional_price_groups = dimensional_price_groups.AsyncDimensionalPriceGroups(self) self.with_raw_response = AsyncOrbWithRawResponse(self) self.with_streaming_response = AsyncOrbWithStreamedResponse(self) @@ -561,6 +566,9 @@ def __init__(self, client: Orb) -> None: self.prices = prices.PricesWithRawResponse(client.prices) self.subscriptions = subscriptions.SubscriptionsWithRawResponse(client.subscriptions) self.alerts = alerts.AlertsWithRawResponse(client.alerts) + self.dimensional_price_groups = dimensional_price_groups.DimensionalPriceGroupsWithRawResponse( + client.dimensional_price_groups + ) class AsyncOrbWithRawResponse: @@ -578,6 +586,9 @@ def __init__(self, client: AsyncOrb) -> None: self.prices = prices.AsyncPricesWithRawResponse(client.prices) self.subscriptions = subscriptions.AsyncSubscriptionsWithRawResponse(client.subscriptions) self.alerts = alerts.AsyncAlertsWithRawResponse(client.alerts) + self.dimensional_price_groups = dimensional_price_groups.AsyncDimensionalPriceGroupsWithRawResponse( + client.dimensional_price_groups + ) class OrbWithStreamedResponse: @@ -595,6 +606,9 @@ def __init__(self, client: Orb) -> None: self.prices = prices.PricesWithStreamingResponse(client.prices) self.subscriptions = subscriptions.SubscriptionsWithStreamingResponse(client.subscriptions) self.alerts = alerts.AlertsWithStreamingResponse(client.alerts) + self.dimensional_price_groups = dimensional_price_groups.DimensionalPriceGroupsWithStreamingResponse( + client.dimensional_price_groups + ) class AsyncOrbWithStreamedResponse: @@ -614,6 +628,9 @@ def __init__(self, client: AsyncOrb) -> None: self.prices = prices.AsyncPricesWithStreamingResponse(client.prices) self.subscriptions = subscriptions.AsyncSubscriptionsWithStreamingResponse(client.subscriptions) self.alerts = alerts.AsyncAlertsWithStreamingResponse(client.alerts) + self.dimensional_price_groups = dimensional_price_groups.AsyncDimensionalPriceGroupsWithStreamingResponse( + client.dimensional_price_groups + ) Client = Orb diff --git a/src/orb/resources/__init__.py b/src/orb/resources/__init__.py index 3d96849f..d1a9920c 100644 --- a/src/orb/resources/__init__.py +++ b/src/orb/resources/__init__.py @@ -104,6 +104,14 @@ InvoiceLineItemsWithStreamingResponse, AsyncInvoiceLineItemsWithStreamingResponse, ) +from .dimensional_price_groups import ( + DimensionalPriceGroups, + AsyncDimensionalPriceGroups, + DimensionalPriceGroupsWithRawResponse, + AsyncDimensionalPriceGroupsWithRawResponse, + DimensionalPriceGroupsWithStreamingResponse, + AsyncDimensionalPriceGroupsWithStreamingResponse, +) __all__ = [ "TopLevel", @@ -184,4 +192,10 @@ "AsyncAlertsWithRawResponse", "AlertsWithStreamingResponse", "AsyncAlertsWithStreamingResponse", + "DimensionalPriceGroups", + "AsyncDimensionalPriceGroups", + "DimensionalPriceGroupsWithRawResponse", + "AsyncDimensionalPriceGroupsWithRawResponse", + "DimensionalPriceGroupsWithStreamingResponse", + "AsyncDimensionalPriceGroupsWithStreamingResponse", ] diff --git a/src/orb/resources/dimensional_price_groups/__init__.py b/src/orb/resources/dimensional_price_groups/__init__.py new file mode 100644 index 00000000..d3533ab1 --- /dev/null +++ b/src/orb/resources/dimensional_price_groups/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .dimensional_price_groups import ( + DimensionalPriceGroups, + AsyncDimensionalPriceGroups, + DimensionalPriceGroupsWithRawResponse, + AsyncDimensionalPriceGroupsWithRawResponse, + DimensionalPriceGroupsWithStreamingResponse, + AsyncDimensionalPriceGroupsWithStreamingResponse, +) +from .external_dimensional_price_group_id import ( + ExternalDimensionalPriceGroupID, + AsyncExternalDimensionalPriceGroupID, + ExternalDimensionalPriceGroupIDWithRawResponse, + AsyncExternalDimensionalPriceGroupIDWithRawResponse, + ExternalDimensionalPriceGroupIDWithStreamingResponse, + AsyncExternalDimensionalPriceGroupIDWithStreamingResponse, +) + +__all__ = [ + "ExternalDimensionalPriceGroupID", + "AsyncExternalDimensionalPriceGroupID", + "ExternalDimensionalPriceGroupIDWithRawResponse", + "AsyncExternalDimensionalPriceGroupIDWithRawResponse", + "ExternalDimensionalPriceGroupIDWithStreamingResponse", + "AsyncExternalDimensionalPriceGroupIDWithStreamingResponse", + "DimensionalPriceGroups", + "AsyncDimensionalPriceGroups", + "DimensionalPriceGroupsWithRawResponse", + "AsyncDimensionalPriceGroupsWithRawResponse", + "DimensionalPriceGroupsWithStreamingResponse", + "AsyncDimensionalPriceGroupsWithStreamingResponse", +] diff --git a/src/orb/resources/dimensional_price_groups/dimensional_price_groups.py b/src/orb/resources/dimensional_price_groups/dimensional_price_groups.py new file mode 100644 index 00000000..8d220f77 --- /dev/null +++ b/src/orb/resources/dimensional_price_groups/dimensional_price_groups.py @@ -0,0 +1,463 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Optional + +import httpx + +from ... import _legacy_response +from ...types import dimensional_price_group_list_params, dimensional_price_group_create_params +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 ...pagination import SyncPage, AsyncPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.dimensional_price_group import DimensionalPriceGroup +from .external_dimensional_price_group_id import ( + ExternalDimensionalPriceGroupID, + AsyncExternalDimensionalPriceGroupID, + ExternalDimensionalPriceGroupIDWithRawResponse, + AsyncExternalDimensionalPriceGroupIDWithRawResponse, + ExternalDimensionalPriceGroupIDWithStreamingResponse, + AsyncExternalDimensionalPriceGroupIDWithStreamingResponse, +) + +__all__ = ["DimensionalPriceGroups", "AsyncDimensionalPriceGroups"] + + +class DimensionalPriceGroups(SyncAPIResource): + @cached_property + def external_dimensional_price_group_id(self) -> ExternalDimensionalPriceGroupID: + return ExternalDimensionalPriceGroupID(self._client) + + @cached_property + def with_raw_response(self) -> DimensionalPriceGroupsWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/orbcorp/orb-python#accessing-raw-response-data-eg-headers + """ + return DimensionalPriceGroupsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DimensionalPriceGroupsWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/orbcorp/orb-python#with_streaming_response + """ + return DimensionalPriceGroupsWithStreamingResponse(self) + + def create( + self, + *, + billable_metric_id: str, + dimensions: List[str], + name: str, + external_dimensional_price_group_id: Optional[str] | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DimensionalPriceGroup: + """ + A dimensional price group is used to partition the result of a billable metric + by a set of dimensions. Prices in a price group must specify the parition used + to derive their usage. + + For example, suppose we have a billable metric that measures the number of + widgets used and we want to charge differently depending on the color of the + widget. We can create a price group with a dimension "color" and two prices: one + that charges $10 per red widget and one that charges $20 per blue widget. + + Args: + dimensions: The set of keys (in order) used to disambiguate prices in the group. + + 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 + """ + return self._post( + "/dimensional_price_groups", + body=maybe_transform( + { + "billable_metric_id": billable_metric_id, + "dimensions": dimensions, + "name": name, + "external_dimensional_price_group_id": external_dimensional_price_group_id, + "metadata": metadata, + }, + dimensional_price_group_create_params.DimensionalPriceGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DimensionalPriceGroup, + ) + + def retrieve( + self, + dimensional_price_group_id: str, + *, + # 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, + ) -> DimensionalPriceGroup: + """ + Fetch dimensional price group + + Args: + 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 + """ + if not dimensional_price_group_id: + raise ValueError( + f"Expected a non-empty value for `dimensional_price_group_id` but received {dimensional_price_group_id!r}" + ) + return self._get( + f"/dimensional_price_groups/{dimensional_price_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DimensionalPriceGroup, + ) + + def list( + self, + *, + cursor: Optional[str] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPage[DimensionalPriceGroup]: + """List dimensional price groups + + Args: + cursor: Cursor for pagination. + + This can be populated by the `next_cursor` value returned + from the initial request. + + limit: The number of items to fetch. Defaults to 20. + + 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 + """ + return self._get_api_list( + "/dimensional_price_groups", + page=SyncPage[DimensionalPriceGroup], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cursor": cursor, + "limit": limit, + }, + dimensional_price_group_list_params.DimensionalPriceGroupListParams, + ), + ), + model=DimensionalPriceGroup, + ) + + +class AsyncDimensionalPriceGroups(AsyncAPIResource): + @cached_property + def external_dimensional_price_group_id(self) -> AsyncExternalDimensionalPriceGroupID: + return AsyncExternalDimensionalPriceGroupID(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDimensionalPriceGroupsWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/orbcorp/orb-python#accessing-raw-response-data-eg-headers + """ + return AsyncDimensionalPriceGroupsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDimensionalPriceGroupsWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/orbcorp/orb-python#with_streaming_response + """ + return AsyncDimensionalPriceGroupsWithStreamingResponse(self) + + async def create( + self, + *, + billable_metric_id: str, + dimensions: List[str], + name: str, + external_dimensional_price_group_id: Optional[str] | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DimensionalPriceGroup: + """ + A dimensional price group is used to partition the result of a billable metric + by a set of dimensions. Prices in a price group must specify the parition used + to derive their usage. + + For example, suppose we have a billable metric that measures the number of + widgets used and we want to charge differently depending on the color of the + widget. We can create a price group with a dimension "color" and two prices: one + that charges $10 per red widget and one that charges $20 per blue widget. + + Args: + dimensions: The set of keys (in order) used to disambiguate prices in the group. + + 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 + """ + return await self._post( + "/dimensional_price_groups", + body=await async_maybe_transform( + { + "billable_metric_id": billable_metric_id, + "dimensions": dimensions, + "name": name, + "external_dimensional_price_group_id": external_dimensional_price_group_id, + "metadata": metadata, + }, + dimensional_price_group_create_params.DimensionalPriceGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DimensionalPriceGroup, + ) + + async def retrieve( + self, + dimensional_price_group_id: str, + *, + # 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, + ) -> DimensionalPriceGroup: + """ + Fetch dimensional price group + + Args: + 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 + """ + if not dimensional_price_group_id: + raise ValueError( + f"Expected a non-empty value for `dimensional_price_group_id` but received {dimensional_price_group_id!r}" + ) + return await self._get( + f"/dimensional_price_groups/{dimensional_price_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DimensionalPriceGroup, + ) + + def list( + self, + *, + cursor: Optional[str] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[DimensionalPriceGroup, AsyncPage[DimensionalPriceGroup]]: + """List dimensional price groups + + Args: + cursor: Cursor for pagination. + + This can be populated by the `next_cursor` value returned + from the initial request. + + limit: The number of items to fetch. Defaults to 20. + + 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 + """ + return self._get_api_list( + "/dimensional_price_groups", + page=AsyncPage[DimensionalPriceGroup], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cursor": cursor, + "limit": limit, + }, + dimensional_price_group_list_params.DimensionalPriceGroupListParams, + ), + ), + model=DimensionalPriceGroup, + ) + + +class DimensionalPriceGroupsWithRawResponse: + def __init__(self, dimensional_price_groups: DimensionalPriceGroups) -> None: + self._dimensional_price_groups = dimensional_price_groups + + self.create = _legacy_response.to_raw_response_wrapper( + dimensional_price_groups.create, + ) + self.retrieve = _legacy_response.to_raw_response_wrapper( + dimensional_price_groups.retrieve, + ) + self.list = _legacy_response.to_raw_response_wrapper( + dimensional_price_groups.list, + ) + + @cached_property + def external_dimensional_price_group_id(self) -> ExternalDimensionalPriceGroupIDWithRawResponse: + return ExternalDimensionalPriceGroupIDWithRawResponse( + self._dimensional_price_groups.external_dimensional_price_group_id + ) + + +class AsyncDimensionalPriceGroupsWithRawResponse: + def __init__(self, dimensional_price_groups: AsyncDimensionalPriceGroups) -> None: + self._dimensional_price_groups = dimensional_price_groups + + self.create = _legacy_response.async_to_raw_response_wrapper( + dimensional_price_groups.create, + ) + self.retrieve = _legacy_response.async_to_raw_response_wrapper( + dimensional_price_groups.retrieve, + ) + self.list = _legacy_response.async_to_raw_response_wrapper( + dimensional_price_groups.list, + ) + + @cached_property + def external_dimensional_price_group_id(self) -> AsyncExternalDimensionalPriceGroupIDWithRawResponse: + return AsyncExternalDimensionalPriceGroupIDWithRawResponse( + self._dimensional_price_groups.external_dimensional_price_group_id + ) + + +class DimensionalPriceGroupsWithStreamingResponse: + def __init__(self, dimensional_price_groups: DimensionalPriceGroups) -> None: + self._dimensional_price_groups = dimensional_price_groups + + self.create = to_streamed_response_wrapper( + dimensional_price_groups.create, + ) + self.retrieve = to_streamed_response_wrapper( + dimensional_price_groups.retrieve, + ) + self.list = to_streamed_response_wrapper( + dimensional_price_groups.list, + ) + + @cached_property + def external_dimensional_price_group_id(self) -> ExternalDimensionalPriceGroupIDWithStreamingResponse: + return ExternalDimensionalPriceGroupIDWithStreamingResponse( + self._dimensional_price_groups.external_dimensional_price_group_id + ) + + +class AsyncDimensionalPriceGroupsWithStreamingResponse: + def __init__(self, dimensional_price_groups: AsyncDimensionalPriceGroups) -> None: + self._dimensional_price_groups = dimensional_price_groups + + self.create = async_to_streamed_response_wrapper( + dimensional_price_groups.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + dimensional_price_groups.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + dimensional_price_groups.list, + ) + + @cached_property + def external_dimensional_price_group_id(self) -> AsyncExternalDimensionalPriceGroupIDWithStreamingResponse: + return AsyncExternalDimensionalPriceGroupIDWithStreamingResponse( + self._dimensional_price_groups.external_dimensional_price_group_id + ) diff --git a/src/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.py b/src/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.py new file mode 100644 index 00000000..f137f4d3 --- /dev/null +++ b/src/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.py @@ -0,0 +1,163 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ... import _legacy_response +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper +from ..._base_client import make_request_options +from ...types.dimensional_price_group import DimensionalPriceGroup + +__all__ = ["ExternalDimensionalPriceGroupID", "AsyncExternalDimensionalPriceGroupID"] + + +class ExternalDimensionalPriceGroupID(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ExternalDimensionalPriceGroupIDWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/orbcorp/orb-python#accessing-raw-response-data-eg-headers + """ + return ExternalDimensionalPriceGroupIDWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ExternalDimensionalPriceGroupIDWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/orbcorp/orb-python#with_streaming_response + """ + return ExternalDimensionalPriceGroupIDWithStreamingResponse(self) + + def retrieve( + self, + external_dimensional_price_group_id: str, + *, + # 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, + ) -> DimensionalPriceGroup: + """ + Fetch dimensional price group by external ID + + Args: + 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 + """ + if not external_dimensional_price_group_id: + raise ValueError( + f"Expected a non-empty value for `external_dimensional_price_group_id` but received {external_dimensional_price_group_id!r}" + ) + return self._get( + f"/dimensional_price_groups/external_dimensional_price_group_id/{external_dimensional_price_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DimensionalPriceGroup, + ) + + +class AsyncExternalDimensionalPriceGroupID(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncExternalDimensionalPriceGroupIDWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/orbcorp/orb-python#accessing-raw-response-data-eg-headers + """ + return AsyncExternalDimensionalPriceGroupIDWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncExternalDimensionalPriceGroupIDWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/orbcorp/orb-python#with_streaming_response + """ + return AsyncExternalDimensionalPriceGroupIDWithStreamingResponse(self) + + async def retrieve( + self, + external_dimensional_price_group_id: str, + *, + # 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, + ) -> DimensionalPriceGroup: + """ + Fetch dimensional price group by external ID + + Args: + 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 + """ + if not external_dimensional_price_group_id: + raise ValueError( + f"Expected a non-empty value for `external_dimensional_price_group_id` but received {external_dimensional_price_group_id!r}" + ) + return await self._get( + f"/dimensional_price_groups/external_dimensional_price_group_id/{external_dimensional_price_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DimensionalPriceGroup, + ) + + +class ExternalDimensionalPriceGroupIDWithRawResponse: + def __init__(self, external_dimensional_price_group_id: ExternalDimensionalPriceGroupID) -> None: + self._external_dimensional_price_group_id = external_dimensional_price_group_id + + self.retrieve = _legacy_response.to_raw_response_wrapper( + external_dimensional_price_group_id.retrieve, + ) + + +class AsyncExternalDimensionalPriceGroupIDWithRawResponse: + def __init__(self, external_dimensional_price_group_id: AsyncExternalDimensionalPriceGroupID) -> None: + self._external_dimensional_price_group_id = external_dimensional_price_group_id + + self.retrieve = _legacy_response.async_to_raw_response_wrapper( + external_dimensional_price_group_id.retrieve, + ) + + +class ExternalDimensionalPriceGroupIDWithStreamingResponse: + def __init__(self, external_dimensional_price_group_id: ExternalDimensionalPriceGroupID) -> None: + self._external_dimensional_price_group_id = external_dimensional_price_group_id + + self.retrieve = to_streamed_response_wrapper( + external_dimensional_price_group_id.retrieve, + ) + + +class AsyncExternalDimensionalPriceGroupIDWithStreamingResponse: + def __init__(self, external_dimensional_price_group_id: AsyncExternalDimensionalPriceGroupID) -> None: + self._external_dimensional_price_group_id = external_dimensional_price_group_id + + self.retrieve = async_to_streamed_response_wrapper( + external_dimensional_price_group_id.retrieve, + ) diff --git a/src/orb/types/__init__.py b/src/orb/types/__init__.py index 18c8b027..c7eb0152 100644 --- a/src/orb/types/__init__.py +++ b/src/orb/types/__init__.py @@ -57,8 +57,10 @@ from .customer_create_params import CustomerCreateParams as CustomerCreateParams from .customer_update_params import CustomerUpdateParams as CustomerUpdateParams from .credit_note_list_params import CreditNoteListParams as CreditNoteListParams +from .dimensional_price_group import DimensionalPriceGroup as DimensionalPriceGroup from .price_evaluate_response import PriceEvaluateResponse as PriceEvaluateResponse from .top_level_ping_response import TopLevelPingResponse as TopLevelPingResponse +from .dimensional_price_groups import DimensionalPriceGroups as DimensionalPriceGroups from .event_deprecate_response import EventDeprecateResponse as EventDeprecateResponse from .invoice_mark_paid_params import InvoiceMarkPaidParams as InvoiceMarkPaidParams from .subscription_list_params import SubscriptionListParams as SubscriptionListParams @@ -80,11 +82,15 @@ from .subscription_trigger_phase_params import SubscriptionTriggerPhaseParams as SubscriptionTriggerPhaseParams from .subscription_fetch_schedule_params import SubscriptionFetchScheduleParams as SubscriptionFetchScheduleParams from .subscription_update_trial_response import SubscriptionUpdateTrialResponse as SubscriptionUpdateTrialResponse +from .dimensional_price_group_list_params import DimensionalPriceGroupListParams as DimensionalPriceGroupListParams from .subscription_price_intervals_params import SubscriptionPriceIntervalsParams as SubscriptionPriceIntervalsParams from .subscription_trigger_phase_response import SubscriptionTriggerPhaseResponse as SubscriptionTriggerPhaseResponse from .alert_create_for_subscription_params import AlertCreateForSubscriptionParams as AlertCreateForSubscriptionParams from .subscription_fetch_schedule_response import SubscriptionFetchScheduleResponse as SubscriptionFetchScheduleResponse from .customer_update_by_external_id_params import CustomerUpdateByExternalIDParams as CustomerUpdateByExternalIDParams +from .dimensional_price_group_create_params import ( + DimensionalPriceGroupCreateParams as DimensionalPriceGroupCreateParams, +) from .subscription_price_intervals_response import ( SubscriptionPriceIntervalsResponse as SubscriptionPriceIntervalsResponse, ) diff --git a/src/orb/types/dimensional_price_group.py b/src/orb/types/dimensional_price_group.py new file mode 100644 index 00000000..da103128 --- /dev/null +++ b/src/orb/types/dimensional_price_group.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from .._models import BaseModel + +__all__ = ["DimensionalPriceGroup"] + + +class DimensionalPriceGroup(BaseModel): + id: str + + billable_metric_id: str + """The billable metric associated with this dimensional price group. + + All prices associated with this dimensional price group will be computed using + this billable metric. + """ + + dimensions: List[str] + """The dimensions that this dimensional price group is defined over""" + + external_dimensional_price_group_id: Optional[str] = None + """An alias for the dimensional price group""" + + 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`. + """ + + name: str + """The name of the dimensional price group""" diff --git a/src/orb/types/dimensional_price_group_create_params.py b/src/orb/types/dimensional_price_group_create_params.py new file mode 100644 index 00000000..36c07bf1 --- /dev/null +++ b/src/orb/types/dimensional_price_group_create_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["DimensionalPriceGroupCreateParams"] + + +class DimensionalPriceGroupCreateParams(TypedDict, total=False): + billable_metric_id: Required[str] + + dimensions: Required[List[str]] + """The set of keys (in order) used to disambiguate prices in the group.""" + + name: Required[str] + + external_dimensional_price_group_id: Optional[str] + + 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/dimensional_price_group_list_params.py b/src/orb/types/dimensional_price_group_list_params.py new file mode 100644 index 00000000..f385535e --- /dev/null +++ b/src/orb/types/dimensional_price_group_list_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["DimensionalPriceGroupListParams"] + + +class DimensionalPriceGroupListParams(TypedDict, total=False): + cursor: Optional[str] + """Cursor for pagination. + + This can be populated by the `next_cursor` value returned from the initial + request. + """ + + limit: int + """The number of items to fetch. Defaults to 20.""" diff --git a/src/orb/types/dimensional_price_groups/__init__.py b/src/orb/types/dimensional_price_groups/__init__.py new file mode 100644 index 00000000..6237c9ac --- /dev/null +++ b/src/orb/types/dimensional_price_groups/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .dimensional_price_groups import DimensionalPriceGroups as DimensionalPriceGroups diff --git a/src/orb/types/dimensional_price_groups/dimensional_price_groups.py b/src/orb/types/dimensional_price_groups/dimensional_price_groups.py new file mode 100644 index 00000000..78893603 --- /dev/null +++ b/src/orb/types/dimensional_price_groups/dimensional_price_groups.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from ..dimensional_price_group import DimensionalPriceGroup +from ..shared.pagination_metadata import PaginationMetadata + +__all__ = ["DimensionalPriceGroups"] + + +class DimensionalPriceGroups(BaseModel): + data: List[DimensionalPriceGroup] + + pagination_metadata: PaginationMetadata diff --git a/tests/api_resources/dimensional_price_groups/__init__.py b/tests/api_resources/dimensional_price_groups/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/dimensional_price_groups/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/dimensional_price_groups/test_external_dimensional_price_group_id.py b/tests/api_resources/dimensional_price_groups/test_external_dimensional_price_group_id.py new file mode 100644 index 00000000..d4fd8c5a --- /dev/null +++ b/tests/api_resources/dimensional_price_groups/test_external_dimensional_price_group_id.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from orb import Orb, AsyncOrb +from orb.types import DimensionalPriceGroup +from tests.utils import assert_matches_type + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestExternalDimensionalPriceGroupID: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Orb) -> None: + external_dimensional_price_group_id = ( + client.dimensional_price_groups.external_dimensional_price_group_id.retrieve( + "external_dimensional_price_group_id", + ) + ) + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Orb) -> None: + response = client.dimensional_price_groups.external_dimensional_price_group_id.with_raw_response.retrieve( + "external_dimensional_price_group_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_dimensional_price_group_id = response.parse() + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Orb) -> None: + with client.dimensional_price_groups.external_dimensional_price_group_id.with_streaming_response.retrieve( + "external_dimensional_price_group_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_dimensional_price_group_id = response.parse() + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Orb) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `external_dimensional_price_group_id` but received ''" + ): + client.dimensional_price_groups.external_dimensional_price_group_id.with_raw_response.retrieve( + "", + ) + + +class TestAsyncExternalDimensionalPriceGroupID: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOrb) -> None: + external_dimensional_price_group_id = ( + await async_client.dimensional_price_groups.external_dimensional_price_group_id.retrieve( + "external_dimensional_price_group_id", + ) + ) + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOrb) -> None: + response = ( + await async_client.dimensional_price_groups.external_dimensional_price_group_id.with_raw_response.retrieve( + "external_dimensional_price_group_id", + ) + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_dimensional_price_group_id = response.parse() + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOrb) -> None: + async with async_client.dimensional_price_groups.external_dimensional_price_group_id.with_streaming_response.retrieve( + "external_dimensional_price_group_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_dimensional_price_group_id = await response.parse() + assert_matches_type(DimensionalPriceGroup, external_dimensional_price_group_id, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOrb) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `external_dimensional_price_group_id` but received ''" + ): + await async_client.dimensional_price_groups.external_dimensional_price_group_id.with_raw_response.retrieve( + "", + ) diff --git a/tests/api_resources/test_dimensional_price_groups.py b/tests/api_resources/test_dimensional_price_groups.py new file mode 100644 index 00000000..d371b7c5 --- /dev/null +++ b/tests/api_resources/test_dimensional_price_groups.py @@ -0,0 +1,265 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from orb import Orb, AsyncOrb +from orb.types import DimensionalPriceGroup +from tests.utils import assert_matches_type +from orb.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDimensionalPriceGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Orb) -> None: + dimensional_price_group = client.dimensional_price_groups.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Orb) -> None: + dimensional_price_group = client.dimensional_price_groups.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + external_dimensional_price_group_id="external_dimensional_price_group_id", + metadata={"foo": "string"}, + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Orb) -> None: + response = client.dimensional_price_groups.with_raw_response.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Orb) -> None: + with client.dimensional_price_groups.with_streaming_response.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Orb) -> None: + dimensional_price_group = client.dimensional_price_groups.retrieve( + "dimensional_price_group_id", + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Orb) -> None: + response = client.dimensional_price_groups.with_raw_response.retrieve( + "dimensional_price_group_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Orb) -> None: + with client.dimensional_price_groups.with_streaming_response.retrieve( + "dimensional_price_group_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Orb) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `dimensional_price_group_id` but received ''" + ): + client.dimensional_price_groups.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Orb) -> None: + dimensional_price_group = client.dimensional_price_groups.list() + assert_matches_type(SyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Orb) -> None: + dimensional_price_group = client.dimensional_price_groups.list( + cursor="cursor", + limit=1, + ) + assert_matches_type(SyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Orb) -> None: + response = client.dimensional_price_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(SyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Orb) -> None: + with client.dimensional_price_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = response.parse() + assert_matches_type(SyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncDimensionalPriceGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncOrb) -> None: + dimensional_price_group = await async_client.dimensional_price_groups.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: + dimensional_price_group = await async_client.dimensional_price_groups.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + external_dimensional_price_group_id="external_dimensional_price_group_id", + metadata={"foo": "string"}, + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncOrb) -> None: + response = await async_client.dimensional_price_groups.with_raw_response.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: + async with async_client.dimensional_price_groups.with_streaming_response.create( + billable_metric_id="billable_metric_id", + dimensions=["region", "instance_type"], + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = await response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncOrb) -> None: + dimensional_price_group = await async_client.dimensional_price_groups.retrieve( + "dimensional_price_group_id", + ) + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOrb) -> None: + response = await async_client.dimensional_price_groups.with_raw_response.retrieve( + "dimensional_price_group_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOrb) -> None: + async with async_client.dimensional_price_groups.with_streaming_response.retrieve( + "dimensional_price_group_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = await response.parse() + assert_matches_type(DimensionalPriceGroup, dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOrb) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `dimensional_price_group_id` but received ''" + ): + await async_client.dimensional_price_groups.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncOrb) -> None: + dimensional_price_group = await async_client.dimensional_price_groups.list() + assert_matches_type(AsyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None: + dimensional_price_group = await async_client.dimensional_price_groups.list( + cursor="cursor", + limit=1, + ) + assert_matches_type(AsyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOrb) -> None: + response = await async_client.dimensional_price_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dimensional_price_group = response.parse() + assert_matches_type(AsyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOrb) -> None: + async with async_client.dimensional_price_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dimensional_price_group = await response.parse() + assert_matches_type(AsyncPage[DimensionalPriceGroup], dimensional_price_group, path=["response"]) + + assert cast(Any, response.is_closed) is True