From 89489ee6242771940a6c427161471fcad637a48a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 02:23:15 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- src/orb/resources/alerts.py | 48 +++---------------- src/orb/types/alert.py | 4 +- .../types/alert_create_for_customer_params.py | 10 +--- ...ert_create_for_external_customer_params.py | 10 +--- .../alert_create_for_subscription_params.py | 10 +--- tests/api_resources/test_alerts.py | 40 ++++++++-------- 7 files changed, 32 insertions(+), 92 deletions(-) diff --git a/.stats.yml b/.stats.yml index b21f5baa..58bce287 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-a2c1aa029d1e72a5fc7d3c6cd431479888ebd9a379683a2c8630da48437baa4f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6797b438a8e6a6856e28f4304a5a3c81bb67e74fa2d6fcc20e734880c725295a.yml diff --git a/src/orb/resources/alerts.py b/src/orb/resources/alerts.py index 4a38058d..8a6ece08 100644 --- a/src/orb/resources/alerts.py +++ b/src/orb/resources/alerts.py @@ -215,13 +215,7 @@ def create_for_customer( customer_id: str, *, currency: str, - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"], thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | 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. @@ -286,13 +280,7 @@ def create_for_external_customer( external_customer_id: str, *, currency: str, - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"], thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | 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. @@ -359,13 +347,7 @@ def create_for_subscription( subscription_id: str, *, thresholds: Iterable[alert_create_for_subscription_params.Threshold], - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["usage_exceeded", "cost_exceeded"], metric_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. @@ -708,13 +690,7 @@ async def create_for_customer( customer_id: str, *, currency: str, - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"], thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | 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. @@ -779,13 +755,7 @@ async def create_for_external_customer( external_customer_id: str, *, currency: str, - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"], thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | 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. @@ -852,13 +822,7 @@ async def create_for_subscription( subscription_id: str, *, thresholds: Iterable[alert_create_for_subscription_params.Threshold], - type: Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ], + type: Literal["usage_exceeded", "cost_exceeded"], metric_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. diff --git a/src/orb/types/alert.py b/src/orb/types/alert.py index 0ef04360..b5e25436 100644 --- a/src/orb/types/alert.py +++ b/src/orb/types/alert.py @@ -79,10 +79,10 @@ class Alert(BaseModel): """ type: Literal[ - "usage_exceeded", - "cost_exceeded", "credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered", + "usage_exceeded", + "cost_exceeded", ] """The type of alert. This must be a valid alert type.""" diff --git a/src/orb/types/alert_create_for_customer_params.py b/src/orb/types/alert_create_for_customer_params.py index 5eeec557..2e2c77d9 100644 --- a/src/orb/types/alert_create_for_customer_params.py +++ b/src/orb/types/alert_create_for_customer_params.py @@ -12,15 +12,7 @@ class AlertCreateForCustomerParams(TypedDict, total=False): currency: Required[str] """The case sensitive currency or custom pricing unit to use for this alert.""" - type: Required[ - Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ] - ] + type: Required[Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"]] """The type of alert to create. This must be a valid alert type.""" thresholds: Optional[Iterable[Threshold]] diff --git a/src/orb/types/alert_create_for_external_customer_params.py b/src/orb/types/alert_create_for_external_customer_params.py index 6732f61c..4c452e7f 100644 --- a/src/orb/types/alert_create_for_external_customer_params.py +++ b/src/orb/types/alert_create_for_external_customer_params.py @@ -12,15 +12,7 @@ class AlertCreateForExternalCustomerParams(TypedDict, total=False): currency: Required[str] """The case sensitive currency or custom pricing unit to use for this alert.""" - type: Required[ - Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ] - ] + type: Required[Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"]] """The type of alert to create. This must be a valid alert type.""" thresholds: Optional[Iterable[Threshold]] diff --git a/src/orb/types/alert_create_for_subscription_params.py b/src/orb/types/alert_create_for_subscription_params.py index 767408dc..e91ce1ab 100644 --- a/src/orb/types/alert_create_for_subscription_params.py +++ b/src/orb/types/alert_create_for_subscription_params.py @@ -12,15 +12,7 @@ class AlertCreateForSubscriptionParams(TypedDict, total=False): thresholds: Required[Iterable[Threshold]] """The thresholds that define the values at which the alert will be triggered.""" - type: Required[ - Literal[ - "usage_exceeded", - "cost_exceeded", - "credit_balance_depleted", - "credit_balance_dropped", - "credit_balance_recovered", - ] - ] + type: Required[Literal["usage_exceeded", "cost_exceeded"]] """The type of alert to create. This must be a valid alert type.""" metric_id: Optional[str] diff --git a/tests/api_resources/test_alerts.py b/tests/api_resources/test_alerts.py index 568aa4ea..b12409c4 100644 --- a/tests/api_resources/test_alerts.py +++ b/tests/api_resources/test_alerts.py @@ -152,7 +152,7 @@ def test_method_create_for_customer(self, client: Orb) -> None: alert = client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert_matches_type(Alert, alert, path=["response"]) @@ -161,7 +161,7 @@ def test_method_create_for_customer_with_all_params(self, client: Orb) -> None: alert = client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", thresholds=[{"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -171,7 +171,7 @@ def test_raw_response_create_for_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert response.is_closed is True @@ -184,7 +184,7 @@ def test_streaming_response_create_for_customer(self, client: Orb) -> None: with client.alerts.with_streaming_response.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -200,7 +200,7 @@ def test_path_params_create_for_customer(self, client: Orb) -> None: client.alerts.with_raw_response.create_for_customer( customer_id="", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) @parametrize @@ -208,7 +208,7 @@ def test_method_create_for_external_customer(self, client: Orb) -> None: alert = client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert_matches_type(Alert, alert, path=["response"]) @@ -217,7 +217,7 @@ def test_method_create_for_external_customer_with_all_params(self, client: Orb) alert = client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", thresholds=[{"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -227,7 +227,7 @@ def test_raw_response_create_for_external_customer(self, client: Orb) -> None: response = client.alerts.with_raw_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert response.is_closed is True @@ -240,7 +240,7 @@ def test_streaming_response_create_for_external_customer(self, client: Orb) -> N with client.alerts.with_streaming_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -256,7 +256,7 @@ def test_path_params_create_for_external_customer(self, client: Orb) -> None: client.alerts.with_raw_response.create_for_external_customer( external_customer_id="", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) @parametrize @@ -546,7 +546,7 @@ async def test_method_create_for_customer(self, async_client: AsyncOrb) -> None: alert = await async_client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert_matches_type(Alert, alert, path=["response"]) @@ -555,7 +555,7 @@ async def test_method_create_for_customer_with_all_params(self, async_client: As alert = await async_client.alerts.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", thresholds=[{"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -565,7 +565,7 @@ async def test_raw_response_create_for_customer(self, async_client: AsyncOrb) -> response = await async_client.alerts.with_raw_response.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert response.is_closed is True @@ -578,7 +578,7 @@ async def test_streaming_response_create_for_customer(self, async_client: AsyncO async with async_client.alerts.with_streaming_response.create_for_customer( customer_id="customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -594,7 +594,7 @@ async def test_path_params_create_for_customer(self, async_client: AsyncOrb) -> await async_client.alerts.with_raw_response.create_for_customer( customer_id="", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) @parametrize @@ -602,7 +602,7 @@ async def test_method_create_for_external_customer(self, async_client: AsyncOrb) alert = await async_client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert_matches_type(Alert, alert, path=["response"]) @@ -611,7 +611,7 @@ async def test_method_create_for_external_customer_with_all_params(self, async_c alert = await async_client.alerts.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", thresholds=[{"value": 0}], ) assert_matches_type(Alert, alert, path=["response"]) @@ -621,7 +621,7 @@ async def test_raw_response_create_for_external_customer(self, async_client: Asy response = await async_client.alerts.with_raw_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) assert response.is_closed is True @@ -634,7 +634,7 @@ async def test_streaming_response_create_for_external_customer(self, async_clien async with async_client.alerts.with_streaming_response.create_for_external_customer( external_customer_id="external_customer_id", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -650,7 +650,7 @@ async def test_path_params_create_for_external_customer(self, async_client: Asyn await async_client.alerts.with_raw_response.create_for_external_customer( external_customer_id="", currency="currency", - type="usage_exceeded", + type="credit_balance_depleted", ) @parametrize