From 0694d785b7ce3a5e020923ee2aff8b801200a7ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 19:47:35 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- src/orb/resources/events/backfills.py | 12 +++++--- src/orb/resources/events/events.py | 8 +++--- src/orb/types/alert.py | 41 +++++++++++++++++++++++---- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0b824ed2..7dd05a09 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c5fe55b056b10d6581c877beb0639a8f0a623e52fd9778e56fab8a86439bd31b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-52bd3046e73f201c4d08edfa92756791c015be907691a7893f8e7782cc2aea6f.yml diff --git a/src/orb/resources/events/backfills.py b/src/orb/resources/events/backfills.py index 112f7807..a7894d16 100644 --- a/src/orb/resources/events/backfills.py +++ b/src/orb/resources/events/backfills.py @@ -97,8 +97,10 @@ def create( only affect events for that customer. If neither is specified, the backfill will affect all customers. - When `replace_existing_events` is `true`, the field `filter` can be optionally - added which enables filtering using + When `replace_existing_events` is `true`, this indicates that existing events in + the timeframe should no longer be counted towards invoiced usage. In this + scenario, the parameter `filter` can be optionally added which enables filtering + using [computed properties](../guides/extensibility/advanced-metrics#computed-properties). The expressiveness of computed properties allows you to deprecate existing events based on both a period of time and specific property values. @@ -407,8 +409,10 @@ async def create( only affect events for that customer. If neither is specified, the backfill will affect all customers. - When `replace_existing_events` is `true`, the field `filter` can be optionally - added which enables filtering using + When `replace_existing_events` is `true`, this indicates that existing events in + the timeframe should no longer be counted towards invoiced usage. In this + scenario, the parameter `filter` can be optionally added which enables filtering + using [computed properties](../guides/extensibility/advanced-metrics#computed-properties). The expressiveness of computed properties allows you to deprecate existing events based on both a period of time and specific property values. diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index 3d4efed8..31f731ad 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -211,8 +211,8 @@ def deprecate( call to a payment gateway failed and the user should not be billed) If you want to only change specific properties of an event, but keep the event - as part of the billing calculation, use the [Amend single event](amend-event) - endpoint instead. + as part of the billing calculation, use the [Amend event](amend-event) endpoint + instead. This API is always audit-safe. The process will still retain the deprecated event, though it will be ignored for billing calculations. For auditing and data @@ -760,8 +760,8 @@ async def deprecate( call to a payment gateway failed and the user should not be billed) If you want to only change specific properties of an event, but keep the event - as part of the billing calculation, use the [Amend single event](amend-event) - endpoint instead. + as part of the billing calculation, use the [Amend event](amend-event) endpoint + instead. This API is always audit-safe. The process will still retain the deprecated event, though it will be ignored for billing calculations. For auditing and data diff --git a/src/orb/types/alert.py b/src/orb/types/alert.py index 7a7dd4b2..0ef04360 100644 --- a/src/orb/types/alert.py +++ b/src/orb/types/alert.py @@ -1,12 +1,41 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["Alert", "Threshold"] +__all__ = ["Alert", "Customer", "Metric", "Plan", "Subscription", "Threshold"] + + +class Customer(BaseModel): + id: str + + external_customer_id: Optional[str] = None + + +class Metric(BaseModel): + id: str + + +class Plan(BaseModel): + id: Optional[str] = None + + external_plan_id: Optional[str] = None + """ + An optional user-defined ID for this plan resource, used throughout the system + as an alias for this Plan. Use this field to identify a plan by an existing + identifier in your system. + """ + + name: Optional[str] = None + + plan_version: str + + +class Subscription(BaseModel): + id: str class Threshold(BaseModel): @@ -28,19 +57,19 @@ class Alert(BaseModel): currency: Optional[str] = None """The name of the currency the credit balance or invoice cost is denominated in.""" - customer: Optional[Dict[str, Optional[str]]] = None + customer: Optional[Customer] = None """The customer the alert applies to.""" enabled: bool """Whether the alert is enabled or disabled.""" - metric: Optional[Dict[str, Optional[str]]] = None + metric: Optional[Metric] = None """The metric the alert applies to.""" - plan: Optional[Dict[str, Optional[str]]] = None + plan: Optional[Plan] = None """The plan the alert applies to.""" - subscription: Optional[Dict[str, Optional[str]]] = None + subscription: Optional[Subscription] = None """The subscription the alert applies to.""" thresholds: Optional[List[Threshold]] = None