@stigg/typescript 0.1.0-alpha.1

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 (442) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE +201 -0
  3. package/README.md +362 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +186 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +186 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +469 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +465 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/pagination.d.mts +55 -0
  37. package/core/pagination.d.mts.map +1 -0
  38. package/core/pagination.d.ts +55 -0
  39. package/core/pagination.d.ts.map +1 -0
  40. package/core/pagination.js +115 -0
  41. package/core/pagination.js.map +1 -0
  42. package/core/pagination.mjs +109 -0
  43. package/core/pagination.mjs.map +1 -0
  44. package/core/resource.d.mts +6 -0
  45. package/core/resource.d.mts.map +1 -0
  46. package/core/resource.d.ts +6 -0
  47. package/core/resource.d.ts.map +1 -0
  48. package/core/resource.js +11 -0
  49. package/core/resource.js.map +1 -0
  50. package/core/resource.mjs +7 -0
  51. package/core/resource.mjs.map +1 -0
  52. package/core/uploads.d.mts +3 -0
  53. package/core/uploads.d.mts.map +1 -0
  54. package/core/uploads.d.ts +3 -0
  55. package/core/uploads.d.ts.map +1 -0
  56. package/core/uploads.js +6 -0
  57. package/core/uploads.js.map +1 -0
  58. package/core/uploads.mjs +2 -0
  59. package/core/uploads.mjs.map +1 -0
  60. package/error.d.mts +2 -0
  61. package/error.d.mts.map +1 -0
  62. package/error.d.ts +2 -0
  63. package/error.d.ts.map +1 -0
  64. package/error.js +6 -0
  65. package/error.js.map +1 -0
  66. package/error.mjs +2 -0
  67. package/error.mjs.map +1 -0
  68. package/index.d.mts +7 -0
  69. package/index.d.mts.map +1 -0
  70. package/index.d.ts +7 -0
  71. package/index.d.ts.map +1 -0
  72. package/index.js +32 -0
  73. package/index.js.map +1 -0
  74. package/index.mjs +8 -0
  75. package/index.mjs.map +1 -0
  76. package/internal/builtin-types.d.mts +73 -0
  77. package/internal/builtin-types.d.mts.map +1 -0
  78. package/internal/builtin-types.d.ts +73 -0
  79. package/internal/builtin-types.d.ts.map +1 -0
  80. package/internal/builtin-types.js +4 -0
  81. package/internal/builtin-types.js.map +1 -0
  82. package/internal/builtin-types.mjs +3 -0
  83. package/internal/builtin-types.mjs.map +1 -0
  84. package/internal/detect-platform.d.mts +15 -0
  85. package/internal/detect-platform.d.mts.map +1 -0
  86. package/internal/detect-platform.d.ts +15 -0
  87. package/internal/detect-platform.d.ts.map +1 -0
  88. package/internal/detect-platform.js +162 -0
  89. package/internal/detect-platform.js.map +1 -0
  90. package/internal/detect-platform.mjs +157 -0
  91. package/internal/detect-platform.mjs.map +1 -0
  92. package/internal/errors.d.mts +3 -0
  93. package/internal/errors.d.mts.map +1 -0
  94. package/internal/errors.d.ts +3 -0
  95. package/internal/errors.d.ts.map +1 -0
  96. package/internal/errors.js +41 -0
  97. package/internal/errors.js.map +1 -0
  98. package/internal/errors.mjs +36 -0
  99. package/internal/errors.mjs.map +1 -0
  100. package/internal/headers.d.mts +20 -0
  101. package/internal/headers.d.mts.map +1 -0
  102. package/internal/headers.d.ts +20 -0
  103. package/internal/headers.d.ts.map +1 -0
  104. package/internal/headers.js +79 -0
  105. package/internal/headers.js.map +1 -0
  106. package/internal/headers.mjs +74 -0
  107. package/internal/headers.mjs.map +1 -0
  108. package/internal/parse.d.mts +12 -0
  109. package/internal/parse.d.mts.map +1 -0
  110. package/internal/parse.d.ts +12 -0
  111. package/internal/parse.d.ts.map +1 -0
  112. package/internal/parse.js +35 -0
  113. package/internal/parse.js.map +1 -0
  114. package/internal/parse.mjs +32 -0
  115. package/internal/parse.mjs.map +1 -0
  116. package/internal/request-options.d.mts +75 -0
  117. package/internal/request-options.d.mts.map +1 -0
  118. package/internal/request-options.d.ts +75 -0
  119. package/internal/request-options.d.ts.map +1 -0
  120. package/internal/request-options.js +14 -0
  121. package/internal/request-options.js.map +1 -0
  122. package/internal/request-options.mjs +10 -0
  123. package/internal/request-options.mjs.map +1 -0
  124. package/internal/shim-types.d.mts +17 -0
  125. package/internal/shim-types.d.mts.map +1 -0
  126. package/internal/shim-types.d.ts +17 -0
  127. package/internal/shim-types.d.ts.map +1 -0
  128. package/internal/shim-types.js +4 -0
  129. package/internal/shim-types.js.map +1 -0
  130. package/internal/shim-types.mjs +3 -0
  131. package/internal/shim-types.mjs.map +1 -0
  132. package/internal/shims.d.mts +20 -0
  133. package/internal/shims.d.mts.map +1 -0
  134. package/internal/shims.d.ts +20 -0
  135. package/internal/shims.d.ts.map +1 -0
  136. package/internal/shims.js +92 -0
  137. package/internal/shims.js.map +1 -0
  138. package/internal/shims.mjs +85 -0
  139. package/internal/shims.mjs.map +1 -0
  140. package/internal/to-file.d.mts +45 -0
  141. package/internal/to-file.d.mts.map +1 -0
  142. package/internal/to-file.d.ts +45 -0
  143. package/internal/to-file.d.ts.map +1 -0
  144. package/internal/to-file.js +91 -0
  145. package/internal/to-file.js.map +1 -0
  146. package/internal/to-file.mjs +88 -0
  147. package/internal/to-file.mjs.map +1 -0
  148. package/internal/tslib.js +81 -0
  149. package/internal/tslib.mjs +17 -0
  150. package/internal/types.d.mts +69 -0
  151. package/internal/types.d.mts.map +1 -0
  152. package/internal/types.d.ts +69 -0
  153. package/internal/types.d.ts.map +1 -0
  154. package/internal/types.js +4 -0
  155. package/internal/types.js.map +1 -0
  156. package/internal/types.mjs +3 -0
  157. package/internal/types.mjs.map +1 -0
  158. package/internal/uploads.d.mts +42 -0
  159. package/internal/uploads.d.mts.map +1 -0
  160. package/internal/uploads.d.ts +42 -0
  161. package/internal/uploads.d.ts.map +1 -0
  162. package/internal/uploads.js +141 -0
  163. package/internal/uploads.js.map +1 -0
  164. package/internal/uploads.mjs +131 -0
  165. package/internal/uploads.mjs.map +1 -0
  166. package/internal/utils/base64.d.mts +3 -0
  167. package/internal/utils/base64.d.mts.map +1 -0
  168. package/internal/utils/base64.d.ts +3 -0
  169. package/internal/utils/base64.d.ts.map +1 -0
  170. package/internal/utils/base64.js +38 -0
  171. package/internal/utils/base64.js.map +1 -0
  172. package/internal/utils/base64.mjs +33 -0
  173. package/internal/utils/base64.mjs.map +1 -0
  174. package/internal/utils/bytes.d.mts +4 -0
  175. package/internal/utils/bytes.d.mts.map +1 -0
  176. package/internal/utils/bytes.d.ts +4 -0
  177. package/internal/utils/bytes.d.ts.map +1 -0
  178. package/internal/utils/bytes.js +31 -0
  179. package/internal/utils/bytes.js.map +1 -0
  180. package/internal/utils/bytes.mjs +26 -0
  181. package/internal/utils/bytes.mjs.map +1 -0
  182. package/internal/utils/env.d.mts +9 -0
  183. package/internal/utils/env.d.mts.map +1 -0
  184. package/internal/utils/env.d.ts +9 -0
  185. package/internal/utils/env.d.ts.map +1 -0
  186. package/internal/utils/env.js +22 -0
  187. package/internal/utils/env.js.map +1 -0
  188. package/internal/utils/env.mjs +18 -0
  189. package/internal/utils/env.mjs.map +1 -0
  190. package/internal/utils/log.d.mts +37 -0
  191. package/internal/utils/log.d.mts.map +1 -0
  192. package/internal/utils/log.d.ts +37 -0
  193. package/internal/utils/log.d.ts.map +1 -0
  194. package/internal/utils/log.js +86 -0
  195. package/internal/utils/log.js.map +1 -0
  196. package/internal/utils/log.mjs +80 -0
  197. package/internal/utils/log.mjs.map +1 -0
  198. package/internal/utils/path.d.mts +15 -0
  199. package/internal/utils/path.d.mts.map +1 -0
  200. package/internal/utils/path.d.ts +15 -0
  201. package/internal/utils/path.d.ts.map +1 -0
  202. package/internal/utils/path.js +79 -0
  203. package/internal/utils/path.js.map +1 -0
  204. package/internal/utils/path.mjs +74 -0
  205. package/internal/utils/path.mjs.map +1 -0
  206. package/internal/utils/sleep.d.mts +2 -0
  207. package/internal/utils/sleep.d.mts.map +1 -0
  208. package/internal/utils/sleep.d.ts +2 -0
  209. package/internal/utils/sleep.d.ts.map +1 -0
  210. package/internal/utils/sleep.js +7 -0
  211. package/internal/utils/sleep.js.map +1 -0
  212. package/internal/utils/sleep.mjs +3 -0
  213. package/internal/utils/sleep.mjs.map +1 -0
  214. package/internal/utils/uuid.d.mts +5 -0
  215. package/internal/utils/uuid.d.mts.map +1 -0
  216. package/internal/utils/uuid.d.ts +5 -0
  217. package/internal/utils/uuid.d.ts.map +1 -0
  218. package/internal/utils/uuid.js +19 -0
  219. package/internal/utils/uuid.js.map +1 -0
  220. package/internal/utils/uuid.mjs +15 -0
  221. package/internal/utils/uuid.mjs.map +1 -0
  222. package/internal/utils/values.d.mts +18 -0
  223. package/internal/utils/values.d.mts.map +1 -0
  224. package/internal/utils/values.d.ts +18 -0
  225. package/internal/utils/values.d.ts.map +1 -0
  226. package/internal/utils/values.js +112 -0
  227. package/internal/utils/values.js.map +1 -0
  228. package/internal/utils/values.mjs +94 -0
  229. package/internal/utils/values.mjs.map +1 -0
  230. package/internal/utils.d.mts +7 -0
  231. package/internal/utils.d.mts.map +1 -0
  232. package/internal/utils.d.ts +7 -0
  233. package/internal/utils.d.ts.map +1 -0
  234. package/internal/utils.js +11 -0
  235. package/internal/utils.js.map +1 -0
  236. package/internal/utils.mjs +8 -0
  237. package/internal/utils.mjs.map +1 -0
  238. package/package.json +148 -0
  239. package/pagination.d.mts +2 -0
  240. package/pagination.d.mts.map +1 -0
  241. package/pagination.d.ts +2 -0
  242. package/pagination.d.ts.map +1 -0
  243. package/pagination.js +6 -0
  244. package/pagination.js.map +1 -0
  245. package/pagination.mjs +2 -0
  246. package/pagination.mjs.map +1 -0
  247. package/resource.d.mts +2 -0
  248. package/resource.d.mts.map +1 -0
  249. package/resource.d.ts +2 -0
  250. package/resource.d.ts.map +1 -0
  251. package/resource.js +6 -0
  252. package/resource.js.map +1 -0
  253. package/resource.mjs +2 -0
  254. package/resource.mjs.map +1 -0
  255. package/resources/index.d.mts +2 -0
  256. package/resources/index.d.mts.map +1 -0
  257. package/resources/index.d.ts +2 -0
  258. package/resources/index.d.ts.map +1 -0
  259. package/resources/index.js +7 -0
  260. package/resources/index.js.map +1 -0
  261. package/resources/index.mjs +3 -0
  262. package/resources/index.mjs.map +1 -0
  263. package/resources/v1/coupons.d.mts +294 -0
  264. package/resources/v1/coupons.d.mts.map +1 -0
  265. package/resources/v1/coupons.d.ts +294 -0
  266. package/resources/v1/coupons.d.ts.map +1 -0
  267. package/resources/v1/coupons.js +28 -0
  268. package/resources/v1/coupons.js.map +1 -0
  269. package/resources/v1/coupons.mjs +24 -0
  270. package/resources/v1/coupons.mjs.map +1 -0
  271. package/resources/v1/customers/customers.d.mts +352 -0
  272. package/resources/v1/customers/customers.d.mts.map +1 -0
  273. package/resources/v1/customers/customers.d.ts +352 -0
  274. package/resources/v1/customers/customers.d.ts.map +1 -0
  275. package/resources/v1/customers/customers.js +58 -0
  276. package/resources/v1/customers/customers.js.map +1 -0
  277. package/resources/v1/customers/customers.mjs +53 -0
  278. package/resources/v1/customers/customers.mjs.map +1 -0
  279. package/resources/v1/customers/index.d.mts +4 -0
  280. package/resources/v1/customers/index.d.mts.map +1 -0
  281. package/resources/v1/customers/index.d.ts +4 -0
  282. package/resources/v1/customers/index.d.ts.map +1 -0
  283. package/resources/v1/customers/index.js +11 -0
  284. package/resources/v1/customers/index.js.map +1 -0
  285. package/resources/v1/customers/index.mjs +5 -0
  286. package/resources/v1/customers/index.mjs.map +1 -0
  287. package/resources/v1/customers/payment-method.d.mts +33 -0
  288. package/resources/v1/customers/payment-method.d.mts.map +1 -0
  289. package/resources/v1/customers/payment-method.d.ts +33 -0
  290. package/resources/v1/customers/payment-method.d.ts.map +1 -0
  291. package/resources/v1/customers/payment-method.js +22 -0
  292. package/resources/v1/customers/payment-method.js.map +1 -0
  293. package/resources/v1/customers/payment-method.mjs +18 -0
  294. package/resources/v1/customers/payment-method.mjs.map +1 -0
  295. package/resources/v1/customers/usage.d.mts +98 -0
  296. package/resources/v1/customers/usage.d.mts.map +1 -0
  297. package/resources/v1/customers/usage.d.ts +98 -0
  298. package/resources/v1/customers/usage.d.ts.map +1 -0
  299. package/resources/v1/customers/usage.js +20 -0
  300. package/resources/v1/customers/usage.js.map +1 -0
  301. package/resources/v1/customers/usage.mjs +16 -0
  302. package/resources/v1/customers/usage.mjs.map +1 -0
  303. package/resources/v1/customers.d.mts +2 -0
  304. package/resources/v1/customers.d.mts.map +1 -0
  305. package/resources/v1/customers.d.ts +2 -0
  306. package/resources/v1/customers.d.ts.map +1 -0
  307. package/resources/v1/customers.js +6 -0
  308. package/resources/v1/customers.js.map +1 -0
  309. package/resources/v1/customers.mjs +3 -0
  310. package/resources/v1/customers.mjs.map +1 -0
  311. package/resources/v1/index.d.mts +5 -0
  312. package/resources/v1/index.d.mts.map +1 -0
  313. package/resources/v1/index.d.ts +5 -0
  314. package/resources/v1/index.d.ts.map +1 -0
  315. package/resources/v1/index.js +13 -0
  316. package/resources/v1/index.js.map +1 -0
  317. package/resources/v1/index.mjs +6 -0
  318. package/resources/v1/index.mjs.map +1 -0
  319. package/resources/v1/subscriptions/future-update.d.mts +39 -0
  320. package/resources/v1/subscriptions/future-update.d.mts.map +1 -0
  321. package/resources/v1/subscriptions/future-update.d.ts +39 -0
  322. package/resources/v1/subscriptions/future-update.d.ts.map +1 -0
  323. package/resources/v1/subscriptions/future-update.js +22 -0
  324. package/resources/v1/subscriptions/future-update.js.map +1 -0
  325. package/resources/v1/subscriptions/future-update.mjs +18 -0
  326. package/resources/v1/subscriptions/future-update.mjs.map +1 -0
  327. package/resources/v1/subscriptions/index.d.mts +3 -0
  328. package/resources/v1/subscriptions/index.d.mts.map +1 -0
  329. package/resources/v1/subscriptions/index.d.ts +3 -0
  330. package/resources/v1/subscriptions/index.d.ts.map +1 -0
  331. package/resources/v1/subscriptions/index.js +9 -0
  332. package/resources/v1/subscriptions/index.js.map +1 -0
  333. package/resources/v1/subscriptions/index.mjs +4 -0
  334. package/resources/v1/subscriptions/index.mjs.map +1 -0
  335. package/resources/v1/subscriptions/subscriptions.d.mts +949 -0
  336. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -0
  337. package/resources/v1/subscriptions/subscriptions.d.ts +949 -0
  338. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -0
  339. package/resources/v1/subscriptions/subscriptions.js +60 -0
  340. package/resources/v1/subscriptions/subscriptions.js.map +1 -0
  341. package/resources/v1/subscriptions/subscriptions.mjs +55 -0
  342. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -0
  343. package/resources/v1/subscriptions.d.mts +2 -0
  344. package/resources/v1/subscriptions.d.mts.map +1 -0
  345. package/resources/v1/subscriptions.d.ts +2 -0
  346. package/resources/v1/subscriptions.d.ts.map +1 -0
  347. package/resources/v1/subscriptions.js +6 -0
  348. package/resources/v1/subscriptions.js.map +1 -0
  349. package/resources/v1/subscriptions.mjs +3 -0
  350. package/resources/v1/subscriptions.mjs.map +1 -0
  351. package/resources/v1/v1.d.mts +161 -0
  352. package/resources/v1/v1.d.mts.map +1 -0
  353. package/resources/v1/v1.d.ts +161 -0
  354. package/resources/v1/v1.d.ts.map +1 -0
  355. package/resources/v1/v1.js +37 -0
  356. package/resources/v1/v1.js.map +1 -0
  357. package/resources/v1/v1.mjs +32 -0
  358. package/resources/v1/v1.mjs.map +1 -0
  359. package/resources/v1.d.mts +2 -0
  360. package/resources/v1.d.mts.map +1 -0
  361. package/resources/v1.d.ts +2 -0
  362. package/resources/v1.d.ts.map +1 -0
  363. package/resources/v1.js +6 -0
  364. package/resources/v1.js.map +1 -0
  365. package/resources/v1.mjs +3 -0
  366. package/resources/v1.mjs.map +1 -0
  367. package/resources.d.mts +2 -0
  368. package/resources.d.mts.map +1 -0
  369. package/resources.d.ts +2 -0
  370. package/resources.d.ts.map +1 -0
  371. package/resources.js +5 -0
  372. package/resources.js.map +1 -0
  373. package/resources.mjs +2 -0
  374. package/resources.mjs.map +1 -0
  375. package/src/api-promise.ts +2 -0
  376. package/src/client.ts +765 -0
  377. package/src/core/README.md +3 -0
  378. package/src/core/api-promise.ts +92 -0
  379. package/src/core/error.ts +130 -0
  380. package/src/core/pagination.ts +177 -0
  381. package/src/core/resource.ts +11 -0
  382. package/src/core/uploads.ts +2 -0
  383. package/src/error.ts +2 -0
  384. package/src/index.ts +23 -0
  385. package/src/internal/README.md +3 -0
  386. package/src/internal/builtin-types.ts +93 -0
  387. package/src/internal/detect-platform.ts +196 -0
  388. package/src/internal/errors.ts +33 -0
  389. package/src/internal/headers.ts +97 -0
  390. package/src/internal/parse.ts +50 -0
  391. package/src/internal/request-options.ts +91 -0
  392. package/src/internal/shim-types.ts +26 -0
  393. package/src/internal/shims.ts +107 -0
  394. package/src/internal/to-file.ts +154 -0
  395. package/src/internal/types.ts +95 -0
  396. package/src/internal/uploads.ts +187 -0
  397. package/src/internal/utils/base64.ts +40 -0
  398. package/src/internal/utils/bytes.ts +32 -0
  399. package/src/internal/utils/env.ts +18 -0
  400. package/src/internal/utils/log.ts +127 -0
  401. package/src/internal/utils/path.ts +88 -0
  402. package/src/internal/utils/sleep.ts +3 -0
  403. package/src/internal/utils/uuid.ts +17 -0
  404. package/src/internal/utils/values.ts +105 -0
  405. package/src/internal/utils.ts +8 -0
  406. package/src/lib/.keep +4 -0
  407. package/src/pagination.ts +2 -0
  408. package/src/resource.ts +2 -0
  409. package/src/resources/index.ts +9 -0
  410. package/src/resources/v1/coupons.ts +843 -0
  411. package/src/resources/v1/customers/customers.ts +489 -0
  412. package/src/resources/v1/customers/index.ts +12 -0
  413. package/src/resources/v1/customers/payment-method.ts +177 -0
  414. package/src/resources/v1/customers/usage.ts +132 -0
  415. package/src/resources/v1/customers.ts +3 -0
  416. package/src/resources/v1/index.ts +41 -0
  417. package/src/resources/v1/subscriptions/future-update.ts +58 -0
  418. package/src/resources/v1/subscriptions/index.ts +23 -0
  419. package/src/resources/v1/subscriptions/subscriptions.ts +1464 -0
  420. package/src/resources/v1/subscriptions.ts +3 -0
  421. package/src/resources/v1/v1.ts +264 -0
  422. package/src/resources/v1.ts +3 -0
  423. package/src/resources.ts +1 -0
  424. package/src/tsconfig.json +11 -0
  425. package/src/uploads.ts +2 -0
  426. package/src/version.ts +1 -0
  427. package/uploads.d.mts +2 -0
  428. package/uploads.d.mts.map +1 -0
  429. package/uploads.d.ts +2 -0
  430. package/uploads.d.ts.map +1 -0
  431. package/uploads.js +6 -0
  432. package/uploads.js.map +1 -0
  433. package/uploads.mjs +2 -0
  434. package/uploads.mjs.map +1 -0
  435. package/version.d.mts +2 -0
  436. package/version.d.mts.map +1 -0
  437. package/version.d.ts +2 -0
  438. package/version.d.ts.map +1 -0
  439. package/version.js +5 -0
  440. package/version.js.map +1 -0
  441. package/version.mjs +2 -0
  442. package/version.mjs.map +1 -0
@@ -0,0 +1,1464 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as FutureUpdateAPI from './future-update';
5
+ import {
6
+ FutureUpdate,
7
+ FutureUpdateCancelPendingPaymentResponse,
8
+ FutureUpdateCancelScheduleResponse,
9
+ } from './future-update';
10
+ import { APIPromise } from '../../../core/api-promise';
11
+ import { RequestOptions } from '../../../internal/request-options';
12
+ import { path } from '../../../internal/utils/path';
13
+
14
+ export class Subscriptions extends APIResource {
15
+ futureUpdate: FutureUpdateAPI.FutureUpdate = new FutureUpdateAPI.FutureUpdate(this._client);
16
+
17
+ /**
18
+ * Create a new Subscription
19
+ */
20
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse> {
21
+ return this._client.post('/api/v1/subscriptions', { body, ...options });
22
+ }
23
+
24
+ /**
25
+ * Get a single Subscription by id
26
+ */
27
+ retrieve(id: string, options?: RequestOptions): APIPromise<SubscriptionRetrieveResponse> {
28
+ return this._client.get(path`/api/v1/subscriptions/${id}`, options);
29
+ }
30
+
31
+ /**
32
+ * Get a list of Subscriptions
33
+ */
34
+ list(
35
+ query: SubscriptionListParams | null | undefined = {},
36
+ options?: RequestOptions,
37
+ ): APIPromise<SubscriptionListResponse> {
38
+ return this._client.get('/api/v1/subscriptions', { query, ...options });
39
+ }
40
+
41
+ /**
42
+ * Perform delegate on a Subscription
43
+ */
44
+ delegate(
45
+ id: string,
46
+ body: SubscriptionDelegateParams,
47
+ options?: RequestOptions,
48
+ ): APIPromise<SubscriptionDelegateResponse> {
49
+ return this._client.post(path`/api/v1/subscriptions/${id}/delegate`, { body, ...options });
50
+ }
51
+
52
+ /**
53
+ * Perform migrate to latest plan version on a Subscription
54
+ */
55
+ migrate(
56
+ id: string,
57
+ body: SubscriptionMigrateParams,
58
+ options?: RequestOptions,
59
+ ): APIPromise<SubscriptionMigrateResponse> {
60
+ return this._client.post(path`/api/v1/subscriptions/${id}/migrate`, { body, ...options });
61
+ }
62
+
63
+ /**
64
+ * Create a new Subscription Preview
65
+ */
66
+ preview(
67
+ body: SubscriptionPreviewParams,
68
+ options?: RequestOptions,
69
+ ): APIPromise<SubscriptionPreviewResponse> {
70
+ return this._client.post('/api/v1/subscriptions/preview', { body, ...options });
71
+ }
72
+
73
+ /**
74
+ * Perform transfer to resource on a Subscription
75
+ */
76
+ transfer(
77
+ id: string,
78
+ body: SubscriptionTransferParams,
79
+ options?: RequestOptions,
80
+ ): APIPromise<SubscriptionTransferResponse> {
81
+ return this._client.post(path`/api/v1/subscriptions/${id}/transfer`, { body, ...options });
82
+ }
83
+ }
84
+
85
+ export interface SubscriptionCreateResponse {
86
+ data: SubscriptionCreateResponse.Data;
87
+ }
88
+
89
+ export namespace SubscriptionCreateResponse {
90
+ export interface Data {
91
+ /**
92
+ * Unique identifier for the provisioned subscription
93
+ */
94
+ id: string;
95
+
96
+ /**
97
+ * Provision status: SUCCESS or PAYMENT_REQUIRED
98
+ */
99
+ status: 'SUCCESS' | 'PAYMENT_REQUIRED';
100
+
101
+ /**
102
+ * Checkout billing ID when payment is required
103
+ */
104
+ checkoutBillingId?: string | null;
105
+
106
+ /**
107
+ * URL to complete payment when PAYMENT_REQUIRED
108
+ */
109
+ checkoutUrl?: string | null;
110
+
111
+ /**
112
+ * Whether the subscription is scheduled for future activation
113
+ */
114
+ isScheduled?: boolean;
115
+
116
+ subscription?: Data.Subscription;
117
+ }
118
+
119
+ export namespace Data {
120
+ export interface Subscription {
121
+ /**
122
+ * Subscription ID
123
+ */
124
+ id: string;
125
+
126
+ /**
127
+ * Billing ID
128
+ */
129
+ billingId: string | null;
130
+
131
+ /**
132
+ * Created at
133
+ */
134
+ createdAt: string;
135
+
136
+ /**
137
+ * Customer ID
138
+ */
139
+ customerId: string;
140
+
141
+ /**
142
+ * Payment collection
143
+ */
144
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
145
+
146
+ /**
147
+ * Plan ID
148
+ */
149
+ planId: string;
150
+
151
+ /**
152
+ * Pricing type
153
+ */
154
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
155
+
156
+ /**
157
+ * Subscription start date
158
+ */
159
+ startDate: string;
160
+
161
+ /**
162
+ * Subscription status
163
+ */
164
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
165
+
166
+ /**
167
+ * Subscription cancellation date
168
+ */
169
+ cancellationDate?: string | null;
170
+
171
+ /**
172
+ * Subscription cancel reason
173
+ */
174
+ cancelReason?:
175
+ | 'UPGRADE_OR_DOWNGRADE'
176
+ | 'CANCELLED_BY_BILLING'
177
+ | 'EXPIRED'
178
+ | 'DETACH_BILLING'
179
+ | 'TRIAL_ENDED'
180
+ | 'Immediate'
181
+ | 'TRIAL_CONVERTED'
182
+ | 'PENDING_PAYMENT_EXPIRED'
183
+ | 'ScheduledCancellation'
184
+ | 'CustomerArchived'
185
+ | 'AutoCancellationRule'
186
+ | null;
187
+
188
+ /**
189
+ * End of the current billing period
190
+ */
191
+ currentBillingPeriodEnd?: string | null;
192
+
193
+ /**
194
+ * Start of the current billing period
195
+ */
196
+ currentBillingPeriodStart?: string | null;
197
+
198
+ /**
199
+ * Subscription effective end date
200
+ */
201
+ effectiveEndDate?: string | null;
202
+
203
+ /**
204
+ * Subscription end date
205
+ */
206
+ endDate?: string | null;
207
+
208
+ /**
209
+ * Additional metadata for the subscription
210
+ */
211
+ metadata?: { [key: string]: string };
212
+
213
+ /**
214
+ * Paying customer ID for delegated billing
215
+ */
216
+ payingCustomerId?: string | null;
217
+
218
+ /**
219
+ * The method used to collect payments for a subscription
220
+ */
221
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
222
+
223
+ /**
224
+ * Resource ID
225
+ */
226
+ resourceId?: string | null;
227
+
228
+ /**
229
+ * Subscription trial end date
230
+ */
231
+ trialEndDate?: string | null;
232
+ }
233
+ }
234
+ }
235
+
236
+ export interface SubscriptionRetrieveResponse {
237
+ data: SubscriptionRetrieveResponse.Data;
238
+ }
239
+
240
+ export namespace SubscriptionRetrieveResponse {
241
+ export interface Data {
242
+ /**
243
+ * Subscription ID
244
+ */
245
+ id: string;
246
+
247
+ /**
248
+ * Billing ID
249
+ */
250
+ billingId: string | null;
251
+
252
+ /**
253
+ * Created at
254
+ */
255
+ createdAt: string;
256
+
257
+ /**
258
+ * Customer ID
259
+ */
260
+ customerId: string;
261
+
262
+ /**
263
+ * Payment collection
264
+ */
265
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
266
+
267
+ /**
268
+ * Plan ID
269
+ */
270
+ planId: string;
271
+
272
+ /**
273
+ * Pricing type
274
+ */
275
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
276
+
277
+ /**
278
+ * Subscription start date
279
+ */
280
+ startDate: string;
281
+
282
+ /**
283
+ * Subscription status
284
+ */
285
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
286
+
287
+ /**
288
+ * Subscription cancellation date
289
+ */
290
+ cancellationDate?: string | null;
291
+
292
+ /**
293
+ * Subscription cancel reason
294
+ */
295
+ cancelReason?:
296
+ | 'UPGRADE_OR_DOWNGRADE'
297
+ | 'CANCELLED_BY_BILLING'
298
+ | 'EXPIRED'
299
+ | 'DETACH_BILLING'
300
+ | 'TRIAL_ENDED'
301
+ | 'Immediate'
302
+ | 'TRIAL_CONVERTED'
303
+ | 'PENDING_PAYMENT_EXPIRED'
304
+ | 'ScheduledCancellation'
305
+ | 'CustomerArchived'
306
+ | 'AutoCancellationRule'
307
+ | null;
308
+
309
+ /**
310
+ * End of the current billing period
311
+ */
312
+ currentBillingPeriodEnd?: string | null;
313
+
314
+ /**
315
+ * Start of the current billing period
316
+ */
317
+ currentBillingPeriodStart?: string | null;
318
+
319
+ /**
320
+ * Subscription effective end date
321
+ */
322
+ effectiveEndDate?: string | null;
323
+
324
+ /**
325
+ * Subscription end date
326
+ */
327
+ endDate?: string | null;
328
+
329
+ /**
330
+ * Additional metadata for the subscription
331
+ */
332
+ metadata?: { [key: string]: string };
333
+
334
+ /**
335
+ * Paying customer ID for delegated billing
336
+ */
337
+ payingCustomerId?: string | null;
338
+
339
+ /**
340
+ * The method used to collect payments for a subscription
341
+ */
342
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
343
+
344
+ /**
345
+ * Resource ID
346
+ */
347
+ resourceId?: string | null;
348
+
349
+ /**
350
+ * Subscription trial end date
351
+ */
352
+ trialEndDate?: string | null;
353
+ }
354
+ }
355
+
356
+ export interface SubscriptionListResponse {
357
+ data: Array<SubscriptionListResponse.Data>;
358
+ }
359
+
360
+ export namespace SubscriptionListResponse {
361
+ export interface Data {
362
+ /**
363
+ * Subscription ID
364
+ */
365
+ id: string;
366
+
367
+ /**
368
+ * Billing ID
369
+ */
370
+ billingId: string | null;
371
+
372
+ /**
373
+ * Created at
374
+ */
375
+ createdAt: string;
376
+
377
+ /**
378
+ * Cursor ID for query pagination
379
+ */
380
+ cursorId: string;
381
+
382
+ /**
383
+ * Customer ID
384
+ */
385
+ customerId: string;
386
+
387
+ /**
388
+ * Payment collection
389
+ */
390
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
391
+
392
+ /**
393
+ * Plan ID
394
+ */
395
+ planId: string;
396
+
397
+ /**
398
+ * Pricing type
399
+ */
400
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
401
+
402
+ /**
403
+ * Subscription start date
404
+ */
405
+ startDate: string;
406
+
407
+ /**
408
+ * Subscription status
409
+ */
410
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
411
+
412
+ /**
413
+ * Subscription cancellation date
414
+ */
415
+ cancellationDate?: string | null;
416
+
417
+ /**
418
+ * Subscription cancel reason
419
+ */
420
+ cancelReason?:
421
+ | 'UPGRADE_OR_DOWNGRADE'
422
+ | 'CANCELLED_BY_BILLING'
423
+ | 'EXPIRED'
424
+ | 'DETACH_BILLING'
425
+ | 'TRIAL_ENDED'
426
+ | 'Immediate'
427
+ | 'TRIAL_CONVERTED'
428
+ | 'PENDING_PAYMENT_EXPIRED'
429
+ | 'ScheduledCancellation'
430
+ | 'CustomerArchived'
431
+ | 'AutoCancellationRule'
432
+ | null;
433
+
434
+ /**
435
+ * End of the current billing period
436
+ */
437
+ currentBillingPeriodEnd?: string | null;
438
+
439
+ /**
440
+ * Start of the current billing period
441
+ */
442
+ currentBillingPeriodStart?: string | null;
443
+
444
+ /**
445
+ * Subscription effective end date
446
+ */
447
+ effectiveEndDate?: string | null;
448
+
449
+ /**
450
+ * Subscription end date
451
+ */
452
+ endDate?: string | null;
453
+
454
+ /**
455
+ * Additional metadata for the subscription
456
+ */
457
+ metadata?: { [key: string]: string };
458
+
459
+ /**
460
+ * Paying customer ID for delegated billing
461
+ */
462
+ payingCustomerId?: string | null;
463
+
464
+ /**
465
+ * The method used to collect payments for a subscription
466
+ */
467
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
468
+
469
+ /**
470
+ * Resource ID
471
+ */
472
+ resourceId?: string | null;
473
+
474
+ /**
475
+ * Subscription trial end date
476
+ */
477
+ trialEndDate?: string | null;
478
+ }
479
+ }
480
+
481
+ export interface SubscriptionDelegateResponse {
482
+ data: SubscriptionDelegateResponse.Data;
483
+ }
484
+
485
+ export namespace SubscriptionDelegateResponse {
486
+ export interface Data {
487
+ /**
488
+ * Subscription ID
489
+ */
490
+ id: string;
491
+
492
+ /**
493
+ * Billing ID
494
+ */
495
+ billingId: string | null;
496
+
497
+ /**
498
+ * Created at
499
+ */
500
+ createdAt: string;
501
+
502
+ /**
503
+ * Customer ID
504
+ */
505
+ customerId: string;
506
+
507
+ /**
508
+ * Payment collection
509
+ */
510
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
511
+
512
+ /**
513
+ * Plan ID
514
+ */
515
+ planId: string;
516
+
517
+ /**
518
+ * Pricing type
519
+ */
520
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
521
+
522
+ /**
523
+ * Subscription start date
524
+ */
525
+ startDate: string;
526
+
527
+ /**
528
+ * Subscription status
529
+ */
530
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
531
+
532
+ /**
533
+ * Subscription cancellation date
534
+ */
535
+ cancellationDate?: string | null;
536
+
537
+ /**
538
+ * Subscription cancel reason
539
+ */
540
+ cancelReason?:
541
+ | 'UPGRADE_OR_DOWNGRADE'
542
+ | 'CANCELLED_BY_BILLING'
543
+ | 'EXPIRED'
544
+ | 'DETACH_BILLING'
545
+ | 'TRIAL_ENDED'
546
+ | 'Immediate'
547
+ | 'TRIAL_CONVERTED'
548
+ | 'PENDING_PAYMENT_EXPIRED'
549
+ | 'ScheduledCancellation'
550
+ | 'CustomerArchived'
551
+ | 'AutoCancellationRule'
552
+ | null;
553
+
554
+ /**
555
+ * End of the current billing period
556
+ */
557
+ currentBillingPeriodEnd?: string | null;
558
+
559
+ /**
560
+ * Start of the current billing period
561
+ */
562
+ currentBillingPeriodStart?: string | null;
563
+
564
+ /**
565
+ * Subscription effective end date
566
+ */
567
+ effectiveEndDate?: string | null;
568
+
569
+ /**
570
+ * Subscription end date
571
+ */
572
+ endDate?: string | null;
573
+
574
+ /**
575
+ * Additional metadata for the subscription
576
+ */
577
+ metadata?: { [key: string]: string };
578
+
579
+ /**
580
+ * Paying customer ID for delegated billing
581
+ */
582
+ payingCustomerId?: string | null;
583
+
584
+ /**
585
+ * The method used to collect payments for a subscription
586
+ */
587
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
588
+
589
+ /**
590
+ * Resource ID
591
+ */
592
+ resourceId?: string | null;
593
+
594
+ /**
595
+ * Subscription trial end date
596
+ */
597
+ trialEndDate?: string | null;
598
+ }
599
+ }
600
+
601
+ export interface SubscriptionMigrateResponse {
602
+ data: SubscriptionMigrateResponse.Data;
603
+ }
604
+
605
+ export namespace SubscriptionMigrateResponse {
606
+ export interface Data {
607
+ /**
608
+ * Subscription ID
609
+ */
610
+ id: string;
611
+
612
+ /**
613
+ * Billing ID
614
+ */
615
+ billingId: string | null;
616
+
617
+ /**
618
+ * Created at
619
+ */
620
+ createdAt: string;
621
+
622
+ /**
623
+ * Customer ID
624
+ */
625
+ customerId: string;
626
+
627
+ /**
628
+ * Payment collection
629
+ */
630
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
631
+
632
+ /**
633
+ * Plan ID
634
+ */
635
+ planId: string;
636
+
637
+ /**
638
+ * Pricing type
639
+ */
640
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
641
+
642
+ /**
643
+ * Subscription start date
644
+ */
645
+ startDate: string;
646
+
647
+ /**
648
+ * Subscription status
649
+ */
650
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
651
+
652
+ /**
653
+ * Subscription cancellation date
654
+ */
655
+ cancellationDate?: string | null;
656
+
657
+ /**
658
+ * Subscription cancel reason
659
+ */
660
+ cancelReason?:
661
+ | 'UPGRADE_OR_DOWNGRADE'
662
+ | 'CANCELLED_BY_BILLING'
663
+ | 'EXPIRED'
664
+ | 'DETACH_BILLING'
665
+ | 'TRIAL_ENDED'
666
+ | 'Immediate'
667
+ | 'TRIAL_CONVERTED'
668
+ | 'PENDING_PAYMENT_EXPIRED'
669
+ | 'ScheduledCancellation'
670
+ | 'CustomerArchived'
671
+ | 'AutoCancellationRule'
672
+ | null;
673
+
674
+ /**
675
+ * End of the current billing period
676
+ */
677
+ currentBillingPeriodEnd?: string | null;
678
+
679
+ /**
680
+ * Start of the current billing period
681
+ */
682
+ currentBillingPeriodStart?: string | null;
683
+
684
+ /**
685
+ * Subscription effective end date
686
+ */
687
+ effectiveEndDate?: string | null;
688
+
689
+ /**
690
+ * Subscription end date
691
+ */
692
+ endDate?: string | null;
693
+
694
+ /**
695
+ * Additional metadata for the subscription
696
+ */
697
+ metadata?: { [key: string]: string };
698
+
699
+ /**
700
+ * Paying customer ID for delegated billing
701
+ */
702
+ payingCustomerId?: string | null;
703
+
704
+ /**
705
+ * The method used to collect payments for a subscription
706
+ */
707
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
708
+
709
+ /**
710
+ * Resource ID
711
+ */
712
+ resourceId?: string | null;
713
+
714
+ /**
715
+ * Subscription trial end date
716
+ */
717
+ trialEndDate?: string | null;
718
+ }
719
+ }
720
+
721
+ export interface SubscriptionPreviewResponse {
722
+ data: SubscriptionPreviewResponse.Data;
723
+ }
724
+
725
+ export namespace SubscriptionPreviewResponse {
726
+ export interface Data {
727
+ immediateInvoice: Data.ImmediateInvoice;
728
+
729
+ billingPeriodRange?: Data.BillingPeriodRange;
730
+
731
+ freeItems?: Array<Data.FreeItem>;
732
+
733
+ hasScheduledUpdates?: boolean;
734
+
735
+ isPlanDowngrade?: boolean;
736
+
737
+ recurringInvoice?: Data.RecurringInvoice;
738
+ }
739
+
740
+ export namespace Data {
741
+ export interface ImmediateInvoice {
742
+ subTotal: number;
743
+
744
+ total: number;
745
+
746
+ billingPeriodRange?: ImmediateInvoice.BillingPeriodRange;
747
+
748
+ currency?: string | null;
749
+
750
+ discount?: number;
751
+
752
+ discountDetails?: ImmediateInvoice.DiscountDetails;
753
+
754
+ discounts?: Array<ImmediateInvoice.Discount>;
755
+
756
+ lines?: Array<ImmediateInvoice.Line>;
757
+
758
+ tax?: number;
759
+ }
760
+
761
+ export namespace ImmediateInvoice {
762
+ export interface BillingPeriodRange {
763
+ /**
764
+ * Billing period end date
765
+ */
766
+ end: string;
767
+
768
+ /**
769
+ * Billing period start date
770
+ */
771
+ start: string;
772
+ }
773
+
774
+ export interface DiscountDetails {
775
+ code?: string;
776
+
777
+ fixedAmount?: number;
778
+
779
+ percentage?: number;
780
+ }
781
+
782
+ export interface Discount {
783
+ amount: number;
784
+
785
+ currency: string;
786
+
787
+ description: string;
788
+ }
789
+
790
+ export interface Line {
791
+ currency: string;
792
+
793
+ description: string;
794
+
795
+ subTotal: number;
796
+
797
+ unitPrice: number;
798
+
799
+ quantity?: number;
800
+ }
801
+ }
802
+
803
+ export interface BillingPeriodRange {
804
+ /**
805
+ * Billing period end date
806
+ */
807
+ end?: string;
808
+
809
+ /**
810
+ * Billing period start date
811
+ */
812
+ start?: string;
813
+ }
814
+
815
+ export interface FreeItem {
816
+ addonId: string;
817
+
818
+ quantity: number;
819
+ }
820
+
821
+ export interface RecurringInvoice {
822
+ subTotal: number;
823
+
824
+ total: number;
825
+
826
+ billingPeriodRange?: RecurringInvoice.BillingPeriodRange;
827
+
828
+ currency?: string | null;
829
+
830
+ discount?: number;
831
+
832
+ discountDetails?: RecurringInvoice.DiscountDetails;
833
+
834
+ discounts?: Array<RecurringInvoice.Discount>;
835
+
836
+ lines?: Array<RecurringInvoice.Line>;
837
+
838
+ tax?: number;
839
+ }
840
+
841
+ export namespace RecurringInvoice {
842
+ export interface BillingPeriodRange {
843
+ /**
844
+ * Billing period end date
845
+ */
846
+ end: string;
847
+
848
+ /**
849
+ * Billing period start date
850
+ */
851
+ start: string;
852
+ }
853
+
854
+ export interface DiscountDetails {
855
+ code?: string;
856
+
857
+ fixedAmount?: number;
858
+
859
+ percentage?: number;
860
+ }
861
+
862
+ export interface Discount {
863
+ amount: number;
864
+
865
+ currency: string;
866
+
867
+ description: string;
868
+ }
869
+
870
+ export interface Line {
871
+ currency: string;
872
+
873
+ description: string;
874
+
875
+ subTotal: number;
876
+
877
+ unitPrice: number;
878
+
879
+ quantity?: number;
880
+ }
881
+ }
882
+ }
883
+ }
884
+
885
+ export interface SubscriptionTransferResponse {
886
+ data: SubscriptionTransferResponse.Data;
887
+ }
888
+
889
+ export namespace SubscriptionTransferResponse {
890
+ export interface Data {
891
+ /**
892
+ * Subscription ID
893
+ */
894
+ id: string;
895
+
896
+ /**
897
+ * Billing ID
898
+ */
899
+ billingId: string | null;
900
+
901
+ /**
902
+ * Created at
903
+ */
904
+ createdAt: string;
905
+
906
+ /**
907
+ * Customer ID
908
+ */
909
+ customerId: string;
910
+
911
+ /**
912
+ * Payment collection
913
+ */
914
+ paymentCollection: 'NOT_REQUIRED' | 'PROCESSING' | 'FAILED' | 'ACTION_REQUIRED';
915
+
916
+ /**
917
+ * Plan ID
918
+ */
919
+ planId: string;
920
+
921
+ /**
922
+ * Pricing type
923
+ */
924
+ pricingType: 'FREE' | 'PAID' | 'CUSTOM';
925
+
926
+ /**
927
+ * Subscription start date
928
+ */
929
+ startDate: string;
930
+
931
+ /**
932
+ * Subscription status
933
+ */
934
+ status: 'PAYMENT_PENDING' | 'ACTIVE' | 'EXPIRED' | 'IN_TRIAL' | 'CANCELED' | 'NOT_STARTED';
935
+
936
+ /**
937
+ * Subscription cancellation date
938
+ */
939
+ cancellationDate?: string | null;
940
+
941
+ /**
942
+ * Subscription cancel reason
943
+ */
944
+ cancelReason?:
945
+ | 'UPGRADE_OR_DOWNGRADE'
946
+ | 'CANCELLED_BY_BILLING'
947
+ | 'EXPIRED'
948
+ | 'DETACH_BILLING'
949
+ | 'TRIAL_ENDED'
950
+ | 'Immediate'
951
+ | 'TRIAL_CONVERTED'
952
+ | 'PENDING_PAYMENT_EXPIRED'
953
+ | 'ScheduledCancellation'
954
+ | 'CustomerArchived'
955
+ | 'AutoCancellationRule'
956
+ | null;
957
+
958
+ /**
959
+ * End of the current billing period
960
+ */
961
+ currentBillingPeriodEnd?: string | null;
962
+
963
+ /**
964
+ * Start of the current billing period
965
+ */
966
+ currentBillingPeriodStart?: string | null;
967
+
968
+ /**
969
+ * Subscription effective end date
970
+ */
971
+ effectiveEndDate?: string | null;
972
+
973
+ /**
974
+ * Subscription end date
975
+ */
976
+ endDate?: string | null;
977
+
978
+ /**
979
+ * Additional metadata for the subscription
980
+ */
981
+ metadata?: { [key: string]: string };
982
+
983
+ /**
984
+ * Paying customer ID for delegated billing
985
+ */
986
+ payingCustomerId?: string | null;
987
+
988
+ /**
989
+ * The method used to collect payments for a subscription
990
+ */
991
+ paymentCollectionMethod?: 'CHARGE' | 'INVOICE' | 'NONE' | null;
992
+
993
+ /**
994
+ * Resource ID
995
+ */
996
+ resourceId?: string | null;
997
+
998
+ /**
999
+ * Subscription trial end date
1000
+ */
1001
+ trialEndDate?: string | null;
1002
+ }
1003
+ }
1004
+
1005
+ export interface SubscriptionCreateParams {
1006
+ /**
1007
+ * Customer ID to provision the subscription for
1008
+ */
1009
+ customerId: string;
1010
+
1011
+ /**
1012
+ * Plan ID to provision
1013
+ */
1014
+ planId: string;
1015
+
1016
+ /**
1017
+ * Unique identifier for the subscription
1018
+ */
1019
+ id?: string | null;
1020
+
1021
+ /**
1022
+ * Whether to wait for payment confirmation before returning the subscription
1023
+ */
1024
+ awaitPaymentConfirmation?: boolean;
1025
+
1026
+ billingPeriod?: 'MONTHLY' | 'ANNUALLY';
1027
+
1028
+ checkoutOptions?: SubscriptionCreateParams.CheckoutOptions;
1029
+
1030
+ /**
1031
+ * Additional metadata for the subscription
1032
+ */
1033
+ metadata?: { [key: string]: string };
1034
+
1035
+ /**
1036
+ * Optional paying customer ID for split billing scenarios
1037
+ */
1038
+ payingCustomerId?: string | null;
1039
+
1040
+ /**
1041
+ * Optional resource ID for multi-instance subscriptions
1042
+ */
1043
+ resourceId?: string | null;
1044
+
1045
+ trialOverrideConfiguration?: SubscriptionCreateParams.TrialOverrideConfiguration;
1046
+ }
1047
+
1048
+ export namespace SubscriptionCreateParams {
1049
+ export interface CheckoutOptions {
1050
+ /**
1051
+ * URL to redirect to if checkout is canceled
1052
+ */
1053
+ cancelUrl: string;
1054
+
1055
+ /**
1056
+ * URL to redirect to after successful checkout
1057
+ */
1058
+ successUrl: string;
1059
+
1060
+ /**
1061
+ * Allow promotional codes during checkout
1062
+ */
1063
+ allowPromoCodes?: boolean;
1064
+
1065
+ /**
1066
+ * Allow tax ID collection during checkout
1067
+ */
1068
+ allowTaxIdCollection?: boolean;
1069
+
1070
+ /**
1071
+ * Collect billing address during checkout
1072
+ */
1073
+ collectBillingAddress?: boolean;
1074
+
1075
+ /**
1076
+ * Collect phone number during checkout
1077
+ */
1078
+ collectPhoneNumber?: boolean;
1079
+
1080
+ /**
1081
+ * Optional reference ID for the checkout session
1082
+ */
1083
+ referenceId?: string | null;
1084
+ }
1085
+
1086
+ export interface TrialOverrideConfiguration {
1087
+ /**
1088
+ * Whether the subscription should start with a trial period
1089
+ */
1090
+ isTrial: boolean;
1091
+
1092
+ /**
1093
+ * Behavior when trial ends: CONVERT_TO_PAID or CANCEL_SUBSCRIPTION
1094
+ */
1095
+ trialEndBehavior?: 'CONVERT_TO_PAID' | 'CANCEL_SUBSCRIPTION';
1096
+
1097
+ /**
1098
+ * Custom trial end date
1099
+ */
1100
+ trialEndDate?: string;
1101
+ }
1102
+ }
1103
+
1104
+ export interface SubscriptionListParams {
1105
+ /**
1106
+ * Filter by customer ID
1107
+ */
1108
+ customerId?: string;
1109
+
1110
+ /**
1111
+ * Ending before this UUID for pagination
1112
+ */
1113
+ endingBefore?: string;
1114
+
1115
+ /**
1116
+ * Items per page
1117
+ */
1118
+ limit?: number;
1119
+
1120
+ /**
1121
+ * Starting after this UUID for pagination
1122
+ */
1123
+ startingAfter?: string;
1124
+
1125
+ /**
1126
+ * Filter by subscription status (comma-separated for multiple statuses, e.g.,
1127
+ * ACTIVE,IN_TRIAL)
1128
+ */
1129
+ status?: string;
1130
+ }
1131
+
1132
+ export interface SubscriptionDelegateParams {
1133
+ /**
1134
+ * The customer ID to delegate the subscription to
1135
+ */
1136
+ targetCustomerId: string;
1137
+ }
1138
+
1139
+ export interface SubscriptionMigrateParams {
1140
+ /**
1141
+ * When to migrate the subscription: IMMEDIATE or END_OF_BILLING_PERIOD
1142
+ */
1143
+ subscriptionMigrationTime?: 'END_OF_BILLING_PERIOD' | 'IMMEDIATE';
1144
+ }
1145
+
1146
+ export interface SubscriptionPreviewParams {
1147
+ /**
1148
+ * Customer ID
1149
+ */
1150
+ customerId: string;
1151
+
1152
+ /**
1153
+ * Plan ID
1154
+ */
1155
+ planId: string;
1156
+
1157
+ addons?: Array<SubscriptionPreviewParams.Addon>;
1158
+
1159
+ appliedCoupon?: SubscriptionPreviewParams.AppliedCoupon;
1160
+
1161
+ billableFeatures?: Array<SubscriptionPreviewParams.BillableFeature>;
1162
+
1163
+ billingCountryCode?: string;
1164
+
1165
+ billingInformation?: SubscriptionPreviewParams.BillingInformation;
1166
+
1167
+ billingPeriod?: 'MONTHLY' | 'ANNUALLY';
1168
+
1169
+ charges?: Array<SubscriptionPreviewParams.Charge>;
1170
+
1171
+ payingCustomerId?: string;
1172
+
1173
+ resourceId?: string;
1174
+
1175
+ scheduleStrategy?: 'END_OF_BILLING_PERIOD' | 'END_OF_BILLING_MONTH' | 'IMMEDIATE';
1176
+
1177
+ /**
1178
+ * Subscription start date
1179
+ */
1180
+ startDate?: string;
1181
+
1182
+ trialOverrideConfiguration?: SubscriptionPreviewParams.TrialOverrideConfiguration;
1183
+
1184
+ unitQuantity?: number;
1185
+ }
1186
+
1187
+ export namespace SubscriptionPreviewParams {
1188
+ export interface Addon {
1189
+ /**
1190
+ * Addon ID
1191
+ */
1192
+ addonId: string;
1193
+
1194
+ quantity?: number;
1195
+ }
1196
+
1197
+ export interface AppliedCoupon {
1198
+ billingCouponId?: string;
1199
+
1200
+ configuration?: AppliedCoupon.Configuration;
1201
+
1202
+ couponId?: string;
1203
+
1204
+ discount?: AppliedCoupon.Discount;
1205
+
1206
+ promotionCode?: string;
1207
+ }
1208
+
1209
+ export namespace AppliedCoupon {
1210
+ export interface Configuration {
1211
+ /**
1212
+ * Coupon start date
1213
+ */
1214
+ startDate?: string;
1215
+ }
1216
+
1217
+ export interface Discount {
1218
+ amountsOff?: Array<Discount.AmountsOff> | null;
1219
+
1220
+ description?: string;
1221
+
1222
+ durationInMonths?: number;
1223
+
1224
+ name?: string;
1225
+
1226
+ percentOff?: number;
1227
+ }
1228
+
1229
+ export namespace Discount {
1230
+ export interface AmountsOff {
1231
+ amount: number;
1232
+
1233
+ currency?:
1234
+ | 'usd'
1235
+ | 'aed'
1236
+ | 'all'
1237
+ | 'amd'
1238
+ | 'ang'
1239
+ | 'aud'
1240
+ | 'awg'
1241
+ | 'azn'
1242
+ | 'bam'
1243
+ | 'bbd'
1244
+ | 'bdt'
1245
+ | 'bgn'
1246
+ | 'bif'
1247
+ | 'bmd'
1248
+ | 'bnd'
1249
+ | 'bsd'
1250
+ | 'bwp'
1251
+ | 'byn'
1252
+ | 'bzd'
1253
+ | 'brl'
1254
+ | 'cad'
1255
+ | 'cdf'
1256
+ | 'chf'
1257
+ | 'cny'
1258
+ | 'czk'
1259
+ | 'dkk'
1260
+ | 'dop'
1261
+ | 'dzd'
1262
+ | 'egp'
1263
+ | 'etb'
1264
+ | 'eur'
1265
+ | 'fjd'
1266
+ | 'gbp'
1267
+ | 'gel'
1268
+ | 'gip'
1269
+ | 'gmd'
1270
+ | 'gyd'
1271
+ | 'hkd'
1272
+ | 'hrk'
1273
+ | 'htg'
1274
+ | 'idr'
1275
+ | 'ils'
1276
+ | 'inr'
1277
+ | 'isk'
1278
+ | 'jmd'
1279
+ | 'jpy'
1280
+ | 'kes'
1281
+ | 'kgs'
1282
+ | 'khr'
1283
+ | 'kmf'
1284
+ | 'krw'
1285
+ | 'kyd'
1286
+ | 'kzt'
1287
+ | 'lbp'
1288
+ | 'lkr'
1289
+ | 'lrd'
1290
+ | 'lsl'
1291
+ | 'mad'
1292
+ | 'mdl'
1293
+ | 'mga'
1294
+ | 'mkd'
1295
+ | 'mmk'
1296
+ | 'mnt'
1297
+ | 'mop'
1298
+ | 'mro'
1299
+ | 'mvr'
1300
+ | 'mwk'
1301
+ | 'mxn'
1302
+ | 'myr'
1303
+ | 'mzn'
1304
+ | 'nad'
1305
+ | 'ngn'
1306
+ | 'nok'
1307
+ | 'npr'
1308
+ | 'nzd'
1309
+ | 'pgk'
1310
+ | 'php'
1311
+ | 'pkr'
1312
+ | 'pln'
1313
+ | 'qar'
1314
+ | 'ron'
1315
+ | 'rsd'
1316
+ | 'rub'
1317
+ | 'rwf'
1318
+ | 'sar'
1319
+ | 'sbd'
1320
+ | 'scr'
1321
+ | 'sek'
1322
+ | 'sgd'
1323
+ | 'sle'
1324
+ | 'sll'
1325
+ | 'sos'
1326
+ | 'szl'
1327
+ | 'thb'
1328
+ | 'tjs'
1329
+ | 'top'
1330
+ | 'try'
1331
+ | 'ttd'
1332
+ | 'tzs'
1333
+ | 'uah'
1334
+ | 'uzs'
1335
+ | 'vnd'
1336
+ | 'vuv'
1337
+ | 'wst'
1338
+ | 'xaf'
1339
+ | 'xcd'
1340
+ | 'yer'
1341
+ | 'zar'
1342
+ | 'zmw'
1343
+ | 'clp'
1344
+ | 'djf'
1345
+ | 'gnf'
1346
+ | 'ugx'
1347
+ | 'pyg'
1348
+ | 'xof'
1349
+ | 'xpf';
1350
+ }
1351
+ }
1352
+ }
1353
+
1354
+ export interface BillableFeature {
1355
+ /**
1356
+ * Feature ID
1357
+ */
1358
+ featureId: string;
1359
+
1360
+ quantity: number;
1361
+ }
1362
+
1363
+ export interface BillingInformation {
1364
+ billingAddress?: BillingInformation.BillingAddress;
1365
+
1366
+ chargeOnBehalfOfAccount?: string;
1367
+
1368
+ integrationId?: string;
1369
+
1370
+ invoiceDaysUntilDue?: number;
1371
+
1372
+ isBackdated?: boolean;
1373
+
1374
+ isInvoicePaid?: boolean;
1375
+
1376
+ metadata?: unknown;
1377
+
1378
+ prorationBehavior?: 'INVOICE_IMMEDIATELY' | 'CREATE_PRORATIONS' | 'NONE';
1379
+
1380
+ taxIds?: Array<BillingInformation.TaxID>;
1381
+
1382
+ taxPercentage?: number;
1383
+
1384
+ taxRateIds?: Array<string>;
1385
+ }
1386
+
1387
+ export namespace BillingInformation {
1388
+ export interface BillingAddress {
1389
+ city?: string;
1390
+
1391
+ country?: string;
1392
+
1393
+ line1?: string;
1394
+
1395
+ line2?: string;
1396
+
1397
+ postalCode?: string;
1398
+
1399
+ state?: string;
1400
+ }
1401
+
1402
+ export interface TaxID {
1403
+ type: string;
1404
+
1405
+ value: string;
1406
+ }
1407
+ }
1408
+
1409
+ export interface Charge {
1410
+ /**
1411
+ * Charge ID
1412
+ */
1413
+ id: string;
1414
+
1415
+ quantity: number;
1416
+
1417
+ type: 'FEATURE' | 'CREDIT';
1418
+ }
1419
+
1420
+ export interface TrialOverrideConfiguration {
1421
+ isTrial: boolean;
1422
+
1423
+ trialEndBehavior?: 'CONVERT_TO_PAID' | 'CANCEL_SUBSCRIPTION';
1424
+
1425
+ /**
1426
+ * Trial end date
1427
+ */
1428
+ trialEndDate?: string;
1429
+ }
1430
+ }
1431
+
1432
+ export interface SubscriptionTransferParams {
1433
+ /**
1434
+ * The resource ID to transfer the subscription to. The destination resource must
1435
+ * belong to the same customer.
1436
+ */
1437
+ destinationResourceId: string;
1438
+ }
1439
+
1440
+ Subscriptions.FutureUpdate = FutureUpdate;
1441
+
1442
+ export declare namespace Subscriptions {
1443
+ export {
1444
+ type SubscriptionCreateResponse as SubscriptionCreateResponse,
1445
+ type SubscriptionRetrieveResponse as SubscriptionRetrieveResponse,
1446
+ type SubscriptionListResponse as SubscriptionListResponse,
1447
+ type SubscriptionDelegateResponse as SubscriptionDelegateResponse,
1448
+ type SubscriptionMigrateResponse as SubscriptionMigrateResponse,
1449
+ type SubscriptionPreviewResponse as SubscriptionPreviewResponse,
1450
+ type SubscriptionTransferResponse as SubscriptionTransferResponse,
1451
+ type SubscriptionCreateParams as SubscriptionCreateParams,
1452
+ type SubscriptionListParams as SubscriptionListParams,
1453
+ type SubscriptionDelegateParams as SubscriptionDelegateParams,
1454
+ type SubscriptionMigrateParams as SubscriptionMigrateParams,
1455
+ type SubscriptionPreviewParams as SubscriptionPreviewParams,
1456
+ type SubscriptionTransferParams as SubscriptionTransferParams,
1457
+ };
1458
+
1459
+ export {
1460
+ FutureUpdate as FutureUpdate,
1461
+ type FutureUpdateCancelPendingPaymentResponse as FutureUpdateCancelPendingPaymentResponse,
1462
+ type FutureUpdateCancelScheduleResponse as FutureUpdateCancelScheduleResponse,
1463
+ };
1464
+ }