@usehercules/sdk 1.2.0 → 1.3.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.
Files changed (197) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +14 -20
  3. package/client.d.mts +6 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +1 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs +1 -1
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/beta/beta.d.mts +4 -4
  13. package/resources/beta/beta.d.mts.map +1 -1
  14. package/resources/beta/beta.d.ts +4 -4
  15. package/resources/beta/beta.d.ts.map +1 -1
  16. package/resources/beta/beta.js +4 -4
  17. package/resources/beta/beta.js.map +1 -1
  18. package/resources/beta/beta.mjs +4 -4
  19. package/resources/beta/beta.mjs.map +1 -1
  20. package/resources/beta/index.d.mts +1 -1
  21. package/resources/beta/index.d.mts.map +1 -1
  22. package/resources/beta/index.d.ts +1 -1
  23. package/resources/beta/index.d.ts.map +1 -1
  24. package/resources/beta/index.js +3 -3
  25. package/resources/beta/index.js.map +1 -1
  26. package/resources/beta/index.mjs +1 -1
  27. package/resources/beta/index.mjs.map +1 -1
  28. package/resources/beta/pay/coupons.d.mts +156 -0
  29. package/resources/beta/pay/coupons.d.mts.map +1 -0
  30. package/resources/beta/pay/coupons.d.ts +156 -0
  31. package/resources/beta/pay/coupons.d.ts.map +1 -0
  32. package/resources/beta/pay/coupons.js +51 -0
  33. package/resources/beta/pay/coupons.js.map +1 -0
  34. package/resources/beta/pay/coupons.mjs +47 -0
  35. package/resources/beta/pay/coupons.mjs.map +1 -0
  36. package/resources/beta/pay/customers.d.mts +160 -0
  37. package/resources/beta/pay/customers.d.mts.map +1 -0
  38. package/resources/beta/pay/customers.d.ts +160 -0
  39. package/resources/beta/pay/customers.d.ts.map +1 -0
  40. package/resources/beta/pay/customers.js +60 -0
  41. package/resources/beta/pay/customers.js.map +1 -0
  42. package/resources/beta/pay/customers.mjs +56 -0
  43. package/resources/beta/pay/customers.mjs.map +1 -0
  44. package/resources/beta/pay/entitlements.d.mts +94 -0
  45. package/resources/beta/pay/entitlements.d.mts.map +1 -0
  46. package/resources/beta/pay/entitlements.d.ts +94 -0
  47. package/resources/beta/pay/entitlements.d.ts.map +1 -0
  48. package/resources/beta/pay/entitlements.js +42 -0
  49. package/resources/beta/pay/entitlements.js.map +1 -0
  50. package/resources/beta/pay/entitlements.mjs +38 -0
  51. package/resources/beta/pay/entitlements.mjs.map +1 -0
  52. package/resources/beta/{subscriptions → pay}/index.d.mts +2 -2
  53. package/resources/beta/pay/index.d.mts.map +1 -0
  54. package/resources/beta/{subscriptions → pay}/index.d.ts +2 -2
  55. package/resources/beta/pay/index.d.ts.map +1 -0
  56. package/resources/beta/{subscriptions → pay}/index.js +5 -5
  57. package/resources/beta/pay/index.js.map +1 -0
  58. package/resources/beta/{subscriptions → pay}/index.mjs +2 -2
  59. package/resources/beta/pay/index.mjs.map +1 -0
  60. package/resources/beta/{subscriptions/subscriptions.d.mts → pay/pay.d.mts} +46 -30
  61. package/resources/beta/pay/pay.d.mts.map +1 -0
  62. package/resources/beta/{subscriptions/subscriptions.d.ts → pay/pay.d.ts} +46 -30
  63. package/resources/beta/pay/pay.d.ts.map +1 -0
  64. package/resources/beta/pay/pay.js +54 -0
  65. package/resources/beta/pay/pay.js.map +1 -0
  66. package/resources/beta/pay/pay.mjs +49 -0
  67. package/resources/beta/pay/pay.mjs.map +1 -0
  68. package/resources/beta/pay/products/entitlements.d.mts +53 -0
  69. package/resources/beta/pay/products/entitlements.d.mts.map +1 -0
  70. package/resources/beta/pay/products/entitlements.d.ts +53 -0
  71. package/resources/beta/pay/products/entitlements.d.ts.map +1 -0
  72. package/resources/beta/pay/products/entitlements.js +38 -0
  73. package/resources/beta/pay/products/entitlements.js.map +1 -0
  74. package/resources/beta/pay/products/entitlements.mjs +34 -0
  75. package/resources/beta/pay/products/entitlements.mjs.map +1 -0
  76. package/resources/beta/pay/products/index.d.mts +3 -0
  77. package/resources/beta/pay/products/index.d.mts.map +1 -0
  78. package/resources/beta/pay/products/index.d.ts +3 -0
  79. package/resources/beta/pay/products/index.d.ts.map +1 -0
  80. package/resources/beta/{subscriptions/plans → pay/products}/index.js +3 -3
  81. package/resources/beta/pay/products/index.js.map +1 -0
  82. package/resources/beta/{subscriptions/plans → pay/products}/index.mjs +1 -1
  83. package/resources/beta/pay/products/index.mjs.map +1 -0
  84. package/resources/beta/pay/products/products.d.mts +152 -0
  85. package/resources/beta/pay/products/products.d.mts.map +1 -0
  86. package/resources/beta/pay/products/products.d.ts +152 -0
  87. package/resources/beta/pay/products/products.d.ts.map +1 -0
  88. package/resources/beta/pay/products/products.js +57 -0
  89. package/resources/beta/pay/products/products.js.map +1 -0
  90. package/resources/beta/pay/products/products.mjs +52 -0
  91. package/resources/beta/pay/products/products.mjs.map +1 -0
  92. package/resources/beta/pay/products.d.mts +2 -0
  93. package/resources/beta/pay/products.d.mts.map +1 -0
  94. package/resources/beta/pay/products.d.ts +2 -0
  95. package/resources/beta/pay/products.d.ts.map +1 -0
  96. package/resources/beta/{subscriptions/plans.js → pay/products.js} +2 -2
  97. package/resources/beta/pay/products.js.map +1 -0
  98. package/resources/beta/{subscriptions.mjs → pay/products.mjs} +2 -2
  99. package/resources/beta/pay/products.mjs.map +1 -0
  100. package/resources/beta/pay.d.mts +2 -0
  101. package/resources/beta/pay.d.mts.map +1 -0
  102. package/resources/beta/pay.d.ts +2 -0
  103. package/resources/beta/pay.d.ts.map +1 -0
  104. package/resources/beta/{subscriptions.js → pay.js} +2 -2
  105. package/resources/beta/pay.js.map +1 -0
  106. package/resources/beta/{subscriptions/plans.mjs → pay.mjs} +2 -2
  107. package/resources/beta/pay.mjs.map +1 -0
  108. package/src/client.ts +6 -4
  109. package/src/resources/beta/beta.ts +18 -18
  110. package/src/resources/beta/index.ts +8 -8
  111. package/src/resources/beta/pay/coupons.ts +218 -0
  112. package/src/resources/beta/pay/customers.ts +229 -0
  113. package/src/resources/beta/pay/entitlements.ts +135 -0
  114. package/src/resources/beta/{subscriptions → pay}/index.ts +15 -15
  115. package/src/resources/beta/{subscriptions/subscriptions.ts → pay/pay.ts} +70 -55
  116. package/src/resources/beta/{subscriptions/plans → pay/products}/entitlements.ts +26 -21
  117. package/src/resources/beta/{subscriptions/plans → pay/products}/index.ts +9 -9
  118. package/src/resources/beta/pay/products/products.ts +224 -0
  119. package/src/resources/beta/{subscriptions.ts → pay/products.ts} +1 -1
  120. package/src/resources/beta/{subscriptions/plans.ts → pay.ts} +1 -1
  121. package/src/version.ts +1 -1
  122. package/version.d.mts +1 -1
  123. package/version.d.ts +1 -1
  124. package/version.js +1 -1
  125. package/version.mjs +1 -1
  126. package/resources/beta/subscriptions/coupons.d.mts +0 -124
  127. package/resources/beta/subscriptions/coupons.d.mts.map +0 -1
  128. package/resources/beta/subscriptions/coupons.d.ts +0 -124
  129. package/resources/beta/subscriptions/coupons.d.ts.map +0 -1
  130. package/resources/beta/subscriptions/coupons.js +0 -45
  131. package/resources/beta/subscriptions/coupons.js.map +0 -1
  132. package/resources/beta/subscriptions/coupons.mjs +0 -41
  133. package/resources/beta/subscriptions/coupons.mjs.map +0 -1
  134. package/resources/beta/subscriptions/customers.d.mts +0 -93
  135. package/resources/beta/subscriptions/customers.d.mts.map +0 -1
  136. package/resources/beta/subscriptions/customers.d.ts +0 -93
  137. package/resources/beta/subscriptions/customers.d.ts.map +0 -1
  138. package/resources/beta/subscriptions/customers.js +0 -57
  139. package/resources/beta/subscriptions/customers.js.map +0 -1
  140. package/resources/beta/subscriptions/customers.mjs +0 -53
  141. package/resources/beta/subscriptions/customers.mjs.map +0 -1
  142. package/resources/beta/subscriptions/entitlements.d.mts +0 -70
  143. package/resources/beta/subscriptions/entitlements.d.mts.map +0 -1
  144. package/resources/beta/subscriptions/entitlements.d.ts +0 -70
  145. package/resources/beta/subscriptions/entitlements.d.ts.map +0 -1
  146. package/resources/beta/subscriptions/entitlements.js +0 -38
  147. package/resources/beta/subscriptions/entitlements.js.map +0 -1
  148. package/resources/beta/subscriptions/entitlements.mjs +0 -34
  149. package/resources/beta/subscriptions/entitlements.mjs.map +0 -1
  150. package/resources/beta/subscriptions/index.d.mts.map +0 -1
  151. package/resources/beta/subscriptions/index.d.ts.map +0 -1
  152. package/resources/beta/subscriptions/index.js.map +0 -1
  153. package/resources/beta/subscriptions/index.mjs.map +0 -1
  154. package/resources/beta/subscriptions/plans/entitlements.d.mts +0 -48
  155. package/resources/beta/subscriptions/plans/entitlements.d.mts.map +0 -1
  156. package/resources/beta/subscriptions/plans/entitlements.d.ts +0 -48
  157. package/resources/beta/subscriptions/plans/entitlements.d.ts.map +0 -1
  158. package/resources/beta/subscriptions/plans/entitlements.js +0 -34
  159. package/resources/beta/subscriptions/plans/entitlements.js.map +0 -1
  160. package/resources/beta/subscriptions/plans/entitlements.mjs +0 -30
  161. package/resources/beta/subscriptions/plans/entitlements.mjs.map +0 -1
  162. package/resources/beta/subscriptions/plans/index.d.mts +0 -3
  163. package/resources/beta/subscriptions/plans/index.d.mts.map +0 -1
  164. package/resources/beta/subscriptions/plans/index.d.ts +0 -3
  165. package/resources/beta/subscriptions/plans/index.d.ts.map +0 -1
  166. package/resources/beta/subscriptions/plans/index.js.map +0 -1
  167. package/resources/beta/subscriptions/plans/index.mjs.map +0 -1
  168. package/resources/beta/subscriptions/plans/plans.d.mts +0 -87
  169. package/resources/beta/subscriptions/plans/plans.d.mts.map +0 -1
  170. package/resources/beta/subscriptions/plans/plans.d.ts +0 -87
  171. package/resources/beta/subscriptions/plans/plans.d.ts.map +0 -1
  172. package/resources/beta/subscriptions/plans/plans.js +0 -49
  173. package/resources/beta/subscriptions/plans/plans.js.map +0 -1
  174. package/resources/beta/subscriptions/plans/plans.mjs +0 -44
  175. package/resources/beta/subscriptions/plans/plans.mjs.map +0 -1
  176. package/resources/beta/subscriptions/plans.d.mts +0 -2
  177. package/resources/beta/subscriptions/plans.d.mts.map +0 -1
  178. package/resources/beta/subscriptions/plans.d.ts +0 -2
  179. package/resources/beta/subscriptions/plans.d.ts.map +0 -1
  180. package/resources/beta/subscriptions/plans.js.map +0 -1
  181. package/resources/beta/subscriptions/plans.mjs.map +0 -1
  182. package/resources/beta/subscriptions/subscriptions.d.mts.map +0 -1
  183. package/resources/beta/subscriptions/subscriptions.d.ts.map +0 -1
  184. package/resources/beta/subscriptions/subscriptions.js +0 -47
  185. package/resources/beta/subscriptions/subscriptions.js.map +0 -1
  186. package/resources/beta/subscriptions/subscriptions.mjs +0 -42
  187. package/resources/beta/subscriptions/subscriptions.mjs.map +0 -1
  188. package/resources/beta/subscriptions.d.mts +0 -2
  189. package/resources/beta/subscriptions.d.mts.map +0 -1
  190. package/resources/beta/subscriptions.d.ts +0 -2
  191. package/resources/beta/subscriptions.d.ts.map +0 -1
  192. package/resources/beta/subscriptions.js.map +0 -1
  193. package/resources/beta/subscriptions.mjs.map +0 -1
  194. package/src/resources/beta/subscriptions/coupons.ts +0 -185
  195. package/src/resources/beta/subscriptions/customers.ts +0 -168
  196. package/src/resources/beta/subscriptions/entitlements.ts +0 -113
  197. package/src/resources/beta/subscriptions/plans/plans.ts +0 -159
@@ -10,56 +10,61 @@ import { path } from '../../../../internal/utils/path';
10
10
 
11
11
  export class Entitlements extends APIResource {
12
12
  /**
13
- * List Plan Entitlements
13
+ * Retrieves all entitlements attached to a product. These entitlements define the
14
+ * features that customers subscribed to this product can access.
14
15
  */
15
16
  list(
16
- planID: string,
17
+ productID: string,
17
18
  query: EntitlementListParams | null | undefined = {},
18
19
  options?: RequestOptions,
19
- ): PagePromise<PlanEntitlementsCursorIDPage, PlanEntitlement> {
20
+ ): PagePromise<ProductEntitlementsCursorIDPage, ProductEntitlement> {
20
21
  return this._client.getAPIList(
21
- path`/v1/subscriptions/plans/${planID}/entitlements`,
22
- CursorIDPage<PlanEntitlement>,
22
+ path`/v1/pay/products/${productID}/entitlements`,
23
+ CursorIDPage<ProductEntitlement>,
23
24
  { query, ...options },
24
25
  );
25
26
  }
26
27
 
27
28
  /**
28
- * Attach Entitlement to Plan
29
+ * Attaches an entitlement to a product. All customers subscribed to this product
30
+ * will gain access to the attached feature. Hercules recommends attaching
31
+ * entitlements when creating or updating products to keep feature access in sync.
29
32
  */
30
33
  attach(
31
- planID: string,
34
+ productID: string,
32
35
  body: EntitlementAttachParams,
33
36
  options?: RequestOptions,
34
- ): APIPromise<PlanEntitlement> {
35
- return this._client.post(path`/v1/subscriptions/plans/${planID}/entitlements`, { body, ...options });
37
+ ): APIPromise<ProductEntitlement> {
38
+ return this._client.post(path`/v1/pay/products/${productID}/entitlements`, { body, ...options });
36
39
  }
37
40
 
38
41
  /**
39
- * Remove Entitlement from Plan
42
+ * Removes an entitlement from a product. Customers subscribed to this product will
43
+ * lose access to the feature. Existing subscriptions are affected immediately.
40
44
  */
41
45
  remove(featureID: string, params: EntitlementRemoveParams, options?: RequestOptions): APIPromise<void> {
42
- const { plan_id } = params;
43
- return this._client.delete(path`/v1/subscriptions/plans/${plan_id}/entitlements/${featureID}`, {
46
+ const { product_id } = params;
47
+ return this._client.delete(path`/v1/pay/products/${product_id}/entitlements/${featureID}`, {
44
48
  ...options,
45
49
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
46
50
  });
47
51
  }
48
52
  }
49
53
 
50
- export type PlanEntitlementsCursorIDPage = CursorIDPage<PlanEntitlement>;
54
+ export type ProductEntitlementsCursorIDPage = CursorIDPage<ProductEntitlement>;
51
55
 
52
56
  /**
53
- * An entitlement attached to a plan
57
+ * An entitlement attached to a product. All customers subscribed to the product
58
+ * gain access to this entitlement.
54
59
  */
55
- export interface PlanEntitlement {
60
+ export interface ProductEntitlement {
56
61
  /**
57
- * An id for a data item
62
+ * Unique identifier for the entitlement
58
63
  */
59
64
  id: string;
60
65
 
61
66
  /**
62
- * An entitlement that can be attached to products
67
+ * The entitlement attached to the product
63
68
  */
64
69
  entitlement: EntitlementsAPI.Entitlement;
65
70
  }
@@ -68,19 +73,19 @@ export interface EntitlementListParams extends CursorIDPageParams {}
68
73
 
69
74
  export interface EntitlementAttachParams {
70
75
  /**
71
- * The ID of the entitlement to attach
76
+ * The ID of the entitlement to attach to the product
72
77
  */
73
78
  entitlement: string;
74
79
  }
75
80
 
76
81
  export interface EntitlementRemoveParams {
77
- plan_id: string;
82
+ product_id: string;
78
83
  }
79
84
 
80
85
  export declare namespace Entitlements {
81
86
  export {
82
- type PlanEntitlement as PlanEntitlement,
83
- type PlanEntitlementsCursorIDPage as PlanEntitlementsCursorIDPage,
87
+ type ProductEntitlement as ProductEntitlement,
88
+ type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage,
84
89
  type EntitlementListParams as EntitlementListParams,
85
90
  type EntitlementAttachParams as EntitlementAttachParams,
86
91
  type EntitlementRemoveParams as EntitlementRemoveParams,
@@ -2,17 +2,17 @@
2
2
 
3
3
  export {
4
4
  Entitlements,
5
- type PlanEntitlement,
5
+ type ProductEntitlement,
6
6
  type EntitlementListParams,
7
7
  type EntitlementAttachParams,
8
8
  type EntitlementRemoveParams,
9
- type PlanEntitlementsCursorIDPage,
9
+ type ProductEntitlementsCursorIDPage,
10
10
  } from './entitlements';
11
11
  export {
12
- Plans,
13
- type Plan,
14
- type PlanCreateParams,
15
- type PlanUpdateParams,
16
- type PlanListParams,
17
- type PlansCursorIDPage,
18
- } from './plans';
12
+ Products,
13
+ type Product,
14
+ type ProductCreateParams,
15
+ type ProductUpdateParams,
16
+ type ProductListParams,
17
+ type ProductsCursorIDPage,
18
+ } from './products';
@@ -0,0 +1,224 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import * as EntitlementsAPI from './entitlements';
5
+ import {
6
+ EntitlementAttachParams,
7
+ EntitlementListParams,
8
+ EntitlementRemoveParams,
9
+ Entitlements,
10
+ ProductEntitlement,
11
+ ProductEntitlementsCursorIDPage,
12
+ } from './entitlements';
13
+ import { APIPromise } from '../../../../core/api-promise';
14
+ import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../../core/pagination';
15
+ import { RequestOptions } from '../../../../internal/request-options';
16
+ import { path } from '../../../../internal/utils/path';
17
+
18
+ export class Products extends APIResource {
19
+ entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
20
+
21
+ /**
22
+ * Creates a new subscription product with a recurring price. Common examples
23
+ * include Free, Pro, Business, or Teams tiers. After creating a product, attach
24
+ * entitlements to define which features customers on this product can access.
25
+ */
26
+ create(body: ProductCreateParams, options?: RequestOptions): APIPromise<Product> {
27
+ return this._client.post('/v1/pay/products', { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * Updates an existing product. Use this to modify the product name, description,
32
+ * or active status. Pricing cannot be changed after creation—create a new product
33
+ * instead.
34
+ */
35
+ update(
36
+ productID: string,
37
+ body: ProductUpdateParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): APIPromise<Product> {
40
+ return this._client.patch(path`/v1/pay/products/${productID}`, { body, ...options });
41
+ }
42
+
43
+ /**
44
+ * Retrieves a paginated list of subscription products. Products define the pricing
45
+ * and billing intervals for subscriptions. Each product can have entitlements
46
+ * attached that grant features to subscribed customers.
47
+ */
48
+ list(
49
+ query: ProductListParams | null | undefined = {},
50
+ options?: RequestOptions,
51
+ ): PagePromise<ProductsCursorIDPage, Product> {
52
+ return this._client.getAPIList('/v1/pay/products', CursorIDPage<Product>, { query, ...options });
53
+ }
54
+
55
+ /**
56
+ * Archives a product, preventing new subscriptions. Existing subscriptions remain
57
+ * active. Use this instead of deletion to preserve subscription history.
58
+ */
59
+ archive(productID: string, options?: RequestOptions): APIPromise<Product> {
60
+ return this._client.delete(path`/v1/pay/products/${productID}`, options);
61
+ }
62
+
63
+ /**
64
+ * Retrieves a product by ID. Returns the product object including pricing details
65
+ * and status.
66
+ */
67
+ get(productID: string, options?: RequestOptions): APIPromise<Product> {
68
+ return this._client.get(path`/v1/pay/products/${productID}`, options);
69
+ }
70
+ }
71
+
72
+ export type ProductsCursorIDPage = CursorIDPage<Product>;
73
+
74
+ /**
75
+ * A subscription product that customers can subscribe to. Products define pricing
76
+ * and billing intervals. Attach entitlements to a product to grant features to all
77
+ * subscribed customers.
78
+ */
79
+ export interface Product {
80
+ /**
81
+ * Unique identifier for the entitlement
82
+ */
83
+ id: string;
84
+
85
+ /**
86
+ * Whether the product is available for new subscriptions
87
+ */
88
+ active: boolean;
89
+
90
+ /**
91
+ * Timestamp when the product was created
92
+ */
93
+ created: string;
94
+
95
+ /**
96
+ * Display name for the product (e.g., Pro, Business, Teams)
97
+ */
98
+ name: string;
99
+
100
+ /**
101
+ * The recurring price configuration for a product
102
+ */
103
+ default_price?: Product.DefaultPrice | null;
104
+
105
+ /**
106
+ * Detailed description of what the product includes
107
+ */
108
+ description?: string | null;
109
+ }
110
+
111
+ export namespace Product {
112
+ /**
113
+ * The recurring price configuration for a product
114
+ */
115
+ export interface DefaultPrice {
116
+ /**
117
+ * Unique identifier for the entitlement
118
+ */
119
+ id: string;
120
+
121
+ /**
122
+ * Three-letter ISO currency code (e.g., usd, eur)
123
+ */
124
+ currency: string;
125
+
126
+ /**
127
+ * Billing frequency: day, week, month, or year
128
+ */
129
+ interval: 'day' | 'week' | 'month' | 'year';
130
+
131
+ /**
132
+ * Number of intervals between billings (e.g., 2 for biweekly)
133
+ */
134
+ interval_count: number;
135
+
136
+ /**
137
+ * Price amount in the smallest currency unit (e.g., cents)
138
+ */
139
+ unit_amount: number | null;
140
+ }
141
+ }
142
+
143
+ export interface ProductCreateParams {
144
+ /**
145
+ * Display name for the product (e.g., Pro, Business, Teams)
146
+ */
147
+ name: string;
148
+
149
+ /**
150
+ * Price amount in the smallest currency unit (e.g., cents). Use 0 for free
151
+ * products.
152
+ */
153
+ unit_amount: number;
154
+
155
+ /**
156
+ * Optional custom ID for the product. If not provided, one will be generated.
157
+ */
158
+ id?: string;
159
+
160
+ /**
161
+ * Three-letter ISO currency code
162
+ */
163
+ currency?: string;
164
+
165
+ /**
166
+ * Detailed description of what the product includes
167
+ */
168
+ description?: string;
169
+
170
+ /**
171
+ * Billing frequency: day, week, month, or year
172
+ */
173
+ interval?: 'day' | 'week' | 'month' | 'year';
174
+
175
+ /**
176
+ * Number of intervals between billings
177
+ */
178
+ interval_count?: number;
179
+ }
180
+
181
+ export interface ProductUpdateParams {
182
+ /**
183
+ * Whether the product is available for new subscriptions
184
+ */
185
+ active?: boolean;
186
+
187
+ /**
188
+ * Detailed description of what the product includes
189
+ */
190
+ description?: string;
191
+
192
+ /**
193
+ * Display name for the product
194
+ */
195
+ name?: string;
196
+ }
197
+
198
+ export interface ProductListParams extends CursorIDPageParams {
199
+ /**
200
+ * Filter by active status
201
+ */
202
+ active?: 'true' | 'false';
203
+ }
204
+
205
+ Products.Entitlements = Entitlements;
206
+
207
+ export declare namespace Products {
208
+ export {
209
+ type Product as Product,
210
+ type ProductsCursorIDPage as ProductsCursorIDPage,
211
+ type ProductCreateParams as ProductCreateParams,
212
+ type ProductUpdateParams as ProductUpdateParams,
213
+ type ProductListParams as ProductListParams,
214
+ };
215
+
216
+ export {
217
+ Entitlements as Entitlements,
218
+ type ProductEntitlement as ProductEntitlement,
219
+ type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage,
220
+ type EntitlementListParams as EntitlementListParams,
221
+ type EntitlementAttachParams as EntitlementAttachParams,
222
+ type EntitlementRemoveParams as EntitlementRemoveParams,
223
+ };
224
+ }
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './subscriptions/index';
3
+ export * from './products/index';
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './plans/index';
3
+ export * from './pay/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.3.0";
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 = '1.2.0'; // x-release-please-version
4
+ exports.VERSION = '1.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1,124 +0,0 @@
1
- import { APIResource } from "../../../core/resource.mjs";
2
- import { APIPromise } from "../../../core/api-promise.mjs";
3
- import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../core/pagination.mjs";
4
- import { RequestOptions } from "../../../internal/request-options.mjs";
5
- export declare class Coupons extends APIResource {
6
- /**
7
- * Create Coupon
8
- */
9
- create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon>;
10
- /**
11
- * Update Coupon
12
- */
13
- update(couponID: string, body?: CouponUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Coupon>;
14
- /**
15
- * List Coupons
16
- */
17
- list(query?: CouponListParams | null | undefined, options?: RequestOptions): PagePromise<CouponsCursorIDPage, Coupon>;
18
- /**
19
- * Delete Coupon
20
- */
21
- delete(couponID: string, options?: RequestOptions): APIPromise<void>;
22
- /**
23
- * Get Coupon
24
- */
25
- get(couponID: string, options?: RequestOptions): APIPromise<Coupon>;
26
- }
27
- export type CouponsCursorIDPage = CursorIDPage<Coupon>;
28
- /**
29
- * A coupon/promo code for discounts
30
- */
31
- export interface Coupon {
32
- /**
33
- * An id for a data item
34
- */
35
- id: string;
36
- active: boolean;
37
- /**
38
- * The promo code
39
- */
40
- code: string;
41
- created: string;
42
- duration: 'once' | 'repeating' | 'forever';
43
- /**
44
- * Number of times this coupon has been redeemed
45
- */
46
- times_redeemed: number;
47
- /**
48
- * Fixed amount discount in cents
49
- */
50
- amount_off?: number | null;
51
- /**
52
- * Currency for amount_off
53
- */
54
- currency?: string | null;
55
- /**
56
- * Number of months for repeating duration
57
- */
58
- duration_in_months?: number | null;
59
- /**
60
- * Maximum number of times this coupon can be redeemed
61
- */
62
- max_redemptions?: number | null;
63
- name?: string | null;
64
- /**
65
- * Percentage discount (1-100)
66
- */
67
- percent_off?: number | null;
68
- /**
69
- * Date after which the coupon can no longer be redeemed
70
- */
71
- redeem_by?: string | null;
72
- }
73
- export interface CouponCreateParams {
74
- /**
75
- * The promo code customers will enter
76
- */
77
- code: string;
78
- /**
79
- * Fixed amount discount in cents
80
- */
81
- amount_off?: number;
82
- /**
83
- * Currency for amount_off
84
- */
85
- currency?: string;
86
- duration?: 'once' | 'repeating' | 'forever';
87
- /**
88
- * Number of months for repeating duration
89
- */
90
- duration_in_months?: number;
91
- /**
92
- * Maximum number of redemptions
93
- */
94
- max_redemptions?: number;
95
- /**
96
- * Display name for the coupon
97
- */
98
- name?: string;
99
- /**
100
- * Percentage discount (1-100)
101
- */
102
- percent_off?: number;
103
- /**
104
- * Expiration date for the coupon
105
- */
106
- redeem_by?: string;
107
- }
108
- export interface CouponUpdateParams {
109
- /**
110
- * Whether the coupon is active
111
- */
112
- active?: boolean;
113
- /**
114
- * Display name for the coupon
115
- */
116
- name?: string;
117
- }
118
- export interface CouponListParams extends CursorIDPageParams {
119
- active?: boolean;
120
- }
121
- export declare namespace Coupons {
122
- export { type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
123
- }
124
- //# sourceMappingURL=coupons.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coupons.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/subscriptions/coupons.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OAEtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,kBAAkB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC;IAIrB;;OAEG;IACH,IAAI,CACF,KAAK,GAAE,gBAAgB,GAAG,IAAI,GAAG,SAAc,EAC/C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,mBAAmB,EAAE,MAAM,CAAC;IAI3C;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOpE;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;CAGpE;AAED,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,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,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -1,124 +0,0 @@
1
- import { APIResource } from "../../../core/resource.js";
2
- import { APIPromise } from "../../../core/api-promise.js";
3
- import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../core/pagination.js";
4
- import { RequestOptions } from "../../../internal/request-options.js";
5
- export declare class Coupons extends APIResource {
6
- /**
7
- * Create Coupon
8
- */
9
- create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon>;
10
- /**
11
- * Update Coupon
12
- */
13
- update(couponID: string, body?: CouponUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Coupon>;
14
- /**
15
- * List Coupons
16
- */
17
- list(query?: CouponListParams | null | undefined, options?: RequestOptions): PagePromise<CouponsCursorIDPage, Coupon>;
18
- /**
19
- * Delete Coupon
20
- */
21
- delete(couponID: string, options?: RequestOptions): APIPromise<void>;
22
- /**
23
- * Get Coupon
24
- */
25
- get(couponID: string, options?: RequestOptions): APIPromise<Coupon>;
26
- }
27
- export type CouponsCursorIDPage = CursorIDPage<Coupon>;
28
- /**
29
- * A coupon/promo code for discounts
30
- */
31
- export interface Coupon {
32
- /**
33
- * An id for a data item
34
- */
35
- id: string;
36
- active: boolean;
37
- /**
38
- * The promo code
39
- */
40
- code: string;
41
- created: string;
42
- duration: 'once' | 'repeating' | 'forever';
43
- /**
44
- * Number of times this coupon has been redeemed
45
- */
46
- times_redeemed: number;
47
- /**
48
- * Fixed amount discount in cents
49
- */
50
- amount_off?: number | null;
51
- /**
52
- * Currency for amount_off
53
- */
54
- currency?: string | null;
55
- /**
56
- * Number of months for repeating duration
57
- */
58
- duration_in_months?: number | null;
59
- /**
60
- * Maximum number of times this coupon can be redeemed
61
- */
62
- max_redemptions?: number | null;
63
- name?: string | null;
64
- /**
65
- * Percentage discount (1-100)
66
- */
67
- percent_off?: number | null;
68
- /**
69
- * Date after which the coupon can no longer be redeemed
70
- */
71
- redeem_by?: string | null;
72
- }
73
- export interface CouponCreateParams {
74
- /**
75
- * The promo code customers will enter
76
- */
77
- code: string;
78
- /**
79
- * Fixed amount discount in cents
80
- */
81
- amount_off?: number;
82
- /**
83
- * Currency for amount_off
84
- */
85
- currency?: string;
86
- duration?: 'once' | 'repeating' | 'forever';
87
- /**
88
- * Number of months for repeating duration
89
- */
90
- duration_in_months?: number;
91
- /**
92
- * Maximum number of redemptions
93
- */
94
- max_redemptions?: number;
95
- /**
96
- * Display name for the coupon
97
- */
98
- name?: string;
99
- /**
100
- * Percentage discount (1-100)
101
- */
102
- percent_off?: number;
103
- /**
104
- * Expiration date for the coupon
105
- */
106
- redeem_by?: string;
107
- }
108
- export interface CouponUpdateParams {
109
- /**
110
- * Whether the coupon is active
111
- */
112
- active?: boolean;
113
- /**
114
- * Display name for the coupon
115
- */
116
- name?: string;
117
- }
118
- export interface CouponListParams extends CursorIDPageParams {
119
- active?: boolean;
120
- }
121
- export declare namespace Coupons {
122
- export { type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
123
- }
124
- //# sourceMappingURL=coupons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coupons.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/subscriptions/coupons.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OAEtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE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