@stigg/typescript 0.1.0-alpha.3 → 0.1.0-alpha.4

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.
Files changed (124) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/index.d.mts +1 -1
  11. package/resources/index.d.mts.map +1 -1
  12. package/resources/index.d.ts +1 -1
  13. package/resources/index.d.ts.map +1 -1
  14. package/resources/index.js.map +1 -1
  15. package/resources/index.mjs +1 -1
  16. package/resources/index.mjs.map +1 -1
  17. package/resources/v1/coupons.d.mts +6 -89
  18. package/resources/v1/coupons.d.mts.map +1 -1
  19. package/resources/v1/coupons.d.ts +6 -89
  20. package/resources/v1/coupons.d.ts.map +1 -1
  21. package/resources/v1/customers/customers.d.mts +106 -46
  22. package/resources/v1/customers/customers.d.mts.map +1 -1
  23. package/resources/v1/customers/customers.d.ts +106 -46
  24. package/resources/v1/customers/customers.d.ts.map +1 -1
  25. package/resources/v1/customers/customers.js +16 -10
  26. package/resources/v1/customers/customers.js.map +1 -1
  27. package/resources/v1/customers/customers.mjs +16 -10
  28. package/resources/v1/customers/customers.mjs.map +1 -1
  29. package/resources/v1/customers/index.d.mts +2 -2
  30. package/resources/v1/customers/index.d.mts.map +1 -1
  31. package/resources/v1/customers/index.d.ts +2 -2
  32. package/resources/v1/customers/index.d.ts.map +1 -1
  33. package/resources/v1/customers/index.js +3 -3
  34. package/resources/v1/customers/index.js.map +1 -1
  35. package/resources/v1/customers/index.mjs +1 -1
  36. package/resources/v1/customers/index.mjs.map +1 -1
  37. package/resources/v1/customers/promotional-entitlements.d.mts +350 -0
  38. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
  39. package/resources/v1/customers/promotional-entitlements.d.ts +350 -0
  40. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
  41. package/resources/v1/customers/promotional-entitlements.js +23 -0
  42. package/resources/v1/customers/promotional-entitlements.js.map +1 -0
  43. package/resources/v1/customers/promotional-entitlements.mjs +19 -0
  44. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
  45. package/resources/v1/events.d.mts +62 -0
  46. package/resources/v1/events.d.mts.map +1 -0
  47. package/resources/v1/events.d.ts +62 -0
  48. package/resources/v1/events.d.ts.map +1 -0
  49. package/resources/v1/events.js +15 -0
  50. package/resources/v1/events.js.map +1 -0
  51. package/resources/v1/events.mjs +11 -0
  52. package/resources/v1/events.mjs.map +1 -0
  53. package/resources/v1/index.d.mts +6 -4
  54. package/resources/v1/index.d.mts.map +1 -1
  55. package/resources/v1/index.d.ts +6 -4
  56. package/resources/v1/index.d.ts.map +1 -1
  57. package/resources/v1/index.js +5 -1
  58. package/resources/v1/index.js.map +1 -1
  59. package/resources/v1/index.mjs +3 -1
  60. package/resources/v1/index.mjs.map +1 -1
  61. package/resources/v1/subscriptions/future-update.d.mts +6 -20
  62. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  63. package/resources/v1/subscriptions/future-update.d.ts +6 -20
  64. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  65. package/resources/v1/subscriptions/future-update.js.map +1 -1
  66. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  67. package/resources/v1/subscriptions/index.d.mts +2 -2
  68. package/resources/v1/subscriptions/index.d.mts.map +1 -1
  69. package/resources/v1/subscriptions/index.d.ts +2 -2
  70. package/resources/v1/subscriptions/index.d.ts.map +1 -1
  71. package/resources/v1/subscriptions/index.js.map +1 -1
  72. package/resources/v1/subscriptions/index.mjs +1 -1
  73. package/resources/v1/subscriptions/index.mjs.map +1 -1
  74. package/resources/v1/subscriptions/subscriptions.d.mts +963 -1049
  75. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  76. package/resources/v1/subscriptions/subscriptions.d.ts +963 -1049
  77. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  78. package/resources/v1/subscriptions/subscriptions.js +24 -6
  79. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  80. package/resources/v1/subscriptions/subscriptions.mjs +25 -7
  81. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  82. package/resources/v1/usage.d.mts +229 -0
  83. package/resources/v1/usage.d.mts.map +1 -0
  84. package/resources/v1/usage.d.ts +229 -0
  85. package/resources/v1/usage.d.ts.map +1 -0
  86. package/resources/v1/usage.js +23 -0
  87. package/resources/v1/usage.js.map +1 -0
  88. package/resources/v1/usage.mjs +19 -0
  89. package/resources/v1/usage.mjs.map +1 -0
  90. package/resources/v1/v1.d.mts +14 -172
  91. package/resources/v1/v1.d.mts.map +1 -1
  92. package/resources/v1/v1.d.ts +14 -172
  93. package/resources/v1/v1.d.ts.map +1 -1
  94. package/resources/v1/v1.js +8 -12
  95. package/resources/v1/v1.js.map +1 -1
  96. package/resources/v1/v1.mjs +8 -12
  97. package/resources/v1/v1.mjs.map +1 -1
  98. package/src/client.ts +2 -14
  99. package/src/resources/index.ts +1 -7
  100. package/src/resources/v1/coupons.ts +6 -222
  101. package/src/resources/v1/customers/customers.ts +142 -57
  102. package/src/resources/v1/customers/index.ts +10 -2
  103. package/src/resources/v1/customers/promotional-entitlements.ts +466 -0
  104. package/src/resources/v1/events.ts +73 -0
  105. package/src/resources/v1/index.ts +19 -15
  106. package/src/resources/v1/subscriptions/future-update.ts +6 -28
  107. package/src/resources/v1/subscriptions/index.ts +8 -11
  108. package/src/resources/v1/subscriptions/subscriptions.ts +2541 -2304
  109. package/src/resources/v1/usage.ts +283 -0
  110. package/src/resources/v1/v1.ts +50 -220
  111. package/src/version.ts +1 -1
  112. package/version.d.mts +1 -1
  113. package/version.d.ts +1 -1
  114. package/version.js +1 -1
  115. package/version.mjs +1 -1
  116. package/resources/v1/customers/usage.d.mts +0 -4
  117. package/resources/v1/customers/usage.d.mts.map +0 -1
  118. package/resources/v1/customers/usage.d.ts +0 -4
  119. package/resources/v1/customers/usage.d.ts.map +0 -1
  120. package/resources/v1/customers/usage.js +0 -9
  121. package/resources/v1/customers/usage.js.map +0 -1
  122. package/resources/v1/customers/usage.mjs +0 -5
  123. package/resources/v1/customers/usage.mjs.map +0 -1
  124. package/src/resources/v1/customers/usage.ts +0 -5
@@ -3,8 +3,14 @@
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as PaymentMethodAPI from './payment-method';
5
5
  import { PaymentMethod, PaymentMethodAttachParams } from './payment-method';
6
- import * as UsageAPI from './usage';
7
- import { Usage } from './usage';
6
+ import * as PromotionalEntitlementsAPI from './promotional-entitlements';
7
+ import {
8
+ PromotionalEntitlementGrantParams,
9
+ PromotionalEntitlementGrantResponse,
10
+ PromotionalEntitlementRevokeParams,
11
+ PromotionalEntitlementRevokeResponse,
12
+ PromotionalEntitlements,
13
+ } from './promotional-entitlements';
8
14
  import { APIPromise } from '../../../core/api-promise';
9
15
  import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
10
16
  import { RequestOptions } from '../../../internal/request-options';
@@ -12,14 +18,8 @@ import { path } from '../../../internal/utils/path';
12
18
 
13
19
  export class Customers extends APIResource {
14
20
  paymentMethod: PaymentMethodAPI.PaymentMethod = new PaymentMethodAPI.PaymentMethod(this._client);
15
- usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
16
-
17
- /**
18
- * Provision customer
19
- */
20
- create(body: CustomerCreateParams, options?: RequestOptions): APIPromise<CustomerResponse> {
21
- return this._client.post('/api/v1/customers', { body, ...options });
22
- }
21
+ promotionalEntitlements: PromotionalEntitlementsAPI.PromotionalEntitlements =
22
+ new PromotionalEntitlementsAPI.PromotionalEntitlements(this._client);
23
23
 
24
24
  /**
25
25
  * Get a single customer by ID
@@ -55,6 +55,20 @@ export class Customers extends APIResource {
55
55
  return this._client.post(path`/api/v1/customers/${id}/archive`, options);
56
56
  }
57
57
 
58
+ /**
59
+ * Bulk import customers
60
+ */
61
+ import(body: CustomerImportParams, options?: RequestOptions): APIPromise<CustomerImportResponse> {
62
+ return this._client.post('/api/v1/customers/import', { body, ...options });
63
+ }
64
+
65
+ /**
66
+ * Provision customer
67
+ */
68
+ provision(body: CustomerProvisionParams, options?: RequestOptions): APIPromise<CustomerResponse> {
69
+ return this._client.post('/api/v1/customers', { body, ...options });
70
+ }
71
+
58
72
  /**
59
73
  * Unarchive customer
60
74
  */
@@ -311,21 +325,33 @@ export namespace CustomerListResponse {
311
325
  }
312
326
  }
313
327
 
314
- export interface CustomerCreateParams {
328
+ /**
329
+ * Response object
330
+ */
331
+ export interface CustomerImportResponse {
315
332
  /**
316
- * Customer slug
333
+ * List of newly created customer IDs from the import operation.
317
334
  */
318
- id: string;
335
+ data: CustomerImportResponse.Data;
336
+ }
319
337
 
338
+ export namespace CustomerImportResponse {
320
339
  /**
321
- * Customer level coupon
340
+ * List of newly created customer IDs from the import operation.
322
341
  */
323
- couponId?: string | null;
342
+ export interface Data {
343
+ /**
344
+ * Customer IDs created during import
345
+ */
346
+ newCustomers: Array<string>;
347
+ }
348
+ }
324
349
 
350
+ export interface CustomerUpdateParams {
325
351
  /**
326
- * The default payment method details
352
+ * Customer level coupon
327
353
  */
328
- defaultPaymentMethod?: CustomerCreateParams.DefaultPaymentMethod | null;
354
+ couponId?: string | null;
329
355
 
330
356
  /**
331
357
  * The email of the customer
@@ -335,7 +361,7 @@ export interface CustomerCreateParams {
335
361
  /**
336
362
  * List of integrations
337
363
  */
338
- integrations?: Array<CustomerCreateParams.Integration>;
364
+ integrations?: Array<CustomerUpdateParams.Integration>;
339
365
 
340
366
  /**
341
367
  * Additional metadata
@@ -348,37 +374,7 @@ export interface CustomerCreateParams {
348
374
  name?: string | null;
349
375
  }
350
376
 
351
- export namespace CustomerCreateParams {
352
- /**
353
- * The default payment method details
354
- */
355
- export interface DefaultPaymentMethod {
356
- /**
357
- * The default payment method id
358
- */
359
- billingId: string | null;
360
-
361
- /**
362
- * The expiration month of the default payment method
363
- */
364
- cardExpiryMonth: number | null;
365
-
366
- /**
367
- * The expiration year of the default payment method
368
- */
369
- cardExpiryYear: number | null;
370
-
371
- /**
372
- * The last 4 digits of the default payment method
373
- */
374
- cardLast4Digits: string | null;
375
-
376
- /**
377
- * The default payment method type
378
- */
379
- type: 'CARD' | 'BANK' | 'CASH_APP';
380
- }
381
-
377
+ export namespace CustomerUpdateParams {
382
378
  /**
383
379
  * External billing or CRM integration link
384
380
  */
@@ -410,12 +406,65 @@ export namespace CustomerCreateParams {
410
406
  }
411
407
  }
412
408
 
413
- export interface CustomerUpdateParams {
409
+ export interface CustomerListParams extends MyCursorIDPageParams {}
410
+
411
+ export interface CustomerImportParams {
412
+ /**
413
+ * List of customer objects to import
414
+ */
415
+ customers: Array<CustomerImportParams.Customer>;
416
+ }
417
+
418
+ export namespace CustomerImportParams {
419
+ export interface Customer {
420
+ /**
421
+ * Customer slug
422
+ */
423
+ id: string;
424
+
425
+ /**
426
+ * The email of the customer
427
+ */
428
+ email: string | null;
429
+
430
+ /**
431
+ * The name of the customer
432
+ */
433
+ name: string | null;
434
+
435
+ /**
436
+ * Additional metadata
437
+ */
438
+ metadata?: { [key: string]: string };
439
+
440
+ /**
441
+ * Billing provider payment method id
442
+ */
443
+ paymentMethodId?: string;
444
+
445
+ /**
446
+ * Timestamp of when the record was last updated
447
+ */
448
+ updatedAt?: string;
449
+ }
450
+ }
451
+
452
+ export interface CustomerProvisionParams {
453
+ /**
454
+ * Customer slug
455
+ */
456
+ id: string;
457
+
414
458
  /**
415
459
  * Customer level coupon
416
460
  */
417
461
  couponId?: string | null;
418
462
 
463
+ /**
464
+ * The default payment method details
465
+ */
466
+ defaultPaymentMethod?: CustomerProvisionParams.DefaultPaymentMethod | null;
467
+
419
468
  /**
420
469
  * The email of the customer
421
470
  */
@@ -424,7 +473,7 @@ export interface CustomerUpdateParams {
424
473
  /**
425
474
  * List of integrations
426
475
  */
427
- integrations?: Array<CustomerUpdateParams.Integration>;
476
+ integrations?: Array<CustomerProvisionParams.Integration>;
428
477
 
429
478
  /**
430
479
  * Additional metadata
@@ -437,7 +486,37 @@ export interface CustomerUpdateParams {
437
486
  name?: string | null;
438
487
  }
439
488
 
440
- export namespace CustomerUpdateParams {
489
+ export namespace CustomerProvisionParams {
490
+ /**
491
+ * The default payment method details
492
+ */
493
+ export interface DefaultPaymentMethod {
494
+ /**
495
+ * The default payment method id
496
+ */
497
+ billingId: string | null;
498
+
499
+ /**
500
+ * The expiration month of the default payment method
501
+ */
502
+ cardExpiryMonth: number | null;
503
+
504
+ /**
505
+ * The expiration year of the default payment method
506
+ */
507
+ cardExpiryYear: number | null;
508
+
509
+ /**
510
+ * The last 4 digits of the default payment method
511
+ */
512
+ cardLast4Digits: string | null;
513
+
514
+ /**
515
+ * The default payment method type
516
+ */
517
+ type: 'CARD' | 'BANK' | 'CASH_APP';
518
+ }
519
+
441
520
  /**
442
521
  * External billing or CRM integration link
443
522
  */
@@ -469,22 +548,28 @@ export namespace CustomerUpdateParams {
469
548
  }
470
549
  }
471
550
 
472
- export interface CustomerListParams extends MyCursorIDPageParams {}
473
-
474
551
  Customers.PaymentMethod = PaymentMethod;
475
- Customers.Usage = Usage;
552
+ Customers.PromotionalEntitlements = PromotionalEntitlements;
476
553
 
477
554
  export declare namespace Customers {
478
555
  export {
479
556
  type CustomerResponse as CustomerResponse,
480
557
  type CustomerListResponse as CustomerListResponse,
558
+ type CustomerImportResponse as CustomerImportResponse,
481
559
  type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage,
482
- type CustomerCreateParams as CustomerCreateParams,
483
560
  type CustomerUpdateParams as CustomerUpdateParams,
484
561
  type CustomerListParams as CustomerListParams,
562
+ type CustomerImportParams as CustomerImportParams,
563
+ type CustomerProvisionParams as CustomerProvisionParams,
485
564
  };
486
565
 
487
566
  export { PaymentMethod as PaymentMethod, type PaymentMethodAttachParams as PaymentMethodAttachParams };
488
567
 
489
- export { Usage as Usage };
568
+ export {
569
+ PromotionalEntitlements as PromotionalEntitlements,
570
+ type PromotionalEntitlementGrantResponse as PromotionalEntitlementGrantResponse,
571
+ type PromotionalEntitlementRevokeResponse as PromotionalEntitlementRevokeResponse,
572
+ type PromotionalEntitlementGrantParams as PromotionalEntitlementGrantParams,
573
+ type PromotionalEntitlementRevokeParams as PromotionalEntitlementRevokeParams,
574
+ };
490
575
  }
@@ -4,10 +4,18 @@ export {
4
4
  Customers,
5
5
  type CustomerResponse,
6
6
  type CustomerListResponse,
7
- type CustomerCreateParams,
7
+ type CustomerImportResponse,
8
8
  type CustomerUpdateParams,
9
9
  type CustomerListParams,
10
+ type CustomerImportParams,
11
+ type CustomerProvisionParams,
10
12
  type CustomerListResponsesMyCursorIDPage,
11
13
  } from './customers';
12
14
  export { PaymentMethod, type PaymentMethodAttachParams } from './payment-method';
13
- export { Usage } from './usage';
15
+ export {
16
+ PromotionalEntitlements,
17
+ type PromotionalEntitlementGrantResponse,
18
+ type PromotionalEntitlementRevokeResponse,
19
+ type PromotionalEntitlementGrantParams,
20
+ type PromotionalEntitlementRevokeParams,
21
+ } from './promotional-entitlements';