Skip to content

Commit 37bfcee

Browse files
feat(api): api update (#459)
1 parent 13d6c94 commit 37bfcee

File tree

7 files changed

+121
-27
lines changed

7 files changed

+121
-27
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-16e9b5c2b884f624e9b1f3dddf584353822295512ead0b72ffb574e6b1780570.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-908960f165205e2874dd29322cc974df5ab10c7634ab9a342ab22047013de1b4.yml

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,5 +385,5 @@ Methods:
385385
- <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>
386386
- <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>
387387
- <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>
388-
- <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>
389-
- <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>
388+
- <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>
389+
- <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>

src/orb/resources/alerts.py

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
from .. import _legacy_response
1212
from ..types import (
1313
alert_list_params,
14+
alert_enable_params,
1415
alert_update_params,
16+
alert_disable_params,
1517
alert_create_for_customer_params,
1618
alert_create_for_subscription_params,
1719
alert_create_for_external_customer_params,
@@ -431,6 +433,7 @@ def disable(
431433
self,
432434
alert_configuration_id: str,
433435
*,
436+
subscription_id: Optional[str] | NotGiven = NOT_GIVEN,
434437
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
435438
# The extra values given here take precedence over values defined on the client or passed to this method.
436439
extra_headers: Headers | None = None,
@@ -439,10 +442,15 @@ def disable(
439442
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
440443
idempotency_key: str | None = None,
441444
) -> Alert:
442-
"""
443-
This endpoint can be used to disable an alert.
445+
"""This endpoint allows you to disable an alert.
446+
447+
To disable a plan-level alert for
448+
a specific subscription, you must include the `subscription_id`. The
449+
`subscription_id` is not required for customer or subscription level alerts.
444450
445451
Args:
452+
subscription_id: Used to update the status of a plan alert scoped to this subscription_id
453+
446454
extra_headers: Send extra headers
447455
448456
extra_query: Add additional query parameters to the request
@@ -465,6 +473,7 @@ def disable(
465473
extra_body=extra_body,
466474
timeout=timeout,
467475
idempotency_key=idempotency_key,
476+
query=maybe_transform({"subscription_id": subscription_id}, alert_disable_params.AlertDisableParams),
468477
),
469478
cast_to=Alert,
470479
)
@@ -473,6 +482,7 @@ def enable(
473482
self,
474483
alert_configuration_id: str,
475484
*,
485+
subscription_id: Optional[str] | NotGiven = NOT_GIVEN,
476486
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
477487
# The extra values given here take precedence over values defined on the client or passed to this method.
478488
extra_headers: Headers | None = None,
@@ -481,10 +491,15 @@ def enable(
481491
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
482492
idempotency_key: str | None = None,
483493
) -> Alert:
484-
"""
485-
This endpoint can be used to enable an alert.
494+
"""This endpoint allows you to enable an alert.
495+
496+
To enable a plan-level alert for a
497+
specific subscription, you must include the `subscription_id`. The
498+
`subscription_id` is not required for customer or subscription level alerts.
486499
487500
Args:
501+
subscription_id: Used to update the status of a plan alert scoped to this subscription_id
502+
488503
extra_headers: Send extra headers
489504
490505
extra_query: Add additional query parameters to the request
@@ -507,6 +522,7 @@ def enable(
507522
extra_body=extra_body,
508523
timeout=timeout,
509524
idempotency_key=idempotency_key,
525+
query=maybe_transform({"subscription_id": subscription_id}, alert_enable_params.AlertEnableParams),
510526
),
511527
cast_to=Alert,
512528
)
@@ -912,6 +928,7 @@ async def disable(
912928
self,
913929
alert_configuration_id: str,
914930
*,
931+
subscription_id: Optional[str] | NotGiven = NOT_GIVEN,
915932
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
916933
# The extra values given here take precedence over values defined on the client or passed to this method.
917934
extra_headers: Headers | None = None,
@@ -920,10 +937,15 @@ async def disable(
920937
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
921938
idempotency_key: str | None = None,
922939
) -> Alert:
923-
"""
924-
This endpoint can be used to disable an alert.
940+
"""This endpoint allows you to disable an alert.
941+
942+
To disable a plan-level alert for
943+
a specific subscription, you must include the `subscription_id`. The
944+
`subscription_id` is not required for customer or subscription level alerts.
925945
926946
Args:
947+
subscription_id: Used to update the status of a plan alert scoped to this subscription_id
948+
927949
extra_headers: Send extra headers
928950
929951
extra_query: Add additional query parameters to the request
@@ -946,6 +968,9 @@ async def disable(
946968
extra_body=extra_body,
947969
timeout=timeout,
948970
idempotency_key=idempotency_key,
971+
query=await async_maybe_transform(
972+
{"subscription_id": subscription_id}, alert_disable_params.AlertDisableParams
973+
),
949974
),
950975
cast_to=Alert,
951976
)
@@ -954,6 +979,7 @@ async def enable(
954979
self,
955980
alert_configuration_id: str,
956981
*,
982+
subscription_id: Optional[str] | NotGiven = NOT_GIVEN,
957983
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
958984
# The extra values given here take precedence over values defined on the client or passed to this method.
959985
extra_headers: Headers | None = None,
@@ -962,10 +988,15 @@ async def enable(
962988
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
963989
idempotency_key: str | None = None,
964990
) -> Alert:
965-
"""
966-
This endpoint can be used to enable an alert.
991+
"""This endpoint allows you to enable an alert.
992+
993+
To enable a plan-level alert for a
994+
specific subscription, you must include the `subscription_id`. The
995+
`subscription_id` is not required for customer or subscription level alerts.
967996
968997
Args:
998+
subscription_id: Used to update the status of a plan alert scoped to this subscription_id
999+
9691000
extra_headers: Send extra headers
9701001
9711002
extra_query: Add additional query parameters to the request
@@ -988,6 +1019,9 @@ async def enable(
9881019
extra_body=extra_body,
9891020
timeout=timeout,
9901021
idempotency_key=idempotency_key,
1022+
query=await async_maybe_transform(
1023+
{"subscription_id": subscription_id}, alert_enable_params.AlertEnableParams
1024+
),
9911025
),
9921026
cast_to=Alert,
9931027
)

src/orb/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@
3333
from .plan_create_params import PlanCreateParams as PlanCreateParams
3434
from .plan_update_params import PlanUpdateParams as PlanUpdateParams
3535
from .subscription_usage import SubscriptionUsage as SubscriptionUsage
36+
from .alert_enable_params import AlertEnableParams as AlertEnableParams
3637
from .alert_update_params import AlertUpdateParams as AlertUpdateParams
3738
from .event_ingest_params import EventIngestParams as EventIngestParams
3839
from .event_search_params import EventSearchParams as EventSearchParams
3940
from .event_update_params import EventUpdateParams as EventUpdateParams
4041
from .invoice_list_params import InvoiceListParams as InvoiceListParams
4142
from .price_create_params import PriceCreateParams as PriceCreateParams
4243
from .price_update_params import PriceUpdateParams as PriceUpdateParams
44+
from .alert_disable_params import AlertDisableParams as AlertDisableParams
4345
from .coupon_create_params import CouponCreateParams as CouponCreateParams
4446
from .customer_list_params import CustomerListParams as CustomerListParams
4547
from .evaluate_price_group import EvaluatePriceGroup as EvaluatePriceGroup
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
__all__ = ["AlertDisableParams"]
9+
10+
11+
class AlertDisableParams(TypedDict, total=False):
12+
subscription_id: Optional[str]
13+
"""Used to update the status of a plan alert scoped to this subscription_id"""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
__all__ = ["AlertEnableParams"]
9+
10+
11+
class AlertEnableParams(TypedDict, total=False):
12+
subscription_id: Optional[str]
13+
"""Used to update the status of a plan alert scoped to this subscription_id"""

tests/api_resources/test_alerts.py

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,22 @@ def test_path_params_create_for_subscription(self, client: Orb) -> None:
318318
@parametrize
319319
def test_method_disable(self, client: Orb) -> None:
320320
alert = client.alerts.disable(
321-
"alert_configuration_id",
321+
alert_configuration_id="alert_configuration_id",
322+
)
323+
assert_matches_type(Alert, alert, path=["response"])
324+
325+
@parametrize
326+
def test_method_disable_with_all_params(self, client: Orb) -> None:
327+
alert = client.alerts.disable(
328+
alert_configuration_id="alert_configuration_id",
329+
subscription_id="subscription_id",
322330
)
323331
assert_matches_type(Alert, alert, path=["response"])
324332

325333
@parametrize
326334
def test_raw_response_disable(self, client: Orb) -> None:
327335
response = client.alerts.with_raw_response.disable(
328-
"alert_configuration_id",
336+
alert_configuration_id="alert_configuration_id",
329337
)
330338

331339
assert response.is_closed is True
@@ -336,7 +344,7 @@ def test_raw_response_disable(self, client: Orb) -> None:
336344
@parametrize
337345
def test_streaming_response_disable(self, client: Orb) -> None:
338346
with client.alerts.with_streaming_response.disable(
339-
"alert_configuration_id",
347+
alert_configuration_id="alert_configuration_id",
340348
) as response:
341349
assert not response.is_closed
342350
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -352,20 +360,28 @@ def test_path_params_disable(self, client: Orb) -> None:
352360
ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''"
353361
):
354362
client.alerts.with_raw_response.disable(
355-
"",
363+
alert_configuration_id="",
356364
)
357365

358366
@parametrize
359367
def test_method_enable(self, client: Orb) -> None:
360368
alert = client.alerts.enable(
361-
"alert_configuration_id",
369+
alert_configuration_id="alert_configuration_id",
370+
)
371+
assert_matches_type(Alert, alert, path=["response"])
372+
373+
@parametrize
374+
def test_method_enable_with_all_params(self, client: Orb) -> None:
375+
alert = client.alerts.enable(
376+
alert_configuration_id="alert_configuration_id",
377+
subscription_id="subscription_id",
362378
)
363379
assert_matches_type(Alert, alert, path=["response"])
364380

365381
@parametrize
366382
def test_raw_response_enable(self, client: Orb) -> None:
367383
response = client.alerts.with_raw_response.enable(
368-
"alert_configuration_id",
384+
alert_configuration_id="alert_configuration_id",
369385
)
370386

371387
assert response.is_closed is True
@@ -376,7 +392,7 @@ def test_raw_response_enable(self, client: Orb) -> None:
376392
@parametrize
377393
def test_streaming_response_enable(self, client: Orb) -> None:
378394
with client.alerts.with_streaming_response.enable(
379-
"alert_configuration_id",
395+
alert_configuration_id="alert_configuration_id",
380396
) as response:
381397
assert not response.is_closed
382398
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -392,7 +408,7 @@ def test_path_params_enable(self, client: Orb) -> None:
392408
ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''"
393409
):
394410
client.alerts.with_raw_response.enable(
395-
"",
411+
alert_configuration_id="",
396412
)
397413

398414

@@ -696,14 +712,22 @@ async def test_path_params_create_for_subscription(self, async_client: AsyncOrb)
696712
@parametrize
697713
async def test_method_disable(self, async_client: AsyncOrb) -> None:
698714
alert = await async_client.alerts.disable(
699-
"alert_configuration_id",
715+
alert_configuration_id="alert_configuration_id",
716+
)
717+
assert_matches_type(Alert, alert, path=["response"])
718+
719+
@parametrize
720+
async def test_method_disable_with_all_params(self, async_client: AsyncOrb) -> None:
721+
alert = await async_client.alerts.disable(
722+
alert_configuration_id="alert_configuration_id",
723+
subscription_id="subscription_id",
700724
)
701725
assert_matches_type(Alert, alert, path=["response"])
702726

703727
@parametrize
704728
async def test_raw_response_disable(self, async_client: AsyncOrb) -> None:
705729
response = await async_client.alerts.with_raw_response.disable(
706-
"alert_configuration_id",
730+
alert_configuration_id="alert_configuration_id",
707731
)
708732

709733
assert response.is_closed is True
@@ -714,7 +738,7 @@ async def test_raw_response_disable(self, async_client: AsyncOrb) -> None:
714738
@parametrize
715739
async def test_streaming_response_disable(self, async_client: AsyncOrb) -> None:
716740
async with async_client.alerts.with_streaming_response.disable(
717-
"alert_configuration_id",
741+
alert_configuration_id="alert_configuration_id",
718742
) as response:
719743
assert not response.is_closed
720744
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:
730754
ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''"
731755
):
732756
await async_client.alerts.with_raw_response.disable(
733-
"",
757+
alert_configuration_id="",
734758
)
735759

736760
@parametrize
737761
async def test_method_enable(self, async_client: AsyncOrb) -> None:
738762
alert = await async_client.alerts.enable(
739-
"alert_configuration_id",
763+
alert_configuration_id="alert_configuration_id",
764+
)
765+
assert_matches_type(Alert, alert, path=["response"])
766+
767+
@parametrize
768+
async def test_method_enable_with_all_params(self, async_client: AsyncOrb) -> None:
769+
alert = await async_client.alerts.enable(
770+
alert_configuration_id="alert_configuration_id",
771+
subscription_id="subscription_id",
740772
)
741773
assert_matches_type(Alert, alert, path=["response"])
742774

743775
@parametrize
744776
async def test_raw_response_enable(self, async_client: AsyncOrb) -> None:
745777
response = await async_client.alerts.with_raw_response.enable(
746-
"alert_configuration_id",
778+
alert_configuration_id="alert_configuration_id",
747779
)
748780

749781
assert response.is_closed is True
@@ -754,7 +786,7 @@ async def test_raw_response_enable(self, async_client: AsyncOrb) -> None:
754786
@parametrize
755787
async def test_streaming_response_enable(self, async_client: AsyncOrb) -> None:
756788
async with async_client.alerts.with_streaming_response.enable(
757-
"alert_configuration_id",
789+
alert_configuration_id="alert_configuration_id",
758790
) as response:
759791
assert not response.is_closed
760792
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:
770802
ValueError, match=r"Expected a non-empty value for `alert_configuration_id` but received ''"
771803
):
772804
await async_client.alerts.with_raw_response.enable(
773-
"",
805+
alert_configuration_id="",
774806
)

0 commit comments

Comments
 (0)