Skip to content

feat(api): api update #580

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
Mar 7, 2025
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: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-a2c1aa029d1e72a5fc7d3c6cd431479888ebd9a379683a2c8630da48437baa4f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6797b438a8e6a6856e28f4304a5a3c81bb67e74fa2d6fcc20e734880c725295a.yml
48 changes: 6 additions & 42 deletions src/orb/resources/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,7 @@ def create_for_customer(
customer_id: str,
*,
currency: str,
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"],
thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | 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.
Expand Down Expand Up @@ -286,13 +280,7 @@ def create_for_external_customer(
external_customer_id: str,
*,
currency: str,
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"],
thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | 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.
Expand Down Expand Up @@ -359,13 +347,7 @@ def create_for_subscription(
subscription_id: str,
*,
thresholds: Iterable[alert_create_for_subscription_params.Threshold],
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["usage_exceeded", "cost_exceeded"],
metric_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.
Expand Down Expand Up @@ -708,13 +690,7 @@ async def create_for_customer(
customer_id: str,
*,
currency: str,
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"],
thresholds: Optional[Iterable[alert_create_for_customer_params.Threshold]] | 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.
Expand Down Expand Up @@ -779,13 +755,7 @@ async def create_for_external_customer(
external_customer_id: str,
*,
currency: str,
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"],
thresholds: Optional[Iterable[alert_create_for_external_customer_params.Threshold]] | 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.
Expand Down Expand Up @@ -852,13 +822,7 @@ async def create_for_subscription(
subscription_id: str,
*,
thresholds: Iterable[alert_create_for_subscription_params.Threshold],
type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
],
type: Literal["usage_exceeded", "cost_exceeded"],
metric_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.
Expand Down
4 changes: 2 additions & 2 deletions src/orb/types/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ class Alert(BaseModel):
"""

type: Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
"usage_exceeded",
"cost_exceeded",
]
"""The type of alert. This must be a valid alert type."""
10 changes: 1 addition & 9 deletions src/orb/types/alert_create_for_customer_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ class AlertCreateForCustomerParams(TypedDict, total=False):
currency: Required[str]
"""The case sensitive currency or custom pricing unit to use for this alert."""

type: Required[
Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
]
]
type: Required[Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"]]
"""The type of alert to create. This must be a valid alert type."""

thresholds: Optional[Iterable[Threshold]]
Expand Down
10 changes: 1 addition & 9 deletions src/orb/types/alert_create_for_external_customer_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ class AlertCreateForExternalCustomerParams(TypedDict, total=False):
currency: Required[str]
"""The case sensitive currency or custom pricing unit to use for this alert."""

type: Required[
Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
]
]
type: Required[Literal["credit_balance_depleted", "credit_balance_dropped", "credit_balance_recovered"]]
"""The type of alert to create. This must be a valid alert type."""

thresholds: Optional[Iterable[Threshold]]
Expand Down
10 changes: 1 addition & 9 deletions src/orb/types/alert_create_for_subscription_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ class AlertCreateForSubscriptionParams(TypedDict, total=False):
thresholds: Required[Iterable[Threshold]]
"""The thresholds that define the values at which the alert will be triggered."""

type: Required[
Literal[
"usage_exceeded",
"cost_exceeded",
"credit_balance_depleted",
"credit_balance_dropped",
"credit_balance_recovered",
]
]
type: Required[Literal["usage_exceeded", "cost_exceeded"]]
"""The type of alert to create. This must be a valid alert type."""

metric_id: Optional[str]
Expand Down
40 changes: 20 additions & 20 deletions tests/api_resources/test_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def test_method_create_for_customer(self, client: Orb) -> None:
alert = client.alerts.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)
assert_matches_type(Alert, alert, path=["response"])

Expand All @@ -161,7 +161,7 @@ def test_method_create_for_customer_with_all_params(self, client: Orb) -> None:
alert = client.alerts.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
thresholds=[{"value": 0}],
)
assert_matches_type(Alert, alert, path=["response"])
Expand All @@ -171,7 +171,7 @@ def test_raw_response_create_for_customer(self, client: Orb) -> None:
response = client.alerts.with_raw_response.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

assert response.is_closed is True
Expand All @@ -184,7 +184,7 @@ def test_streaming_response_create_for_customer(self, client: Orb) -> None:
with client.alerts.with_streaming_response.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -200,15 +200,15 @@ def test_path_params_create_for_customer(self, client: Orb) -> None:
client.alerts.with_raw_response.create_for_customer(
customer_id="",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

@parametrize
def test_method_create_for_external_customer(self, client: Orb) -> None:
alert = client.alerts.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)
assert_matches_type(Alert, alert, path=["response"])

Expand All @@ -217,7 +217,7 @@ def test_method_create_for_external_customer_with_all_params(self, client: Orb)
alert = client.alerts.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
thresholds=[{"value": 0}],
)
assert_matches_type(Alert, alert, path=["response"])
Expand All @@ -227,7 +227,7 @@ def test_raw_response_create_for_external_customer(self, client: Orb) -> None:
response = client.alerts.with_raw_response.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

assert response.is_closed is True
Expand All @@ -240,7 +240,7 @@ def test_streaming_response_create_for_external_customer(self, client: Orb) -> N
with client.alerts.with_streaming_response.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -256,7 +256,7 @@ def test_path_params_create_for_external_customer(self, client: Orb) -> None:
client.alerts.with_raw_response.create_for_external_customer(
external_customer_id="",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

@parametrize
Expand Down Expand Up @@ -546,7 +546,7 @@ async def test_method_create_for_customer(self, async_client: AsyncOrb) -> None:
alert = await async_client.alerts.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)
assert_matches_type(Alert, alert, path=["response"])

Expand All @@ -555,7 +555,7 @@ async def test_method_create_for_customer_with_all_params(self, async_client: As
alert = await async_client.alerts.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
thresholds=[{"value": 0}],
)
assert_matches_type(Alert, alert, path=["response"])
Expand All @@ -565,7 +565,7 @@ async def test_raw_response_create_for_customer(self, async_client: AsyncOrb) ->
response = await async_client.alerts.with_raw_response.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

assert response.is_closed is True
Expand All @@ -578,7 +578,7 @@ async def test_streaming_response_create_for_customer(self, async_client: AsyncO
async with async_client.alerts.with_streaming_response.create_for_customer(
customer_id="customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -594,15 +594,15 @@ async def test_path_params_create_for_customer(self, async_client: AsyncOrb) ->
await async_client.alerts.with_raw_response.create_for_customer(
customer_id="",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

@parametrize
async def test_method_create_for_external_customer(self, async_client: AsyncOrb) -> None:
alert = await async_client.alerts.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)
assert_matches_type(Alert, alert, path=["response"])

Expand All @@ -611,7 +611,7 @@ async def test_method_create_for_external_customer_with_all_params(self, async_c
alert = await async_client.alerts.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
thresholds=[{"value": 0}],
)
assert_matches_type(Alert, alert, path=["response"])
Expand All @@ -621,7 +621,7 @@ async def test_raw_response_create_for_external_customer(self, async_client: Asy
response = await async_client.alerts.with_raw_response.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

assert response.is_closed is True
Expand All @@ -634,7 +634,7 @@ async def test_streaming_response_create_for_external_customer(self, async_clien
async with async_client.alerts.with_streaming_response.create_for_external_customer(
external_customer_id="external_customer_id",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -650,7 +650,7 @@ async def test_path_params_create_for_external_customer(self, async_client: Asyn
await async_client.alerts.with_raw_response.create_for_external_customer(
external_customer_id="",
currency="currency",
type="usage_exceeded",
type="credit_balance_depleted",
)

@parametrize
Expand Down