@commet/node 5.5.0 → 6.0.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/dist/index.d.mts +1293 -996
- package/dist/index.d.ts +1293 -996
- package/dist/index.js +299 -297
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -297
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -3,28 +3,29 @@ var AddonsResource = class {
|
|
|
3
3
|
constructor(httpClient) {
|
|
4
4
|
this.httpClient = httpClient;
|
|
5
5
|
}
|
|
6
|
+
/** List all active add-ons for a customer's subscription. */
|
|
6
7
|
async listActive(params, options) {
|
|
7
|
-
return this.httpClient.get(
|
|
8
|
-
"/addons/active",
|
|
9
|
-
{ customerId: params.customerId },
|
|
10
|
-
options
|
|
11
|
-
);
|
|
8
|
+
return this.httpClient.get("/addons/active", params, options);
|
|
12
9
|
}
|
|
10
|
+
/** List all add-ons with cursor-based pagination. */
|
|
13
11
|
async list(params, options) {
|
|
14
12
|
return this.httpClient.get("/addons", params, options);
|
|
15
13
|
}
|
|
14
|
+
/** Retrieve an add-on by its public ID or slug. */
|
|
16
15
|
async get(params, options) {
|
|
17
16
|
const { id } = params;
|
|
18
17
|
return this.httpClient.get(`/addons/${id}`, void 0, options);
|
|
19
18
|
}
|
|
19
|
+
/** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
|
|
20
20
|
async create(params, options) {
|
|
21
21
|
return this.httpClient.post("/addons", params, options);
|
|
22
22
|
}
|
|
23
|
+
/** Update an add-on's name, description, or pricing. */
|
|
23
24
|
async update(params, options) {
|
|
24
|
-
const { id, ...
|
|
25
|
-
return this.httpClient.put(`/addons/${id}`,
|
|
25
|
+
const { id, ...rest } = params;
|
|
26
|
+
return this.httpClient.put(`/addons/${id}`, rest, options);
|
|
26
27
|
}
|
|
27
|
-
/** Fails if
|
|
28
|
+
/** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
|
|
28
29
|
async delete(params, options) {
|
|
29
30
|
const { id } = params;
|
|
30
31
|
return this.httpClient.delete(`/addons/${id}`, void 0, options);
|
|
@@ -36,15 +37,18 @@ var ApiKeysResource = class {
|
|
|
36
37
|
constructor(httpClient) {
|
|
37
38
|
this.httpClient = httpClient;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
/** List API keys with cursor-based pagination. Keys are returned without the full secret. */
|
|
41
|
+
async list(params, options) {
|
|
42
|
+
return this.httpClient.get("/api-keys", params, options);
|
|
41
43
|
}
|
|
42
|
-
/**
|
|
44
|
+
/** Create a new API key. The full key is only returned once in the response. */
|
|
43
45
|
async create(params, options) {
|
|
44
46
|
return this.httpClient.post("/api-keys", params, options);
|
|
45
47
|
}
|
|
48
|
+
/** Permanently revoke and delete an API key. */
|
|
46
49
|
async delete(params, options) {
|
|
47
|
-
|
|
50
|
+
const { id } = params;
|
|
51
|
+
return this.httpClient.delete(`/api-keys/${id}`, void 0, options);
|
|
48
52
|
}
|
|
49
53
|
};
|
|
50
54
|
|
|
@@ -53,16 +57,20 @@ var CreditPacksResource = class {
|
|
|
53
57
|
constructor(httpClient) {
|
|
54
58
|
this.httpClient = httpClient;
|
|
55
59
|
}
|
|
60
|
+
/** List all active credit packs. */
|
|
56
61
|
async list() {
|
|
57
62
|
return this.httpClient.get("/credit-packs");
|
|
58
63
|
}
|
|
64
|
+
/** Create a new credit pack. */
|
|
59
65
|
async create(params, options) {
|
|
60
66
|
return this.httpClient.post("/credit-packs/manage", params, options);
|
|
61
67
|
}
|
|
68
|
+
/** Update a credit pack's name, description, credits, price, or active status. */
|
|
62
69
|
async update(params, options) {
|
|
63
|
-
const { id, ...
|
|
64
|
-
return this.httpClient.put(`/credit-packs/${id}`,
|
|
70
|
+
const { id, ...rest } = params;
|
|
71
|
+
return this.httpClient.put(`/credit-packs/${id}`, rest, options);
|
|
65
72
|
}
|
|
73
|
+
/** Soft-delete a credit pack. */
|
|
66
74
|
async delete(params, options) {
|
|
67
75
|
const { id } = params;
|
|
68
76
|
return this.httpClient.delete(`/credit-packs/${id}`, void 0, options);
|
|
@@ -74,62 +82,27 @@ var CustomersResource = class {
|
|
|
74
82
|
constructor(httpClient) {
|
|
75
83
|
this.httpClient = httpClient;
|
|
76
84
|
}
|
|
77
|
-
/**
|
|
85
|
+
/** List customers with cursor-based pagination. */
|
|
86
|
+
async list(params, options) {
|
|
87
|
+
return this.httpClient.get("/customers", params, options);
|
|
88
|
+
}
|
|
89
|
+
/** Create a new customer. Idempotent when customerId is provided. */
|
|
78
90
|
async create(params, options) {
|
|
79
|
-
return this.httpClient.post(
|
|
80
|
-
"/customers",
|
|
81
|
-
{
|
|
82
|
-
billingEmail: params.email,
|
|
83
|
-
id: params.id,
|
|
84
|
-
fullName: params.fullName,
|
|
85
|
-
domain: params.domain,
|
|
86
|
-
website: params.website,
|
|
87
|
-
timezone: params.timezone,
|
|
88
|
-
language: params.language,
|
|
89
|
-
industry: params.industry,
|
|
90
|
-
metadata: params.metadata,
|
|
91
|
-
address: params.address
|
|
92
|
-
},
|
|
93
|
-
options
|
|
94
|
-
);
|
|
91
|
+
return this.httpClient.post("/customers", params, options);
|
|
95
92
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
fullName: c.fullName,
|
|
101
|
-
domain: c.domain,
|
|
102
|
-
website: c.website,
|
|
103
|
-
timezone: c.timezone,
|
|
104
|
-
language: c.language,
|
|
105
|
-
industry: c.industry,
|
|
106
|
-
metadata: c.metadata,
|
|
107
|
-
address: c.address
|
|
108
|
-
}));
|
|
109
|
-
return this.httpClient.post("/customers/batch", { customers }, options);
|
|
110
|
-
}
|
|
111
|
-
async get(params) {
|
|
112
|
-
return this.httpClient.get(`/customers/${params.id}`);
|
|
93
|
+
/** Retrieve a customer by their public ID, including subscription status and metadata. */
|
|
94
|
+
async get(params, options) {
|
|
95
|
+
const { id } = params;
|
|
96
|
+
return this.httpClient.get(`/customers/${id}`, void 0, options);
|
|
113
97
|
}
|
|
98
|
+
/** Update a customer's name, external ID, or metadata. */
|
|
114
99
|
async update(params, options) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
{
|
|
118
|
-
billingEmail: params.email,
|
|
119
|
-
fullName: params.fullName,
|
|
120
|
-
domain: params.domain,
|
|
121
|
-
website: params.website,
|
|
122
|
-
timezone: params.timezone,
|
|
123
|
-
language: params.language,
|
|
124
|
-
industry: params.industry,
|
|
125
|
-
metadata: params.metadata,
|
|
126
|
-
address: params.address
|
|
127
|
-
},
|
|
128
|
-
options
|
|
129
|
-
);
|
|
100
|
+
const { id, ...rest } = params;
|
|
101
|
+
return this.httpClient.put(`/customers/${id}`, rest, options);
|
|
130
102
|
}
|
|
131
|
-
|
|
132
|
-
|
|
103
|
+
/** Create up to 100 customers in a single request. */
|
|
104
|
+
async createBatch(params, options) {
|
|
105
|
+
return this.httpClient.post("/customers/batch", params, options);
|
|
133
106
|
}
|
|
134
107
|
};
|
|
135
108
|
|
|
@@ -138,36 +111,34 @@ var FeaturesResource = class {
|
|
|
138
111
|
constructor(httpClient) {
|
|
139
112
|
this.httpClient = httpClient;
|
|
140
113
|
}
|
|
114
|
+
/** List all features for a customer's active subscription. */
|
|
115
|
+
async list(params, options) {
|
|
116
|
+
return this.httpClient.get("/features", params, options);
|
|
117
|
+
}
|
|
118
|
+
/** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
|
|
141
119
|
async get(params, options) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{ customerId: params.customerId },
|
|
145
|
-
options
|
|
146
|
-
);
|
|
120
|
+
const { code, ...rest } = params;
|
|
121
|
+
return this.httpClient.get(`/features/${code}`, rest, options);
|
|
147
122
|
}
|
|
148
|
-
/**
|
|
123
|
+
/** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
|
|
149
124
|
async canUse(params, options) {
|
|
125
|
+
const { code, ...rest } = params;
|
|
150
126
|
return this.httpClient.get(
|
|
151
|
-
`/features/${
|
|
152
|
-
{
|
|
153
|
-
options
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
async list(params, options) {
|
|
157
|
-
return this.httpClient.get(
|
|
158
|
-
"/features",
|
|
159
|
-
{ customerId: params.customerId },
|
|
127
|
+
`/features/${code}`,
|
|
128
|
+
{ ...rest, action: "canUse" },
|
|
160
129
|
options
|
|
161
130
|
);
|
|
162
131
|
}
|
|
132
|
+
/** Create a new feature. Code must be lowercase alphanumeric with underscores. */
|
|
163
133
|
async create(params, options) {
|
|
164
134
|
return this.httpClient.post("/features/manage", params, options);
|
|
165
135
|
}
|
|
136
|
+
/** Update a feature's name, description, or unit name. At least one field must be provided. */
|
|
166
137
|
async update(params, options) {
|
|
167
|
-
const { code, ...
|
|
168
|
-
return this.httpClient.put(`/features/${code}/manage`,
|
|
138
|
+
const { code, ...rest } = params;
|
|
139
|
+
return this.httpClient.put(`/features/${code}/manage`, rest, options);
|
|
169
140
|
}
|
|
170
|
-
/** Fails if feature is attached to active plans or has an active
|
|
141
|
+
/** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
|
|
171
142
|
async delete(params, options) {
|
|
172
143
|
const { code } = params;
|
|
173
144
|
return this.httpClient.delete(
|
|
@@ -183,27 +154,52 @@ var InvoicesResource = class {
|
|
|
183
154
|
constructor(httpClient) {
|
|
184
155
|
this.httpClient = httpClient;
|
|
185
156
|
}
|
|
186
|
-
|
|
187
|
-
|
|
157
|
+
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
158
|
+
async list(params, options) {
|
|
159
|
+
return this.httpClient.get("/invoices", params, options);
|
|
188
160
|
}
|
|
189
|
-
|
|
190
|
-
|
|
161
|
+
/** Retrieve a single invoice by its public ID, including line items. */
|
|
162
|
+
async get(params, options) {
|
|
163
|
+
const { id } = params;
|
|
164
|
+
return this.httpClient.get(`/invoices/${id}`, void 0, options);
|
|
191
165
|
}
|
|
192
|
-
/**
|
|
166
|
+
/** Create a one-off adjustment invoice. Use a negative amount for a credit. */
|
|
193
167
|
async createAdjustment(params, options) {
|
|
194
168
|
return this.httpClient.post("/invoices", params, options);
|
|
195
169
|
}
|
|
196
|
-
/**
|
|
197
|
-
async getDownloadUrl(params) {
|
|
198
|
-
|
|
170
|
+
/** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
|
|
171
|
+
async getDownloadUrl(params, options) {
|
|
172
|
+
const { id } = params;
|
|
173
|
+
return this.httpClient.get(`/invoices/${id}/download`, void 0, options);
|
|
199
174
|
}
|
|
175
|
+
/** Send the invoice to the customer via email. */
|
|
200
176
|
async send(params, options) {
|
|
201
|
-
|
|
177
|
+
const { id } = params;
|
|
178
|
+
return this.httpClient.post(`/invoices/${id}/send`, {}, options);
|
|
202
179
|
}
|
|
203
|
-
/**
|
|
180
|
+
/** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
|
|
204
181
|
async updateStatus(params, options) {
|
|
205
|
-
const { id, ...
|
|
206
|
-
return this.httpClient.put(`/invoices/${id}/status`,
|
|
182
|
+
const { id, ...rest } = params;
|
|
183
|
+
return this.httpClient.put(`/invoices/${id}/status`, rest, options);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/resources/payouts.ts
|
|
188
|
+
var PayoutsResource = class {
|
|
189
|
+
constructor(httpClient) {
|
|
190
|
+
this.httpClient = httpClient;
|
|
191
|
+
}
|
|
192
|
+
/** Add an additional destination bank account to the organization's existing payout account. Country and currency are resolved from the organization. The full account number is never returned — only `last4`. */
|
|
193
|
+
async addBankAccount(params, options) {
|
|
194
|
+
return this.httpClient.post("/payouts/bank-accounts", params, options);
|
|
195
|
+
}
|
|
196
|
+
/** Withdraw available balance to the organization's verified payout account. `amount` is in cents (USD, minimum 1000 = $10). The payout is created in `pending` and settles to `paid` asynchronously as provider webhooks arrive. */
|
|
197
|
+
async request(params, options) {
|
|
198
|
+
return this.httpClient.post("/payouts", params, options);
|
|
199
|
+
}
|
|
200
|
+
/** Provision the organization's payout account in a single call with the full KYC + bank payload. Uploads the identity document, persists the destination bank, and creates the connected account through the org's payout provider. The account starts `pending_verification` and flips to `verified` via the provider's webhook. Idempotent: returns the existing account if the org already has one. */
|
|
201
|
+
async completeVerification(params, options) {
|
|
202
|
+
return this.httpClient.post("/payouts/verification", params, options);
|
|
207
203
|
}
|
|
208
204
|
};
|
|
209
205
|
|
|
@@ -212,31 +208,35 @@ var PlanGroupsResource = class {
|
|
|
212
208
|
constructor(httpClient) {
|
|
213
209
|
this.httpClient = httpClient;
|
|
214
210
|
}
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
/** List plan groups with cursor-based pagination. */
|
|
212
|
+
async list(params, options) {
|
|
213
|
+
return this.httpClient.get("/plan-groups", params, options);
|
|
217
214
|
}
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
/** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
|
|
216
|
+
async get(params, options) {
|
|
217
|
+
const { id } = params;
|
|
218
|
+
return this.httpClient.get(`/plan-groups/${id}`, void 0, options);
|
|
220
219
|
}
|
|
220
|
+
/** Create a new plan group for organizing plans. */
|
|
221
221
|
async create(params, options) {
|
|
222
222
|
return this.httpClient.post("/plan-groups", params, options);
|
|
223
223
|
}
|
|
224
|
+
/** Update a plan group's name, description, or visibility. */
|
|
224
225
|
async update(params, options) {
|
|
225
|
-
const { id, ...
|
|
226
|
-
return this.httpClient.put(`/plan-groups/${id}`,
|
|
226
|
+
const { id, ...rest } = params;
|
|
227
|
+
return this.httpClient.put(`/plan-groups/${id}`, rest, options);
|
|
227
228
|
}
|
|
228
|
-
/** Plans in the group are unlinked, not deleted. */
|
|
229
|
+
/** Delete a plan group. Plans in the group are unlinked, not deleted. */
|
|
229
230
|
async delete(params, options) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
void 0,
|
|
233
|
-
options
|
|
234
|
-
);
|
|
231
|
+
const { id } = params;
|
|
232
|
+
return this.httpClient.delete(`/plan-groups/${id}`, void 0, options);
|
|
235
233
|
}
|
|
234
|
+
/** Add an existing plan to a plan group with optional sort order. */
|
|
236
235
|
async addPlan(params, options) {
|
|
237
|
-
const { id, ...
|
|
238
|
-
return this.httpClient.post(`/plan-groups/${id}/plans`,
|
|
236
|
+
const { id, ...rest } = params;
|
|
237
|
+
return this.httpClient.post(`/plan-groups/${id}/plans`, rest, options);
|
|
239
238
|
}
|
|
239
|
+
/** Remove a plan from a plan group. */
|
|
240
240
|
async removePlan(params, options) {
|
|
241
241
|
const { id, planId } = params;
|
|
242
242
|
return this.httpClient.delete(
|
|
@@ -245,11 +245,12 @@ var PlanGroupsResource = class {
|
|
|
245
245
|
options
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
|
+
/** Set the display order of plans within a group. All plan IDs in the group must be provided. */
|
|
248
249
|
async reorderPlans(params, options) {
|
|
249
|
-
const { id, ...
|
|
250
|
+
const { id, ...rest } = params;
|
|
250
251
|
return this.httpClient.put(
|
|
251
252
|
`/plan-groups/${id}/plans/reorder`,
|
|
252
|
-
|
|
253
|
+
rest,
|
|
253
254
|
options
|
|
254
255
|
);
|
|
255
256
|
}
|
|
@@ -260,90 +261,104 @@ var PlansResource = class {
|
|
|
260
261
|
constructor(httpClient) {
|
|
261
262
|
this.httpClient = httpClient;
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
-
|
|
264
|
+
/** List all plans with their prices and features. Optionally include private plans. */
|
|
265
|
+
async list(params, options) {
|
|
266
|
+
return this.httpClient.get("/plans", params, options);
|
|
265
267
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
+
/** Get detailed plan information by code or ID. */
|
|
269
|
+
async get(params, options) {
|
|
270
|
+
const { id } = params;
|
|
271
|
+
return this.httpClient.get(`/plans/${id}`, void 0, options);
|
|
268
272
|
}
|
|
273
|
+
/** Create a new plan with optional consumption model, visibility, and plan group assignment. */
|
|
269
274
|
async create(params, options) {
|
|
270
275
|
return this.httpClient.post("/plans/manage", params, options);
|
|
271
276
|
}
|
|
277
|
+
/** Update a plan's name, description, visibility, or metadata. */
|
|
272
278
|
async update(params, options) {
|
|
273
|
-
const { id, ...
|
|
274
|
-
return this.httpClient.put(`/plans/${id}/manage`,
|
|
279
|
+
const { id, ...rest } = params;
|
|
280
|
+
return this.httpClient.put(`/plans/${id}/manage`, rest, options);
|
|
275
281
|
}
|
|
282
|
+
/** Soft-delete a plan. */
|
|
276
283
|
async delete(params, options) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
void 0,
|
|
280
|
-
options
|
|
281
|
-
);
|
|
284
|
+
const { id } = params;
|
|
285
|
+
return this.httpClient.delete(`/plans/${id}/manage`, void 0, options);
|
|
282
286
|
}
|
|
287
|
+
/** Toggle a plan between public and private. */
|
|
283
288
|
async setVisibility(params, options) {
|
|
284
|
-
const { id, ...
|
|
285
|
-
return this.httpClient.put(`/plans/${id}/visibility`,
|
|
289
|
+
const { id, ...rest } = params;
|
|
290
|
+
return this.httpClient.put(`/plans/${id}/visibility`, rest, options);
|
|
286
291
|
}
|
|
292
|
+
/** Attach a feature to a plan with limits, overage, and credits configuration. */
|
|
287
293
|
async addFeature(params, options) {
|
|
288
|
-
const {
|
|
289
|
-
return this.httpClient.post(`/plans/${
|
|
294
|
+
const { id, ...rest } = params;
|
|
295
|
+
return this.httpClient.post(`/plans/${id}/features`, rest, options);
|
|
290
296
|
}
|
|
297
|
+
/** Update limits, overage, or enabled status of a feature on a plan. */
|
|
291
298
|
async updateFeature(params, options) {
|
|
292
|
-
const {
|
|
299
|
+
const { id, featureId, ...rest } = params;
|
|
293
300
|
return this.httpClient.put(
|
|
294
|
-
`/plans/${
|
|
295
|
-
|
|
301
|
+
`/plans/${id}/features/${featureId}`,
|
|
302
|
+
rest,
|
|
296
303
|
options
|
|
297
304
|
);
|
|
298
305
|
}
|
|
306
|
+
/** Detach a feature from a plan. */
|
|
299
307
|
async removeFeature(params, options) {
|
|
300
|
-
const {
|
|
308
|
+
const { id, featureId } = params;
|
|
301
309
|
return this.httpClient.delete(
|
|
302
|
-
`/plans/${
|
|
310
|
+
`/plans/${id}/features/${featureId}`,
|
|
303
311
|
void 0,
|
|
304
312
|
options
|
|
305
313
|
);
|
|
306
314
|
}
|
|
315
|
+
/** Add a billing interval price to a plan with optional trial days and included balance/credits. */
|
|
307
316
|
async addPrice(params, options) {
|
|
308
|
-
const {
|
|
309
|
-
return this.httpClient.post(`/plans/${
|
|
317
|
+
const { id, ...rest } = params;
|
|
318
|
+
return this.httpClient.post(`/plans/${id}/prices`, rest, options);
|
|
310
319
|
}
|
|
320
|
+
/** Update an existing price on a plan. */
|
|
311
321
|
async updatePrice(params, options) {
|
|
312
|
-
const {
|
|
313
|
-
return this.httpClient.put(
|
|
314
|
-
`/plans/${planId}/prices/${priceId}`,
|
|
315
|
-
body,
|
|
316
|
-
options
|
|
317
|
-
);
|
|
322
|
+
const { id, priceId, ...rest } = params;
|
|
323
|
+
return this.httpClient.put(`/plans/${id}/prices/${priceId}`, rest, options);
|
|
318
324
|
}
|
|
325
|
+
/** Remove a price from a plan. */
|
|
319
326
|
async deletePrice(params, options) {
|
|
320
|
-
const {
|
|
327
|
+
const { id, priceId } = params;
|
|
321
328
|
return this.httpClient.delete(
|
|
322
|
-
`/plans/${
|
|
329
|
+
`/plans/${id}/prices/${priceId}`,
|
|
323
330
|
void 0,
|
|
324
331
|
options
|
|
325
332
|
);
|
|
326
333
|
}
|
|
334
|
+
/** Set a specific price as the default for its plan. Unsets previous default. */
|
|
327
335
|
async setDefaultPrice(params, options) {
|
|
328
|
-
const {
|
|
336
|
+
const { id, priceId } = params;
|
|
329
337
|
return this.httpClient.put(
|
|
330
|
-
`/plans/${
|
|
338
|
+
`/plans/${id}/prices/${priceId}/default`,
|
|
331
339
|
{},
|
|
332
340
|
options
|
|
333
341
|
);
|
|
334
342
|
}
|
|
343
|
+
/** Create or update regional currency price overrides for a plan price. */
|
|
335
344
|
async setRegionalPrices(params, options) {
|
|
336
|
-
const {
|
|
345
|
+
const { id, priceId, ...rest } = params;
|
|
337
346
|
return this.httpClient.put(
|
|
338
|
-
`/plans/${
|
|
339
|
-
|
|
347
|
+
`/plans/${id}/prices/${priceId}/regional`,
|
|
348
|
+
rest,
|
|
340
349
|
options
|
|
341
350
|
);
|
|
342
351
|
}
|
|
352
|
+
/** Configure a plan's regional pricing for one currency. Sending only currency and exchangeRate derives every regional value (base price, included balance, feature overage, intro offer) from the USD value at that rate. Optional per-price and per-feature overrides are stored as manual values. */
|
|
353
|
+
async setRegionalPricing(params, options) {
|
|
354
|
+
const { id, ...rest } = params;
|
|
355
|
+
return this.httpClient.put(`/plans/${id}/regional`, rest, options);
|
|
356
|
+
}
|
|
357
|
+
/** Remove all regional currency overrides for a plan price. */
|
|
343
358
|
async deleteRegionalPrices(params, options) {
|
|
344
|
-
const {
|
|
359
|
+
const { id, priceId } = params;
|
|
345
360
|
return this.httpClient.delete(
|
|
346
|
-
`/plans/${
|
|
361
|
+
`/plans/${id}/prices/${priceId}/regional`,
|
|
347
362
|
void 0,
|
|
348
363
|
options
|
|
349
364
|
);
|
|
@@ -355,6 +370,7 @@ var PortalResource = class {
|
|
|
355
370
|
constructor(httpClient) {
|
|
356
371
|
this.httpClient = httpClient;
|
|
357
372
|
}
|
|
373
|
+
/** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
|
|
358
374
|
async getUrl(params, options) {
|
|
359
375
|
return this.httpClient.post("/portal/request-access", params, options);
|
|
360
376
|
}
|
|
@@ -365,18 +381,23 @@ var PromoCodesResource = class {
|
|
|
365
381
|
constructor(httpClient) {
|
|
366
382
|
this.httpClient = httpClient;
|
|
367
383
|
}
|
|
368
|
-
|
|
369
|
-
|
|
384
|
+
/** List promo codes with cursor-based pagination. */
|
|
385
|
+
async list(params, options) {
|
|
386
|
+
return this.httpClient.get("/promo-codes", params, options);
|
|
370
387
|
}
|
|
371
|
-
|
|
372
|
-
|
|
388
|
+
/** Retrieve a promo code by its public ID. */
|
|
389
|
+
async get(params, options) {
|
|
390
|
+
const { id } = params;
|
|
391
|
+
return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
|
|
373
392
|
}
|
|
393
|
+
/** Create a new promo code. Optionally restrict to specific plans. */
|
|
374
394
|
async create(params, options) {
|
|
375
395
|
return this.httpClient.post("/promo-codes", params, options);
|
|
376
396
|
}
|
|
397
|
+
/** Update a promo code's redemption limits, expiration, active status, or plan restrictions. */
|
|
377
398
|
async update(params, options) {
|
|
378
|
-
const { id, ...
|
|
379
|
-
return this.httpClient.put(`/promo-codes/${id}`,
|
|
399
|
+
const { id, ...rest } = params;
|
|
400
|
+
return this.httpClient.put(`/promo-codes/${id}`, rest, options);
|
|
380
401
|
}
|
|
381
402
|
};
|
|
382
403
|
|
|
@@ -385,49 +406,25 @@ var QuotaResource = class {
|
|
|
385
406
|
constructor(httpClient) {
|
|
386
407
|
this.httpClient = httpClient;
|
|
387
408
|
}
|
|
409
|
+
/** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
|
|
388
410
|
async add(params, options) {
|
|
389
|
-
return this.httpClient.post(
|
|
390
|
-
"/usage/quota",
|
|
391
|
-
{
|
|
392
|
-
customerId: params.customerId,
|
|
393
|
-
featureCode: params.featureCode,
|
|
394
|
-
count: params.count ?? 1
|
|
395
|
-
},
|
|
396
|
-
options
|
|
397
|
-
);
|
|
411
|
+
return this.httpClient.post("/usage/quota", params, options);
|
|
398
412
|
}
|
|
413
|
+
/** Set a customer's quota allowance for a feature to an exact value. */
|
|
399
414
|
async set(params, options) {
|
|
400
|
-
return this.httpClient.put(
|
|
401
|
-
"/usage/quota",
|
|
402
|
-
{
|
|
403
|
-
customerId: params.customerId,
|
|
404
|
-
featureCode: params.featureCode,
|
|
405
|
-
count: params.count
|
|
406
|
-
},
|
|
407
|
-
options
|
|
408
|
-
);
|
|
415
|
+
return this.httpClient.put("/usage/quota", params, options);
|
|
409
416
|
}
|
|
417
|
+
/** Remove from a customer's quota allowance for a feature. Defaults to 1 if count is omitted. Returns 400 insufficient_balance if the balance would go negative. */
|
|
410
418
|
async remove(params, options) {
|
|
411
|
-
return this.httpClient.delete(
|
|
412
|
-
"/usage/quota",
|
|
413
|
-
{
|
|
414
|
-
customerId: params.customerId,
|
|
415
|
-
featureCode: params.featureCode,
|
|
416
|
-
count: params.count ?? 1
|
|
417
|
-
},
|
|
418
|
-
options
|
|
419
|
-
);
|
|
419
|
+
return this.httpClient.delete("/usage/quota", params, options);
|
|
420
420
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
featureCode: params.featureCode
|
|
425
|
-
});
|
|
421
|
+
/** Get the current quota allowance (used vs included) for a specific feature. */
|
|
422
|
+
async get(params, options) {
|
|
423
|
+
return this.httpClient.get("/usage/quota", params, options);
|
|
426
424
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
});
|
|
425
|
+
/** Get all quota allowances for a customer across every quota feature in their plan. */
|
|
426
|
+
async getAll(params, options) {
|
|
427
|
+
return this.httpClient.get("/usage/quota/all", params, options);
|
|
431
428
|
}
|
|
432
429
|
};
|
|
433
430
|
|
|
@@ -436,54 +433,29 @@ var SeatsResource = class {
|
|
|
436
433
|
constructor(httpClient) {
|
|
437
434
|
this.httpClient = httpClient;
|
|
438
435
|
}
|
|
439
|
-
/** Prorates charges for the current billing period. */
|
|
436
|
+
/** Add seats to a customer's subscription. Prorates charges for the current billing period. */
|
|
440
437
|
async add(params, options) {
|
|
441
|
-
return this.httpClient.post(
|
|
442
|
-
"/seats",
|
|
443
|
-
{
|
|
444
|
-
customerId: params.customerId,
|
|
445
|
-
featureCode: params.featureCode,
|
|
446
|
-
count: params.count ?? 1
|
|
447
|
-
},
|
|
448
|
-
options
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
/** Removal takes effect at the end of the billing period. */
|
|
452
|
-
async remove(params, options) {
|
|
453
|
-
return this.httpClient.delete(
|
|
454
|
-
"/seats",
|
|
455
|
-
{
|
|
456
|
-
customerId: params.customerId,
|
|
457
|
-
featureCode: params.featureCode,
|
|
458
|
-
count: params.count ?? 1
|
|
459
|
-
},
|
|
460
|
-
options
|
|
461
|
-
);
|
|
438
|
+
return this.httpClient.post("/seats", params, options);
|
|
462
439
|
}
|
|
440
|
+
/** Set seats to an exact count. */
|
|
463
441
|
async set(params, options) {
|
|
464
|
-
return this.httpClient.put(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
count: params.count
|
|
470
|
-
},
|
|
471
|
-
options
|
|
472
|
-
);
|
|
442
|
+
return this.httpClient.put("/seats", params, options);
|
|
443
|
+
}
|
|
444
|
+
/** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
|
|
445
|
+
async remove(params, options) {
|
|
446
|
+
return this.httpClient.delete("/seats", params, options);
|
|
473
447
|
}
|
|
448
|
+
/** Set all seat types at once. */
|
|
474
449
|
async setAll(params, options) {
|
|
475
450
|
return this.httpClient.put("/seats/bulk", params, options);
|
|
476
451
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
featureCode: params.featureCode
|
|
481
|
-
});
|
|
452
|
+
/** Get current balance for a specific seat type. */
|
|
453
|
+
async getBalance(params, options) {
|
|
454
|
+
return this.httpClient.get("/seats/balance", params, options);
|
|
482
455
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
});
|
|
456
|
+
/** Get the current balance for all seat types in a customer's subscription. */
|
|
457
|
+
async getAllBalances(params, options) {
|
|
458
|
+
return this.httpClient.get("/seats/balances", params, options);
|
|
487
459
|
}
|
|
488
460
|
};
|
|
489
461
|
|
|
@@ -492,54 +464,57 @@ var SubscriptionsResource = class {
|
|
|
492
464
|
constructor(httpClient) {
|
|
493
465
|
this.httpClient = httpClient;
|
|
494
466
|
}
|
|
495
|
-
/**
|
|
467
|
+
/** List all subscriptions. Filter by customer ID or status. */
|
|
468
|
+
async list(params, options) {
|
|
469
|
+
return this.httpClient.get("/subscriptions", params, options);
|
|
470
|
+
}
|
|
471
|
+
/** Create a subscription for a customer. Requires planId or planCode plus customerId. */
|
|
496
472
|
async create(params, options) {
|
|
497
473
|
return this.httpClient.post("/subscriptions", params, options);
|
|
498
474
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
});
|
|
475
|
+
/** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
|
|
476
|
+
async get(params, options) {
|
|
477
|
+
const { id } = params;
|
|
478
|
+
return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
|
|
479
|
+
}
|
|
480
|
+
/** Get the active subscription for a customer. Returns null if none. */
|
|
481
|
+
async getActive(params, options) {
|
|
482
|
+
return this.httpClient.get("/subscriptions/active", params, options);
|
|
503
483
|
}
|
|
504
|
-
/**
|
|
484
|
+
/** Cancel immediately or at period end. */
|
|
505
485
|
async cancel(params, options) {
|
|
506
|
-
const { id, ...
|
|
507
|
-
return this.httpClient.post(`/subscriptions/${id}/cancel`,
|
|
486
|
+
const { id, ...rest } = params;
|
|
487
|
+
return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
|
|
508
488
|
}
|
|
509
|
-
/** Only works
|
|
489
|
+
/** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
|
|
510
490
|
async uncancel(params, options) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
{},
|
|
514
|
-
options
|
|
515
|
-
);
|
|
491
|
+
const { id } = params;
|
|
492
|
+
return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
|
|
516
493
|
}
|
|
517
|
-
/**
|
|
494
|
+
/** Upgrade, downgrade, or change billing interval. */
|
|
518
495
|
async changePlan(params, options) {
|
|
519
|
-
const { id, ...
|
|
496
|
+
const { id, ...rest } = params;
|
|
520
497
|
return this.httpClient.post(
|
|
521
498
|
`/subscriptions/${id}/change-plan`,
|
|
522
|
-
|
|
499
|
+
rest,
|
|
523
500
|
options
|
|
524
501
|
);
|
|
525
502
|
}
|
|
526
|
-
|
|
527
|
-
return this.httpClient.get("/subscriptions", params);
|
|
528
|
-
}
|
|
529
|
-
/** Dry-run: returns proration details without applying the change. */
|
|
503
|
+
/** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. */
|
|
530
504
|
async previewChange(params, options) {
|
|
531
|
-
const { id, ...
|
|
505
|
+
const { id, ...rest } = params;
|
|
532
506
|
return this.httpClient.post(
|
|
533
507
|
`/subscriptions/${id}/preview-change`,
|
|
534
|
-
|
|
508
|
+
rest,
|
|
535
509
|
options
|
|
536
510
|
);
|
|
537
511
|
}
|
|
538
|
-
/**
|
|
512
|
+
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
539
513
|
async activateAddon(params, options) {
|
|
540
|
-
const { id, ...
|
|
541
|
-
return this.httpClient.post(`/subscriptions/${id}/addons`,
|
|
514
|
+
const { id, ...rest } = params;
|
|
515
|
+
return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
|
|
542
516
|
}
|
|
517
|
+
/** Deactivate an add-on from a subscription. */
|
|
543
518
|
async deactivateAddon(params, options) {
|
|
544
519
|
const { id, addonId } = params;
|
|
545
520
|
return this.httpClient.delete(
|
|
@@ -548,27 +523,47 @@ var SubscriptionsResource = class {
|
|
|
548
523
|
options
|
|
549
524
|
);
|
|
550
525
|
}
|
|
551
|
-
/**
|
|
526
|
+
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
552
527
|
async adjustBalance(params, options) {
|
|
553
|
-
const { id, ...
|
|
528
|
+
const { id, ...rest } = params;
|
|
554
529
|
return this.httpClient.post(
|
|
555
530
|
`/subscriptions/${id}/balance/adjust`,
|
|
556
|
-
|
|
531
|
+
rest,
|
|
557
532
|
options
|
|
558
533
|
);
|
|
559
534
|
}
|
|
560
|
-
/** Charges the customer's payment method. */
|
|
535
|
+
/** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
|
|
561
536
|
async topupBalance(params, options) {
|
|
562
|
-
const { id, ...
|
|
537
|
+
const { id, ...rest } = params;
|
|
563
538
|
return this.httpClient.post(
|
|
564
539
|
`/subscriptions/${id}/balance/topup`,
|
|
565
|
-
|
|
540
|
+
rest,
|
|
566
541
|
options
|
|
567
542
|
);
|
|
568
543
|
}
|
|
544
|
+
/** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
|
|
569
545
|
async purchaseCredits(params, options) {
|
|
570
|
-
const { id, ...
|
|
571
|
-
return this.httpClient.post(`/subscriptions/${id}/credits`,
|
|
546
|
+
const { id, ...rest } = params;
|
|
547
|
+
return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/resources/test-clock.ts
|
|
552
|
+
var TestClockResource = class {
|
|
553
|
+
constructor(httpClient) {
|
|
554
|
+
this.httpClient = httpClient;
|
|
555
|
+
}
|
|
556
|
+
/** Returns the organization's current test clock state. Sandbox only. */
|
|
557
|
+
async get() {
|
|
558
|
+
return this.httpClient.get("/test-clock");
|
|
559
|
+
}
|
|
560
|
+
/** Moves the test clock forward, by a number of days (advanceDays) or to an absolute instant (frozenTime). The clock can only move forward. Sandbox only. */
|
|
561
|
+
async advance(params, options) {
|
|
562
|
+
return this.httpClient.post("/test-clock", params, options);
|
|
563
|
+
}
|
|
564
|
+
/** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Enqueueing is asynchronous. Sandbox only. */
|
|
565
|
+
async processBilling() {
|
|
566
|
+
return this.httpClient.post("/test-clock/process-billing", {});
|
|
572
567
|
}
|
|
573
568
|
};
|
|
574
569
|
|
|
@@ -577,27 +572,46 @@ var TransactionsResource = class {
|
|
|
577
572
|
constructor(httpClient) {
|
|
578
573
|
this.httpClient = httpClient;
|
|
579
574
|
}
|
|
580
|
-
|
|
581
|
-
|
|
575
|
+
/** List payment transactions with cursor-based pagination. Filter by status or customer email. */
|
|
576
|
+
async list(params, options) {
|
|
577
|
+
return this.httpClient.get("/transactions", params, options);
|
|
582
578
|
}
|
|
583
|
-
|
|
584
|
-
|
|
579
|
+
/** Retrieve a single payment transaction by its public ID, including provider details. */
|
|
580
|
+
async get(params, options) {
|
|
581
|
+
const { id } = params;
|
|
582
|
+
return this.httpClient.get(`/transactions/${id}`, void 0, options);
|
|
585
583
|
}
|
|
586
|
-
/**
|
|
584
|
+
/** Issue a full refund for a payment transaction. */
|
|
587
585
|
async refund(params, options) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
{},
|
|
591
|
-
options
|
|
592
|
-
);
|
|
586
|
+
const { id } = params;
|
|
587
|
+
return this.httpClient.post(`/transactions/${id}/refund`, {}, options);
|
|
593
588
|
}
|
|
594
|
-
/** Creates a new invoice and initiates a new payment attempt. */
|
|
589
|
+
/** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
|
|
595
590
|
async retry(params, options) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
591
|
+
const { id } = params;
|
|
592
|
+
return this.httpClient.post(`/transactions/${id}/retry`, {}, options);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
// src/_generated_resources.ts
|
|
597
|
+
var GeneratedResources = class {
|
|
598
|
+
initResources(http) {
|
|
599
|
+
this.addons = new AddonsResource(http);
|
|
600
|
+
this.apiKeys = new ApiKeysResource(http);
|
|
601
|
+
this.creditPacks = new CreditPacksResource(http);
|
|
602
|
+
this.customers = new CustomersResource(http);
|
|
603
|
+
this.features = new FeaturesResource(http);
|
|
604
|
+
this.invoices = new InvoicesResource(http);
|
|
605
|
+
this.payouts = new PayoutsResource(http);
|
|
606
|
+
this.planGroups = new PlanGroupsResource(http);
|
|
607
|
+
this.plans = new PlansResource(http);
|
|
608
|
+
this.portal = new PortalResource(http);
|
|
609
|
+
this.promoCodes = new PromoCodesResource(http);
|
|
610
|
+
this.quota = new QuotaResource(http);
|
|
611
|
+
this.seats = new SeatsResource(http);
|
|
612
|
+
this.subscriptions = new SubscriptionsResource(http);
|
|
613
|
+
this.testClock = new TestClockResource(http);
|
|
614
|
+
this.transactions = new TransactionsResource(http);
|
|
601
615
|
}
|
|
602
616
|
};
|
|
603
617
|
|
|
@@ -732,8 +746,8 @@ var CommetValidationError = class extends CommetError {
|
|
|
732
746
|
};
|
|
733
747
|
|
|
734
748
|
// src/version.ts
|
|
735
|
-
var API_VERSION = "2026-
|
|
736
|
-
var SDK_VERSION = "
|
|
749
|
+
var API_VERSION = "2026-06-07";
|
|
750
|
+
var SDK_VERSION = "6.0.0";
|
|
737
751
|
|
|
738
752
|
// src/utils/telemetry.ts
|
|
739
753
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|
|
@@ -1041,8 +1055,9 @@ _CommetHTTPClient.BODY_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"
|
|
|
1041
1055
|
var CommetHTTPClient = _CommetHTTPClient;
|
|
1042
1056
|
|
|
1043
1057
|
// src/client.ts
|
|
1044
|
-
var Commet = class {
|
|
1058
|
+
var Commet = class extends GeneratedResources {
|
|
1045
1059
|
constructor(config) {
|
|
1060
|
+
super();
|
|
1046
1061
|
if (!config.apiKey) {
|
|
1047
1062
|
throw new Error("Commet SDK: API key is required");
|
|
1048
1063
|
}
|
|
@@ -1052,20 +1067,7 @@ var Commet = class {
|
|
|
1052
1067
|
);
|
|
1053
1068
|
}
|
|
1054
1069
|
this.httpClient = new CommetHTTPClient(config);
|
|
1055
|
-
this.
|
|
1056
|
-
this.apiKeys = new ApiKeysResource(this.httpClient);
|
|
1057
|
-
this.creditPacks = new CreditPacksResource(this.httpClient);
|
|
1058
|
-
this.customers = new CustomersResource(this.httpClient);
|
|
1059
|
-
this.features = new FeaturesResource(this.httpClient);
|
|
1060
|
-
this.invoices = new InvoicesResource(this.httpClient);
|
|
1061
|
-
this.planGroups = new PlanGroupsResource(this.httpClient);
|
|
1062
|
-
this.plans = new PlansResource(this.httpClient);
|
|
1063
|
-
this.portal = new PortalResource(this.httpClient);
|
|
1064
|
-
this.promoCodes = new PromoCodesResource(this.httpClient);
|
|
1065
|
-
this.quota = new QuotaResource(this.httpClient);
|
|
1066
|
-
this.seats = new SeatsResource(this.httpClient);
|
|
1067
|
-
this.subscriptions = new SubscriptionsResource(this.httpClient);
|
|
1068
|
-
this.transactions = new TransactionsResource(this.httpClient);
|
|
1070
|
+
this.initResources(this.httpClient);
|
|
1069
1071
|
this.usage = new UsageResource(this.httpClient);
|
|
1070
1072
|
this.webhooks = new Webhooks(this.httpClient);
|
|
1071
1073
|
}
|