@stigg/typescript 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (317) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +40 -0
  3. package/client.d.mts +6 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +23 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +24 -22
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +11 -5
  12. package/core/pagination.d.mts.map +1 -1
  13. package/core/pagination.d.ts +11 -5
  14. package/core/pagination.d.ts.map +1 -1
  15. package/core/pagination.js +9 -9
  16. package/core/pagination.js.map +1 -1
  17. package/core/pagination.mjs +9 -9
  18. package/core/pagination.mjs.map +1 -1
  19. package/internal/parse.d.mts.map +1 -1
  20. package/internal/parse.d.ts.map +1 -1
  21. package/internal/parse.js +5 -0
  22. package/internal/parse.js.map +1 -1
  23. package/internal/parse.mjs +5 -0
  24. package/internal/parse.mjs.map +1 -1
  25. package/internal/qs/formats.d.mts +7 -0
  26. package/internal/qs/formats.d.mts.map +1 -0
  27. package/internal/qs/formats.d.ts +7 -0
  28. package/internal/qs/formats.d.ts.map +1 -0
  29. package/internal/qs/formats.js +13 -0
  30. package/internal/qs/formats.js.map +1 -0
  31. package/internal/qs/formats.mjs +9 -0
  32. package/internal/qs/formats.mjs.map +1 -0
  33. package/internal/qs/index.d.mts +10 -0
  34. package/internal/qs/index.d.mts.map +1 -0
  35. package/internal/qs/index.d.ts +10 -0
  36. package/internal/qs/index.d.ts.map +1 -0
  37. package/internal/qs/index.js +14 -0
  38. package/internal/qs/index.js.map +1 -0
  39. package/internal/qs/index.mjs +10 -0
  40. package/internal/qs/index.mjs.map +1 -0
  41. package/internal/qs/stringify.d.mts +3 -0
  42. package/internal/qs/stringify.d.mts.map +1 -0
  43. package/internal/qs/stringify.d.ts +3 -0
  44. package/internal/qs/stringify.d.ts.map +1 -0
  45. package/internal/qs/stringify.js +277 -0
  46. package/internal/qs/stringify.js.map +1 -0
  47. package/internal/qs/stringify.mjs +274 -0
  48. package/internal/qs/stringify.mjs.map +1 -0
  49. package/internal/qs/types.d.mts +57 -0
  50. package/internal/qs/types.d.mts.map +1 -0
  51. package/internal/qs/types.d.ts +57 -0
  52. package/internal/qs/types.d.ts.map +1 -0
  53. package/internal/qs/types.js +3 -0
  54. package/internal/qs/types.js.map +1 -0
  55. package/internal/qs/types.mjs +2 -0
  56. package/internal/qs/types.mjs.map +1 -0
  57. package/internal/qs/utils.d.mts +15 -0
  58. package/internal/qs/utils.d.mts.map +1 -0
  59. package/internal/qs/utils.d.ts +15 -0
  60. package/internal/qs/utils.d.ts.map +1 -0
  61. package/internal/qs/utils.js +230 -0
  62. package/internal/qs/utils.js.map +1 -0
  63. package/internal/qs/utils.mjs +217 -0
  64. package/internal/qs/utils.mjs.map +1 -0
  65. package/package.json +1 -1
  66. package/resources/index.d.mts +1 -1
  67. package/resources/index.d.mts.map +1 -1
  68. package/resources/index.d.ts +1 -1
  69. package/resources/index.d.ts.map +1 -1
  70. package/resources/index.js.map +1 -1
  71. package/resources/index.mjs +1 -1
  72. package/resources/index.mjs.map +1 -1
  73. package/resources/v1/addons/addons.d.mts +1298 -0
  74. package/resources/v1/addons/addons.d.mts.map +1 -0
  75. package/resources/v1/addons/addons.d.ts +1298 -0
  76. package/resources/v1/addons/addons.d.ts.map +1 -0
  77. package/resources/v1/addons/addons.js +78 -0
  78. package/resources/v1/addons/addons.js.map +1 -0
  79. package/resources/v1/addons/addons.mjs +73 -0
  80. package/resources/v1/addons/addons.mjs.map +1 -0
  81. package/resources/v1/addons/entitlements.d.mts +747 -0
  82. package/resources/v1/addons/entitlements.d.mts.map +1 -0
  83. package/resources/v1/addons/entitlements.d.ts +747 -0
  84. package/resources/v1/addons/entitlements.d.ts.map +1 -0
  85. package/resources/v1/addons/entitlements.js +36 -0
  86. package/resources/v1/addons/entitlements.js.map +1 -0
  87. package/resources/v1/addons/entitlements.mjs +32 -0
  88. package/resources/v1/addons/entitlements.mjs.map +1 -0
  89. package/resources/v1/addons/index.d.mts +3 -0
  90. package/resources/v1/addons/index.d.mts.map +1 -0
  91. package/resources/v1/addons/index.d.ts +3 -0
  92. package/resources/v1/addons/index.d.ts.map +1 -0
  93. package/resources/v1/addons/index.js +9 -0
  94. package/resources/v1/addons/index.js.map +1 -0
  95. package/resources/v1/addons/index.mjs +4 -0
  96. package/resources/v1/addons/index.mjs.map +1 -0
  97. package/resources/v1/addons.d.mts +2 -0
  98. package/resources/v1/addons.d.mts.map +1 -0
  99. package/resources/v1/addons.d.ts +2 -0
  100. package/resources/v1/addons.d.ts.map +1 -0
  101. package/resources/v1/addons.js +6 -0
  102. package/resources/v1/addons.js.map +1 -0
  103. package/resources/v1/addons.mjs +3 -0
  104. package/resources/v1/addons.mjs.map +1 -0
  105. package/resources/v1/coupons.d.mts +154 -157
  106. package/resources/v1/coupons.d.mts.map +1 -1
  107. package/resources/v1/coupons.d.ts +154 -157
  108. package/resources/v1/coupons.d.ts.map +1 -1
  109. package/resources/v1/coupons.js +21 -4
  110. package/resources/v1/coupons.js.map +1 -1
  111. package/resources/v1/coupons.mjs +21 -4
  112. package/resources/v1/coupons.mjs.map +1 -1
  113. package/resources/v1/customers/customers.d.mts +247 -118
  114. package/resources/v1/customers/customers.d.mts.map +1 -1
  115. package/resources/v1/customers/customers.d.ts +247 -118
  116. package/resources/v1/customers/customers.d.ts.map +1 -1
  117. package/resources/v1/customers/customers.js +37 -16
  118. package/resources/v1/customers/customers.js.map +1 -1
  119. package/resources/v1/customers/customers.mjs +37 -16
  120. package/resources/v1/customers/customers.mjs.map +1 -1
  121. package/resources/v1/customers/index.d.mts +2 -2
  122. package/resources/v1/customers/index.d.mts.map +1 -1
  123. package/resources/v1/customers/index.d.ts +2 -2
  124. package/resources/v1/customers/index.d.ts.map +1 -1
  125. package/resources/v1/customers/index.js +3 -3
  126. package/resources/v1/customers/index.js.map +1 -1
  127. package/resources/v1/customers/index.mjs +1 -1
  128. package/resources/v1/customers/index.mjs.map +1 -1
  129. package/resources/v1/customers/payment-method.d.mts +7 -2
  130. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  131. package/resources/v1/customers/payment-method.d.ts +7 -2
  132. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  133. package/resources/v1/customers/payment-method.js +4 -2
  134. package/resources/v1/customers/payment-method.js.map +1 -1
  135. package/resources/v1/customers/payment-method.mjs +4 -2
  136. package/resources/v1/customers/payment-method.mjs.map +1 -1
  137. package/resources/v1/customers/promotional-entitlements.d.mts +498 -0
  138. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
  139. package/resources/v1/customers/promotional-entitlements.d.ts +498 -0
  140. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
  141. package/resources/v1/customers/promotional-entitlements.js +32 -0
  142. package/resources/v1/customers/promotional-entitlements.js.map +1 -0
  143. package/resources/v1/customers/promotional-entitlements.mjs +28 -0
  144. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
  145. package/resources/v1/events.d.mts +63 -0
  146. package/resources/v1/events.d.mts.map +1 -0
  147. package/resources/v1/events.d.ts +63 -0
  148. package/resources/v1/events.d.ts.map +1 -0
  149. package/resources/v1/events.js +16 -0
  150. package/resources/v1/events.js.map +1 -0
  151. package/resources/v1/events.mjs +12 -0
  152. package/resources/v1/events.mjs.map +1 -0
  153. package/resources/v1/features.d.mts +444 -0
  154. package/resources/v1/features.d.mts.map +1 -0
  155. package/resources/v1/features.d.ts +444 -0
  156. package/resources/v1/features.d.ts.map +1 -0
  157. package/resources/v1/features.js +51 -0
  158. package/resources/v1/features.js.map +1 -0
  159. package/resources/v1/features.mjs +47 -0
  160. package/resources/v1/features.mjs.map +1 -0
  161. package/resources/v1/index.d.mts +10 -4
  162. package/resources/v1/index.d.mts.map +1 -1
  163. package/resources/v1/index.d.ts +10 -4
  164. package/resources/v1/index.d.ts.map +1 -1
  165. package/resources/v1/index.js +17 -5
  166. package/resources/v1/index.js.map +1 -1
  167. package/resources/v1/index.mjs +7 -1
  168. package/resources/v1/index.mjs.map +1 -1
  169. package/resources/v1/plans/entitlements.d.mts +747 -0
  170. package/resources/v1/plans/entitlements.d.mts.map +1 -0
  171. package/resources/v1/plans/entitlements.d.ts +747 -0
  172. package/resources/v1/plans/entitlements.d.ts.map +1 -0
  173. package/resources/v1/plans/entitlements.js +36 -0
  174. package/resources/v1/plans/entitlements.js.map +1 -0
  175. package/resources/v1/plans/entitlements.mjs +32 -0
  176. package/resources/v1/plans/entitlements.mjs.map +1 -0
  177. package/resources/v1/plans/index.d.mts +3 -0
  178. package/resources/v1/plans/index.d.mts.map +1 -0
  179. package/resources/v1/plans/index.d.ts +3 -0
  180. package/resources/v1/plans/index.d.ts.map +1 -0
  181. package/resources/v1/plans/index.js +9 -0
  182. package/resources/v1/plans/index.js.map +1 -0
  183. package/resources/v1/plans/index.mjs +4 -0
  184. package/resources/v1/plans/index.mjs.map +1 -0
  185. package/resources/v1/plans/plans.d.mts +973 -0
  186. package/resources/v1/plans/plans.d.mts.map +1 -0
  187. package/resources/v1/plans/plans.d.ts +973 -0
  188. package/resources/v1/plans/plans.d.ts.map +1 -0
  189. package/resources/v1/plans/plans.js +76 -0
  190. package/resources/v1/plans/plans.js.map +1 -0
  191. package/resources/v1/plans/plans.mjs +71 -0
  192. package/resources/v1/plans/plans.mjs.map +1 -0
  193. package/resources/v1/plans.d.mts +2 -0
  194. package/resources/v1/plans.d.mts.map +1 -0
  195. package/resources/v1/plans.d.ts +2 -0
  196. package/resources/v1/plans.d.ts.map +1 -0
  197. package/resources/v1/plans.js +6 -0
  198. package/resources/v1/plans.js.map +1 -0
  199. package/resources/v1/plans.mjs +3 -0
  200. package/resources/v1/plans.mjs.map +1 -0
  201. package/resources/v1/products.d.mts +332 -0
  202. package/resources/v1/products.d.mts.map +1 -0
  203. package/resources/v1/products.d.ts +332 -0
  204. package/resources/v1/products.d.ts.map +1 -0
  205. package/resources/v1/products.js +52 -0
  206. package/resources/v1/products.js.map +1 -0
  207. package/resources/v1/products.mjs +48 -0
  208. package/resources/v1/products.mjs.map +1 -0
  209. package/resources/v1/subscriptions/future-update.d.mts +12 -19
  210. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  211. package/resources/v1/subscriptions/future-update.d.ts +12 -19
  212. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  213. package/resources/v1/subscriptions/future-update.js +3 -2
  214. package/resources/v1/subscriptions/future-update.js.map +1 -1
  215. package/resources/v1/subscriptions/future-update.mjs +3 -2
  216. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  217. package/resources/v1/subscriptions/index.d.mts +4 -2
  218. package/resources/v1/subscriptions/index.d.mts.map +1 -1
  219. package/resources/v1/subscriptions/index.d.ts +4 -2
  220. package/resources/v1/subscriptions/index.d.ts.map +1 -1
  221. package/resources/v1/subscriptions/index.js +5 -1
  222. package/resources/v1/subscriptions/index.js.map +1 -1
  223. package/resources/v1/subscriptions/index.mjs +3 -1
  224. package/resources/v1/subscriptions/index.mjs.map +1 -1
  225. package/resources/v1/subscriptions/invoice.d.mts +34 -0
  226. package/resources/v1/subscriptions/invoice.d.mts.map +1 -0
  227. package/resources/v1/subscriptions/invoice.d.ts +34 -0
  228. package/resources/v1/subscriptions/invoice.d.ts.map +1 -0
  229. package/resources/v1/subscriptions/invoice.js +17 -0
  230. package/resources/v1/subscriptions/invoice.js.map +1 -0
  231. package/resources/v1/subscriptions/invoice.mjs +13 -0
  232. package/resources/v1/subscriptions/invoice.mjs.map +1 -0
  233. package/resources/v1/subscriptions/subscriptions.d.mts +1565 -518
  234. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  235. package/resources/v1/subscriptions/subscriptions.d.ts +1565 -518
  236. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  237. package/resources/v1/subscriptions/subscriptions.js +52 -12
  238. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  239. package/resources/v1/subscriptions/subscriptions.mjs +53 -13
  240. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  241. package/resources/v1/subscriptions/usage.d.mts +98 -0
  242. package/resources/v1/subscriptions/usage.d.mts.map +1 -0
  243. package/resources/v1/subscriptions/usage.d.ts +98 -0
  244. package/resources/v1/subscriptions/usage.d.ts.map +1 -0
  245. package/resources/v1/subscriptions/usage.js +24 -0
  246. package/resources/v1/subscriptions/usage.js.map +1 -0
  247. package/resources/v1/subscriptions/usage.mjs +20 -0
  248. package/resources/v1/subscriptions/usage.mjs.map +1 -0
  249. package/resources/v1/usage.d.mts +230 -0
  250. package/resources/v1/usage.d.mts.map +1 -0
  251. package/resources/v1/usage.d.ts +230 -0
  252. package/resources/v1/usage.d.ts.map +1 -0
  253. package/resources/v1/usage.js +24 -0
  254. package/resources/v1/usage.js.map +1 -0
  255. package/resources/v1/usage.mjs +20 -0
  256. package/resources/v1/usage.mjs.map +1 -0
  257. package/resources/v1/v1.d.mts +30 -149
  258. package/resources/v1/v1.d.mts.map +1 -1
  259. package/resources/v1/v1.d.ts +30 -149
  260. package/resources/v1/v1.d.ts.map +1 -1
  261. package/resources/v1/v1.js +24 -12
  262. package/resources/v1/v1.js.map +1 -1
  263. package/resources/v1/v1.mjs +24 -12
  264. package/resources/v1/v1.mjs.map +1 -1
  265. package/src/client.ts +33 -40
  266. package/src/core/pagination.ts +24 -18
  267. package/src/internal/parse.ts +6 -0
  268. package/src/internal/qs/LICENSE.md +13 -0
  269. package/src/internal/qs/README.md +3 -0
  270. package/src/internal/qs/formats.ts +10 -0
  271. package/src/internal/qs/index.ts +13 -0
  272. package/src/internal/qs/stringify.ts +385 -0
  273. package/src/internal/qs/types.ts +71 -0
  274. package/src/internal/qs/utils.ts +265 -0
  275. package/src/resources/index.ts +1 -7
  276. package/src/resources/v1/addons/addons.ts +3245 -0
  277. package/src/resources/v1/addons/entitlements.ts +976 -0
  278. package/src/resources/v1/addons/index.ts +26 -0
  279. package/src/resources/v1/addons.ts +3 -0
  280. package/src/resources/v1/coupons.ts +311 -436
  281. package/src/resources/v1/customers/customers.ts +334 -153
  282. package/src/resources/v1/customers/index.ts +17 -2
  283. package/src/resources/v1/customers/payment-method.ts +7 -2
  284. package/src/resources/v1/customers/promotional-entitlements.ts +669 -0
  285. package/src/resources/v1/events.ts +74 -0
  286. package/src/resources/v1/features.ts +571 -0
  287. package/src/resources/v1/index.ts +73 -15
  288. package/src/resources/v1/plans/entitlements.ts +968 -0
  289. package/src/resources/v1/plans/index.ts +24 -0
  290. package/src/resources/v1/plans/plans.ts +2032 -0
  291. package/src/resources/v1/plans.ts +3 -0
  292. package/src/resources/v1/products.ts +423 -0
  293. package/src/resources/v1/subscriptions/future-update.ts +12 -27
  294. package/src/resources/v1/subscriptions/index.ts +16 -11
  295. package/src/resources/v1/subscriptions/invoice.ts +42 -0
  296. package/src/resources/v1/subscriptions/subscriptions.ts +3341 -832
  297. package/src/resources/v1/subscriptions/usage.ts +126 -0
  298. package/src/resources/v1/usage.ts +284 -0
  299. package/src/resources/v1/v1.ts +174 -197
  300. package/src/version.ts +1 -1
  301. package/version.d.mts +1 -1
  302. package/version.d.mts.map +1 -1
  303. package/version.d.ts +1 -1
  304. package/version.d.ts.map +1 -1
  305. package/version.js +1 -1
  306. package/version.js.map +1 -1
  307. package/version.mjs +1 -1
  308. package/version.mjs.map +1 -1
  309. package/resources/v1/customers/usage.d.mts +0 -98
  310. package/resources/v1/customers/usage.d.mts.map +0 -1
  311. package/resources/v1/customers/usage.d.ts +0 -98
  312. package/resources/v1/customers/usage.d.ts.map +0 -1
  313. package/resources/v1/customers/usage.js +0 -20
  314. package/resources/v1/customers/usage.js.map +0 -1
  315. package/resources/v1/customers/usage.mjs +0 -16
  316. package/resources/v1/customers/usage.mjs.map +0 -1
  317. package/src/resources/v1/customers/usage.ts +0 -132
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './plans/index';
@@ -0,0 +1,423 @@
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 { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../core/pagination';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+
9
+ export class Products extends APIResource {
10
+ /**
11
+ * Archives a product, preventing new subscriptions. All plans and addons are
12
+ * archived.
13
+ */
14
+ archiveProduct(id: string, options?: RequestOptions): APIPromise<Product> {
15
+ return this._client.post(path`/api/v1/products/${id}/archive`, options);
16
+ }
17
+
18
+ /**
19
+ * Creates a new product.
20
+ */
21
+ createProduct(body: ProductCreateProductParams, options?: RequestOptions): APIPromise<Product> {
22
+ return this._client.post('/api/v1/products', { body, ...options });
23
+ }
24
+
25
+ /**
26
+ * Duplicates an existing product, including its plans, addons, and configuration.
27
+ */
28
+ duplicateProduct(
29
+ pathID: string,
30
+ body: ProductDuplicateProductParams,
31
+ options?: RequestOptions,
32
+ ): APIPromise<Product> {
33
+ return this._client.post(path`/api/v1/products/${pathID}/duplicate`, { body, ...options });
34
+ }
35
+
36
+ /**
37
+ * Retrieves a paginated list of products in the environment.
38
+ */
39
+ listProducts(
40
+ query: ProductListProductsParams | null | undefined = {},
41
+ options?: RequestOptions,
42
+ ): PagePromise<ProductListProductsResponsesMyCursorIDPage, ProductListProductsResponse> {
43
+ return this._client.getAPIList('/api/v1/products', MyCursorIDPage<ProductListProductsResponse>, {
44
+ query,
45
+ ...options,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Restores an archived product, allowing new subscriptions to be created.
51
+ */
52
+ unarchiveProduct(id: string, options?: RequestOptions): APIPromise<Product> {
53
+ return this._client.post(path`/api/v1/products/${id}/unarchive`, options);
54
+ }
55
+
56
+ /**
57
+ * Updates an existing product's properties such as display name, description, and
58
+ * metadata.
59
+ */
60
+ updateProduct(id: string, body: ProductUpdateProductParams, options?: RequestOptions): APIPromise<Product> {
61
+ return this._client.patch(path`/api/v1/products/${id}`, { body, ...options });
62
+ }
63
+ }
64
+
65
+ export type ProductListProductsResponsesMyCursorIDPage = MyCursorIDPage<ProductListProductsResponse>;
66
+
67
+ /**
68
+ * Response object
69
+ */
70
+ export interface Product {
71
+ /**
72
+ * Product configuration object
73
+ */
74
+ data: Product.Data;
75
+ }
76
+
77
+ export namespace Product {
78
+ /**
79
+ * Product configuration object
80
+ */
81
+ export interface Data {
82
+ /**
83
+ * The unique identifier for the entity
84
+ */
85
+ id: string;
86
+
87
+ /**
88
+ * Timestamp of when the record was created
89
+ */
90
+ createdAt: string;
91
+
92
+ /**
93
+ * Description of the product
94
+ */
95
+ description: string | null;
96
+
97
+ /**
98
+ * Display name of the product
99
+ */
100
+ displayName: string;
101
+
102
+ /**
103
+ * Metadata associated with the entity
104
+ */
105
+ metadata: { [key: string]: string };
106
+
107
+ /**
108
+ * Indicates if multiple subscriptions to this product are allowed
109
+ */
110
+ multipleSubscriptions: boolean;
111
+
112
+ /**
113
+ * The status of the product
114
+ */
115
+ status: 'PUBLISHED' | 'ARCHIVED';
116
+
117
+ /**
118
+ * Timestamp of when the record was last updated
119
+ */
120
+ updatedAt: string;
121
+
122
+ /**
123
+ * Product behavior settings for subscription lifecycle management.
124
+ */
125
+ productSettings?: Data.ProductSettings;
126
+ }
127
+
128
+ export namespace Data {
129
+ /**
130
+ * Product behavior settings for subscription lifecycle management.
131
+ */
132
+ export interface ProductSettings {
133
+ /**
134
+ * Time when the subscription will be cancelled
135
+ */
136
+ subscriptionCancellationTime: 'END_OF_BILLING_PERIOD' | 'IMMEDIATE' | 'SPECIFIC_DATE';
137
+
138
+ /**
139
+ * Setup for the end of the subscription
140
+ */
141
+ subscriptionEndSetup: 'DOWNGRADE_TO_FREE' | 'CANCEL_SUBSCRIPTION';
142
+
143
+ /**
144
+ * Setup for the start of the subscription
145
+ */
146
+ subscriptionStartSetup: 'PLAN_SELECTION' | 'TRIAL_PERIOD' | 'FREE_PLAN';
147
+
148
+ /**
149
+ * ID of the plan to downgrade to at the end of the billing period
150
+ */
151
+ downgradePlanId?: string | null;
152
+
153
+ /**
154
+ * Indicates if the subscription should be prorated at the end of the billing
155
+ * period
156
+ */
157
+ prorateAtEndOfBillingPeriod?: boolean | null;
158
+
159
+ /**
160
+ * ID of the plan to start the subscription with
161
+ */
162
+ subscriptionStartPlanId?: string | null;
163
+ }
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Product configuration object
169
+ */
170
+ export interface ProductListProductsResponse {
171
+ /**
172
+ * The unique identifier for the entity
173
+ */
174
+ id: string;
175
+
176
+ /**
177
+ * Timestamp of when the record was created
178
+ */
179
+ createdAt: string;
180
+
181
+ /**
182
+ * Description of the product
183
+ */
184
+ description: string | null;
185
+
186
+ /**
187
+ * Display name of the product
188
+ */
189
+ displayName: string;
190
+
191
+ /**
192
+ * Metadata associated with the entity
193
+ */
194
+ metadata: { [key: string]: string };
195
+
196
+ /**
197
+ * Indicates if multiple subscriptions to this product are allowed
198
+ */
199
+ multipleSubscriptions: boolean;
200
+
201
+ /**
202
+ * The status of the product
203
+ */
204
+ status: 'PUBLISHED' | 'ARCHIVED';
205
+
206
+ /**
207
+ * Timestamp of when the record was last updated
208
+ */
209
+ updatedAt: string;
210
+
211
+ /**
212
+ * Product behavior settings for subscription lifecycle management.
213
+ */
214
+ productSettings?: ProductListProductsResponse.ProductSettings;
215
+ }
216
+
217
+ export namespace ProductListProductsResponse {
218
+ /**
219
+ * Product behavior settings for subscription lifecycle management.
220
+ */
221
+ export interface ProductSettings {
222
+ /**
223
+ * Time when the subscription will be cancelled
224
+ */
225
+ subscriptionCancellationTime: 'END_OF_BILLING_PERIOD' | 'IMMEDIATE' | 'SPECIFIC_DATE';
226
+
227
+ /**
228
+ * Setup for the end of the subscription
229
+ */
230
+ subscriptionEndSetup: 'DOWNGRADE_TO_FREE' | 'CANCEL_SUBSCRIPTION';
231
+
232
+ /**
233
+ * Setup for the start of the subscription
234
+ */
235
+ subscriptionStartSetup: 'PLAN_SELECTION' | 'TRIAL_PERIOD' | 'FREE_PLAN';
236
+
237
+ /**
238
+ * ID of the plan to downgrade to at the end of the billing period
239
+ */
240
+ downgradePlanId?: string | null;
241
+
242
+ /**
243
+ * Indicates if the subscription should be prorated at the end of the billing
244
+ * period
245
+ */
246
+ prorateAtEndOfBillingPeriod?: boolean | null;
247
+
248
+ /**
249
+ * ID of the plan to start the subscription with
250
+ */
251
+ subscriptionStartPlanId?: string | null;
252
+ }
253
+ }
254
+
255
+ export interface ProductCreateProductParams {
256
+ /**
257
+ * The unique identifier for the entity
258
+ */
259
+ id: string;
260
+
261
+ /**
262
+ * Description of the product
263
+ */
264
+ description?: string | null;
265
+
266
+ /**
267
+ * Display name of the product
268
+ */
269
+ displayName?: string;
270
+
271
+ /**
272
+ * Additional metadata for the product
273
+ */
274
+ metadata?: { [key: string]: string } | null;
275
+
276
+ /**
277
+ * Indicates if multiple subscriptions to this product are allowed
278
+ */
279
+ multipleSubscriptions?: boolean;
280
+ }
281
+
282
+ export interface ProductDuplicateProductParams {
283
+ /**
284
+ * The unique identifier for the entity
285
+ */
286
+ body_id: string;
287
+
288
+ /**
289
+ * Description of the product
290
+ */
291
+ description?: string | null;
292
+
293
+ /**
294
+ * Display name of the product
295
+ */
296
+ displayName?: string;
297
+ }
298
+
299
+ export interface ProductListProductsParams extends MyCursorIDPageParams {
300
+ /**
301
+ * Filter by entity ID
302
+ */
303
+ id?: string;
304
+
305
+ /**
306
+ * Filter by creation date using range operators: gt, gte, lt, lte
307
+ */
308
+ createdAt?: ProductListProductsParams.CreatedAt;
309
+
310
+ /**
311
+ * Filter by product status. Supports comma-separated values for multiple statuses
312
+ */
313
+ status?: string;
314
+ }
315
+
316
+ export namespace ProductListProductsParams {
317
+ /**
318
+ * Filter by creation date using range operators: gt, gte, lt, lte
319
+ */
320
+ export interface CreatedAt {
321
+ /**
322
+ * Greater than the specified createdAt value
323
+ */
324
+ gt?: string;
325
+
326
+ /**
327
+ * Greater than or equal to the specified createdAt value
328
+ */
329
+ gte?: string;
330
+
331
+ /**
332
+ * Less than the specified createdAt value
333
+ */
334
+ lt?: string;
335
+
336
+ /**
337
+ * Less than or equal to the specified createdAt value
338
+ */
339
+ lte?: string;
340
+ }
341
+ }
342
+
343
+ export interface ProductUpdateProductParams {
344
+ /**
345
+ * Description of the product
346
+ */
347
+ description?: string | null;
348
+
349
+ /**
350
+ * Display name of the product
351
+ */
352
+ displayName?: string;
353
+
354
+ /**
355
+ * Additional metadata for the product
356
+ */
357
+ metadata?: { [key: string]: string } | null;
358
+
359
+ /**
360
+ * Indicates if multiple subscriptions to this product are allowed
361
+ */
362
+ multipleSubscriptions?: boolean;
363
+
364
+ productSettings?: ProductUpdateProductParams.ProductSettings;
365
+
366
+ /**
367
+ * Rule defining when usage resets upon subscription update.
368
+ */
369
+ usageResetCutoffRule?: ProductUpdateProductParams.UsageResetCutoffRule;
370
+ }
371
+
372
+ export namespace ProductUpdateProductParams {
373
+ export interface ProductSettings {
374
+ /**
375
+ * Time when the subscription will be cancelled
376
+ */
377
+ subscriptionCancellationTime: 'END_OF_BILLING_PERIOD' | 'IMMEDIATE' | 'SPECIFIC_DATE';
378
+
379
+ /**
380
+ * Setup for the end of the subscription
381
+ */
382
+ subscriptionEndSetup: 'DOWNGRADE_TO_FREE' | 'CANCEL_SUBSCRIPTION';
383
+
384
+ /**
385
+ * Setup for the start of the subscription
386
+ */
387
+ subscriptionStartSetup: 'PLAN_SELECTION' | 'TRIAL_PERIOD' | 'FREE_PLAN';
388
+
389
+ /**
390
+ * ID of the plan to downgrade to at the end of the billing period
391
+ */
392
+ downgradePlanId?: string | null;
393
+
394
+ prorateAtEndOfBillingPeriod?: boolean | null;
395
+
396
+ /**
397
+ * ID of the plan to start the subscription with
398
+ */
399
+ subscriptionStartPlanId?: string | null;
400
+ }
401
+
402
+ /**
403
+ * Rule defining when usage resets upon subscription update.
404
+ */
405
+ export interface UsageResetCutoffRule {
406
+ /**
407
+ * Behavior of the usage reset cutoff rule
408
+ */
409
+ behavior: 'NEVER_RESET' | 'ALWAYS_RESET' | 'BILLING_PERIOD_CHANGE';
410
+ }
411
+ }
412
+
413
+ export declare namespace Products {
414
+ export {
415
+ type Product as Product,
416
+ type ProductListProductsResponse as ProductListProductsResponse,
417
+ type ProductListProductsResponsesMyCursorIDPage as ProductListProductsResponsesMyCursorIDPage,
418
+ type ProductCreateProductParams as ProductCreateProductParams,
419
+ type ProductDuplicateProductParams as ProductDuplicateProductParams,
420
+ type ProductListProductsParams as ProductListProductsParams,
421
+ type ProductUpdateProductParams as ProductUpdateProductParams,
422
+ };
423
+ }
@@ -7,41 +7,29 @@ import { path } from '../../../internal/utils/path';
7
7
 
8
8
  export class FutureUpdate extends APIResource {
9
9
  /**
10
- * Perform cancel future update on a Subscription
10
+ * Cancels a subscription update that is pending payment completion.
11
11
  */
12
- cancelPendingPayment(
13
- id: string,
14
- options?: RequestOptions,
15
- ): APIPromise<FutureUpdateCancelPendingPaymentResponse> {
12
+ cancelPendingPayment(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
16
13
  return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/pending-payment`, options);
17
14
  }
18
15
 
19
16
  /**
20
- * Perform cancel future update on a Subscription
17
+ * Cancels a scheduled subscription update, such as a future downgrade or plan
18
+ * change.
21
19
  */
22
- cancelSchedule(id: string, options?: RequestOptions): APIPromise<FutureUpdateCancelScheduleResponse> {
20
+ cancelSchedule(id: string, options?: RequestOptions): APIPromise<CancelSubscription> {
23
21
  return this._client.delete(path`/api/v1/subscriptions/${id}/future-update/schedule`, options);
24
22
  }
25
23
  }
26
24
 
27
- export interface FutureUpdateCancelPendingPaymentResponse {
28
- data: FutureUpdateCancelPendingPaymentResponse.Data;
25
+ /**
26
+ * Response object
27
+ */
28
+ export interface CancelSubscription {
29
+ data: CancelSubscription.Data;
29
30
  }
30
31
 
31
- export namespace FutureUpdateCancelPendingPaymentResponse {
32
- export interface Data {
33
- /**
34
- * Subscription ID
35
- */
36
- id: string;
37
- }
38
- }
39
-
40
- export interface FutureUpdateCancelScheduleResponse {
41
- data: FutureUpdateCancelScheduleResponse.Data;
42
- }
43
-
44
- export namespace FutureUpdateCancelScheduleResponse {
32
+ export namespace CancelSubscription {
45
33
  export interface Data {
46
34
  /**
47
35
  * Subscription ID
@@ -51,8 +39,5 @@ export namespace FutureUpdateCancelScheduleResponse {
51
39
  }
52
40
 
53
41
  export declare namespace FutureUpdate {
54
- export {
55
- type FutureUpdateCancelPendingPaymentResponse as FutureUpdateCancelPendingPaymentResponse,
56
- type FutureUpdateCancelScheduleResponse as FutureUpdateCancelScheduleResponse,
57
- };
42
+ export { type CancelSubscription as CancelSubscription };
58
43
  }
@@ -1,23 +1,28 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export {
4
- FutureUpdate,
5
- type FutureUpdateCancelPendingPaymentResponse,
6
- type FutureUpdateCancelScheduleResponse,
7
- } from './future-update';
3
+ export { FutureUpdate, type CancelSubscription } from './future-update';
4
+ export { Invoice, type InvoiceMarkAsPaidResponse } from './invoice';
8
5
  export {
9
6
  Subscriptions,
10
- type SubscriptionCreateResponse,
11
- type SubscriptionRetrieveResponse,
7
+ type Subscription,
12
8
  type SubscriptionListResponse,
13
- type SubscriptionDelegateResponse,
14
- type SubscriptionMigrateResponse,
9
+ type SubscriptionImportResponse,
15
10
  type SubscriptionPreviewResponse,
16
- type SubscriptionTransferResponse,
17
- type SubscriptionCreateParams,
11
+ type SubscriptionProvisionResponse,
12
+ type SubscriptionUpdateParams,
18
13
  type SubscriptionListParams,
14
+ type SubscriptionCancelParams,
19
15
  type SubscriptionDelegateParams,
16
+ type SubscriptionImportParams,
20
17
  type SubscriptionMigrateParams,
21
18
  type SubscriptionPreviewParams,
19
+ type SubscriptionProvisionParams,
22
20
  type SubscriptionTransferParams,
21
+ type SubscriptionListResponsesMyCursorIDPage,
23
22
  } from './subscriptions';
23
+ export {
24
+ Usage,
25
+ type UsageChargeUsageResponse,
26
+ type UsageSyncResponse,
27
+ type UsageChargeUsageParams,
28
+ } from './usage';
@@ -0,0 +1,42 @@
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 { RequestOptions } from '../../../internal/request-options';
6
+ import { path } from '../../../internal/utils/path';
7
+
8
+ export class Invoice extends APIResource {
9
+ /**
10
+ * Marks the latest invoice of a subscription as paid in the billing provider. The
11
+ * invoice must exist and have an OPEN status.
12
+ */
13
+ markAsPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkAsPaidResponse> {
14
+ return this._client.post(path`/api/v1/subscriptions/${id}/invoice/paid`, options);
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Response object
20
+ */
21
+ export interface InvoiceMarkAsPaidResponse {
22
+ /**
23
+ * Result of marking a subscription invoice as paid.
24
+ */
25
+ data: InvoiceMarkAsPaidResponse.Data;
26
+ }
27
+
28
+ export namespace InvoiceMarkAsPaidResponse {
29
+ /**
30
+ * Result of marking a subscription invoice as paid.
31
+ */
32
+ export interface Data {
33
+ /**
34
+ * The subscription ID whose invoice was marked as paid
35
+ */
36
+ id: string;
37
+ }
38
+ }
39
+
40
+ export declare namespace Invoice {
41
+ export { type InvoiceMarkAsPaidResponse as InvoiceMarkAsPaidResponse };
42
+ }