orb-billing 6.0.1 → 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 +22 -0
- package/README.md +1 -4
- package/bin/cli +52 -0
- package/bin/migration-config.json +238 -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 -1
- 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
package/src/resources/alerts.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as AlertsAPI from './alerts';
|
|
|
5
5
|
import * as Shared from './shared';
|
|
6
6
|
import { APIPromise } from '../core/api-promise';
|
|
7
7
|
import { Page, type PageParams, PagePromise } from '../core/pagination';
|
|
8
|
+
import { buildHeaders } from '../internal/headers';
|
|
8
9
|
import { RequestOptions } from '../internal/request-options';
|
|
9
10
|
import { path } from '../internal/utils/path';
|
|
10
11
|
|
|
@@ -18,15 +19,15 @@ export class Alerts extends APIResource {
|
|
|
18
19
|
/**
|
|
19
20
|
* This endpoint retrieves an alert by its ID.
|
|
20
21
|
*/
|
|
21
|
-
retrieve(
|
|
22
|
-
return this._client.get(path`/alerts/${
|
|
22
|
+
retrieve(alertID: string, options?: RequestOptions): APIPromise<Alert> {
|
|
23
|
+
return this._client.get(path`/alerts/${alertID}`, options);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* This endpoint updates the thresholds of an alert.
|
|
27
28
|
*/
|
|
28
|
-
update(
|
|
29
|
-
return this._client.put(path`/alerts/${
|
|
29
|
+
update(alertConfigurationID: string, body: AlertUpdateParams, options?: RequestOptions): APIPromise<Alert> {
|
|
30
|
+
return this._client.put(path`/alerts/${alertConfigurationID}`, { body, ...options });
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -49,6 +50,23 @@ export class Alerts extends APIResource {
|
|
|
49
50
|
return this._client.getAPIList('/alerts', Page<Alert>, { query, ...options });
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
/**
|
|
54
|
+
* This endpoint trashes a subscription- or customer-scoped alert. The alert is
|
|
55
|
+
* soft-deleted: it stops firing immediately and no longer appears in fetch or list
|
|
56
|
+
* responses, while the underlying record is retained internally for audit.
|
|
57
|
+
*
|
|
58
|
+
* Plan-level alerts cannot be trashed via the API — disable them instead
|
|
59
|
+
* (`POST /v1/alerts/{alert_configuration_id}/disable`). Their removal would need
|
|
60
|
+
* to be unwound from every subscription the alert was propagated to, which isn't
|
|
61
|
+
* supported yet.
|
|
62
|
+
*/
|
|
63
|
+
delete(alertConfigurationID: string, options?: RequestOptions): APIPromise<void> {
|
|
64
|
+
return this._client.delete(path`/alerts/${alertConfigurationID}`, {
|
|
65
|
+
...options,
|
|
66
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
/**
|
|
53
71
|
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
54
72
|
* are three types of alerts that can be scoped to customers:
|
|
@@ -60,11 +78,11 @@ export class Alerts extends APIResource {
|
|
|
60
78
|
* require thresholds.
|
|
61
79
|
*/
|
|
62
80
|
createForCustomer(
|
|
63
|
-
|
|
81
|
+
customerID: string,
|
|
64
82
|
body: AlertCreateForCustomerParams,
|
|
65
83
|
options?: RequestOptions,
|
|
66
84
|
): APIPromise<Alert> {
|
|
67
|
-
return this._client.post(path`/alerts/customer_id/${
|
|
85
|
+
return this._client.post(path`/alerts/customer_id/${customerID}`, { body, ...options });
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
/**
|
|
@@ -78,11 +96,11 @@ export class Alerts extends APIResource {
|
|
|
78
96
|
* require thresholds.
|
|
79
97
|
*/
|
|
80
98
|
createForExternalCustomer(
|
|
81
|
-
|
|
99
|
+
externalCustomerID: string,
|
|
82
100
|
body: AlertCreateForExternalCustomerParams,
|
|
83
101
|
options?: RequestOptions,
|
|
84
102
|
): APIPromise<Alert> {
|
|
85
|
-
return this._client.post(path`/alerts/external_customer_id/${
|
|
103
|
+
return this._client.post(path`/alerts/external_customer_id/${externalCustomerID}`, { body, ...options });
|
|
86
104
|
}
|
|
87
105
|
|
|
88
106
|
/**
|
|
@@ -99,11 +117,11 @@ export class Alerts extends APIResource {
|
|
|
99
117
|
* usage or cost conditions met during the current billing cycle.
|
|
100
118
|
*/
|
|
101
119
|
createForSubscription(
|
|
102
|
-
|
|
120
|
+
subscriptionID: string,
|
|
103
121
|
body: AlertCreateForSubscriptionParams,
|
|
104
122
|
options?: RequestOptions,
|
|
105
123
|
): APIPromise<Alert> {
|
|
106
|
-
return this._client.post(path`/alerts/subscription_id/${
|
|
124
|
+
return this._client.post(path`/alerts/subscription_id/${subscriptionID}`, { body, ...options });
|
|
107
125
|
}
|
|
108
126
|
|
|
109
127
|
/**
|
|
@@ -112,12 +130,12 @@ export class Alerts extends APIResource {
|
|
|
112
130
|
* `subscription_id` is not required for customer or subscription level alerts.
|
|
113
131
|
*/
|
|
114
132
|
disable(
|
|
115
|
-
|
|
133
|
+
alertConfigurationID: string,
|
|
116
134
|
params: AlertDisableParams | null | undefined = {},
|
|
117
135
|
options?: RequestOptions,
|
|
118
136
|
): APIPromise<Alert> {
|
|
119
137
|
const { subscription_id } = params ?? {};
|
|
120
|
-
return this._client.post(path`/alerts/${
|
|
138
|
+
return this._client.post(path`/alerts/${alertConfigurationID}/disable`, {
|
|
121
139
|
query: { subscription_id },
|
|
122
140
|
...options,
|
|
123
141
|
});
|
|
@@ -129,12 +147,12 @@ export class Alerts extends APIResource {
|
|
|
129
147
|
* `subscription_id` is not required for customer or subscription level alerts.
|
|
130
148
|
*/
|
|
131
149
|
enable(
|
|
132
|
-
|
|
150
|
+
alertConfigurationID: string,
|
|
133
151
|
params: AlertEnableParams | null | undefined = {},
|
|
134
152
|
options?: RequestOptions,
|
|
135
153
|
): APIPromise<Alert> {
|
|
136
154
|
const { subscription_id } = params ?? {};
|
|
137
|
-
return this._client.post(path`/alerts/${
|
|
155
|
+
return this._client.post(path`/alerts/${alertConfigurationID}/enable`, {
|
|
138
156
|
query: { subscription_id },
|
|
139
157
|
...options,
|
|
140
158
|
});
|
|
@@ -26,11 +26,11 @@ export class Beta extends APIResource {
|
|
|
26
26
|
* This endpoint allows the creation of a new plan version for an existing plan.
|
|
27
27
|
*/
|
|
28
28
|
createPlanVersion(
|
|
29
|
-
|
|
29
|
+
planID: string,
|
|
30
30
|
body: BetaCreatePlanVersionParams,
|
|
31
31
|
options?: RequestOptions,
|
|
32
32
|
): APIPromise<PlanVersion> {
|
|
33
|
-
return this._client.post(path`/plans/${
|
|
33
|
+
return this._client.post(path`/plans/${planID}/versions`, { body, ...options });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -42,19 +42,19 @@ export class Beta extends APIResource {
|
|
|
42
42
|
params: BetaFetchPlanVersionParams,
|
|
43
43
|
options?: RequestOptions,
|
|
44
44
|
): APIPromise<PlanVersion> {
|
|
45
|
-
const { plan_id
|
|
46
|
-
return this._client.get(path`/plans/${
|
|
45
|
+
const { plan_id } = params;
|
|
46
|
+
return this._client.get(path`/plans/${plan_id}/versions/${version}`, options);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* This endpoint allows setting the default version of a plan.
|
|
51
51
|
*/
|
|
52
52
|
setDefaultPlanVersion(
|
|
53
|
-
|
|
53
|
+
planID: string,
|
|
54
54
|
body: BetaSetDefaultPlanVersionParams,
|
|
55
55
|
options?: RequestOptions,
|
|
56
56
|
): APIPromise<PlansAPI.Plan> {
|
|
57
|
-
return this._client.post(path`/plans/${
|
|
57
|
+
return this._client.post(path`/plans/${planID}/set_default_version`, { body, ...options });
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -18,11 +18,11 @@ export class ExternalPlanID extends APIResource {
|
|
|
18
18
|
* This endpoint allows the creation of a new plan version for an existing plan.
|
|
19
19
|
*/
|
|
20
20
|
createPlanVersion(
|
|
21
|
-
|
|
21
|
+
externalPlanID: string,
|
|
22
22
|
body: ExternalPlanIDCreatePlanVersionParams,
|
|
23
23
|
options?: RequestOptions,
|
|
24
24
|
): APIPromise<BetaAPI.PlanVersion> {
|
|
25
|
-
return this._client.post(path`/plans/external_plan_id/${
|
|
25
|
+
return this._client.post(path`/plans/external_plan_id/${externalPlanID}/versions`, { body, ...options });
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -34,19 +34,19 @@ export class ExternalPlanID extends APIResource {
|
|
|
34
34
|
params: ExternalPlanIDFetchPlanVersionParams,
|
|
35
35
|
options?: RequestOptions,
|
|
36
36
|
): APIPromise<BetaAPI.PlanVersion> {
|
|
37
|
-
const { external_plan_id
|
|
38
|
-
return this._client.get(path`/plans/external_plan_id/${
|
|
37
|
+
const { external_plan_id } = params;
|
|
38
|
+
return this._client.get(path`/plans/external_plan_id/${external_plan_id}/versions/${version}`, options);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* This endpoint allows setting the default version of a plan.
|
|
43
43
|
*/
|
|
44
44
|
setDefaultPlanVersion(
|
|
45
|
-
|
|
45
|
+
externalPlanID: string,
|
|
46
46
|
body: ExternalPlanIDSetDefaultPlanVersionParams,
|
|
47
47
|
options?: RequestOptions,
|
|
48
48
|
): APIPromise<PlansAPI.Plan> {
|
|
49
|
-
return this._client.post(path`/plans/external_plan_id/${
|
|
49
|
+
return this._client.post(path`/plans/external_plan_id/${externalPlanID}/set_default_version`, {
|
|
50
50
|
body,
|
|
51
51
|
...options,
|
|
52
52
|
});
|
|
@@ -66,8 +66,8 @@ export class Coupons extends APIResource {
|
|
|
66
66
|
* const coupon = await client.coupons.archive('coupon_id');
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
archive(
|
|
70
|
-
return this._client.post(path`/coupons/${
|
|
69
|
+
archive(couponID: string, options?: RequestOptions): APIPromise<Coupon> {
|
|
70
|
+
return this._client.post(path`/coupons/${couponID}/archive`, options);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -80,8 +80,8 @@ export class Coupons extends APIResource {
|
|
|
80
80
|
* const coupon = await client.coupons.fetch('coupon_id');
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
|
-
fetch(
|
|
84
|
-
return this._client.get(path`/coupons/${
|
|
83
|
+
fetch(couponID: string, options?: RequestOptions): APIPromise<Coupon> {
|
|
84
|
+
return this._client.get(path`/coupons/${couponID}`, options);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -28,12 +28,12 @@ export class Subscriptions extends APIResource {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
list(
|
|
31
|
-
|
|
31
|
+
couponID: string,
|
|
32
32
|
query: SubscriptionListParams | null | undefined = {},
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): PagePromise<SubscriptionsPage, SubscriptionsAPI.Subscription> {
|
|
35
35
|
return this._client.getAPIList(
|
|
36
|
-
path`/coupons/${
|
|
36
|
+
path`/coupons/${couponID}/subscriptions`,
|
|
37
37
|
Page<SubscriptionsAPI.Subscription>,
|
|
38
38
|
{ query, ...options },
|
|
39
39
|
);
|
|
@@ -14,8 +14,8 @@ export class CreditBlocks extends APIResource {
|
|
|
14
14
|
/**
|
|
15
15
|
* This endpoint returns a credit block identified by its block_id.
|
|
16
16
|
*/
|
|
17
|
-
retrieve(
|
|
18
|
-
return this._client.get(path`/credit_blocks/${
|
|
17
|
+
retrieve(blockID: string, options?: RequestOptions): APIPromise<CreditBlockRetrieveResponse> {
|
|
18
|
+
return this._client.get(path`/credit_blocks/${blockID}`, options);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -35,8 +35,8 @@ export class CreditBlocks extends APIResource {
|
|
|
35
35
|
* reflect the state as if credits from the deleted block were never applied.
|
|
36
36
|
* </Note>
|
|
37
37
|
*/
|
|
38
|
-
delete(
|
|
39
|
-
return this._client.delete(path`/credit_blocks/${
|
|
38
|
+
delete(blockID: string, options?: RequestOptions): APIPromise<void> {
|
|
39
|
+
return this._client.delete(path`/credit_blocks/${blockID}`, {
|
|
40
40
|
...options,
|
|
41
41
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
42
42
|
});
|
|
@@ -61,8 +61,8 @@ export class CreditBlocks extends APIResource {
|
|
|
61
61
|
* future releases. Please contact support before building production integrations
|
|
62
62
|
* against this endpoint.**
|
|
63
63
|
*/
|
|
64
|
-
listInvoices(
|
|
65
|
-
return this._client.get(path`/credit_blocks/${
|
|
64
|
+
listInvoices(blockID: string, options?: RequestOptions): APIPromise<CreditBlockListInvoicesResponse> {
|
|
65
|
+
return this._client.get(path`/credit_blocks/${blockID}/invoices`, options);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -90,8 +90,8 @@ export class CreditNotes extends APIResource {
|
|
|
90
90
|
* );
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
fetch(
|
|
94
|
-
return this._client.get(path`/credit_notes/${
|
|
93
|
+
fetch(creditNoteID: string, options?: RequestOptions): APIPromise<Shared.CreditNote> {
|
|
94
|
+
return this._client.get(path`/credit_notes/${creditNoteID}`, options);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -29,11 +29,11 @@ export class BalanceTransactions extends APIResource {
|
|
|
29
29
|
* returns back the newly created transaction.
|
|
30
30
|
*/
|
|
31
31
|
create(
|
|
32
|
-
|
|
32
|
+
customerID: string,
|
|
33
33
|
body: BalanceTransactionCreateParams,
|
|
34
34
|
options?: RequestOptions,
|
|
35
35
|
): APIPromise<BalanceTransactionCreateResponse> {
|
|
36
|
-
return this._client.post(path`/customers/${
|
|
36
|
+
return this._client.post(path`/customers/${customerID}/balance_transactions`, { body, ...options });
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -60,12 +60,12 @@ export class BalanceTransactions extends APIResource {
|
|
|
60
60
|
* all adjustments and invoice applications.
|
|
61
61
|
*/
|
|
62
62
|
list(
|
|
63
|
-
|
|
63
|
+
customerID: string,
|
|
64
64
|
query: BalanceTransactionListParams | null | undefined = {},
|
|
65
65
|
options?: RequestOptions,
|
|
66
66
|
): PagePromise<BalanceTransactionListResponsesPage, BalanceTransactionListResponse> {
|
|
67
67
|
return this._client.getAPIList(
|
|
68
|
-
path`/customers/${
|
|
68
|
+
path`/customers/${customerID}/balance_transactions`,
|
|
69
69
|
Page<BalanceTransactionListResponse>,
|
|
70
70
|
{ query, ...options },
|
|
71
71
|
);
|
|
@@ -143,11 +143,11 @@ export class Costs extends APIResource {
|
|
|
143
143
|
* `grouping_value` and `secondary_grouping_value` available.
|
|
144
144
|
*/
|
|
145
145
|
list(
|
|
146
|
-
|
|
146
|
+
customerID: string,
|
|
147
147
|
query: CostListParams | null | undefined = {},
|
|
148
148
|
options?: RequestOptions,
|
|
149
149
|
): APIPromise<CostListResponse> {
|
|
150
|
-
return this._client.get(path`/customers/${
|
|
150
|
+
return this._client.get(path`/customers/${customerID}/costs`, { query, ...options });
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -270,11 +270,11 @@ export class Costs extends APIResource {
|
|
|
270
270
|
* `grouping_value` and `secondary_grouping_value` available.
|
|
271
271
|
*/
|
|
272
272
|
listByExternalID(
|
|
273
|
-
|
|
273
|
+
externalCustomerID: string,
|
|
274
274
|
query: CostListByExternalIDParams | null | undefined = {},
|
|
275
275
|
options?: RequestOptions,
|
|
276
276
|
): APIPromise<CostListByExternalIDResponse> {
|
|
277
|
-
return this._client.get(path`/customers/external_customer_id/${
|
|
277
|
+
return this._client.get(path`/customers/external_customer_id/${externalCustomerID}/costs`, {
|
|
278
278
|
query,
|
|
279
279
|
...options,
|
|
280
280
|
});
|
|
@@ -67,11 +67,11 @@ export class Credits extends APIResource {
|
|
|
67
67
|
* becomes effective, which may differ from creation time for backdated credits.
|
|
68
68
|
*/
|
|
69
69
|
list(
|
|
70
|
-
|
|
70
|
+
customerID: string,
|
|
71
71
|
query: CreditListParams | null | undefined = {},
|
|
72
72
|
options?: RequestOptions,
|
|
73
73
|
): PagePromise<CreditListResponsesPage, CreditListResponse> {
|
|
74
|
-
return this._client.getAPIList(path`/customers/${
|
|
74
|
+
return this._client.getAPIList(path`/customers/${customerID}/credits`, Page<CreditListResponse>, {
|
|
75
75
|
query,
|
|
76
76
|
...options,
|
|
77
77
|
});
|
|
@@ -92,12 +92,12 @@ export class Credits extends APIResource {
|
|
|
92
92
|
* becomes effective, which may differ from creation time for backdated credits.
|
|
93
93
|
*/
|
|
94
94
|
listByExternalID(
|
|
95
|
-
|
|
95
|
+
externalCustomerID: string,
|
|
96
96
|
query: CreditListByExternalIDParams | null | undefined = {},
|
|
97
97
|
options?: RequestOptions,
|
|
98
98
|
): PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse> {
|
|
99
99
|
return this._client.getAPIList(
|
|
100
|
-
path`/customers/external_customer_id/${
|
|
100
|
+
path`/customers/external_customer_id/${externalCustomerID}/credits`,
|
|
101
101
|
Page<CreditListByExternalIDResponse>,
|
|
102
102
|
{ query, ...options },
|
|
103
103
|
);
|
|
@@ -93,11 +93,11 @@ export class Ledger extends APIResource {
|
|
|
93
93
|
* entry will be added to the ledger to indicate the adjustment of credits.
|
|
94
94
|
*/
|
|
95
95
|
list(
|
|
96
|
-
|
|
96
|
+
customerID: string,
|
|
97
97
|
query: LedgerListParams | null | undefined = {},
|
|
98
98
|
options?: RequestOptions,
|
|
99
99
|
): PagePromise<LedgerListResponsesPage, LedgerListResponse> {
|
|
100
|
-
return this._client.getAPIList(path`/customers/${
|
|
100
|
+
return this._client.getAPIList(path`/customers/${customerID}/credits/ledger`, Page<LedgerListResponse>, {
|
|
101
101
|
query,
|
|
102
102
|
...options,
|
|
103
103
|
});
|
|
@@ -230,11 +230,11 @@ export class Ledger extends APIResource {
|
|
|
230
230
|
* return to the customer, up to the block's initial balance.
|
|
231
231
|
*/
|
|
232
232
|
createEntry(
|
|
233
|
-
|
|
233
|
+
customerID: string,
|
|
234
234
|
body: LedgerCreateEntryParams,
|
|
235
235
|
options?: RequestOptions,
|
|
236
236
|
): APIPromise<LedgerCreateEntryResponse> {
|
|
237
|
-
return this._client.post(path`/customers/${
|
|
237
|
+
return this._client.post(path`/customers/${customerID}/credits/ledger_entry`, { body, ...options });
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
/**
|
|
@@ -364,12 +364,12 @@ export class Ledger extends APIResource {
|
|
|
364
364
|
* return to the customer, up to the block's initial balance.
|
|
365
365
|
*/
|
|
366
366
|
createEntryByExternalID(
|
|
367
|
-
|
|
367
|
+
externalCustomerID: string,
|
|
368
368
|
body: LedgerCreateEntryByExternalIDParams,
|
|
369
369
|
options?: RequestOptions,
|
|
370
370
|
): APIPromise<LedgerCreateEntryByExternalIDResponse> {
|
|
371
371
|
return this._client.post(
|
|
372
|
-
path`/customers/external_customer_id/${
|
|
372
|
+
path`/customers/external_customer_id/${externalCustomerID}/credits/ledger_entry`,
|
|
373
373
|
{ body, ...options },
|
|
374
374
|
);
|
|
375
375
|
}
|
|
@@ -456,12 +456,12 @@ export class Ledger extends APIResource {
|
|
|
456
456
|
* entry will be added to the ledger to indicate the adjustment of credits.
|
|
457
457
|
*/
|
|
458
458
|
listByExternalID(
|
|
459
|
-
|
|
459
|
+
externalCustomerID: string,
|
|
460
460
|
query: LedgerListByExternalIDParams | null | undefined = {},
|
|
461
461
|
options?: RequestOptions,
|
|
462
462
|
): PagePromise<LedgerListByExternalIDResponsesPage, LedgerListByExternalIDResponse> {
|
|
463
463
|
return this._client.getAPIList(
|
|
464
|
-
path`/customers/external_customer_id/${
|
|
464
|
+
path`/customers/external_customer_id/${externalCustomerID}/credits/ledger`,
|
|
465
465
|
Page<LedgerListByExternalIDResponse>,
|
|
466
466
|
{ query, ...options },
|
|
467
467
|
);
|
|
@@ -21,22 +21,22 @@ export class TopUps extends APIResource {
|
|
|
21
21
|
* top-up will be replaced.
|
|
22
22
|
*/
|
|
23
23
|
create(
|
|
24
|
-
|
|
24
|
+
customerID: string,
|
|
25
25
|
body: TopUpCreateParams,
|
|
26
26
|
options?: RequestOptions,
|
|
27
27
|
): APIPromise<TopUpCreateResponse> {
|
|
28
|
-
return this._client.post(path`/customers/${
|
|
28
|
+
return this._client.post(path`/customers/${customerID}/credits/top_ups`, { body, ...options });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* List top-ups
|
|
33
33
|
*/
|
|
34
34
|
list(
|
|
35
|
-
|
|
35
|
+
customerID: string,
|
|
36
36
|
query: TopUpListParams | null | undefined = {},
|
|
37
37
|
options?: RequestOptions,
|
|
38
38
|
): PagePromise<TopUpListResponsesPage, TopUpListResponse> {
|
|
39
|
-
return this._client.getAPIList(path`/customers/${
|
|
39
|
+
return this._client.getAPIList(path`/customers/${customerID}/credits/top_ups`, Page<TopUpListResponse>, {
|
|
40
40
|
query,
|
|
41
41
|
...options,
|
|
42
42
|
});
|
|
@@ -46,9 +46,9 @@ export class TopUps extends APIResource {
|
|
|
46
46
|
* This deactivates the top-up and voids any invoices associated with pending
|
|
47
47
|
* credit blocks purchased through the top-up.
|
|
48
48
|
*/
|
|
49
|
-
delete(
|
|
50
|
-
const { customer_id
|
|
51
|
-
return this._client.delete(path`/customers/${
|
|
49
|
+
delete(topUpID: string, params: TopUpDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
50
|
+
const { customer_id } = params;
|
|
51
|
+
return this._client.delete(path`/customers/${customer_id}/credits/top_ups/${topUpID}`, {
|
|
52
52
|
...options,
|
|
53
53
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
54
54
|
});
|
|
@@ -64,11 +64,11 @@ export class TopUps extends APIResource {
|
|
|
64
64
|
* top-up will be replaced.
|
|
65
65
|
*/
|
|
66
66
|
createByExternalID(
|
|
67
|
-
|
|
67
|
+
externalCustomerID: string,
|
|
68
68
|
body: TopUpCreateByExternalIDParams,
|
|
69
69
|
options?: RequestOptions,
|
|
70
70
|
): APIPromise<TopUpCreateByExternalIDResponse> {
|
|
71
|
-
return this._client.post(path`/customers/external_customer_id/${
|
|
71
|
+
return this._client.post(path`/customers/external_customer_id/${externalCustomerID}/credits/top_ups`, {
|
|
72
72
|
body,
|
|
73
73
|
...options,
|
|
74
74
|
});
|
|
@@ -79,13 +79,13 @@ export class TopUps extends APIResource {
|
|
|
79
79
|
* credit blocks purchased through the top-up.
|
|
80
80
|
*/
|
|
81
81
|
deleteByExternalID(
|
|
82
|
-
|
|
82
|
+
topUpID: string,
|
|
83
83
|
params: TopUpDeleteByExternalIDParams,
|
|
84
84
|
options?: RequestOptions,
|
|
85
85
|
): APIPromise<void> {
|
|
86
|
-
const { external_customer_id
|
|
86
|
+
const { external_customer_id } = params;
|
|
87
87
|
return this._client.delete(
|
|
88
|
-
path`/customers/external_customer_id/${
|
|
88
|
+
path`/customers/external_customer_id/${external_customer_id}/credits/top_ups/${topUpID}`,
|
|
89
89
|
{ ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
90
90
|
);
|
|
91
91
|
}
|
|
@@ -94,12 +94,12 @@ export class TopUps extends APIResource {
|
|
|
94
94
|
* List top-ups by external ID
|
|
95
95
|
*/
|
|
96
96
|
listByExternalID(
|
|
97
|
-
|
|
97
|
+
externalCustomerID: string,
|
|
98
98
|
query: TopUpListByExternalIDParams | null | undefined = {},
|
|
99
99
|
options?: RequestOptions,
|
|
100
100
|
): PagePromise<TopUpListByExternalIDResponsesPage, TopUpListByExternalIDResponse> {
|
|
101
101
|
return this._client.getAPIList(
|
|
102
|
-
path`/customers/external_customer_id/${
|
|
102
|
+
path`/customers/external_customer_id/${externalCustomerID}/credits/top_ups`,
|
|
103
103
|
Page<TopUpListByExternalIDResponse>,
|
|
104
104
|
{ query, ...options },
|
|
105
105
|
);
|