Skip to content

Commit 17a06ae

Browse files
feat(client)!: breaking change to re-use types
A number of types that were previously defined in-line at each call site have now been declared as shareable types. This has the benefit of greatly reducing the number of duplicated definitions of the same types, but is also a breaking change since these types will be moving to a shared single definition. A summary of the new types is below: Billing Configuration Models - Address - BillingCycleAnchorConfiguration - BillingCycleConfiguration - FixedFeeQuantityScheduleEntry - FixedFeeQuantityTransition - CustomExpiration - SubLineItemGrouping Pricing Models (Base) - Price - PriceUnitPrice - PricePackagePrice - PriceMatrixPrice - PriceTieredPrice - PriceTieredBPSPrice - PriceBPSPrice - PriceBulkBPSPrice - PriceBulkPrice - PriceInterval Advanced Pricing Models - PriceThresholdTotalAmountPrice - PriceTieredPackagePrice - PriceTieredWithMinimumPrice - PricePackageWithAllocationPrice - PriceMatrixWithAllocationPrice - PriceTieredWithProrationPrice - PriceUnitWithProrationPrice - PriceGroupedAllocationPrice - PriceMatrixWithDisplayNamePrice Discount and Adjustment Models - AmountDiscount - PercentageDiscount - UsageDiscount - TrialDiscount - Discount - CouponRedemption (formerly SubscriptionRedeemedCoupon) - TransformPriceFilter - AdjustmentInterval - AdjustmentIntervalAdjustment Monetary Adjustment Models - MonetaryAmountDiscountAdjustment - MonetaryMaximumAdjustment - MonetaryMinimumAdjustment - MonetaryPercentageDiscountAdjustment - MonetaryUsageDiscountAdjustment Plan Phase Adjustment Models - PlanPhaseAmountDiscountAdjustment - PlanPhaseMaximumAdjustment - PlanPhaseMinimumAdjustment - PlanPhasePercentageDiscountAdjustment - PlanPhaseUsageDiscountAdjustment Limit Models - Maximum (formerly PlanMaximum) - Minimum (formerly PlanMinimum) - MinimumInterval (formerly SubscriptionMinimumInterval) - MaximumInterval (formerly SubscriptionMaximumInterval) Cost and Allocation Models - AggregatedCost - PerPriceCost - Allocation - SubscriptionTrialInfo Configuration Parameter Models - BPSConfigParam - BulkBPSConfigParam - BulkConfigParam - MatrixConfigParam - PackageConfigParam - TieredBPSConfigParam - TieredConfigParam - UnitConfigParam Reference Models - CustomerMinified - SubscriptionMinified - InvoiceTiny - CreditNoteTiny - ItemSlim - BillableMetricTiny - TaxAmount Dimensional Pricing Models - DimensionalPriceConfiguration - MatrixValue
1 parent 89ce8ec commit 17a06ae

25 files changed

+13804
-77939
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 115
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-fee4c7438579fd72ae7c08ad11cc502da279ad3cccfe2235b18afcacc91ad0d9.yml
33
openapi_spec_hash: dc9d553a388715ba22d873aee54a3ed1
4-
config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31
4+
config_hash: 38d4539e31b962c34d7ceb224b161855

api.md

Lines changed: 188 additions & 28 deletions
Large diffs are not rendered by default.

src/index.ts

Lines changed: 210 additions & 42 deletions
Large diffs are not rendered by default.

src/resources/alerts.ts

Lines changed: 20 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { APIResource } from '../resource';
44
import { isRequestOptions } from '../core';
55
import * as Core from '../core';
6+
import * as Shared from './shared';
67
import { Page, type PageParams } from '../pagination';
78

89
export class Alerts extends APIResource {
@@ -187,7 +188,7 @@ export interface Alert {
187188
/**
188189
* The customer the alert applies to.
189190
*/
190-
customer: Alert.Customer | null;
191+
customer: Shared.CustomerMinified | null;
191192

192193
/**
193194
* Whether the alert is enabled or disabled.
@@ -207,13 +208,13 @@ export interface Alert {
207208
/**
208209
* The subscription the alert applies to.
209210
*/
210-
subscription: Alert.Subscription | null;
211+
subscription: Shared.SubscriptionMinified | null;
211212

212213
/**
213214
* The thresholds that define the conditions under which the alert will be
214215
* triggered.
215216
*/
216-
thresholds: Array<Alert.Threshold> | null;
217+
thresholds: Array<Threshold> | null;
217218

218219
/**
219220
* The type of alert. This must be a valid alert type.
@@ -233,15 +234,6 @@ export interface Alert {
233234
}
234235

235236
export namespace Alert {
236-
/**
237-
* The customer the alert applies to.
238-
*/
239-
export interface Customer {
240-
id: string;
241-
242-
external_customer_id: string | null;
243-
}
244-
245237
/**
246238
* The metric the alert applies to.
247239
*/
@@ -267,26 +259,6 @@ export namespace Alert {
267259
plan_version: string;
268260
}
269261

270-
/**
271-
* The subscription the alert applies to.
272-
*/
273-
export interface Subscription {
274-
id: string;
275-
}
276-
277-
/**
278-
* Thresholds are used to define the conditions under which an alert will be
279-
* triggered.
280-
*/
281-
export interface Threshold {
282-
/**
283-
* The value at which an alert will fire. For credit balance alerts, the alert will
284-
* fire at or below this value. For usage and cost alerts, the alert will fire at
285-
* or above this value.
286-
*/
287-
value: number;
288-
}
289-
290262
/**
291263
* Alert status is used to determine if an alert is currently in-alert or not.
292264
*/
@@ -303,26 +275,24 @@ export namespace Alert {
303275
}
304276
}
305277

306-
export interface AlertUpdateParams {
278+
/**
279+
* Thresholds are used to define the conditions under which an alert will be
280+
* triggered.
281+
*/
282+
export interface Threshold {
307283
/**
308-
* The thresholds that define the values at which the alert will be triggered.
284+
* The value at which an alert will fire. For credit balance alerts, the alert will
285+
* fire at or below this value. For usage and cost alerts, the alert will fire at
286+
* or above this value.
309287
*/
310-
thresholds: Array<AlertUpdateParams.Threshold>;
288+
value: number;
311289
}
312290

313-
export namespace AlertUpdateParams {
291+
export interface AlertUpdateParams {
314292
/**
315-
* Thresholds are used to define the conditions under which an alert will be
316-
* triggered.
293+
* The thresholds that define the values at which the alert will be triggered.
317294
*/
318-
export interface Threshold {
319-
/**
320-
* The value at which an alert will fire. For credit balance alerts, the alert will
321-
* fire at or below this value. For usage and cost alerts, the alert will fire at
322-
* or above this value.
323-
*/
324-
value: number;
325-
}
295+
thresholds: Array<Threshold>;
326296
}
327297

328298
export interface AlertListParams extends PageParams {
@@ -364,22 +334,7 @@ export interface AlertCreateForCustomerParams {
364334
/**
365335
* The thresholds that define the values at which the alert will be triggered.
366336
*/
367-
thresholds?: Array<AlertCreateForCustomerParams.Threshold> | null;
368-
}
369-
370-
export namespace AlertCreateForCustomerParams {
371-
/**
372-
* Thresholds are used to define the conditions under which an alert will be
373-
* triggered.
374-
*/
375-
export interface Threshold {
376-
/**
377-
* The value at which an alert will fire. For credit balance alerts, the alert will
378-
* fire at or below this value. For usage and cost alerts, the alert will fire at
379-
* or above this value.
380-
*/
381-
value: number;
382-
}
337+
thresholds?: Array<Threshold> | null;
383338
}
384339

385340
export interface AlertCreateForExternalCustomerParams {
@@ -396,29 +351,14 @@ export interface AlertCreateForExternalCustomerParams {
396351
/**
397352
* The thresholds that define the values at which the alert will be triggered.
398353
*/
399-
thresholds?: Array<AlertCreateForExternalCustomerParams.Threshold> | null;
400-
}
401-
402-
export namespace AlertCreateForExternalCustomerParams {
403-
/**
404-
* Thresholds are used to define the conditions under which an alert will be
405-
* triggered.
406-
*/
407-
export interface Threshold {
408-
/**
409-
* The value at which an alert will fire. For credit balance alerts, the alert will
410-
* fire at or below this value. For usage and cost alerts, the alert will fire at
411-
* or above this value.
412-
*/
413-
value: number;
414-
}
354+
thresholds?: Array<Threshold> | null;
415355
}
416356

417357
export interface AlertCreateForSubscriptionParams {
418358
/**
419359
* The thresholds that define the values at which the alert will be triggered.
420360
*/
421-
thresholds: Array<AlertCreateForSubscriptionParams.Threshold>;
361+
thresholds: Array<Threshold>;
422362

423363
/**
424364
* The type of alert to create. This must be a valid alert type.
@@ -431,21 +371,6 @@ export interface AlertCreateForSubscriptionParams {
431371
metric_id?: string | null;
432372
}
433373

434-
export namespace AlertCreateForSubscriptionParams {
435-
/**
436-
* Thresholds are used to define the conditions under which an alert will be
437-
* triggered.
438-
*/
439-
export interface Threshold {
440-
/**
441-
* The value at which an alert will fire. For credit balance alerts, the alert will
442-
* fire at or below this value. For usage and cost alerts, the alert will fire at
443-
* or above this value.
444-
*/
445-
value: number;
446-
}
447-
}
448-
449374
export interface AlertDisableParams {
450375
/**
451376
* Used to update the status of a plan alert scoped to this subscription_id
@@ -465,6 +390,7 @@ Alerts.AlertsPage = AlertsPage;
465390
export declare namespace Alerts {
466391
export {
467392
type Alert as Alert,
393+
type Threshold as Threshold,
468394
AlertsPage as AlertsPage,
469395
type AlertUpdateParams as AlertUpdateParams,
470396
type AlertListParams as AlertListParams,

0 commit comments

Comments
 (0)