diff --git a/.stats.yml b/.stats.yml index aaba5809..26721953 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-16e9b5c2b884f624e9b1f3dddf584353822295512ead0b72ffb574e6b1780570.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-908960f165205e2874dd29322cc974df5ab10c7634ab9a342ab22047013de1b4.yml diff --git a/api.md b/api.md index 89f33f14..c4dc1320 100644 --- a/api.md +++ b/api.md @@ -378,5 +378,5 @@ Methods: - client.alerts.create_for_customer(customer_id, \*\*params) -> Alert - client.alerts.create_for_external_customer(external_customer_id, \*\*params) -> Alert - client.alerts.create_for_subscription(subscription_id, \*\*params) -> Alert -- client.alerts.disable(alert_configuration_id) -> Alert -- client.alerts.enable(alert_configuration_id) -> Alert +- client.alerts.disable(alert_configuration_id, \*\*params) -> Alert +- client.alerts.enable(alert_configuration_id, \*\*params) -> Alert diff --git a/src/orb/resources/alerts.py b/src/orb/resources/alerts.py index 36f800fa..14e32c00 100644 --- a/src/orb/resources/alerts.py +++ b/src/orb/resources/alerts.py @@ -11,7 +11,9 @@ from .. import _legacy_response from ..types import ( alert_list_params, + alert_enable_params, alert_update_params, + alert_disable_params, alert_create_for_customer_params, alert_create_for_subscription_params, alert_create_for_external_customer_params, @@ -431,6 +433,7 @@ def disable( self, alert_configuration_id: str, *, + subscription_id: 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, @@ -439,10 +442,15 @@ def disable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Alert: - """ - This endpoint can be used to disable an alert. + """This endpoint allows you to disable an alert. + + To disable a plan-level alert for + a specific subscription, you must include the `subscription_id`. The + `subscription_id` is not required for customer or subscription level alerts. Args: + subscription_id: Used to update the status of a plan alert scoped to this subscription_id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -465,6 +473,7 @@ def disable( extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, + query=maybe_transform({"subscription_id": subscription_id}, alert_disable_params.AlertDisableParams), ), cast_to=Alert, ) @@ -473,6 +482,7 @@ def enable( self, alert_configuration_id: str, *, + subscription_id: 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, @@ -481,10 +491,15 @@ def enable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Alert: - """ - This endpoint can be used to enable an alert. + """This endpoint allows you to enable an alert. + + To enable a plan-level alert for a + specific subscription, you must include the `subscription_id`. The + `subscription_id` is not required for customer or subscription level alerts. Args: + subscription_id: Used to update the status of a plan alert scoped to this subscription_id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -507,6 +522,7 @@ def enable( extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, + query=maybe_transform({"subscription_id": subscription_id}, alert_enable_params.AlertEnableParams), ), cast_to=Alert, ) @@ -912,6 +928,7 @@ async def disable( self, alert_configuration_id: str, *, + subscription_id: 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, @@ -920,10 +937,15 @@ async def disable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Alert: - """ - This endpoint can be used to disable an alert. + """This endpoint allows you to disable an alert. + + To disable a plan-level alert for + a specific subscription, you must include the `subscription_id`. The + `subscription_id` is not required for customer or subscription level alerts. Args: + subscription_id: Used to update the status of a plan alert scoped to this subscription_id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -946,6 +968,9 @@ async def disable( extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, + query=await async_maybe_transform( + {"subscription_id": subscription_id}, alert_disable_params.AlertDisableParams + ), ), cast_to=Alert, ) @@ -954,6 +979,7 @@ async def enable( self, alert_configuration_id: str, *, + subscription_id: 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, @@ -962,10 +988,15 @@ async def enable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Alert: - """ - This endpoint can be used to enable an alert. + """This endpoint allows you to enable an alert. + + To enable a plan-level alert for a + specific subscription, you must include the `subscription_id`. The + `subscription_id` is not required for customer or subscription level alerts. Args: + subscription_id: Used to update the status of a plan alert scoped to this subscription_id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -988,6 +1019,9 @@ async def enable( extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, + query=await async_maybe_transform( + {"subscription_id": subscription_id}, alert_enable_params.AlertEnableParams + ), ), cast_to=Alert, ) diff --git a/src/orb/types/__init__.py b/src/orb/types/__init__.py index bbccb109..18c8b027 100644 --- a/src/orb/types/__init__.py +++ b/src/orb/types/__init__.py @@ -33,6 +33,7 @@ from .plan_create_params import PlanCreateParams as PlanCreateParams from .plan_update_params import PlanUpdateParams as PlanUpdateParams from .subscription_usage import SubscriptionUsage as SubscriptionUsage +from .alert_enable_params import AlertEnableParams as AlertEnableParams from .alert_update_params import AlertUpdateParams as AlertUpdateParams from .event_ingest_params import EventIngestParams as EventIngestParams from .event_search_params import EventSearchParams as EventSearchParams @@ -40,6 +41,7 @@ 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 .alert_disable_params import AlertDisableParams as AlertDisableParams from .coupon_create_params import CouponCreateParams as CouponCreateParams from .customer_list_params import CustomerListParams as CustomerListParams from .evaluate_price_group import EvaluatePriceGroup as EvaluatePriceGroup diff --git a/src/orb/types/alert_disable_params.py b/src/orb/types/alert_disable_params.py new file mode 100644 index 00000000..dc4a9847 --- /dev/null +++ b/src/orb/types/alert_disable_params.py @@ -0,0 +1,13 @@ +# 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__ = ["AlertDisableParams"] + + +class AlertDisableParams(TypedDict, total=False): + subscription_id: Optional[str] + """Used to update the status of a plan alert scoped to this subscription_id""" diff --git a/src/orb/types/alert_enable_params.py b/src/orb/types/alert_enable_params.py new file mode 100644 index 00000000..b607505a --- /dev/null +++ b/src/orb/types/alert_enable_params.py @@ -0,0 +1,13 @@ +# 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__ = ["AlertEnableParams"] + + +class AlertEnableParams(TypedDict, total=False): + subscription_id: Optional[str] + """Used to update the status of a plan alert scoped to this subscription_id""" diff --git a/tests/api_resources/test_alerts.py b/tests/api_resources/test_alerts.py index cb07e015..568aa4ea 100644 --- a/tests/api_resources/test_alerts.py +++ b/tests/api_resources/test_alerts.py @@ -318,14 +318,22 @@ def test_path_params_create_for_subscription(self, client: Orb) -> None: @parametrize def test_method_disable(self, client: Orb) -> None: alert = client.alerts.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", + ) + assert_matches_type(Alert, alert, path=["response"]) + + @parametrize + def test_method_disable_with_all_params(self, client: Orb) -> None: + alert = client.alerts.disable( + alert_configuration_id="alert_configuration_id", + subscription_id="subscription_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_disable(self, client: Orb) -> None: response = client.alerts.with_raw_response.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) assert response.is_closed is True @@ -336,7 +344,7 @@ def test_raw_response_disable(self, client: Orb) -> None: @parametrize def test_streaming_response_disable(self, client: Orb) -> None: with client.alerts.with_streaming_response.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -352,20 +360,28 @@ def test_path_params_disable(self, client: Orb) -> None: ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''" ): client.alerts.with_raw_response.disable( - "", + alert_configuration_id="", ) @parametrize def test_method_enable(self, client: Orb) -> None: alert = client.alerts.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", + ) + assert_matches_type(Alert, alert, path=["response"]) + + @parametrize + def test_method_enable_with_all_params(self, client: Orb) -> None: + alert = client.alerts.enable( + alert_configuration_id="alert_configuration_id", + subscription_id="subscription_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize def test_raw_response_enable(self, client: Orb) -> None: response = client.alerts.with_raw_response.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) assert response.is_closed is True @@ -376,7 +392,7 @@ def test_raw_response_enable(self, client: Orb) -> None: @parametrize def test_streaming_response_enable(self, client: Orb) -> None: with client.alerts.with_streaming_response.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -392,7 +408,7 @@ def test_path_params_enable(self, client: Orb) -> None: ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''" ): client.alerts.with_raw_response.enable( - "", + alert_configuration_id="", ) @@ -696,14 +712,22 @@ async def test_path_params_create_for_subscription(self, async_client: AsyncOrb) @parametrize async def test_method_disable(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", + ) + assert_matches_type(Alert, alert, path=["response"]) + + @parametrize + async def test_method_disable_with_all_params(self, async_client: AsyncOrb) -> None: + alert = await async_client.alerts.disable( + alert_configuration_id="alert_configuration_id", + subscription_id="subscription_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_disable(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) assert response.is_closed is True @@ -714,7 +738,7 @@ async def test_raw_response_disable(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_disable(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.disable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -730,20 +754,28 @@ async def test_path_params_disable(self, async_client: AsyncOrb) -> None: ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''" ): await async_client.alerts.with_raw_response.disable( - "", + alert_configuration_id="", ) @parametrize async def test_method_enable(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", + ) + assert_matches_type(Alert, alert, path=["response"]) + + @parametrize + async def test_method_enable_with_all_params(self, async_client: AsyncOrb) -> None: + alert = await async_client.alerts.enable( + alert_configuration_id="alert_configuration_id", + subscription_id="subscription_id", ) assert_matches_type(Alert, alert, path=["response"]) @parametrize async def test_raw_response_enable(self, async_client: AsyncOrb) -> None: response = await async_client.alerts.with_raw_response.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) assert response.is_closed is True @@ -754,7 +786,7 @@ async def test_raw_response_enable(self, async_client: AsyncOrb) -> None: @parametrize async def test_streaming_response_enable(self, async_client: AsyncOrb) -> None: async with async_client.alerts.with_streaming_response.enable( - "alert_configuration_id", + alert_configuration_id="alert_configuration_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -770,5 +802,5 @@ async def test_path_params_enable(self, async_client: AsyncOrb) -> None: ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''" ): await async_client.alerts.with_raw_response.enable( - "", + alert_configuration_id="", )