@usehercules/sdk 1.7.0 → 1.8.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 (201) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +17 -16
  3. package/package.json +1 -1
  4. package/resources/beta/beta.d.mts +4 -4
  5. package/resources/beta/beta.d.mts.map +1 -1
  6. package/resources/beta/beta.d.ts +4 -4
  7. package/resources/beta/beta.d.ts.map +1 -1
  8. package/resources/beta/beta.js +4 -4
  9. package/resources/beta/beta.js.map +1 -1
  10. package/resources/beta/beta.mjs +4 -4
  11. package/resources/beta/beta.mjs.map +1 -1
  12. package/resources/beta/commerce/commerce.d.mts +201 -0
  13. package/resources/beta/commerce/commerce.d.mts.map +1 -0
  14. package/resources/beta/commerce/commerce.d.ts +201 -0
  15. package/resources/beta/commerce/commerce.d.ts.map +1 -0
  16. package/resources/beta/{pay/pay.js → commerce/commerce.js} +10 -14
  17. package/resources/beta/commerce/commerce.js.map +1 -0
  18. package/resources/beta/{pay/pay.mjs → commerce/commerce.mjs} +8 -12
  19. package/resources/beta/commerce/commerce.mjs.map +1 -0
  20. package/resources/beta/commerce/coupons.d.mts +333 -0
  21. package/resources/beta/commerce/coupons.d.mts.map +1 -0
  22. package/resources/beta/commerce/coupons.d.ts +333 -0
  23. package/resources/beta/commerce/coupons.d.ts.map +1 -0
  24. package/resources/beta/{pay → commerce}/coupons.js +8 -5
  25. package/resources/beta/commerce/coupons.js.map +1 -0
  26. package/resources/beta/{pay → commerce}/coupons.mjs +8 -5
  27. package/resources/beta/commerce/coupons.mjs.map +1 -0
  28. package/resources/beta/commerce/customers.d.mts +407 -0
  29. package/resources/beta/commerce/customers.d.mts.map +1 -0
  30. package/resources/beta/commerce/customers.d.ts +407 -0
  31. package/resources/beta/commerce/customers.d.ts.map +1 -0
  32. package/resources/beta/{pay → commerce}/customers.js +9 -6
  33. package/resources/beta/commerce/customers.js.map +1 -0
  34. package/resources/beta/{pay → commerce}/customers.mjs +9 -6
  35. package/resources/beta/commerce/customers.mjs.map +1 -0
  36. package/resources/beta/commerce/index.d.mts +5 -0
  37. package/resources/beta/commerce/index.d.mts.map +1 -0
  38. package/resources/beta/commerce/index.d.ts +5 -0
  39. package/resources/beta/commerce/index.d.ts.map +1 -0
  40. package/resources/beta/{pay → commerce}/index.js +3 -5
  41. package/resources/beta/commerce/index.js.map +1 -0
  42. package/resources/beta/{pay → commerce}/index.mjs +1 -2
  43. package/resources/beta/commerce/index.mjs.map +1 -0
  44. package/resources/beta/commerce/products/index.d.mts +4 -0
  45. package/resources/beta/commerce/products/index.d.mts.map +1 -0
  46. package/resources/beta/commerce/products/index.d.ts +4 -0
  47. package/resources/beta/commerce/products/index.d.ts.map +1 -0
  48. package/resources/beta/{pay → commerce}/products/index.js +3 -3
  49. package/resources/beta/commerce/products/index.js.map +1 -0
  50. package/resources/beta/{pay → commerce}/products/index.mjs +1 -1
  51. package/resources/beta/commerce/products/index.mjs.map +1 -0
  52. package/resources/beta/commerce/products/products.d.mts +967 -0
  53. package/resources/beta/commerce/products/products.d.mts.map +1 -0
  54. package/resources/beta/commerce/products/products.d.ts +967 -0
  55. package/resources/beta/commerce/products/products.d.ts.map +1 -0
  56. package/resources/beta/{pay → commerce}/products/products.js +16 -12
  57. package/resources/beta/commerce/products/products.js.map +1 -0
  58. package/resources/beta/{pay → commerce}/products/products.mjs +16 -12
  59. package/resources/beta/commerce/products/products.mjs.map +1 -0
  60. package/resources/beta/commerce/products/resources.d.mts +160 -0
  61. package/resources/beta/commerce/products/resources.d.mts.map +1 -0
  62. package/resources/beta/commerce/products/resources.d.ts +160 -0
  63. package/resources/beta/commerce/products/resources.d.ts.map +1 -0
  64. package/resources/beta/commerce/products/resources.js +41 -0
  65. package/resources/beta/commerce/products/resources.js.map +1 -0
  66. package/resources/beta/commerce/products/resources.mjs +37 -0
  67. package/resources/beta/commerce/products/resources.mjs.map +1 -0
  68. package/resources/beta/commerce/products/variants.d.mts +798 -0
  69. package/resources/beta/commerce/products/variants.d.mts.map +1 -0
  70. package/resources/beta/commerce/products/variants.d.ts +798 -0
  71. package/resources/beta/commerce/products/variants.d.ts.map +1 -0
  72. package/resources/beta/{pay → commerce}/products/variants.js +5 -8
  73. package/resources/beta/commerce/products/variants.js.map +1 -0
  74. package/resources/beta/{pay → commerce}/products/variants.mjs +5 -8
  75. package/resources/beta/commerce/products/variants.mjs.map +1 -0
  76. package/resources/beta/commerce/products.d.mts.map +1 -0
  77. package/resources/beta/commerce/products.d.ts.map +1 -0
  78. package/resources/beta/commerce/products.js.map +1 -0
  79. package/resources/beta/commerce/products.mjs.map +1 -0
  80. package/resources/beta/commerce.d.mts +2 -0
  81. package/resources/beta/commerce.d.mts.map +1 -0
  82. package/resources/beta/commerce.d.ts +2 -0
  83. package/resources/beta/commerce.d.ts.map +1 -0
  84. package/resources/beta/{pay.js → commerce.js} +2 -2
  85. package/resources/beta/commerce.js.map +1 -0
  86. package/resources/beta/{pay.mjs → commerce.mjs} +2 -2
  87. package/resources/beta/commerce.mjs.map +1 -0
  88. package/resources/beta/index.d.mts +1 -1
  89. package/resources/beta/index.d.mts.map +1 -1
  90. package/resources/beta/index.d.ts +1 -1
  91. package/resources/beta/index.d.ts.map +1 -1
  92. package/resources/beta/index.js +3 -3
  93. package/resources/beta/index.js.map +1 -1
  94. package/resources/beta/index.mjs +1 -1
  95. package/resources/beta/index.mjs.map +1 -1
  96. package/resources/push-notifications/push-notifications.d.mts +8 -9
  97. package/resources/push-notifications/push-notifications.d.mts.map +1 -1
  98. package/resources/push-notifications/push-notifications.d.ts +8 -9
  99. package/resources/push-notifications/push-notifications.d.ts.map +1 -1
  100. package/resources/push-notifications/push-notifications.js +5 -6
  101. package/resources/push-notifications/push-notifications.js.map +1 -1
  102. package/resources/push-notifications/push-notifications.mjs +5 -6
  103. package/resources/push-notifications/push-notifications.mjs.map +1 -1
  104. package/src/resources/beta/beta.ts +18 -18
  105. package/src/resources/beta/{pay/pay.ts → commerce/commerce.ts} +82 -85
  106. package/src/resources/beta/commerce/coupons.ts +440 -0
  107. package/src/resources/beta/commerce/customers.ts +532 -0
  108. package/src/resources/beta/commerce/index.ts +47 -0
  109. package/src/resources/beta/commerce/products/index.ts +37 -0
  110. package/src/resources/beta/commerce/products/products.ts +1199 -0
  111. package/src/resources/beta/commerce/products/resources.ts +213 -0
  112. package/src/resources/beta/commerce/products/variants.ts +984 -0
  113. package/src/resources/beta/{pay.ts → commerce.ts} +1 -1
  114. package/src/resources/beta/index.ts +8 -8
  115. package/src/resources/push-notifications/push-notifications.ts +8 -9
  116. package/src/version.ts +1 -1
  117. package/version.d.mts +1 -1
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
  120. package/version.mjs +1 -1
  121. package/resources/beta/pay/coupons.d.mts +0 -156
  122. package/resources/beta/pay/coupons.d.mts.map +0 -1
  123. package/resources/beta/pay/coupons.d.ts +0 -156
  124. package/resources/beta/pay/coupons.d.ts.map +0 -1
  125. package/resources/beta/pay/coupons.js.map +0 -1
  126. package/resources/beta/pay/coupons.mjs.map +0 -1
  127. package/resources/beta/pay/customers.d.mts +0 -160
  128. package/resources/beta/pay/customers.d.mts.map +0 -1
  129. package/resources/beta/pay/customers.d.ts +0 -160
  130. package/resources/beta/pay/customers.d.ts.map +0 -1
  131. package/resources/beta/pay/customers.js.map +0 -1
  132. package/resources/beta/pay/customers.mjs.map +0 -1
  133. package/resources/beta/pay/entitlements.d.mts +0 -76
  134. package/resources/beta/pay/entitlements.d.mts.map +0 -1
  135. package/resources/beta/pay/entitlements.d.ts +0 -76
  136. package/resources/beta/pay/entitlements.d.ts.map +0 -1
  137. package/resources/beta/pay/entitlements.js +0 -41
  138. package/resources/beta/pay/entitlements.js.map +0 -1
  139. package/resources/beta/pay/entitlements.mjs +0 -37
  140. package/resources/beta/pay/entitlements.mjs.map +0 -1
  141. package/resources/beta/pay/index.d.mts +0 -6
  142. package/resources/beta/pay/index.d.mts.map +0 -1
  143. package/resources/beta/pay/index.d.ts +0 -6
  144. package/resources/beta/pay/index.d.ts.map +0 -1
  145. package/resources/beta/pay/index.js.map +0 -1
  146. package/resources/beta/pay/index.mjs.map +0 -1
  147. package/resources/beta/pay/pay.d.mts +0 -206
  148. package/resources/beta/pay/pay.d.mts.map +0 -1
  149. package/resources/beta/pay/pay.d.ts +0 -206
  150. package/resources/beta/pay/pay.d.ts.map +0 -1
  151. package/resources/beta/pay/pay.js.map +0 -1
  152. package/resources/beta/pay/pay.mjs.map +0 -1
  153. package/resources/beta/pay/products/entitlements.d.mts +0 -53
  154. package/resources/beta/pay/products/entitlements.d.mts.map +0 -1
  155. package/resources/beta/pay/products/entitlements.d.ts +0 -53
  156. package/resources/beta/pay/products/entitlements.d.ts.map +0 -1
  157. package/resources/beta/pay/products/entitlements.js +0 -38
  158. package/resources/beta/pay/products/entitlements.js.map +0 -1
  159. package/resources/beta/pay/products/entitlements.mjs +0 -34
  160. package/resources/beta/pay/products/entitlements.mjs.map +0 -1
  161. package/resources/beta/pay/products/index.d.mts +0 -4
  162. package/resources/beta/pay/products/index.d.mts.map +0 -1
  163. package/resources/beta/pay/products/index.d.ts +0 -4
  164. package/resources/beta/pay/products/index.d.ts.map +0 -1
  165. package/resources/beta/pay/products/index.js.map +0 -1
  166. package/resources/beta/pay/products/index.mjs.map +0 -1
  167. package/resources/beta/pay/products/products.d.mts +0 -183
  168. package/resources/beta/pay/products/products.d.mts.map +0 -1
  169. package/resources/beta/pay/products/products.d.ts +0 -183
  170. package/resources/beta/pay/products/products.d.ts.map +0 -1
  171. package/resources/beta/pay/products/products.js.map +0 -1
  172. package/resources/beta/pay/products/products.mjs.map +0 -1
  173. package/resources/beta/pay/products/variants.d.mts +0 -206
  174. package/resources/beta/pay/products/variants.d.mts.map +0 -1
  175. package/resources/beta/pay/products/variants.d.ts +0 -206
  176. package/resources/beta/pay/products/variants.d.ts.map +0 -1
  177. package/resources/beta/pay/products/variants.js.map +0 -1
  178. package/resources/beta/pay/products/variants.mjs.map +0 -1
  179. package/resources/beta/pay/products.d.mts.map +0 -1
  180. package/resources/beta/pay/products.d.ts.map +0 -1
  181. package/resources/beta/pay/products.js.map +0 -1
  182. package/resources/beta/pay/products.mjs.map +0 -1
  183. package/resources/beta/pay.d.mts +0 -2
  184. package/resources/beta/pay.d.mts.map +0 -1
  185. package/resources/beta/pay.d.ts +0 -2
  186. package/resources/beta/pay.d.ts.map +0 -1
  187. package/resources/beta/pay.js.map +0 -1
  188. package/resources/beta/pay.mjs.map +0 -1
  189. package/src/resources/beta/pay/coupons.ts +0 -218
  190. package/src/resources/beta/pay/customers.ts +0 -229
  191. package/src/resources/beta/pay/entitlements.ts +0 -113
  192. package/src/resources/beta/pay/index.ts +0 -46
  193. package/src/resources/beta/pay/products/entitlements.ts +0 -93
  194. package/src/resources/beta/pay/products/index.ts +0 -28
  195. package/src/resources/beta/pay/products/products.ts +0 -280
  196. package/src/resources/beta/pay/products/variants.ts +0 -279
  197. /package/resources/beta/{pay → commerce}/products.d.mts +0 -0
  198. /package/resources/beta/{pay → commerce}/products.d.ts +0 -0
  199. /package/resources/beta/{pay → commerce}/products.js +0 -0
  200. /package/resources/beta/{pay → commerce}/products.mjs +0 -0
  201. /package/src/resources/beta/{pay → commerce}/products.ts +0 -0
@@ -1,229 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../../core/resource';
4
- import { APIPromise } from '../../../core/api-promise';
5
- import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../core/pagination';
6
- import { buildHeaders } from '../../../internal/headers';
7
- import { RequestOptions } from '../../../internal/request-options';
8
- import { path } from '../../../internal/utils/path';
9
-
10
- export class Customers extends APIResource {
11
- /**
12
- * Creates a new billable customer. A customer represents the entity in your app
13
- * that will be charged—typically a user, organization, or project. Hercules
14
- * recommends creating a customer immediately after creating the corresponding
15
- * entity in your app.
16
- */
17
- create(body: CustomerCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<Customer> {
18
- return this._client.post('/v1/pay/customers', { body, ...options });
19
- }
20
-
21
- /**
22
- * Updates an existing customer. Use this to modify contact information or billing
23
- * address. Only provided fields are updated; omitted fields remain unchanged.
24
- */
25
- update(
26
- customerID: string,
27
- body: CustomerUpdateParams | null | undefined = {},
28
- options?: RequestOptions,
29
- ): APIPromise<Customer> {
30
- return this._client.patch(path`/v1/pay/customers/${customerID}`, { body, ...options });
31
- }
32
-
33
- /**
34
- * Retrieves a paginated list of all customers. Customers are the billable entities
35
- * in your app—typically users, organizations, or projects.
36
- */
37
- list(
38
- query: CustomerListParams | null | undefined = {},
39
- options?: RequestOptions,
40
- ): PagePromise<CustomersCursorIDPage, Customer> {
41
- return this._client.getAPIList('/v1/pay/customers', CursorIDPage<Customer>, { query, ...options });
42
- }
43
-
44
- /**
45
- * Permanently deletes a customer. This also cancels any active subscriptions. This
46
- * action cannot be undone.
47
- */
48
- delete(customerID: string, options?: RequestOptions): APIPromise<void> {
49
- return this._client.delete(path`/v1/pay/customers/${customerID}`, {
50
- ...options,
51
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
52
- });
53
- }
54
-
55
- /**
56
- * Generates a URL to a hosted billing portal where the customer can view invoices,
57
- * update payment methods, and manage billing details. Redirect the customer to the
58
- * returned URL.
59
- */
60
- billingPortal(
61
- customerID: string,
62
- body: CustomerBillingPortalParams | null | undefined = {},
63
- options?: RequestOptions,
64
- ): APIPromise<CustomerBillingPortalResponse> {
65
- return this._client.post(path`/v1/pay/customers/${customerID}/billing_portal`, { body, ...options });
66
- }
67
-
68
- /**
69
- * Retrieves a customer by ID. Returns the customer object including contact
70
- * information and billing address.
71
- */
72
- get(customerID: string, options?: RequestOptions): APIPromise<Customer> {
73
- return this._client.get(path`/v1/pay/customers/${customerID}`, options);
74
- }
75
- }
76
-
77
- export type CustomersCursorIDPage = CursorIDPage<Customer>;
78
-
79
- /**
80
- * A billable customer. Represents the entity in your app that will be
81
- * charged—typically a user, organization, or project.
82
- */
83
- export interface Customer {
84
- /**
85
- * Unique identifier for the topic subscription
86
- */
87
- id: string;
88
-
89
- /**
90
- * Timestamp when the customer was created
91
- */
92
- created: string;
93
-
94
- /**
95
- * The customer's billing address
96
- */
97
- address?: CustomerAddress | null;
98
-
99
- /**
100
- * The customer's email address for receipts and notifications
101
- */
102
- email?: string | null;
103
-
104
- /**
105
- * The customer's full name
106
- */
107
- name?: string | null;
108
-
109
- /**
110
- * The customer's phone number
111
- */
112
- phone?: string | null;
113
- }
114
-
115
- /**
116
- * The customer's billing address
117
- */
118
- export interface CustomerAddress {
119
- /**
120
- * City name
121
- */
122
- city?: string | null;
123
-
124
- /**
125
- * Two-letter ISO country code
126
- */
127
- country?: string | null;
128
-
129
- /**
130
- * Street address line 1
131
- */
132
- line1?: string | null;
133
-
134
- /**
135
- * Street address line 2 (apartment, suite, etc.)
136
- */
137
- line2?: string | null;
138
-
139
- /**
140
- * Postal or ZIP code
141
- */
142
- postal_code?: string | null;
143
-
144
- /**
145
- * State, province, or region
146
- */
147
- state?: string | null;
148
- }
149
-
150
- /**
151
- * Response containing the billing portal URL
152
- */
153
- export interface CustomerBillingPortalResponse {
154
- /**
155
- * URL to redirect the customer to for the billing portal
156
- */
157
- url: string;
158
- }
159
-
160
- export interface CustomerCreateParams {
161
- /**
162
- * Optional custom ID for the customer. If not provided, one will be generated.
163
- */
164
- id?: string;
165
-
166
- /**
167
- * The customer's billing address
168
- */
169
- address?: CustomerAddress;
170
-
171
- /**
172
- * The customer's email address for receipts and notifications
173
- */
174
- email?: string;
175
-
176
- /**
177
- * The customer's full name
178
- */
179
- name?: string;
180
-
181
- /**
182
- * The customer's phone number
183
- */
184
- phone?: string;
185
- }
186
-
187
- export interface CustomerUpdateParams {
188
- /**
189
- * The customer's billing address
190
- */
191
- address?: CustomerAddress;
192
-
193
- /**
194
- * The customer's email address for receipts and notifications
195
- */
196
- email?: string;
197
-
198
- /**
199
- * The customer's full name
200
- */
201
- name?: string;
202
-
203
- /**
204
- * The customer's phone number
205
- */
206
- phone?: string;
207
- }
208
-
209
- export interface CustomerListParams extends CursorIDPageParams {}
210
-
211
- export interface CustomerBillingPortalParams {
212
- /**
213
- * URL to redirect the customer to after they exit the billing portal
214
- */
215
- return_url?: string;
216
- }
217
-
218
- export declare namespace Customers {
219
- export {
220
- type Customer as Customer,
221
- type CustomerAddress as CustomerAddress,
222
- type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
223
- type CustomersCursorIDPage as CustomersCursorIDPage,
224
- type CustomerCreateParams as CustomerCreateParams,
225
- type CustomerUpdateParams as CustomerUpdateParams,
226
- type CustomerListParams as CustomerListParams,
227
- type CustomerBillingPortalParams as CustomerBillingPortalParams,
228
- };
229
- }
@@ -1,113 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../../core/resource';
4
- import { APIPromise } from '../../../core/api-promise';
5
- import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../core/pagination';
6
- import { RequestOptions } from '../../../internal/request-options';
7
- import { path } from '../../../internal/utils/path';
8
-
9
- export class Entitlements extends APIResource {
10
- /**
11
- * Creates a new feature entitlement. Entitlements represent features or
12
- * capabilities in your app that can be gated by subscription. After creating an
13
- * entitlement, attach it to one or more plans to grant access to customers on
14
- * those plans.
15
- */
16
- create(body: EntitlementCreateParams, options?: RequestOptions): APIPromise<Entitlement> {
17
- return this._client.post('/v1/pay/entitlements', { body, ...options });
18
- }
19
-
20
- /**
21
- * Updates an existing entitlement. Use this to modify the name or deactivate the
22
- * entitlement.
23
- */
24
- update(
25
- entitlementID: string,
26
- body: EntitlementUpdateParams | null | undefined = {},
27
- options?: RequestOptions,
28
- ): APIPromise<Entitlement> {
29
- return this._client.patch(path`/v1/pay/entitlements/${entitlementID}`, { body, ...options });
30
- }
31
-
32
- /**
33
- * Retrieves a paginated list of all entitlements. Entitlements represent features
34
- * or capabilities in your app that can be gated by subscription.
35
- */
36
- list(
37
- query: EntitlementListParams | null | undefined = {},
38
- options?: RequestOptions,
39
- ): PagePromise<EntitlementsCursorIDPage, Entitlement> {
40
- return this._client.getAPIList('/v1/pay/entitlements', CursorIDPage<Entitlement>, { query, ...options });
41
- }
42
-
43
- /**
44
- * Retrieves an entitlement by ID. Returns the entitlement object including its
45
- * active status.
46
- */
47
- get(entitlementID: string, options?: RequestOptions): APIPromise<Entitlement> {
48
- return this._client.get(path`/v1/pay/entitlements/${entitlementID}`, options);
49
- }
50
- }
51
-
52
- export type EntitlementsCursorIDPage = CursorIDPage<Entitlement>;
53
-
54
- /**
55
- * The entitlement attached to the product
56
- */
57
- export interface Entitlement {
58
- /**
59
- * Unique identifier for the topic subscription
60
- */
61
- id: string;
62
-
63
- /**
64
- * Whether the entitlement is active and can be attached to products
65
- */
66
- active: boolean;
67
-
68
- /**
69
- * Display name for the entitlement (e.g., API Access, Premium Support)
70
- */
71
- name: string;
72
- }
73
-
74
- export interface EntitlementCreateParams {
75
- /**
76
- * Display name for the entitlement (e.g., API Access, Premium Support)
77
- */
78
- name: string;
79
-
80
- /**
81
- * Optional custom ID for the entitlement. If not provided, one will be generated.
82
- */
83
- id?: string;
84
- }
85
-
86
- export interface EntitlementUpdateParams {
87
- /**
88
- * Whether the entitlement is active. Deactivating removes it from access checks.
89
- */
90
- active?: boolean;
91
-
92
- /**
93
- * Display name for the entitlement
94
- */
95
- name?: string;
96
- }
97
-
98
- export interface EntitlementListParams extends CursorIDPageParams {
99
- /**
100
- * Filter by archived status
101
- */
102
- archived?: 'true' | 'false';
103
- }
104
-
105
- export declare namespace Entitlements {
106
- export {
107
- type Entitlement as Entitlement,
108
- type EntitlementsCursorIDPage as EntitlementsCursorIDPage,
109
- type EntitlementCreateParams as EntitlementCreateParams,
110
- type EntitlementUpdateParams as EntitlementUpdateParams,
111
- type EntitlementListParams as EntitlementListParams,
112
- };
113
- }
@@ -1,46 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export {
4
- Coupons,
5
- type Coupon,
6
- type CouponCreateParams,
7
- type CouponUpdateParams,
8
- type CouponListParams,
9
- type CouponsCursorIDPage,
10
- } from './coupons';
11
- export {
12
- Customers,
13
- type Customer,
14
- type CustomerAddress,
15
- type CustomerBillingPortalResponse,
16
- type CustomerCreateParams,
17
- type CustomerUpdateParams,
18
- type CustomerListParams,
19
- type CustomerBillingPortalParams,
20
- type CustomersCursorIDPage,
21
- } from './customers';
22
- export {
23
- Entitlements,
24
- type Entitlement,
25
- type EntitlementCreateParams,
26
- type EntitlementUpdateParams,
27
- type EntitlementListParams,
28
- type EntitlementsCursorIDPage,
29
- } from './entitlements';
30
- export {
31
- Pay,
32
- type PayCancelResponse,
33
- type PayCheckResponse,
34
- type PayCheckoutResponse,
35
- type PayCancelParams,
36
- type PayCheckParams,
37
- type PayCheckoutParams,
38
- } from './pay';
39
- export {
40
- Products,
41
- type Product,
42
- type ProductCreateParams,
43
- type ProductUpdateParams,
44
- type ProductListParams,
45
- type ProductsCursorIDPage,
46
- } from './products/index';
@@ -1,93 +0,0 @@
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 { APIPromise } from '../../../../core/api-promise';
6
- import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../../core/pagination';
7
- import { buildHeaders } from '../../../../internal/headers';
8
- import { RequestOptions } from '../../../../internal/request-options';
9
- import { path } from '../../../../internal/utils/path';
10
-
11
- export class Entitlements extends APIResource {
12
- /**
13
- * Retrieves all entitlements attached to a product. These entitlements define the
14
- * features that customers subscribed to this product can access.
15
- */
16
- list(
17
- productID: string,
18
- query: EntitlementListParams | null | undefined = {},
19
- options?: RequestOptions,
20
- ): PagePromise<ProductEntitlementsCursorIDPage, ProductEntitlement> {
21
- return this._client.getAPIList(
22
- path`/v1/pay/products/${productID}/entitlements`,
23
- CursorIDPage<ProductEntitlement>,
24
- { query, ...options },
25
- );
26
- }
27
-
28
- /**
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.
32
- */
33
- attach(
34
- productID: string,
35
- body: EntitlementAttachParams,
36
- options?: RequestOptions,
37
- ): APIPromise<ProductEntitlement> {
38
- return this._client.post(path`/v1/pay/products/${productID}/entitlements`, { body, ...options });
39
- }
40
-
41
- /**
42
- * Removes an entitlement from a product. Customers subscribed to this product will
43
- * lose access to the feature. Existing subscriptions are affected immediately.
44
- */
45
- remove(featureID: string, params: EntitlementRemoveParams, options?: RequestOptions): APIPromise<void> {
46
- const { product_id } = params;
47
- return this._client.delete(path`/v1/pay/products/${product_id}/entitlements/${featureID}`, {
48
- ...options,
49
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
50
- });
51
- }
52
- }
53
-
54
- export type ProductEntitlementsCursorIDPage = CursorIDPage<ProductEntitlement>;
55
-
56
- /**
57
- * An entitlement attached to a product. All customers subscribed to the product
58
- * gain access to this entitlement.
59
- */
60
- export interface ProductEntitlement {
61
- /**
62
- * Unique identifier for the topic subscription
63
- */
64
- id: string;
65
-
66
- /**
67
- * The entitlement attached to the product
68
- */
69
- entitlement: EntitlementsAPI.Entitlement;
70
- }
71
-
72
- export interface EntitlementListParams extends CursorIDPageParams {}
73
-
74
- export interface EntitlementAttachParams {
75
- /**
76
- * The ID of the entitlement to attach to the product
77
- */
78
- entitlement: string;
79
- }
80
-
81
- export interface EntitlementRemoveParams {
82
- product_id: string;
83
- }
84
-
85
- export declare namespace Entitlements {
86
- export {
87
- type ProductEntitlement as ProductEntitlement,
88
- type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage,
89
- type EntitlementListParams as EntitlementListParams,
90
- type EntitlementAttachParams as EntitlementAttachParams,
91
- type EntitlementRemoveParams as EntitlementRemoveParams,
92
- };
93
- }
@@ -1,28 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export {
4
- Entitlements,
5
- type ProductEntitlement,
6
- type EntitlementListParams,
7
- type EntitlementAttachParams,
8
- type EntitlementRemoveParams,
9
- type ProductEntitlementsCursorIDPage,
10
- } from './entitlements';
11
- export {
12
- Products,
13
- type Product,
14
- type ProductCreateParams,
15
- type ProductUpdateParams,
16
- type ProductListParams,
17
- type ProductsCursorIDPage,
18
- } from './products';
19
- export {
20
- Variants,
21
- type Variant,
22
- type VariantCreateParams,
23
- type VariantUpdateParams,
24
- type VariantListParams,
25
- type VariantArchiveParams,
26
- type VariantGetParams,
27
- type VariantsCursorIDPage,
28
- } from './variants';