@commet/node 7.10.0 → 8.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.mjs CHANGED
@@ -7,29 +7,29 @@ var AddonsResource = class {
7
7
  async listActive(params, options) {
8
8
  return this.httpClient.get("/active-addons", params, options);
9
9
  }
10
- /** List all add-ons with cursor-based pagination. */
11
- async list(params, options) {
12
- return this.httpClient.get("/addons", params, options);
13
- }
14
10
  /** Retrieve an add-on by its public ID or slug. */
15
11
  async get(params, options) {
16
12
  const { id } = params;
17
13
  return this.httpClient.get(`/addons/${id}`, void 0, options);
18
14
  }
19
- /** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
20
- async create(params, options) {
21
- return this.httpClient.post("/addons", params, options);
22
- }
23
15
  /** Update an add-on's name, description, or pricing. */
24
16
  async update(params, options) {
25
17
  const { id, ...rest } = params;
26
- return this.httpClient.put(`/addons/${id}`, rest, options);
18
+ return this.httpClient.patch(`/addons/${id}`, rest, options);
27
19
  }
28
20
  /** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
29
21
  async delete(params, options) {
30
22
  const { id } = params;
31
23
  return this.httpClient.delete(`/addons/${id}`, void 0, options);
32
24
  }
25
+ /** List all add-ons with cursor-based pagination. */
26
+ async list(params, options) {
27
+ return this.httpClient.get("/addons", params, options);
28
+ }
29
+ /** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
30
+ async create(params, options) {
31
+ return this.httpClient.post("/addons", params, options);
32
+ }
33
33
  };
34
34
 
35
35
  // src/resources/api-keys.ts
@@ -37,6 +37,11 @@ var ApiKeysResource = class {
37
37
  constructor(httpClient) {
38
38
  this.httpClient = httpClient;
39
39
  }
40
+ /** Permanently revoke and delete an API key. */
41
+ async delete(params, options) {
42
+ const { id } = params;
43
+ return this.httpClient.delete(`/api-keys/${id}`, void 0, options);
44
+ }
40
45
  /** List API keys with cursor-based pagination. Keys are returned without the full secret. */
41
46
  async list(params, options) {
42
47
  return this.httpClient.get("/api-keys", params, options);
@@ -45,11 +50,6 @@ var ApiKeysResource = class {
45
50
  async create(params, options) {
46
51
  return this.httpClient.post("/api-keys", params, options);
47
52
  }
48
- /** Permanently revoke and delete an API key. */
49
- async delete(params, options) {
50
- const { id } = params;
51
- return this.httpClient.delete(`/api-keys/${id}`, void 0, options);
52
- }
53
53
  };
54
54
 
55
55
  // src/resources/credit-packs.ts
@@ -57,24 +57,24 @@ var CreditPacksResource = class {
57
57
  constructor(httpClient) {
58
58
  this.httpClient = httpClient;
59
59
  }
60
- /** List all active credit packs. */
61
- async list() {
62
- return this.httpClient.get("/credit-packs");
63
- }
64
- /** Create a new credit pack. */
65
- async create(params, options) {
66
- return this.httpClient.post("/credit-packs/manage", params, options);
67
- }
68
60
  /** Update a credit pack's name, description, credits, price, or active status. */
69
61
  async update(params, options) {
70
62
  const { id, ...rest } = params;
71
- return this.httpClient.put(`/credit-packs/${id}`, rest, options);
63
+ return this.httpClient.patch(`/credit-packs/${id}`, rest, options);
72
64
  }
73
65
  /** Soft-delete a credit pack. */
74
66
  async delete(params, options) {
75
67
  const { id } = params;
76
68
  return this.httpClient.delete(`/credit-packs/${id}`, void 0, options);
77
69
  }
70
+ /** List all active credit packs. */
71
+ async list() {
72
+ return this.httpClient.get("/credit-packs");
73
+ }
74
+ /** Create a new credit pack. */
75
+ async create(params, options) {
76
+ return this.httpClient.post("/credit-packs", params, options);
77
+ }
78
78
  };
79
79
 
80
80
  // src/resources/customers.ts
@@ -82,14 +82,6 @@ var CustomersResource = class {
82
82
  constructor(httpClient) {
83
83
  this.httpClient = httpClient;
84
84
  }
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. */
90
- async create(params, options) {
91
- return this.httpClient.post("/customers", params, options);
92
- }
93
85
  /** Retrieve a customer by their public ID, including subscription status and metadata. */
94
86
  async get(params, options) {
95
87
  const { id } = params;
@@ -98,12 +90,20 @@ var CustomersResource = class {
98
90
  /** Update a customer's name, external ID, or metadata. */
99
91
  async update(params, options) {
100
92
  const { id, ...rest } = params;
101
- return this.httpClient.put(`/customers/${id}`, rest, options);
93
+ return this.httpClient.patch(`/customers/${id}`, rest, options);
102
94
  }
103
95
  /** Create up to 100 customers in a single request. */
104
96
  async createBatch(params, options) {
105
97
  return this.httpClient.post("/customers/batch", params, options);
106
98
  }
99
+ /** List customers with cursor-based pagination. */
100
+ async list(params, options) {
101
+ return this.httpClient.get("/customers", params, options);
102
+ }
103
+ /** Create a new customer. Idempotent when customerId is provided. */
104
+ async create(params, options) {
105
+ return this.httpClient.post("/customers", params, options);
106
+ }
107
107
  };
108
108
 
109
109
  // src/resources/feature-access.ts
@@ -111,23 +111,14 @@ var FeatureAccessResource = class {
111
111
  constructor(httpClient) {
112
112
  this.httpClient = httpClient;
113
113
  }
114
- /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
115
- async list(params, options) {
116
- return this.httpClient.get("/feature-access", params, options);
117
- }
118
- /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
114
+ /** Get one feature's access and current usage for a customer. To evaluate a prospective consumption, use POST /usage/check. */
119
115
  async get(params, options) {
120
116
  const { code, ...rest } = params;
121
117
  return this.httpClient.get(`/feature-access/${code}`, rest, options);
122
118
  }
123
- /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
124
- async canUse(params, options) {
125
- const { code, ...rest } = params;
126
- return this.httpClient.get(
127
- `/feature-access/${code}`,
128
- { ...rest, action: "canUse" },
129
- options
130
- );
119
+ /** List a customer's feature access and current usage. */
120
+ async list(params, options) {
121
+ return this.httpClient.get("/feature-access", params, options);
131
122
  }
132
123
  };
133
124
 
@@ -136,32 +127,28 @@ var FeaturesResource = class {
136
127
  constructor(httpClient) {
137
128
  this.httpClient = httpClient;
138
129
  }
139
- /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
140
- async list() {
141
- return this.httpClient.get("/features");
142
- }
143
130
  /** Get a single feature definition by code from the organization's feature catalog. */
144
131
  async get(params, options) {
145
132
  const { code } = params;
146
133
  return this.httpClient.get(`/features/${code}`, void 0, options);
147
134
  }
148
- /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
149
- async create(params, options) {
150
- return this.httpClient.post("/features/manage", params, options);
151
- }
152
135
  /** Update a feature's name, description, or unit name. At least one field must be provided. */
153
136
  async update(params, options) {
154
137
  const { code, ...rest } = params;
155
- return this.httpClient.put(`/features/${code}/manage`, rest, options);
138
+ return this.httpClient.patch(`/features/${code}`, rest, options);
156
139
  }
157
140
  /** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
158
141
  async delete(params, options) {
159
142
  const { code } = params;
160
- return this.httpClient.delete(
161
- `/features/${code}/manage`,
162
- void 0,
163
- options
164
- );
143
+ return this.httpClient.delete(`/features/${code}`, void 0, options);
144
+ }
145
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
146
+ async list() {
147
+ return this.httpClient.get("/features");
148
+ }
149
+ /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
150
+ async create(params, options) {
151
+ return this.httpClient.post("/features", params, options);
165
152
  }
166
153
  };
167
154
 
@@ -170,62 +157,92 @@ var InvoicesResource = class {
170
157
  constructor(httpClient) {
171
158
  this.httpClient = httpClient;
172
159
  }
173
- /** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
174
- async list(params, options) {
175
- return this.httpClient.get("/invoices", params, options);
160
+ /** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
161
+ async getDownloadUrl(params, options) {
162
+ const { id } = params;
163
+ return this.httpClient.post(`/invoices/${id}/download-links`, {}, options);
176
164
  }
177
165
  /** Retrieve a single invoice by its public ID, including line items. */
178
166
  async get(params, options) {
179
167
  const { id } = params;
180
168
  return this.httpClient.get(`/invoices/${id}`, void 0, options);
181
169
  }
182
- /** Create a one-off adjustment invoice. Use a negative amount for a credit. */
183
- async createAdjustment(params, options) {
184
- return this.httpClient.post("/invoices", params, options);
185
- }
186
- /** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
187
- async getDownloadUrl(params, options) {
188
- const { id } = params;
189
- return this.httpClient.get(`/invoices/${id}/download`, void 0, options);
190
- }
191
170
  /** Send the invoice to the customer via email. */
192
171
  async send(params, options) {
193
172
  const { id } = params;
194
173
  return this.httpClient.post(`/invoices/${id}/send`, {}, options);
195
174
  }
196
- /** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
175
+ /** Mark an outstanding invoice as "paid" or "void" and return the updated invoice. Cannot change the status of already paid or voided invoices. */
197
176
  async updateStatus(params, options) {
198
177
  const { id, ...rest } = params;
199
- return this.httpClient.put(`/invoices/${id}/status`, rest, options);
178
+ return this.httpClient.patch(`/invoices/${id}/status`, rest, options);
179
+ }
180
+ /** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
181
+ async list(params, options) {
182
+ return this.httpClient.get("/invoices", params, options);
183
+ }
184
+ /** Create a one-off adjustment invoice and return the created invoice. Use a negative amount for a credit. */
185
+ async createAdjustment(params, options) {
186
+ return this.httpClient.post("/invoices", params, options);
200
187
  }
201
188
  };
202
189
 
203
- // src/resources/payments.ts
204
- var PaymentsResource = class {
190
+ // src/resources/offers.ts
191
+ var OffersResource = class {
205
192
  constructor(httpClient) {
206
193
  this.httpClient = httpClient;
207
194
  }
208
- /** List payments with cursor-based pagination. Filter by customer. */
195
+ /** Retrieve a canonical offer by its public ID. */
196
+ async get(params, options) {
197
+ const { id } = params;
198
+ return this.httpClient.get(`/offers/${id}`, void 0, options);
199
+ }
200
+ /** Replace an offer's catalog definition. Existing offer applications keep their immutable accepted terms. */
201
+ async update(params, options) {
202
+ const { id, ...rest } = params;
203
+ return this.httpClient.patch(`/offers/${id}`, rest, options);
204
+ }
205
+ /** Soft-delete an offer. Existing applications and their accepted terms remain available for billing and audit. */
206
+ async delete(params, options) {
207
+ const { id } = params;
208
+ return this.httpClient.delete(`/offers/${id}`, void 0, options);
209
+ }
210
+ /** List the organization's canonical introductory and promotional offers. */
209
211
  async list(params, options) {
210
- return this.httpClient.get("/payments", params, options);
212
+ return this.httpClient.get("/offers", params, options);
211
213
  }
212
- /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
214
+ /** Create a canonical offer scoped to one or more plan prices. Currency-specific phases require an explicit USD value and never fall back across currencies. */
213
215
  async create(params, options) {
214
- return this.httpClient.post("/payments", params, options);
216
+ return this.httpClient.post("/offers", params, options);
215
217
  }
216
- /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
217
- async charge(params, options) {
218
- return this.httpClient.post("/payments/charge", params, options);
218
+ };
219
+
220
+ // src/resources/payments.ts
221
+ var PaymentsResource = class {
222
+ constructor(httpClient) {
223
+ this.httpClient = httpClient;
224
+ }
225
+ /** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
226
+ async cancel(params, options) {
227
+ const { id } = params;
228
+ return this.httpClient.post(`/payments/${id}/cancel`, {}, options);
219
229
  }
220
230
  /** Retrieve a payment by its public ID. */
221
231
  async get(params, options) {
222
232
  const { id } = params;
223
233
  return this.httpClient.get(`/payments/${id}`, void 0, options);
224
234
  }
225
- /** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
226
- async cancel(params, options) {
227
- const { id } = params;
228
- return this.httpClient.post(`/payments/${id}/cancel`, {}, options);
235
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
236
+ async charge(params, options) {
237
+ return this.httpClient.post("/payments/charge", params, options);
238
+ }
239
+ /** List payments with cursor-based pagination. Filter by customer. */
240
+ async list(params, options) {
241
+ return this.httpClient.get("/payments", params, options);
242
+ }
243
+ /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
244
+ async create(params, options) {
245
+ return this.httpClient.post("/payments", params, options);
229
246
  }
230
247
  };
231
248
 
@@ -253,34 +270,6 @@ var PlanGroupsResource = class {
253
270
  constructor(httpClient) {
254
271
  this.httpClient = httpClient;
255
272
  }
256
- /** List plan groups with cursor-based pagination. */
257
- async list(params, options) {
258
- return this.httpClient.get("/plan-groups", params, options);
259
- }
260
- /** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
261
- async get(params, options) {
262
- const { id } = params;
263
- return this.httpClient.get(`/plan-groups/${id}`, void 0, options);
264
- }
265
- /** Create a new plan group for organizing plans. */
266
- async create(params, options) {
267
- return this.httpClient.post("/plan-groups", params, options);
268
- }
269
- /** Update a plan group's name, description, or visibility. */
270
- async update(params, options) {
271
- const { id, ...rest } = params;
272
- return this.httpClient.put(`/plan-groups/${id}`, rest, options);
273
- }
274
- /** Delete a plan group. Plans in the group are unlinked, not deleted. */
275
- async delete(params, options) {
276
- const { id } = params;
277
- return this.httpClient.delete(`/plan-groups/${id}`, void 0, options);
278
- }
279
- /** Add an existing plan to a plan group with optional sort order. */
280
- async addPlan(params, options) {
281
- const { id, ...rest } = params;
282
- return this.httpClient.post(`/plan-groups/${id}/plans`, rest, options);
283
- }
284
273
  /** Remove a plan from a plan group. */
285
274
  async removePlan(params, options) {
286
275
  const { id, planId } = params;
@@ -299,50 +288,45 @@ var PlanGroupsResource = class {
299
288
  options
300
289
  );
301
290
  }
302
- };
303
-
304
- // src/resources/plans.ts
305
- var PlansResource = class {
306
- constructor(httpClient) {
307
- this.httpClient = httpClient;
308
- }
309
- /** List all plans with their prices and features. Optionally include private plans. */
310
- async list(params, options) {
311
- return this.httpClient.get("/plans", params, options);
291
+ /** Add an existing plan to a plan group with optional sort order. */
292
+ async addPlan(params, options) {
293
+ const { id, ...rest } = params;
294
+ return this.httpClient.post(`/plan-groups/${id}/plans`, rest, options);
312
295
  }
313
- /** Get detailed plan information by code or ID. */
296
+ /** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
314
297
  async get(params, options) {
315
298
  const { id } = params;
316
- return this.httpClient.get(`/plans/${id}`, void 0, options);
317
- }
318
- /** Create a new plan with optional consumption model, visibility, and plan group assignment. */
319
- async create(params, options) {
320
- return this.httpClient.post("/plans/manage", params, options);
299
+ return this.httpClient.get(`/plan-groups/${id}`, void 0, options);
321
300
  }
322
- /** Update a plan's name, description, visibility, or metadata. */
301
+ /** Update a plan group's name, description, or visibility. */
323
302
  async update(params, options) {
324
303
  const { id, ...rest } = params;
325
- return this.httpClient.put(`/plans/${id}/manage`, rest, options);
304
+ return this.httpClient.patch(`/plan-groups/${id}`, rest, options);
326
305
  }
327
- /** Soft-delete a plan. */
306
+ /** Delete a plan group. Plans in the group are unlinked, not deleted. */
328
307
  async delete(params, options) {
329
308
  const { id } = params;
330
- return this.httpClient.delete(`/plans/${id}/manage`, void 0, options);
309
+ return this.httpClient.delete(`/plan-groups/${id}`, void 0, options);
331
310
  }
332
- /** Toggle a plan between public and private. */
333
- async setVisibility(params, options) {
334
- const { id, ...rest } = params;
335
- return this.httpClient.put(`/plans/${id}/visibility`, rest, options);
311
+ /** List plan groups with cursor-based pagination. */
312
+ async list(params, options) {
313
+ return this.httpClient.get("/plan-groups", params, options);
336
314
  }
337
- /** Attach a feature to a plan with limits, overage, and credits configuration. */
338
- async addFeature(params, options) {
339
- const { id, ...rest } = params;
340
- return this.httpClient.post(`/plans/${id}/features`, rest, options);
315
+ /** Create a new plan group for organizing plans. */
316
+ async create(params, options) {
317
+ return this.httpClient.post("/plan-groups", params, options);
318
+ }
319
+ };
320
+
321
+ // src/resources/plans.ts
322
+ var PlansResource = class {
323
+ constructor(httpClient) {
324
+ this.httpClient = httpClient;
341
325
  }
342
326
  /** Update limits, overage, or enabled status of a feature on a plan. */
343
327
  async updateFeature(params, options) {
344
328
  const { id, featureId, ...rest } = params;
345
- return this.httpClient.put(
329
+ return this.httpClient.patch(
346
330
  `/plans/${id}/features/${featureId}`,
347
331
  rest,
348
332
  options
@@ -357,26 +341,12 @@ var PlansResource = class {
357
341
  options
358
342
  );
359
343
  }
360
- /** Add a billing interval price to a plan with optional trial days and included balance/credits. */
361
- async addPrice(params, options) {
344
+ /** Attach a feature to a plan with limits, overage, and credits configuration. */
345
+ async addFeature(params, options) {
362
346
  const { id, ...rest } = params;
363
- return this.httpClient.post(`/plans/${id}/prices`, rest, options);
364
- }
365
- /** Update an existing price on a plan. */
366
- async updatePrice(params, options) {
367
- const { id, priceId, ...rest } = params;
368
- return this.httpClient.put(`/plans/${id}/prices/${priceId}`, rest, options);
369
- }
370
- /** Remove a price from a plan. */
371
- async deletePrice(params, options) {
372
- const { id, priceId } = params;
373
- return this.httpClient.delete(
374
- `/plans/${id}/prices/${priceId}`,
375
- void 0,
376
- options
377
- );
347
+ return this.httpClient.post(`/plans/${id}/features`, rest, options);
378
348
  }
379
- /** Set a specific price as the default for its plan. Unsets previous default. */
349
+ /** Set a specific price as the default and return the updated plan price. */
380
350
  async setDefaultPrice(params, options) {
381
351
  const { id, priceId } = params;
382
352
  return this.httpClient.put(
@@ -394,12 +364,7 @@ var PlansResource = class {
394
364
  options
395
365
  );
396
366
  }
397
- /** Configure a plan's regional pricing for one currency. USD configures the United States variant; exchangeRate acts as its price multiplier. Sending only currency and exchangeRate derives every regional value (base price, included balance, feature overage, intro offer) from the default USD value. Optional per-price and per-feature overrides are stored as manual values. */
398
- async setRegionalPricing(params, options) {
399
- const { id, ...rest } = params;
400
- return this.httpClient.put(`/plans/${id}/regional`, rest, options);
401
- }
402
- /** Remove all regional currency overrides for a plan price. */
367
+ /** Remove all regional currency overrides for a plan price. The request is rejected while billable subscriptions depend on an override. */
403
368
  async deleteRegionalPrices(params, options) {
404
369
  const { id, priceId } = params;
405
370
  return this.httpClient.delete(
@@ -408,6 +373,62 @@ var PlansResource = class {
408
373
  options
409
374
  );
410
375
  }
376
+ /** Update a base price or market price variant. Removing a base market override is rejected while a variant depends on it. Offer terms are managed through Offers. */
377
+ async updatePrice(params, options) {
378
+ const { id, priceId, ...rest } = params;
379
+ return this.httpClient.patch(
380
+ `/plans/${id}/prices/${priceId}`,
381
+ rest,
382
+ options
383
+ );
384
+ }
385
+ /** Archive a price for new subscriptions. Existing subscriptions that selected it continue using its current catalog value. */
386
+ async deletePrice(params, options) {
387
+ const { id, priceId } = params;
388
+ return this.httpClient.delete(
389
+ `/plans/${id}/prices/${priceId}`,
390
+ void 0,
391
+ options
392
+ );
393
+ }
394
+ /** Add a base price or a selectable market price variant. Variants inherit their base price outside the markets they override. Configure introductory and promotional benefits through Offers. */
395
+ async addPrice(params, options) {
396
+ const { id, ...rest } = params;
397
+ return this.httpClient.post(`/plans/${id}/prices`, rest, options);
398
+ }
399
+ /** Configure regional prices and feature overage values for one currency. Currency-specific offer terms are managed through Offers. */
400
+ async setRegionalPricing(params, options) {
401
+ const { id, ...rest } = params;
402
+ return this.httpClient.put(`/plans/${id}/regional`, rest, options);
403
+ }
404
+ /** Get a plan with public price IDs and their automatic introductory offer IDs. */
405
+ async get(params, options) {
406
+ const { id } = params;
407
+ return this.httpClient.get(`/plans/${id}`, void 0, options);
408
+ }
409
+ /** Update a plan's name, description, visibility, or metadata. */
410
+ async update(params, options) {
411
+ const { id, ...rest } = params;
412
+ return this.httpClient.patch(`/plans/${id}`, rest, options);
413
+ }
414
+ /** Soft-delete a plan. */
415
+ async delete(params, options) {
416
+ const { id } = params;
417
+ return this.httpClient.delete(`/plans/${id}`, void 0, options);
418
+ }
419
+ /** Set a plan's public visibility and return the updated plan. */
420
+ async setVisibility(params, options) {
421
+ const { id, ...rest } = params;
422
+ return this.httpClient.put(`/plans/${id}/visibility`, rest, options);
423
+ }
424
+ /** List plans with public price IDs and their automatic introductory offer IDs. */
425
+ async list(params, options) {
426
+ return this.httpClient.get("/plans", params, options);
427
+ }
428
+ /** Create a new plan with optional consumption model, visibility, and plan group assignment. */
429
+ async create(params, options) {
430
+ return this.httpClient.post("/plans", params, options);
431
+ }
411
432
  };
412
433
 
413
434
  // src/resources/portal.ts
@@ -417,7 +438,45 @@ var PortalResource = class {
417
438
  }
418
439
  /** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
419
440
  async getUrl(params, options) {
420
- return this.httpClient.post("/portal/request-access", params, options);
441
+ return this.httpClient.post("/portal/sessions", params, options);
442
+ }
443
+ };
444
+
445
+ // src/resources/pricing.ts
446
+ var PricingResource = class {
447
+ constructor(httpClient) {
448
+ this.httpClient = httpClient;
449
+ }
450
+ /** Get one reusable pricing market group. */
451
+ async getMarketGroup(params, options) {
452
+ const { id } = params;
453
+ return this.httpClient.get(
454
+ `/pricing/market-groups/${id}`,
455
+ void 0,
456
+ options
457
+ );
458
+ }
459
+ /** Replace the name, countries, and metadata of a pricing market group. */
460
+ async updateMarketGroup(params, options) {
461
+ const { id, ...rest } = params;
462
+ return this.httpClient.patch(`/pricing/market-groups/${id}`, rest, options);
463
+ }
464
+ /** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
465
+ async deleteMarketGroup(params, options) {
466
+ const { id } = params;
467
+ return this.httpClient.delete(
468
+ `/pricing/market-groups/${id}`,
469
+ void 0,
470
+ options
471
+ );
472
+ }
473
+ /** List reusable country groups used to resolve market-specific prices independently from currency. */
474
+ async listMarketGroups() {
475
+ return this.httpClient.get("/pricing/market-groups");
476
+ }
477
+ /** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
478
+ async createMarketGroup(params, options) {
479
+ return this.httpClient.post("/pricing/market-groups", params, options);
421
480
  }
422
481
  };
423
482
 
@@ -426,27 +485,23 @@ var PromoCodesResource = class {
426
485
  constructor(httpClient) {
427
486
  this.httpClient = httpClient;
428
487
  }
429
- /** List promo codes with cursor-based pagination. */
430
- async list(params, options) {
431
- return this.httpClient.get("/promo-codes", params, options);
432
- }
433
488
  /** Retrieve a promo code by its public ID. */
434
489
  async get(params, options) {
435
490
  const { id } = params;
436
491
  return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
437
492
  }
438
- /**
439
- * Create a new promo code. Optionally restrict it to specific plans and a billing interval.
440
- *
441
- * **100% discounts are not supported.** Percentage codes must be strictly less than 100% (`discountValue` < 10000 basis points). For full waivers, use an introductory offer on the plan instead. At checkout, any code — percentage or fixed amount — that would reduce the total below the currency's minimum charge ($0.50 USD equivalent) is silently dropped.
442
- */
443
- async create(params, options) {
444
- return this.httpClient.post("/promo-codes", params, options);
445
- }
446
493
  /** Update a promo code's billing interval, redemption limits, expiration, active status, or plan restrictions. */
447
494
  async update(params, options) {
448
495
  const { id, ...rest } = params;
449
- return this.httpClient.put(`/promo-codes/${id}`, rest, options);
496
+ return this.httpClient.patch(`/promo-codes/${id}`, rest, options);
497
+ }
498
+ /** List promo codes with cursor-based pagination. */
499
+ async list(params, options) {
500
+ return this.httpClient.get("/promo-codes", params, options);
501
+ }
502
+ /** Create a distribution code for an existing promotional offer. Offer economics remain owned by the referenced Offer. */
503
+ async create(params, options) {
504
+ return this.httpClient.post("/promo-codes", params, options);
450
505
  }
451
506
  };
452
507
 
@@ -466,25 +521,25 @@ var QuotaResource = class {
466
521
  constructor(httpClient) {
467
522
  this.httpClient = httpClient;
468
523
  }
469
- /** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
470
- async add(params, options) {
471
- return this.httpClient.post("/usage/quota", params, options);
472
- }
473
- /** Set a customer's quota allowance for a feature to an exact value. */
474
- async set(params, options) {
475
- return this.httpClient.put("/usage/quota", params, options);
524
+ /** Get all quota allowances for a customer across every quota feature in their plan. */
525
+ async getAll(params, options) {
526
+ return this.httpClient.get("/usage/quota/all", params, options);
476
527
  }
477
528
  /** 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. */
478
529
  async remove(params, options) {
479
- return this.httpClient.delete("/usage/quota", params, options);
530
+ return this.httpClient.post("/usage/quota/remove", params, options);
480
531
  }
481
532
  /** Get the current quota allowance (used vs included) for a specific feature. */
482
533
  async get(params, options) {
483
534
  return this.httpClient.get("/usage/quota", params, options);
484
535
  }
485
- /** Get all quota allowances for a customer across every quota feature in their plan. */
486
- async getAll(params, options) {
487
- return this.httpClient.get("/usage/quota/all", params, options);
536
+ /** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
537
+ async add(params, options) {
538
+ return this.httpClient.post("/usage/quota", params, options);
539
+ }
540
+ /** Set a customer's quota allowance for a feature to an exact value. */
541
+ async set(params, options) {
542
+ return this.httpClient.put("/usage/quota", params, options);
488
543
  }
489
544
  };
490
545
 
@@ -493,22 +548,6 @@ var SeatsResource = class {
493
548
  constructor(httpClient) {
494
549
  this.httpClient = httpClient;
495
550
  }
496
- /** Add seats to a customer's subscription. Prorates charges for the current billing period. */
497
- async add(params, options) {
498
- return this.httpClient.post("/seats", params, options);
499
- }
500
- /** Set seats to an exact count. */
501
- async set(params, options) {
502
- return this.httpClient.put("/seats", params, options);
503
- }
504
- /** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
505
- async remove(params, options) {
506
- return this.httpClient.delete("/seats", params, options);
507
- }
508
- /** Set all seat types at once. */
509
- async setAll(params, options) {
510
- return this.httpClient.put("/seats/bulk", params, options);
511
- }
512
551
  /** Get current balance for a specific seat type. */
513
552
  async getBalance(params, options) {
514
553
  return this.httpClient.get("/seats/balance", params, options);
@@ -517,6 +556,22 @@ var SeatsResource = class {
517
556
  async getAllBalances(params, options) {
518
557
  return this.httpClient.get("/seats/balances", params, options);
519
558
  }
559
+ /** Set all seat types at once. */
560
+ async setAll(params, options) {
561
+ return this.httpClient.put("/seats/bulk", params, options);
562
+ }
563
+ /** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
564
+ async remove(params, options) {
565
+ return this.httpClient.post("/seats/remove", params, options);
566
+ }
567
+ /** Add seats to a customer's subscription. Prorates charges for the current billing period. */
568
+ async add(params, options) {
569
+ return this.httpClient.post("/seats", params, options);
570
+ }
571
+ /** Set seats to an exact count. */
572
+ async set(params, options) {
573
+ return this.httpClient.put("/seats", params, options);
574
+ }
520
575
  };
521
576
 
522
577
  // src/resources/subscriptions.ts
@@ -524,57 +579,44 @@ var SubscriptionsResource = class {
524
579
  constructor(httpClient) {
525
580
  this.httpClient = httpClient;
526
581
  }
527
- /** List all subscriptions. Filter by customer ID or status. */
528
- async list(params, options) {
529
- return this.httpClient.get("/subscriptions", params, options);
530
- }
531
- /** Create a subscription for a customer. Requires planId or planCode plus customerId. */
532
- async create(params, options) {
533
- return this.httpClient.post("/subscriptions", params, options);
534
- }
535
- /** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
536
- async get(params, options) {
537
- const { id } = params;
538
- return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
539
- }
540
- /** Get the active subscription for a customer. Returns null if none. */
541
- async getActive(params, options) {
542
- return this.httpClient.get("/subscriptions/active", params, options);
582
+ /** Deactivate an add-on from a subscription. */
583
+ async deactivateAddon(params, options) {
584
+ const { id, addonId } = params;
585
+ return this.httpClient.delete(
586
+ `/subscriptions/${id}/addons/${addonId}`,
587
+ void 0,
588
+ options
589
+ );
543
590
  }
544
- /** Cancel immediately or at period end. */
545
- async cancel(params, options) {
591
+ /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
592
+ async activateAddon(params, options) {
546
593
  const { id, ...rest } = params;
547
- return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
548
- }
549
- /** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
550
- async uncancel(params, options) {
551
- const { id } = params;
552
- return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
553
- }
554
- /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. */
555
- async reactivate(params, options) {
556
- const { id } = params;
557
- return this.httpClient.post(`/subscriptions/${id}/reactivate`, {}, options);
594
+ return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
558
595
  }
559
- /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
560
- async createRecoveryLink(params, options) {
561
- const { id } = params;
596
+ /** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
597
+ async adjustBalance(params, options) {
598
+ const { id, ...rest } = params;
562
599
  return this.httpClient.post(
563
- `/subscriptions/${id}/recovery-link`,
564
- {},
600
+ `/subscriptions/${id}/balance/adjust`,
601
+ rest,
565
602
  options
566
603
  );
567
604
  }
568
- /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
569
- async updatePaymentMethod(params, options) {
605
+ /** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
606
+ async topupBalance(params, options) {
570
607
  const { id, ...rest } = params;
571
608
  return this.httpClient.post(
572
- `/subscriptions/${id}/payment-method/update`,
609
+ `/subscriptions/${id}/balance/topup`,
573
610
  rest,
574
611
  options
575
612
  );
576
613
  }
577
- /** Upgrade, downgrade, or change billing interval. */
614
+ /** Cancel immediately or at period end and return the updated subscription. */
615
+ async cancel(params, options) {
616
+ const { id, ...rest } = params;
617
+ return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
618
+ }
619
+ /** Upgrade or change billing interval immediately, optionally applying a quoted Promotional Offer. Scheduled changes do not accept offers. */
578
620
  async changePlan(params, options) {
579
621
  const { id, ...rest } = params;
580
622
  return this.httpClient.post(
@@ -583,51 +625,68 @@ var SubscriptionsResource = class {
583
625
  options
584
626
  );
585
627
  }
586
- /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. 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. */
587
- async previewChange(params, options) {
628
+ /** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
629
+ async purchaseCredits(params, options) {
630
+ const { id, ...rest } = params;
631
+ return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
632
+ }
633
+ /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
634
+ async updatePaymentMethod(params, options) {
588
635
  const { id, ...rest } = params;
589
636
  return this.httpClient.post(
590
- `/subscriptions/${id}/preview-change`,
637
+ `/subscriptions/${id}/payment-method/update`,
591
638
  rest,
592
639
  options
593
640
  );
594
641
  }
595
- /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
596
- async activateAddon(params, options) {
642
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. 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. Pass offerId to quote the destination plan with a Promotional Offer. */
643
+ async previewChange(params, options) {
597
644
  const { id, ...rest } = params;
598
- return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
599
- }
600
- /** Deactivate an add-on from a subscription. */
601
- async deactivateAddon(params, options) {
602
- const { id, addonId } = params;
603
- return this.httpClient.delete(
604
- `/subscriptions/${id}/addons/${addonId}`,
605
- void 0,
645
+ return this.httpClient.post(
646
+ `/subscriptions/${id}/preview-change`,
647
+ rest,
606
648
  options
607
649
  );
608
650
  }
609
- /** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
610
- async adjustBalance(params, options) {
651
+ /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply a Promotional Offer by offerId; past-due recovery cannot. */
652
+ async reactivate(params, options) {
611
653
  const { id, ...rest } = params;
612
654
  return this.httpClient.post(
613
- `/subscriptions/${id}/balance/adjust`,
655
+ `/subscriptions/${id}/reactivate`,
614
656
  rest,
615
657
  options
616
658
  );
617
659
  }
618
- /** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
619
- async topupBalance(params, options) {
620
- const { id, ...rest } = params;
660
+ /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
661
+ async createRecoveryLink(params, options) {
662
+ const { id } = params;
621
663
  return this.httpClient.post(
622
- `/subscriptions/${id}/balance/topup`,
623
- rest,
664
+ `/subscriptions/${id}/recovery-links`,
665
+ {},
624
666
  options
625
667
  );
626
668
  }
627
- /** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
628
- async purchaseCredits(params, options) {
629
- const { id, ...rest } = params;
630
- return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
669
+ /** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
670
+ async get(params, options) {
671
+ const { id } = params;
672
+ return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
673
+ }
674
+ /** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
675
+ async uncancel(params, options) {
676
+ const { id } = params;
677
+ return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
678
+ }
679
+ /** Get the active subscription for a customer. Returns null if none. */
680
+ async getActive(params, options) {
681
+ return this.httpClient.get("/subscriptions/active", params, options);
682
+ }
683
+ /** List all subscriptions. Filter by customer ID or status. */
684
+ async list(params, options) {
685
+ return this.httpClient.get("/subscriptions", params, options);
686
+ }
687
+ /** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory offer. Pass one Promotional Offer through offerId to override it. Experiment assignment remains external. */
688
+ async create(params, options) {
689
+ return this.httpClient.post("/subscriptions", params, options);
631
690
  }
632
691
  };
633
692
 
@@ -636,6 +695,10 @@ var TestClockResource = class {
636
695
  constructor(httpClient) {
637
696
  this.httpClient = httpClient;
638
697
  }
698
+ /** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Also fires any dunning retry whose scheduled time has passed. Enqueueing is asynchronous. Sandbox only. */
699
+ async processBilling(options) {
700
+ return this.httpClient.post("/test-clock/process-billing", {}, options);
701
+ }
639
702
  /** Returns the organization's current test clock state. Sandbox only. */
640
703
  async get() {
641
704
  return this.httpClient.get("/test-clock");
@@ -644,10 +707,6 @@ var TestClockResource = class {
644
707
  async advance(params, options) {
645
708
  return this.httpClient.post("/test-clock", params, options);
646
709
  }
647
- /** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Also fires any dunning retry whose scheduled time has passed. Enqueueing is asynchronous. Sandbox only. */
648
- async processBilling(options) {
649
- return this.httpClient.post("/test-clock/process-billing", {}, options);
650
- }
651
710
  };
652
711
 
653
712
  // src/resources/transactions.ts
@@ -655,25 +714,44 @@ var TransactionsResource = class {
655
714
  constructor(httpClient) {
656
715
  this.httpClient = httpClient;
657
716
  }
658
- /** List payment transactions with cursor-based pagination. Filter by status or customer email. */
659
- async list(params, options) {
660
- return this.httpClient.get("/transactions", params, options);
661
- }
662
- /** Retrieve a single payment transaction by its public ID, including provider details. */
663
- async get(params, options) {
664
- const { id } = params;
665
- return this.httpClient.get(`/transactions/${id}`, void 0, options);
666
- }
667
- /** Issue a full refund for a payment transaction. */
717
+ /** Issue a full refund and return the provider-neutral refund resource with its actual status. */
668
718
  async refund(params, options) {
669
719
  const { id } = params;
670
720
  return this.httpClient.post(`/transactions/${id}/refund`, {}, options);
671
721
  }
672
- /** Retry a failed subscription renewal. Re-charges the outstanding renewal invoice through the recovery engine. */
722
+ /** Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable. */
673
723
  async retry(params, options) {
674
724
  const { id } = params;
675
725
  return this.httpClient.post(`/transactions/${id}/retry`, {}, options);
676
726
  }
727
+ /** Retrieve a single payment transaction by its public ID, including provider details. */
728
+ async get(params, options) {
729
+ const { id } = params;
730
+ return this.httpClient.get(`/transactions/${id}`, void 0, options);
731
+ }
732
+ /** List payment transactions with cursor-based pagination. Filter by status or customer email. */
733
+ async list(params, options) {
734
+ return this.httpClient.get("/transactions", params, options);
735
+ }
736
+ };
737
+
738
+ // src/resources/usage.ts
739
+ var UsageResource = class {
740
+ constructor(httpClient) {
741
+ this.httpClient = httpClient;
742
+ }
743
+ /** Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model. */
744
+ async check(params, options) {
745
+ return this.httpClient.post("/usage/check", params, options);
746
+ }
747
+ /** Track a usage event for a metered feature. Deducts from balance/credits if applicable. */
748
+ async track(params, options) {
749
+ return this.httpClient.post("/usage/events", params, options);
750
+ }
751
+ /** Set a metered feature's usage to an exact value for the current period. Use the Idempotency-Key header to make retries safe. */
752
+ async set(params, options) {
753
+ return this.httpClient.put("/usage", params, options);
754
+ }
677
755
  };
678
756
 
679
757
  // src/_generated_resources.ts
@@ -686,11 +764,13 @@ var GeneratedResources = class {
686
764
  this.featureAccess = new FeatureAccessResource(http);
687
765
  this.features = new FeaturesResource(http);
688
766
  this.invoices = new InvoicesResource(http);
767
+ this.offers = new OffersResource(http);
689
768
  this.payments = new PaymentsResource(http);
690
769
  this.payouts = new PayoutsResource(http);
691
770
  this.planGroups = new PlanGroupsResource(http);
692
771
  this.plans = new PlansResource(http);
693
772
  this.portal = new PortalResource(http);
773
+ this.pricing = new PricingResource(http);
694
774
  this.promoCodes = new PromoCodesResource(http);
695
775
  this.provisioning = new ProvisioningResource(http);
696
776
  this.quota = new QuotaResource(http);
@@ -698,56 +778,14 @@ var GeneratedResources = class {
698
778
  this.subscriptions = new SubscriptionsResource(http);
699
779
  this.testClock = new TestClockResource(http);
700
780
  this.transactions = new TransactionsResource(http);
701
- }
702
- };
703
-
704
- // src/resources/usage.ts
705
- var UsageResource = class {
706
- constructor(httpClient) {
707
- this.httpClient = httpClient;
708
- }
709
- /** Deducts from balance/credits if the plan uses consumption. Duplicate `idempotencyKey` is rejected. */
710
- async track(params, options) {
711
- const eventData = {
712
- feature: params.feature,
713
- customerId: params.customerId,
714
- idempotencyKey: params.idempotencyKey,
715
- timestamp: params.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
716
- properties: params.properties ? Object.entries(params.properties).map(([property, value]) => ({
717
- property,
718
- value
719
- })) : void 0
720
- };
721
- if ("model" in params && params.model) {
722
- eventData.model = params.model;
723
- eventData.inputTokens = params.inputTokens;
724
- eventData.outputTokens = params.outputTokens;
725
- if (params.cacheReadTokens) {
726
- eventData.cacheReadTokens = params.cacheReadTokens;
727
- }
728
- if (params.cacheWriteTokens) {
729
- eventData.cacheWriteTokens = params.cacheWriteTokens;
730
- }
731
- } else {
732
- eventData.value = params.value;
733
- }
734
- return this.httpClient.post("/usage/events", eventData, options);
735
- }
736
- /** Dry-run: checks if a usage event would be allowed without actually tracking it. */
737
- async check(params, options) {
738
- return this.httpClient.post("/usage/check", params, options);
739
- }
740
- /** Set a metered feature's usage to an exact value for the current period. */
741
- async set(params, options) {
742
- return this.httpClient.put("/usage", params, options);
781
+ this.usage = new UsageResource(http);
743
782
  }
744
783
  };
745
784
 
746
785
  // src/resources/webhooks.ts
747
786
  import crypto2 from "crypto";
748
787
  var Webhooks = class {
749
- constructor(httpClient) {
750
- this.httpClient = httpClient;
788
+ constructor() {
751
789
  this.eventHandlers = /* @__PURE__ */ new Map();
752
790
  }
753
791
  verify(params) {
@@ -794,27 +832,41 @@ var Webhooks = class {
794
832
  if (handler) await handler(payload.data, payload);
795
833
  return payload;
796
834
  }
797
- async list(params, options) {
798
- return this.httpClient.get("/webhooks", params, options);
799
- }
800
- async create(params, options) {
801
- return this.httpClient.post("/webhooks", params, options);
835
+ };
836
+
837
+ // src/resources/generated-webhooks.ts
838
+ var GeneratedWebhooksResource = class extends Webhooks {
839
+ constructor(httpClient) {
840
+ super();
841
+ this.httpClient = httpClient;
802
842
  }
843
+ /** Retrieve a webhook endpoint by its public ID. */
803
844
  async get(params, options) {
804
845
  const { id } = params;
805
846
  return this.httpClient.get(`/webhooks/${id}`, void 0, options);
806
847
  }
848
+ /** Update a webhook endpoint. Only the provided fields change. */
807
849
  async update(params, options) {
808
- const { id, ...body } = params;
809
- return this.httpClient.put(`/webhooks/${id}`, body, options);
850
+ const { id, ...rest } = params;
851
+ return this.httpClient.patch(`/webhooks/${id}`, rest, options);
810
852
  }
853
+ /** Permanently delete a webhook endpoint. */
811
854
  async delete(params, options) {
812
855
  const { id } = params;
813
856
  return this.httpClient.delete(`/webhooks/${id}`, void 0, options);
814
857
  }
858
+ /** Send a test event to a webhook endpoint to verify connectivity. */
815
859
  async test(params, options) {
816
860
  const { id } = params;
817
- return this.httpClient.post(`/webhooks/${id}/test`, void 0, options);
861
+ return this.httpClient.post(`/webhooks/${id}/test`, {}, options);
862
+ }
863
+ /** List webhook endpoints with cursor-based pagination. */
864
+ async list(params, options) {
865
+ return this.httpClient.get("/webhooks", params, options);
866
+ }
867
+ /** Create a new webhook endpoint. The response includes the signing secret which is only returned once. */
868
+ async create(params, options) {
869
+ return this.httpClient.post("/webhooks", params, options);
818
870
  }
819
871
  };
820
872
 
@@ -849,8 +901,8 @@ var CommetValidationError = class extends CommetError {
849
901
  };
850
902
 
851
903
  // src/version.ts
852
- var API_VERSION = "2026-07-11";
853
- var SDK_VERSION = "7.10.0";
904
+ var API_VERSION = "2026-07-24";
905
+ var SDK_VERSION = "8.0.0";
854
906
 
855
907
  // src/utils/telemetry.ts
856
908
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -960,6 +1012,9 @@ var _CommetHTTPClient = class _CommetHTTPClient {
960
1012
  async put(endpoint, data, options) {
961
1013
  return this.request("PUT", endpoint, data, options);
962
1014
  }
1015
+ async patch(endpoint, data, options) {
1016
+ return this.request("PATCH", endpoint, data, options);
1017
+ }
963
1018
  async delete(endpoint, data, options) {
964
1019
  return this.request("DELETE", endpoint, data, options);
965
1020
  }
@@ -1298,8 +1353,7 @@ var Commet = class extends GeneratedResources {
1298
1353
  }
1299
1354
  this.httpClient = new CommetHTTPClient(config);
1300
1355
  this.initResources(this.httpClient);
1301
- this.usage = new UsageResource(this.httpClient);
1302
- this.webhooks = new Webhooks(this.httpClient);
1356
+ this.webhooks = new GeneratedWebhooksResource(this.httpClient);
1303
1357
  scheduleSdkUpdateCheck();
1304
1358
  }
1305
1359
  };