orb-billing 6.0.2 → 6.1.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 +15 -0
- package/client.d.mts +5 -10
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -10
- package/client.d.ts.map +1 -1
- package/client.js +140 -149
- package/client.js.map +1 -1
- package/client.mjs +138 -146
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +2 -2
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/pagination.d.mts +4 -4
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +4 -4
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs.map +1 -1
- package/core/resource.d.mts +3 -3
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +3 -3
- package/core/resource.d.ts.map +1 -1
- package/core/resource.js.map +1 -1
- package/core/resource.mjs.map +1 -1
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -2
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +2 -2
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +4 -4
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/package.json +4 -4
- package/resources/alerts.d.mts +18 -7
- package/resources/alerts.d.mts.map +1 -1
- package/resources/alerts.d.ts +18 -7
- package/resources/alerts.d.ts.map +1 -1
- package/resources/alerts.js +31 -14
- package/resources/alerts.js.map +1 -1
- package/resources/alerts.mjs +31 -14
- package/resources/alerts.mjs.map +1 -1
- package/resources/beta/beta.d.mts +2 -2
- package/resources/beta/beta.d.ts +2 -2
- package/resources/beta/beta.js +6 -6
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +6 -6
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/external-plan-id.d.mts +2 -2
- package/resources/beta/external-plan-id.d.ts +2 -2
- package/resources/beta/external-plan-id.js +6 -6
- package/resources/beta/external-plan-id.js.map +1 -1
- package/resources/beta/external-plan-id.mjs +6 -6
- package/resources/beta/external-plan-id.mjs.map +1 -1
- package/resources/coupons/coupons.d.mts +2 -2
- package/resources/coupons/coupons.d.ts +2 -2
- package/resources/coupons/coupons.js +4 -4
- package/resources/coupons/coupons.mjs +4 -4
- package/resources/coupons/subscriptions.d.mts +1 -1
- package/resources/coupons/subscriptions.d.ts +1 -1
- package/resources/coupons/subscriptions.js +2 -2
- package/resources/coupons/subscriptions.mjs +2 -2
- package/resources/credit-blocks.d.mts +3 -3
- package/resources/credit-blocks.d.ts +3 -3
- package/resources/credit-blocks.js +6 -6
- package/resources/credit-blocks.mjs +6 -6
- package/resources/credit-notes.d.mts +1 -1
- package/resources/credit-notes.d.ts +1 -1
- package/resources/credit-notes.js +2 -2
- package/resources/credit-notes.mjs +2 -2
- package/resources/customers/balance-transactions.d.mts +2 -2
- package/resources/customers/balance-transactions.d.ts +2 -2
- package/resources/customers/balance-transactions.js +4 -4
- package/resources/customers/balance-transactions.mjs +4 -4
- package/resources/customers/costs.d.mts +2 -2
- package/resources/customers/costs.d.ts +2 -2
- package/resources/customers/costs.js +4 -4
- package/resources/customers/costs.mjs +4 -4
- package/resources/customers/credits/credits.d.mts +2 -2
- package/resources/customers/credits/credits.d.ts +2 -2
- package/resources/customers/credits/credits.js +4 -4
- package/resources/customers/credits/credits.mjs +4 -4
- package/resources/customers/credits/ledger.d.mts +4 -4
- package/resources/customers/credits/ledger.d.ts +4 -4
- package/resources/customers/credits/ledger.js +8 -8
- package/resources/customers/credits/ledger.mjs +8 -8
- package/resources/customers/credits/top-ups.d.mts +6 -6
- package/resources/customers/credits/top-ups.d.ts +6 -6
- package/resources/customers/credits/top-ups.js +14 -14
- package/resources/customers/credits/top-ups.js.map +1 -1
- package/resources/customers/credits/top-ups.mjs +14 -14
- package/resources/customers/credits/top-ups.mjs.map +1 -1
- package/resources/customers/customers.d.mts +65 -7
- package/resources/customers/customers.d.mts.map +1 -1
- package/resources/customers/customers.d.ts +65 -7
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js +35 -12
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs +35 -12
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/customers/index.d.mts +1 -1
- package/resources/customers/index.d.mts.map +1 -1
- package/resources/customers/index.d.ts +1 -1
- package/resources/customers/index.d.ts.map +1 -1
- package/resources/customers/index.js.map +1 -1
- package/resources/customers/index.mjs.map +1 -1
- package/resources/dimensional-price-groups/dimensional-price-groups.d.mts +2 -2
- package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +2 -2
- package/resources/dimensional-price-groups/dimensional-price-groups.js +4 -4
- package/resources/dimensional-price-groups/dimensional-price-groups.mjs +4 -4
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.mts +2 -2
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +2 -2
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.js +4 -4
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs +4 -4
- package/resources/events/backfills.d.mts +3 -3
- package/resources/events/backfills.d.ts +3 -3
- package/resources/events/backfills.js +6 -6
- package/resources/events/backfills.mjs +6 -6
- package/resources/events/events.d.mts +2 -18
- package/resources/events/events.d.mts.map +1 -1
- package/resources/events/events.d.ts +2 -18
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +6 -6
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +6 -6
- package/resources/events/events.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.mts +74 -8
- package/resources/invoices.d.mts.map +1 -1
- package/resources/invoices.d.ts +74 -8
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +87 -17
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +87 -17
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.mts +3 -3
- package/resources/items.d.ts +3 -3
- package/resources/items.js +6 -6
- package/resources/items.mjs +6 -6
- package/resources/license-types.d.mts +1 -1
- package/resources/license-types.d.ts +1 -1
- package/resources/license-types.js +2 -2
- package/resources/license-types.mjs +2 -2
- package/resources/licenses/external-licenses.d.mts +1 -1
- package/resources/licenses/external-licenses.d.ts +1 -1
- package/resources/licenses/external-licenses.js +2 -2
- package/resources/licenses/external-licenses.mjs +2 -2
- package/resources/licenses/licenses.d.mts +3 -3
- package/resources/licenses/licenses.d.ts +3 -3
- package/resources/licenses/licenses.js +6 -6
- package/resources/licenses/licenses.mjs +6 -6
- package/resources/licenses/usage.d.mts +1 -1
- package/resources/licenses/usage.d.ts +1 -1
- package/resources/licenses/usage.js +2 -2
- package/resources/licenses/usage.mjs +2 -2
- package/resources/metrics.d.mts +2 -2
- package/resources/metrics.d.ts +2 -2
- package/resources/metrics.js +4 -4
- package/resources/metrics.mjs +4 -4
- package/resources/plans/external-plan-id.d.mts +2 -2
- package/resources/plans/external-plan-id.d.ts +2 -2
- package/resources/plans/external-plan-id.js +4 -4
- package/resources/plans/external-plan-id.mjs +4 -4
- package/resources/plans/migrations.d.mts +3 -3
- package/resources/plans/migrations.d.ts +3 -3
- package/resources/plans/migrations.js +8 -8
- package/resources/plans/migrations.js.map +1 -1
- package/resources/plans/migrations.mjs +8 -8
- package/resources/plans/migrations.mjs.map +1 -1
- package/resources/plans/plans.d.mts +2 -2
- package/resources/plans/plans.d.ts +2 -2
- package/resources/plans/plans.js +4 -4
- package/resources/plans/plans.mjs +4 -4
- package/resources/prices/external-price-id.d.mts +2 -2
- package/resources/prices/external-price-id.d.ts +2 -2
- package/resources/prices/external-price-id.js +4 -4
- package/resources/prices/external-price-id.mjs +4 -4
- package/resources/prices/prices.d.mts +3 -3
- package/resources/prices/prices.d.ts +3 -3
- package/resources/prices/prices.js +6 -6
- package/resources/prices/prices.mjs +6 -6
- package/resources/subscription-changes.d.mts +3 -3
- package/resources/subscription-changes.d.ts +3 -3
- package/resources/subscription-changes.js +6 -6
- package/resources/subscription-changes.mjs +6 -6
- package/resources/subscriptions.d.mts +15 -15
- package/resources/subscriptions.d.ts +15 -15
- package/resources/subscriptions.js +30 -30
- package/resources/subscriptions.mjs +30 -30
- package/src/client.ts +11 -8
- package/src/core/api-promise.ts +4 -7
- package/src/core/pagination.ts +5 -5
- package/src/core/resource.ts +3 -3
- package/src/index.ts +1 -1
- package/src/internal/parse.ts +2 -2
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/log.ts +3 -3
- package/src/resources/alerts.ts +32 -14
- package/src/resources/beta/beta.ts +6 -6
- package/src/resources/beta/external-plan-id.ts +6 -6
- package/src/resources/coupons/coupons.ts +4 -4
- package/src/resources/coupons/subscriptions.ts +2 -2
- package/src/resources/credit-blocks.ts +6 -6
- package/src/resources/credit-notes.ts +2 -2
- package/src/resources/customers/balance-transactions.ts +4 -4
- package/src/resources/customers/costs.ts +4 -4
- package/src/resources/customers/credits/credits.ts +4 -4
- package/src/resources/customers/credits/ledger.ts +8 -8
- package/src/resources/customers/credits/top-ups.ts +14 -14
- package/src/resources/customers/customers.ts +105 -12
- package/src/resources/customers/index.ts +4 -0
- package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +4 -4
- package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +4 -4
- package/src/resources/events/backfills.ts +6 -6
- package/src/resources/events/events.ts +6 -26
- package/src/resources/index.ts +4 -0
- package/src/resources/invoices.ts +89 -17
- package/src/resources/items.ts +6 -6
- package/src/resources/license-types.ts +2 -2
- package/src/resources/licenses/external-licenses.ts +2 -2
- package/src/resources/licenses/licenses.ts +6 -6
- package/src/resources/licenses/usage.ts +2 -2
- package/src/resources/metrics.ts +4 -4
- package/src/resources/plans/external-plan-id.ts +4 -4
- package/src/resources/plans/migrations.ts +8 -8
- package/src/resources/plans/plans.ts +4 -4
- package/src/resources/prices/external-price-id.ts +4 -4
- package/src/resources/prices/prices.ts +6 -6
- package/src/resources/subscription-changes.ts +6 -6
- package/src/resources/subscriptions.ts +30 -30
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -289,8 +289,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
289
289
|
* );
|
|
290
290
|
* ```
|
|
291
291
|
*/
|
|
292
|
-
update(
|
|
293
|
-
return this._client.put((0, path_1.path) `/subscriptions/${
|
|
292
|
+
update(subscriptionID, body, options) {
|
|
293
|
+
return this._client.put((0, path_1.path) `/subscriptions/${subscriptionID}`, { body, ...options });
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* This endpoint returns a list of all subscriptions for an account as a
|
|
@@ -390,8 +390,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
390
390
|
* });
|
|
391
391
|
* ```
|
|
392
392
|
*/
|
|
393
|
-
cancel(
|
|
394
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
393
|
+
cancel(subscriptionID, body, options) {
|
|
394
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/cancel`, { body, ...options });
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
397
397
|
* This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
|
|
@@ -404,8 +404,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
404
404
|
* );
|
|
405
405
|
* ```
|
|
406
406
|
*/
|
|
407
|
-
fetch(
|
|
408
|
-
return this._client.get((0, path_1.path) `/subscriptions/${
|
|
407
|
+
fetch(subscriptionID, options) {
|
|
408
|
+
return this._client.get((0, path_1.path) `/subscriptions/${subscriptionID}`, options);
|
|
409
409
|
}
|
|
410
410
|
/**
|
|
411
411
|
* This endpoint is used to fetch a day-by-day snapshot of a subscription's costs
|
|
@@ -426,8 +426,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
426
426
|
* );
|
|
427
427
|
* ```
|
|
428
428
|
*/
|
|
429
|
-
fetchCosts(
|
|
430
|
-
return this._client.get((0, path_1.path) `/subscriptions/${
|
|
429
|
+
fetchCosts(subscriptionID, query = {}, options) {
|
|
430
|
+
return this._client.get((0, path_1.path) `/subscriptions/${subscriptionID}/costs`, { query, ...options });
|
|
431
431
|
}
|
|
432
432
|
/**
|
|
433
433
|
* This endpoint returns a [paginated](/api-reference/pagination) list of all plans
|
|
@@ -445,8 +445,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
445
445
|
* }
|
|
446
446
|
* ```
|
|
447
447
|
*/
|
|
448
|
-
fetchSchedule(
|
|
449
|
-
return this._client.getAPIList((0, path_1.path) `/subscriptions/${
|
|
448
|
+
fetchSchedule(subscriptionID, query = {}, options) {
|
|
449
|
+
return this._client.getAPIList((0, path_1.path) `/subscriptions/${subscriptionID}/schedule`, (pagination_1.Page), { query, ...options });
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* This endpoint is used to fetch a subscription's usage in Orb. Especially when
|
|
@@ -650,8 +650,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
650
650
|
* await client.subscriptions.fetchUsage('subscription_id');
|
|
651
651
|
* ```
|
|
652
652
|
*/
|
|
653
|
-
fetchUsage(
|
|
654
|
-
return this._client.get((0, path_1.path) `/subscriptions/${
|
|
653
|
+
fetchUsage(subscriptionID, query = {}, options) {
|
|
654
|
+
return this._client.get((0, path_1.path) `/subscriptions/${subscriptionID}/usage`, { query, ...options });
|
|
655
655
|
}
|
|
656
656
|
/**
|
|
657
657
|
* This endpoint is used to add and edit subscription
|
|
@@ -735,8 +735,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
735
735
|
* );
|
|
736
736
|
* ```
|
|
737
737
|
*/
|
|
738
|
-
priceIntervals(
|
|
739
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
738
|
+
priceIntervals(subscriptionID, body, options) {
|
|
739
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/price_intervals`, { body, ...options });
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
742
742
|
* Redeem a coupon effective at a given time.
|
|
@@ -750,8 +750,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
750
750
|
* );
|
|
751
751
|
* ```
|
|
752
752
|
*/
|
|
753
|
-
redeemCoupon(
|
|
754
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
753
|
+
redeemCoupon(subscriptionID, body, options) {
|
|
754
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/redeem_coupon`, { body, ...options });
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* This endpoint can be used to change an existing subscription's plan. It returns
|
|
@@ -947,8 +947,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
947
947
|
* );
|
|
948
948
|
* ```
|
|
949
949
|
*/
|
|
950
|
-
schedulePlanChange(
|
|
951
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
950
|
+
schedulePlanChange(subscriptionID, body, options) {
|
|
951
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/schedule_plan_change`, {
|
|
952
952
|
body,
|
|
953
953
|
...options,
|
|
954
954
|
});
|
|
@@ -965,8 +965,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
965
965
|
* );
|
|
966
966
|
* ```
|
|
967
967
|
*/
|
|
968
|
-
triggerPhase(
|
|
969
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
968
|
+
triggerPhase(subscriptionID, body, options) {
|
|
969
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/trigger_phase`, { body, ...options });
|
|
970
970
|
}
|
|
971
971
|
/**
|
|
972
972
|
* This endpoint can be used to unschedule any pending cancellations for a
|
|
@@ -990,8 +990,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
990
990
|
* );
|
|
991
991
|
* ```
|
|
992
992
|
*/
|
|
993
|
-
unscheduleCancellation(
|
|
994
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
993
|
+
unscheduleCancellation(subscriptionID, options) {
|
|
994
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/unschedule_cancellation`, options);
|
|
995
995
|
}
|
|
996
996
|
/**
|
|
997
997
|
* This endpoint can be used to clear scheduled updates to the quantity for a fixed
|
|
@@ -1009,8 +1009,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
1009
1009
|
* );
|
|
1010
1010
|
* ```
|
|
1011
1011
|
*/
|
|
1012
|
-
unscheduleFixedFeeQuantityUpdates(
|
|
1013
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
1012
|
+
unscheduleFixedFeeQuantityUpdates(subscriptionID, body, options) {
|
|
1013
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/unschedule_fixed_fee_quantity_updates`, {
|
|
1014
1014
|
body,
|
|
1015
1015
|
...options,
|
|
1016
1016
|
});
|
|
@@ -1027,8 +1027,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
1027
1027
|
* );
|
|
1028
1028
|
* ```
|
|
1029
1029
|
*/
|
|
1030
|
-
unschedulePendingPlanChanges(
|
|
1031
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
1030
|
+
unschedulePendingPlanChanges(subscriptionID, options) {
|
|
1031
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/unschedule_pending_plan_changes`, options);
|
|
1032
1032
|
}
|
|
1033
1033
|
/**
|
|
1034
1034
|
* This endpoint can be used to update the quantity for a fixed fee.
|
|
@@ -1055,8 +1055,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
1055
1055
|
* );
|
|
1056
1056
|
* ```
|
|
1057
1057
|
*/
|
|
1058
|
-
updateFixedFeeQuantity(
|
|
1059
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
1058
|
+
updateFixedFeeQuantity(subscriptionID, body, options) {
|
|
1059
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/update_fixed_fee_quantity`, {
|
|
1060
1060
|
body,
|
|
1061
1061
|
...options,
|
|
1062
1062
|
});
|
|
@@ -1090,8 +1090,8 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
1090
1090
|
* );
|
|
1091
1091
|
* ```
|
|
1092
1092
|
*/
|
|
1093
|
-
updateTrial(
|
|
1094
|
-
return this._client.post((0, path_1.path) `/subscriptions/${
|
|
1093
|
+
updateTrial(subscriptionID, body, options) {
|
|
1094
|
+
return this._client.post((0, path_1.path) `/subscriptions/${subscriptionID}/update_trial`, { body, ...options });
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
exports.Subscriptions = Subscriptions;
|
|
@@ -286,8 +286,8 @@ export class Subscriptions extends APIResource {
|
|
|
286
286
|
* );
|
|
287
287
|
* ```
|
|
288
288
|
*/
|
|
289
|
-
update(
|
|
290
|
-
return this._client.put(path `/subscriptions/${
|
|
289
|
+
update(subscriptionID, body, options) {
|
|
290
|
+
return this._client.put(path `/subscriptions/${subscriptionID}`, { body, ...options });
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* This endpoint returns a list of all subscriptions for an account as a
|
|
@@ -387,8 +387,8 @@ export class Subscriptions extends APIResource {
|
|
|
387
387
|
* });
|
|
388
388
|
* ```
|
|
389
389
|
*/
|
|
390
|
-
cancel(
|
|
391
|
-
return this._client.post(path `/subscriptions/${
|
|
390
|
+
cancel(subscriptionID, body, options) {
|
|
391
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/cancel`, { body, ...options });
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
394
|
* This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
|
|
@@ -401,8 +401,8 @@ export class Subscriptions extends APIResource {
|
|
|
401
401
|
* );
|
|
402
402
|
* ```
|
|
403
403
|
*/
|
|
404
|
-
fetch(
|
|
405
|
-
return this._client.get(path `/subscriptions/${
|
|
404
|
+
fetch(subscriptionID, options) {
|
|
405
|
+
return this._client.get(path `/subscriptions/${subscriptionID}`, options);
|
|
406
406
|
}
|
|
407
407
|
/**
|
|
408
408
|
* This endpoint is used to fetch a day-by-day snapshot of a subscription's costs
|
|
@@ -423,8 +423,8 @@ export class Subscriptions extends APIResource {
|
|
|
423
423
|
* );
|
|
424
424
|
* ```
|
|
425
425
|
*/
|
|
426
|
-
fetchCosts(
|
|
427
|
-
return this._client.get(path `/subscriptions/${
|
|
426
|
+
fetchCosts(subscriptionID, query = {}, options) {
|
|
427
|
+
return this._client.get(path `/subscriptions/${subscriptionID}/costs`, { query, ...options });
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
430
|
* This endpoint returns a [paginated](/api-reference/pagination) list of all plans
|
|
@@ -442,8 +442,8 @@ export class Subscriptions extends APIResource {
|
|
|
442
442
|
* }
|
|
443
443
|
* ```
|
|
444
444
|
*/
|
|
445
|
-
fetchSchedule(
|
|
446
|
-
return this._client.getAPIList(path `/subscriptions/${
|
|
445
|
+
fetchSchedule(subscriptionID, query = {}, options) {
|
|
446
|
+
return this._client.getAPIList(path `/subscriptions/${subscriptionID}/schedule`, (Page), { query, ...options });
|
|
447
447
|
}
|
|
448
448
|
/**
|
|
449
449
|
* This endpoint is used to fetch a subscription's usage in Orb. Especially when
|
|
@@ -647,8 +647,8 @@ export class Subscriptions extends APIResource {
|
|
|
647
647
|
* await client.subscriptions.fetchUsage('subscription_id');
|
|
648
648
|
* ```
|
|
649
649
|
*/
|
|
650
|
-
fetchUsage(
|
|
651
|
-
return this._client.get(path `/subscriptions/${
|
|
650
|
+
fetchUsage(subscriptionID, query = {}, options) {
|
|
651
|
+
return this._client.get(path `/subscriptions/${subscriptionID}/usage`, { query, ...options });
|
|
652
652
|
}
|
|
653
653
|
/**
|
|
654
654
|
* This endpoint is used to add and edit subscription
|
|
@@ -732,8 +732,8 @@ export class Subscriptions extends APIResource {
|
|
|
732
732
|
* );
|
|
733
733
|
* ```
|
|
734
734
|
*/
|
|
735
|
-
priceIntervals(
|
|
736
|
-
return this._client.post(path `/subscriptions/${
|
|
735
|
+
priceIntervals(subscriptionID, body, options) {
|
|
736
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/price_intervals`, { body, ...options });
|
|
737
737
|
}
|
|
738
738
|
/**
|
|
739
739
|
* Redeem a coupon effective at a given time.
|
|
@@ -747,8 +747,8 @@ export class Subscriptions extends APIResource {
|
|
|
747
747
|
* );
|
|
748
748
|
* ```
|
|
749
749
|
*/
|
|
750
|
-
redeemCoupon(
|
|
751
|
-
return this._client.post(path `/subscriptions/${
|
|
750
|
+
redeemCoupon(subscriptionID, body, options) {
|
|
751
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/redeem_coupon`, { body, ...options });
|
|
752
752
|
}
|
|
753
753
|
/**
|
|
754
754
|
* This endpoint can be used to change an existing subscription's plan. It returns
|
|
@@ -944,8 +944,8 @@ export class Subscriptions extends APIResource {
|
|
|
944
944
|
* );
|
|
945
945
|
* ```
|
|
946
946
|
*/
|
|
947
|
-
schedulePlanChange(
|
|
948
|
-
return this._client.post(path `/subscriptions/${
|
|
947
|
+
schedulePlanChange(subscriptionID, body, options) {
|
|
948
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/schedule_plan_change`, {
|
|
949
949
|
body,
|
|
950
950
|
...options,
|
|
951
951
|
});
|
|
@@ -962,8 +962,8 @@ export class Subscriptions extends APIResource {
|
|
|
962
962
|
* );
|
|
963
963
|
* ```
|
|
964
964
|
*/
|
|
965
|
-
triggerPhase(
|
|
966
|
-
return this._client.post(path `/subscriptions/${
|
|
965
|
+
triggerPhase(subscriptionID, body, options) {
|
|
966
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/trigger_phase`, { body, ...options });
|
|
967
967
|
}
|
|
968
968
|
/**
|
|
969
969
|
* This endpoint can be used to unschedule any pending cancellations for a
|
|
@@ -987,8 +987,8 @@ export class Subscriptions extends APIResource {
|
|
|
987
987
|
* );
|
|
988
988
|
* ```
|
|
989
989
|
*/
|
|
990
|
-
unscheduleCancellation(
|
|
991
|
-
return this._client.post(path `/subscriptions/${
|
|
990
|
+
unscheduleCancellation(subscriptionID, options) {
|
|
991
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/unschedule_cancellation`, options);
|
|
992
992
|
}
|
|
993
993
|
/**
|
|
994
994
|
* This endpoint can be used to clear scheduled updates to the quantity for a fixed
|
|
@@ -1006,8 +1006,8 @@ export class Subscriptions extends APIResource {
|
|
|
1006
1006
|
* );
|
|
1007
1007
|
* ```
|
|
1008
1008
|
*/
|
|
1009
|
-
unscheduleFixedFeeQuantityUpdates(
|
|
1010
|
-
return this._client.post(path `/subscriptions/${
|
|
1009
|
+
unscheduleFixedFeeQuantityUpdates(subscriptionID, body, options) {
|
|
1010
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/unschedule_fixed_fee_quantity_updates`, {
|
|
1011
1011
|
body,
|
|
1012
1012
|
...options,
|
|
1013
1013
|
});
|
|
@@ -1024,8 +1024,8 @@ export class Subscriptions extends APIResource {
|
|
|
1024
1024
|
* );
|
|
1025
1025
|
* ```
|
|
1026
1026
|
*/
|
|
1027
|
-
unschedulePendingPlanChanges(
|
|
1028
|
-
return this._client.post(path `/subscriptions/${
|
|
1027
|
+
unschedulePendingPlanChanges(subscriptionID, options) {
|
|
1028
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/unschedule_pending_plan_changes`, options);
|
|
1029
1029
|
}
|
|
1030
1030
|
/**
|
|
1031
1031
|
* This endpoint can be used to update the quantity for a fixed fee.
|
|
@@ -1052,8 +1052,8 @@ export class Subscriptions extends APIResource {
|
|
|
1052
1052
|
* );
|
|
1053
1053
|
* ```
|
|
1054
1054
|
*/
|
|
1055
|
-
updateFixedFeeQuantity(
|
|
1056
|
-
return this._client.post(path `/subscriptions/${
|
|
1055
|
+
updateFixedFeeQuantity(subscriptionID, body, options) {
|
|
1056
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/update_fixed_fee_quantity`, {
|
|
1057
1057
|
body,
|
|
1058
1058
|
...options,
|
|
1059
1059
|
});
|
|
@@ -1087,8 +1087,8 @@ export class Subscriptions extends APIResource {
|
|
|
1087
1087
|
* );
|
|
1088
1088
|
* ```
|
|
1089
1089
|
*/
|
|
1090
|
-
updateTrial(
|
|
1091
|
-
return this._client.post(path `/subscriptions/${
|
|
1090
|
+
updateTrial(subscriptionID, body, options) {
|
|
1091
|
+
return this._client.post(path `/subscriptions/${subscriptionID}/update_trial`, { body, ...options });
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
//# sourceMappingURL=subscriptions.mjs.map
|
package/src/client.ts
CHANGED
|
@@ -167,6 +167,10 @@ import {
|
|
|
167
167
|
AddressInput,
|
|
168
168
|
Customer,
|
|
169
169
|
CustomerCreateParams,
|
|
170
|
+
CustomerCreatePortalSessionByExternalIDParams,
|
|
171
|
+
CustomerCreatePortalSessionByExternalIDResponse,
|
|
172
|
+
CustomerCreatePortalSessionParams,
|
|
173
|
+
CustomerCreatePortalSessionResponse,
|
|
170
174
|
CustomerHierarchyConfig,
|
|
171
175
|
CustomerListParams,
|
|
172
176
|
CustomerUpdateByExternalIDParams,
|
|
@@ -325,9 +329,9 @@ export interface ClientOptions {
|
|
|
325
329
|
}
|
|
326
330
|
|
|
327
331
|
/**
|
|
328
|
-
*
|
|
332
|
+
* API Client for interfacing with the Orb API.
|
|
329
333
|
*/
|
|
330
|
-
export class
|
|
334
|
+
export class Orb {
|
|
331
335
|
apiKey: string;
|
|
332
336
|
webhookSecret: string | null;
|
|
333
337
|
|
|
@@ -376,7 +380,7 @@ export class BaseOrb {
|
|
|
376
380
|
};
|
|
377
381
|
|
|
378
382
|
this.baseURL = options.baseURL!;
|
|
379
|
-
this.timeout = options.timeout ??
|
|
383
|
+
this.timeout = options.timeout ?? Orb.DEFAULT_TIMEOUT /* 1 minute */;
|
|
380
384
|
this.logger = options.logger ?? console;
|
|
381
385
|
const defaultLogLevel = 'warn';
|
|
382
386
|
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
@@ -995,12 +999,7 @@ export class BaseOrb {
|
|
|
995
999
|
static DuplicateResourceCreation = Errors.DuplicateResourceCreation;
|
|
996
1000
|
|
|
997
1001
|
static toFile = Uploads.toFile;
|
|
998
|
-
}
|
|
999
1002
|
|
|
1000
|
-
/**
|
|
1001
|
-
* API Client for interfacing with the Orb API.
|
|
1002
|
-
*/
|
|
1003
|
-
export class Orb extends BaseOrb {
|
|
1004
1003
|
topLevel: API.TopLevel = new API.TopLevel(this);
|
|
1005
1004
|
/**
|
|
1006
1005
|
* The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed to by a
|
|
@@ -1164,10 +1163,14 @@ export declare namespace Orb {
|
|
|
1164
1163
|
type NewReportingConfiguration as NewReportingConfiguration,
|
|
1165
1164
|
type NewSphereConfiguration as NewSphereConfiguration,
|
|
1166
1165
|
type NewTaxJarConfiguration as NewTaxJarConfiguration,
|
|
1166
|
+
type CustomerCreatePortalSessionResponse as CustomerCreatePortalSessionResponse,
|
|
1167
|
+
type CustomerCreatePortalSessionByExternalIDResponse as CustomerCreatePortalSessionByExternalIDResponse,
|
|
1167
1168
|
type CustomersPage as CustomersPage,
|
|
1168
1169
|
type CustomerCreateParams as CustomerCreateParams,
|
|
1169
1170
|
type CustomerUpdateParams as CustomerUpdateParams,
|
|
1170
1171
|
type CustomerListParams as CustomerListParams,
|
|
1172
|
+
type CustomerCreatePortalSessionParams as CustomerCreatePortalSessionParams,
|
|
1173
|
+
type CustomerCreatePortalSessionByExternalIDParams as CustomerCreatePortalSessionByExternalIDParams,
|
|
1171
1174
|
type CustomerUpdateByExternalIDParams as CustomerUpdateByExternalIDParams,
|
|
1172
1175
|
};
|
|
1173
1176
|
|
package/src/core/api-promise.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { type
|
|
3
|
+
import { type Orb } from '../client';
|
|
4
4
|
|
|
5
5
|
import { type PromiseOrValue } from '../internal/types';
|
|
6
6
|
import { APIResponseProps, defaultParseResponse } from '../internal/parse';
|
|
@@ -11,15 +11,12 @@ import { APIResponseProps, defaultParseResponse } from '../internal/parse';
|
|
|
11
11
|
*/
|
|
12
12
|
export class APIPromise<T> extends Promise<T> {
|
|
13
13
|
private parsedPromise: Promise<T> | undefined;
|
|
14
|
-
#client:
|
|
14
|
+
#client: Orb;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
|
-
client:
|
|
17
|
+
client: Orb,
|
|
18
18
|
private responsePromise: Promise<APIResponseProps>,
|
|
19
|
-
private parseResponse: (
|
|
20
|
-
client: BaseOrb,
|
|
21
|
-
props: APIResponseProps,
|
|
22
|
-
) => PromiseOrValue<T> = defaultParseResponse,
|
|
19
|
+
private parseResponse: (client: Orb, props: APIResponseProps) => PromiseOrValue<T> = defaultParseResponse,
|
|
23
20
|
) {
|
|
24
21
|
super((resolve) => {
|
|
25
22
|
// this is maybe a bit weird but this has to be a no-op to not implicitly
|
package/src/core/pagination.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { OrbError } from './error';
|
|
4
4
|
import { FinalRequestOptions } from '../internal/request-options';
|
|
5
5
|
import { defaultParseResponse } from '../internal/parse';
|
|
6
|
-
import { type
|
|
6
|
+
import { type Orb } from '../client';
|
|
7
7
|
import { APIPromise } from './api-promise';
|
|
8
8
|
import { type APIResponseProps } from '../internal/parse';
|
|
9
9
|
import { maybeObj } from '../internal/utils/values';
|
|
@@ -11,13 +11,13 @@ import { maybeObj } from '../internal/utils/values';
|
|
|
11
11
|
export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
|
|
12
12
|
|
|
13
13
|
export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
14
|
-
#client:
|
|
14
|
+
#client: Orb;
|
|
15
15
|
protected options: FinalRequestOptions;
|
|
16
16
|
|
|
17
17
|
protected response: Response;
|
|
18
18
|
protected body: unknown;
|
|
19
19
|
|
|
20
|
-
constructor(client:
|
|
20
|
+
constructor(client: Orb, response: Response, body: unknown, options: FinalRequestOptions) {
|
|
21
21
|
this.#client = client;
|
|
22
22
|
this.options = options;
|
|
23
23
|
this.response = response;
|
|
@@ -80,7 +80,7 @@ export class PagePromise<
|
|
|
80
80
|
implements AsyncIterable<Item>
|
|
81
81
|
{
|
|
82
82
|
constructor(
|
|
83
|
-
client:
|
|
83
|
+
client: Orb,
|
|
84
84
|
request: Promise<APIResponseProps>,
|
|
85
85
|
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
|
86
86
|
) {
|
|
@@ -139,7 +139,7 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
|
|
|
139
139
|
|
|
140
140
|
pagination_metadata: PageResponse.PaginationMetadata;
|
|
141
141
|
|
|
142
|
-
constructor(client:
|
|
142
|
+
constructor(client: Orb, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
|
|
143
143
|
super(client, response, body, options);
|
|
144
144
|
|
|
145
145
|
this.data = body.data || [];
|
package/src/core/resource.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { Orb } from '../client';
|
|
4
4
|
|
|
5
5
|
export abstract class APIResource {
|
|
6
|
-
protected _client:
|
|
6
|
+
protected _client: Orb;
|
|
7
7
|
|
|
8
|
-
constructor(client:
|
|
8
|
+
constructor(client: Orb) {
|
|
9
9
|
this._client = client;
|
|
10
10
|
}
|
|
11
11
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Orb as default } from './client';
|
|
|
4
4
|
|
|
5
5
|
export { type Uploadable, toFile } from './core/uploads';
|
|
6
6
|
export { APIPromise } from './core/api-promise';
|
|
7
|
-
export {
|
|
7
|
+
export { Orb, type ClientOptions } from './client';
|
|
8
8
|
export { PagePromise } from './core/pagination';
|
|
9
9
|
export {
|
|
10
10
|
OrbError,
|
package/src/internal/parse.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import type { FinalRequestOptions } from './request-options';
|
|
4
|
-
import { type
|
|
4
|
+
import { type Orb } from '../client';
|
|
5
5
|
import { formatRequestDetails, loggerFor } from './utils/log';
|
|
6
6
|
|
|
7
7
|
export type APIResponseProps = {
|
|
@@ -13,7 +13,7 @@ export type APIResponseProps = {
|
|
|
13
13
|
startTime: number;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export async function defaultParseResponse<T>(client:
|
|
16
|
+
export async function defaultParseResponse<T>(client: Orb, props: APIResponseProps): Promise<T> {
|
|
17
17
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
18
18
|
const body = await (async () => {
|
|
19
19
|
// fetch refuses to read the body when the status code is 204.
|
package/src/internal/uploads.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RequestOptions } from './request-options';
|
|
2
2
|
import type { FilePropertyBag, Fetch } from './builtin-types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Orb } from '../client';
|
|
4
4
|
import { ReadableStreamFrom } from './shims';
|
|
5
5
|
|
|
6
6
|
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
|
|
@@ -74,7 +74,7 @@ export const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
|
|
|
74
74
|
*/
|
|
75
75
|
export const maybeMultipartFormRequestOptions = async (
|
|
76
76
|
opts: RequestOptions,
|
|
77
|
-
fetch:
|
|
77
|
+
fetch: Orb | Fetch,
|
|
78
78
|
): Promise<RequestOptions> => {
|
|
79
79
|
if (!hasUploadableValue(opts.body)) return opts;
|
|
80
80
|
|
|
@@ -85,7 +85,7 @@ type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & { body: unknow
|
|
|
85
85
|
|
|
86
86
|
export const multipartFormRequestOptions = async (
|
|
87
87
|
opts: MultipartFormRequestOptions,
|
|
88
|
-
fetch:
|
|
88
|
+
fetch: Orb | Fetch,
|
|
89
89
|
): Promise<RequestOptions> => {
|
|
90
90
|
return { ...opts, body: await createForm(opts.body, fetch) };
|
|
91
91
|
};
|
|
@@ -98,7 +98,7 @@ const supportsFormDataMap = /* @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>
|
|
|
98
98
|
* This function detects if the fetch function provided supports the global FormData object to avoid
|
|
99
99
|
* confusing error messages later on.
|
|
100
100
|
*/
|
|
101
|
-
function supportsFormData(fetchObject:
|
|
101
|
+
function supportsFormData(fetchObject: Orb | Fetch): Promise<boolean> {
|
|
102
102
|
const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch;
|
|
103
103
|
const cached = supportsFormDataMap.get(fetch);
|
|
104
104
|
if (cached) return cached;
|
|
@@ -124,7 +124,7 @@ function supportsFormData(fetchObject: BaseOrb | Fetch): Promise<boolean> {
|
|
|
124
124
|
|
|
125
125
|
export const createForm = async <T = Record<string, unknown>>(
|
|
126
126
|
body: T | undefined,
|
|
127
|
-
fetch:
|
|
127
|
+
fetch: Orb | Fetch,
|
|
128
128
|
): Promise<FormData> => {
|
|
129
129
|
if (!(await supportsFormData(fetch))) {
|
|
130
130
|
throw new TypeError(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { hasOwn } from './values';
|
|
4
|
-
import { type
|
|
4
|
+
import { type Orb } from '../../client';
|
|
5
5
|
import { RequestOptions } from '../request-options';
|
|
6
6
|
|
|
7
7
|
type LogFn = (message: string, ...rest: unknown[]) => void;
|
|
@@ -24,7 +24,7 @@ const levelNumbers = {
|
|
|
24
24
|
export const parseLogLevel = (
|
|
25
25
|
maybeLevel: string | undefined,
|
|
26
26
|
sourceName: string,
|
|
27
|
-
client:
|
|
27
|
+
client: Orb,
|
|
28
28
|
): LogLevel | undefined => {
|
|
29
29
|
if (!maybeLevel) {
|
|
30
30
|
return undefined;
|
|
@@ -60,7 +60,7 @@ const noopLogger = {
|
|
|
60
60
|
|
|
61
61
|
let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
|
|
62
62
|
|
|
63
|
-
export function loggerFor(client:
|
|
63
|
+
export function loggerFor(client: Orb): Logger {
|
|
64
64
|
const logger = client.logger;
|
|
65
65
|
const logLevel = client.logLevel ?? 'off';
|
|
66
66
|
if (!logger) {
|