Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,5 @@ Methods:
- <code title="post /alerts/customer_id/{customer_id}">client.alerts.<a href="./src/orb/resources/alerts.py">create_for_customer</a>(customer_id, \*\*<a href="src/orb/types/alert_create_for_customer_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/external_customer_id/{external_customer_id}">client.alerts.<a href="./src/orb/resources/alerts.py">create_for_external_customer</a>(external_customer_id, \*\*<a href="src/orb/types/alert_create_for_external_customer_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/subscription_id/{subscription_id}">client.alerts.<a href="./src/orb/resources/alerts.py">create_for_subscription</a>(subscription_id, \*\*<a href="src/orb/types/alert_create_for_subscription_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/{alert_configuration_id}/disable">client.alerts.<a href="./src/orb/resources/alerts.py">disable</a>(alert_configuration_id) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/{alert_configuration_id}/enable">client.alerts.<a href="./src/orb/resources/alerts.py">enable</a>(alert_configuration_id) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/{alert_configuration_id}/disable">client.alerts.<a href="./src/orb/resources/alerts.py">disable</a>(alert_configuration_id, \*\*<a href="src/orb/types/alert_disable_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
- <code title="post /alerts/{alert_configuration_id}/enable">client.alerts.<a href="./src/orb/resources/alerts.py">enable</a>(alert_configuration_id, \*\*<a href="src/orb/types/alert_enable_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
50 changes: 42 additions & 8 deletions src/orb/resources/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
)
Expand Down
2 changes: 2 additions & 0 deletions src/orb/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
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
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 .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
Expand Down
13 changes: 13 additions & 0 deletions src/orb/types/alert_disable_params.py
Original file line number Diff line number Diff line change
@@ -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"""
13 changes: 13 additions & 0 deletions src/orb/types/alert_enable_params.py
Original file line number Diff line number Diff line change
@@ -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"""
64 changes: 48 additions & 16 deletions tests/api_resources/test_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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="",
)


Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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="",
)