Skip to content

Commit 83017c7

Browse files
Stainless Botstainless-app[bot]
Stainless Bot
authored andcommitted
feat(api): add method to enable alerts (#255)
1 parent d5f974a commit 83017c7

15 files changed

+1441
-639
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 82
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-e0338fed09226882fc7e89ae7249ca67d95217701cba0c91b68c7a6cc102fd7f.yml
1+
configured_endpoints: 83
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-2eaf3a96bd08daefaae73e68bb28d49e8f1e0aa6cc308ef67a42be62d7eb049f.yml

api.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -342,4 +342,16 @@ Methods:
342342
Methods:
343343

344344
- <code>client.webhooks.<a href="./src/orb/resources/webhooks.py">unwrap</a>(\*args) -> object</code>
345-
- <code>client.webhooks.<a href="./src/orb/resources/webhooks.py">verify_signature</a>(\*args) -> None</code>
345+
- <code>client.webhooks.<a href="./src/orb/resources/webhooks.py">verify_signature</a>(\*args) -> None</code>
346+
347+
# Alerts
348+
349+
Types:
350+
351+
```python
352+
from orb.types import Alert
353+
```
354+
355+
Methods:
356+
357+
- <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>

src/orb/_client.py

+9
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Orb(SyncAPIClient):
6060
prices: resources.Prices
6161
subscriptions: resources.Subscriptions
6262
webhooks: resources.Webhooks
63+
alerts: resources.Alerts
6364
with_raw_response: OrbWithRawResponse
6465
with_streaming_response: OrbWithStreamedResponse
6566

@@ -140,6 +141,8 @@ def __init__(
140141
self.prices = resources.Prices(self)
141142
self.subscriptions = resources.Subscriptions(self)
142143
self.webhooks = resources.Webhooks(self)
144+
self.alerts = resources.Alerts(self)
145+
self.with_raw_response = OrbWithRawResponse(self)
143146
self.with_streaming_response = OrbWithStreamedResponse(self)
144147

145148
@property
@@ -311,6 +314,7 @@ class AsyncOrb(AsyncAPIClient):
311314
prices: resources.AsyncPrices
312315
subscriptions: resources.AsyncSubscriptions
313316
webhooks: resources.AsyncWebhooks
317+
alerts: resources.AsyncAlerts
314318
with_raw_response: AsyncOrbWithRawResponse
315319
with_streaming_response: AsyncOrbWithStreamedResponse
316320

@@ -391,6 +395,7 @@ def __init__(
391395
self.prices = resources.AsyncPrices(self)
392396
self.subscriptions = resources.AsyncSubscriptions(self)
393397
self.webhooks = resources.AsyncWebhooks(self)
398+
self.alerts = resources.AsyncAlerts(self)
394399
self.with_raw_response = AsyncOrbWithRawResponse(self)
395400
self.with_streaming_response = AsyncOrbWithStreamedResponse(self)
396401

@@ -563,6 +568,7 @@ def __init__(self, client: Orb) -> None:
563568
self.plans = resources.PlansWithRawResponse(client.plans)
564569
self.prices = resources.PricesWithRawResponse(client.prices)
565570
self.subscriptions = resources.SubscriptionsWithRawResponse(client.subscriptions)
571+
self.alerts = resources.AlertsWithRawResponse(client.alerts)
566572

567573

568574
class AsyncOrbWithRawResponse:
@@ -579,6 +585,7 @@ def __init__(self, client: AsyncOrb) -> None:
579585
self.plans = resources.AsyncPlansWithRawResponse(client.plans)
580586
self.prices = resources.AsyncPricesWithRawResponse(client.prices)
581587
self.subscriptions = resources.AsyncSubscriptionsWithRawResponse(client.subscriptions)
588+
self.alerts = resources.AsyncAlertsWithRawResponse(client.alerts)
582589

583590

584591
class OrbWithStreamedResponse:
@@ -595,6 +602,7 @@ def __init__(self, client: Orb) -> None:
595602
self.plans = resources.PlansWithStreamingResponse(client.plans)
596603
self.prices = resources.PricesWithStreamingResponse(client.prices)
597604
self.subscriptions = resources.SubscriptionsWithStreamingResponse(client.subscriptions)
605+
self.alerts = resources.AlertsWithStreamingResponse(client.alerts)
598606

599607

600608
class AsyncOrbWithStreamedResponse:
@@ -611,6 +619,7 @@ def __init__(self, client: AsyncOrb) -> None:
611619
self.plans = resources.AsyncPlansWithStreamingResponse(client.plans)
612620
self.prices = resources.AsyncPricesWithStreamingResponse(client.prices)
613621
self.subscriptions = resources.AsyncSubscriptionsWithStreamingResponse(client.subscriptions)
622+
self.alerts = resources.AsyncAlertsWithStreamingResponse(client.alerts)
614623

615624

616625
Client = Orb

src/orb/resources/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
PlansWithStreamingResponse,
1717
AsyncPlansWithStreamingResponse,
1818
)
19+
from .alerts import (
20+
Alerts,
21+
AsyncAlerts,
22+
AlertsWithRawResponse,
23+
AsyncAlertsWithRawResponse,
24+
AlertsWithStreamingResponse,
25+
AsyncAlertsWithStreamingResponse,
26+
)
1927
from .events import (
2028
Events,
2129
AsyncEvents,
@@ -176,4 +184,10 @@
176184
"AsyncSubscriptionsWithStreamingResponse",
177185
"Webhooks",
178186
"AsyncWebhooks",
187+
"Alerts",
188+
"AsyncAlerts",
189+
"AlertsWithRawResponse",
190+
"AsyncAlertsWithRawResponse",
191+
"AlertsWithStreamingResponse",
192+
"AsyncAlertsWithStreamingResponse",
179193
]

src/orb/resources/alerts.py

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import httpx
6+
7+
from .. import _legacy_response
8+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from .._compat import cached_property
10+
from .._resource import SyncAPIResource, AsyncAPIResource
11+
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
12+
from ..types.alert import Alert
13+
from .._base_client import (
14+
make_request_options,
15+
)
16+
17+
__all__ = ["Alerts", "AsyncAlerts"]
18+
19+
20+
class Alerts(SyncAPIResource):
21+
@cached_property
22+
def with_raw_response(self) -> AlertsWithRawResponse:
23+
return AlertsWithRawResponse(self)
24+
25+
@cached_property
26+
def with_streaming_response(self) -> AlertsWithStreamingResponse:
27+
return AlertsWithStreamingResponse(self)
28+
29+
def enable(
30+
self,
31+
alert_configuration_id: str,
32+
*,
33+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
34+
# The extra values given here take precedence over values defined on the client or passed to this method.
35+
extra_headers: Headers | None = None,
36+
extra_query: Query | None = None,
37+
extra_body: Body | None = None,
38+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
39+
idempotency_key: str | None = None,
40+
) -> Alert:
41+
"""
42+
This endpoint can be used to enable an alert.
43+
44+
Args:
45+
extra_headers: Send extra headers
46+
47+
extra_query: Add additional query parameters to the request
48+
49+
extra_body: Add additional JSON properties to the request
50+
51+
timeout: Override the client-level default timeout for this request, in seconds
52+
53+
idempotency_key: Specify a custom idempotency key for this request
54+
"""
55+
if not alert_configuration_id:
56+
raise ValueError(
57+
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
58+
)
59+
return self._post(
60+
f"/alerts/{alert_configuration_id}/enable",
61+
options=make_request_options(
62+
extra_headers=extra_headers,
63+
extra_query=extra_query,
64+
extra_body=extra_body,
65+
timeout=timeout,
66+
idempotency_key=idempotency_key,
67+
),
68+
cast_to=Alert,
69+
)
70+
71+
72+
class AsyncAlerts(AsyncAPIResource):
73+
@cached_property
74+
def with_raw_response(self) -> AsyncAlertsWithRawResponse:
75+
return AsyncAlertsWithRawResponse(self)
76+
77+
@cached_property
78+
def with_streaming_response(self) -> AsyncAlertsWithStreamingResponse:
79+
return AsyncAlertsWithStreamingResponse(self)
80+
81+
async def enable(
82+
self,
83+
alert_configuration_id: str,
84+
*,
85+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
86+
# The extra values given here take precedence over values defined on the client or passed to this method.
87+
extra_headers: Headers | None = None,
88+
extra_query: Query | None = None,
89+
extra_body: Body | None = None,
90+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
91+
idempotency_key: str | None = None,
92+
) -> Alert:
93+
"""
94+
This endpoint can be used to enable an alert.
95+
96+
Args:
97+
extra_headers: Send extra headers
98+
99+
extra_query: Add additional query parameters to the request
100+
101+
extra_body: Add additional JSON properties to the request
102+
103+
timeout: Override the client-level default timeout for this request, in seconds
104+
105+
idempotency_key: Specify a custom idempotency key for this request
106+
"""
107+
if not alert_configuration_id:
108+
raise ValueError(
109+
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
110+
)
111+
return await self._post(
112+
f"/alerts/{alert_configuration_id}/enable",
113+
options=make_request_options(
114+
extra_headers=extra_headers,
115+
extra_query=extra_query,
116+
extra_body=extra_body,
117+
timeout=timeout,
118+
idempotency_key=idempotency_key,
119+
),
120+
cast_to=Alert,
121+
)
122+
123+
124+
class AlertsWithRawResponse:
125+
def __init__(self, alerts: Alerts) -> None:
126+
self._alerts = alerts
127+
128+
self.enable = _legacy_response.to_raw_response_wrapper(
129+
alerts.enable,
130+
)
131+
132+
133+
class AsyncAlertsWithRawResponse:
134+
def __init__(self, alerts: AsyncAlerts) -> None:
135+
self._alerts = alerts
136+
137+
self.enable = _legacy_response.async_to_raw_response_wrapper(
138+
alerts.enable,
139+
)
140+
141+
142+
class AlertsWithStreamingResponse:
143+
def __init__(self, alerts: Alerts) -> None:
144+
self._alerts = alerts
145+
146+
self.enable = to_streamed_response_wrapper(
147+
alerts.enable,
148+
)
149+
150+
151+
class AsyncAlertsWithStreamingResponse:
152+
def __init__(self, alerts: AsyncAlerts) -> None:
153+
self._alerts = alerts
154+
155+
self.enable = async_to_streamed_response_wrapper(
156+
alerts.enable,
157+
)

0 commit comments

Comments
 (0)