@flexprice/sdk 2.1.47 → 2.1.48-dev.10

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 (290) hide show
  1. package/docs/sdk/models/billing-term-input.md +30 -0
  2. package/docs/sdk/models/billing-term-kind.md +17 -0
  3. package/docs/sdk/models/billing-term-owner-type.md +15 -0
  4. package/docs/sdk/models/billing-term-split.md +17 -0
  5. package/docs/sdk/models/billing-term-value-type.md +19 -0
  6. package/docs/sdk/models/billing-terms-response.md +16 -0
  7. package/docs/sdk/models/billingterm-instalment.md +40 -0
  8. package/docs/sdk/models/billingterm-term.md +37 -0
  9. package/docs/sdk/models/cancellation-fee-input.md +19 -0
  10. package/docs/sdk/models/cancellation-fee-type.md +17 -0
  11. package/docs/sdk/models/commitment-response.md +3 -1
  12. package/docs/sdk/models/create-commitment-request.md +3 -1
  13. package/docs/sdk/models/get-commitment-billing-terms-request.md +17 -0
  14. package/docs/sdk/models/get-subscription-v2-request.md +4 -4
  15. package/docs/sdk/models/instalment-bill-trigger.md +17 -0
  16. package/docs/sdk/models/instalment-delivery.md +17 -0
  17. package/docs/sdk/models/instalment-kind.md +17 -0
  18. package/docs/sdk/models/instalment-status.md +17 -0
  19. package/docs/sdk/models/invoice-billing-reason.md +1 -1
  20. package/docs/sdk/models/invoice-line-item-response.md +1 -0
  21. package/docs/sdk/models/list-commitment-instalments-request.md +18 -0
  22. package/docs/sdk/models/list-instalments-response.md +15 -0
  23. package/docs/sdk/models/preview-commitment-billing-terms-request.md +21 -0
  24. package/docs/sdk/models/replace-billing-terms-request.md +17 -0
  25. package/docs/sdk/models/replace-commitment-billing-terms-request.md +21 -0
  26. package/docs/sdk/models/subscription-response-v2.md +1 -0
  27. package/docs/sdk/models/subscription-response.md +1 -0
  28. package/docs/sdk/models/terminate-commitment-request.md +4 -4
  29. package/docs/sdk/models/trigger-commitment-instalment-request.md +20 -0
  30. package/docs/sdk/models/trigger-instalment-request.md +15 -0
  31. package/docs/sdk/models/update-commitment-request.md +7 -6
  32. package/docs/sdk/models/webhook-dto-billing-instalment-webhook-payload.md +16 -0
  33. package/docs/sdk/models/webhook-dto-billing-terms-webhook-payload.md +18 -0
  34. package/docs/sdk/models/webhook-dto-invoice-line-item.md +1 -0
  35. package/docs/sdk/models/webhook-event-name.md +1 -1
  36. package/docs/sdks/commitments/README.md +384 -1
  37. package/docs/sdks/subscriptions/README.md +1 -1
  38. package/docs/sdks/webhookevents/README.md +414 -0
  39. package/esm/funcs/commitments-get-commitment-billing-terms.d.ts +17 -0
  40. package/esm/funcs/commitments-get-commitment-billing-terms.d.ts.map +1 -0
  41. package/esm/funcs/commitments-get-commitment-billing-terms.js +91 -0
  42. package/esm/funcs/commitments-get-commitment-billing-terms.js.map +1 -0
  43. package/esm/funcs/commitments-list-commitment-instalments.d.ts +17 -0
  44. package/esm/funcs/commitments-list-commitment-instalments.d.ts.map +1 -0
  45. package/esm/funcs/commitments-list-commitment-instalments.js +96 -0
  46. package/esm/funcs/commitments-list-commitment-instalments.js.map +1 -0
  47. package/esm/funcs/commitments-preview-commitment-billing-terms.d.ts +17 -0
  48. package/esm/funcs/commitments-preview-commitment-billing-terms.d.ts.map +1 -0
  49. package/esm/funcs/commitments-preview-commitment-billing-terms.js +93 -0
  50. package/esm/funcs/commitments-preview-commitment-billing-terms.js.map +1 -0
  51. package/esm/funcs/commitments-replace-commitment-billing-terms.d.ts +17 -0
  52. package/esm/funcs/commitments-replace-commitment-billing-terms.d.ts.map +1 -0
  53. package/esm/funcs/commitments-replace-commitment-billing-terms.js +93 -0
  54. package/esm/funcs/commitments-replace-commitment-billing-terms.js.map +1 -0
  55. package/esm/funcs/commitments-terminate-commitment.d.ts +1 -1
  56. package/esm/funcs/commitments-terminate-commitment.js +1 -1
  57. package/esm/funcs/commitments-trigger-commitment-instalment.d.ts +17 -0
  58. package/esm/funcs/commitments-trigger-commitment-instalment.d.ts.map +1 -0
  59. package/esm/funcs/commitments-trigger-commitment-instalment.js +98 -0
  60. package/esm/funcs/commitments-trigger-commitment-instalment.js.map +1 -0
  61. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.d.ts +17 -0
  62. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.d.ts.map +1 -0
  63. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.js +69 -0
  64. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.js.map +1 -0
  65. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.d.ts +17 -0
  66. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.d.ts.map +1 -0
  67. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.js +69 -0
  68. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-created.js.map +1 -0
  69. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.d.ts +17 -0
  70. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.d.ts.map +1 -0
  71. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.js +69 -0
  72. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.js.map +1 -0
  73. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.d.ts +17 -0
  74. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.d.ts.map +1 -0
  75. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.js +69 -0
  76. package/esm/funcs/webhook-events-post-webhook-events-billing-instalment-updated.js.map +1 -0
  77. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.d.ts +17 -0
  78. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.d.ts.map +1 -0
  79. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.js +69 -0
  80. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-created.js.map +1 -0
  81. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.d.ts +17 -0
  82. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.d.ts.map +1 -0
  83. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.js +69 -0
  84. package/esm/funcs/webhook-events-post-webhook-events-billing-terms-updated.js.map +1 -0
  85. package/esm/lib/config.d.ts +3 -3
  86. package/esm/lib/config.d.ts.map +1 -1
  87. package/esm/lib/config.js +3 -3
  88. package/esm/lib/config.js.map +1 -1
  89. package/esm/sdk/commitments.d.ts +36 -1
  90. package/esm/sdk/commitments.d.ts.map +1 -1
  91. package/esm/sdk/commitments.js +51 -1
  92. package/esm/sdk/commitments.js.map +1 -1
  93. package/esm/sdk/models/billing-term-input.d.ts +67 -0
  94. package/esm/sdk/models/billing-term-input.d.ts.map +1 -0
  95. package/esm/sdk/models/billing-term-input.js +43 -0
  96. package/esm/sdk/models/billing-term-input.js.map +1 -0
  97. package/esm/sdk/models/billing-term-kind.d.ts +12 -0
  98. package/esm/sdk/models/billing-term-kind.d.ts.map +1 -0
  99. package/esm/sdk/models/billing-term-kind.js +13 -0
  100. package/esm/sdk/models/billing-term-kind.js.map +1 -0
  101. package/esm/sdk/models/billing-term-owner-type.d.ts +9 -0
  102. package/esm/sdk/models/billing-term-owner-type.d.ts.map +1 -0
  103. package/esm/sdk/models/billing-term-owner-type.js +10 -0
  104. package/esm/sdk/models/billing-term-owner-type.js.map +1 -0
  105. package/esm/sdk/models/billing-term-split.d.ts +12 -0
  106. package/esm/sdk/models/billing-term-split.d.ts.map +1 -0
  107. package/esm/sdk/models/billing-term-split.js +13 -0
  108. package/esm/sdk/models/billing-term-split.js.map +1 -0
  109. package/esm/sdk/models/billing-term-value-type.d.ts +19 -0
  110. package/esm/sdk/models/billing-term-value-type.d.ts.map +1 -0
  111. package/esm/sdk/models/billing-term-value-type.js +17 -0
  112. package/esm/sdk/models/billing-term-value-type.js.map +1 -0
  113. package/esm/sdk/models/billing-terms-response.d.ts +13 -0
  114. package/esm/sdk/models/billing-terms-response.d.ts.map +1 -0
  115. package/esm/sdk/models/billing-terms-response.js +22 -0
  116. package/esm/sdk/models/billing-terms-response.js.map +1 -0
  117. package/esm/sdk/models/billingterm-instalment.d.ts +43 -0
  118. package/esm/sdk/models/billingterm-instalment.d.ts.map +1 -0
  119. package/esm/sdk/models/billingterm-instalment.js +68 -0
  120. package/esm/sdk/models/billingterm-instalment.js.map +1 -0
  121. package/esm/sdk/models/billingterm-term.d.ts +57 -0
  122. package/esm/sdk/models/billingterm-term.d.ts.map +1 -0
  123. package/esm/sdk/models/billingterm-term.js +65 -0
  124. package/esm/sdk/models/billingterm-term.js.map +1 -0
  125. package/esm/sdk/models/cancellation-fee-input.d.ts +18 -0
  126. package/esm/sdk/models/cancellation-fee-input.d.ts.map +1 -0
  127. package/esm/sdk/models/cancellation-fee-input.js +14 -0
  128. package/esm/sdk/models/cancellation-fee-input.js.map +1 -0
  129. package/esm/sdk/models/cancellation-fee-type.d.ts +16 -0
  130. package/esm/sdk/models/cancellation-fee-type.d.ts.map +1 -0
  131. package/esm/sdk/models/cancellation-fee-type.js +14 -0
  132. package/esm/sdk/models/cancellation-fee-type.js.map +1 -0
  133. package/esm/sdk/models/commitment-response.d.ts +9 -1
  134. package/esm/sdk/models/commitment-response.d.ts.map +1 -1
  135. package/esm/sdk/models/commitment-response.js +7 -1
  136. package/esm/sdk/models/commitment-response.js.map +1 -1
  137. package/esm/sdk/models/create-commitment-request.d.ts +12 -0
  138. package/esm/sdk/models/create-commitment-request.d.ts.map +1 -1
  139. package/esm/sdk/models/create-commitment-request.js +6 -0
  140. package/esm/sdk/models/create-commitment-request.js.map +1 -1
  141. package/esm/sdk/models/get-commitment-billing-terms-op.d.ts +15 -0
  142. package/esm/sdk/models/get-commitment-billing-terms-op.d.ts.map +1 -0
  143. package/esm/sdk/models/get-commitment-billing-terms-op.js +12 -0
  144. package/esm/sdk/models/get-commitment-billing-terms-op.js.map +1 -0
  145. package/esm/sdk/models/get-subscription-v2-op.d.ts +1 -1
  146. package/esm/sdk/models/index.d.ts +24 -0
  147. package/esm/sdk/models/index.d.ts.map +1 -1
  148. package/esm/sdk/models/index.js +24 -0
  149. package/esm/sdk/models/index.js.map +1 -1
  150. package/esm/sdk/models/instalment-bill-trigger.d.ts +12 -0
  151. package/esm/sdk/models/instalment-bill-trigger.d.ts.map +1 -0
  152. package/esm/sdk/models/instalment-bill-trigger.js +13 -0
  153. package/esm/sdk/models/instalment-bill-trigger.js.map +1 -0
  154. package/esm/sdk/models/instalment-delivery.d.ts +12 -0
  155. package/esm/sdk/models/instalment-delivery.d.ts.map +1 -0
  156. package/esm/sdk/models/instalment-delivery.js +13 -0
  157. package/esm/sdk/models/instalment-delivery.js.map +1 -0
  158. package/esm/sdk/models/instalment-kind.d.ts +10 -0
  159. package/esm/sdk/models/instalment-kind.d.ts.map +1 -0
  160. package/esm/sdk/models/instalment-kind.js +11 -0
  161. package/esm/sdk/models/instalment-kind.js.map +1 -0
  162. package/esm/sdk/models/instalment-status.d.ts +11 -0
  163. package/esm/sdk/models/instalment-status.d.ts.map +1 -0
  164. package/esm/sdk/models/instalment-status.js +12 -0
  165. package/esm/sdk/models/instalment-status.js.map +1 -0
  166. package/esm/sdk/models/invoice-billing-reason.d.ts +2 -0
  167. package/esm/sdk/models/invoice-billing-reason.d.ts.map +1 -1
  168. package/esm/sdk/models/invoice-billing-reason.js +2 -0
  169. package/esm/sdk/models/invoice-billing-reason.js.map +1 -1
  170. package/esm/sdk/models/invoice-line-item-response.d.ts +4 -0
  171. package/esm/sdk/models/invoice-line-item-response.d.ts.map +1 -1
  172. package/esm/sdk/models/invoice-line-item-response.js +2 -0
  173. package/esm/sdk/models/invoice-line-item-response.js.map +1 -1
  174. package/esm/sdk/models/list-commitment-instalments-op.d.ts +20 -0
  175. package/esm/sdk/models/list-commitment-instalments-op.d.ts.map +1 -0
  176. package/esm/sdk/models/list-commitment-instalments-op.js +13 -0
  177. package/esm/sdk/models/list-commitment-instalments-op.js.map +1 -0
  178. package/esm/sdk/models/list-instalments-response.d.ts +11 -0
  179. package/esm/sdk/models/list-instalments-response.d.ts.map +1 -0
  180. package/esm/sdk/models/list-instalments-response.js +15 -0
  181. package/esm/sdk/models/list-instalments-response.js.map +1 -0
  182. package/esm/sdk/models/preview-commitment-billing-terms-op.d.ts +21 -0
  183. package/esm/sdk/models/preview-commitment-billing-terms-op.d.ts.map +1 -0
  184. package/esm/sdk/models/preview-commitment-billing-terms-op.js +14 -0
  185. package/esm/sdk/models/preview-commitment-billing-terms-op.js.map +1 -0
  186. package/esm/sdk/models/replace-billing-terms-request.d.ts +13 -0
  187. package/esm/sdk/models/replace-billing-terms-request.d.ts.map +1 -0
  188. package/esm/sdk/models/replace-billing-terms-request.js +18 -0
  189. package/esm/sdk/models/replace-billing-terms-request.js.map +1 -0
  190. package/esm/sdk/models/replace-commitment-billing-terms-op.d.ts +21 -0
  191. package/esm/sdk/models/replace-commitment-billing-terms-op.d.ts.map +1 -0
  192. package/esm/sdk/models/replace-commitment-billing-terms-op.js +14 -0
  193. package/esm/sdk/models/replace-commitment-billing-terms-op.js.map +1 -0
  194. package/esm/sdk/models/subscription-response-v2.d.ts +5 -0
  195. package/esm/sdk/models/subscription-response-v2.d.ts.map +1 -1
  196. package/esm/sdk/models/subscription-response-v2.js +2 -0
  197. package/esm/sdk/models/subscription-response-v2.js.map +1 -1
  198. package/esm/sdk/models/subscription-response.d.ts +5 -0
  199. package/esm/sdk/models/subscription-response.d.ts.map +1 -1
  200. package/esm/sdk/models/subscription-response.js +2 -0
  201. package/esm/sdk/models/subscription-response.js.map +1 -1
  202. package/esm/sdk/models/terminate-commitment-request.d.ts +6 -2
  203. package/esm/sdk/models/terminate-commitment-request.d.ts.map +1 -1
  204. package/esm/sdk/models/terminate-commitment-request.js +2 -1
  205. package/esm/sdk/models/terminate-commitment-request.js.map +1 -1
  206. package/esm/sdk/models/trigger-commitment-instalment-op.d.ts +26 -0
  207. package/esm/sdk/models/trigger-commitment-instalment-op.d.ts.map +1 -0
  208. package/esm/sdk/models/trigger-commitment-instalment-op.js +20 -0
  209. package/esm/sdk/models/trigger-commitment-instalment-op.js.map +1 -0
  210. package/esm/sdk/models/trigger-instalment-request.d.ts +15 -0
  211. package/esm/sdk/models/trigger-instalment-request.d.ts.map +1 -0
  212. package/esm/sdk/models/trigger-instalment-request.js +17 -0
  213. package/esm/sdk/models/trigger-instalment-request.js.map +1 -0
  214. package/esm/sdk/models/update-commitment-request.d.ts +5 -0
  215. package/esm/sdk/models/update-commitment-request.d.ts.map +1 -1
  216. package/esm/sdk/models/update-commitment-request.js +2 -0
  217. package/esm/sdk/models/update-commitment-request.js.map +1 -1
  218. package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.d.ts +13 -0
  219. package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.d.ts.map +1 -0
  220. package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.js +22 -0
  221. package/esm/sdk/models/webhook-dto-billing-instalment-webhook-payload.js.map +1 -0
  222. package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.d.ts +16 -0
  223. package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.d.ts.map +1 -0
  224. package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.js +28 -0
  225. package/esm/sdk/models/webhook-dto-billing-terms-webhook-payload.js.map +1 -0
  226. package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts +1 -0
  227. package/esm/sdk/models/webhook-dto-invoice-line-item.d.ts.map +1 -1
  228. package/esm/sdk/models/webhook-dto-invoice-line-item.js +2 -0
  229. package/esm/sdk/models/webhook-dto-invoice-line-item.js.map +1 -1
  230. package/esm/sdk/models/webhook-event-name.d.ts +6 -0
  231. package/esm/sdk/models/webhook-event-name.d.ts.map +1 -1
  232. package/esm/sdk/models/webhook-event-name.js +6 -0
  233. package/esm/sdk/models/webhook-event-name.js.map +1 -1
  234. package/esm/sdk/webhook-events.d.ts +42 -0
  235. package/esm/sdk/webhook-events.d.ts.map +1 -1
  236. package/esm/sdk/webhook-events.js +60 -0
  237. package/esm/sdk/webhook-events.js.map +1 -1
  238. package/jsr.json +1 -1
  239. package/package.json +3 -3
  240. package/src/funcs/commitments-get-commitment-billing-terms.ts +182 -0
  241. package/src/funcs/commitments-list-commitment-instalments.ts +191 -0
  242. package/src/funcs/commitments-preview-commitment-billing-terms.ts +192 -0
  243. package/src/funcs/commitments-replace-commitment-billing-terms.ts +190 -0
  244. package/src/funcs/commitments-terminate-commitment.ts +1 -1
  245. package/src/funcs/commitments-trigger-commitment-instalment.ts +197 -0
  246. package/src/funcs/webhook-events-post-webhook-events-billing-instalment-cancelled.ts +144 -0
  247. package/src/funcs/webhook-events-post-webhook-events-billing-instalment-created.ts +144 -0
  248. package/src/funcs/webhook-events-post-webhook-events-billing-instalment-invoiced.ts +144 -0
  249. package/src/funcs/webhook-events-post-webhook-events-billing-instalment-updated.ts +144 -0
  250. package/src/funcs/webhook-events-post-webhook-events-billing-terms-created.ts +144 -0
  251. package/src/funcs/webhook-events-post-webhook-events-billing-terms-updated.ts +144 -0
  252. package/src/lib/config.ts +4 -3
  253. package/src/sdk/commitments.ts +101 -1
  254. package/src/sdk/models/billing-term-input.ts +127 -0
  255. package/src/sdk/models/billing-term-kind.ts +24 -0
  256. package/src/sdk/models/billing-term-owner-type.ts +16 -0
  257. package/src/sdk/models/billing-term-split.ts +24 -0
  258. package/src/sdk/models/billing-term-value-type.ts +31 -0
  259. package/src/sdk/models/billing-terms-response.ts +49 -0
  260. package/src/sdk/models/billingterm-instalment.ts +128 -0
  261. package/src/sdk/models/billingterm-term.ts +143 -0
  262. package/src/sdk/models/cancellation-fee-input.ts +40 -0
  263. package/src/sdk/models/cancellation-fee-type.ts +23 -0
  264. package/src/sdk/models/commitment-response.ts +22 -2
  265. package/src/sdk/models/create-commitment-request.ts +23 -0
  266. package/src/sdk/models/get-commitment-billing-terms-op.ts +35 -0
  267. package/src/sdk/models/get-subscription-v2-op.ts +1 -1
  268. package/src/sdk/models/index.ts +24 -0
  269. package/src/sdk/models/instalment-bill-trigger.ts +24 -0
  270. package/src/sdk/models/instalment-delivery.ts +24 -0
  271. package/src/sdk/models/instalment-kind.ts +19 -0
  272. package/src/sdk/models/instalment-status.ts +20 -0
  273. package/src/sdk/models/invoice-billing-reason.ts +2 -0
  274. package/src/sdk/models/invoice-line-item-response.ts +6 -0
  275. package/src/sdk/models/list-commitment-instalments-op.ts +41 -0
  276. package/src/sdk/models/list-instalments-response.ts +35 -0
  277. package/src/sdk/models/preview-commitment-billing-terms-op.ts +46 -0
  278. package/src/sdk/models/replace-billing-terms-request.ts +43 -0
  279. package/src/sdk/models/replace-commitment-billing-terms-op.ts +46 -0
  280. package/src/sdk/models/subscription-response-v2.ts +9 -0
  281. package/src/sdk/models/subscription-response.ts +9 -0
  282. package/src/sdk/models/terminate-commitment-request.ts +11 -3
  283. package/src/sdk/models/trigger-commitment-instalment-op.ts +60 -0
  284. package/src/sdk/models/trigger-instalment-request.ts +41 -0
  285. package/src/sdk/models/update-commitment-request.ts +7 -0
  286. package/src/sdk/models/webhook-dto-billing-instalment-webhook-payload.ts +53 -0
  287. package/src/sdk/models/webhook-dto-billing-terms-webhook-payload.ts +61 -0
  288. package/src/sdk/models/webhook-dto-invoice-line-item.ts +3 -0
  289. package/src/sdk/models/webhook-event-name.ts +6 -0
  290. package/src/sdk/webhook-events.ts +96 -0
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { FlexPriceError } from "../sdk/models/flex-price-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../sdk/models/http-client-errors.js";
20
+ import * as models from "../sdk/models/index.js";
21
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
22
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * billing_instalment.updated
28
+ *
29
+ * @remarks
30
+ * Fired when a trigger moves a billing instalment's bill date, or a voided invoice puts it back on schedule. Doc-only for parsing.
31
+ */
32
+ export function webhookEventsPostWebhookEventsBillingInstalmentUpdated(
33
+ client: FlexpriceCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.WebhookDtoBillingInstalmentWebhookPayload,
38
+ | FlexPriceError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: FlexpriceCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ models.WebhookDtoBillingInstalmentWebhookPayload,
61
+ | FlexPriceError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/webhook-events/billing_instalment.updated")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
80
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "post_/webhook-events/billing_instalment.updated",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyAuth,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "POST",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ userAgent: client._options.userAgent,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return [requestRes, { status: "invalid" }];
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ isErrorStatusCode: (statusCode: number) =>
115
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return [doResult, { status: "request-error", request: req }];
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const [result] = await M.match<
125
+ models.WebhookDtoBillingInstalmentWebhookPayload,
126
+ | FlexPriceError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, models.WebhookDtoBillingInstalmentWebhookPayload$inboundSchema),
136
+ M.fail("4XX"),
137
+ M.fail("5XX"),
138
+ )(response, req);
139
+ if (!result.ok) {
140
+ return [result, { status: "complete", request: req, response }];
141
+ }
142
+
143
+ return [result, { status: "complete", request: req, response }];
144
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { FlexPriceError } from "../sdk/models/flex-price-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../sdk/models/http-client-errors.js";
20
+ import * as models from "../sdk/models/index.js";
21
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
22
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * billing_terms.created
28
+ *
29
+ * @remarks
30
+ * Fired when billing terms are saved against an entity (like a commitment). Doc-only for parsing.
31
+ */
32
+ export function webhookEventsPostWebhookEventsBillingTermsCreated(
33
+ client: FlexpriceCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.WebhookDtoBillingTermsWebhookPayload,
38
+ | FlexPriceError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: FlexpriceCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ models.WebhookDtoBillingTermsWebhookPayload,
61
+ | FlexPriceError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/webhook-events/billing_terms.created")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
80
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "post_/webhook-events/billing_terms.created",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyAuth,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "POST",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ userAgent: client._options.userAgent,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return [requestRes, { status: "invalid" }];
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ isErrorStatusCode: (statusCode: number) =>
115
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return [doResult, { status: "request-error", request: req }];
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const [result] = await M.match<
125
+ models.WebhookDtoBillingTermsWebhookPayload,
126
+ | FlexPriceError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, models.WebhookDtoBillingTermsWebhookPayload$inboundSchema),
136
+ M.fail("4XX"),
137
+ M.fail("5XX"),
138
+ )(response, req);
139
+ if (!result.ok) {
140
+ return [result, { status: "complete", request: req, response }];
141
+ }
142
+
143
+ return [result, { status: "complete", request: req, response }];
144
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { FlexPriceError } from "../sdk/models/flex-price-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../sdk/models/http-client-errors.js";
20
+ import * as models from "../sdk/models/index.js";
21
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
22
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * billing_terms.updated
28
+ *
29
+ * @remarks
30
+ * Fired when an entity's (like a commitment's) billing terms are replaced. Doc-only for parsing.
31
+ */
32
+ export function webhookEventsPostWebhookEventsBillingTermsUpdated(
33
+ client: FlexpriceCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.WebhookDtoBillingTermsWebhookPayload,
38
+ | FlexPriceError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: FlexpriceCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ models.WebhookDtoBillingTermsWebhookPayload,
61
+ | FlexPriceError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/webhook-events/billing_terms.updated")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
80
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "post_/webhook-events/billing_terms.updated",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyAuth,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "POST",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ userAgent: client._options.userAgent,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return [requestRes, { status: "invalid" }];
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ isErrorStatusCode: (statusCode: number) =>
115
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return [doResult, { status: "request-error", request: req }];
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const [result] = await M.match<
125
+ models.WebhookDtoBillingTermsWebhookPayload,
126
+ | FlexPriceError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, models.WebhookDtoBillingTermsWebhookPayload$inboundSchema),
136
+ M.fail("4XX"),
137
+ M.fail("5XX"),
138
+ )(response, req);
139
+ if (!result.ok) {
140
+ return [result, { status: "complete", request: req, response }];
141
+ }
142
+
143
+ return [result, { status: "complete", request: req, response }];
144
+ }
package/src/lib/config.ts CHANGED
@@ -77,7 +77,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
77
77
  export const SDK_METADATA = {
78
78
  language: "typescript",
79
79
  openapiDocVersion: "1.0",
80
- sdkVersion: "2.1.47",
81
- genVersion: "2.948.4",
82
- userAgent: "speakeasy-sdk/typescript 2.1.47 2.948.4 1.0 @flexprice/sdk",
80
+ sdkVersion: "2.1.48-dev.10",
81
+ genVersion: "2.956.1",
82
+ userAgent:
83
+ "speakeasy-sdk/typescript 2.1.48-dev.10 2.956.1 1.0 @flexprice/sdk",
83
84
  } as const;
@@ -3,10 +3,15 @@
3
3
  */
4
4
 
5
5
  import { commitmentsCreateCommitment } from "../funcs/commitments-create-commitment.js";
6
+ import { commitmentsGetCommitmentBillingTerms } from "../funcs/commitments-get-commitment-billing-terms.js";
6
7
  import { commitmentsGetCommitment } from "../funcs/commitments-get-commitment.js";
8
+ import { commitmentsListCommitmentInstalments } from "../funcs/commitments-list-commitment-instalments.js";
9
+ import { commitmentsPreviewCommitmentBillingTerms } from "../funcs/commitments-preview-commitment-billing-terms.js";
7
10
  import { commitmentsPreviewCommitment } from "../funcs/commitments-preview-commitment.js";
8
11
  import { commitmentsQueryCommitment } from "../funcs/commitments-query-commitment.js";
12
+ import { commitmentsReplaceCommitmentBillingTerms } from "../funcs/commitments-replace-commitment-billing-terms.js";
9
13
  import { commitmentsTerminateCommitment } from "../funcs/commitments-terminate-commitment.js";
14
+ import { commitmentsTriggerCommitmentInstalment } from "../funcs/commitments-trigger-commitment-instalment.js";
10
15
  import { commitmentsUpdateCommitment } from "../funcs/commitments-update-commitment.js";
11
16
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
12
17
  import { unwrapAsync } from "../types/fp.js";
@@ -100,11 +105,106 @@ export class Commitments extends ClientSDK {
100
105
  ));
101
106
  }
102
107
 
108
+ /**
109
+ * Get billing terms
110
+ *
111
+ * @remarks
112
+ * Returns the commitment's current billing terms with its scheduled and invoiced instalments in billing order. Invoiced instalments may come from terms an edit replaced. Cancelled instalments are listed by the instalments endpoint.
113
+ */
114
+ async getCommitmentBillingTerms(
115
+ id: string,
116
+ options?: RequestOptions,
117
+ ): Promise<models.BillingTermsResponse> {
118
+ return unwrapAsync(commitmentsGetCommitmentBillingTerms(
119
+ this,
120
+ id,
121
+ options,
122
+ ));
123
+ }
124
+
125
+ /**
126
+ * Edit billing terms
127
+ *
128
+ * @remarks
129
+ * Replaces the whole set of billing terms of an active commitment. Its scheduled instalments are cancelled and the new terms generate instalments for what the invoiced ones leave of the commitment total; invoiced instalments and their invoices are kept. A term without bill_on or start_date starts at the billing period holding now, or at the commitment start once its term has ended. Returns the new terms with the scheduled and invoiced instalments in billing order.
130
+ */
131
+ async replaceCommitmentBillingTerms(
132
+ id: string,
133
+ body: models.ReplaceBillingTermsRequest,
134
+ options?: RequestOptions,
135
+ ): Promise<models.BillingTermsResponse> {
136
+ return unwrapAsync(commitmentsReplaceCommitmentBillingTerms(
137
+ this,
138
+ id,
139
+ body,
140
+ options,
141
+ ));
142
+ }
143
+
144
+ /**
145
+ * Preview billing terms edit
146
+ *
147
+ * @remarks
148
+ * Returns what editing the billing terms would produce, without saving anything: the new terms with the invoiced and new instalments in billing order.
149
+ */
150
+ async previewCommitmentBillingTerms(
151
+ id: string,
152
+ body: models.ReplaceBillingTermsRequest,
153
+ options?: RequestOptions,
154
+ ): Promise<models.BillingTermsResponse> {
155
+ return unwrapAsync(commitmentsPreviewCommitmentBillingTerms(
156
+ this,
157
+ id,
158
+ body,
159
+ options,
160
+ ));
161
+ }
162
+
163
+ /**
164
+ * List instalments
165
+ *
166
+ * @remarks
167
+ * Lists the instalments of the commitment in billing order. Without a status filter every instalment is listed, cancelled ones included.
168
+ */
169
+ async listCommitmentInstalments(
170
+ id: string,
171
+ status?: Array<string> | undefined,
172
+ options?: RequestOptions,
173
+ ): Promise<models.ListInstalmentsResponse> {
174
+ return unwrapAsync(commitmentsListCommitmentInstalments(
175
+ this,
176
+ id,
177
+ status,
178
+ options,
179
+ ));
180
+ }
181
+
182
+ /**
183
+ * Trigger instalment
184
+ *
185
+ * @remarks
186
+ * Bills a manual instalment of an active commitment on bill_on, now by default, which must fall within the commitment term. The instalment goes on the first subscription invoice at or after that date, or on its own invoice once due when its instalment_invoicing, the term's or else the commitment's, is separate_invoice. Either way it waits while the subscription is trialing or paused. Until it is triggered, a manual instalment waits at the end of the term, and bill_on can only move earlier; edit the billing terms to bill it later.
187
+ */
188
+ async triggerCommitmentInstalment(
189
+ id: string,
190
+ instalmentId: string,
191
+ body?: models.TriggerInstalmentRequest | undefined,
192
+ options?: RequestOptions,
193
+ ): Promise<models.BillingtermInstalment> {
194
+ return unwrapAsync(commitmentsTriggerCommitmentInstalment(
195
+ this,
196
+ id,
197
+ instalmentId,
198
+ body,
199
+ options,
200
+ ));
201
+ }
202
+
103
203
  /**
104
204
  * Terminate commitment
105
205
  *
106
206
  * @remarks
107
- * Ends a commitment early, effective at the given time or now.
207
+ * Ends a commitment immediately. effective_at defaults to now and cannot be in the future. Under billing terms, its scheduled instalments are cancelled, and those already due by effective_at are billed together as one settlement; later instalments are not billed and nothing is refunded. The settlement and a fixed cancellation fee, when given, are billed together on one one-off invoice.
108
208
  */
109
209
  async terminateCommitment(
110
210
  id: string,
@@ -0,0 +1,127 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ BillingTermKind,
9
+ BillingTermKind$outboundSchema,
10
+ } from "./billing-term-kind.js";
11
+ import {
12
+ BillingTermSplit,
13
+ BillingTermSplit$outboundSchema,
14
+ } from "./billing-term-split.js";
15
+ import {
16
+ BillingTermValueType,
17
+ BillingTermValueType$outboundSchema,
18
+ } from "./billing-term-value-type.js";
19
+ import {
20
+ InstalmentBillTrigger,
21
+ InstalmentBillTrigger$outboundSchema,
22
+ } from "./instalment-bill-trigger.js";
23
+ import {
24
+ InstalmentDelivery,
25
+ InstalmentDelivery$outboundSchema,
26
+ } from "./instalment-delivery.js";
27
+ import {
28
+ InvoiceCadence,
29
+ InvoiceCadence$outboundSchema,
30
+ } from "./invoice-cadence.js";
31
+
32
+ export type BillingTermInput = {
33
+ /**
34
+ * BillOn defaults to the commitment start, or on an edit to the start of the billing period holding now (the
35
+ *
36
+ * @remarks
37
+ * commitment start once its term has ended). A manual term omits it and waits at the commitment end.
38
+ */
39
+ billOn?: string | undefined;
40
+ billTrigger?: InstalmentBillTrigger | undefined;
41
+ endDate?: Date | undefined;
42
+ instalmentInvoicing?: InstalmentDelivery | undefined;
43
+ invoiceCadence?: InvoiceCadence | undefined;
44
+ /**
45
+ * InvoiceLabel names the term's instalments, "Instalment {n} of {of}" by default. {n} and {of} count only the
46
+ *
47
+ * @remarks
48
+ * commitment's instalments whose labels use them.
49
+ */
50
+ invoiceLabel?: string | undefined;
51
+ kind: BillingTermKind;
52
+ metadata?: { [k: string]: string } | undefined;
53
+ periodCount?: number | undefined;
54
+ split?: BillingTermSplit | undefined;
55
+ /**
56
+ * StartDate and EndDate are edges of the periods the term steps on: billing periods, or anniversary ones when it is
57
+ *
58
+ * @remarks
59
+ * invoiced separately; by default, the period holding the commitment start (now, on an edit) to the commitment end.
60
+ */
61
+ startDate?: Date | undefined;
62
+ value?: string | undefined;
63
+ /**
64
+ * fixed or remainder; percentage is reserved and rejected as not supported yet
65
+ */
66
+ valueType: BillingTermValueType;
67
+ };
68
+
69
+ /** @internal */
70
+ export type BillingTermInput$Outbound = {
71
+ bill_on?: string | undefined;
72
+ bill_trigger?: string | undefined;
73
+ end_date?: string | undefined;
74
+ instalment_invoicing?: string | undefined;
75
+ invoice_cadence?: string | undefined;
76
+ invoice_label?: string | undefined;
77
+ kind: string;
78
+ metadata?: { [k: string]: string } | undefined;
79
+ period_count?: number | undefined;
80
+ split?: string | undefined;
81
+ start_date?: string | undefined;
82
+ value?: string | undefined;
83
+ value_type: string;
84
+ };
85
+
86
+ /** @internal */
87
+ export const BillingTermInput$outboundSchema: z.ZodMiniType<
88
+ BillingTermInput$Outbound,
89
+ BillingTermInput
90
+ > = z.pipe(
91
+ z.object({
92
+ billOn: z.optional(z.string()),
93
+ billTrigger: z.optional(InstalmentBillTrigger$outboundSchema),
94
+ endDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
95
+ instalmentInvoicing: z.optional(InstalmentDelivery$outboundSchema),
96
+ invoiceCadence: z.optional(InvoiceCadence$outboundSchema),
97
+ invoiceLabel: z.optional(z.string()),
98
+ kind: BillingTermKind$outboundSchema,
99
+ metadata: z.optional(z.record(z.string(), z.string())),
100
+ periodCount: z.optional(z.int()),
101
+ split: z.optional(BillingTermSplit$outboundSchema),
102
+ startDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
103
+ value: z.optional(z.string()),
104
+ valueType: BillingTermValueType$outboundSchema,
105
+ }),
106
+ z.transform((v) => {
107
+ return remap$(v, {
108
+ billOn: "bill_on",
109
+ billTrigger: "bill_trigger",
110
+ endDate: "end_date",
111
+ instalmentInvoicing: "instalment_invoicing",
112
+ invoiceCadence: "invoice_cadence",
113
+ invoiceLabel: "invoice_label",
114
+ periodCount: "period_count",
115
+ startDate: "start_date",
116
+ valueType: "value_type",
117
+ });
118
+ }),
119
+ );
120
+
121
+ export function billingTermInputToJSON(
122
+ billingTermInput: BillingTermInput,
123
+ ): string {
124
+ return JSON.stringify(
125
+ BillingTermInput$outboundSchema.parse(billingTermInput),
126
+ );
127
+ }