@commet/node 5.4.0 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -171,6 +171,285 @@ declare class CommetHTTPClient {
171
171
  private sleep;
172
172
  }
173
173
 
174
+ type PlanID = `plan_${string}`;
175
+ type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
176
+ type FeatureType = "boolean" | "usage" | "seats" | "quota";
177
+ type ConsumptionModel = "metered" | "credits" | "balance";
178
+ type DiscountType = "percentage" | "amount";
179
+ interface PlanPrice {
180
+ billingInterval: BillingInterval;
181
+ price: number;
182
+ isDefault: boolean;
183
+ trialDays: number;
184
+ }
185
+ interface PlanFeature {
186
+ code: string;
187
+ name: string;
188
+ type: FeatureType;
189
+ unitName: string | null;
190
+ enabled?: boolean;
191
+ includedAmount?: number;
192
+ unlimited?: boolean;
193
+ overageEnabled?: boolean;
194
+ overageUnitPrice?: number;
195
+ }
196
+ interface Plan {
197
+ id: PlanID;
198
+ object: "plan";
199
+ livemode: boolean;
200
+ code: string;
201
+ name: string;
202
+ description: string | null;
203
+ isPublic: boolean;
204
+ isFree: boolean;
205
+ isDefault: boolean;
206
+ sortOrder: number;
207
+ prices: PlanPrice[];
208
+ features: PlanFeature[];
209
+ createdAt: string;
210
+ }
211
+ interface PlanDetailPrice {
212
+ billingInterval: BillingInterval;
213
+ price: number;
214
+ isDefault: boolean;
215
+ trialDays: number;
216
+ introOffer: {
217
+ enabled: boolean;
218
+ discountType: DiscountType | null;
219
+ discountValue: number | null;
220
+ durationCycles: number | null;
221
+ } | null;
222
+ }
223
+ interface PlanDetailFeature extends PlanFeature {
224
+ overage: {
225
+ enabled: boolean;
226
+ model: "per_unit" | null;
227
+ unitPrice: number | null;
228
+ } | null;
229
+ }
230
+ interface PlanDetail {
231
+ id: PlanID;
232
+ object: "plan";
233
+ livemode: boolean;
234
+ code: string;
235
+ name: string;
236
+ description: string | null;
237
+ isPublic: boolean;
238
+ isDefault: boolean;
239
+ sortOrder: number;
240
+ prices: PlanDetailPrice[];
241
+ features: PlanDetailFeature[];
242
+ createdAt: string;
243
+ updatedAt: string;
244
+ }
245
+ interface ListPlansParams extends ListParams {
246
+ includePrivate?: boolean;
247
+ }
248
+ interface PlanManage {
249
+ id: string;
250
+ object: "plan";
251
+ livemode: boolean;
252
+ name: string;
253
+ code: string;
254
+ description: string | null;
255
+ consumptionModel: ConsumptionModel | null;
256
+ isPublic: boolean;
257
+ isDefault: boolean;
258
+ isFree: boolean;
259
+ blockOnExhaustion: boolean;
260
+ sortOrder: number;
261
+ planGroupId: string | null;
262
+ metadata: Record<string, unknown> | null;
263
+ createdAt: string;
264
+ updatedAt: string;
265
+ }
266
+ interface PlanFeatureManageBase {
267
+ planId: string;
268
+ featureId: string;
269
+ enabled: boolean;
270
+ includedAmount: number | null;
271
+ unlimited: boolean;
272
+ overageEnabled: boolean;
273
+ creditsPerUnit: number | null;
274
+ }
275
+ interface FixedPricingFeatureManage extends PlanFeatureManageBase {
276
+ pricingMode: "fixed";
277
+ overageUnitPrice: number | null;
278
+ margin: null;
279
+ }
280
+ interface AiModelPricingFeatureManage extends PlanFeatureManageBase {
281
+ pricingMode: "ai_model";
282
+ margin: number;
283
+ overageUnitPrice: null;
284
+ }
285
+ type PlanFeatureManage = FixedPricingFeatureManage | AiModelPricingFeatureManage;
286
+ interface PlanPriceManage {
287
+ id: string;
288
+ object: "plan_price";
289
+ livemode: boolean;
290
+ planId: string;
291
+ billingInterval: BillingInterval;
292
+ price: number;
293
+ isDefault: boolean;
294
+ trialDays: number;
295
+ includedBalance: number | null;
296
+ includedCredits: number | null;
297
+ introOfferEnabled: boolean;
298
+ introOfferDiscountType: DiscountType | null;
299
+ introOfferDiscountValue: number | null;
300
+ introOfferDurationCycles: number | null;
301
+ createdAt: string;
302
+ updatedAt: string;
303
+ }
304
+ interface RegionalPriceResult {
305
+ priceId: string;
306
+ overrides: Array<{
307
+ currency: string;
308
+ price: number;
309
+ }>;
310
+ }
311
+ interface DeleteResult {
312
+ id: string;
313
+ deleted: true;
314
+ }
315
+ interface RemoveResult {
316
+ id: string;
317
+ removed: true;
318
+ }
319
+ interface CreatePlanParams {
320
+ name: string;
321
+ code: string;
322
+ description?: string;
323
+ consumptionModel?: ConsumptionModel;
324
+ isPublic?: boolean;
325
+ isFree?: boolean;
326
+ blockOnExhaustion?: boolean;
327
+ planGroupId?: string;
328
+ metadata?: Record<string, unknown>;
329
+ }
330
+ interface UpdatePlanParams {
331
+ id: string;
332
+ name?: string;
333
+ description?: string;
334
+ metadata?: Record<string, unknown>;
335
+ isPublic?: boolean;
336
+ }
337
+ interface DeletePlanParams {
338
+ id: string;
339
+ }
340
+ interface SetVisibilityParams {
341
+ id: string;
342
+ isPublic: boolean;
343
+ }
344
+ interface AddPlanFeatureBase {
345
+ planId: string;
346
+ featureId: string;
347
+ enabled?: boolean;
348
+ includedAmount?: number;
349
+ unlimited?: boolean;
350
+ overageEnabled?: boolean;
351
+ creditsPerUnit?: number | null;
352
+ }
353
+ interface AddFixedPricingFeatureParams extends AddPlanFeatureBase {
354
+ pricingMode?: "fixed";
355
+ overageUnitPrice?: number;
356
+ }
357
+ interface AddAiModelPricingFeatureParams extends AddPlanFeatureBase {
358
+ pricingMode: "ai_model";
359
+ margin: number;
360
+ }
361
+ type AddPlanFeatureParams = AddFixedPricingFeatureParams | AddAiModelPricingFeatureParams;
362
+ interface UpdatePlanFeatureBase {
363
+ planId: string;
364
+ featureId: string;
365
+ enabled?: boolean;
366
+ includedAmount?: number;
367
+ unlimited?: boolean;
368
+ overageEnabled?: boolean;
369
+ creditsPerUnit?: number | null;
370
+ }
371
+ interface UpdateFixedPricingFeatureParams extends UpdatePlanFeatureBase {
372
+ pricingMode?: "fixed";
373
+ overageUnitPrice?: number;
374
+ }
375
+ interface UpdateAiModelPricingFeatureParams extends UpdatePlanFeatureBase {
376
+ pricingMode: "ai_model";
377
+ margin?: number;
378
+ }
379
+ type UpdatePlanFeatureParams = UpdateFixedPricingFeatureParams | UpdateAiModelPricingFeatureParams;
380
+ interface RemovePlanFeatureParams {
381
+ planId: string;
382
+ featureId: string;
383
+ }
384
+ interface AddPlanPriceParams {
385
+ planId: string;
386
+ billingInterval: BillingInterval;
387
+ price: number;
388
+ trialDays?: number;
389
+ isDefault?: boolean;
390
+ includedBalance?: number;
391
+ includedCredits?: number;
392
+ introOfferEnabled?: boolean;
393
+ introOfferDiscountType?: "percentage" | "amount";
394
+ introOfferDiscountValue?: number;
395
+ introOfferDurationCycles?: number;
396
+ }
397
+ interface UpdatePlanPriceParams {
398
+ planId: string;
399
+ priceId: string;
400
+ price?: number;
401
+ isDefault?: boolean;
402
+ trialDays?: number;
403
+ includedBalance?: number;
404
+ includedCredits?: number;
405
+ introOfferEnabled?: boolean;
406
+ introOfferDiscountType?: "percentage" | "amount" | null;
407
+ introOfferDiscountValue?: number | null;
408
+ introOfferDurationCycles?: number | null;
409
+ }
410
+ interface DeletePlanPriceParams {
411
+ planId: string;
412
+ priceId: string;
413
+ }
414
+ interface SetDefaultPriceParams {
415
+ planId: string;
416
+ priceId: string;
417
+ }
418
+ interface SetRegionalPricesParams {
419
+ planId: string;
420
+ priceId: string;
421
+ overrides: Array<{
422
+ currency: string;
423
+ price: number;
424
+ }>;
425
+ }
426
+ interface DeleteRegionalPricesParams {
427
+ planId: string;
428
+ priceId: string;
429
+ }
430
+ declare class PlansResource {
431
+ private httpClient;
432
+ constructor(httpClient: CommetHTTPClient);
433
+ list(params?: ListPlansParams): Promise<ApiResponse<Plan[]>>;
434
+ get(params: {
435
+ id: string;
436
+ }): Promise<ApiResponse<PlanDetail>>;
437
+ create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
438
+ update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
439
+ delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
440
+ setVisibility(params: SetVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
441
+ addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
442
+ updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
443
+ removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemoveResult>>;
444
+ addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
445
+ updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
446
+ deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
447
+ setDefaultPrice(params: SetDefaultPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
448
+ setRegionalPrices(params: SetRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<RegionalPriceResult>>;
449
+ deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
450
+ }
451
+
452
+ type AddonConsumptionModel = "boolean" | "metered" | "credits" | "balance";
174
453
  interface ActiveAddon {
175
454
  object: "addon";
176
455
  livemode: boolean;
@@ -179,8 +458,8 @@ interface ActiveAddon {
179
458
  basePrice: number;
180
459
  featureCode: string;
181
460
  featureName: string;
182
- featureType: string;
183
- consumptionModel: string | null;
461
+ featureType: FeatureType;
462
+ consumptionModel: AddonConsumptionModel | null;
184
463
  activatedAt: string;
185
464
  }
186
465
  interface ListActiveAddonsParams {
@@ -308,413 +587,137 @@ declare class ApiKeysResource {
308
587
  private httpClient;
309
588
  constructor(httpClient: CommetHTTPClient);
310
589
  list(params?: ListApiKeysParams): Promise<ApiResponse<ApiKey[]>>;
311
- /** Response includes full `apiKey` which is only returned once. */
312
- create(params: CreateApiKeyParams, options?: RequestOptions): Promise<ApiResponse<ApiKeyCreated>>;
313
- delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<ApiResponse<void>>;
314
- }
315
-
316
- interface CreditPack {
317
- id: string;
318
- object: "credit_pack";
319
- livemode: boolean;
320
- name: string;
321
- description: string | null;
322
- credits: number;
323
- price: number;
324
- currency: string;
325
- }
326
- interface CreditPackDetail {
327
- id: string;
328
- object: "credit_pack";
329
- livemode: boolean;
330
- name: string;
331
- description: string | null;
332
- credits: number;
333
- price: number;
334
- isActive: boolean;
335
- createdAt: string;
336
- updatedAt: string;
337
- }
338
- interface CreateCreditPackParams {
339
- name: string;
340
- description?: string;
341
- credits: number;
342
- price: number;
343
- isActive?: boolean;
344
- }
345
- interface UpdateCreditPackParams {
346
- id: string;
347
- name?: string;
348
- description?: string;
349
- credits?: number;
350
- price?: number;
351
- isActive?: boolean;
352
- }
353
- interface DeleteCreditPackParams {
354
- id: string;
355
- }
356
- declare class CreditPacksResource {
357
- private httpClient;
358
- constructor(httpClient: CommetHTTPClient);
359
- list(): Promise<ApiResponse<CreditPack[]>>;
360
- create(params: CreateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
361
- update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
362
- delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<ApiResponse<{
363
- id: string;
364
- deleted: true;
365
- }>>;
366
- }
367
-
368
- interface Customer {
369
- id: CustomerID;
370
- object: "customer";
371
- livemode: boolean;
372
- organizationId: string;
373
- fullName?: string;
374
- domain?: string;
375
- website?: string;
376
- billingEmail: string;
377
- timezone?: string;
378
- language?: string;
379
- industry?: string;
380
- employeeCount?: string;
381
- metadata?: Record<string, unknown>;
382
- createdAt: string;
383
- updatedAt: string;
384
- }
385
- interface CustomerAddress {
386
- line1: string;
387
- line2?: string;
388
- city: string;
389
- state?: string;
390
- postalCode: string;
391
- country: string;
392
- }
393
- interface CreateParams {
394
- email: string;
395
- id?: string;
396
- fullName?: string;
397
- domain?: string;
398
- website?: string;
399
- timezone?: string;
400
- language?: string;
401
- industry?: string;
402
- metadata?: Record<string, unknown>;
403
- address?: CustomerAddress;
404
- }
405
- interface GetCustomerParams {
406
- id: CustomerID;
407
- }
408
- interface UpdateParams {
409
- id: CustomerID;
410
- email?: string;
411
- fullName?: string;
412
- domain?: string;
413
- website?: string;
414
- timezone?: string;
415
- language?: string;
416
- industry?: string;
417
- metadata?: Record<string, unknown>;
418
- address?: CustomerAddress;
419
- }
420
- interface ListCustomersParams extends ListParams {
421
- search?: string;
422
- }
423
- interface BatchResult {
424
- successful: Customer[];
425
- failed: Array<{
426
- index: number;
427
- error: string;
428
- data: CreateParams;
429
- }>;
430
- }
431
- declare class CustomersResource {
432
- private httpClient;
433
- constructor(httpClient: CommetHTTPClient);
434
- /** Idempotent when `id` is provided — returns existing customer instead of duplicating. */
435
- create(params: CreateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
436
- createBatch(params: {
437
- customers: CreateParams[];
438
- }, options?: RequestOptions): Promise<ApiResponse<BatchResult>>;
439
- get(params: GetCustomerParams): Promise<ApiResponse<Customer>>;
440
- update(params: UpdateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
441
- list(params?: ListCustomersParams): Promise<ApiResponse<Customer[]>>;
442
- }
443
-
444
- type PlanID = `plan_${string}`;
445
- type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
446
- type FeatureType = "boolean" | "usage" | "seats" | "quota";
447
- interface PlanPrice {
448
- billingInterval: BillingInterval;
449
- price: number;
450
- isDefault: boolean;
451
- trialDays: number;
452
- }
453
- interface PlanFeature {
454
- code: string;
455
- name: string;
456
- type: FeatureType;
457
- unitName: string | null;
458
- enabled?: boolean;
459
- includedAmount?: number;
460
- unlimited?: boolean;
461
- overageEnabled?: boolean;
462
- overageUnitPrice?: number;
463
- }
464
- interface Plan {
465
- id: PlanID;
466
- object: "plan";
467
- livemode: boolean;
468
- code: string;
469
- name: string;
470
- description: string | null;
471
- isPublic: boolean;
472
- isFree: boolean;
473
- isDefault: boolean;
474
- sortOrder: number;
475
- prices: PlanPrice[];
476
- features: PlanFeature[];
477
- createdAt: string;
478
- }
479
- interface PlanDetailPrice {
480
- billingInterval: BillingInterval;
481
- price: number;
482
- isDefault: boolean;
483
- trialDays: number;
484
- introOffer: {
485
- enabled: boolean;
486
- discountType: "percentage" | "amount" | null;
487
- discountValue: number | null;
488
- durationCycles: number | null;
489
- } | null;
490
- }
491
- interface PlanDetailFeature extends PlanFeature {
492
- overage: {
493
- enabled: boolean;
494
- model: "per_unit" | null;
495
- unitPrice: number | null;
496
- } | null;
497
- }
498
- interface PlanDetail {
499
- id: PlanID;
500
- object: "plan";
501
- livemode: boolean;
502
- code: string;
503
- name: string;
504
- description: string | null;
505
- isPublic: boolean;
506
- isDefault: boolean;
507
- sortOrder: number;
508
- prices: PlanDetailPrice[];
509
- features: PlanDetailFeature[];
510
- createdAt: string;
511
- updatedAt: string;
512
- }
513
- interface ListPlansParams extends ListParams {
514
- includePrivate?: boolean;
515
- }
516
- interface PlanManage {
517
- id: string;
518
- object: "plan";
519
- livemode: boolean;
520
- name: string;
521
- code: string;
522
- description: string | null;
523
- consumptionModel: string | null;
524
- isPublic: boolean;
525
- isDefault: boolean;
526
- isFree: boolean;
527
- blockOnExhaustion: boolean;
528
- sortOrder: number;
529
- planGroupId: string | null;
530
- metadata: Record<string, unknown> | null;
531
- createdAt: string;
532
- updatedAt: string;
533
- }
534
- interface PlanFeatureManageBase {
535
- planId: string;
536
- featureId: string;
537
- enabled: boolean;
538
- includedAmount: number | null;
539
- unlimited: boolean;
540
- overageEnabled: boolean;
541
- creditsPerUnit: number | null;
542
- }
543
- interface FixedPricingFeatureManage extends PlanFeatureManageBase {
544
- pricingMode: "fixed";
545
- overageUnitPrice: number | null;
546
- margin: null;
590
+ /** Response includes full `apiKey` which is only returned once. */
591
+ create(params: CreateApiKeyParams, options?: RequestOptions): Promise<ApiResponse<ApiKeyCreated>>;
592
+ delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<ApiResponse<void>>;
547
593
  }
548
- interface AiModelPricingFeatureManage extends PlanFeatureManageBase {
549
- pricingMode: "ai_model";
550
- margin: number;
551
- overageUnitPrice: null;
594
+
595
+ interface CreditPack {
596
+ id: string;
597
+ object: "credit_pack";
598
+ livemode: boolean;
599
+ name: string;
600
+ description: string | null;
601
+ credits: number;
602
+ price: number;
603
+ currency: string;
552
604
  }
553
- type PlanFeatureManage = FixedPricingFeatureManage | AiModelPricingFeatureManage;
554
- interface PlanPriceManage {
605
+ interface CreditPackDetail {
555
606
  id: string;
556
- object: "plan_price";
607
+ object: "credit_pack";
557
608
  livemode: boolean;
558
- planId: string;
559
- billingInterval: BillingInterval;
609
+ name: string;
610
+ description: string | null;
611
+ credits: number;
560
612
  price: number;
561
- isDefault: boolean;
562
- trialDays: number;
563
- includedBalance: number | null;
564
- includedCredits: number | null;
565
- introOfferEnabled: boolean;
566
- introOfferDiscountType: "percentage" | "amount" | null;
567
- introOfferDiscountValue: number | null;
568
- introOfferDurationCycles: number | null;
613
+ isActive: boolean;
569
614
  createdAt: string;
570
615
  updatedAt: string;
571
616
  }
572
- interface RegionalPriceResult {
573
- priceId: string;
574
- overrides: Array<{
575
- currency: string;
576
- price: number;
577
- }>;
578
- }
579
- interface DeleteResult {
580
- id: string;
581
- deleted: true;
582
- }
583
- interface RemoveResult {
584
- id: string;
585
- removed: true;
586
- }
587
- interface CreatePlanParams {
617
+ interface CreateCreditPackParams {
588
618
  name: string;
589
- code: string;
590
619
  description?: string;
591
- consumptionModel?: "metered" | "credits" | "balance";
592
- isPublic?: boolean;
593
- isFree?: boolean;
594
- blockOnExhaustion?: boolean;
595
- planGroupId?: string;
596
- metadata?: Record<string, unknown>;
620
+ credits: number;
621
+ price: number;
622
+ isActive?: boolean;
597
623
  }
598
- interface UpdatePlanParams {
624
+ interface UpdateCreditPackParams {
599
625
  id: string;
600
626
  name?: string;
601
627
  description?: string;
602
- metadata?: Record<string, unknown>;
603
- isPublic?: boolean;
604
- }
605
- interface DeletePlanParams {
606
- id: string;
628
+ credits?: number;
629
+ price?: number;
630
+ isActive?: boolean;
607
631
  }
608
- interface SetVisibilityParams {
632
+ interface DeleteCreditPackParams {
609
633
  id: string;
610
- isPublic: boolean;
611
- }
612
- interface AddPlanFeatureBase {
613
- planId: string;
614
- featureId: string;
615
- enabled?: boolean;
616
- includedAmount?: number;
617
- unlimited?: boolean;
618
- overageEnabled?: boolean;
619
- creditsPerUnit?: number | null;
620
- }
621
- interface AddFixedPricingFeatureParams extends AddPlanFeatureBase {
622
- pricingMode?: "fixed";
623
- overageUnitPrice?: number;
624
- }
625
- interface AddAiModelPricingFeatureParams extends AddPlanFeatureBase {
626
- pricingMode: "ai_model";
627
- margin: number;
628
- }
629
- type AddPlanFeatureParams = AddFixedPricingFeatureParams | AddAiModelPricingFeatureParams;
630
- interface UpdatePlanFeatureBase {
631
- planId: string;
632
- featureId: string;
633
- enabled?: boolean;
634
- includedAmount?: number;
635
- unlimited?: boolean;
636
- overageEnabled?: boolean;
637
- creditsPerUnit?: number | null;
638
634
  }
639
- interface UpdateFixedPricingFeatureParams extends UpdatePlanFeatureBase {
640
- pricingMode?: "fixed";
641
- overageUnitPrice?: number;
635
+ declare class CreditPacksResource {
636
+ private httpClient;
637
+ constructor(httpClient: CommetHTTPClient);
638
+ list(): Promise<ApiResponse<CreditPack[]>>;
639
+ create(params: CreateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
640
+ update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPackDetail>>;
641
+ delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<ApiResponse<{
642
+ id: string;
643
+ deleted: true;
644
+ }>>;
642
645
  }
643
- interface UpdateAiModelPricingFeatureParams extends UpdatePlanFeatureBase {
644
- pricingMode: "ai_model";
645
- margin?: number;
646
+
647
+ interface Customer {
648
+ id: CustomerID;
649
+ object: "customer";
650
+ livemode: boolean;
651
+ organizationId: string;
652
+ fullName?: string;
653
+ domain?: string;
654
+ website?: string;
655
+ billingEmail: string;
656
+ timezone?: string;
657
+ language?: string;
658
+ industry?: string;
659
+ employeeCount?: string;
660
+ metadata?: Record<string, unknown>;
661
+ createdAt: string;
662
+ updatedAt: string;
646
663
  }
647
- type UpdatePlanFeatureParams = UpdateFixedPricingFeatureParams | UpdateAiModelPricingFeatureParams;
648
- interface RemovePlanFeatureParams {
649
- planId: string;
650
- featureId: string;
664
+ interface CustomerAddress {
665
+ line1: string;
666
+ line2?: string;
667
+ city: string;
668
+ state?: string;
669
+ postalCode: string;
670
+ country: string;
651
671
  }
652
- interface AddPlanPriceParams {
653
- planId: string;
654
- billingInterval: BillingInterval;
655
- price: number;
656
- trialDays?: number;
657
- isDefault?: boolean;
658
- includedBalance?: number;
659
- includedCredits?: number;
660
- introOfferEnabled?: boolean;
661
- introOfferDiscountType?: "percentage" | "amount";
662
- introOfferDiscountValue?: number;
663
- introOfferDurationCycles?: number;
672
+ interface CreateParams {
673
+ email: string;
674
+ id?: string;
675
+ fullName?: string;
676
+ domain?: string;
677
+ website?: string;
678
+ timezone?: string;
679
+ language?: string;
680
+ industry?: string;
681
+ metadata?: Record<string, unknown>;
682
+ address?: CustomerAddress;
664
683
  }
665
- interface UpdatePlanPriceParams {
666
- planId: string;
667
- priceId: string;
668
- price?: number;
669
- isDefault?: boolean;
670
- trialDays?: number;
671
- includedBalance?: number;
672
- includedCredits?: number;
673
- introOfferEnabled?: boolean;
674
- introOfferDiscountType?: "percentage" | "amount" | null;
675
- introOfferDiscountValue?: number | null;
676
- introOfferDurationCycles?: number | null;
684
+ interface GetCustomerParams {
685
+ id: CustomerID;
677
686
  }
678
- interface DeletePlanPriceParams {
679
- planId: string;
680
- priceId: string;
687
+ interface UpdateParams {
688
+ id: CustomerID;
689
+ email?: string;
690
+ fullName?: string;
691
+ domain?: string;
692
+ website?: string;
693
+ timezone?: string;
694
+ language?: string;
695
+ industry?: string;
696
+ metadata?: Record<string, unknown>;
697
+ address?: CustomerAddress;
681
698
  }
682
- interface SetDefaultPriceParams {
683
- planId: string;
684
- priceId: string;
699
+ interface ListCustomersParams extends ListParams {
700
+ search?: string;
685
701
  }
686
- interface SetRegionalPricesParams {
687
- planId: string;
688
- priceId: string;
689
- overrides: Array<{
690
- currency: string;
691
- price: number;
702
+ interface BatchResult {
703
+ successful: Customer[];
704
+ failed: Array<{
705
+ index: number;
706
+ error: string;
707
+ data: CreateParams;
692
708
  }>;
693
709
  }
694
- interface DeleteRegionalPricesParams {
695
- planId: string;
696
- priceId: string;
697
- }
698
- declare class PlansResource {
710
+ declare class CustomersResource {
699
711
  private httpClient;
700
712
  constructor(httpClient: CommetHTTPClient);
701
- list(params?: ListPlansParams): Promise<ApiResponse<Plan[]>>;
702
- get(params: {
703
- id: string;
704
- }): Promise<ApiResponse<PlanDetail>>;
705
- create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
706
- update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
707
- delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
708
- setVisibility(params: SetVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanManage>>;
709
- addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
710
- updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeatureManage>>;
711
- removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<RemoveResult>>;
712
- addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
713
- updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
714
- deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
715
- setDefaultPrice(params: SetDefaultPriceParams, options?: RequestOptions): Promise<ApiResponse<PlanPriceManage>>;
716
- setRegionalPrices(params: SetRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<RegionalPriceResult>>;
717
- deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<ApiResponse<DeleteResult>>;
713
+ /** Idempotent when `id` is provided — returns existing customer instead of duplicating. */
714
+ create(params: CreateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
715
+ createBatch(params: {
716
+ customers: CreateParams[];
717
+ }, options?: RequestOptions): Promise<ApiResponse<BatchResult>>;
718
+ get(params: GetCustomerParams): Promise<ApiResponse<Customer>>;
719
+ update(params: UpdateParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
720
+ list(params?: ListCustomersParams): Promise<ApiResponse<Customer[]>>;
718
721
  }
719
722
 
720
723
  interface GetFeatureParams {
@@ -794,8 +797,12 @@ declare class FeaturesResource {
794
797
  }>>;
795
798
  }
796
799
 
800
+ type InvoiceStatus = "draft" | "upcoming" | "outstanding" | "paid" | "void" | "uncollectible";
801
+ type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation";
802
+ type InvoiceLineType = "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "credit" | "addon_base";
803
+ type ChargeType = "standard" | "advance" | "true_up";
797
804
  interface InvoiceLineItem {
798
- lineType: string;
805
+ lineType: InvoiceLineType;
799
806
  featureName: string | null;
800
807
  description: string | null;
801
808
  quantity: number;
@@ -804,10 +811,10 @@ interface InvoiceLineItem {
804
811
  includedAmount: number | null;
805
812
  usedAmount: number | null;
806
813
  overageAmount: number | null;
807
- discountType: string | null;
814
+ discountType: DiscountType | null;
808
815
  discountValue: number | null;
809
816
  discountName: string | null;
810
- chargeType: string | null;
817
+ chargeType: ChargeType | null;
811
818
  }
812
819
  interface InvoiceListItem {
813
820
  id: string;
@@ -816,8 +823,8 @@ interface InvoiceListItem {
816
823
  customerId: string;
817
824
  subscriptionId: string | null;
818
825
  invoiceNumber: string;
819
- status: string;
820
- invoiceType: string;
826
+ status: InvoiceStatus;
827
+ invoiceType: InvoiceType;
821
828
  currency: string;
822
829
  subtotal: number;
823
830
  discountAmount: number;
@@ -849,7 +856,7 @@ interface InvoiceSendResult {
849
856
  }
850
857
  interface InvoiceStatusResult {
851
858
  id: string;
852
- status: string;
859
+ status: "paid" | "void";
853
860
  updatedAt: string;
854
861
  }
855
862
  interface CreateAdjustmentResult {
@@ -858,8 +865,8 @@ interface CreateAdjustmentResult {
858
865
  livemode: boolean;
859
866
  customerId: string;
860
867
  invoiceNumber: string;
861
- status: string;
862
- invoiceType: string;
868
+ status: "outstanding" | "paid";
869
+ invoiceType: InvoiceType;
863
870
  currency: string;
864
871
  subtotal: number;
865
872
  taxAmount: number;
@@ -873,7 +880,7 @@ interface CreateAdjustmentResult {
873
880
  }
874
881
  interface ListInvoicesParams {
875
882
  customerId?: string;
876
- status?: string;
883
+ status?: InvoiceStatus;
877
884
  subscriptionId?: string;
878
885
  limit?: number;
879
886
  cursor?: string;
@@ -895,7 +902,7 @@ interface SendInvoiceParams {
895
902
  }
896
903
  interface UpdateInvoiceStatusParams {
897
904
  id: string;
898
- status: string;
905
+ status: "paid" | "void";
899
906
  }
900
907
  declare class InvoicesResource {
901
908
  private httpClient;
@@ -1188,7 +1195,6 @@ interface DiscountSummary {
1188
1195
  name: string | null;
1189
1196
  endsAt: string | null;
1190
1197
  }
1191
- type ConsumptionModel = "metered" | "credits" | "balance";
1192
1198
  interface ActiveSubscription {
1193
1199
  id: string;
1194
1200
  object: "subscription";
@@ -1364,6 +1370,7 @@ interface PreviewChangeParams {
1364
1370
  billingInterval?: BillingInterval;
1365
1371
  }
1366
1372
  interface PreviewChangeResult {
1373
+ currency: string;
1367
1374
  currentPlanCredit: number;
1368
1375
  newPlanCharge: number;
1369
1376
  estimatedTotal: number;
@@ -1441,6 +1448,7 @@ declare class SubscriptionsResource {
1441
1448
  purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<ApiResponse<PurchaseCreditsResult>>;
1442
1449
  }
1443
1450
 
1451
+ type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
1444
1452
  interface TransactionListItem {
1445
1453
  id: string;
1446
1454
  object: "transaction";
@@ -1450,7 +1458,7 @@ interface TransactionListItem {
1450
1458
  subtotal: number;
1451
1459
  taxAmount: number;
1452
1460
  currency: string;
1453
- status: string;
1461
+ status: TransactionStatus;
1454
1462
  customerEmail: string;
1455
1463
  customerName: string | null;
1456
1464
  paidAt: string | null;
@@ -1462,15 +1470,15 @@ interface TransactionDetail extends TransactionListItem {
1462
1470
  }
1463
1471
  interface TransactionRefundResult {
1464
1472
  id: string;
1465
- status: string;
1473
+ status: "refunded";
1466
1474
  }
1467
1475
  interface TransactionRetryResult {
1468
1476
  id: string;
1469
- status: string;
1477
+ status: "processing";
1470
1478
  retryInvoiceNumber: string;
1471
1479
  }
1472
1480
  interface ListTransactionsParams {
1473
- status?: string;
1481
+ status?: TransactionStatus;
1474
1482
  customerEmail?: string;
1475
1483
  limit?: number;
1476
1484
  cursor?: string;
@@ -1495,6 +1503,7 @@ declare class TransactionsResource {
1495
1503
  retry(params: RetryTransactionParams, options?: RequestOptions): Promise<ApiResponse<TransactionRetryResult>>;
1496
1504
  }
1497
1505
 
1506
+ type UsageCheckDenialReason = "included_limit_reached" | "insufficient_credits" | "insufficient_balance";
1498
1507
  interface UsageEvent {
1499
1508
  id: EventID;
1500
1509
  object: "usage_event";
@@ -1541,7 +1550,7 @@ interface CheckUsageParams {
1541
1550
  }
1542
1551
  interface UsageCheckResult {
1543
1552
  allowed: boolean;
1544
- consumptionModel: string;
1553
+ consumptionModel: ConsumptionModel;
1545
1554
  feature: string;
1546
1555
  quantity: number;
1547
1556
  current?: number;
@@ -1560,7 +1569,7 @@ interface UsageCheckResult {
1560
1569
  currentBalance?: number;
1561
1570
  blockOnExhaustion?: boolean;
1562
1571
  currency?: string;
1563
- reason?: string;
1572
+ reason?: UsageCheckDenialReason;
1564
1573
  message?: string;
1565
1574
  }
1566
1575
  declare class UsageResource {
@@ -1710,4 +1719,4 @@ declare function registerIntegration(name: string, version: string): void;
1710
1719
  declare const API_VERSION = "2026-05-25";
1711
1720
  declare const SDK_VERSION: string;
1712
1721
 
1713
- export { API_VERSION, type ActivateAddonParams, type ActivateAddonResult, type ActiveAddon, type ActiveSubscription, type AddAiModelPricingFeatureParams, type AddFixedPricingFeatureParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type Addon, type AdjustBalanceParams, type AdjustBalanceResult, type AiModelPricingFeatureManage, type ApiErrorDetail, type ApiKey, type ApiKeyCreated, type ApiResponse, type BalanceAddon, type BillingConfig, type BillingInterval, type BooleanAddon, type CanUseFeatureParams, type CanUseResult, type CancelParams, type CancellationSummary, type ChangePlanParams, type ChangePlanResult, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CreateAddonParams, type CreateAdjustmentParams, type CreateAdjustmentResult, type CreateApiKeyParams, type CreateBalanceAddonParams, type CreateBooleanAddonParams, type CreateCreditPackParams, type CreateCreditsAddonParams, type CreateParams as CreateCustomerParams, type CreateFeatureParams, type CreateMeteredAddonParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedSubscription, type CreditPack, type CreditPackDetail, type CreditsAddon, type Currency, type CustomIntroOffer, type Customer, type CustomerAddress, type CustomerID, type BatchResult as CustomersBatchResult, type DeactivateAddonParams, type DeactivateAddonResult, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteResult, type DeleteWebhookParams, type DiscountSummary, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureSummary, type FeatureType, type FixedPricingFeatureManage, type GetActiveParams, type GetAddonParams, type GetAllBalancesParams, type GetAllQuotaParams, type GetBalanceParams, type GetCustomerParams, type GetDownloadUrlParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPromoCodeParams, type GetQuotaParams, type GetTransactionParams, type GetUrlParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type InvoiceDetail, type InvoiceDownloadResult, type InvoiceLineItem, type InvoiceListItem, type InvoiceSendResult, type InvoiceStatusResult, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type MeteredAddon, type PaginatedList, type PaginatedResponse, type Plan, type PlanDef, type PlanDetail, type PlanFeature, type PlanFeatureManage, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanID, type PlanManage, type PlanPrice, type PlanPriceManage, type PortalAccess, type PreviewChangeParams, type PreviewChangeResult, type PriceDef, type PromoCode, type PromoCodeDetail, type PurchaseCreditsParams, type PurchaseCreditsResult, type QuotaAllowance, type QuotaEvent, type RefundTransactionParams, type RegionalPriceResult, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveResult, type RemoveSeatsParams, type ReorderPlansParams, type RequestOptions, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatEvent, type SendInvoiceParams, type SetAllSeatsParams, type SetDefaultPriceParams, type SetQuotaParams, type SetRegionalPricesParams, type SetSeatsParams, type SetVisibilityParams, type Subscription, type SubscriptionListItem, type SubscriptionStatus, type TestWebhookParams, type TopupBalanceParams, type TopupBalanceResult, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type TransactionDetail, type TransactionListItem, type TransactionRefundResult, type TransactionRetryResult, type UncancelParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateParams as UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
1722
+ export { API_VERSION, type ActivateAddonParams, type ActivateAddonResult, type ActiveAddon, type ActiveSubscription, type AddAiModelPricingFeatureParams, type AddFixedPricingFeatureParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type Addon, type AddonConsumptionModel, type AdjustBalanceParams, type AdjustBalanceResult, type AiModelPricingFeatureManage, type ApiErrorDetail, type ApiKey, type ApiKeyCreated, type ApiResponse, type BalanceAddon, type BillingConfig, type BillingInterval, type BooleanAddon, type CanUseFeatureParams, type CanUseResult, type CancelParams, type CancellationSummary, type ChangePlanParams, type ChangePlanResult, type ChargeType, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentParams, type CreateAdjustmentResult, type CreateApiKeyParams, type CreateBalanceAddonParams, type CreateBooleanAddonParams, type CreateCreditPackParams, type CreateCreditsAddonParams, type CreateParams as CreateCustomerParams, type CreateFeatureParams, type CreateMeteredAddonParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedSubscription, type CreditPack, type CreditPackDetail, type CreditsAddon, type Currency, type CustomIntroOffer, type Customer, type CustomerAddress, type CustomerID, type BatchResult as CustomersBatchResult, type DeactivateAddonParams, type DeactivateAddonResult, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteResult, type DeleteWebhookParams, type DiscountSummary, type DiscountType, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureSummary, type FeatureType, type FixedPricingFeatureManage, type GetActiveParams, type GetAddonParams, type GetAllBalancesParams, type GetAllQuotaParams, type GetBalanceParams, type GetCustomerParams, type GetDownloadUrlParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPromoCodeParams, type GetQuotaParams, type GetTransactionParams, type GetUrlParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type InvoiceDetail, type InvoiceDownloadResult, type InvoiceLineItem, type InvoiceLineType, type InvoiceListItem, type InvoiceSendResult, type InvoiceStatus, type InvoiceStatusResult, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type MeteredAddon, type PaginatedList, type PaginatedResponse, type Plan, type PlanDef, type PlanDetail, type PlanFeature, type PlanFeatureManage, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanID, type PlanManage, type PlanPrice, type PlanPriceManage, type PortalAccess, type PreviewChangeParams, type PreviewChangeResult, type PriceDef, type PromoCode, type PromoCodeDetail, type PurchaseCreditsParams, type PurchaseCreditsResult, type QuotaAllowance, type QuotaEvent, type RefundTransactionParams, type RegionalPriceResult, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveResult, type RemoveSeatsParams, type ReorderPlansParams, type RequestOptions, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatEvent, type SendInvoiceParams, type SetAllSeatsParams, type SetDefaultPriceParams, type SetQuotaParams, type SetRegionalPricesParams, type SetSeatsParams, type SetVisibilityParams, type Subscription, type SubscriptionListItem, type SubscriptionStatus, type TestWebhookParams, type TopupBalanceParams, type TopupBalanceResult, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type TransactionDetail, type TransactionListItem, type TransactionRefundResult, type TransactionRetryResult, type TransactionStatus, type UncancelParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateParams as UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };