Skip to content

Commit f123127

Browse files
feat(api): codegen changes (#355)
1 parent f83b162 commit f123127

12 files changed

+485
-125
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 91
1+
configured_endpoints: 93
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5083c44a1414120feda9b5c06490ce6e3125836645b45c6d2cca6ed73897288e.yml

api.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,15 @@ Methods:
242242
Types:
243243

244244
```python
245-
from orb.types import MetricCreateResponse, MetricListResponse, MetricFetchResponse
245+
from orb.types import BillableMetric
246246
```
247247

248248
Methods:
249249

250-
- <code title="post /metrics">client.metrics.<a href="./src/orb/resources/metrics.py">create</a>(\*\*<a href="src/orb/types/metric_create_params.py">params</a>) -> <a href="./src/orb/types/metric_create_response.py">MetricCreateResponse</a></code>
251-
- <code title="get /metrics">client.metrics.<a href="./src/orb/resources/metrics.py">list</a>(\*\*<a href="src/orb/types/metric_list_params.py">params</a>) -> <a href="./src/orb/types/metric_list_response.py">SyncPage[MetricListResponse]</a></code>
252-
- <code title="get /metrics/{metric_id}">client.metrics.<a href="./src/orb/resources/metrics.py">fetch</a>(metric_id) -> <a href="./src/orb/types/metric_fetch_response.py">MetricFetchResponse</a></code>
250+
- <code title="post /metrics">client.metrics.<a href="./src/orb/resources/metrics.py">create</a>(\*\*<a href="src/orb/types/metric_create_params.py">params</a>) -> <a href="./src/orb/types/billable_metric.py">BillableMetric</a></code>
251+
- <code title="put /metrics/{metric_id}">client.metrics.<a href="./src/orb/resources/metrics.py">update</a>(metric_id, \*\*<a href="src/orb/types/metric_update_params.py">params</a>) -> <a href="./src/orb/types/billable_metric.py">BillableMetric</a></code>
252+
- <code title="get /metrics">client.metrics.<a href="./src/orb/resources/metrics.py">list</a>(\*\*<a href="src/orb/types/metric_list_params.py">params</a>) -> <a href="./src/orb/types/billable_metric.py">SyncPage[BillableMetric]</a></code>
253+
- <code title="get /metrics/{metric_id}">client.metrics.<a href="./src/orb/resources/metrics.py">fetch</a>(metric_id) -> <a href="./src/orb/types/billable_metric.py">BillableMetric</a></code>
253254

254255
# Plans
255256

@@ -346,6 +347,7 @@ from orb.types import Alert
346347
Methods:
347348

348349
- <code title="get /alerts/{alert_id}">client.alerts.<a href="./src/orb/resources/alerts.py">retrieve</a>(alert_id) -> <a href="./src/orb/types/alert.py">Alert</a></code>
350+
- <code title="put /alerts/{alert_configuration_id}">client.alerts.<a href="./src/orb/resources/alerts.py">update</a>(alert_configuration_id, \*\*<a href="src/orb/types/alert_update_params.py">params</a>) -> <a href="./src/orb/types/alert.py">Alert</a></code>
349351
- <code title="get /alerts">client.alerts.<a href="./src/orb/resources/alerts.py">list</a>(\*\*<a href="src/orb/types/alert_list_params.py">params</a>) -> <a href="./src/orb/types/alert.py">SyncPage[Alert]</a></code>
350352
- <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>
351353
- <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>

src/orb/resources/alerts.py

+105
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .. import _legacy_response
1212
from ..types import (
1313
alert_list_params,
14+
alert_update_params,
1415
alert_create_for_customer_params,
1516
alert_create_for_subscription_params,
1617
alert_create_for_external_customer_params,
@@ -72,6 +73,52 @@ def retrieve(
7273
cast_to=Alert,
7374
)
7475

76+
def update(
77+
self,
78+
alert_configuration_id: str,
79+
*,
80+
thresholds: Iterable[alert_update_params.Threshold],
81+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
82+
# The extra values given here take precedence over values defined on the client or passed to this method.
83+
extra_headers: Headers | None = None,
84+
extra_query: Query | None = None,
85+
extra_body: Body | None = None,
86+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
87+
idempotency_key: str | None = None,
88+
) -> Alert:
89+
"""
90+
This endpoint updates the thresholds of an alert.
91+
92+
Args:
93+
thresholds: The thresholds that define the values at which the alert will be triggered.
94+
95+
extra_headers: Send extra headers
96+
97+
extra_query: Add additional query parameters to the request
98+
99+
extra_body: Add additional JSON properties to the request
100+
101+
timeout: Override the client-level default timeout for this request, in seconds
102+
103+
idempotency_key: Specify a custom idempotency key for this request
104+
"""
105+
if not alert_configuration_id:
106+
raise ValueError(
107+
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
108+
)
109+
return self._put(
110+
f"/alerts/{alert_configuration_id}",
111+
body=maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams),
112+
options=make_request_options(
113+
extra_headers=extra_headers,
114+
extra_query=extra_query,
115+
extra_body=extra_body,
116+
timeout=timeout,
117+
idempotency_key=idempotency_key,
118+
),
119+
cast_to=Alert,
120+
)
121+
75122
def list(
76123
self,
77124
*,
@@ -496,6 +543,52 @@ async def retrieve(
496543
cast_to=Alert,
497544
)
498545

546+
async def update(
547+
self,
548+
alert_configuration_id: str,
549+
*,
550+
thresholds: Iterable[alert_update_params.Threshold],
551+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
552+
# The extra values given here take precedence over values defined on the client or passed to this method.
553+
extra_headers: Headers | None = None,
554+
extra_query: Query | None = None,
555+
extra_body: Body | None = None,
556+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
557+
idempotency_key: str | None = None,
558+
) -> Alert:
559+
"""
560+
This endpoint updates the thresholds of an alert.
561+
562+
Args:
563+
thresholds: The thresholds that define the values at which the alert will be triggered.
564+
565+
extra_headers: Send extra headers
566+
567+
extra_query: Add additional query parameters to the request
568+
569+
extra_body: Add additional JSON properties to the request
570+
571+
timeout: Override the client-level default timeout for this request, in seconds
572+
573+
idempotency_key: Specify a custom idempotency key for this request
574+
"""
575+
if not alert_configuration_id:
576+
raise ValueError(
577+
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
578+
)
579+
return await self._put(
580+
f"/alerts/{alert_configuration_id}",
581+
body=await async_maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams),
582+
options=make_request_options(
583+
extra_headers=extra_headers,
584+
extra_query=extra_query,
585+
extra_body=extra_body,
586+
timeout=timeout,
587+
idempotency_key=idempotency_key,
588+
),
589+
cast_to=Alert,
590+
)
591+
499592
def list(
500593
self,
501594
*,
@@ -885,6 +978,9 @@ def __init__(self, alerts: Alerts) -> None:
885978
self.retrieve = _legacy_response.to_raw_response_wrapper(
886979
alerts.retrieve,
887980
)
981+
self.update = _legacy_response.to_raw_response_wrapper(
982+
alerts.update,
983+
)
888984
self.list = _legacy_response.to_raw_response_wrapper(
889985
alerts.list,
890986
)
@@ -912,6 +1008,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
9121008
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
9131009
alerts.retrieve,
9141010
)
1011+
self.update = _legacy_response.async_to_raw_response_wrapper(
1012+
alerts.update,
1013+
)
9151014
self.list = _legacy_response.async_to_raw_response_wrapper(
9161015
alerts.list,
9171016
)
@@ -939,6 +1038,9 @@ def __init__(self, alerts: Alerts) -> None:
9391038
self.retrieve = to_streamed_response_wrapper(
9401039
alerts.retrieve,
9411040
)
1041+
self.update = to_streamed_response_wrapper(
1042+
alerts.update,
1043+
)
9421044
self.list = to_streamed_response_wrapper(
9431045
alerts.list,
9441046
)
@@ -966,6 +1068,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
9661068
self.retrieve = async_to_streamed_response_wrapper(
9671069
alerts.retrieve,
9681070
)
1071+
self.update = async_to_streamed_response_wrapper(
1072+
alerts.update,
1073+
)
9691074
self.list = async_to_streamed_response_wrapper(
9701075
alerts.list,
9711076
)

0 commit comments

Comments
 (0)