@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
@@ -1,42 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../../core/resource.mjs";
3
- import * as CouponsAPI from "./coupons.mjs";
4
- import { Coupons, } from "./coupons.mjs";
5
- import * as CustomersAPI from "./customers.mjs";
6
- import { Customers, } from "./customers.mjs";
7
- import * as EntitlementsAPI from "./entitlements.mjs";
8
- import { Entitlements, } from "./entitlements.mjs";
9
- import * as PlansAPI from "./plans/plans.mjs";
10
- import { Plans, } from "./plans/plans.mjs";
11
- export class Subscriptions extends APIResource {
12
- constructor() {
13
- super(...arguments);
14
- this.customers = new CustomersAPI.Customers(this._client);
15
- this.plans = new PlansAPI.Plans(this._client);
16
- this.entitlements = new EntitlementsAPI.Entitlements(this._client);
17
- this.coupons = new CouponsAPI.Coupons(this._client);
18
- }
19
- /**
20
- * Cancel Subscription
21
- */
22
- cancel(body, options) {
23
- return this._client.post('/v1/subscriptions/cancel', { body, ...options });
24
- }
25
- /**
26
- * Check Entitlement
27
- */
28
- check(body, options) {
29
- return this._client.post('/v1/subscriptions/check', { body, ...options });
30
- }
31
- /**
32
- * Create Checkout Session
33
- */
34
- checkout(body, options) {
35
- return this._client.post('/v1/subscriptions/checkout', { body, ...options });
36
- }
37
- }
38
- Subscriptions.Customers = Customers;
39
- Subscriptions.Plans = Plans;
40
- Subscriptions.Entitlements = Entitlements;
41
- Subscriptions.Coupons = Coupons;
42
- //# sourceMappingURL=subscriptions.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../../../src/resources/beta/subscriptions/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAKL,OAAO,GAER;OACM,KAAK,YAAY;OACjB,EAQL,SAAS,GAEV;OACM,KAAK,eAAe;OACpB,EAKL,YAAY,GAEb;OACM,KAAK,QAAQ;OACb,EAKL,KAAK,GAEN;AAID,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAyBrE,CAAC;IAvBC;;OAEG;IACH,MAAM,CAAC,IAA8B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAA6B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF;AAiHD,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;AACpC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;AAC5B,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC;AAC1C,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./subscriptions/index.mjs";
2
- //# sourceMappingURL=subscriptions.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.d.mts","sourceRoot":"","sources":["../../src/resources/beta/subscriptions.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from "./subscriptions/index.js";
2
- //# sourceMappingURL=subscriptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/beta/subscriptions.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/resources/beta/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,mEAAsC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../../src/resources/beta/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
@@ -1,185 +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 Coupons extends APIResource {
11
- /**
12
- * Create Coupon
13
- */
14
- create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon> {
15
- return this._client.post('/v1/subscriptions/coupons', { body, ...options });
16
- }
17
-
18
- /**
19
- * Update Coupon
20
- */
21
- update(
22
- couponID: string,
23
- body: CouponUpdateParams | null | undefined = {},
24
- options?: RequestOptions,
25
- ): APIPromise<Coupon> {
26
- return this._client.patch(path`/v1/subscriptions/coupons/${couponID}`, { body, ...options });
27
- }
28
-
29
- /**
30
- * List Coupons
31
- */
32
- list(
33
- query: CouponListParams | null | undefined = {},
34
- options?: RequestOptions,
35
- ): PagePromise<CouponsCursorIDPage, Coupon> {
36
- return this._client.getAPIList('/v1/subscriptions/coupons', CursorIDPage<Coupon>, { query, ...options });
37
- }
38
-
39
- /**
40
- * Delete Coupon
41
- */
42
- delete(couponID: string, options?: RequestOptions): APIPromise<void> {
43
- return this._client.delete(path`/v1/subscriptions/coupons/${couponID}`, {
44
- ...options,
45
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
46
- });
47
- }
48
-
49
- /**
50
- * Get Coupon
51
- */
52
- get(couponID: string, options?: RequestOptions): APIPromise<Coupon> {
53
- return this._client.get(path`/v1/subscriptions/coupons/${couponID}`, options);
54
- }
55
- }
56
-
57
- export type CouponsCursorIDPage = CursorIDPage<Coupon>;
58
-
59
- /**
60
- * A coupon/promo code for discounts
61
- */
62
- export interface Coupon {
63
- /**
64
- * An id for a data item
65
- */
66
- id: string;
67
-
68
- active: boolean;
69
-
70
- /**
71
- * The promo code
72
- */
73
- code: string;
74
-
75
- created: string;
76
-
77
- duration: 'once' | 'repeating' | 'forever';
78
-
79
- /**
80
- * Number of times this coupon has been redeemed
81
- */
82
- times_redeemed: number;
83
-
84
- /**
85
- * Fixed amount discount in cents
86
- */
87
- amount_off?: number | null;
88
-
89
- /**
90
- * Currency for amount_off
91
- */
92
- currency?: string | null;
93
-
94
- /**
95
- * Number of months for repeating duration
96
- */
97
- duration_in_months?: number | null;
98
-
99
- /**
100
- * Maximum number of times this coupon can be redeemed
101
- */
102
- max_redemptions?: number | null;
103
-
104
- name?: string | null;
105
-
106
- /**
107
- * Percentage discount (1-100)
108
- */
109
- percent_off?: number | null;
110
-
111
- /**
112
- * Date after which the coupon can no longer be redeemed
113
- */
114
- redeem_by?: string | null;
115
- }
116
-
117
- export interface CouponCreateParams {
118
- /**
119
- * The promo code customers will enter
120
- */
121
- code: string;
122
-
123
- /**
124
- * Fixed amount discount in cents
125
- */
126
- amount_off?: number;
127
-
128
- /**
129
- * Currency for amount_off
130
- */
131
- currency?: string;
132
-
133
- duration?: 'once' | 'repeating' | 'forever';
134
-
135
- /**
136
- * Number of months for repeating duration
137
- */
138
- duration_in_months?: number;
139
-
140
- /**
141
- * Maximum number of redemptions
142
- */
143
- max_redemptions?: number;
144
-
145
- /**
146
- * Display name for the coupon
147
- */
148
- name?: string;
149
-
150
- /**
151
- * Percentage discount (1-100)
152
- */
153
- percent_off?: number;
154
-
155
- /**
156
- * Expiration date for the coupon
157
- */
158
- redeem_by?: string;
159
- }
160
-
161
- export interface CouponUpdateParams {
162
- /**
163
- * Whether the coupon is active
164
- */
165
- active?: boolean;
166
-
167
- /**
168
- * Display name for the coupon
169
- */
170
- name?: string;
171
- }
172
-
173
- export interface CouponListParams extends CursorIDPageParams {
174
- active?: boolean;
175
- }
176
-
177
- export declare namespace Coupons {
178
- export {
179
- type Coupon as Coupon,
180
- type CouponsCursorIDPage as CouponsCursorIDPage,
181
- type CouponCreateParams as CouponCreateParams,
182
- type CouponUpdateParams as CouponUpdateParams,
183
- type CouponListParams as CouponListParams,
184
- };
185
- }
@@ -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,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
- * Create Entitlement
12
- */
13
- create(body: EntitlementCreateParams, options?: RequestOptions): APIPromise<Entitlement> {
14
- return this._client.post('/v1/subscriptions/entitlements', { body, ...options });
15
- }
16
-
17
- /**
18
- * Update Entitlement
19
- */
20
- update(
21
- entitlementID: string,
22
- body: EntitlementUpdateParams | null | undefined = {},
23
- options?: RequestOptions,
24
- ): APIPromise<Entitlement> {
25
- return this._client.patch(path`/v1/subscriptions/entitlements/${entitlementID}`, { body, ...options });
26
- }
27
-
28
- /**
29
- * List Entitlements
30
- */
31
- list(
32
- query: EntitlementListParams | null | undefined = {},
33
- options?: RequestOptions,
34
- ): PagePromise<EntitlementsCursorIDPage, Entitlement> {
35
- return this._client.getAPIList('/v1/subscriptions/entitlements', CursorIDPage<Entitlement>, {
36
- query,
37
- ...options,
38
- });
39
- }
40
-
41
- /**
42
- * Get Entitlement
43
- */
44
- get(entitlementID: string, options?: RequestOptions): APIPromise<Entitlement> {
45
- return this._client.get(path`/v1/subscriptions/entitlements/${entitlementID}`, options);
46
- }
47
- }
48
-
49
- export type EntitlementsCursorIDPage = CursorIDPage<Entitlement>;
50
-
51
- /**
52
- * An entitlement that can be attached to products
53
- */
54
- export interface Entitlement {
55
- /**
56
- * An id for a data item
57
- */
58
- id: string;
59
-
60
- active: boolean;
61
-
62
- livemode: boolean;
63
-
64
- lookup_key: string;
65
-
66
- name: string;
67
- }
68
-
69
- export interface EntitlementCreateParams {
70
- /**
71
- * A unique key to identify the entitlement in your system
72
- */
73
- lookup_key: string;
74
-
75
- /**
76
- * The name of the entitlement
77
- */
78
- name: string;
79
- }
80
-
81
- export interface EntitlementUpdateParams {
82
- /**
83
- * Whether the entitlement is active
84
- */
85
- active?: boolean;
86
-
87
- /**
88
- * The name of the entitlement
89
- */
90
- name?: string;
91
- }
92
-
93
- export interface EntitlementListParams extends CursorIDPageParams {
94
- /**
95
- * Filter by archived status
96
- */
97
- archived?: boolean;
98
-
99
- /**
100
- * Filter by lookup key
101
- */
102
- lookup_key?: string;
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,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
- }