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

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 (177) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +9 -0
  3. package/client.d.mts +4 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +4 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +16 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +16 -21
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/internal/qs/formats.d.mts +7 -0
  18. package/internal/qs/formats.d.mts.map +1 -0
  19. package/internal/qs/formats.d.ts +7 -0
  20. package/internal/qs/formats.d.ts.map +1 -0
  21. package/internal/qs/formats.js +13 -0
  22. package/internal/qs/formats.js.map +1 -0
  23. package/internal/qs/formats.mjs +9 -0
  24. package/internal/qs/formats.mjs.map +1 -0
  25. package/internal/qs/index.d.mts +10 -0
  26. package/internal/qs/index.d.mts.map +1 -0
  27. package/internal/qs/index.d.ts +10 -0
  28. package/internal/qs/index.d.ts.map +1 -0
  29. package/internal/qs/index.js +14 -0
  30. package/internal/qs/index.js.map +1 -0
  31. package/internal/qs/index.mjs +10 -0
  32. package/internal/qs/index.mjs.map +1 -0
  33. package/internal/qs/stringify.d.mts +3 -0
  34. package/internal/qs/stringify.d.mts.map +1 -0
  35. package/internal/qs/stringify.d.ts +3 -0
  36. package/internal/qs/stringify.d.ts.map +1 -0
  37. package/internal/qs/stringify.js +277 -0
  38. package/internal/qs/stringify.js.map +1 -0
  39. package/internal/qs/stringify.mjs +274 -0
  40. package/internal/qs/stringify.mjs.map +1 -0
  41. package/internal/qs/types.d.mts +57 -0
  42. package/internal/qs/types.d.mts.map +1 -0
  43. package/internal/qs/types.d.ts +57 -0
  44. package/internal/qs/types.d.ts.map +1 -0
  45. package/internal/qs/types.js +3 -0
  46. package/internal/qs/types.js.map +1 -0
  47. package/internal/qs/types.mjs +2 -0
  48. package/internal/qs/types.mjs.map +1 -0
  49. package/internal/qs/utils.d.mts +15 -0
  50. package/internal/qs/utils.d.mts.map +1 -0
  51. package/internal/qs/utils.d.ts +15 -0
  52. package/internal/qs/utils.d.ts.map +1 -0
  53. package/internal/qs/utils.js +230 -0
  54. package/internal/qs/utils.js.map +1 -0
  55. package/internal/qs/utils.mjs +217 -0
  56. package/internal/qs/utils.mjs.map +1 -0
  57. package/package.json +1 -1
  58. package/resources/v1/coupons.d.mts +49 -7
  59. package/resources/v1/coupons.d.mts.map +1 -1
  60. package/resources/v1/coupons.d.ts +49 -7
  61. package/resources/v1/coupons.d.ts.map +1 -1
  62. package/resources/v1/coupons.js +4 -3
  63. package/resources/v1/coupons.js.map +1 -1
  64. package/resources/v1/coupons.mjs +4 -3
  65. package/resources/v1/coupons.mjs.map +1 -1
  66. package/resources/v1/customers/customers.d.mts +72 -8
  67. package/resources/v1/customers/customers.d.mts.map +1 -1
  68. package/resources/v1/customers/customers.d.ts +72 -8
  69. package/resources/v1/customers/customers.d.ts.map +1 -1
  70. package/resources/v1/customers/customers.js +18 -7
  71. package/resources/v1/customers/customers.js.map +1 -1
  72. package/resources/v1/customers/customers.mjs +18 -7
  73. package/resources/v1/customers/customers.mjs.map +1 -1
  74. package/resources/v1/customers/index.d.mts +1 -1
  75. package/resources/v1/customers/index.d.mts.map +1 -1
  76. package/resources/v1/customers/index.d.ts +1 -1
  77. package/resources/v1/customers/index.d.ts.map +1 -1
  78. package/resources/v1/customers/index.js.map +1 -1
  79. package/resources/v1/customers/index.mjs.map +1 -1
  80. package/resources/v1/customers/payment-method.d.mts +4 -2
  81. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  82. package/resources/v1/customers/payment-method.d.ts +4 -2
  83. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  84. package/resources/v1/customers/payment-method.js +4 -2
  85. package/resources/v1/customers/payment-method.js.map +1 -1
  86. package/resources/v1/customers/payment-method.mjs +4 -2
  87. package/resources/v1/customers/payment-method.mjs.map +1 -1
  88. package/resources/v1/customers/promotional-entitlements.d.mts +4 -2
  89. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -1
  90. package/resources/v1/customers/promotional-entitlements.d.ts +4 -2
  91. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -1
  92. package/resources/v1/customers/promotional-entitlements.js +4 -2
  93. package/resources/v1/customers/promotional-entitlements.js.map +1 -1
  94. package/resources/v1/customers/promotional-entitlements.mjs +4 -2
  95. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -1
  96. package/resources/v1/events.d.mts +2 -1
  97. package/resources/v1/events.d.mts.map +1 -1
  98. package/resources/v1/events.d.ts +2 -1
  99. package/resources/v1/events.d.ts.map +1 -1
  100. package/resources/v1/events.js +2 -1
  101. package/resources/v1/events.js.map +1 -1
  102. package/resources/v1/events.mjs +2 -1
  103. package/resources/v1/events.mjs.map +1 -1
  104. package/resources/v1/index.d.mts +2 -1
  105. package/resources/v1/index.d.mts.map +1 -1
  106. package/resources/v1/index.d.ts +2 -1
  107. package/resources/v1/index.d.ts.map +1 -1
  108. package/resources/v1/index.js +3 -1
  109. package/resources/v1/index.js.map +1 -1
  110. package/resources/v1/index.mjs +1 -0
  111. package/resources/v1/index.mjs.map +1 -1
  112. package/resources/v1/products.d.mts +126 -0
  113. package/resources/v1/products.d.mts.map +1 -0
  114. package/resources/v1/products.d.ts +126 -0
  115. package/resources/v1/products.d.ts.map +1 -0
  116. package/resources/v1/products.js +19 -0
  117. package/resources/v1/products.js.map +1 -0
  118. package/resources/v1/products.mjs +15 -0
  119. package/resources/v1/products.mjs.map +1 -0
  120. package/resources/v1/subscriptions/future-update.d.mts +3 -2
  121. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  122. package/resources/v1/subscriptions/future-update.d.ts +3 -2
  123. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  124. package/resources/v1/subscriptions/future-update.js +3 -2
  125. package/resources/v1/subscriptions/future-update.js.map +1 -1
  126. package/resources/v1/subscriptions/future-update.mjs +3 -2
  127. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  128. package/resources/v1/subscriptions/subscriptions.d.mts +158 -34
  129. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  130. package/resources/v1/subscriptions/subscriptions.d.ts +158 -34
  131. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  132. package/resources/v1/subscriptions/subscriptions.js +20 -10
  133. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  134. package/resources/v1/subscriptions/subscriptions.mjs +20 -10
  135. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  136. package/resources/v1/usage.d.mts +3 -2
  137. package/resources/v1/usage.d.mts.map +1 -1
  138. package/resources/v1/usage.d.ts +3 -2
  139. package/resources/v1/usage.d.ts.map +1 -1
  140. package/resources/v1/usage.js +3 -2
  141. package/resources/v1/usage.js.map +1 -1
  142. package/resources/v1/usage.mjs +3 -2
  143. package/resources/v1/usage.mjs.map +1 -1
  144. package/resources/v1/v1.d.mts +6 -2
  145. package/resources/v1/v1.d.mts.map +1 -1
  146. package/resources/v1/v1.d.ts +6 -2
  147. package/resources/v1/v1.d.ts.map +1 -1
  148. package/resources/v1/v1.js +4 -0
  149. package/resources/v1/v1.js.map +1 -1
  150. package/resources/v1/v1.mjs +4 -0
  151. package/resources/v1/v1.mjs.map +1 -1
  152. package/src/client.ts +23 -26
  153. package/src/internal/parse.ts +6 -0
  154. package/src/internal/qs/LICENSE.md +13 -0
  155. package/src/internal/qs/README.md +3 -0
  156. package/src/internal/qs/formats.ts +10 -0
  157. package/src/internal/qs/index.ts +13 -0
  158. package/src/internal/qs/stringify.ts +385 -0
  159. package/src/internal/qs/types.ts +71 -0
  160. package/src/internal/qs/utils.ts +265 -0
  161. package/src/resources/v1/coupons.ts +57 -9
  162. package/src/resources/v1/customers/customers.ts +97 -8
  163. package/src/resources/v1/customers/index.ts +3 -0
  164. package/src/resources/v1/customers/payment-method.ts +4 -2
  165. package/src/resources/v1/customers/promotional-entitlements.ts +4 -2
  166. package/src/resources/v1/events.ts +2 -1
  167. package/src/resources/v1/index.ts +9 -0
  168. package/src/resources/v1/products.ts +162 -0
  169. package/src/resources/v1/subscriptions/future-update.ts +3 -2
  170. package/src/resources/v1/subscriptions/subscriptions.ts +218 -36
  171. package/src/resources/v1/usage.ts +3 -2
  172. package/src/resources/v1/v1.ts +22 -0
  173. package/src/version.ts +1 -1
  174. package/version.d.mts +1 -1
  175. package/version.d.ts +1 -1
  176. package/version.js +1 -1
  177. package/version.mjs +1 -1
@@ -0,0 +1,162 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../core/pagination';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+
7
+ export class Products extends APIResource {
8
+ /**
9
+ * Retrieves a paginated list of products in the environment.
10
+ */
11
+ listProducts(
12
+ query: ProductListProductsParams | null | undefined = {},
13
+ options?: RequestOptions,
14
+ ): PagePromise<ProductListProductsResponsesMyCursorIDPage, ProductListProductsResponse> {
15
+ return this._client.getAPIList('/api/v1/products', MyCursorIDPage<ProductListProductsResponse>, {
16
+ query,
17
+ ...options,
18
+ });
19
+ }
20
+ }
21
+
22
+ export type ProductListProductsResponsesMyCursorIDPage = MyCursorIDPage<ProductListProductsResponse>;
23
+
24
+ /**
25
+ * Product configuration object
26
+ */
27
+ export interface ProductListProductsResponse {
28
+ /**
29
+ * The unique identifier for the entity
30
+ */
31
+ id: string;
32
+
33
+ /**
34
+ * Timestamp of when the record was created
35
+ */
36
+ createdAt: string;
37
+
38
+ /**
39
+ * Description of the product
40
+ */
41
+ description: string | null;
42
+
43
+ /**
44
+ * Display name of the product
45
+ */
46
+ displayName: string;
47
+
48
+ /**
49
+ * Metadata associated with the entity
50
+ */
51
+ metadata: { [key: string]: string };
52
+
53
+ /**
54
+ * Indicates if multiple subscriptions to this product are allowed
55
+ */
56
+ multipleSubscriptions: boolean;
57
+
58
+ /**
59
+ * The status of the product
60
+ */
61
+ status: 'PUBLISHED' | 'ARCHIVED';
62
+
63
+ /**
64
+ * Timestamp of when the record was last updated
65
+ */
66
+ updatedAt: string;
67
+
68
+ /**
69
+ * Product behavior settings for subscription lifecycle management.
70
+ */
71
+ productSettings?: ProductListProductsResponse.ProductSettings;
72
+ }
73
+
74
+ export namespace ProductListProductsResponse {
75
+ /**
76
+ * Product behavior settings for subscription lifecycle management.
77
+ */
78
+ export interface ProductSettings {
79
+ /**
80
+ * Time when the subscription will be cancelled
81
+ */
82
+ subscriptionCancellationTime: 'END_OF_BILLING_PERIOD' | 'IMMEDIATE' | 'SPECIFIC_DATE';
83
+
84
+ /**
85
+ * Setup for the end of the subscription
86
+ */
87
+ subscriptionEndSetup: 'DOWNGRADE_TO_FREE' | 'CANCEL_SUBSCRIPTION';
88
+
89
+ /**
90
+ * Setup for the start of the subscription
91
+ */
92
+ subscriptionStartSetup: 'PLAN_SELECTION' | 'TRIAL_PERIOD' | 'FREE_PLAN';
93
+
94
+ /**
95
+ * ID of the plan to downgrade to at the end of the billing period
96
+ */
97
+ downgradePlanId?: string | null;
98
+
99
+ /**
100
+ * Indicates if the subscription should be prorated at the end of the billing
101
+ * period
102
+ */
103
+ prorateAtEndOfBillingPeriod?: boolean | null;
104
+
105
+ /**
106
+ * ID of the plan to start the subscription with
107
+ */
108
+ subscriptionStartPlanId?: string | null;
109
+ }
110
+ }
111
+
112
+ export interface ProductListProductsParams extends MyCursorIDPageParams {
113
+ /**
114
+ * Filter by entity ID
115
+ */
116
+ id?: string;
117
+
118
+ /**
119
+ * Filter by creation date using range operators: gt, gte, lt, lte
120
+ */
121
+ createdAt?: ProductListProductsParams.CreatedAt;
122
+
123
+ /**
124
+ * Filter by product status. Supports comma-separated values for multiple statuses
125
+ */
126
+ status?: string;
127
+ }
128
+
129
+ export namespace ProductListProductsParams {
130
+ /**
131
+ * Filter by creation date using range operators: gt, gte, lt, lte
132
+ */
133
+ export interface CreatedAt {
134
+ /**
135
+ * Greater than the specified createdAt value
136
+ */
137
+ gt?: string;
138
+
139
+ /**
140
+ * Greater than or equal to the specified createdAt value
141
+ */
142
+ gte?: string;
143
+
144
+ /**
145
+ * Less than the specified createdAt value
146
+ */
147
+ lt?: string;
148
+
149
+ /**
150
+ * Less than or equal to the specified createdAt value
151
+ */
152
+ lte?: string;
153
+ }
154
+ }
155
+
156
+ export declare namespace Products {
157
+ export {
158
+ type ProductListProductsResponse as ProductListProductsResponse,
159
+ type ProductListProductsResponsesMyCursorIDPage as ProductListProductsResponsesMyCursorIDPage,
160
+ type ProductListProductsParams as ProductListProductsParams,
161
+ };
162
+ }
@@ -7,14 +7,15 @@ import { path } from '../../../internal/utils/path';
7
7
 
8
8
  export class FutureUpdate extends APIResource {
9
9
  /**
10
- * Cancel pending payment update
10
+ * Cancels a subscription update that is pending payment completion.
11
11
  */
12
12
  cancelPendingPayment(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
13
13
  return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/pending-payment`, options);
14
14
  }
15
15
 
16
16
  /**
17
- * Cancel scheduled update
17
+ * Cancels a scheduled subscription update, such as a future downgrade or plan
18
+ * change.
18
19
  */
19
20
  cancelSchedule(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
20
21
  return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/schedule`, options);
@@ -12,21 +12,24 @@ export class Subscriptions extends APIResource {
12
12
  futureUpdate: FutureUpdateAPI.FutureUpdate = new FutureUpdateAPI.FutureUpdate(this._client);
13
13
 
14
14
  /**
15
- * Get a single subscription by ID
15
+ * Retrieves a subscription by its unique identifier, including plan details,
16
+ * billing period, status, and add-ons.
16
17
  */
17
18
  retrieve(id: string, options?: RequestOptions): APIPromise<Subscription> {
18
19
  return this._client.get(path`/api/v1/subscriptions/${id}`, options);
19
20
  }
20
21
 
21
22
  /**
22
- * Update a subscription
23
+ * Updates an active subscription's properties including billing period, add-ons,
24
+ * unit quantities, and discounts.
23
25
  */
24
26
  update(id: string, body: SubscriptionUpdateParams, options?: RequestOptions): APIPromise<Subscription> {
25
27
  return this._client.patch(path`/api/v1/subscriptions/${id}`, { body, ...options });
26
28
  }
27
29
 
28
30
  /**
29
- * Get a list of subscriptions
31
+ * Retrieves a paginated list of subscriptions, with optional filters for customer,
32
+ * status, and plan.
30
33
  */
31
34
  list(
32
35
  query: SubscriptionListParams | null | undefined = {},
@@ -39,35 +42,40 @@ export class Subscriptions extends APIResource {
39
42
  }
40
43
 
41
44
  /**
42
- * Cancel subscription
45
+ * Cancels an active subscription, either immediately or at a specified time such
46
+ * as end of billing period.
43
47
  */
44
48
  cancel(id: string, body: SubscriptionCancelParams, options?: RequestOptions): APIPromise<Subscription> {
45
49
  return this._client.post(path`/api/v1/subscriptions/${id}/cancel`, { body, ...options });
46
50
  }
47
51
 
48
52
  /**
49
- * Delegate subscription payment to customer
53
+ * Delegates the payment responsibility of a subscription to a different customer.
54
+ * The delegated customer will be billed for this subscription.
50
55
  */
51
56
  delegate(id: string, body: SubscriptionDelegateParams, options?: RequestOptions): APIPromise<Subscription> {
52
57
  return this._client.post(path`/api/v1/subscriptions/${id}/delegate`, { body, ...options });
53
58
  }
54
59
 
55
60
  /**
56
- * Bulk import subscriptions
61
+ * Imports multiple subscriptions in bulk. Used for migrating subscription data
62
+ * from external systems.
57
63
  */
58
64
  import(body: SubscriptionImportParams, options?: RequestOptions): APIPromise<SubscriptionImportResponse> {
59
65
  return this._client.post('/api/v1/subscriptions/import', { body, ...options });
60
66
  }
61
67
 
62
68
  /**
63
- * Migrate subscription to latest plan version
69
+ * Migrates a subscription to the latest published version of its plan or add-ons.
70
+ * Handles prorated charges or credits automatically.
64
71
  */
65
72
  migrate(id: string, body: SubscriptionMigrateParams, options?: RequestOptions): APIPromise<Subscription> {
66
73
  return this._client.post(path`/api/v1/subscriptions/${id}/migrate`, { body, ...options });
67
74
  }
68
75
 
69
76
  /**
70
- * Preview subscription
77
+ * Previews the pricing impact of creating or updating a subscription without
78
+ * making changes. Returns estimated costs, taxes, and proration details.
71
79
  */
72
80
  preview(
73
81
  body: SubscriptionPreviewParams,
@@ -77,7 +85,8 @@ export class Subscriptions extends APIResource {
77
85
  }
78
86
 
79
87
  /**
80
- * Provision subscription
88
+ * Creates a new subscription for an existing customer. When payment is required
89
+ * and no payment method exists, returns a checkout URL.
81
90
  */
82
91
  provision(
83
92
  body: SubscriptionProvisionParams,
@@ -87,7 +96,8 @@ export class Subscriptions extends APIResource {
87
96
  }
88
97
 
89
98
  /**
90
- * Transfer subscription to resource
99
+ * Transfers a subscription to a different resource ID. Used for multi-resource
100
+ * products where subscriptions apply to specific entities like websites or apps.
91
101
  */
92
102
  transfer(id: string, body: SubscriptionTransferParams, options?: RequestOptions): APIPromise<Subscription> {
93
103
  return this._client.post(path`/api/v1/subscriptions/${id}/transfer`, { body, ...options });
@@ -777,80 +787,184 @@ export namespace SubscriptionProvisionResponse {
777
787
  */
778
788
  id: string;
779
789
 
780
- entitlements: Array<Data.Entitlement>;
790
+ entitlements: Array<Data.UnionMember0 | Data.UnionMember1> | null;
781
791
 
782
792
  /**
783
793
  * Provision status: SUCCESS or PAYMENT_REQUIRED
784
794
  */
785
795
  status: 'SUCCESS' | 'PAYMENT_REQUIRED';
786
796
 
797
+ /**
798
+ * Created subscription (when status is SUCCESS)
799
+ */
800
+ subscription: Data.Subscription | null;
801
+
787
802
  /**
788
803
  * Checkout billing ID when payment is required
789
804
  */
790
- checkoutBillingId?: string | null;
805
+ checkoutBillingId?: string;
791
806
 
792
807
  /**
793
808
  * URL to complete payment when PAYMENT_REQUIRED
794
809
  */
795
- checkoutUrl?: string | null;
810
+ checkoutUrl?: string;
796
811
 
797
812
  /**
798
813
  * Whether the subscription is scheduled for future activation
799
814
  */
800
815
  isScheduled?: boolean;
801
-
802
- /**
803
- * Created subscription (when status is SUCCESS)
804
- */
805
- subscription?: Data.Subscription;
806
816
  }
807
817
 
808
818
  export namespace Data {
809
- export interface Entitlement {
810
- accessDeniedReason?: string | null;
819
+ export interface UnionMember0 {
820
+ accessDeniedReason:
821
+ | 'FeatureNotFound'
822
+ | 'CustomerNotFound'
823
+ | 'CustomerIsArchived'
824
+ | 'CustomerResourceNotFound'
825
+ | 'NoActiveSubscription'
826
+ | 'NoFeatureEntitlementInSubscription'
827
+ | 'RequestedUsageExceedingLimit'
828
+ | 'RequestedValuesMismatch'
829
+ | 'BudgetExceeded'
830
+ | 'Unknown'
831
+ | 'FeatureTypeMismatch'
832
+ | 'Revoked'
833
+ | 'InsufficientCredits'
834
+ | 'EntitlementNotFound'
835
+ | null;
836
+
837
+ isGranted: boolean;
838
+
839
+ type: 'FEATURE';
811
840
 
812
841
  currentUsage?: number;
813
842
 
814
843
  /**
815
- * entitlement updated at
844
+ * Timestamp of the last update to the entitlement grant or configuration.
816
845
  */
817
- entitlementUpdatedAt?: string | null;
818
-
819
- feature?: Entitlement.Feature | null;
846
+ entitlementUpdatedAt?: string;
820
847
 
821
- hasUnlimitedUsage?: boolean | null;
848
+ feature?: UnionMember0.Feature;
822
849
 
823
- isGranted?: boolean;
850
+ hasUnlimitedUsage?: boolean;
824
851
 
825
852
  resetPeriod?: 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | null;
826
853
 
827
854
  usageLimit?: number | null;
828
855
 
829
856
  /**
830
- * usage period anchor
857
+ * The anchor for calculating the usage period for metered entitlements with a
858
+ * reset period configured
831
859
  */
832
- usagePeriodAnchor?: string | null;
860
+ usagePeriodAnchor?: string;
833
861
 
834
862
  /**
835
- * usage period end
863
+ * The end date of the usage period for metered entitlements with a reset period
864
+ * configured
836
865
  */
837
- usagePeriodEnd?: string | null;
866
+ usagePeriodEnd?: string;
838
867
 
839
868
  /**
840
- * usage period start
869
+ * The start date of the usage period for metered entitlements with a reset period
870
+ * configured
841
871
  */
842
- usagePeriodStart?: string | null;
872
+ usagePeriodStart?: string;
873
+
874
+ /**
875
+ * The next time the entitlement should be recalculated
876
+ */
877
+ validUntil?: string;
843
878
  }
844
879
 
845
- export namespace Entitlement {
880
+ export namespace UnionMember0 {
846
881
  export interface Feature {
847
882
  /**
848
- * Feature ID
883
+ * The human-readable name of the entitlement, shown in UI elements.
884
+ */
885
+ displayName: string;
886
+
887
+ /**
888
+ * The current status of the feature.
889
+ */
890
+ featureStatus: 'NEW' | 'SUSPENDED' | 'ACTIVE';
891
+
892
+ /**
893
+ * The type of feature associated with the entitlement.
894
+ */
895
+ featureType: 'BOOLEAN' | 'NUMBER' | 'ENUM';
896
+
897
+ /**
898
+ * The unique reference ID of the entitlement.
849
899
  */
850
900
  refId: string;
851
901
  }
852
902
  }
853
903
 
904
+ export interface UnionMember1 {
905
+ accessDeniedReason:
906
+ | 'FeatureNotFound'
907
+ | 'CustomerNotFound'
908
+ | 'CustomerIsArchived'
909
+ | 'CustomerResourceNotFound'
910
+ | 'NoActiveSubscription'
911
+ | 'NoFeatureEntitlementInSubscription'
912
+ | 'RequestedUsageExceedingLimit'
913
+ | 'RequestedValuesMismatch'
914
+ | 'BudgetExceeded'
915
+ | 'Unknown'
916
+ | 'FeatureTypeMismatch'
917
+ | 'Revoked'
918
+ | 'InsufficientCredits'
919
+ | 'EntitlementNotFound'
920
+ | null;
921
+
922
+ /**
923
+ * The currency associated with a credit entitlement.
924
+ */
925
+ currency: UnionMember1.Currency;
926
+
927
+ currentUsage: number;
928
+
929
+ isGranted: boolean;
930
+
931
+ type: 'CREDIT';
932
+
933
+ usageLimit: number;
934
+
935
+ /**
936
+ * Timestamp of the last update to the credit usage.
937
+ */
938
+ usageUpdatedAt: string;
939
+
940
+ /**
941
+ * Timestamp of the last update to the entitlement grant or configuration.
942
+ */
943
+ entitlementUpdatedAt?: string;
944
+
945
+ /**
946
+ * The end date of the current billing period for recurring credit grants.
947
+ */
948
+ usagePeriodEnd?: string;
949
+
950
+ /**
951
+ * The next time the entitlement should be recalculated
952
+ */
953
+ validUntil?: string;
954
+ }
955
+
956
+ export namespace UnionMember1 {
957
+ /**
958
+ * The currency associated with a credit entitlement.
959
+ */
960
+ export interface Currency {
961
+ /**
962
+ * The unique identifier of the custom currency.
963
+ */
964
+ currencyId: string;
965
+ }
966
+ }
967
+
854
968
  /**
855
969
  * Created subscription (when status is SUCCESS)
856
970
  */
@@ -1859,10 +1973,25 @@ export namespace SubscriptionUpdateParams {
1859
1973
  }
1860
1974
 
1861
1975
  export interface PriceOverride {
1976
+ /**
1977
+ * Addon ID
1978
+ */
1979
+ addonId?: string;
1980
+
1981
+ /**
1982
+ * Whether this is a base charge override
1983
+ */
1984
+ baseCharge?: boolean;
1985
+
1986
+ /**
1987
+ * The corresponding custom currency id of the recurring credits price
1988
+ */
1989
+ currencyId?: string;
1990
+
1862
1991
  /**
1863
1992
  * Feature ID
1864
1993
  */
1865
- featureId: string;
1994
+ featureId?: string;
1866
1995
 
1867
1996
  price?: PriceOverride.Price;
1868
1997
  }
@@ -2035,17 +2164,65 @@ export namespace SubscriptionUpdateParams {
2035
2164
  }
2036
2165
 
2037
2166
  export interface SubscriptionListParams extends MyCursorIDPageParams {
2167
+ /**
2168
+ * Filter by creation date using range operators: gt, gte, lt, lte
2169
+ */
2170
+ createdAt?: SubscriptionListParams.CreatedAt;
2171
+
2038
2172
  /**
2039
2173
  * Filter by customer ID
2040
2174
  */
2041
2175
  customerId?: string;
2042
2176
 
2043
2177
  /**
2044
- * Filter by status (comma-separated)
2178
+ * Filter by plan ID
2179
+ */
2180
+ planId?: string;
2181
+
2182
+ /**
2183
+ * Filter by pricing type. Supports comma-separated values for multiple types
2184
+ */
2185
+ pricingType?: string;
2186
+
2187
+ /**
2188
+ * Filter by resource ID
2189
+ */
2190
+ resourceId?: string;
2191
+
2192
+ /**
2193
+ * Filter by subscription status. Supports comma-separated values for multiple
2194
+ * statuses
2045
2195
  */
2046
2196
  status?: string;
2047
2197
  }
2048
2198
 
2199
+ export namespace SubscriptionListParams {
2200
+ /**
2201
+ * Filter by creation date using range operators: gt, gte, lt, lte
2202
+ */
2203
+ export interface CreatedAt {
2204
+ /**
2205
+ * Greater than the specified createdAt value
2206
+ */
2207
+ gt?: string;
2208
+
2209
+ /**
2210
+ * Greater than or equal to the specified createdAt value
2211
+ */
2212
+ gte?: string;
2213
+
2214
+ /**
2215
+ * Less than the specified createdAt value
2216
+ */
2217
+ lt?: string;
2218
+
2219
+ /**
2220
+ * Less than or equal to the specified createdAt value
2221
+ */
2222
+ lte?: string;
2223
+ }
2224
+ }
2225
+
2049
2226
  export interface SubscriptionCancelParams {
2050
2227
  /**
2051
2228
  * Action on cancellation (downgrade or revoke)
@@ -2082,6 +2259,11 @@ export interface SubscriptionImportParams {
2082
2259
  * List of subscription objects to import
2083
2260
  */
2084
2261
  subscriptions: Array<SubscriptionImportParams.Subscription>;
2262
+
2263
+ /**
2264
+ * Integration ID to use for importing subscriptions
2265
+ */
2266
+ integrationId?: string | null;
2085
2267
  }
2086
2268
 
2087
2269
  export namespace SubscriptionImportParams {
@@ -7,7 +7,7 @@ import { path } from '../../internal/utils/path';
7
7
 
8
8
  export class Usage extends APIResource {
9
9
  /**
10
- * Get usage history
10
+ * Retrieves historical usage data for a customer's metered feature over time.
11
11
  */
12
12
  history(
13
13
  featureID: string,
@@ -19,7 +19,8 @@ export class Usage extends APIResource {
19
19
  }
20
20
 
21
21
  /**
22
- * Report usage measurements
22
+ * Reports usage measurements for metered features. The reported usage is used to
23
+ * track, limit, and bill customer consumption.
23
24
  */
24
25
  report(body: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse> {
25
26
  return this._client.post('/api/v1/usage', { body, ...options });
@@ -12,6 +12,13 @@ import {
12
12
  } from './coupons';
13
13
  import * as EventsAPI from './events';
14
14
  import { EventReportParams, EventReportResponse, Events } from './events';
15
+ import * as ProductsAPI from './products';
16
+ import {
17
+ ProductListProductsParams,
18
+ ProductListProductsResponse,
19
+ ProductListProductsResponsesMyCursorIDPage,
20
+ Products,
21
+ } from './products';
15
22
  import * as UsageAPI from './usage';
16
23
  import {
17
24
  Usage,
@@ -25,6 +32,9 @@ import {
25
32
  CustomerImportParams,
26
33
  CustomerImportResponse,
27
34
  CustomerListParams,
35
+ CustomerListResourcesParams,
36
+ CustomerListResourcesResponse,
37
+ CustomerListResourcesResponsesMyCursorIDPage,
28
38
  CustomerListResponse,
29
39
  CustomerListResponsesMyCursorIDPage,
30
40
  CustomerProvisionParams,
@@ -58,6 +68,7 @@ export class V1 extends APIResource {
58
68
  coupons: CouponsAPI.Coupons = new CouponsAPI.Coupons(this._client);
59
69
  events: EventsAPI.Events = new EventsAPI.Events(this._client);
60
70
  usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
71
+ products: ProductsAPI.Products = new ProductsAPI.Products(this._client);
61
72
  }
62
73
 
63
74
  V1.Customers = Customers;
@@ -65,6 +76,7 @@ V1.Subscriptions = Subscriptions;
65
76
  V1.Coupons = Coupons;
66
77
  V1.Events = Events;
67
78
  V1.Usage = Usage;
79
+ V1.Products = Products;
68
80
 
69
81
  export declare namespace V1 {
70
82
  export {
@@ -72,10 +84,13 @@ export declare namespace V1 {
72
84
  type CustomerResponse as CustomerResponse,
73
85
  type CustomerListResponse as CustomerListResponse,
74
86
  type CustomerImportResponse as CustomerImportResponse,
87
+ type CustomerListResourcesResponse as CustomerListResourcesResponse,
75
88
  type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage,
89
+ type CustomerListResourcesResponsesMyCursorIDPage as CustomerListResourcesResponsesMyCursorIDPage,
76
90
  type CustomerUpdateParams as CustomerUpdateParams,
77
91
  type CustomerListParams as CustomerListParams,
78
92
  type CustomerImportParams as CustomerImportParams,
93
+ type CustomerListResourcesParams as CustomerListResourcesParams,
79
94
  type CustomerProvisionParams as CustomerProvisionParams,
80
95
  };
81
96
 
@@ -120,4 +135,11 @@ export declare namespace V1 {
120
135
  type UsageHistoryParams as UsageHistoryParams,
121
136
  type UsageReportParams as UsageReportParams,
122
137
  };
138
+
139
+ export {
140
+ Products as Products,
141
+ type ProductListProductsResponse as ProductListProductsResponse,
142
+ type ProductListProductsResponsesMyCursorIDPage as ProductListProductsResponsesMyCursorIDPage,
143
+ type ProductListProductsParams as ProductListProductsParams,
144
+ };
123
145
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-alpha.4'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.7'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.4";
1
+ export declare const VERSION = "0.1.0-alpha.7";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.4";
1
+ export declare const VERSION = "0.1.0-alpha.7";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0-alpha.4'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-alpha.7'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-alpha.4'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.7'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map