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,135 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
76
+ exports.Availability = void 0;
77
+ var utils = __importStar(require("../internal/utils"));
78
+ var operations = __importStar(require("./models/operations"));
79
+ var shared = __importStar(require("./models/shared"));
80
+ /**
81
+ * The Availability resource represents a customer's availability. Availability is created when a customer's invoice is paid, and is updated when a customer's transaction is refunded.
82
+ */
83
+ var Availability = /** @class */ (function () {
84
+ function Availability(sdkConfig) {
85
+ this.sdkConfiguration = sdkConfig;
86
+ }
87
+ /**
88
+ * Check availability
89
+ *
90
+ * @remarks
91
+ * This endpoint allows you to test your connection to the Orb API and check the validity of your API key, passed in the `Authorization` header. This is particularly useful for checking that your environment is set up properly, and is a great choice for connectors and integrations.
92
+ *
93
+ * This API does not have any side-effects or return any Orb resources.
94
+ */
95
+ Availability.prototype.ping = function (config) {
96
+ var _a, _b;
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
99
+ return __generator(this, function (_c) {
100
+ switch (_c.label) {
101
+ case 0:
102
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
103
+ url = baseURL.replace(/\/$/, "") + "/ping";
104
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
105
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
106
+ headers["Accept"] = "application/json";
107
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
108
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
109
+ case 1:
110
+ httpRes = _c.sent();
111
+ 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 : "";
112
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
113
+ throw new Error("status code not found in response: ".concat(httpRes));
114
+ }
115
+ res = new operations.PingResponse({
116
+ statusCode: httpRes.status,
117
+ contentType: contentType,
118
+ rawResponse: httpRes,
119
+ });
120
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
121
+ switch (true) {
122
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
123
+ if (utils.matchContentType(contentType, "application/json")) {
124
+ res.availability = utils.objectToClass(JSON.parse(decodedRes), shared.Availability);
125
+ }
126
+ break;
127
+ }
128
+ return [2 /*return*/, res];
129
+ }
130
+ });
131
+ });
132
+ };
133
+ return Availability;
134
+ }());
135
+ exports.Availability = Availability;
@@ -0,0 +1,53 @@
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
+ * A coupon represents a reusable discount configuration, and have an attached redemption code that can be issued to your end users. Coupons are most often used in self-serve signup or upgrade flows in your checkout experience or billing portal.
7
+ *
8
+ * @remarks
9
+ *
10
+ * To redeem a coupon, pass the `redemption_code` property in the [create subscription](create-subscription.api.mdx) or [schedule plan change](schedule-plan-change.api.mdx) request.
11
+ *
12
+ */
13
+ export declare class Coupon {
14
+ private sdkConfiguration;
15
+ constructor(sdkConfig: SDKConfiguration);
16
+ /**
17
+ * Archive coupon
18
+ *
19
+ * @remarks
20
+ * This endpoint allows a coupon to be archived. Archived coupons can no longer be redeemed, and will be hidden from lists of active coupons. Additionally, once a coupon is archived, its redemption code can be reused for a different coupon.
21
+ */
22
+ archive(req: operations.ArchiveCouponRequest, config?: AxiosRequestConfig): Promise<operations.ArchiveCouponResponse>;
23
+ /**
24
+ * Create coupon
25
+ *
26
+ * @remarks
27
+ * This endpoint allows the creation of coupons, which can then be redeemed at subscription creation or plan change.
28
+ */
29
+ create(req: shared.NewCoupon, config?: AxiosRequestConfig): Promise<operations.CreateCouponResponse>;
30
+ /**
31
+ * Fetch coupon
32
+ *
33
+ * @remarks
34
+ * This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use the [List coupons](list-coupons) endpoint with the `redemption_code` parameter.
35
+ */
36
+ fetch(req: operations.FetchCouponRequest, config?: AxiosRequestConfig): Promise<operations.FetchCouponResponse>;
37
+ /**
38
+ * List coupons
39
+ *
40
+ * @remarks
41
+ * This endpoint returns a list of all coupons for an account in a list format.
42
+ *
43
+ * The list of coupons is ordered starting from the most recently created coupon. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the [Pagination-metadata schema](pagination).
44
+ */
45
+ list(req: operations.ListCouponsRequest, config?: AxiosRequestConfig): Promise<operations.ListCouponsResponse>;
46
+ /**
47
+ * List coupon subscriptions
48
+ *
49
+ * @remarks
50
+ * This endpoint returns a list of all subscriptions that have redeemed a given coupon as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see [Subscription](../guides/concepts#subscription).
51
+ */
52
+ listSubscriptions(req: operations.ListCouponSubscriptionsRequest, config?: AxiosRequestConfig): Promise<operations.ListCouponSubscriptionsResponse>;
53
+ }
@@ -0,0 +1,358 @@
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.Coupon = 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
+ * A coupon represents a reusable discount configuration, and have an attached redemption code that can be issued to your end users. Coupons are most often used in self-serve signup or upgrade flows in your checkout experience or billing portal.
98
+ *
99
+ * @remarks
100
+ *
101
+ * To redeem a coupon, pass the `redemption_code` property in the [create subscription](create-subscription.api.mdx) or [schedule plan change](schedule-plan-change.api.mdx) request.
102
+ *
103
+ */
104
+ var Coupon = /** @class */ (function () {
105
+ function Coupon(sdkConfig) {
106
+ this.sdkConfiguration = sdkConfig;
107
+ }
108
+ /**
109
+ * Archive coupon
110
+ *
111
+ * @remarks
112
+ * This endpoint allows a coupon to be archived. Archived coupons can no longer be redeemed, and will be hidden from lists of active coupons. Additionally, once a coupon is archived, its redemption code can be reused for a different coupon.
113
+ */
114
+ Coupon.prototype.archive = function (req, config) {
115
+ var _a, _b;
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
118
+ return __generator(this, function (_c) {
119
+ switch (_c.label) {
120
+ case 0:
121
+ if (!(req instanceof utils.SpeakeasyBase)) {
122
+ req = new operations.ArchiveCouponRequest(req);
123
+ }
124
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
125
+ url = utils.generateURL(baseURL, "/coupons/{coupon_id}/archive", req);
126
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
127
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
128
+ headers["Accept"] = "application/json";
129
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
130
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer" }, config))];
131
+ case 1:
132
+ httpRes = _c.sent();
133
+ 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 : "";
134
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
135
+ throw new Error("status code not found in response: ".concat(httpRes));
136
+ }
137
+ res = new operations.ArchiveCouponResponse({
138
+ statusCode: httpRes.status,
139
+ contentType: contentType,
140
+ rawResponse: httpRes,
141
+ });
142
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
143
+ switch (true) {
144
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
145
+ if (utils.matchContentType(contentType, "application/json")) {
146
+ res.coupon = utils.objectToClass(JSON.parse(decodedRes), shared.Coupon);
147
+ }
148
+ break;
149
+ }
150
+ return [2 /*return*/, res];
151
+ }
152
+ });
153
+ });
154
+ };
155
+ /**
156
+ * Create coupon
157
+ *
158
+ * @remarks
159
+ * This endpoint allows the creation of coupons, which can then be redeemed at subscription creation or plan change.
160
+ */
161
+ Coupon.prototype.create = function (req, config) {
162
+ var _a, _b;
163
+ return __awaiter(this, void 0, void 0, function () {
164
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res, decodedRes;
165
+ var _d;
166
+ return __generator(this, function (_e) {
167
+ switch (_e.label) {
168
+ case 0:
169
+ if (!(req instanceof utils.SpeakeasyBase)) {
170
+ req = new shared.NewCoupon(req);
171
+ }
172
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
173
+ url = baseURL.replace(/\/$/, "") + "/coupons";
174
+ _c = __read([{}, {}], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
175
+ try {
176
+ _d = __read(utils.serializeRequestBody(req, "request", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
177
+ }
178
+ catch (e) {
179
+ if (e instanceof Error) {
180
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
181
+ }
182
+ }
183
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
184
+ headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
185
+ headers["Accept"] = "application/json";
186
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
187
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
188
+ case 1:
189
+ httpRes = _e.sent();
190
+ 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 : "";
191
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
192
+ throw new Error("status code not found in response: ".concat(httpRes));
193
+ }
194
+ res = new operations.CreateCouponResponse({
195
+ statusCode: httpRes.status,
196
+ contentType: contentType,
197
+ rawResponse: httpRes,
198
+ });
199
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
200
+ switch (true) {
201
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
202
+ if (utils.matchContentType(contentType, "application/json")) {
203
+ res.coupon = utils.objectToClass(JSON.parse(decodedRes), shared.Coupon);
204
+ }
205
+ break;
206
+ }
207
+ return [2 /*return*/, res];
208
+ }
209
+ });
210
+ });
211
+ };
212
+ /**
213
+ * Fetch coupon
214
+ *
215
+ * @remarks
216
+ * This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use the [List coupons](list-coupons) endpoint with the `redemption_code` parameter.
217
+ */
218
+ Coupon.prototype.fetch = function (req, config) {
219
+ var _a, _b;
220
+ return __awaiter(this, void 0, void 0, function () {
221
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
222
+ return __generator(this, function (_c) {
223
+ switch (_c.label) {
224
+ case 0:
225
+ if (!(req instanceof utils.SpeakeasyBase)) {
226
+ req = new operations.FetchCouponRequest(req);
227
+ }
228
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
229
+ url = utils.generateURL(baseURL, "/coupons/{coupon_id}", req);
230
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
231
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
232
+ headers["Accept"] = "application/json";
233
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
234
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
235
+ case 1:
236
+ httpRes = _c.sent();
237
+ 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 : "";
238
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
239
+ throw new Error("status code not found in response: ".concat(httpRes));
240
+ }
241
+ res = new operations.FetchCouponResponse({
242
+ statusCode: httpRes.status,
243
+ contentType: contentType,
244
+ rawResponse: httpRes,
245
+ });
246
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
247
+ switch (true) {
248
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
249
+ if (utils.matchContentType(contentType, "application/json")) {
250
+ res.coupon = utils.objectToClass(JSON.parse(decodedRes), shared.Coupon);
251
+ }
252
+ break;
253
+ }
254
+ return [2 /*return*/, res];
255
+ }
256
+ });
257
+ });
258
+ };
259
+ /**
260
+ * List coupons
261
+ *
262
+ * @remarks
263
+ * This endpoint returns a list of all coupons for an account in a list format.
264
+ *
265
+ * The list of coupons is ordered starting from the most recently created coupon. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the [Pagination-metadata schema](pagination).
266
+ */
267
+ Coupon.prototype.list = function (req, config) {
268
+ var _a, _b;
269
+ return __awaiter(this, void 0, void 0, function () {
270
+ var baseURL, url, client, headers, queryParams, httpRes, contentType, res, decodedRes;
271
+ return __generator(this, function (_c) {
272
+ switch (_c.label) {
273
+ case 0:
274
+ if (!(req instanceof utils.SpeakeasyBase)) {
275
+ req = new operations.ListCouponsRequest(req);
276
+ }
277
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
278
+ url = baseURL.replace(/\/$/, "") + "/coupons";
279
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
280
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
281
+ queryParams = utils.serializeQueryParams(req);
282
+ headers["Accept"] = "application/json";
283
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
284
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
285
+ case 1:
286
+ httpRes = _c.sent();
287
+ 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 : "";
288
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
289
+ throw new Error("status code not found in response: ".concat(httpRes));
290
+ }
291
+ res = new operations.ListCouponsResponse({
292
+ statusCode: httpRes.status,
293
+ contentType: contentType,
294
+ rawResponse: httpRes,
295
+ });
296
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
297
+ switch (true) {
298
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
299
+ if (utils.matchContentType(contentType, "application/json")) {
300
+ res.coupons = utils.objectToClass(JSON.parse(decodedRes), shared.Coupons);
301
+ }
302
+ break;
303
+ }
304
+ return [2 /*return*/, res];
305
+ }
306
+ });
307
+ });
308
+ };
309
+ /**
310
+ * List coupon subscriptions
311
+ *
312
+ * @remarks
313
+ * This endpoint returns a list of all subscriptions that have redeemed a given coupon as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see [Subscription](../guides/concepts#subscription).
314
+ */
315
+ Coupon.prototype.listSubscriptions = function (req, config) {
316
+ var _a, _b;
317
+ return __awaiter(this, void 0, void 0, function () {
318
+ var baseURL, url, client, headers, httpRes, contentType, res, decodedRes;
319
+ return __generator(this, function (_c) {
320
+ switch (_c.label) {
321
+ case 0:
322
+ if (!(req instanceof utils.SpeakeasyBase)) {
323
+ req = new operations.ListCouponSubscriptionsRequest(req);
324
+ }
325
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
326
+ url = utils.generateURL(baseURL, "/coupons/{coupon_id}/subscriptions", req);
327
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
328
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
329
+ headers["Accept"] = "application/json";
330
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
331
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
332
+ case 1:
333
+ httpRes = _c.sent();
334
+ 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 : "";
335
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
336
+ throw new Error("status code not found in response: ".concat(httpRes));
337
+ }
338
+ res = new operations.ListCouponSubscriptionsResponse({
339
+ statusCode: httpRes.status,
340
+ contentType: contentType,
341
+ rawResponse: httpRes,
342
+ });
343
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
344
+ switch (true) {
345
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
346
+ if (utils.matchContentType(contentType, "application/json")) {
347
+ res.subscriptions = utils.objectToClass(JSON.parse(decodedRes), shared.Subscriptions);
348
+ }
349
+ break;
350
+ }
351
+ return [2 /*return*/, res];
352
+ }
353
+ });
354
+ });
355
+ };
356
+ return Coupon;
357
+ }());
358
+ exports.Coupon = Coupon;