@commet/node 5.5.1 → 7.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/README.md +5 -5
- package/dist/index.d.mts +1309 -992
- package/dist/index.d.ts +1309 -992
- package/dist/index.js +317 -298
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +317 -298
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -49,28 +49,29 @@ var AddonsResource = class {
|
|
|
49
49
|
constructor(httpClient) {
|
|
50
50
|
this.httpClient = httpClient;
|
|
51
51
|
}
|
|
52
|
+
/** List all active add-ons for a customer's subscription. */
|
|
52
53
|
async listActive(params, options) {
|
|
53
|
-
return this.httpClient.get(
|
|
54
|
-
"/addons/active",
|
|
55
|
-
{ customerId: params.customerId },
|
|
56
|
-
options
|
|
57
|
-
);
|
|
54
|
+
return this.httpClient.get("/active-addons", params, options);
|
|
58
55
|
}
|
|
56
|
+
/** List all add-ons with cursor-based pagination. */
|
|
59
57
|
async list(params, options) {
|
|
60
58
|
return this.httpClient.get("/addons", params, options);
|
|
61
59
|
}
|
|
60
|
+
/** Retrieve an add-on by its public ID or slug. */
|
|
62
61
|
async get(params, options) {
|
|
63
62
|
const { id } = params;
|
|
64
63
|
return this.httpClient.get(`/addons/${id}`, void 0, options);
|
|
65
64
|
}
|
|
65
|
+
/** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
|
|
66
66
|
async create(params, options) {
|
|
67
67
|
return this.httpClient.post("/addons", params, options);
|
|
68
68
|
}
|
|
69
|
+
/** Update an add-on's name, description, or pricing. */
|
|
69
70
|
async update(params, options) {
|
|
70
|
-
const { id, ...
|
|
71
|
-
return this.httpClient.put(`/addons/${id}`,
|
|
71
|
+
const { id, ...rest } = params;
|
|
72
|
+
return this.httpClient.put(`/addons/${id}`, rest, options);
|
|
72
73
|
}
|
|
73
|
-
/** Fails if
|
|
74
|
+
/** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
|
|
74
75
|
async delete(params, options) {
|
|
75
76
|
const { id } = params;
|
|
76
77
|
return this.httpClient.delete(`/addons/${id}`, void 0, options);
|
|
@@ -82,15 +83,18 @@ var ApiKeysResource = class {
|
|
|
82
83
|
constructor(httpClient) {
|
|
83
84
|
this.httpClient = httpClient;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
/** List API keys with cursor-based pagination. Keys are returned without the full secret. */
|
|
87
|
+
async list(params, options) {
|
|
88
|
+
return this.httpClient.get("/api-keys", params, options);
|
|
87
89
|
}
|
|
88
|
-
/**
|
|
90
|
+
/** Create a new API key. The full key is only returned once in the response. */
|
|
89
91
|
async create(params, options) {
|
|
90
92
|
return this.httpClient.post("/api-keys", params, options);
|
|
91
93
|
}
|
|
94
|
+
/** Permanently revoke and delete an API key. */
|
|
92
95
|
async delete(params, options) {
|
|
93
|
-
|
|
96
|
+
const { id } = params;
|
|
97
|
+
return this.httpClient.delete(`/api-keys/${id}`, void 0, options);
|
|
94
98
|
}
|
|
95
99
|
};
|
|
96
100
|
|
|
@@ -99,16 +103,20 @@ var CreditPacksResource = class {
|
|
|
99
103
|
constructor(httpClient) {
|
|
100
104
|
this.httpClient = httpClient;
|
|
101
105
|
}
|
|
106
|
+
/** List all active credit packs. */
|
|
102
107
|
async list() {
|
|
103
108
|
return this.httpClient.get("/credit-packs");
|
|
104
109
|
}
|
|
110
|
+
/** Create a new credit pack. */
|
|
105
111
|
async create(params, options) {
|
|
106
112
|
return this.httpClient.post("/credit-packs/manage", params, options);
|
|
107
113
|
}
|
|
114
|
+
/** Update a credit pack's name, description, credits, price, or active status. */
|
|
108
115
|
async update(params, options) {
|
|
109
|
-
const { id, ...
|
|
110
|
-
return this.httpClient.put(`/credit-packs/${id}`,
|
|
116
|
+
const { id, ...rest } = params;
|
|
117
|
+
return this.httpClient.put(`/credit-packs/${id}`, rest, options);
|
|
111
118
|
}
|
|
119
|
+
/** Soft-delete a credit pack. */
|
|
112
120
|
async delete(params, options) {
|
|
113
121
|
const { id } = params;
|
|
114
122
|
return this.httpClient.delete(`/credit-packs/${id}`, void 0, options);
|
|
@@ -120,100 +128,79 @@ var CustomersResource = class {
|
|
|
120
128
|
constructor(httpClient) {
|
|
121
129
|
this.httpClient = httpClient;
|
|
122
130
|
}
|
|
123
|
-
/**
|
|
131
|
+
/** List customers with cursor-based pagination. */
|
|
132
|
+
async list(params, options) {
|
|
133
|
+
return this.httpClient.get("/customers", params, options);
|
|
134
|
+
}
|
|
135
|
+
/** Create a new customer. Idempotent when customerId is provided. */
|
|
124
136
|
async create(params, options) {
|
|
125
|
-
return this.httpClient.post(
|
|
126
|
-
"/customers",
|
|
127
|
-
{
|
|
128
|
-
billingEmail: params.email,
|
|
129
|
-
id: params.id,
|
|
130
|
-
fullName: params.fullName,
|
|
131
|
-
domain: params.domain,
|
|
132
|
-
website: params.website,
|
|
133
|
-
timezone: params.timezone,
|
|
134
|
-
language: params.language,
|
|
135
|
-
industry: params.industry,
|
|
136
|
-
metadata: params.metadata,
|
|
137
|
-
address: params.address
|
|
138
|
-
},
|
|
139
|
-
options
|
|
140
|
-
);
|
|
137
|
+
return this.httpClient.post("/customers", params, options);
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
fullName: c.fullName,
|
|
147
|
-
domain: c.domain,
|
|
148
|
-
website: c.website,
|
|
149
|
-
timezone: c.timezone,
|
|
150
|
-
language: c.language,
|
|
151
|
-
industry: c.industry,
|
|
152
|
-
metadata: c.metadata,
|
|
153
|
-
address: c.address
|
|
154
|
-
}));
|
|
155
|
-
return this.httpClient.post("/customers/batch", { customers }, options);
|
|
156
|
-
}
|
|
157
|
-
async get(params) {
|
|
158
|
-
return this.httpClient.get(`/customers/${params.id}`);
|
|
139
|
+
/** Retrieve a customer by their public ID, including subscription status and metadata. */
|
|
140
|
+
async get(params, options) {
|
|
141
|
+
const { id } = params;
|
|
142
|
+
return this.httpClient.get(`/customers/${id}`, void 0, options);
|
|
159
143
|
}
|
|
144
|
+
/** Update a customer's name, external ID, or metadata. */
|
|
160
145
|
async update(params, options) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
billingEmail: params.email,
|
|
165
|
-
fullName: params.fullName,
|
|
166
|
-
domain: params.domain,
|
|
167
|
-
website: params.website,
|
|
168
|
-
timezone: params.timezone,
|
|
169
|
-
language: params.language,
|
|
170
|
-
industry: params.industry,
|
|
171
|
-
metadata: params.metadata,
|
|
172
|
-
address: params.address
|
|
173
|
-
},
|
|
174
|
-
options
|
|
175
|
-
);
|
|
146
|
+
const { id, ...rest } = params;
|
|
147
|
+
return this.httpClient.put(`/customers/${id}`, rest, options);
|
|
176
148
|
}
|
|
177
|
-
|
|
178
|
-
|
|
149
|
+
/** Create up to 100 customers in a single request. */
|
|
150
|
+
async createBatch(params, options) {
|
|
151
|
+
return this.httpClient.post("/customers/batch", params, options);
|
|
179
152
|
}
|
|
180
153
|
};
|
|
181
154
|
|
|
182
|
-
// src/resources/
|
|
183
|
-
var
|
|
155
|
+
// src/resources/feature-access.ts
|
|
156
|
+
var FeatureAccessResource = class {
|
|
184
157
|
constructor(httpClient) {
|
|
185
158
|
this.httpClient = httpClient;
|
|
186
159
|
}
|
|
160
|
+
/** List all features for a customer's active subscription, scoped by the customerId query parameter. */
|
|
161
|
+
async list(params, options) {
|
|
162
|
+
return this.httpClient.get("/feature-access", params, options);
|
|
163
|
+
}
|
|
164
|
+
/** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
|
|
187
165
|
async get(params, options) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
{ customerId: params.customerId },
|
|
191
|
-
options
|
|
192
|
-
);
|
|
166
|
+
const { code, ...rest } = params;
|
|
167
|
+
return this.httpClient.get(`/feature-access/${code}`, rest, options);
|
|
193
168
|
}
|
|
194
|
-
/**
|
|
169
|
+
/** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
|
|
195
170
|
async canUse(params, options) {
|
|
171
|
+
const { code, ...rest } = params;
|
|
196
172
|
return this.httpClient.get(
|
|
197
|
-
`/
|
|
198
|
-
{
|
|
173
|
+
`/feature-access/${code}`,
|
|
174
|
+
{ ...rest, action: "canUse" },
|
|
199
175
|
options
|
|
200
176
|
);
|
|
201
177
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/resources/features.ts
|
|
181
|
+
var FeaturesResource = class {
|
|
182
|
+
constructor(httpClient) {
|
|
183
|
+
this.httpClient = httpClient;
|
|
184
|
+
}
|
|
185
|
+
/** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
|
|
186
|
+
async list() {
|
|
187
|
+
return this.httpClient.get("/features");
|
|
208
188
|
}
|
|
189
|
+
/** Get a single feature definition by code from the organization's feature catalog. */
|
|
190
|
+
async get(params, options) {
|
|
191
|
+
const { code } = params;
|
|
192
|
+
return this.httpClient.get(`/features/${code}`, void 0, options);
|
|
193
|
+
}
|
|
194
|
+
/** Create a new feature. Code must be lowercase alphanumeric with underscores. */
|
|
209
195
|
async create(params, options) {
|
|
210
196
|
return this.httpClient.post("/features/manage", params, options);
|
|
211
197
|
}
|
|
198
|
+
/** Update a feature's name, description, or unit name. At least one field must be provided. */
|
|
212
199
|
async update(params, options) {
|
|
213
|
-
const { code, ...
|
|
214
|
-
return this.httpClient.put(`/features/${code}/manage`,
|
|
200
|
+
const { code, ...rest } = params;
|
|
201
|
+
return this.httpClient.put(`/features/${code}/manage`, rest, options);
|
|
215
202
|
}
|
|
216
|
-
/** Fails if feature is attached to active plans or has an active
|
|
203
|
+
/** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
|
|
217
204
|
async delete(params, options) {
|
|
218
205
|
const { code } = params;
|
|
219
206
|
return this.httpClient.delete(
|
|
@@ -229,27 +216,52 @@ var InvoicesResource = class {
|
|
|
229
216
|
constructor(httpClient) {
|
|
230
217
|
this.httpClient = httpClient;
|
|
231
218
|
}
|
|
232
|
-
|
|
233
|
-
|
|
219
|
+
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
220
|
+
async list(params, options) {
|
|
221
|
+
return this.httpClient.get("/invoices", params, options);
|
|
234
222
|
}
|
|
235
|
-
|
|
236
|
-
|
|
223
|
+
/** Retrieve a single invoice by its public ID, including line items. */
|
|
224
|
+
async get(params, options) {
|
|
225
|
+
const { id } = params;
|
|
226
|
+
return this.httpClient.get(`/invoices/${id}`, void 0, options);
|
|
237
227
|
}
|
|
238
|
-
/**
|
|
228
|
+
/** Create a one-off adjustment invoice. Use a negative amount for a credit. */
|
|
239
229
|
async createAdjustment(params, options) {
|
|
240
230
|
return this.httpClient.post("/invoices", params, options);
|
|
241
231
|
}
|
|
242
|
-
/**
|
|
243
|
-
async getDownloadUrl(params) {
|
|
244
|
-
|
|
232
|
+
/** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
|
|
233
|
+
async getDownloadUrl(params, options) {
|
|
234
|
+
const { id } = params;
|
|
235
|
+
return this.httpClient.get(`/invoices/${id}/download`, void 0, options);
|
|
245
236
|
}
|
|
237
|
+
/** Send the invoice to the customer via email. */
|
|
246
238
|
async send(params, options) {
|
|
247
|
-
|
|
239
|
+
const { id } = params;
|
|
240
|
+
return this.httpClient.post(`/invoices/${id}/send`, {}, options);
|
|
248
241
|
}
|
|
249
|
-
/**
|
|
242
|
+
/** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
|
|
250
243
|
async updateStatus(params, options) {
|
|
251
|
-
const { id, ...
|
|
252
|
-
return this.httpClient.put(`/invoices/${id}/status`,
|
|
244
|
+
const { id, ...rest } = params;
|
|
245
|
+
return this.httpClient.put(`/invoices/${id}/status`, rest, options);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/resources/payouts.ts
|
|
250
|
+
var PayoutsResource = class {
|
|
251
|
+
constructor(httpClient) {
|
|
252
|
+
this.httpClient = httpClient;
|
|
253
|
+
}
|
|
254
|
+
/** 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`. */
|
|
255
|
+
async addBankAccount(params, options) {
|
|
256
|
+
return this.httpClient.post("/payouts/bank-accounts", params, options);
|
|
257
|
+
}
|
|
258
|
+
/** 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. */
|
|
259
|
+
async request(params, options) {
|
|
260
|
+
return this.httpClient.post("/payouts", params, options);
|
|
261
|
+
}
|
|
262
|
+
/** 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. */
|
|
263
|
+
async completeVerification(params, options) {
|
|
264
|
+
return this.httpClient.post("/payouts/verification", params, options);
|
|
253
265
|
}
|
|
254
266
|
};
|
|
255
267
|
|
|
@@ -258,31 +270,35 @@ var PlanGroupsResource = class {
|
|
|
258
270
|
constructor(httpClient) {
|
|
259
271
|
this.httpClient = httpClient;
|
|
260
272
|
}
|
|
261
|
-
|
|
262
|
-
|
|
273
|
+
/** List plan groups with cursor-based pagination. */
|
|
274
|
+
async list(params, options) {
|
|
275
|
+
return this.httpClient.get("/plan-groups", params, options);
|
|
263
276
|
}
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
/** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
|
|
278
|
+
async get(params, options) {
|
|
279
|
+
const { id } = params;
|
|
280
|
+
return this.httpClient.get(`/plan-groups/${id}`, void 0, options);
|
|
266
281
|
}
|
|
282
|
+
/** Create a new plan group for organizing plans. */
|
|
267
283
|
async create(params, options) {
|
|
268
284
|
return this.httpClient.post("/plan-groups", params, options);
|
|
269
285
|
}
|
|
286
|
+
/** Update a plan group's name, description, or visibility. */
|
|
270
287
|
async update(params, options) {
|
|
271
|
-
const { id, ...
|
|
272
|
-
return this.httpClient.put(`/plan-groups/${id}`,
|
|
288
|
+
const { id, ...rest } = params;
|
|
289
|
+
return this.httpClient.put(`/plan-groups/${id}`, rest, options);
|
|
273
290
|
}
|
|
274
|
-
/** Plans in the group are unlinked, not deleted. */
|
|
291
|
+
/** Delete a plan group. Plans in the group are unlinked, not deleted. */
|
|
275
292
|
async delete(params, options) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
void 0,
|
|
279
|
-
options
|
|
280
|
-
);
|
|
293
|
+
const { id } = params;
|
|
294
|
+
return this.httpClient.delete(`/plan-groups/${id}`, void 0, options);
|
|
281
295
|
}
|
|
296
|
+
/** Add an existing plan to a plan group with optional sort order. */
|
|
282
297
|
async addPlan(params, options) {
|
|
283
|
-
const { id, ...
|
|
284
|
-
return this.httpClient.post(`/plan-groups/${id}/plans`,
|
|
298
|
+
const { id, ...rest } = params;
|
|
299
|
+
return this.httpClient.post(`/plan-groups/${id}/plans`, rest, options);
|
|
285
300
|
}
|
|
301
|
+
/** Remove a plan from a plan group. */
|
|
286
302
|
async removePlan(params, options) {
|
|
287
303
|
const { id, planId } = params;
|
|
288
304
|
return this.httpClient.delete(
|
|
@@ -291,11 +307,12 @@ var PlanGroupsResource = class {
|
|
|
291
307
|
options
|
|
292
308
|
);
|
|
293
309
|
}
|
|
310
|
+
/** Set the display order of plans within a group. All plan IDs in the group must be provided. */
|
|
294
311
|
async reorderPlans(params, options) {
|
|
295
|
-
const { id, ...
|
|
312
|
+
const { id, ...rest } = params;
|
|
296
313
|
return this.httpClient.put(
|
|
297
314
|
`/plan-groups/${id}/plans/reorder`,
|
|
298
|
-
|
|
315
|
+
rest,
|
|
299
316
|
options
|
|
300
317
|
);
|
|
301
318
|
}
|
|
@@ -306,90 +323,104 @@ var PlansResource = class {
|
|
|
306
323
|
constructor(httpClient) {
|
|
307
324
|
this.httpClient = httpClient;
|
|
308
325
|
}
|
|
309
|
-
|
|
310
|
-
|
|
326
|
+
/** List all plans with their prices and features. Optionally include private plans. */
|
|
327
|
+
async list(params, options) {
|
|
328
|
+
return this.httpClient.get("/plans", params, options);
|
|
311
329
|
}
|
|
312
|
-
|
|
313
|
-
|
|
330
|
+
/** Get detailed plan information by code or ID. */
|
|
331
|
+
async get(params, options) {
|
|
332
|
+
const { id } = params;
|
|
333
|
+
return this.httpClient.get(`/plans/${id}`, void 0, options);
|
|
314
334
|
}
|
|
335
|
+
/** Create a new plan with optional consumption model, visibility, and plan group assignment. */
|
|
315
336
|
async create(params, options) {
|
|
316
337
|
return this.httpClient.post("/plans/manage", params, options);
|
|
317
338
|
}
|
|
339
|
+
/** Update a plan's name, description, visibility, or metadata. */
|
|
318
340
|
async update(params, options) {
|
|
319
|
-
const { id, ...
|
|
320
|
-
return this.httpClient.put(`/plans/${id}/manage`,
|
|
341
|
+
const { id, ...rest } = params;
|
|
342
|
+
return this.httpClient.put(`/plans/${id}/manage`, rest, options);
|
|
321
343
|
}
|
|
344
|
+
/** Soft-delete a plan. */
|
|
322
345
|
async delete(params, options) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
void 0,
|
|
326
|
-
options
|
|
327
|
-
);
|
|
346
|
+
const { id } = params;
|
|
347
|
+
return this.httpClient.delete(`/plans/${id}/manage`, void 0, options);
|
|
328
348
|
}
|
|
349
|
+
/** Toggle a plan between public and private. */
|
|
329
350
|
async setVisibility(params, options) {
|
|
330
|
-
const { id, ...
|
|
331
|
-
return this.httpClient.put(`/plans/${id}/visibility`,
|
|
351
|
+
const { id, ...rest } = params;
|
|
352
|
+
return this.httpClient.put(`/plans/${id}/visibility`, rest, options);
|
|
332
353
|
}
|
|
354
|
+
/** Attach a feature to a plan with limits, overage, and credits configuration. */
|
|
333
355
|
async addFeature(params, options) {
|
|
334
|
-
const {
|
|
335
|
-
return this.httpClient.post(`/plans/${
|
|
356
|
+
const { id, ...rest } = params;
|
|
357
|
+
return this.httpClient.post(`/plans/${id}/features`, rest, options);
|
|
336
358
|
}
|
|
359
|
+
/** Update limits, overage, or enabled status of a feature on a plan. */
|
|
337
360
|
async updateFeature(params, options) {
|
|
338
|
-
const {
|
|
361
|
+
const { id, featureId, ...rest } = params;
|
|
339
362
|
return this.httpClient.put(
|
|
340
|
-
`/plans/${
|
|
341
|
-
|
|
363
|
+
`/plans/${id}/features/${featureId}`,
|
|
364
|
+
rest,
|
|
342
365
|
options
|
|
343
366
|
);
|
|
344
367
|
}
|
|
368
|
+
/** Detach a feature from a plan. */
|
|
345
369
|
async removeFeature(params, options) {
|
|
346
|
-
const {
|
|
370
|
+
const { id, featureId } = params;
|
|
347
371
|
return this.httpClient.delete(
|
|
348
|
-
`/plans/${
|
|
372
|
+
`/plans/${id}/features/${featureId}`,
|
|
349
373
|
void 0,
|
|
350
374
|
options
|
|
351
375
|
);
|
|
352
376
|
}
|
|
377
|
+
/** Add a billing interval price to a plan with optional trial days and included balance/credits. */
|
|
353
378
|
async addPrice(params, options) {
|
|
354
|
-
const {
|
|
355
|
-
return this.httpClient.post(`/plans/${
|
|
379
|
+
const { id, ...rest } = params;
|
|
380
|
+
return this.httpClient.post(`/plans/${id}/prices`, rest, options);
|
|
356
381
|
}
|
|
382
|
+
/** Update an existing price on a plan. */
|
|
357
383
|
async updatePrice(params, options) {
|
|
358
|
-
const {
|
|
359
|
-
return this.httpClient.put(
|
|
360
|
-
`/plans/${planId}/prices/${priceId}`,
|
|
361
|
-
body,
|
|
362
|
-
options
|
|
363
|
-
);
|
|
384
|
+
const { id, priceId, ...rest } = params;
|
|
385
|
+
return this.httpClient.put(`/plans/${id}/prices/${priceId}`, rest, options);
|
|
364
386
|
}
|
|
387
|
+
/** Remove a price from a plan. */
|
|
365
388
|
async deletePrice(params, options) {
|
|
366
|
-
const {
|
|
389
|
+
const { id, priceId } = params;
|
|
367
390
|
return this.httpClient.delete(
|
|
368
|
-
`/plans/${
|
|
391
|
+
`/plans/${id}/prices/${priceId}`,
|
|
369
392
|
void 0,
|
|
370
393
|
options
|
|
371
394
|
);
|
|
372
395
|
}
|
|
396
|
+
/** Set a specific price as the default for its plan. Unsets previous default. */
|
|
373
397
|
async setDefaultPrice(params, options) {
|
|
374
|
-
const {
|
|
398
|
+
const { id, priceId } = params;
|
|
375
399
|
return this.httpClient.put(
|
|
376
|
-
`/plans/${
|
|
400
|
+
`/plans/${id}/prices/${priceId}/default`,
|
|
377
401
|
{},
|
|
378
402
|
options
|
|
379
403
|
);
|
|
380
404
|
}
|
|
405
|
+
/** Create or update regional currency price overrides for a plan price. */
|
|
381
406
|
async setRegionalPrices(params, options) {
|
|
382
|
-
const {
|
|
407
|
+
const { id, priceId, ...rest } = params;
|
|
383
408
|
return this.httpClient.put(
|
|
384
|
-
`/plans/${
|
|
385
|
-
|
|
409
|
+
`/plans/${id}/prices/${priceId}/regional`,
|
|
410
|
+
rest,
|
|
386
411
|
options
|
|
387
412
|
);
|
|
388
413
|
}
|
|
414
|
+
/** 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. */
|
|
415
|
+
async setRegionalPricing(params, options) {
|
|
416
|
+
const { id, ...rest } = params;
|
|
417
|
+
return this.httpClient.put(`/plans/${id}/regional`, rest, options);
|
|
418
|
+
}
|
|
419
|
+
/** Remove all regional currency overrides for a plan price. */
|
|
389
420
|
async deleteRegionalPrices(params, options) {
|
|
390
|
-
const {
|
|
421
|
+
const { id, priceId } = params;
|
|
391
422
|
return this.httpClient.delete(
|
|
392
|
-
`/plans/${
|
|
423
|
+
`/plans/${id}/prices/${priceId}/regional`,
|
|
393
424
|
void 0,
|
|
394
425
|
options
|
|
395
426
|
);
|
|
@@ -401,6 +432,7 @@ var PortalResource = class {
|
|
|
401
432
|
constructor(httpClient) {
|
|
402
433
|
this.httpClient = httpClient;
|
|
403
434
|
}
|
|
435
|
+
/** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
|
|
404
436
|
async getUrl(params, options) {
|
|
405
437
|
return this.httpClient.post("/portal/request-access", params, options);
|
|
406
438
|
}
|
|
@@ -411,18 +443,23 @@ var PromoCodesResource = class {
|
|
|
411
443
|
constructor(httpClient) {
|
|
412
444
|
this.httpClient = httpClient;
|
|
413
445
|
}
|
|
414
|
-
|
|
415
|
-
|
|
446
|
+
/** List promo codes with cursor-based pagination. */
|
|
447
|
+
async list(params, options) {
|
|
448
|
+
return this.httpClient.get("/promo-codes", params, options);
|
|
416
449
|
}
|
|
417
|
-
|
|
418
|
-
|
|
450
|
+
/** Retrieve a promo code by its public ID. */
|
|
451
|
+
async get(params, options) {
|
|
452
|
+
const { id } = params;
|
|
453
|
+
return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
|
|
419
454
|
}
|
|
455
|
+
/** Create a new promo code. Optionally restrict to specific plans. */
|
|
420
456
|
async create(params, options) {
|
|
421
457
|
return this.httpClient.post("/promo-codes", params, options);
|
|
422
458
|
}
|
|
459
|
+
/** Update a promo code's redemption limits, expiration, active status, or plan restrictions. */
|
|
423
460
|
async update(params, options) {
|
|
424
|
-
const { id, ...
|
|
425
|
-
return this.httpClient.put(`/promo-codes/${id}`,
|
|
461
|
+
const { id, ...rest } = params;
|
|
462
|
+
return this.httpClient.put(`/promo-codes/${id}`, rest, options);
|
|
426
463
|
}
|
|
427
464
|
};
|
|
428
465
|
|
|
@@ -431,49 +468,25 @@ var QuotaResource = class {
|
|
|
431
468
|
constructor(httpClient) {
|
|
432
469
|
this.httpClient = httpClient;
|
|
433
470
|
}
|
|
471
|
+
/** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
|
|
434
472
|
async add(params, options) {
|
|
435
|
-
return this.httpClient.post(
|
|
436
|
-
"/usage/quota",
|
|
437
|
-
{
|
|
438
|
-
customerId: params.customerId,
|
|
439
|
-
featureCode: params.featureCode,
|
|
440
|
-
count: params.count ?? 1
|
|
441
|
-
},
|
|
442
|
-
options
|
|
443
|
-
);
|
|
473
|
+
return this.httpClient.post("/usage/quota", params, options);
|
|
444
474
|
}
|
|
475
|
+
/** Set a customer's quota allowance for a feature to an exact value. */
|
|
445
476
|
async set(params, options) {
|
|
446
|
-
return this.httpClient.put(
|
|
447
|
-
"/usage/quota",
|
|
448
|
-
{
|
|
449
|
-
customerId: params.customerId,
|
|
450
|
-
featureCode: params.featureCode,
|
|
451
|
-
count: params.count
|
|
452
|
-
},
|
|
453
|
-
options
|
|
454
|
-
);
|
|
477
|
+
return this.httpClient.put("/usage/quota", params, options);
|
|
455
478
|
}
|
|
479
|
+
/** 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. */
|
|
456
480
|
async remove(params, options) {
|
|
457
|
-
return this.httpClient.delete(
|
|
458
|
-
"/usage/quota",
|
|
459
|
-
{
|
|
460
|
-
customerId: params.customerId,
|
|
461
|
-
featureCode: params.featureCode,
|
|
462
|
-
count: params.count ?? 1
|
|
463
|
-
},
|
|
464
|
-
options
|
|
465
|
-
);
|
|
481
|
+
return this.httpClient.delete("/usage/quota", params, options);
|
|
466
482
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
featureCode: params.featureCode
|
|
471
|
-
});
|
|
483
|
+
/** Get the current quota allowance (used vs included) for a specific feature. */
|
|
484
|
+
async get(params, options) {
|
|
485
|
+
return this.httpClient.get("/usage/quota", params, options);
|
|
472
486
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
});
|
|
487
|
+
/** Get all quota allowances for a customer across every quota feature in their plan. */
|
|
488
|
+
async getAll(params, options) {
|
|
489
|
+
return this.httpClient.get("/usage/quota/all", params, options);
|
|
477
490
|
}
|
|
478
491
|
};
|
|
479
492
|
|
|
@@ -482,54 +495,29 @@ var SeatsResource = class {
|
|
|
482
495
|
constructor(httpClient) {
|
|
483
496
|
this.httpClient = httpClient;
|
|
484
497
|
}
|
|
485
|
-
/** Prorates charges for the current billing period. */
|
|
498
|
+
/** Add seats to a customer's subscription. Prorates charges for the current billing period. */
|
|
486
499
|
async add(params, options) {
|
|
487
|
-
return this.httpClient.post(
|
|
488
|
-
"/seats",
|
|
489
|
-
{
|
|
490
|
-
customerId: params.customerId,
|
|
491
|
-
featureCode: params.featureCode,
|
|
492
|
-
count: params.count ?? 1
|
|
493
|
-
},
|
|
494
|
-
options
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
/** Removal takes effect at the end of the billing period. */
|
|
498
|
-
async remove(params, options) {
|
|
499
|
-
return this.httpClient.delete(
|
|
500
|
-
"/seats",
|
|
501
|
-
{
|
|
502
|
-
customerId: params.customerId,
|
|
503
|
-
featureCode: params.featureCode,
|
|
504
|
-
count: params.count ?? 1
|
|
505
|
-
},
|
|
506
|
-
options
|
|
507
|
-
);
|
|
500
|
+
return this.httpClient.post("/seats", params, options);
|
|
508
501
|
}
|
|
502
|
+
/** Set seats to an exact count. */
|
|
509
503
|
async set(params, options) {
|
|
510
|
-
return this.httpClient.put(
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
count: params.count
|
|
516
|
-
},
|
|
517
|
-
options
|
|
518
|
-
);
|
|
504
|
+
return this.httpClient.put("/seats", params, options);
|
|
505
|
+
}
|
|
506
|
+
/** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
|
|
507
|
+
async remove(params, options) {
|
|
508
|
+
return this.httpClient.delete("/seats", params, options);
|
|
519
509
|
}
|
|
510
|
+
/** Set all seat types at once. */
|
|
520
511
|
async setAll(params, options) {
|
|
521
512
|
return this.httpClient.put("/seats/bulk", params, options);
|
|
522
513
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
featureCode: params.featureCode
|
|
527
|
-
});
|
|
514
|
+
/** Get current balance for a specific seat type. */
|
|
515
|
+
async getBalance(params, options) {
|
|
516
|
+
return this.httpClient.get("/seats/balance", params, options);
|
|
528
517
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
});
|
|
518
|
+
/** Get the current balance for all seat types in a customer's subscription. */
|
|
519
|
+
async getAllBalances(params, options) {
|
|
520
|
+
return this.httpClient.get("/seats/balances", params, options);
|
|
533
521
|
}
|
|
534
522
|
};
|
|
535
523
|
|
|
@@ -538,54 +526,57 @@ var SubscriptionsResource = class {
|
|
|
538
526
|
constructor(httpClient) {
|
|
539
527
|
this.httpClient = httpClient;
|
|
540
528
|
}
|
|
541
|
-
/**
|
|
529
|
+
/** List all subscriptions. Filter by customer ID or status. */
|
|
530
|
+
async list(params, options) {
|
|
531
|
+
return this.httpClient.get("/subscriptions", params, options);
|
|
532
|
+
}
|
|
533
|
+
/** Create a subscription for a customer. Requires planId or planCode plus customerId. */
|
|
542
534
|
async create(params, options) {
|
|
543
535
|
return this.httpClient.post("/subscriptions", params, options);
|
|
544
536
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
});
|
|
537
|
+
/** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
|
|
538
|
+
async get(params, options) {
|
|
539
|
+
const { id } = params;
|
|
540
|
+
return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
|
|
541
|
+
}
|
|
542
|
+
/** Get the active subscription for a customer. Returns null if none. */
|
|
543
|
+
async getActive(params, options) {
|
|
544
|
+
return this.httpClient.get("/subscriptions/active", params, options);
|
|
549
545
|
}
|
|
550
|
-
/**
|
|
546
|
+
/** Cancel immediately or at period end. */
|
|
551
547
|
async cancel(params, options) {
|
|
552
|
-
const { id, ...
|
|
553
|
-
return this.httpClient.post(`/subscriptions/${id}/cancel`,
|
|
548
|
+
const { id, ...rest } = params;
|
|
549
|
+
return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
|
|
554
550
|
}
|
|
555
|
-
/** Only works
|
|
551
|
+
/** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
|
|
556
552
|
async uncancel(params, options) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
{},
|
|
560
|
-
options
|
|
561
|
-
);
|
|
553
|
+
const { id } = params;
|
|
554
|
+
return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
|
|
562
555
|
}
|
|
563
|
-
/**
|
|
556
|
+
/** Upgrade, downgrade, or change billing interval. */
|
|
564
557
|
async changePlan(params, options) {
|
|
565
|
-
const { id, ...
|
|
558
|
+
const { id, ...rest } = params;
|
|
566
559
|
return this.httpClient.post(
|
|
567
560
|
`/subscriptions/${id}/change-plan`,
|
|
568
|
-
|
|
561
|
+
rest,
|
|
569
562
|
options
|
|
570
563
|
);
|
|
571
564
|
}
|
|
572
|
-
|
|
573
|
-
return this.httpClient.get("/subscriptions", params);
|
|
574
|
-
}
|
|
575
|
-
/** Dry-run: returns proration details without applying the change. */
|
|
565
|
+
/** 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. */
|
|
576
566
|
async previewChange(params, options) {
|
|
577
|
-
const { id, ...
|
|
567
|
+
const { id, ...rest } = params;
|
|
578
568
|
return this.httpClient.post(
|
|
579
569
|
`/subscriptions/${id}/preview-change`,
|
|
580
|
-
|
|
570
|
+
rest,
|
|
581
571
|
options
|
|
582
572
|
);
|
|
583
573
|
}
|
|
584
|
-
/**
|
|
574
|
+
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
585
575
|
async activateAddon(params, options) {
|
|
586
|
-
const { id, ...
|
|
587
|
-
return this.httpClient.post(`/subscriptions/${id}/addons`,
|
|
576
|
+
const { id, ...rest } = params;
|
|
577
|
+
return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
|
|
588
578
|
}
|
|
579
|
+
/** Deactivate an add-on from a subscription. */
|
|
589
580
|
async deactivateAddon(params, options) {
|
|
590
581
|
const { id, addonId } = params;
|
|
591
582
|
return this.httpClient.delete(
|
|
@@ -594,27 +585,47 @@ var SubscriptionsResource = class {
|
|
|
594
585
|
options
|
|
595
586
|
);
|
|
596
587
|
}
|
|
597
|
-
/**
|
|
588
|
+
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
598
589
|
async adjustBalance(params, options) {
|
|
599
|
-
const { id, ...
|
|
590
|
+
const { id, ...rest } = params;
|
|
600
591
|
return this.httpClient.post(
|
|
601
592
|
`/subscriptions/${id}/balance/adjust`,
|
|
602
|
-
|
|
593
|
+
rest,
|
|
603
594
|
options
|
|
604
595
|
);
|
|
605
596
|
}
|
|
606
|
-
/** Charges the customer's payment method. */
|
|
597
|
+
/** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
|
|
607
598
|
async topupBalance(params, options) {
|
|
608
|
-
const { id, ...
|
|
599
|
+
const { id, ...rest } = params;
|
|
609
600
|
return this.httpClient.post(
|
|
610
601
|
`/subscriptions/${id}/balance/topup`,
|
|
611
|
-
|
|
602
|
+
rest,
|
|
612
603
|
options
|
|
613
604
|
);
|
|
614
605
|
}
|
|
606
|
+
/** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
|
|
615
607
|
async purchaseCredits(params, options) {
|
|
616
|
-
const { id, ...
|
|
617
|
-
return this.httpClient.post(`/subscriptions/${id}/credits`,
|
|
608
|
+
const { id, ...rest } = params;
|
|
609
|
+
return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
// src/resources/test-clock.ts
|
|
614
|
+
var TestClockResource = class {
|
|
615
|
+
constructor(httpClient) {
|
|
616
|
+
this.httpClient = httpClient;
|
|
617
|
+
}
|
|
618
|
+
/** Returns the organization's current test clock state. Sandbox only. */
|
|
619
|
+
async get() {
|
|
620
|
+
return this.httpClient.get("/test-clock");
|
|
621
|
+
}
|
|
622
|
+
/** 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. */
|
|
623
|
+
async advance(params, options) {
|
|
624
|
+
return this.httpClient.post("/test-clock", params, options);
|
|
625
|
+
}
|
|
626
|
+
/** 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. */
|
|
627
|
+
async processBilling() {
|
|
628
|
+
return this.httpClient.post("/test-clock/process-billing", {});
|
|
618
629
|
}
|
|
619
630
|
};
|
|
620
631
|
|
|
@@ -623,27 +634,47 @@ var TransactionsResource = class {
|
|
|
623
634
|
constructor(httpClient) {
|
|
624
635
|
this.httpClient = httpClient;
|
|
625
636
|
}
|
|
626
|
-
|
|
627
|
-
|
|
637
|
+
/** List payment transactions with cursor-based pagination. Filter by status or customer email. */
|
|
638
|
+
async list(params, options) {
|
|
639
|
+
return this.httpClient.get("/transactions", params, options);
|
|
628
640
|
}
|
|
629
|
-
|
|
630
|
-
|
|
641
|
+
/** Retrieve a single payment transaction by its public ID, including provider details. */
|
|
642
|
+
async get(params, options) {
|
|
643
|
+
const { id } = params;
|
|
644
|
+
return this.httpClient.get(`/transactions/${id}`, void 0, options);
|
|
631
645
|
}
|
|
632
|
-
/**
|
|
646
|
+
/** Issue a full refund for a payment transaction. */
|
|
633
647
|
async refund(params, options) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
{},
|
|
637
|
-
options
|
|
638
|
-
);
|
|
648
|
+
const { id } = params;
|
|
649
|
+
return this.httpClient.post(`/transactions/${id}/refund`, {}, options);
|
|
639
650
|
}
|
|
640
|
-
/** Creates a new invoice and initiates a new payment attempt. */
|
|
651
|
+
/** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
|
|
641
652
|
async retry(params, options) {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
653
|
+
const { id } = params;
|
|
654
|
+
return this.httpClient.post(`/transactions/${id}/retry`, {}, options);
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
// src/_generated_resources.ts
|
|
659
|
+
var GeneratedResources = class {
|
|
660
|
+
initResources(http) {
|
|
661
|
+
this.addons = new AddonsResource(http);
|
|
662
|
+
this.apiKeys = new ApiKeysResource(http);
|
|
663
|
+
this.creditPacks = new CreditPacksResource(http);
|
|
664
|
+
this.customers = new CustomersResource(http);
|
|
665
|
+
this.featureAccess = new FeatureAccessResource(http);
|
|
666
|
+
this.features = new FeaturesResource(http);
|
|
667
|
+
this.invoices = new InvoicesResource(http);
|
|
668
|
+
this.payouts = new PayoutsResource(http);
|
|
669
|
+
this.planGroups = new PlanGroupsResource(http);
|
|
670
|
+
this.plans = new PlansResource(http);
|
|
671
|
+
this.portal = new PortalResource(http);
|
|
672
|
+
this.promoCodes = new PromoCodesResource(http);
|
|
673
|
+
this.quota = new QuotaResource(http);
|
|
674
|
+
this.seats = new SeatsResource(http);
|
|
675
|
+
this.subscriptions = new SubscriptionsResource(http);
|
|
676
|
+
this.testClock = new TestClockResource(http);
|
|
677
|
+
this.transactions = new TransactionsResource(http);
|
|
647
678
|
}
|
|
648
679
|
};
|
|
649
680
|
|
|
@@ -778,8 +809,8 @@ var CommetValidationError = class extends CommetError {
|
|
|
778
809
|
};
|
|
779
810
|
|
|
780
811
|
// src/version.ts
|
|
781
|
-
var API_VERSION = "2026-
|
|
782
|
-
var SDK_VERSION = "
|
|
812
|
+
var API_VERSION = "2026-06-10";
|
|
813
|
+
var SDK_VERSION = "7.0.0";
|
|
783
814
|
|
|
784
815
|
// src/utils/telemetry.ts
|
|
785
816
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|
|
@@ -1087,8 +1118,9 @@ _CommetHTTPClient.BODY_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"
|
|
|
1087
1118
|
var CommetHTTPClient = _CommetHTTPClient;
|
|
1088
1119
|
|
|
1089
1120
|
// src/client.ts
|
|
1090
|
-
var Commet = class {
|
|
1121
|
+
var Commet = class extends GeneratedResources {
|
|
1091
1122
|
constructor(config) {
|
|
1123
|
+
super();
|
|
1092
1124
|
if (!config.apiKey) {
|
|
1093
1125
|
throw new Error("Commet SDK: API key is required");
|
|
1094
1126
|
}
|
|
@@ -1098,20 +1130,7 @@ var Commet = class {
|
|
|
1098
1130
|
);
|
|
1099
1131
|
}
|
|
1100
1132
|
this.httpClient = new CommetHTTPClient(config);
|
|
1101
|
-
this.
|
|
1102
|
-
this.apiKeys = new ApiKeysResource(this.httpClient);
|
|
1103
|
-
this.creditPacks = new CreditPacksResource(this.httpClient);
|
|
1104
|
-
this.customers = new CustomersResource(this.httpClient);
|
|
1105
|
-
this.features = new FeaturesResource(this.httpClient);
|
|
1106
|
-
this.invoices = new InvoicesResource(this.httpClient);
|
|
1107
|
-
this.planGroups = new PlanGroupsResource(this.httpClient);
|
|
1108
|
-
this.plans = new PlansResource(this.httpClient);
|
|
1109
|
-
this.portal = new PortalResource(this.httpClient);
|
|
1110
|
-
this.promoCodes = new PromoCodesResource(this.httpClient);
|
|
1111
|
-
this.quota = new QuotaResource(this.httpClient);
|
|
1112
|
-
this.seats = new SeatsResource(this.httpClient);
|
|
1113
|
-
this.subscriptions = new SubscriptionsResource(this.httpClient);
|
|
1114
|
-
this.transactions = new TransactionsResource(this.httpClient);
|
|
1133
|
+
this.initResources(this.httpClient);
|
|
1115
1134
|
this.usage = new UsageResource(this.httpClient);
|
|
1116
1135
|
this.webhooks = new Webhooks(this.httpClient);
|
|
1117
1136
|
}
|