orb-billing 1.0.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 (413) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +169 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +20 -0
  5. package/dist/internal/utils/contenttype.d.ts +1 -0
  6. package/dist/internal/utils/contenttype.js +33 -0
  7. package/dist/internal/utils/headers.d.ts +4 -0
  8. package/dist/internal/utils/headers.js +92 -0
  9. package/dist/internal/utils/index.d.ts +8 -0
  10. package/dist/internal/utils/index.js +27 -0
  11. package/dist/internal/utils/pathparams.d.ts +2 -0
  12. package/dist/internal/utils/pathparams.js +53 -0
  13. package/dist/internal/utils/queryparams.d.ts +2 -0
  14. package/dist/internal/utils/queryparams.js +178 -0
  15. package/dist/internal/utils/requestbody.d.ts +2 -0
  16. package/dist/internal/utils/requestbody.js +318 -0
  17. package/dist/internal/utils/retries.d.ts +20 -0
  18. package/dist/internal/utils/retries.js +250 -0
  19. package/dist/internal/utils/security.d.ts +2 -0
  20. package/dist/internal/utils/security.js +188 -0
  21. package/dist/internal/utils/utils.d.ts +37 -0
  22. package/dist/internal/utils/utils.js +370 -0
  23. package/dist/sdk/availability.d.ts +19 -0
  24. package/dist/sdk/availability.js +135 -0
  25. package/dist/sdk/coupon.d.ts +53 -0
  26. package/dist/sdk/coupon.js +358 -0
  27. package/dist/sdk/credit.d.ts +142 -0
  28. package/dist/sdk/credit.js +501 -0
  29. package/dist/sdk/creditnote.d.ts +26 -0
  30. package/dist/sdk/creditnote.js +186 -0
  31. package/dist/sdk/customer.d.ts +264 -0
  32. package/dist/sdk/customer.js +958 -0
  33. package/dist/sdk/event.d.ts +258 -0
  34. package/dist/sdk/event.js +732 -0
  35. package/dist/sdk/index.d.ts +1 -0
  36. package/dist/sdk/index.js +20 -0
  37. package/dist/sdk/invoice.d.ts +60 -0
  38. package/dist/sdk/invoice.js +416 -0
  39. package/dist/sdk/models/operations/addledgerentryexternalid.d.ts +16 -0
  40. package/dist/sdk/models/operations/addledgerentryexternalid.js +95 -0
  41. package/dist/sdk/models/operations/amendevent.d.ts +23 -0
  42. package/dist/sdk/models/operations/amendevent.js +99 -0
  43. package/dist/sdk/models/operations/amendusage.d.ts +34 -0
  44. package/dist/sdk/models/operations/amendusage.js +122 -0
  45. package/dist/sdk/models/operations/amendusageexternalcustomerid.d.ts +34 -0
  46. package/dist/sdk/models/operations/amendusageexternalcustomerid.js +122 -0
  47. package/dist/sdk/models/operations/archivecoupon.d.ts +15 -0
  48. package/dist/sdk/models/operations/archivecoupon.js +91 -0
  49. package/dist/sdk/models/operations/cancelsubscription.d.ts +16 -0
  50. package/dist/sdk/models/operations/cancelsubscription.js +95 -0
  51. package/dist/sdk/models/operations/closebackfill.d.ts +15 -0
  52. package/dist/sdk/models/operations/closebackfill.js +91 -0
  53. package/dist/sdk/models/operations/createbackfill.d.ts +12 -0
  54. package/dist/sdk/models/operations/createbackfill.js +79 -0
  55. package/dist/sdk/models/operations/createcoupon.d.ts +12 -0
  56. package/dist/sdk/models/operations/createcoupon.js +79 -0
  57. package/dist/sdk/models/operations/createcustomer.d.ts +12 -0
  58. package/dist/sdk/models/operations/createcustomer.js +79 -0
  59. package/dist/sdk/models/operations/createcustomerbalancetransaction.d.ts +16 -0
  60. package/dist/sdk/models/operations/createcustomerbalancetransaction.js +95 -0
  61. package/dist/sdk/models/operations/createinvoicelineitem.d.ts +12 -0
  62. package/dist/sdk/models/operations/createinvoicelineitem.js +79 -0
  63. package/dist/sdk/models/operations/createledgerentry.d.ts +16 -0
  64. package/dist/sdk/models/operations/createledgerentry.js +95 -0
  65. package/dist/sdk/models/operations/createsubscription.d.ts +12 -0
  66. package/dist/sdk/models/operations/createsubscription.js +79 -0
  67. package/dist/sdk/models/operations/deletecustomer.d.ts +22 -0
  68. package/dist/sdk/models/operations/deletecustomer.js +78 -0
  69. package/dist/sdk/models/operations/deprecateevent.d.ts +22 -0
  70. package/dist/sdk/models/operations/deprecateevent.js +95 -0
  71. package/dist/sdk/models/operations/fetchcoupon.d.ts +15 -0
  72. package/dist/sdk/models/operations/fetchcoupon.js +91 -0
  73. package/dist/sdk/models/operations/fetchcreditnote.d.ts +18 -0
  74. package/dist/sdk/models/operations/fetchcreditnote.js +91 -0
  75. package/dist/sdk/models/operations/fetchcustomer.d.ts +18 -0
  76. package/dist/sdk/models/operations/fetchcustomer.js +91 -0
  77. package/dist/sdk/models/operations/fetchcustomercosts.d.ts +34 -0
  78. package/dist/sdk/models/operations/fetchcustomercosts.js +107 -0
  79. package/dist/sdk/models/operations/fetchcustomercostsexternalid.d.ts +31 -0
  80. package/dist/sdk/models/operations/fetchcustomercostsexternalid.js +107 -0
  81. package/dist/sdk/models/operations/fetchcustomercredits.d.ts +26 -0
  82. package/dist/sdk/models/operations/fetchcustomercredits.js +99 -0
  83. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.d.ts +23 -0
  84. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.js +99 -0
  85. package/dist/sdk/models/operations/fetchcustomercreditsledger.d.ts +35 -0
  86. package/dist/sdk/models/operations/fetchcustomercreditsledger.js +111 -0
  87. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.d.ts +35 -0
  88. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.js +111 -0
  89. package/dist/sdk/models/operations/fetchcustomerexternalid.d.ts +15 -0
  90. package/dist/sdk/models/operations/fetchcustomerexternalid.js +91 -0
  91. package/dist/sdk/models/operations/fetchinvoice.d.ts +15 -0
  92. package/dist/sdk/models/operations/fetchinvoice.js +91 -0
  93. package/dist/sdk/models/operations/fetchplan.d.ts +15 -0
  94. package/dist/sdk/models/operations/fetchplan.js +91 -0
  95. package/dist/sdk/models/operations/fetchplanexternalid.d.ts +15 -0
  96. package/dist/sdk/models/operations/fetchplanexternalid.js +91 -0
  97. package/dist/sdk/models/operations/fetchsubscription.d.ts +15 -0
  98. package/dist/sdk/models/operations/fetchsubscription.js +91 -0
  99. package/dist/sdk/models/operations/fetchsubscriptioncosts.d.ts +31 -0
  100. package/dist/sdk/models/operations/fetchsubscriptioncosts.js +107 -0
  101. package/dist/sdk/models/operations/fetchsubscriptionschedule.d.ts +23 -0
  102. package/dist/sdk/models/operations/fetchsubscriptionschedule.js +99 -0
  103. package/dist/sdk/models/operations/fetchsubscriptionusage.d.ts +39 -0
  104. package/dist/sdk/models/operations/fetchsubscriptionusage.js +115 -0
  105. package/dist/sdk/models/operations/fetchupcominginvoice.d.ts +15 -0
  106. package/dist/sdk/models/operations/fetchupcominginvoice.js +91 -0
  107. package/dist/sdk/models/operations/index.d.ts +55 -0
  108. package/dist/sdk/models/operations/index.js +74 -0
  109. package/dist/sdk/models/operations/ingest.d.ts +30 -0
  110. package/dist/sdk/models/operations/ingest.js +118 -0
  111. package/dist/sdk/models/operations/issueinvoice.d.ts +19 -0
  112. package/dist/sdk/models/operations/issueinvoice.js +95 -0
  113. package/dist/sdk/models/operations/listbackfills.d.ts +22 -0
  114. package/dist/sdk/models/operations/listbackfills.js +95 -0
  115. package/dist/sdk/models/operations/listbalancetransactions.d.ts +23 -0
  116. package/dist/sdk/models/operations/listbalancetransactions.js +99 -0
  117. package/dist/sdk/models/operations/listcoupons.d.ts +30 -0
  118. package/dist/sdk/models/operations/listcoupons.js +103 -0
  119. package/dist/sdk/models/operations/listcouponsubscriptions.d.ts +15 -0
  120. package/dist/sdk/models/operations/listcouponsubscriptions.js +91 -0
  121. package/dist/sdk/models/operations/listcreditnote.d.ts +34 -0
  122. package/dist/sdk/models/operations/listcreditnote.js +107 -0
  123. package/dist/sdk/models/operations/listcustomers.d.ts +22 -0
  124. package/dist/sdk/models/operations/listcustomers.js +95 -0
  125. package/dist/sdk/models/operations/listinvoices.d.ts +38 -0
  126. package/dist/sdk/models/operations/listinvoices.js +111 -0
  127. package/dist/sdk/models/operations/listplans.d.ts +22 -0
  128. package/dist/sdk/models/operations/listplans.js +95 -0
  129. package/dist/sdk/models/operations/listsubscriptions.d.ts +24 -0
  130. package/dist/sdk/models/operations/listsubscriptions.js +103 -0
  131. package/dist/sdk/models/operations/ping.d.ts +12 -0
  132. package/dist/sdk/models/operations/ping.js +79 -0
  133. package/dist/sdk/models/operations/revertbackfill.d.ts +15 -0
  134. package/dist/sdk/models/operations/revertbackfill.js +91 -0
  135. package/dist/sdk/models/operations/scheduleplanchange.d.ts +16 -0
  136. package/dist/sdk/models/operations/scheduleplanchange.js +95 -0
  137. package/dist/sdk/models/operations/searchevents.d.ts +23 -0
  138. package/dist/sdk/models/operations/searchevents.js +99 -0
  139. package/dist/sdk/models/operations/unschedulecancellation.d.ts +15 -0
  140. package/dist/sdk/models/operations/unschedulecancellation.js +91 -0
  141. package/dist/sdk/models/operations/unscheduleplanchange.d.ts +15 -0
  142. package/dist/sdk/models/operations/unscheduleplanchange.js +91 -0
  143. package/dist/sdk/models/operations/updatecustomer.d.ts +19 -0
  144. package/dist/sdk/models/operations/updatecustomer.js +95 -0
  145. package/dist/sdk/models/operations/updatecustomerexternalid.d.ts +16 -0
  146. package/dist/sdk/models/operations/updatecustomerexternalid.js +95 -0
  147. package/dist/sdk/models/operations/updatefixedfeequantity.d.ts +16 -0
  148. package/dist/sdk/models/operations/updatefixedfeequantity.js +95 -0
  149. package/dist/sdk/models/operations/voidinvoice.d.ts +19 -0
  150. package/dist/sdk/models/operations/voidinvoice.js +95 -0
  151. package/dist/sdk/models/shared/action.d.ts +8 -0
  152. package/dist/sdk/models/shared/action.js +15 -0
  153. package/dist/sdk/models/shared/amendedevent.d.ts +28 -0
  154. package/dist/sdk/models/shared/amendedevent.js +81 -0
  155. package/dist/sdk/models/shared/amendedusage.d.ts +16 -0
  156. package/dist/sdk/models/shared/amendedusage.js +62 -0
  157. package/dist/sdk/models/shared/amendeventresult.d.ts +10 -0
  158. package/dist/sdk/models/shared/amendeventresult.js +48 -0
  159. package/dist/sdk/models/shared/autocollection.d.ts +18 -0
  160. package/dist/sdk/models/shared/autocollection.js +66 -0
  161. package/dist/sdk/models/shared/availability.d.ts +7 -0
  162. package/dist/sdk/models/shared/availability.js +48 -0
  163. package/dist/sdk/models/shared/backfill.d.ts +27 -0
  164. package/dist/sdk/models/shared/backfill.js +104 -0
  165. package/dist/sdk/models/shared/backfills.d.ts +10 -0
  166. package/dist/sdk/models/shared/backfills.js +57 -0
  167. package/dist/sdk/models/shared/backfillstatus.d.ts +9 -0
  168. package/dist/sdk/models/shared/backfillstatus.js +16 -0
  169. package/dist/sdk/models/shared/billablemetric.d.ts +4 -0
  170. package/dist/sdk/models/shared/billablemetric.js +45 -0
  171. package/dist/sdk/models/shared/billablemetricminified.d.ts +5 -0
  172. package/dist/sdk/models/shared/billablemetricminified.js +50 -0
  173. package/dist/sdk/models/shared/bpsconfig.d.ts +8 -0
  174. package/dist/sdk/models/shared/bpsconfig.js +53 -0
  175. package/dist/sdk/models/shared/bpspriceoverride.d.ts +24 -0
  176. package/dist/sdk/models/shared/bpspriceoverride.js +74 -0
  177. package/dist/sdk/models/shared/bpstier.d.ts +7 -0
  178. package/dist/sdk/models/shared/bpstier.js +60 -0
  179. package/dist/sdk/models/shared/bulkbpsconfig.d.ts +8 -0
  180. package/dist/sdk/models/shared/bulkbpsconfig.js +50 -0
  181. package/dist/sdk/models/shared/bulkbpspriceoverride.d.ts +24 -0
  182. package/dist/sdk/models/shared/bulkbpspriceoverride.js +74 -0
  183. package/dist/sdk/models/shared/bulkbpstier.d.ts +6 -0
  184. package/dist/sdk/models/shared/bulkbpstier.js +55 -0
  185. package/dist/sdk/models/shared/bulkconfig.d.ts +8 -0
  186. package/dist/sdk/models/shared/bulkconfig.js +50 -0
  187. package/dist/sdk/models/shared/bulkpriceoverride.d.ts +24 -0
  188. package/dist/sdk/models/shared/bulkpriceoverride.js +74 -0
  189. package/dist/sdk/models/shared/bulktier.d.ts +5 -0
  190. package/dist/sdk/models/shared/bulktier.js +50 -0
  191. package/dist/sdk/models/shared/cadence.d.ts +5 -0
  192. package/dist/sdk/models/shared/cadence.js +12 -0
  193. package/dist/sdk/models/shared/canceloption.d.ts +8 -0
  194. package/dist/sdk/models/shared/canceloption.js +15 -0
  195. package/dist/sdk/models/shared/changeoption.d.ts +8 -0
  196. package/dist/sdk/models/shared/changeoption.js +15 -0
  197. package/dist/sdk/models/shared/changeoption1.d.ts +8 -0
  198. package/dist/sdk/models/shared/changeoption1.js +15 -0
  199. package/dist/sdk/models/shared/coupon.d.ts +36 -0
  200. package/dist/sdk/models/shared/coupon.js +88 -0
  201. package/dist/sdk/models/shared/coupons.d.ts +10 -0
  202. package/dist/sdk/models/shared/coupons.js +57 -0
  203. package/dist/sdk/models/shared/credit.d.ts +16 -0
  204. package/dist/sdk/models/shared/credit.js +64 -0
  205. package/dist/sdk/models/shared/creditblock.d.ts +15 -0
  206. package/dist/sdk/models/shared/creditblock.js +58 -0
  207. package/dist/sdk/models/shared/creditledgerentries.d.ts +10 -0
  208. package/dist/sdk/models/shared/creditledgerentries.js +57 -0
  209. package/dist/sdk/models/shared/creditledgerentry.d.ts +58 -0
  210. package/dist/sdk/models/shared/creditledgerentry.js +144 -0
  211. package/dist/sdk/models/shared/creditnote.d.ts +71 -0
  212. package/dist/sdk/models/shared/creditnote.js +134 -0
  213. package/dist/sdk/models/shared/creditnotelineitem.d.ts +38 -0
  214. package/dist/sdk/models/shared/creditnotelineitem.js +86 -0
  215. package/dist/sdk/models/shared/creditnotes.d.ts +10 -0
  216. package/dist/sdk/models/shared/creditnotes.js +57 -0
  217. package/dist/sdk/models/shared/creditnotesummary.d.ts +9 -0
  218. package/dist/sdk/models/shared/creditnotesummary.js +74 -0
  219. package/dist/sdk/models/shared/creditnotetype.d.ts +7 -0
  220. package/dist/sdk/models/shared/creditnotetype.js +14 -0
  221. package/dist/sdk/models/shared/credits.d.ts +10 -0
  222. package/dist/sdk/models/shared/credits.js +57 -0
  223. package/dist/sdk/models/shared/customer.d.ts +227 -0
  224. package/dist/sdk/models/shared/customer.js +364 -0
  225. package/dist/sdk/models/shared/customerbalancetransaction.d.ts +57 -0
  226. package/dist/sdk/models/shared/customerbalancetransaction.js +133 -0
  227. package/dist/sdk/models/shared/customercost.d.ts +15 -0
  228. package/dist/sdk/models/shared/customercost.js +75 -0
  229. package/dist/sdk/models/shared/customercosts.d.ts +8 -0
  230. package/dist/sdk/models/shared/customercosts.js +50 -0
  231. package/dist/sdk/models/shared/customerminified.d.ts +8 -0
  232. package/dist/sdk/models/shared/customerminified.js +53 -0
  233. package/dist/sdk/models/shared/customers.d.ts +10 -0
  234. package/dist/sdk/models/shared/customers.js +57 -0
  235. package/dist/sdk/models/shared/debug.d.ts +8 -0
  236. package/dist/sdk/models/shared/debug.js +53 -0
  237. package/dist/sdk/models/shared/deprecatedeventresult.d.ts +10 -0
  238. package/dist/sdk/models/shared/deprecatedeventresult.js +48 -0
  239. package/dist/sdk/models/shared/discount.d.ts +25 -0
  240. package/dist/sdk/models/shared/discount.js +71 -0
  241. package/dist/sdk/models/shared/discounttype.d.ts +6 -0
  242. package/dist/sdk/models/shared/discounttype.js +13 -0
  243. package/dist/sdk/models/shared/durationunit.d.ts +8 -0
  244. package/dist/sdk/models/shared/durationunit.js +15 -0
  245. package/dist/sdk/models/shared/entrystatus.d.ts +7 -0
  246. package/dist/sdk/models/shared/entrystatus.js +14 -0
  247. package/dist/sdk/models/shared/entrytype.d.ts +9 -0
  248. package/dist/sdk/models/shared/entrytype.js +16 -0
  249. package/dist/sdk/models/shared/event.d.ts +32 -0
  250. package/dist/sdk/models/shared/event.js +82 -0
  251. package/dist/sdk/models/shared/eventsearchcriteria.d.ts +11 -0
  252. package/dist/sdk/models/shared/eventsearchcriteria.js +50 -0
  253. package/dist/sdk/models/shared/eventsearchresults.d.ts +10 -0
  254. package/dist/sdk/models/shared/eventsearchresults.js +57 -0
  255. package/dist/sdk/models/shared/externalmarketplace.d.ts +8 -0
  256. package/dist/sdk/models/shared/externalmarketplace.js +15 -0
  257. package/dist/sdk/models/shared/fixedfeequantitychange.d.ts +18 -0
  258. package/dist/sdk/models/shared/fixedfeequantitychange.js +66 -0
  259. package/dist/sdk/models/shared/fixedfeequantityschedule.d.ts +7 -0
  260. package/dist/sdk/models/shared/fixedfeequantityschedule.js +68 -0
  261. package/dist/sdk/models/shared/granularity.d.ts +6 -0
  262. package/dist/sdk/models/shared/granularity.js +13 -0
  263. package/dist/sdk/models/shared/grouping.d.ts +8 -0
  264. package/dist/sdk/models/shared/grouping.js +53 -0
  265. package/dist/sdk/models/shared/index.d.ts +125 -0
  266. package/dist/sdk/models/shared/index.js +144 -0
  267. package/dist/sdk/models/shared/ingestionresponse.d.ts +13 -0
  268. package/dist/sdk/models/shared/ingestionresponse.js +57 -0
  269. package/dist/sdk/models/shared/invoice.d.ts +274 -0
  270. package/dist/sdk/models/shared/invoice.js +460 -0
  271. package/dist/sdk/models/shared/invoicelineitem.d.ts +207 -0
  272. package/dist/sdk/models/shared/invoicelineitem.js +416 -0
  273. package/dist/sdk/models/shared/invoices.d.ts +10 -0
  274. package/dist/sdk/models/shared/invoices.js +57 -0
  275. package/dist/sdk/models/shared/invoicesettings.d.ts +18 -0
  276. package/dist/sdk/models/shared/invoicesettings.js +58 -0
  277. package/dist/sdk/models/shared/invoicestatus.d.ts +10 -0
  278. package/dist/sdk/models/shared/invoicestatus.js +17 -0
  279. package/dist/sdk/models/shared/lineitem.d.ts +58 -0
  280. package/dist/sdk/models/shared/lineitem.js +147 -0
  281. package/dist/sdk/models/shared/matrixconfig.d.ts +13 -0
  282. package/dist/sdk/models/shared/matrixconfig.js +60 -0
  283. package/dist/sdk/models/shared/matrixconfig1.d.ts +10 -0
  284. package/dist/sdk/models/shared/matrixconfig1.js +48 -0
  285. package/dist/sdk/models/shared/matrixvalue.d.ts +8 -0
  286. package/dist/sdk/models/shared/matrixvalue.js +50 -0
  287. package/dist/sdk/models/shared/modeltype.d.ts +10 -0
  288. package/dist/sdk/models/shared/modeltype.js +17 -0
  289. package/dist/sdk/models/shared/newbackfill.d.ts +27 -0
  290. package/dist/sdk/models/shared/newbackfill.js +82 -0
  291. package/dist/sdk/models/shared/newcoupon.d.ts +24 -0
  292. package/dist/sdk/models/shared/newcoupon.js +69 -0
  293. package/dist/sdk/models/shared/newcreditledgerentry.d.ts +44 -0
  294. package/dist/sdk/models/shared/newcreditledgerentry.js +109 -0
  295. package/dist/sdk/models/shared/newcustomer.d.ts +202 -0
  296. package/dist/sdk/models/shared/newcustomer.js +324 -0
  297. package/dist/sdk/models/shared/newinvoicelineitem.d.ts +28 -0
  298. package/dist/sdk/models/shared/newinvoicelineitem.js +79 -0
  299. package/dist/sdk/models/shared/newsubscription.d.ts +79 -0
  300. package/dist/sdk/models/shared/newsubscription.js +145 -0
  301. package/dist/sdk/models/shared/newtransaction.d.ts +10 -0
  302. package/dist/sdk/models/shared/newtransaction.js +56 -0
  303. package/dist/sdk/models/shared/packageconfig.d.ts +8 -0
  304. package/dist/sdk/models/shared/packageconfig.js +53 -0
  305. package/dist/sdk/models/shared/packagepriceoverride.d.ts +24 -0
  306. package/dist/sdk/models/shared/packagepriceoverride.js +74 -0
  307. package/dist/sdk/models/shared/paginationmetadata.d.ts +5 -0
  308. package/dist/sdk/models/shared/paginationmetadata.js +50 -0
  309. package/dist/sdk/models/shared/perpricecost.d.ts +24 -0
  310. package/dist/sdk/models/shared/perpricecost.js +67 -0
  311. package/dist/sdk/models/shared/phaseoverride.d.ts +40 -0
  312. package/dist/sdk/models/shared/phaseoverride.js +100 -0
  313. package/dist/sdk/models/shared/plan.d.ts +101 -0
  314. package/dist/sdk/models/shared/plan.js +250 -0
  315. package/dist/sdk/models/shared/planminified.d.ts +5 -0
  316. package/dist/sdk/models/shared/planminified.js +50 -0
  317. package/dist/sdk/models/shared/planphase.d.ts +68 -0
  318. package/dist/sdk/models/shared/planphase.js +162 -0
  319. package/dist/sdk/models/shared/plans.d.ts +10 -0
  320. package/dist/sdk/models/shared/plans.js +57 -0
  321. package/dist/sdk/models/shared/price.d.ts +114 -0
  322. package/dist/sdk/models/shared/price.js +245 -0
  323. package/dist/sdk/models/shared/pricegroup.d.ts +17 -0
  324. package/dist/sdk/models/shared/pricegroup.js +65 -0
  325. package/dist/sdk/models/shared/product.d.ts +6 -0
  326. package/dist/sdk/models/shared/product.js +59 -0
  327. package/dist/sdk/models/shared/reason.d.ts +9 -0
  328. package/dist/sdk/models/shared/reason.js +16 -0
  329. package/dist/sdk/models/shared/requestvalidationerror.d.ts +20 -0
  330. package/dist/sdk/models/shared/requestvalidationerror.js +65 -0
  331. package/dist/sdk/models/shared/security.d.ts +4 -0
  332. package/dist/sdk/models/shared/security.js +45 -0
  333. package/dist/sdk/models/shared/sublineitem.d.ts +32 -0
  334. package/dist/sdk/models/shared/sublineitem.js +102 -0
  335. package/dist/sdk/models/shared/sublineitem1.d.ts +24 -0
  336. package/dist/sdk/models/shared/sublineitem1.js +75 -0
  337. package/dist/sdk/models/shared/sublineitem2.d.ts +6 -0
  338. package/dist/sdk/models/shared/sublineitem2.js +55 -0
  339. package/dist/sdk/models/shared/subscription.d.ts +95 -0
  340. package/dist/sdk/models/shared/subscription.js +207 -0
  341. package/dist/sdk/models/shared/subscriptioncancellation.d.ts +12 -0
  342. package/dist/sdk/models/shared/subscriptioncancellation.js +55 -0
  343. package/dist/sdk/models/shared/subscriptioncost.d.ts +15 -0
  344. package/dist/sdk/models/shared/subscriptioncost.js +75 -0
  345. package/dist/sdk/models/shared/subscriptioncosts.d.ts +8 -0
  346. package/dist/sdk/models/shared/subscriptioncosts.js +50 -0
  347. package/dist/sdk/models/shared/subscriptionminified.d.ts +7 -0
  348. package/dist/sdk/models/shared/subscriptionminified.js +48 -0
  349. package/dist/sdk/models/shared/subscriptionplanchange.d.ts +54 -0
  350. package/dist/sdk/models/shared/subscriptionplanchange.js +104 -0
  351. package/dist/sdk/models/shared/subscriptions.d.ts +10 -0
  352. package/dist/sdk/models/shared/subscriptions.js +57 -0
  353. package/dist/sdk/models/shared/subscriptionschedule.d.ts +10 -0
  354. package/dist/sdk/models/shared/subscriptionschedule.js +57 -0
  355. package/dist/sdk/models/shared/subscriptionscheduleitem.d.ts +7 -0
  356. package/dist/sdk/models/shared/subscriptionscheduleitem.js +65 -0
  357. package/dist/sdk/models/shared/subscriptionstatus.d.ts +5 -0
  358. package/dist/sdk/models/shared/subscriptionstatus.js +12 -0
  359. package/dist/sdk/models/shared/subscriptionusage.d.ts +8 -0
  360. package/dist/sdk/models/shared/subscriptionusage.js +50 -0
  361. package/dist/sdk/models/shared/taxamount.d.ts +15 -0
  362. package/dist/sdk/models/shared/taxamount.js +55 -0
  363. package/dist/sdk/models/shared/tier.d.ts +6 -0
  364. package/dist/sdk/models/shared/tier.js +55 -0
  365. package/dist/sdk/models/shared/tier7.d.ts +7 -0
  366. package/dist/sdk/models/shared/tier7.js +60 -0
  367. package/dist/sdk/models/shared/tierconfig.d.ts +9 -0
  368. package/dist/sdk/models/shared/tierconfig.js +58 -0
  369. package/dist/sdk/models/shared/tieredbpsconfig.d.ts +8 -0
  370. package/dist/sdk/models/shared/tieredbpsconfig.js +50 -0
  371. package/dist/sdk/models/shared/tieredbpsconfig1.d.ts +5 -0
  372. package/dist/sdk/models/shared/tieredbpsconfig1.js +47 -0
  373. package/dist/sdk/models/shared/tieredbpspriceoverride.d.ts +21 -0
  374. package/dist/sdk/models/shared/tieredbpspriceoverride.js +74 -0
  375. package/dist/sdk/models/shared/tieredconfig.d.ts +8 -0
  376. package/dist/sdk/models/shared/tieredconfig.js +50 -0
  377. package/dist/sdk/models/shared/tieredpriceoverride.d.ts +27 -0
  378. package/dist/sdk/models/shared/tieredpriceoverride.js +74 -0
  379. package/dist/sdk/models/shared/transactions.d.ts +10 -0
  380. package/dist/sdk/models/shared/transactions.js +57 -0
  381. package/dist/sdk/models/shared/transactiontype.d.ts +4 -0
  382. package/dist/sdk/models/shared/transactiontype.js +11 -0
  383. package/dist/sdk/models/shared/trialconfig.d.ts +8 -0
  384. package/dist/sdk/models/shared/trialconfig.js +54 -0
  385. package/dist/sdk/models/shared/type.d.ts +7 -0
  386. package/dist/sdk/models/shared/type.js +14 -0
  387. package/dist/sdk/models/shared/unitconfig.d.ts +7 -0
  388. package/dist/sdk/models/shared/unitconfig.js +48 -0
  389. package/dist/sdk/models/shared/unitpriceoverride.d.ts +24 -0
  390. package/dist/sdk/models/shared/unitpriceoverride.js +74 -0
  391. package/dist/sdk/models/shared/upcominginvoice.d.ts +95 -0
  392. package/dist/sdk/models/shared/upcominginvoice.js +193 -0
  393. package/dist/sdk/models/shared/updateevent.d.ts +28 -0
  394. package/dist/sdk/models/shared/updateevent.js +77 -0
  395. package/dist/sdk/models/shared/usage.d.ts +13 -0
  396. package/dist/sdk/models/shared/usage.js +69 -0
  397. package/dist/sdk/models/shared/usageitem.d.ts +6 -0
  398. package/dist/sdk/models/shared/usageitem.js +63 -0
  399. package/dist/sdk/models/shared/validationerrors.d.ts +13 -0
  400. package/dist/sdk/models/shared/validationerrors.js +59 -0
  401. package/dist/sdk/models/shared/viewmode.d.ts +7 -0
  402. package/dist/sdk/models/shared/viewmode.js +14 -0
  403. package/dist/sdk/plan.d.ts +222 -0
  404. package/dist/sdk/plan.js +422 -0
  405. package/dist/sdk/sdk.d.ts +298 -0
  406. package/dist/sdk/sdk.js +110 -0
  407. package/dist/sdk/subscription.d.ts +614 -0
  408. package/dist/sdk/subscription.js +1192 -0
  409. package/dist/sdk/types/index.d.ts +1 -0
  410. package/dist/sdk/types/index.js +20 -0
  411. package/dist/sdk/types/rfcdate.d.ts +9 -0
  412. package/dist/sdk/types/rfcdate.js +59 -0
  413. package/package.json +33 -0
@@ -0,0 +1 @@
1
+ export * from "./sdk";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./sdk"), exports);
@@ -0,0 +1,60 @@
1
+ import * as operations from "./models/operations";
2
+ import * as shared from "./models/shared";
3
+ import { SDKConfiguration } from "./sdk";
4
+ import { AxiosRequestConfig } from "axios";
5
+ /**
6
+ * An [`Invoice`](../guides/concepts#invoice) is a fundamental billing entity, representing the request for payment for a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as the result of an action, such as a cancellation.
7
+ */
8
+ export declare class Invoice {
9
+ private sdkConfiguration;
10
+ constructor(sdkConfig: SDKConfiguration);
11
+ /**
12
+ * Create invoice line item
13
+ *
14
+ * @remarks
15
+ * This creates a one-off fixed fee invoice line item on an [Invoice](../guides/concepts#invoice). This can only be done for invoices that are in a `draft` status.
16
+ */
17
+ create(req: shared.NewInvoiceLineItem, config?: AxiosRequestConfig): Promise<operations.CreateInvoiceLineItemResponse>;
18
+ /**
19
+ * Fetch invoice
20
+ *
21
+ * @remarks
22
+ * This endpoint is used to fetch an [`Invoice`](../guides/concepts#invoice) given an identifier.
23
+ */
24
+ fetch(req: operations.FetchInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.FetchInvoiceResponse>;
25
+ /**
26
+ * Fetch upcoming invoice
27
+ *
28
+ * @remarks
29
+ * This endpoint can be used to fetch the upcoming [invoice](../guides/concepts#invoice) for the current billing period given a subscription.
30
+ */
31
+ fetchUpcoming(req: operations.FetchUpcomingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.FetchUpcomingInvoiceResponse>;
32
+ /**
33
+ * Issue an invoice
34
+ *
35
+ * @remarks
36
+ * This endpoint allows an eligible invoice to be issued manually. This is only possible with invoices where `status` is `draft`, `will_auto_issue` is true, and an `eligible_to_issue_at` is a time in the past.
37
+ * Issuing an invoice could possibly trigger side effects, some of which could be customer-visible (e.g. sending emails, auto-collecting payment, syncing the invoice to external providers, etc).
38
+ */
39
+ issue(req: operations.IssueInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.IssueInvoiceResponse>;
40
+ /**
41
+ * List invoices
42
+ *
43
+ * @remarks
44
+ * This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for an account in a list format.
45
+ *
46
+ * The list of invoices is ordered starting from the most recently issued invoice date. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.
47
+ *
48
+ * By default, this only returns invoices that are `issued`, `paid`, or `synced`.
49
+ */
50
+ list(req: operations.ListInvoicesRequest, config?: AxiosRequestConfig): Promise<operations.ListInvoicesResponse>;
51
+ /**
52
+ * Void invoice
53
+ *
54
+ * @remarks
55
+ * This endpoint allows an invoice's status to be set the `void` status. This can only be done to invoices that are in the `issued` status.
56
+ *
57
+ * If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding.
58
+ */
59
+ void(req: operations.VoidInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.VoidInvoiceResponse>;
60
+ }
@@ -0,0 +1,416 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ return new (P || (P = Promise))(function (resolve, reject) {
42
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
46
+ });
47
+ };
48
+ var __generator = (this && this.__generator) || function (thisArg, body) {
49
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
50
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
+ function verb(n) { return function (v) { return step([n, v]); }; }
52
+ function step(op) {
53
+ if (f) throw new TypeError("Generator is already executing.");
54
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
55
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
56
+ if (y = 0, t) op = [op[0] & 2, t.value];
57
+ switch (op[0]) {
58
+ case 0: case 1: t = op; break;
59
+ case 4: _.label++; return { value: op[1], done: false };
60
+ case 5: _.label++; y = op[1]; op = [0]; continue;
61
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
62
+ default:
63
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
64
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
65
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
66
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67
+ if (t[2]) _.ops.pop();
68
+ _.trys.pop(); continue;
69
+ }
70
+ op = body.call(thisArg, _);
71
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
72
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
73
+ }
74
+ };
75
+ var __read = (this && this.__read) || function (o, n) {
76
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
77
+ if (!m) return o;
78
+ var i = m.call(o), r, ar = [], e;
79
+ try {
80
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
81
+ }
82
+ catch (error) { e = { error: error }; }
83
+ finally {
84
+ try {
85
+ if (r && !r.done && (m = i["return"])) m.call(i);
86
+ }
87
+ finally { if (e) throw e.error; }
88
+ }
89
+ return ar;
90
+ };
91
+ Object.defineProperty(exports, "__esModule", { value: true });
92
+ exports.Invoice = void 0;
93
+ var utils = __importStar(require("../internal/utils"));
94
+ var operations = __importStar(require("./models/operations"));
95
+ var shared = __importStar(require("./models/shared"));
96
+ /**
97
+ * An [`Invoice`](../guides/concepts#invoice) is a fundamental billing entity, representing the request for payment for a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as the result of an action, such as a cancellation.
98
+ */
99
+ var Invoice = /** @class */ (function () {
100
+ function Invoice(sdkConfig) {
101
+ this.sdkConfiguration = sdkConfig;
102
+ }
103
+ /**
104
+ * Create invoice line item
105
+ *
106
+ * @remarks
107
+ * This creates a one-off fixed fee invoice line item on an [Invoice](../guides/concepts#invoice). This can only be done for invoices that are in a `draft` status.
108
+ */
109
+ Invoice.prototype.create = function (req, config) {
110
+ var _a, _b;
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res, decodedRes;
113
+ var _d;
114
+ return __generator(this, function (_e) {
115
+ switch (_e.label) {
116
+ case 0:
117
+ if (!(req instanceof utils.SpeakeasyBase)) {
118
+ req = new shared.NewInvoiceLineItem(req);
119
+ }
120
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
121
+ url = baseURL.replace(/\/$/, "") + "/invoice_line_items";
122
+ _c = __read([{}, {}], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
123
+ try {
124
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
125
+ }
126
+ catch (e) {
127
+ if (e instanceof Error) {
128
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
129
+ }
130
+ }
131
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
132
+ headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
133
+ headers["Accept"] = "application/json";
134
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
135
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
136
+ case 1:
137
+ httpRes = _e.sent();
138
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
139
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
140
+ throw new Error("status code not found in response: ".concat(httpRes));
141
+ }
142
+ res = new operations.CreateInvoiceLineItemResponse({
143
+ statusCode: httpRes.status,
144
+ contentType: contentType,
145
+ rawResponse: httpRes,
146
+ });
147
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
148
+ switch (true) {
149
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 201:
150
+ if (utils.matchContentType(contentType, "application/json")) {
151
+ res.invoiceLineItem = utils.objectToClass(JSON.parse(decodedRes), shared.InvoiceLineItem);
152
+ }
153
+ break;
154
+ }
155
+ return [2 /*return*/, res];
156
+ }
157
+ });
158
+ });
159
+ };
160
+ /**
161
+ * Fetch invoice
162
+ *
163
+ * @remarks
164
+ * This endpoint is used to fetch an [`Invoice`](../guides/concepts#invoice) given an identifier.
165
+ */
166
+ Invoice.prototype.fetch = function (req, config) {
167
+ var _a, _b;
168
+ return __awaiter(this, void 0, void 0, function () {
169
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
170
+ return __generator(this, function (_c) {
171
+ switch (_c.label) {
172
+ case 0:
173
+ if (!(req instanceof utils.SpeakeasyBase)) {
174
+ req = new operations.FetchInvoiceRequest(req);
175
+ }
176
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
177
+ url = utils.generateURL(baseURL, "/invoices/{invoice_id}", req);
178
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
179
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
180
+ headers["Accept"] = "application/json";
181
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
182
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
183
+ case 1:
184
+ httpRes = _c.sent();
185
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
186
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
187
+ throw new Error("status code not found in response: ".concat(httpRes));
188
+ }
189
+ res = new operations.FetchInvoiceResponse({
190
+ statusCode: httpRes.status,
191
+ contentType: contentType,
192
+ rawResponse: httpRes,
193
+ });
194
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
195
+ switch (true) {
196
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
197
+ if (utils.matchContentType(contentType, "application/json")) {
198
+ res.invoice = utils.objectToClass(JSON.parse(decodedRes), shared.Invoice);
199
+ }
200
+ break;
201
+ }
202
+ return [2 /*return*/, res];
203
+ }
204
+ });
205
+ });
206
+ };
207
+ /**
208
+ * Fetch upcoming invoice
209
+ *
210
+ * @remarks
211
+ * This endpoint can be used to fetch the upcoming [invoice](../guides/concepts#invoice) for the current billing period given a subscription.
212
+ */
213
+ Invoice.prototype.fetchUpcoming = function (req, config) {
214
+ var _a, _b;
215
+ return __awaiter(this, void 0, void 0, function () {
216
+ var baseURL, url, client, headers, queryParams, httpRes, contentType, res, decodedRes;
217
+ return __generator(this, function (_c) {
218
+ switch (_c.label) {
219
+ case 0:
220
+ if (!(req instanceof utils.SpeakeasyBase)) {
221
+ req = new operations.FetchUpcomingInvoiceRequest(req);
222
+ }
223
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
224
+ url = baseURL.replace(/\/$/, "") + "/invoices/upcoming";
225
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
226
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
227
+ queryParams = utils.serializeQueryParams(req);
228
+ headers["Accept"] = "application/json";
229
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
230
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
231
+ case 1:
232
+ httpRes = _c.sent();
233
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
234
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
235
+ throw new Error("status code not found in response: ".concat(httpRes));
236
+ }
237
+ res = new operations.FetchUpcomingInvoiceResponse({
238
+ statusCode: httpRes.status,
239
+ contentType: contentType,
240
+ rawResponse: httpRes,
241
+ });
242
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
243
+ switch (true) {
244
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
245
+ if (utils.matchContentType(contentType, "application/json")) {
246
+ res.upcomingInvoice = utils.objectToClass(JSON.parse(decodedRes), shared.UpcomingInvoice);
247
+ }
248
+ break;
249
+ }
250
+ return [2 /*return*/, res];
251
+ }
252
+ });
253
+ });
254
+ };
255
+ /**
256
+ * Issue an invoice
257
+ *
258
+ * @remarks
259
+ * This endpoint allows an eligible invoice to be issued manually. This is only possible with invoices where `status` is `draft`, `will_auto_issue` is true, and an `eligible_to_issue_at` is a time in the past.
260
+ * Issuing an invoice could possibly trigger side effects, some of which could be customer-visible (e.g. sending emails, auto-collecting payment, syncing the invoice to external providers, etc).
261
+ */
262
+ Invoice.prototype.issue = function (req, config) {
263
+ var _a, _b;
264
+ return __awaiter(this, void 0, void 0, function () {
265
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
266
+ return __generator(this, function (_c) {
267
+ switch (_c.label) {
268
+ case 0:
269
+ if (!(req instanceof utils.SpeakeasyBase)) {
270
+ req = new operations.IssueInvoiceRequest(req);
271
+ }
272
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
273
+ url = utils.generateURL(baseURL, "/invoices/{invoice_id}/issue", req);
274
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
275
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
276
+ headers["Accept"] = "application/json;q=1, application/json;q=0";
277
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
278
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer" }, config))];
279
+ case 1:
280
+ httpRes = _c.sent();
281
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
282
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
283
+ throw new Error("status code not found in response: ".concat(httpRes));
284
+ }
285
+ res = new operations.IssueInvoiceResponse({
286
+ statusCode: httpRes.status,
287
+ contentType: contentType,
288
+ rawResponse: httpRes,
289
+ });
290
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
291
+ switch (true) {
292
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
293
+ if (utils.matchContentType(contentType, "application/json")) {
294
+ res.invoice = utils.objectToClass(JSON.parse(decodedRes), shared.Invoice);
295
+ }
296
+ break;
297
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
298
+ if (utils.matchContentType(contentType, "application/json")) {
299
+ res.requestValidationError = utils.objectToClass(JSON.parse(decodedRes), shared.RequestValidationError);
300
+ }
301
+ break;
302
+ }
303
+ return [2 /*return*/, res];
304
+ }
305
+ });
306
+ });
307
+ };
308
+ /**
309
+ * List invoices
310
+ *
311
+ * @remarks
312
+ * This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for an account in a list format.
313
+ *
314
+ * The list of invoices is ordered starting from the most recently issued invoice date. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.
315
+ *
316
+ * By default, this only returns invoices that are `issued`, `paid`, or `synced`.
317
+ */
318
+ Invoice.prototype.list = function (req, config) {
319
+ var _a, _b;
320
+ return __awaiter(this, void 0, void 0, function () {
321
+ var baseURL, url, client, headers, queryParams, httpRes, contentType, res, decodedRes;
322
+ return __generator(this, function (_c) {
323
+ switch (_c.label) {
324
+ case 0:
325
+ if (!(req instanceof utils.SpeakeasyBase)) {
326
+ req = new operations.ListInvoicesRequest(req);
327
+ }
328
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
329
+ url = baseURL.replace(/\/$/, "") + "/invoices";
330
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
331
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
332
+ queryParams = utils.serializeQueryParams(req);
333
+ headers["Accept"] = "application/json";
334
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
335
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
336
+ case 1:
337
+ httpRes = _c.sent();
338
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
339
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
340
+ throw new Error("status code not found in response: ".concat(httpRes));
341
+ }
342
+ res = new operations.ListInvoicesResponse({
343
+ statusCode: httpRes.status,
344
+ contentType: contentType,
345
+ rawResponse: httpRes,
346
+ });
347
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
348
+ switch (true) {
349
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
350
+ if (utils.matchContentType(contentType, "application/json")) {
351
+ res.invoices = utils.objectToClass(JSON.parse(decodedRes), shared.Invoices);
352
+ }
353
+ break;
354
+ }
355
+ return [2 /*return*/, res];
356
+ }
357
+ });
358
+ });
359
+ };
360
+ /**
361
+ * Void invoice
362
+ *
363
+ * @remarks
364
+ * This endpoint allows an invoice's status to be set the `void` status. This can only be done to invoices that are in the `issued` status.
365
+ *
366
+ * If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding.
367
+ */
368
+ Invoice.prototype.void = function (req, config) {
369
+ var _a, _b;
370
+ return __awaiter(this, void 0, void 0, function () {
371
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
372
+ return __generator(this, function (_c) {
373
+ switch (_c.label) {
374
+ case 0:
375
+ if (!(req instanceof utils.SpeakeasyBase)) {
376
+ req = new operations.VoidInvoiceRequest(req);
377
+ }
378
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
379
+ url = utils.generateURL(baseURL, "/invoices/{invoice_id}/void", req);
380
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
381
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
382
+ headers["Accept"] = "application/json;q=1, application/json;q=0";
383
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
384
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer" }, config))];
385
+ case 1:
386
+ httpRes = _c.sent();
387
+ contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
388
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
389
+ throw new Error("status code not found in response: ".concat(httpRes));
390
+ }
391
+ res = new operations.VoidInvoiceResponse({
392
+ statusCode: httpRes.status,
393
+ contentType: contentType,
394
+ rawResponse: httpRes,
395
+ });
396
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
397
+ switch (true) {
398
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 201:
399
+ if (utils.matchContentType(contentType, "application/json")) {
400
+ res.invoice = utils.objectToClass(JSON.parse(decodedRes), shared.Invoice);
401
+ }
402
+ break;
403
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
404
+ if (utils.matchContentType(contentType, "application/json")) {
405
+ res.requestValidationError = utils.objectToClass(JSON.parse(decodedRes), shared.RequestValidationError);
406
+ }
407
+ break;
408
+ }
409
+ return [2 /*return*/, res];
410
+ }
411
+ });
412
+ });
413
+ };
414
+ return Invoice;
415
+ }());
416
+ exports.Invoice = Invoice;
@@ -0,0 +1,16 @@
1
+ import { SpeakeasyBase } from "../../../internal/utils";
2
+ import * as shared from "../shared";
3
+ import { AxiosResponse } from "axios";
4
+ export declare class AddLedgerEntryExternalIdRequest extends SpeakeasyBase {
5
+ newCreditLedgerEntry?: shared.NewCreditLedgerEntry;
6
+ externalCustomerId: string;
7
+ }
8
+ export declare class AddLedgerEntryExternalIdResponse extends SpeakeasyBase {
9
+ contentType: string;
10
+ /**
11
+ * OK
12
+ */
13
+ creditLedgerEntry?: shared.CreditLedgerEntry;
14
+ statusCode: number;
15
+ rawResponse?: AxiosResponse;
16
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __extends = (this && this.__extends) || (function () {
6
+ var extendStatics = function (d, b) {
7
+ extendStatics = Object.setPrototypeOf ||
8
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
10
+ return extendStatics(d, b);
11
+ };
12
+ return function (d, b) {
13
+ if (typeof b !== "function" && b !== null)
14
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
15
+ extendStatics(d, b);
16
+ function __() { this.constructor = d; }
17
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
+ };
19
+ })();
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
33
+ }) : function(o, v) {
34
+ o["default"] = v;
35
+ });
36
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
37
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
40
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
41
+ };
42
+ var __importStar = (this && this.__importStar) || function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ var __metadata = (this && this.__metadata) || function (k, v) {
50
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.AddLedgerEntryExternalIdResponse = exports.AddLedgerEntryExternalIdRequest = void 0;
54
+ var utils_1 = require("../../../internal/utils");
55
+ var shared = __importStar(require("../shared"));
56
+ var AddLedgerEntryExternalIdRequest = /** @class */ (function (_super) {
57
+ __extends(AddLedgerEntryExternalIdRequest, _super);
58
+ function AddLedgerEntryExternalIdRequest() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
60
+ }
61
+ __decorate([
62
+ (0, utils_1.SpeakeasyMetadata)({ data: "request, media_type=application/json" }),
63
+ __metadata("design:type", shared.NewCreditLedgerEntry)
64
+ ], AddLedgerEntryExternalIdRequest.prototype, "newCreditLedgerEntry", void 0);
65
+ __decorate([
66
+ (0, utils_1.SpeakeasyMetadata)({ data: "pathParam, style=simple;explode=false;name=external_customer_id" }),
67
+ __metadata("design:type", String)
68
+ ], AddLedgerEntryExternalIdRequest.prototype, "externalCustomerId", void 0);
69
+ return AddLedgerEntryExternalIdRequest;
70
+ }(utils_1.SpeakeasyBase));
71
+ exports.AddLedgerEntryExternalIdRequest = AddLedgerEntryExternalIdRequest;
72
+ var AddLedgerEntryExternalIdResponse = /** @class */ (function (_super) {
73
+ __extends(AddLedgerEntryExternalIdResponse, _super);
74
+ function AddLedgerEntryExternalIdResponse() {
75
+ return _super !== null && _super.apply(this, arguments) || this;
76
+ }
77
+ __decorate([
78
+ (0, utils_1.SpeakeasyMetadata)(),
79
+ __metadata("design:type", String)
80
+ ], AddLedgerEntryExternalIdResponse.prototype, "contentType", void 0);
81
+ __decorate([
82
+ (0, utils_1.SpeakeasyMetadata)(),
83
+ __metadata("design:type", shared.CreditLedgerEntry)
84
+ ], AddLedgerEntryExternalIdResponse.prototype, "creditLedgerEntry", void 0);
85
+ __decorate([
86
+ (0, utils_1.SpeakeasyMetadata)(),
87
+ __metadata("design:type", Number)
88
+ ], AddLedgerEntryExternalIdResponse.prototype, "statusCode", void 0);
89
+ __decorate([
90
+ (0, utils_1.SpeakeasyMetadata)(),
91
+ __metadata("design:type", Object)
92
+ ], AddLedgerEntryExternalIdResponse.prototype, "rawResponse", void 0);
93
+ return AddLedgerEntryExternalIdResponse;
94
+ }(utils_1.SpeakeasyBase));
95
+ exports.AddLedgerEntryExternalIdResponse = AddLedgerEntryExternalIdResponse;
@@ -0,0 +1,23 @@
1
+ import { SpeakeasyBase } from "../../../internal/utils";
2
+ import * as shared from "../shared";
3
+ import { AxiosResponse } from "axios";
4
+ export declare class AmendEventRequest extends SpeakeasyBase {
5
+ amendedEvent?: shared.AmendedEvent;
6
+ /**
7
+ * Identical to the `idempotency_key` provided on event ingestion. Uniquely identifies an event in the system.
8
+ */
9
+ eventId: string;
10
+ }
11
+ export declare class AmendEventResponse extends SpeakeasyBase {
12
+ /**
13
+ * OK
14
+ */
15
+ amendEventResult?: shared.AmendEventResult;
16
+ contentType: string;
17
+ /**
18
+ * Bad Request
19
+ */
20
+ requestValidationError?: shared.RequestValidationError;
21
+ statusCode: number;
22
+ rawResponse?: AxiosResponse;
23
+ }