@usehercules/sdk 1.2.0 → 1.4.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 (209) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +1 -1
  3. package/README.md +14 -20
  4. package/client.d.mts +6 -3
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +6 -3
  7. package/client.d.ts.map +1 -1
  8. package/client.js +1 -1
  9. package/client.js.map +1 -1
  10. package/client.mjs +1 -1
  11. package/client.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/beta/beta.d.mts +4 -4
  14. package/resources/beta/beta.d.mts.map +1 -1
  15. package/resources/beta/beta.d.ts +4 -4
  16. package/resources/beta/beta.d.ts.map +1 -1
  17. package/resources/beta/beta.js +4 -4
  18. package/resources/beta/beta.js.map +1 -1
  19. package/resources/beta/beta.mjs +4 -4
  20. package/resources/beta/beta.mjs.map +1 -1
  21. package/resources/beta/index.d.mts +1 -1
  22. package/resources/beta/index.d.mts.map +1 -1
  23. package/resources/beta/index.d.ts +1 -1
  24. package/resources/beta/index.d.ts.map +1 -1
  25. package/resources/beta/index.js +3 -3
  26. package/resources/beta/index.js.map +1 -1
  27. package/resources/beta/index.mjs +1 -1
  28. package/resources/beta/index.mjs.map +1 -1
  29. package/resources/beta/pay/coupons.d.mts +156 -0
  30. package/resources/beta/pay/coupons.d.mts.map +1 -0
  31. package/resources/beta/pay/coupons.d.ts +156 -0
  32. package/resources/beta/pay/coupons.d.ts.map +1 -0
  33. package/resources/beta/pay/coupons.js +51 -0
  34. package/resources/beta/pay/coupons.js.map +1 -0
  35. package/resources/beta/pay/coupons.mjs +47 -0
  36. package/resources/beta/pay/coupons.mjs.map +1 -0
  37. package/resources/beta/pay/customers.d.mts +160 -0
  38. package/resources/beta/pay/customers.d.mts.map +1 -0
  39. package/resources/beta/pay/customers.d.ts +160 -0
  40. package/resources/beta/pay/customers.d.ts.map +1 -0
  41. package/resources/beta/pay/customers.js +60 -0
  42. package/resources/beta/pay/customers.js.map +1 -0
  43. package/resources/beta/pay/customers.mjs +56 -0
  44. package/resources/beta/pay/customers.mjs.map +1 -0
  45. package/resources/beta/{subscriptions → pay}/entitlements.d.mts +25 -19
  46. package/resources/beta/pay/entitlements.d.mts.map +1 -0
  47. package/resources/beta/{subscriptions → pay}/entitlements.d.ts +25 -19
  48. package/resources/beta/pay/entitlements.d.ts.map +1 -0
  49. package/resources/beta/pay/entitlements.js +41 -0
  50. package/resources/beta/pay/entitlements.js.map +1 -0
  51. package/resources/beta/pay/entitlements.mjs +37 -0
  52. package/resources/beta/pay/entitlements.mjs.map +1 -0
  53. package/resources/beta/{subscriptions → pay}/index.d.mts +2 -2
  54. package/resources/beta/pay/index.d.mts.map +1 -0
  55. package/resources/beta/{subscriptions → pay}/index.d.ts +2 -2
  56. package/resources/beta/pay/index.d.ts.map +1 -0
  57. package/resources/beta/{subscriptions → pay}/index.js +5 -5
  58. package/resources/beta/pay/index.js.map +1 -0
  59. package/resources/beta/{subscriptions → pay}/index.mjs +2 -2
  60. package/resources/beta/pay/index.mjs.map +1 -0
  61. package/resources/beta/pay/pay.d.mts +206 -0
  62. package/resources/beta/pay/pay.d.mts.map +1 -0
  63. package/resources/beta/pay/pay.d.ts +206 -0
  64. package/resources/beta/pay/pay.d.ts.map +1 -0
  65. package/resources/beta/pay/pay.js +54 -0
  66. package/resources/beta/pay/pay.js.map +1 -0
  67. package/resources/beta/pay/pay.mjs +49 -0
  68. package/resources/beta/pay/pay.mjs.map +1 -0
  69. package/resources/beta/pay/products/entitlements.d.mts +53 -0
  70. package/resources/beta/pay/products/entitlements.d.mts.map +1 -0
  71. package/resources/beta/pay/products/entitlements.d.ts +53 -0
  72. package/resources/beta/pay/products/entitlements.d.ts.map +1 -0
  73. package/resources/beta/pay/products/entitlements.js +38 -0
  74. package/resources/beta/pay/products/entitlements.js.map +1 -0
  75. package/resources/beta/pay/products/entitlements.mjs +34 -0
  76. package/resources/beta/pay/products/entitlements.mjs.map +1 -0
  77. package/resources/beta/pay/products/index.d.mts +4 -0
  78. package/resources/beta/pay/products/index.d.mts.map +1 -0
  79. package/resources/beta/pay/products/index.d.ts +4 -0
  80. package/resources/beta/pay/products/index.d.ts.map +1 -0
  81. package/resources/beta/pay/products/index.js +11 -0
  82. package/resources/beta/pay/products/index.js.map +1 -0
  83. package/resources/beta/{subscriptions/plans → pay/products}/index.mjs +2 -1
  84. package/resources/beta/pay/products/index.mjs.map +1 -0
  85. package/resources/beta/pay/products/products.d.mts +183 -0
  86. package/resources/beta/pay/products/products.d.mts.map +1 -0
  87. package/resources/beta/pay/products/products.d.ts +183 -0
  88. package/resources/beta/pay/products/products.d.ts.map +1 -0
  89. package/resources/beta/pay/products/products.js +61 -0
  90. package/resources/beta/pay/products/products.js.map +1 -0
  91. package/resources/beta/pay/products/products.mjs +56 -0
  92. package/resources/beta/pay/products/products.mjs.map +1 -0
  93. package/resources/beta/pay/products/variants.d.mts +206 -0
  94. package/resources/beta/pay/products/variants.d.mts.map +1 -0
  95. package/resources/beta/pay/products/variants.d.ts +206 -0
  96. package/resources/beta/pay/products/variants.d.ts.map +1 -0
  97. package/resources/beta/pay/products/variants.js +56 -0
  98. package/resources/beta/pay/products/variants.js.map +1 -0
  99. package/resources/beta/pay/products/variants.mjs +52 -0
  100. package/resources/beta/pay/products/variants.mjs.map +1 -0
  101. package/resources/beta/pay/products.d.mts +2 -0
  102. package/resources/beta/pay/products.d.mts.map +1 -0
  103. package/resources/beta/pay/products.d.ts +2 -0
  104. package/resources/beta/pay/products.d.ts.map +1 -0
  105. package/resources/beta/{subscriptions/plans.js → pay/products.js} +2 -2
  106. package/resources/beta/pay/products.js.map +1 -0
  107. package/resources/beta/{subscriptions.mjs → pay/products.mjs} +2 -2
  108. package/resources/beta/pay/products.mjs.map +1 -0
  109. package/resources/beta/pay.d.mts +2 -0
  110. package/resources/beta/pay.d.mts.map +1 -0
  111. package/resources/beta/pay.d.ts +2 -0
  112. package/resources/beta/pay.d.ts.map +1 -0
  113. package/resources/beta/{subscriptions.js → pay.js} +2 -2
  114. package/resources/beta/pay.js.map +1 -0
  115. package/resources/beta/{subscriptions/plans.mjs → pay.mjs} +2 -2
  116. package/resources/beta/pay.mjs.map +1 -0
  117. package/src/client.ts +6 -4
  118. package/src/resources/beta/beta.ts +18 -18
  119. package/src/resources/beta/index.ts +8 -8
  120. package/src/resources/beta/pay/coupons.ts +218 -0
  121. package/src/resources/beta/pay/customers.ts +229 -0
  122. package/src/resources/beta/{subscriptions → pay}/entitlements.ts +29 -29
  123. package/src/resources/beta/{subscriptions → pay}/index.ts +15 -15
  124. package/src/resources/beta/pay/pay.ts +326 -0
  125. package/src/resources/beta/{subscriptions/plans → pay/products}/entitlements.ts +26 -21
  126. package/src/resources/beta/pay/products/index.ts +28 -0
  127. package/src/resources/beta/pay/products/products.ts +280 -0
  128. package/src/resources/beta/pay/products/variants.ts +279 -0
  129. package/src/resources/beta/{subscriptions.ts → pay/products.ts} +1 -1
  130. package/src/resources/beta/{subscriptions/plans.ts → pay.ts} +1 -1
  131. package/src/version.ts +1 -1
  132. package/version.d.mts +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
  136. package/resources/beta/subscriptions/coupons.d.mts +0 -124
  137. package/resources/beta/subscriptions/coupons.d.mts.map +0 -1
  138. package/resources/beta/subscriptions/coupons.d.ts +0 -124
  139. package/resources/beta/subscriptions/coupons.d.ts.map +0 -1
  140. package/resources/beta/subscriptions/coupons.js +0 -45
  141. package/resources/beta/subscriptions/coupons.js.map +0 -1
  142. package/resources/beta/subscriptions/coupons.mjs +0 -41
  143. package/resources/beta/subscriptions/coupons.mjs.map +0 -1
  144. package/resources/beta/subscriptions/customers.d.mts +0 -93
  145. package/resources/beta/subscriptions/customers.d.mts.map +0 -1
  146. package/resources/beta/subscriptions/customers.d.ts +0 -93
  147. package/resources/beta/subscriptions/customers.d.ts.map +0 -1
  148. package/resources/beta/subscriptions/customers.js +0 -57
  149. package/resources/beta/subscriptions/customers.js.map +0 -1
  150. package/resources/beta/subscriptions/customers.mjs +0 -53
  151. package/resources/beta/subscriptions/customers.mjs.map +0 -1
  152. package/resources/beta/subscriptions/entitlements.d.mts.map +0 -1
  153. package/resources/beta/subscriptions/entitlements.d.ts.map +0 -1
  154. package/resources/beta/subscriptions/entitlements.js +0 -38
  155. package/resources/beta/subscriptions/entitlements.js.map +0 -1
  156. package/resources/beta/subscriptions/entitlements.mjs +0 -34
  157. package/resources/beta/subscriptions/entitlements.mjs.map +0 -1
  158. package/resources/beta/subscriptions/index.d.mts.map +0 -1
  159. package/resources/beta/subscriptions/index.d.ts.map +0 -1
  160. package/resources/beta/subscriptions/index.js.map +0 -1
  161. package/resources/beta/subscriptions/index.mjs.map +0 -1
  162. package/resources/beta/subscriptions/plans/entitlements.d.mts +0 -48
  163. package/resources/beta/subscriptions/plans/entitlements.d.mts.map +0 -1
  164. package/resources/beta/subscriptions/plans/entitlements.d.ts +0 -48
  165. package/resources/beta/subscriptions/plans/entitlements.d.ts.map +0 -1
  166. package/resources/beta/subscriptions/plans/entitlements.js +0 -34
  167. package/resources/beta/subscriptions/plans/entitlements.js.map +0 -1
  168. package/resources/beta/subscriptions/plans/entitlements.mjs +0 -30
  169. package/resources/beta/subscriptions/plans/entitlements.mjs.map +0 -1
  170. package/resources/beta/subscriptions/plans/index.d.mts +0 -3
  171. package/resources/beta/subscriptions/plans/index.d.mts.map +0 -1
  172. package/resources/beta/subscriptions/plans/index.d.ts +0 -3
  173. package/resources/beta/subscriptions/plans/index.d.ts.map +0 -1
  174. package/resources/beta/subscriptions/plans/index.js +0 -9
  175. package/resources/beta/subscriptions/plans/index.js.map +0 -1
  176. package/resources/beta/subscriptions/plans/index.mjs.map +0 -1
  177. package/resources/beta/subscriptions/plans/plans.d.mts +0 -87
  178. package/resources/beta/subscriptions/plans/plans.d.mts.map +0 -1
  179. package/resources/beta/subscriptions/plans/plans.d.ts +0 -87
  180. package/resources/beta/subscriptions/plans/plans.d.ts.map +0 -1
  181. package/resources/beta/subscriptions/plans/plans.js +0 -49
  182. package/resources/beta/subscriptions/plans/plans.js.map +0 -1
  183. package/resources/beta/subscriptions/plans/plans.mjs +0 -44
  184. package/resources/beta/subscriptions/plans/plans.mjs.map +0 -1
  185. package/resources/beta/subscriptions/plans.d.mts +0 -2
  186. package/resources/beta/subscriptions/plans.d.mts.map +0 -1
  187. package/resources/beta/subscriptions/plans.d.ts +0 -2
  188. package/resources/beta/subscriptions/plans.d.ts.map +0 -1
  189. package/resources/beta/subscriptions/plans.js.map +0 -1
  190. package/resources/beta/subscriptions/plans.mjs.map +0 -1
  191. package/resources/beta/subscriptions/subscriptions.d.mts +0 -130
  192. package/resources/beta/subscriptions/subscriptions.d.mts.map +0 -1
  193. package/resources/beta/subscriptions/subscriptions.d.ts +0 -130
  194. package/resources/beta/subscriptions/subscriptions.d.ts.map +0 -1
  195. package/resources/beta/subscriptions/subscriptions.js +0 -47
  196. package/resources/beta/subscriptions/subscriptions.js.map +0 -1
  197. package/resources/beta/subscriptions/subscriptions.mjs +0 -42
  198. package/resources/beta/subscriptions/subscriptions.mjs.map +0 -1
  199. package/resources/beta/subscriptions.d.mts +0 -2
  200. package/resources/beta/subscriptions.d.mts.map +0 -1
  201. package/resources/beta/subscriptions.d.ts +0 -2
  202. package/resources/beta/subscriptions.d.ts.map +0 -1
  203. package/resources/beta/subscriptions.js.map +0 -1
  204. package/resources/beta/subscriptions.mjs.map +0 -1
  205. package/src/resources/beta/subscriptions/coupons.ts +0 -185
  206. package/src/resources/beta/subscriptions/customers.ts +0 -168
  207. package/src/resources/beta/subscriptions/plans/index.ts +0 -18
  208. package/src/resources/beta/subscriptions/plans/plans.ts +0 -159
  209. package/src/resources/beta/subscriptions/subscriptions.ts +0 -241
@@ -1,168 +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
- * Create Customer
13
- */
14
- create(body: CustomerCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<Customer> {
15
- return this._client.post('/v1/subscriptions/customers', { body, ...options });
16
- }
17
-
18
- /**
19
- * Update Customer
20
- */
21
- update(
22
- customerID: string,
23
- body: CustomerUpdateParams | null | undefined = {},
24
- options?: RequestOptions,
25
- ): APIPromise<Customer> {
26
- return this._client.patch(path`/v1/subscriptions/customers/${customerID}`, { body, ...options });
27
- }
28
-
29
- /**
30
- * List Customers
31
- */
32
- list(
33
- query: CustomerListParams | null | undefined = {},
34
- options?: RequestOptions,
35
- ): PagePromise<CustomersCursorIDPage, Customer> {
36
- return this._client.getAPIList('/v1/subscriptions/customers', CursorIDPage<Customer>, {
37
- query,
38
- ...options,
39
- });
40
- }
41
-
42
- /**
43
- * Delete Customer
44
- */
45
- delete(customerID: string, options?: RequestOptions): APIPromise<void> {
46
- return this._client.delete(path`/v1/subscriptions/customers/${customerID}`, {
47
- ...options,
48
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
49
- });
50
- }
51
-
52
- /**
53
- * Open Customer Portal
54
- */
55
- billingPortal(
56
- customerID: string,
57
- body: CustomerBillingPortalParams | null | undefined = {},
58
- options?: RequestOptions,
59
- ): APIPromise<CustomerBillingPortalResponse> {
60
- return this._client.post(path`/v1/subscriptions/customers/${customerID}/billing_portal`, {
61
- body,
62
- ...options,
63
- });
64
- }
65
-
66
- /**
67
- * Get Customer
68
- */
69
- get(customerID: string, options?: RequestOptions): APIPromise<Customer> {
70
- return this._client.get(path`/v1/subscriptions/customers/${customerID}`, options);
71
- }
72
- }
73
-
74
- export type CustomersCursorIDPage = CursorIDPage<Customer>;
75
-
76
- /**
77
- * A subscription customer
78
- */
79
- export interface Customer {
80
- /**
81
- * An id for a data item
82
- */
83
- id: string;
84
-
85
- created: string;
86
-
87
- /**
88
- * Customer billing address
89
- */
90
- address?: CustomerAddress | null;
91
-
92
- email?: string | null;
93
-
94
- name?: string | null;
95
-
96
- phone?: string | null;
97
-
98
- stripe_id?: string | null;
99
- }
100
-
101
- /**
102
- * Customer billing address
103
- */
104
- export interface CustomerAddress {
105
- city?: string | null;
106
-
107
- country?: string | null;
108
-
109
- line1?: string | null;
110
-
111
- line2?: string | null;
112
-
113
- postal_code?: string | null;
114
-
115
- state?: string | null;
116
- }
117
-
118
- /**
119
- * Billing portal session URL
120
- */
121
- export interface CustomerBillingPortalResponse {
122
- url: string;
123
- }
124
-
125
- export interface CustomerCreateParams {
126
- /**
127
- * Customer billing address
128
- */
129
- address?: CustomerAddress;
130
-
131
- email?: string;
132
-
133
- name?: string;
134
-
135
- phone?: string;
136
- }
137
-
138
- export interface CustomerUpdateParams {
139
- /**
140
- * Customer billing address
141
- */
142
- address?: CustomerAddress;
143
-
144
- email?: string;
145
-
146
- name?: string;
147
-
148
- phone?: string;
149
- }
150
-
151
- export interface CustomerListParams extends CursorIDPageParams {}
152
-
153
- export interface CustomerBillingPortalParams {
154
- return_url?: string;
155
- }
156
-
157
- export declare namespace Customers {
158
- export {
159
- type Customer as Customer,
160
- type CustomerAddress as CustomerAddress,
161
- type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
162
- type CustomersCursorIDPage as CustomersCursorIDPage,
163
- type CustomerCreateParams as CustomerCreateParams,
164
- type CustomerUpdateParams as CustomerUpdateParams,
165
- type CustomerListParams as CustomerListParams,
166
- type CustomerBillingPortalParams as CustomerBillingPortalParams,
167
- };
168
- }
@@ -1,18 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export {
4
- Entitlements,
5
- type PlanEntitlement,
6
- type EntitlementListParams,
7
- type EntitlementAttachParams,
8
- type EntitlementRemoveParams,
9
- type PlanEntitlementsCursorIDPage,
10
- } from './entitlements';
11
- export {
12
- Plans,
13
- type Plan,
14
- type PlanCreateParams,
15
- type PlanUpdateParams,
16
- type PlanListParams,
17
- type PlansCursorIDPage,
18
- } from './plans';
@@ -1,159 +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 {
6
- EntitlementAttachParams,
7
- EntitlementListParams,
8
- EntitlementRemoveParams,
9
- Entitlements,
10
- PlanEntitlement,
11
- PlanEntitlementsCursorIDPage,
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 Plans extends APIResource {
19
- entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
20
-
21
- /**
22
- * Create Plan
23
- */
24
- create(body: PlanCreateParams, options?: RequestOptions): APIPromise<Plan> {
25
- return this._client.post('/v1/subscriptions/plans', { body, ...options });
26
- }
27
-
28
- /**
29
- * Update Plan
30
- */
31
- update(
32
- planID: string,
33
- body: PlanUpdateParams | null | undefined = {},
34
- options?: RequestOptions,
35
- ): APIPromise<Plan> {
36
- return this._client.patch(path`/v1/subscriptions/plans/${planID}`, { body, ...options });
37
- }
38
-
39
- /**
40
- * List Plans
41
- */
42
- list(
43
- query: PlanListParams | null | undefined = {},
44
- options?: RequestOptions,
45
- ): PagePromise<PlansCursorIDPage, Plan> {
46
- return this._client.getAPIList('/v1/subscriptions/plans', CursorIDPage<Plan>, { query, ...options });
47
- }
48
-
49
- /**
50
- * Archive Plan
51
- */
52
- archive(planID: string, options?: RequestOptions): APIPromise<Plan> {
53
- return this._client.delete(path`/v1/subscriptions/plans/${planID}`, options);
54
- }
55
-
56
- /**
57
- * Get Plan
58
- */
59
- get(planID: string, options?: RequestOptions): APIPromise<Plan> {
60
- return this._client.get(path`/v1/subscriptions/plans/${planID}`, options);
61
- }
62
- }
63
-
64
- export type PlansCursorIDPage = CursorIDPage<Plan>;
65
-
66
- /**
67
- * A subscription plan
68
- */
69
- export interface Plan {
70
- /**
71
- * An id for a data item
72
- */
73
- id: string;
74
-
75
- active: boolean;
76
-
77
- created: string;
78
-
79
- name: string;
80
-
81
- stripe_product_id: string;
82
-
83
- /**
84
- * A recurring price for a plan
85
- */
86
- default_price?: Plan.DefaultPrice | null;
87
-
88
- description?: string | null;
89
- }
90
-
91
- export namespace Plan {
92
- /**
93
- * A recurring price for a plan
94
- */
95
- export interface DefaultPrice {
96
- /**
97
- * An id for a data item
98
- */
99
- id: string;
100
-
101
- currency: string;
102
-
103
- interval: 'day' | 'week' | 'month' | 'year';
104
-
105
- interval_count: number;
106
-
107
- unit_amount: number | null;
108
- }
109
- }
110
-
111
- export interface PlanCreateParams {
112
- name: string;
113
-
114
- /**
115
- * Amount in cents
116
- */
117
- unit_amount: number;
118
-
119
- currency?: string;
120
-
121
- description?: string;
122
-
123
- interval?: 'day' | 'week' | 'month' | 'year';
124
-
125
- interval_count?: number;
126
- }
127
-
128
- export interface PlanUpdateParams {
129
- active?: boolean;
130
-
131
- description?: string;
132
-
133
- name?: string;
134
- }
135
-
136
- export interface PlanListParams extends CursorIDPageParams {
137
- active?: boolean;
138
- }
139
-
140
- Plans.Entitlements = Entitlements;
141
-
142
- export declare namespace Plans {
143
- export {
144
- type Plan as Plan,
145
- type PlansCursorIDPage as PlansCursorIDPage,
146
- type PlanCreateParams as PlanCreateParams,
147
- type PlanUpdateParams as PlanUpdateParams,
148
- type PlanListParams as PlanListParams,
149
- };
150
-
151
- export {
152
- Entitlements as Entitlements,
153
- type PlanEntitlement as PlanEntitlement,
154
- type PlanEntitlementsCursorIDPage as PlanEntitlementsCursorIDPage,
155
- type EntitlementListParams as EntitlementListParams,
156
- type EntitlementAttachParams as EntitlementAttachParams,
157
- type EntitlementRemoveParams as EntitlementRemoveParams,
158
- };
159
- }
@@ -1,241 +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 CouponsAPI from './coupons';
5
- import {
6
- Coupon,
7
- CouponCreateParams,
8
- CouponListParams,
9
- CouponUpdateParams,
10
- Coupons,
11
- CouponsCursorIDPage,
12
- } from './coupons';
13
- import * as CustomersAPI from './customers';
14
- import {
15
- Customer,
16
- CustomerAddress,
17
- CustomerBillingPortalParams,
18
- CustomerBillingPortalResponse,
19
- CustomerCreateParams,
20
- CustomerListParams,
21
- CustomerUpdateParams,
22
- Customers,
23
- CustomersCursorIDPage,
24
- } from './customers';
25
- import * as EntitlementsAPI from './entitlements';
26
- import {
27
- Entitlement,
28
- EntitlementCreateParams,
29
- EntitlementListParams,
30
- EntitlementUpdateParams,
31
- Entitlements,
32
- EntitlementsCursorIDPage,
33
- } from './entitlements';
34
- import * as PlansAPI from './plans/plans';
35
- import {
36
- Plan,
37
- PlanCreateParams,
38
- PlanListParams,
39
- PlanUpdateParams,
40
- Plans,
41
- PlansCursorIDPage,
42
- } from './plans/plans';
43
- import { APIPromise } from '../../../core/api-promise';
44
- import { RequestOptions } from '../../../internal/request-options';
45
-
46
- export class Subscriptions extends APIResource {
47
- customers: CustomersAPI.Customers = new CustomersAPI.Customers(this._client);
48
- plans: PlansAPI.Plans = new PlansAPI.Plans(this._client);
49
- entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
50
- coupons: CouponsAPI.Coupons = new CouponsAPI.Coupons(this._client);
51
-
52
- /**
53
- * Cancel Subscription
54
- */
55
- cancel(body: SubscriptionCancelParams, options?: RequestOptions): APIPromise<SubscriptionCancelResponse> {
56
- return this._client.post('/v1/subscriptions/cancel', { body, ...options });
57
- }
58
-
59
- /**
60
- * Check Entitlement
61
- */
62
- check(body: SubscriptionCheckParams, options?: RequestOptions): APIPromise<SubscriptionCheckResponse> {
63
- return this._client.post('/v1/subscriptions/check', { body, ...options });
64
- }
65
-
66
- /**
67
- * Create Checkout Session
68
- */
69
- checkout(
70
- body: SubscriptionCheckoutParams,
71
- options?: RequestOptions,
72
- ): APIPromise<SubscriptionCheckoutResponse> {
73
- return this._client.post('/v1/subscriptions/checkout', { body, ...options });
74
- }
75
- }
76
-
77
- /**
78
- * Cancel subscription response
79
- */
80
- export interface SubscriptionCancelResponse {
81
- /**
82
- * The subscription ID
83
- */
84
- id: string;
85
-
86
- /**
87
- * Whether the subscription will cancel at period end
88
- */
89
- cancel_at_period_end: boolean;
90
-
91
- /**
92
- * The subscription status
93
- */
94
- status: string;
95
-
96
- /**
97
- * When the subscription was canceled
98
- */
99
- canceled_at?: string | null;
100
- }
101
-
102
- /**
103
- * Check entitlement response
104
- */
105
- export interface SubscriptionCheckResponse {
106
- /**
107
- * Whether the customer has the entitlement
108
- */
109
- has_entitlement: boolean;
110
-
111
- /**
112
- * The entitlement lookup key that was checked
113
- */
114
- lookup_key: string;
115
-
116
- /**
117
- * The active entitlement ID if present
118
- */
119
- entitlement_id?: string | null;
120
- }
121
-
122
- /**
123
- * Checkout session response
124
- */
125
- export interface SubscriptionCheckoutResponse {
126
- /**
127
- * The checkout session ID
128
- */
129
- id: string;
130
-
131
- /**
132
- * The checkout URL to redirect the customer to
133
- */
134
- url: string;
135
- }
136
-
137
- export interface SubscriptionCancelParams {
138
- /**
139
- * The customer ID
140
- */
141
- customer_id: string;
142
-
143
- /**
144
- * The subscription ID to cancel
145
- */
146
- subscription_id: string;
147
-
148
- /**
149
- * Whether to cancel at period end or immediately
150
- */
151
- cancel_at_period_end?: boolean;
152
- }
153
-
154
- export interface SubscriptionCheckParams {
155
- /**
156
- * The customer ID
157
- */
158
- customer_id: string;
159
-
160
- /**
161
- * The entitlement feature lookup key to check
162
- */
163
- entitlement_lookup_key: string;
164
- }
165
-
166
- export interface SubscriptionCheckoutParams {
167
- /**
168
- * The customer ID
169
- */
170
- customer_id: string;
171
-
172
- /**
173
- * The plan ID to subscribe to
174
- */
175
- plan_id: string;
176
-
177
- /**
178
- * URL to redirect on cancel
179
- */
180
- cancel_url?: string;
181
-
182
- /**
183
- * URL to redirect on success
184
- */
185
- success_url?: string;
186
- }
187
-
188
- Subscriptions.Customers = Customers;
189
- Subscriptions.Plans = Plans;
190
- Subscriptions.Entitlements = Entitlements;
191
- Subscriptions.Coupons = Coupons;
192
-
193
- export declare namespace Subscriptions {
194
- export {
195
- type SubscriptionCancelResponse as SubscriptionCancelResponse,
196
- type SubscriptionCheckResponse as SubscriptionCheckResponse,
197
- type SubscriptionCheckoutResponse as SubscriptionCheckoutResponse,
198
- type SubscriptionCancelParams as SubscriptionCancelParams,
199
- type SubscriptionCheckParams as SubscriptionCheckParams,
200
- type SubscriptionCheckoutParams as SubscriptionCheckoutParams,
201
- };
202
-
203
- export {
204
- Customers as Customers,
205
- type Customer as Customer,
206
- type CustomerAddress as CustomerAddress,
207
- type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
208
- type CustomersCursorIDPage as CustomersCursorIDPage,
209
- type CustomerCreateParams as CustomerCreateParams,
210
- type CustomerUpdateParams as CustomerUpdateParams,
211
- type CustomerListParams as CustomerListParams,
212
- type CustomerBillingPortalParams as CustomerBillingPortalParams,
213
- };
214
-
215
- export {
216
- Plans as Plans,
217
- type Plan as Plan,
218
- type PlansCursorIDPage as PlansCursorIDPage,
219
- type PlanCreateParams as PlanCreateParams,
220
- type PlanUpdateParams as PlanUpdateParams,
221
- type PlanListParams as PlanListParams,
222
- };
223
-
224
- export {
225
- Entitlements as Entitlements,
226
- type Entitlement as Entitlement,
227
- type EntitlementsCursorIDPage as EntitlementsCursorIDPage,
228
- type EntitlementCreateParams as EntitlementCreateParams,
229
- type EntitlementUpdateParams as EntitlementUpdateParams,
230
- type EntitlementListParams as EntitlementListParams,
231
- };
232
-
233
- export {
234
- Coupons as Coupons,
235
- type Coupon as Coupon,
236
- type CouponsCursorIDPage as CouponsCursorIDPage,
237
- type CouponCreateParams as CouponCreateParams,
238
- type CouponUpdateParams as CouponUpdateParams,
239
- type CouponListParams as CouponListParams,
240
- };
241
- }