Skip to content

feat(api): codegen changes #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2024
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: 91
configured_endpoints: 93
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5083c44a1414120feda9b5c06490ce6e3125836645b45c6d2cca6ed73897288e.yml
10 changes: 6 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,15 @@ Methods:
Types:

```python
from orb.types import MetricCreateResponse, MetricListResponse, MetricFetchResponse
from orb.types import BillableMetric
```

Methods:

- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>

# Plans

Expand Down Expand Up @@ -339,6 +340,7 @@ from orb.types import Alert
Methods:

- <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>
- <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>
- <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>
- <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>
Expand Down
105 changes: 105 additions & 0 deletions src/orb/resources/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .. import _legacy_response
from ..types import (
alert_list_params,
alert_update_params,
alert_create_for_customer_params,
alert_create_for_subscription_params,
alert_create_for_external_customer_params,
Expand Down Expand Up @@ -72,6 +73,52 @@ def retrieve(
cast_to=Alert,
)

def update(
self,
alert_configuration_id: str,
*,
thresholds: Iterable[alert_update_params.Threshold],
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Alert:
"""
This endpoint updates the thresholds of an alert.

Args:
thresholds: The thresholds that define the values at which the alert will be triggered.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not alert_configuration_id:
raise ValueError(
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
)
return self._put(
f"/alerts/{alert_configuration_id}",
body=maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=Alert,
)

def list(
self,
*,
Expand Down Expand Up @@ -496,6 +543,52 @@ async def retrieve(
cast_to=Alert,
)

async def update(
self,
alert_configuration_id: str,
*,
thresholds: Iterable[alert_update_params.Threshold],
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Alert:
"""
This endpoint updates the thresholds of an alert.

Args:
thresholds: The thresholds that define the values at which the alert will be triggered.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not alert_configuration_id:
raise ValueError(
f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}"
)
return await self._put(
f"/alerts/{alert_configuration_id}",
body=await async_maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=Alert,
)

def list(
self,
*,
Expand Down Expand Up @@ -885,6 +978,9 @@ def __init__(self, alerts: Alerts) -> None:
self.retrieve = _legacy_response.to_raw_response_wrapper(
alerts.retrieve,
)
self.update = _legacy_response.to_raw_response_wrapper(
alerts.update,
)
self.list = _legacy_response.to_raw_response_wrapper(
alerts.list,
)
Expand Down Expand Up @@ -912,6 +1008,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
alerts.retrieve,
)
self.update = _legacy_response.async_to_raw_response_wrapper(
alerts.update,
)
self.list = _legacy_response.async_to_raw_response_wrapper(
alerts.list,
)
Expand Down Expand Up @@ -939,6 +1038,9 @@ def __init__(self, alerts: Alerts) -> None:
self.retrieve = to_streamed_response_wrapper(
alerts.retrieve,
)
self.update = to_streamed_response_wrapper(
alerts.update,
)
self.list = to_streamed_response_wrapper(
alerts.list,
)
Expand Down Expand Up @@ -966,6 +1068,9 @@ def __init__(self, alerts: AsyncAlerts) -> None:
self.retrieve = async_to_streamed_response_wrapper(
alerts.retrieve,
)
self.update = async_to_streamed_response_wrapper(
alerts.update,
)
self.list = async_to_streamed_response_wrapper(
alerts.list,
)
Expand Down
Loading