orb-billing 5.48.0 → 5.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +249 -0
- package/core.js +2 -2
- package/core.js.map +1 -1
- package/core.mjs +2 -2
- package/core.mjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +11 -0
- package/index.js.map +1 -1
- package/index.mjs +11 -0
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/alerts.d.ts +140 -3
- package/resources/alerts.d.ts.map +1 -1
- package/resources/alerts.js.map +1 -1
- package/resources/alerts.mjs.map +1 -1
- package/resources/beta/beta.d.ts +738 -7570
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/external-plan-id.d.ts +664 -7572
- package/resources/beta/external-plan-id.d.ts.map +1 -1
- package/resources/coupons/coupons.d.ts +29 -0
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js +21 -0
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs +21 -0
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/coupons/subscriptions.d.ts +10 -0
- package/resources/coupons/subscriptions.d.ts.map +1 -1
- package/resources/coupons/subscriptions.js.map +1 -1
- package/resources/coupons/subscriptions.mjs.map +1 -1
- package/resources/credit-blocks.d.ts +138 -7
- package/resources/credit-blocks.d.ts.map +1 -1
- package/resources/credit-blocks.js +10 -7
- package/resources/credit-blocks.js.map +1 -1
- package/resources/credit-blocks.mjs +10 -7
- package/resources/credit-blocks.mjs.map +1 -1
- package/resources/credit-notes.d.ts +28 -0
- package/resources/credit-notes.d.ts.map +1 -1
- package/resources/credit-notes.js +20 -0
- package/resources/credit-notes.js.map +1 -1
- package/resources/credit-notes.mjs +20 -0
- package/resources/credit-notes.mjs.map +1 -1
- package/resources/customers/credits/credits.d.ts +129 -0
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/ledger.d.ts +34 -20
- package/resources/customers/credits/ledger.d.ts.map +1 -1
- package/resources/customers/credits/ledger.js +28 -14
- package/resources/customers/credits/ledger.js.map +1 -1
- package/resources/customers/credits/ledger.mjs +28 -14
- package/resources/customers/credits/ledger.mjs.map +1 -1
- package/resources/customers/customers.d.ts +89 -6
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +35 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.js +26 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.js.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs +26 -0
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs +16 -0
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs.map +1 -1
- package/resources/events/backfills.d.ts +37 -0
- package/resources/events/backfills.d.ts.map +1 -1
- package/resources/events/backfills.js +29 -0
- package/resources/events/backfills.js.map +1 -1
- package/resources/events/backfills.mjs +29 -0
- package/resources/events/backfills.mjs.map +1 -1
- package/resources/events/events.d.ts +41 -33
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +39 -31
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +39 -31
- package/resources/events/events.mjs.map +1 -1
- package/resources/events/volume.d.ts +7 -0
- package/resources/events/volume.d.ts.map +1 -1
- package/resources/events/volume.js +7 -0
- package/resources/events/volume.js.map +1 -1
- package/resources/events/volume.mjs +7 -0
- package/resources/events/volume.mjs.map +1 -1
- package/resources/invoice-line-items.d.ts +89 -1
- package/resources/invoice-line-items.d.ts.map +1 -1
- package/resources/invoice-line-items.js +12 -0
- package/resources/invoice-line-items.js.map +1 -1
- package/resources/invoice-line-items.mjs +12 -0
- package/resources/invoice-line-items.mjs.map +1 -1
- package/resources/invoices.d.ts +200 -12
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +64 -0
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +64 -0
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.ts +30 -0
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +22 -0
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +22 -0
- package/resources/items.mjs.map +1 -1
- package/resources/licenses/external-licenses.d.ts +13 -1
- package/resources/licenses/external-licenses.d.ts.map +1 -1
- package/resources/licenses/external-licenses.js +12 -0
- package/resources/licenses/external-licenses.js.map +1 -1
- package/resources/licenses/external-licenses.mjs +12 -0
- package/resources/licenses/external-licenses.mjs.map +1 -1
- package/resources/licenses/licenses.d.ts +44 -0
- package/resources/licenses/licenses.d.ts.map +1 -1
- package/resources/licenses/licenses.js +44 -0
- package/resources/licenses/licenses.js.map +1 -1
- package/resources/licenses/licenses.mjs +44 -0
- package/resources/licenses/licenses.mjs.map +1 -1
- package/resources/licenses/usage.d.ts +17 -2
- package/resources/licenses/usage.d.ts.map +1 -1
- package/resources/licenses/usage.js +8 -0
- package/resources/licenses/usage.js.map +1 -1
- package/resources/licenses/usage.mjs +8 -0
- package/resources/licenses/usage.mjs.map +1 -1
- package/resources/metrics.d.ts +42 -5
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js +27 -2
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs +27 -2
- package/resources/metrics.mjs.map +1 -1
- package/resources/plans/external-plan-id.d.ts +6 -2
- package/resources/plans/external-plan-id.d.ts.map +1 -1
- package/resources/plans/external-plan-id.js +2 -2
- package/resources/plans/external-plan-id.mjs +2 -2
- package/resources/plans/migrations.d.ts +42 -0
- package/resources/plans/migrations.d.ts.map +1 -1
- package/resources/plans/migrations.js.map +1 -1
- package/resources/plans/migrations.mjs.map +1 -1
- package/resources/plans/plans.d.ts +382 -3754
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js +2 -2
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs +2 -2
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/external-price-id.d.ts +14 -0
- package/resources/prices/external-price-id.d.ts.map +1 -1
- package/resources/prices/external-price-id.js +14 -0
- package/resources/prices/external-price-id.js.map +1 -1
- package/resources/prices/external-price-id.mjs +14 -0
- package/resources/prices/external-price-id.mjs.map +1 -1
- package/resources/prices/prices.d.ts +1632 -393
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +46 -0
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +46 -0
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/shared.d.ts +922 -52
- package/resources/shared.d.ts.map +1 -1
- package/resources/shared.js.map +1 -1
- package/resources/shared.mjs.map +1 -1
- package/resources/subscription-changes.d.ts +72 -1
- package/resources/subscription-changes.d.ts.map +1 -1
- package/resources/subscription-changes.js.map +1 -1
- package/resources/subscription-changes.mjs.map +1 -1
- package/resources/subscriptions.d.ts +3075 -464
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +111 -0
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +111 -0
- package/resources/subscriptions.mjs.map +1 -1
- package/src/core.ts +2 -2
- package/src/index.ts +12 -0
- package/src/resources/alerts.ts +161 -3
- package/src/resources/beta/beta.ts +828 -8988
- package/src/resources/beta/external-plan-id.ts +745 -8997
- package/src/resources/coupons/coupons.ts +29 -0
- package/src/resources/coupons/subscriptions.ts +10 -0
- package/src/resources/credit-blocks.ts +166 -7
- package/src/resources/credit-notes.ts +28 -0
- package/src/resources/customers/credits/credits.ts +157 -0
- package/src/resources/customers/credits/ledger.ts +34 -20
- package/src/resources/customers/customers.ts +99 -6
- package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +35 -1
- package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +16 -0
- package/src/resources/events/backfills.ts +37 -0
- package/src/resources/events/events.ts +41 -33
- package/src/resources/events/volume.ts +7 -0
- package/src/resources/invoice-line-items.ts +104 -0
- package/src/resources/invoices.ts +215 -11
- package/src/resources/items.ts +30 -0
- package/src/resources/licenses/external-licenses.ts +13 -1
- package/src/resources/licenses/licenses.ts +44 -0
- package/src/resources/licenses/usage.ts +17 -2
- package/src/resources/metrics.ts +43 -5
- package/src/resources/plans/external-plan-id.ts +7 -2
- package/src/resources/plans/migrations.ts +42 -0
- package/src/resources/plans/plans.ts +456 -4482
- package/src/resources/prices/external-price-id.ts +14 -0
- package/src/resources/prices/prices.ts +1743 -264
- package/src/resources/shared.ts +1172 -50
- package/src/resources/subscription-changes.ts +88 -1
- package/src/resources/subscriptions.ts +4707 -1585
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -267,6 +267,12 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
267
267
|
* ## Limits
|
|
268
268
|
*
|
|
269
269
|
* By default, Orb limits the number of subscriptions per customer to 100.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const mutatedSubscription =
|
|
274
|
+
* await client.subscriptions.create();
|
|
275
|
+
* ```
|
|
270
276
|
*/
|
|
271
277
|
create(body, options) {
|
|
272
278
|
return this._client.post('/subscriptions', { body, ...options });
|
|
@@ -275,6 +281,13 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
275
281
|
* This endpoint can be used to update the `metadata`, `net terms`,
|
|
276
282
|
* `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
|
|
277
283
|
* on a subscription.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* const subscription = await client.subscriptions.update(
|
|
288
|
+
* 'subscription_id',
|
|
289
|
+
* );
|
|
290
|
+
* ```
|
|
278
291
|
*/
|
|
279
292
|
update(subscriptionId, body, options) {
|
|
280
293
|
return this._client.put(`/subscriptions/${subscriptionId}`, { body, ...options });
|
|
@@ -347,6 +360,14 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
347
360
|
* Orb will void the intervening invoice and generate a new one based on the new
|
|
348
361
|
* dates for the subscription. See the section on
|
|
349
362
|
* [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const mutatedSubscription =
|
|
367
|
+
* await client.subscriptions.cancel('subscription_id', {
|
|
368
|
+
* cancel_option: 'end_of_subscription_term',
|
|
369
|
+
* });
|
|
370
|
+
* ```
|
|
350
371
|
*/
|
|
351
372
|
cancel(subscriptionId, body, options) {
|
|
352
373
|
return this._client.post(`/subscriptions/${subscriptionId}/cancel`, { body, ...options });
|
|
@@ -354,6 +375,13 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
354
375
|
/**
|
|
355
376
|
* This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
|
|
356
377
|
* given an identifier.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* const subscription = await client.subscriptions.fetch(
|
|
382
|
+
* 'subscription_id',
|
|
383
|
+
* );
|
|
384
|
+
* ```
|
|
357
385
|
*/
|
|
358
386
|
fetch(subscriptionId, options) {
|
|
359
387
|
return this._client.get(`/subscriptions/${subscriptionId}`, options);
|
|
@@ -449,12 +477,29 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
449
477
|
* existing list of transitions can be retrieved using the
|
|
450
478
|
* `fixed_fee_quantity_transitions` property on a subscription’s serialized price
|
|
451
479
|
* intervals.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```ts
|
|
483
|
+
* const mutatedSubscription =
|
|
484
|
+
* await client.subscriptions.priceIntervals(
|
|
485
|
+
* 'subscription_id',
|
|
486
|
+
* );
|
|
487
|
+
* ```
|
|
452
488
|
*/
|
|
453
489
|
priceIntervals(subscriptionId, body, options) {
|
|
454
490
|
return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options });
|
|
455
491
|
}
|
|
456
492
|
/**
|
|
457
493
|
* Redeem a coupon effective at a given time.
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* ```ts
|
|
497
|
+
* const mutatedSubscription =
|
|
498
|
+
* await client.subscriptions.redeemCoupon(
|
|
499
|
+
* 'subscription_id',
|
|
500
|
+
* { change_option: 'requested_date' },
|
|
501
|
+
* );
|
|
502
|
+
* ```
|
|
458
503
|
*/
|
|
459
504
|
redeemCoupon(subscriptionId, body, options) {
|
|
460
505
|
return this._client.post(`/subscriptions/${subscriptionId}/redeem_coupon`, { body, ...options });
|
|
@@ -643,6 +688,15 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
643
688
|
* a plan change, adjusting the customer balance as needed. For details on this
|
|
644
689
|
* behavior, see
|
|
645
690
|
* [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```ts
|
|
694
|
+
* const mutatedSubscription =
|
|
695
|
+
* await client.subscriptions.schedulePlanChange(
|
|
696
|
+
* 'subscription_id',
|
|
697
|
+
* { change_option: 'requested_date' },
|
|
698
|
+
* );
|
|
699
|
+
* ```
|
|
646
700
|
*/
|
|
647
701
|
schedulePlanChange(subscriptionId, body, options) {
|
|
648
702
|
return this._client.post(`/subscriptions/${subscriptionId}/schedule_plan_change`, { body, ...options });
|
|
@@ -650,6 +704,14 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
650
704
|
/**
|
|
651
705
|
* Manually trigger a phase, effective the given date (or the current time, if not
|
|
652
706
|
* specified).
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```ts
|
|
710
|
+
* const mutatedSubscription =
|
|
711
|
+
* await client.subscriptions.triggerPhase(
|
|
712
|
+
* 'subscription_id',
|
|
713
|
+
* );
|
|
714
|
+
* ```
|
|
653
715
|
*/
|
|
654
716
|
triggerPhase(subscriptionId, body, options) {
|
|
655
717
|
return this._client.post(`/subscriptions/${subscriptionId}/trigger_phase`, { body, ...options });
|
|
@@ -661,6 +723,20 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
661
723
|
* To be eligible, the subscription must currently be active and have a future
|
|
662
724
|
* cancellation. This operation will turn on auto-renew, ensuring that the
|
|
663
725
|
* subscription does not end at the currently scheduled cancellation time.
|
|
726
|
+
*
|
|
727
|
+
* Note: uncancellation is a lossy operation. Price intervals that were cut short
|
|
728
|
+
* by the cancellation are extended to infinity (original end dates are lost), and
|
|
729
|
+
* future intervals or phases scheduled after the cancellation time are permanently
|
|
730
|
+
* deleted. For complex subscriptions with phases or scheduled plan changes,
|
|
731
|
+
* consider creating a new plan change instead of uncancelling.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```ts
|
|
735
|
+
* const mutatedSubscription =
|
|
736
|
+
* await client.subscriptions.unscheduleCancellation(
|
|
737
|
+
* 'subscription_id',
|
|
738
|
+
* );
|
|
739
|
+
* ```
|
|
664
740
|
*/
|
|
665
741
|
unscheduleCancellation(subscriptionId, options) {
|
|
666
742
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_cancellation`, options);
|
|
@@ -671,6 +747,15 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
671
747
|
*
|
|
672
748
|
* If there are no updates scheduled, a request validation error will be returned
|
|
673
749
|
* with a 400 status code.
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```ts
|
|
753
|
+
* const mutatedSubscription =
|
|
754
|
+
* await client.subscriptions.unscheduleFixedFeeQuantityUpdates(
|
|
755
|
+
* 'subscription_id',
|
|
756
|
+
* { price_id: 'price_id' },
|
|
757
|
+
* );
|
|
758
|
+
* ```
|
|
674
759
|
*/
|
|
675
760
|
unscheduleFixedFeeQuantityUpdates(subscriptionId, body, options) {
|
|
676
761
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_fixed_fee_quantity_updates`, {
|
|
@@ -681,6 +766,14 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
681
766
|
/**
|
|
682
767
|
* This endpoint can be used to unschedule any pending plan changes on an existing
|
|
683
768
|
* subscription. When called, all upcoming plan changes will be unscheduled.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```ts
|
|
772
|
+
* const mutatedSubscription =
|
|
773
|
+
* await client.subscriptions.unschedulePendingPlanChanges(
|
|
774
|
+
* 'subscription_id',
|
|
775
|
+
* );
|
|
776
|
+
* ```
|
|
684
777
|
*/
|
|
685
778
|
unschedulePendingPlanChanges(subscriptionId, options) {
|
|
686
779
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_pending_plan_changes`, options);
|
|
@@ -700,6 +793,15 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
700
793
|
*
|
|
701
794
|
* If the fee is an in-advance fixed fee, it will also issue an immediate invoice
|
|
702
795
|
* for the difference for the remainder of the billing period.
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```ts
|
|
799
|
+
* const mutatedSubscription =
|
|
800
|
+
* await client.subscriptions.updateFixedFeeQuantity(
|
|
801
|
+
* 'subscription_id',
|
|
802
|
+
* { price_id: 'price_id', quantity: 0 },
|
|
803
|
+
* );
|
|
804
|
+
* ```
|
|
703
805
|
*/
|
|
704
806
|
updateFixedFeeQuantity(subscriptionId, body, options) {
|
|
705
807
|
return this._client.post(`/subscriptions/${subscriptionId}/update_fixed_fee_quantity`, {
|
|
@@ -726,6 +828,15 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
726
828
|
* end date shift (so, e.g., if a plan change is scheduled or an add-on price was
|
|
727
829
|
* added, that change will be pushed back by the same amount of time the trial is
|
|
728
830
|
* extended).
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* ```ts
|
|
834
|
+
* const mutatedSubscription =
|
|
835
|
+
* await client.subscriptions.updateTrial(
|
|
836
|
+
* 'subscription_id',
|
|
837
|
+
* { trial_end_date: '2017-07-21T17:32:28Z' },
|
|
838
|
+
* );
|
|
839
|
+
* ```
|
|
729
840
|
*/
|
|
730
841
|
updateTrial(subscriptionId, body, options) {
|
|
731
842
|
return this._client.post(`/subscriptions/${subscriptionId}/update_trial`, { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAO3C,iDAAsD;AAEtD,MAAa,aAAc,SAAQ,sBAAW;IAC5C
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAO3C,iDAAsD;AAEtD,MAAa,aAAc,SAAQ,sBAAW;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2QG;IACH,MAAM,CACJ,IAA8B,E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4BAA4B,CAC1B,cAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,sBAAsB,CACpB,cAAsB,EACtB,IAA8C,EAC9C,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,4BAA4B,EAAE;YACrF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,WAAW,CACT,cAAsB,EACtB,IAAmC,EACnC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF;AAtrCD,sCAsrCC;AAED,MAAa,iBAAkB,SAAQ,iBAAkB;CAAG;AAA5D,8CAA4D;AAE5D,MAAa,sCAAuC,SAAQ,iBAAuC;CAAG;AAAtG,wFAAsG;AAujXtG,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACpD,aAAa,CAAC,sCAAsC,GAAG,sCAAsC,CAAC"}
|
|
@@ -264,6 +264,12 @@ export class Subscriptions extends APIResource {
|
|
|
264
264
|
* ## Limits
|
|
265
265
|
*
|
|
266
266
|
* By default, Orb limits the number of subscriptions per customer to 100.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const mutatedSubscription =
|
|
271
|
+
* await client.subscriptions.create();
|
|
272
|
+
* ```
|
|
267
273
|
*/
|
|
268
274
|
create(body, options) {
|
|
269
275
|
return this._client.post('/subscriptions', { body, ...options });
|
|
@@ -272,6 +278,13 @@ export class Subscriptions extends APIResource {
|
|
|
272
278
|
* This endpoint can be used to update the `metadata`, `net terms`,
|
|
273
279
|
* `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
|
|
274
280
|
* on a subscription.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* const subscription = await client.subscriptions.update(
|
|
285
|
+
* 'subscription_id',
|
|
286
|
+
* );
|
|
287
|
+
* ```
|
|
275
288
|
*/
|
|
276
289
|
update(subscriptionId, body, options) {
|
|
277
290
|
return this._client.put(`/subscriptions/${subscriptionId}`, { body, ...options });
|
|
@@ -344,6 +357,14 @@ export class Subscriptions extends APIResource {
|
|
|
344
357
|
* Orb will void the intervening invoice and generate a new one based on the new
|
|
345
358
|
* dates for the subscription. See the section on
|
|
346
359
|
* [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```ts
|
|
363
|
+
* const mutatedSubscription =
|
|
364
|
+
* await client.subscriptions.cancel('subscription_id', {
|
|
365
|
+
* cancel_option: 'end_of_subscription_term',
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
347
368
|
*/
|
|
348
369
|
cancel(subscriptionId, body, options) {
|
|
349
370
|
return this._client.post(`/subscriptions/${subscriptionId}/cancel`, { body, ...options });
|
|
@@ -351,6 +372,13 @@ export class Subscriptions extends APIResource {
|
|
|
351
372
|
/**
|
|
352
373
|
* This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
|
|
353
374
|
* given an identifier.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const subscription = await client.subscriptions.fetch(
|
|
379
|
+
* 'subscription_id',
|
|
380
|
+
* );
|
|
381
|
+
* ```
|
|
354
382
|
*/
|
|
355
383
|
fetch(subscriptionId, options) {
|
|
356
384
|
return this._client.get(`/subscriptions/${subscriptionId}`, options);
|
|
@@ -446,12 +474,29 @@ export class Subscriptions extends APIResource {
|
|
|
446
474
|
* existing list of transitions can be retrieved using the
|
|
447
475
|
* `fixed_fee_quantity_transitions` property on a subscription’s serialized price
|
|
448
476
|
* intervals.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```ts
|
|
480
|
+
* const mutatedSubscription =
|
|
481
|
+
* await client.subscriptions.priceIntervals(
|
|
482
|
+
* 'subscription_id',
|
|
483
|
+
* );
|
|
484
|
+
* ```
|
|
449
485
|
*/
|
|
450
486
|
priceIntervals(subscriptionId, body, options) {
|
|
451
487
|
return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options });
|
|
452
488
|
}
|
|
453
489
|
/**
|
|
454
490
|
* Redeem a coupon effective at a given time.
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* const mutatedSubscription =
|
|
495
|
+
* await client.subscriptions.redeemCoupon(
|
|
496
|
+
* 'subscription_id',
|
|
497
|
+
* { change_option: 'requested_date' },
|
|
498
|
+
* );
|
|
499
|
+
* ```
|
|
455
500
|
*/
|
|
456
501
|
redeemCoupon(subscriptionId, body, options) {
|
|
457
502
|
return this._client.post(`/subscriptions/${subscriptionId}/redeem_coupon`, { body, ...options });
|
|
@@ -640,6 +685,15 @@ export class Subscriptions extends APIResource {
|
|
|
640
685
|
* a plan change, adjusting the customer balance as needed. For details on this
|
|
641
686
|
* behavior, see
|
|
642
687
|
* [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```ts
|
|
691
|
+
* const mutatedSubscription =
|
|
692
|
+
* await client.subscriptions.schedulePlanChange(
|
|
693
|
+
* 'subscription_id',
|
|
694
|
+
* { change_option: 'requested_date' },
|
|
695
|
+
* );
|
|
696
|
+
* ```
|
|
643
697
|
*/
|
|
644
698
|
schedulePlanChange(subscriptionId, body, options) {
|
|
645
699
|
return this._client.post(`/subscriptions/${subscriptionId}/schedule_plan_change`, { body, ...options });
|
|
@@ -647,6 +701,14 @@ export class Subscriptions extends APIResource {
|
|
|
647
701
|
/**
|
|
648
702
|
* Manually trigger a phase, effective the given date (or the current time, if not
|
|
649
703
|
* specified).
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```ts
|
|
707
|
+
* const mutatedSubscription =
|
|
708
|
+
* await client.subscriptions.triggerPhase(
|
|
709
|
+
* 'subscription_id',
|
|
710
|
+
* );
|
|
711
|
+
* ```
|
|
650
712
|
*/
|
|
651
713
|
triggerPhase(subscriptionId, body, options) {
|
|
652
714
|
return this._client.post(`/subscriptions/${subscriptionId}/trigger_phase`, { body, ...options });
|
|
@@ -658,6 +720,20 @@ export class Subscriptions extends APIResource {
|
|
|
658
720
|
* To be eligible, the subscription must currently be active and have a future
|
|
659
721
|
* cancellation. This operation will turn on auto-renew, ensuring that the
|
|
660
722
|
* subscription does not end at the currently scheduled cancellation time.
|
|
723
|
+
*
|
|
724
|
+
* Note: uncancellation is a lossy operation. Price intervals that were cut short
|
|
725
|
+
* by the cancellation are extended to infinity (original end dates are lost), and
|
|
726
|
+
* future intervals or phases scheduled after the cancellation time are permanently
|
|
727
|
+
* deleted. For complex subscriptions with phases or scheduled plan changes,
|
|
728
|
+
* consider creating a new plan change instead of uncancelling.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```ts
|
|
732
|
+
* const mutatedSubscription =
|
|
733
|
+
* await client.subscriptions.unscheduleCancellation(
|
|
734
|
+
* 'subscription_id',
|
|
735
|
+
* );
|
|
736
|
+
* ```
|
|
661
737
|
*/
|
|
662
738
|
unscheduleCancellation(subscriptionId, options) {
|
|
663
739
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_cancellation`, options);
|
|
@@ -668,6 +744,15 @@ export class Subscriptions extends APIResource {
|
|
|
668
744
|
*
|
|
669
745
|
* If there are no updates scheduled, a request validation error will be returned
|
|
670
746
|
* with a 400 status code.
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```ts
|
|
750
|
+
* const mutatedSubscription =
|
|
751
|
+
* await client.subscriptions.unscheduleFixedFeeQuantityUpdates(
|
|
752
|
+
* 'subscription_id',
|
|
753
|
+
* { price_id: 'price_id' },
|
|
754
|
+
* );
|
|
755
|
+
* ```
|
|
671
756
|
*/
|
|
672
757
|
unscheduleFixedFeeQuantityUpdates(subscriptionId, body, options) {
|
|
673
758
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_fixed_fee_quantity_updates`, {
|
|
@@ -678,6 +763,14 @@ export class Subscriptions extends APIResource {
|
|
|
678
763
|
/**
|
|
679
764
|
* This endpoint can be used to unschedule any pending plan changes on an existing
|
|
680
765
|
* subscription. When called, all upcoming plan changes will be unscheduled.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* ```ts
|
|
769
|
+
* const mutatedSubscription =
|
|
770
|
+
* await client.subscriptions.unschedulePendingPlanChanges(
|
|
771
|
+
* 'subscription_id',
|
|
772
|
+
* );
|
|
773
|
+
* ```
|
|
681
774
|
*/
|
|
682
775
|
unschedulePendingPlanChanges(subscriptionId, options) {
|
|
683
776
|
return this._client.post(`/subscriptions/${subscriptionId}/unschedule_pending_plan_changes`, options);
|
|
@@ -697,6 +790,15 @@ export class Subscriptions extends APIResource {
|
|
|
697
790
|
*
|
|
698
791
|
* If the fee is an in-advance fixed fee, it will also issue an immediate invoice
|
|
699
792
|
* for the difference for the remainder of the billing period.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```ts
|
|
796
|
+
* const mutatedSubscription =
|
|
797
|
+
* await client.subscriptions.updateFixedFeeQuantity(
|
|
798
|
+
* 'subscription_id',
|
|
799
|
+
* { price_id: 'price_id', quantity: 0 },
|
|
800
|
+
* );
|
|
801
|
+
* ```
|
|
700
802
|
*/
|
|
701
803
|
updateFixedFeeQuantity(subscriptionId, body, options) {
|
|
702
804
|
return this._client.post(`/subscriptions/${subscriptionId}/update_fixed_fee_quantity`, {
|
|
@@ -723,6 +825,15 @@ export class Subscriptions extends APIResource {
|
|
|
723
825
|
* end date shift (so, e.g., if a plan change is scheduled or an add-on price was
|
|
724
826
|
* added, that change will be pushed back by the same amount of time the trial is
|
|
725
827
|
* extended).
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* ```ts
|
|
831
|
+
* const mutatedSubscription =
|
|
832
|
+
* await client.subscriptions.updateTrial(
|
|
833
|
+
* 'subscription_id',
|
|
834
|
+
* { trial_end_date: '2017-07-21T17:32:28Z' },
|
|
835
|
+
* );
|
|
836
|
+
* ```
|
|
726
837
|
*/
|
|
727
838
|
updateTrial(subscriptionId, body, options) {
|
|
728
839
|
return this._client.post(`/subscriptions/${subscriptionId}/update_trial`, { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAOpB,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C
|
|
1
|
+
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAOpB,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2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IACH,4BAA4B,CAC1B,cAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,sBAAsB,CACpB,cAAsB,EACtB,IAA8C,EAC9C,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,4BAA4B,EAAE;YACrF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,WAAW,CACT,cAAsB,EACtB,IAAmC,EACnC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,IAAkB;CAAG;AAE5D,MAAM,OAAO,sCAAuC,SAAQ,IAAuC;CAAG;AAujXtG,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACpD,aAAa,CAAC,sCAAsC,GAAG,sCAAsC,CAAC"}
|
package/src/core.ts
CHANGED
|
@@ -1053,10 +1053,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
|
|
|
1053
1053
|
*/
|
|
1054
1054
|
export const readEnv = (env: string): string | undefined => {
|
|
1055
1055
|
if (typeof process !== 'undefined') {
|
|
1056
|
-
return process.env?.[env]?.trim()
|
|
1056
|
+
return process.env?.[env]?.trim() || undefined;
|
|
1057
1057
|
}
|
|
1058
1058
|
if (typeof Deno !== 'undefined') {
|
|
1059
|
-
return Deno.env?.get?.(env)?.trim();
|
|
1059
|
+
return Deno.env?.get?.(env)?.trim() || undefined;
|
|
1060
1060
|
}
|
|
1061
1061
|
return undefined;
|
|
1062
1062
|
};
|
package/src/index.ts
CHANGED
|
@@ -338,6 +338,18 @@ export class Orb extends Core.APIClient {
|
|
|
338
338
|
fetch: options.fetch,
|
|
339
339
|
});
|
|
340
340
|
|
|
341
|
+
const customHeadersEnv = Core.readEnv('ORB_CUSTOM_HEADERS');
|
|
342
|
+
if (customHeadersEnv) {
|
|
343
|
+
const parsed: Record<string, string> = {};
|
|
344
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
345
|
+
const colon = line.indexOf(':');
|
|
346
|
+
if (colon >= 0) {
|
|
347
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
351
|
+
}
|
|
352
|
+
|
|
341
353
|
this._options = options;
|
|
342
354
|
this.idempotencyHeader = 'Idempotency-Key';
|
|
343
355
|
|
package/src/resources/alerts.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import { isRequestOptions } from '../core';
|
|
5
5
|
import * as Core from '../core';
|
|
6
|
+
import * as AlertsAPI from './alerts';
|
|
6
7
|
import * as Shared from './shared';
|
|
7
8
|
import { Page, type PageParams } from '../pagination';
|
|
8
9
|
|
|
@@ -249,6 +250,18 @@ export interface Alert {
|
|
|
249
250
|
* Minified license type for alert serialization.
|
|
250
251
|
*/
|
|
251
252
|
license_type?: Alert.LicenseType | null;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Filters scoping which prices are included in grouped cost alert evaluation.
|
|
256
|
+
*/
|
|
257
|
+
price_filters?: Array<Alert.PriceFilter> | null;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Per-group threshold overrides. Each override maps a specific combination of
|
|
261
|
+
* grouping_keys values to a replacement threshold list. Only present for grouped
|
|
262
|
+
* cost alerts that have at least one override.
|
|
263
|
+
*/
|
|
264
|
+
threshold_overrides?: Array<Alert.ThresholdOverride> | null;
|
|
252
265
|
}
|
|
253
266
|
|
|
254
267
|
export namespace Alert {
|
|
@@ -298,6 +311,42 @@ export namespace Alert {
|
|
|
298
311
|
export interface LicenseType {
|
|
299
312
|
id: string;
|
|
300
313
|
}
|
|
314
|
+
|
|
315
|
+
export interface PriceFilter {
|
|
316
|
+
/**
|
|
317
|
+
* The property of the price to filter on.
|
|
318
|
+
*/
|
|
319
|
+
field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Should prices that match the filter be included or excluded.
|
|
323
|
+
*/
|
|
324
|
+
operator: 'includes' | 'excludes';
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The IDs or values that match this filter.
|
|
328
|
+
*/
|
|
329
|
+
values: Array<string>;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* A per-group threshold override on a grouped cost alert.
|
|
334
|
+
*
|
|
335
|
+
* An empty `thresholds` list means the group is silenced (never fires). A
|
|
336
|
+
* non-empty list fully replaces the default thresholds for that group.
|
|
337
|
+
*/
|
|
338
|
+
export interface ThresholdOverride {
|
|
339
|
+
/**
|
|
340
|
+
* The values of the grouping keys that identify this group. The list length
|
|
341
|
+
* matches the alert's grouping_keys.
|
|
342
|
+
*/
|
|
343
|
+
group_values: Array<string>;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The thresholds applied to this group. An empty list means the group is silenced.
|
|
347
|
+
*/
|
|
348
|
+
thresholds: Array<AlertsAPI.Threshold>;
|
|
349
|
+
}
|
|
301
350
|
}
|
|
302
351
|
|
|
303
352
|
/**
|
|
@@ -318,6 +367,59 @@ export interface AlertUpdateParams {
|
|
|
318
367
|
* The thresholds that define the values at which the alert will be triggered.
|
|
319
368
|
*/
|
|
320
369
|
thresholds: Array<Threshold>;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Replaces the price filters on a grouped cost alert; an empty list clears them.
|
|
373
|
+
* Only applicable to cost alerts with grouping_keys. Omit to leave unchanged.
|
|
374
|
+
*/
|
|
375
|
+
price_filters?: Array<AlertUpdateParams.PriceFilter> | null;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Replaces the per-group threshold overrides on a grouped cost alert; an empty
|
|
379
|
+
* list clears them. Only applicable to cost alerts with grouping_keys. Omit to
|
|
380
|
+
* leave unchanged.
|
|
381
|
+
*/
|
|
382
|
+
threshold_overrides?: Array<AlertUpdateParams.ThresholdOverride> | null;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export namespace AlertUpdateParams {
|
|
386
|
+
export interface PriceFilter {
|
|
387
|
+
/**
|
|
388
|
+
* The property of the price to filter on.
|
|
389
|
+
*/
|
|
390
|
+
field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Should prices that match the filter be included or excluded.
|
|
394
|
+
*/
|
|
395
|
+
operator: 'includes' | 'excludes';
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* The IDs or values that match this filter.
|
|
399
|
+
*/
|
|
400
|
+
values: Array<string>;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Per-group threshold override on a grouped cost alert.
|
|
405
|
+
*
|
|
406
|
+
* - An empty `thresholds` list silences alerts for this group (never fires).
|
|
407
|
+
* - A non-empty list fully replaces the default thresholds for this group.
|
|
408
|
+
*/
|
|
409
|
+
export interface ThresholdOverride {
|
|
410
|
+
/**
|
|
411
|
+
* The values of the grouping keys that identify this group. The list length must
|
|
412
|
+
* match the alert's grouping_keys, and values appear in the same order as
|
|
413
|
+
* grouping_keys.
|
|
414
|
+
*/
|
|
415
|
+
group_values: Array<string>;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* The thresholds to apply to this group. An empty list silences alerts for this
|
|
419
|
+
* group. A non-empty list fully replaces the default thresholds for this group.
|
|
420
|
+
*/
|
|
421
|
+
thresholds: Array<AlertsAPI.Threshold>;
|
|
422
|
+
}
|
|
321
423
|
}
|
|
322
424
|
|
|
323
425
|
export interface AlertListParams extends PageParams {
|
|
@@ -390,6 +492,12 @@ export interface AlertCreateForSubscriptionParams {
|
|
|
390
492
|
*/
|
|
391
493
|
type: 'usage_exceeded' | 'cost_exceeded';
|
|
392
494
|
|
|
495
|
+
/**
|
|
496
|
+
* The case sensitive currency or custom pricing unit to use for grouped cost
|
|
497
|
+
* alerts. Required when grouping_keys is set.
|
|
498
|
+
*/
|
|
499
|
+
currency?: string | null;
|
|
500
|
+
|
|
393
501
|
/**
|
|
394
502
|
* The property keys to group cost alerts by. Only applicable for cost_exceeded
|
|
395
503
|
* alerts.
|
|
@@ -402,10 +510,60 @@ export interface AlertCreateForSubscriptionParams {
|
|
|
402
510
|
metric_id?: string | null;
|
|
403
511
|
|
|
404
512
|
/**
|
|
405
|
-
*
|
|
406
|
-
*
|
|
513
|
+
* Filters to scope which prices are included in grouped cost alert evaluation.
|
|
514
|
+
* Supports filtering by price_id, item_id, or price_type with includes/excludes
|
|
515
|
+
* operators. Only applicable when grouping_keys is set.
|
|
516
|
+
*/
|
|
517
|
+
price_filters?: Array<AlertCreateForSubscriptionParams.PriceFilter> | null;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Per-group threshold overrides. Each override maps a specific combination of
|
|
521
|
+
* grouping_keys values to a list of thresholds that fully replaces the default
|
|
522
|
+
* thresholds for that group. An empty thresholds list silences the group. Groups
|
|
523
|
+
* without an override use the default thresholds. Only applicable when
|
|
524
|
+
* grouping_keys is set.
|
|
525
|
+
*/
|
|
526
|
+
threshold_overrides?: Array<AlertCreateForSubscriptionParams.ThresholdOverride> | null;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export namespace AlertCreateForSubscriptionParams {
|
|
530
|
+
export interface PriceFilter {
|
|
531
|
+
/**
|
|
532
|
+
* The property of the price to filter on.
|
|
533
|
+
*/
|
|
534
|
+
field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Should prices that match the filter be included or excluded.
|
|
538
|
+
*/
|
|
539
|
+
operator: 'includes' | 'excludes';
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* The IDs or values that match this filter.
|
|
543
|
+
*/
|
|
544
|
+
values: Array<string>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Per-group threshold override on a grouped cost alert.
|
|
549
|
+
*
|
|
550
|
+
* - An empty `thresholds` list silences alerts for this group (never fires).
|
|
551
|
+
* - A non-empty list fully replaces the default thresholds for this group.
|
|
407
552
|
*/
|
|
408
|
-
|
|
553
|
+
export interface ThresholdOverride {
|
|
554
|
+
/**
|
|
555
|
+
* The values of the grouping keys that identify this group. The list length must
|
|
556
|
+
* match the alert's grouping_keys, and values appear in the same order as
|
|
557
|
+
* grouping_keys.
|
|
558
|
+
*/
|
|
559
|
+
group_values: Array<string>;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* The thresholds to apply to this group. An empty list silences alerts for this
|
|
563
|
+
* group. A non-empty list fully replaces the default thresholds for this group.
|
|
564
|
+
*/
|
|
565
|
+
thresholds: Array<AlertsAPI.Threshold>;
|
|
566
|
+
}
|
|
409
567
|
}
|
|
410
568
|
|
|
411
569
|
export interface AlertDisableParams {
|