orb-billing 1.20.0 → 1.20.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 (257) hide show
  1. package/dist/sdk/availability.js +17 -36
  2. package/dist/sdk/coupon.js +85 -180
  3. package/dist/sdk/credit.js +102 -216
  4. package/dist/sdk/creditnote.js +34 -72
  5. package/dist/sdk/customer.js +221 -468
  6. package/dist/sdk/event.js +153 -324
  7. package/dist/sdk/invoice.js +136 -288
  8. package/dist/sdk/item.js +34 -72
  9. package/dist/sdk/metric.js +51 -108
  10. package/dist/sdk/models/errors/fivehundrederror.d.ts +12 -0
  11. package/dist/sdk/models/errors/fivehundrederror.js +112 -0
  12. package/dist/sdk/models/errors/fourhundredandoneerror.d.ts +12 -0
  13. package/dist/sdk/models/errors/fourhundredandoneerror.js +112 -0
  14. package/dist/sdk/models/errors/fourhundredandtwentynineerror.d.ts +12 -0
  15. package/dist/sdk/models/errors/fourhundredandtwentynineerror.js +112 -0
  16. package/dist/sdk/models/errors/index.d.ts +3 -0
  17. package/dist/sdk/models/errors/index.js +3 -0
  18. package/dist/sdk/models/operations/addeditpriceintervals.d.ts +0 -28
  19. package/dist/sdk/models/operations/addeditpriceintervals.js +0 -28
  20. package/dist/sdk/models/operations/amendevent.d.ts +0 -28
  21. package/dist/sdk/models/operations/amendevent.js +0 -28
  22. package/dist/sdk/models/operations/amendusage.d.ts +0 -28
  23. package/dist/sdk/models/operations/amendusage.js +0 -28
  24. package/dist/sdk/models/operations/amendusageexternalcustomerid.d.ts +0 -28
  25. package/dist/sdk/models/operations/amendusageexternalcustomerid.js +0 -28
  26. package/dist/sdk/models/operations/archivecoupon.d.ts +0 -28
  27. package/dist/sdk/models/operations/archivecoupon.js +0 -28
  28. package/dist/sdk/models/operations/cancelsubscription.d.ts +0 -28
  29. package/dist/sdk/models/operations/cancelsubscription.js +0 -28
  30. package/dist/sdk/models/operations/closebackfill.d.ts +0 -28
  31. package/dist/sdk/models/operations/closebackfill.js +0 -28
  32. package/dist/sdk/models/operations/createbackfill.d.ts +0 -28
  33. package/dist/sdk/models/operations/createbackfill.js +0 -28
  34. package/dist/sdk/models/operations/createcoupon.d.ts +0 -28
  35. package/dist/sdk/models/operations/createcoupon.js +0 -28
  36. package/dist/sdk/models/operations/createcustomer.d.ts +0 -28
  37. package/dist/sdk/models/operations/createcustomer.js +0 -28
  38. package/dist/sdk/models/operations/createcustomerbalancetransaction.d.ts +0 -28
  39. package/dist/sdk/models/operations/createcustomerbalancetransaction.js +0 -28
  40. package/dist/sdk/models/operations/createinvoice.d.ts +0 -28
  41. package/dist/sdk/models/operations/createinvoice.js +0 -28
  42. package/dist/sdk/models/operations/createinvoicelineitem.d.ts +0 -28
  43. package/dist/sdk/models/operations/createinvoicelineitem.js +0 -28
  44. package/dist/sdk/models/operations/createledgerentry.d.ts +0 -29
  45. package/dist/sdk/models/operations/createledgerentry.js +0 -52
  46. package/dist/sdk/models/operations/createledgerentryexternalid.d.ts +0 -29
  47. package/dist/sdk/models/operations/createledgerentryexternalid.js +0 -52
  48. package/dist/sdk/models/operations/createmetric.d.ts +0 -28
  49. package/dist/sdk/models/operations/createmetric.js +0 -28
  50. package/dist/sdk/models/operations/createplan.d.ts +0 -28
  51. package/dist/sdk/models/operations/createplan.js +0 -28
  52. package/dist/sdk/models/operations/createprice.d.ts +0 -29
  53. package/dist/sdk/models/operations/createprice.js +0 -52
  54. package/dist/sdk/models/operations/createsubscription.d.ts +0 -28
  55. package/dist/sdk/models/operations/createsubscription.js +0 -28
  56. package/dist/sdk/models/operations/deletecustomer.d.ts +0 -28
  57. package/dist/sdk/models/operations/deletecustomer.js +0 -28
  58. package/dist/sdk/models/operations/deprecateevent.d.ts +0 -28
  59. package/dist/sdk/models/operations/deprecateevent.js +0 -28
  60. package/dist/sdk/models/operations/fetchbackfill.d.ts +0 -28
  61. package/dist/sdk/models/operations/fetchbackfill.js +0 -28
  62. package/dist/sdk/models/operations/fetchcoupon.d.ts +0 -28
  63. package/dist/sdk/models/operations/fetchcoupon.js +0 -28
  64. package/dist/sdk/models/operations/fetchcreditnote.d.ts +0 -28
  65. package/dist/sdk/models/operations/fetchcreditnote.js +0 -28
  66. package/dist/sdk/models/operations/fetchcustomer.d.ts +0 -28
  67. package/dist/sdk/models/operations/fetchcustomer.js +0 -28
  68. package/dist/sdk/models/operations/fetchcustomercosts.d.ts +0 -28
  69. package/dist/sdk/models/operations/fetchcustomercosts.js +0 -28
  70. package/dist/sdk/models/operations/fetchcustomercostsexternalid.d.ts +0 -28
  71. package/dist/sdk/models/operations/fetchcustomercostsexternalid.js +0 -28
  72. package/dist/sdk/models/operations/fetchcustomercredits.d.ts +0 -28
  73. package/dist/sdk/models/operations/fetchcustomercredits.js +0 -28
  74. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.d.ts +0 -28
  75. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.js +0 -28
  76. package/dist/sdk/models/operations/fetchcustomercreditsledger.d.ts +0 -28
  77. package/dist/sdk/models/operations/fetchcustomercreditsledger.js +0 -28
  78. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.d.ts +0 -28
  79. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.js +0 -28
  80. package/dist/sdk/models/operations/fetchcustomerexternalid.d.ts +0 -28
  81. package/dist/sdk/models/operations/fetchcustomerexternalid.js +0 -28
  82. package/dist/sdk/models/operations/fetchinvoice.d.ts +0 -28
  83. package/dist/sdk/models/operations/fetchinvoice.js +0 -28
  84. package/dist/sdk/models/operations/fetchitem.d.ts +0 -28
  85. package/dist/sdk/models/operations/fetchitem.js +0 -28
  86. package/dist/sdk/models/operations/fetchmetric.d.ts +0 -28
  87. package/dist/sdk/models/operations/fetchmetric.js +0 -28
  88. package/dist/sdk/models/operations/fetchplan.d.ts +0 -28
  89. package/dist/sdk/models/operations/fetchplan.js +0 -28
  90. package/dist/sdk/models/operations/fetchplanexternalid.d.ts +0 -28
  91. package/dist/sdk/models/operations/fetchplanexternalid.js +0 -28
  92. package/dist/sdk/models/operations/fetchprice.d.ts +0 -29
  93. package/dist/sdk/models/operations/fetchprice.js +0 -52
  94. package/dist/sdk/models/operations/fetchpriceexternalid.d.ts +0 -29
  95. package/dist/sdk/models/operations/fetchpriceexternalid.js +0 -52
  96. package/dist/sdk/models/operations/fetchsubscription.d.ts +0 -28
  97. package/dist/sdk/models/operations/fetchsubscription.js +0 -28
  98. package/dist/sdk/models/operations/fetchsubscriptioncosts.d.ts +0 -28
  99. package/dist/sdk/models/operations/fetchsubscriptioncosts.js +0 -28
  100. package/dist/sdk/models/operations/fetchsubscriptionschedule.d.ts +0 -28
  101. package/dist/sdk/models/operations/fetchsubscriptionschedule.js +0 -28
  102. package/dist/sdk/models/operations/fetchsubscriptionusage.d.ts +0 -29
  103. package/dist/sdk/models/operations/fetchsubscriptionusage.js +0 -52
  104. package/dist/sdk/models/operations/fetchupcominginvoice.d.ts +0 -28
  105. package/dist/sdk/models/operations/fetchupcominginvoice.js +0 -28
  106. package/dist/sdk/models/operations/ingest.d.ts +0 -28
  107. package/dist/sdk/models/operations/ingest.js +0 -28
  108. package/dist/sdk/models/operations/issueinvoice.d.ts +0 -28
  109. package/dist/sdk/models/operations/issueinvoice.js +0 -28
  110. package/dist/sdk/models/operations/listbackfills.d.ts +0 -28
  111. package/dist/sdk/models/operations/listbackfills.js +0 -28
  112. package/dist/sdk/models/operations/listbalancetransactions.d.ts +0 -28
  113. package/dist/sdk/models/operations/listbalancetransactions.js +0 -28
  114. package/dist/sdk/models/operations/listcoupons.d.ts +0 -28
  115. package/dist/sdk/models/operations/listcoupons.js +0 -28
  116. package/dist/sdk/models/operations/listcouponsubscriptions.d.ts +0 -28
  117. package/dist/sdk/models/operations/listcouponsubscriptions.js +0 -28
  118. package/dist/sdk/models/operations/listcreditnotes.d.ts +0 -28
  119. package/dist/sdk/models/operations/listcreditnotes.js +0 -28
  120. package/dist/sdk/models/operations/listcustomers.d.ts +0 -28
  121. package/dist/sdk/models/operations/listcustomers.js +0 -28
  122. package/dist/sdk/models/operations/listinvoices.d.ts +0 -28
  123. package/dist/sdk/models/operations/listinvoices.js +0 -28
  124. package/dist/sdk/models/operations/listitems.d.ts +0 -28
  125. package/dist/sdk/models/operations/listitems.js +0 -28
  126. package/dist/sdk/models/operations/listmetrics.d.ts +0 -28
  127. package/dist/sdk/models/operations/listmetrics.js +0 -28
  128. package/dist/sdk/models/operations/listplans.d.ts +0 -28
  129. package/dist/sdk/models/operations/listplans.js +0 -28
  130. package/dist/sdk/models/operations/listprices.d.ts +0 -28
  131. package/dist/sdk/models/operations/listprices.js +0 -28
  132. package/dist/sdk/models/operations/listsubscriptions.d.ts +0 -28
  133. package/dist/sdk/models/operations/listsubscriptions.js +0 -28
  134. package/dist/sdk/models/operations/markinvoiceaspaid.d.ts +0 -28
  135. package/dist/sdk/models/operations/markinvoiceaspaid.js +0 -28
  136. package/dist/sdk/models/operations/ping.d.ts +0 -28
  137. package/dist/sdk/models/operations/ping.js +0 -28
  138. package/dist/sdk/models/operations/revertbackfill.d.ts +0 -28
  139. package/dist/sdk/models/operations/revertbackfill.js +0 -28
  140. package/dist/sdk/models/operations/scheduleplanchange.d.ts +0 -28
  141. package/dist/sdk/models/operations/scheduleplanchange.js +0 -28
  142. package/dist/sdk/models/operations/searchevents.d.ts +0 -28
  143. package/dist/sdk/models/operations/searchevents.js +0 -28
  144. package/dist/sdk/models/operations/triggerphase.d.ts +0 -28
  145. package/dist/sdk/models/operations/triggerphase.js +0 -28
  146. package/dist/sdk/models/operations/unschedulecancellation.d.ts +0 -28
  147. package/dist/sdk/models/operations/unschedulecancellation.js +0 -28
  148. package/dist/sdk/models/operations/unschedulefixedfeequantity.d.ts +0 -28
  149. package/dist/sdk/models/operations/unschedulefixedfeequantity.js +0 -28
  150. package/dist/sdk/models/operations/unscheduleplanchange.d.ts +0 -28
  151. package/dist/sdk/models/operations/unscheduleplanchange.js +0 -28
  152. package/dist/sdk/models/operations/updatecustomer.d.ts +0 -28
  153. package/dist/sdk/models/operations/updatecustomer.js +0 -28
  154. package/dist/sdk/models/operations/updatecustomerexternalid.d.ts +0 -28
  155. package/dist/sdk/models/operations/updatecustomerexternalid.js +0 -28
  156. package/dist/sdk/models/operations/updatefixedfeequantity.d.ts +0 -28
  157. package/dist/sdk/models/operations/updatefixedfeequantity.js +0 -28
  158. package/dist/sdk/models/operations/updateplan.d.ts +0 -28
  159. package/dist/sdk/models/operations/updateplan.js +0 -28
  160. package/dist/sdk/models/operations/updateplanexternal.d.ts +0 -28
  161. package/dist/sdk/models/operations/updateplanexternal.js +0 -28
  162. package/dist/sdk/models/operations/voidinvoice.d.ts +0 -28
  163. package/dist/sdk/models/operations/voidinvoice.js +0 -28
  164. package/dist/sdk/models/shared/fivehundrederror.d.ts +0 -10
  165. package/dist/sdk/models/shared/fivehundrederror.js +1 -69
  166. package/dist/sdk/models/shared/fourhundredandoneerror.d.ts +0 -10
  167. package/dist/sdk/models/shared/fourhundredandoneerror.js +1 -69
  168. package/dist/sdk/models/shared/fourhundredandtwentynineerror.d.ts +0 -10
  169. package/dist/sdk/models/shared/fourhundredandtwentynineerror.js +1 -69
  170. package/dist/sdk/plan.js +102 -216
  171. package/dist/sdk/price.js +68 -144
  172. package/dist/sdk/priceinterval.js +17 -36
  173. package/dist/sdk/sdk.js +2 -2
  174. package/dist/sdk/subscription.js +221 -468
  175. package/docs/models/errors/fivehundrederror.md +12 -0
  176. package/docs/models/errors/fourhundredandoneerror.md +12 -0
  177. package/docs/models/errors/fourhundredandtwentynineerror.md +12 -0
  178. package/docs/models/operations/addeditpriceintervalsresponse.md +6 -13
  179. package/docs/models/operations/amendeventresponse.md +6 -13
  180. package/docs/models/operations/amendusageexternalcustomeridresponse.md +6 -13
  181. package/docs/models/operations/amendusageresponse.md +6 -13
  182. package/docs/models/operations/archivecouponresponse.md +6 -13
  183. package/docs/models/operations/cancelsubscriptionresponse.md +6 -13
  184. package/docs/models/operations/closebackfillresponse.md +6 -13
  185. package/docs/models/operations/createbackfillresponse.md +6 -13
  186. package/docs/models/operations/createcouponresponse.md +6 -13
  187. package/docs/models/operations/createcustomerbalancetransactionresponse.md +6 -13
  188. package/docs/models/operations/createcustomerresponse.md +6 -13
  189. package/docs/models/operations/createinvoicelineitemresponse.md +6 -13
  190. package/docs/models/operations/createinvoiceresponse.md +6 -13
  191. package/docs/models/operations/createledgerentryexternalidresponse.md +6 -13
  192. package/docs/models/operations/createledgerentryresponse.md +6 -13
  193. package/docs/models/operations/createmetricresponse.md +6 -13
  194. package/docs/models/operations/createplanresponse.md +6 -13
  195. package/docs/models/operations/createpriceresponse.md +6 -13
  196. package/docs/models/operations/createsubscriptionresponse.md +6 -13
  197. package/docs/models/operations/deletecustomerresponse.md +6 -13
  198. package/docs/models/operations/deprecateeventresponse.md +6 -13
  199. package/docs/models/operations/fetchbackfillresponse.md +6 -13
  200. package/docs/models/operations/fetchcouponresponse.md +6 -13
  201. package/docs/models/operations/fetchcreditnoteresponse.md +6 -13
  202. package/docs/models/operations/fetchcustomercostsexternalidresponse.md +6 -13
  203. package/docs/models/operations/fetchcustomercostsresponse.md +6 -13
  204. package/docs/models/operations/fetchcustomercreditsexternalidresponse.md +6 -13
  205. package/docs/models/operations/fetchcustomercreditsledgerexternalidresponse.md +6 -13
  206. package/docs/models/operations/fetchcustomercreditsledgerresponse.md +6 -13
  207. package/docs/models/operations/fetchcustomercreditsresponse.md +6 -13
  208. package/docs/models/operations/fetchcustomerexternalidresponse.md +6 -13
  209. package/docs/models/operations/fetchcustomerresponse.md +6 -13
  210. package/docs/models/operations/fetchinvoiceresponse.md +6 -13
  211. package/docs/models/operations/fetchitemresponse.md +6 -13
  212. package/docs/models/operations/fetchmetricresponse.md +6 -13
  213. package/docs/models/operations/fetchplanexternalidresponse.md +6 -13
  214. package/docs/models/operations/fetchplanresponse.md +6 -13
  215. package/docs/models/operations/fetchpriceexternalidresponse.md +6 -13
  216. package/docs/models/operations/fetchpriceresponse.md +6 -13
  217. package/docs/models/operations/fetchsubscriptioncostsresponse.md +6 -13
  218. package/docs/models/operations/fetchsubscriptionresponse.md +6 -13
  219. package/docs/models/operations/fetchsubscriptionscheduleresponse.md +6 -13
  220. package/docs/models/operations/fetchsubscriptionusageresponse.md +6 -13
  221. package/docs/models/operations/fetchupcominginvoiceresponse.md +6 -13
  222. package/docs/models/operations/ingestresponse.md +6 -13
  223. package/docs/models/operations/issueinvoiceresponse.md +6 -13
  224. package/docs/models/operations/listbackfillsresponse.md +6 -13
  225. package/docs/models/operations/listbalancetransactionsresponse.md +6 -13
  226. package/docs/models/operations/listcouponsresponse.md +6 -13
  227. package/docs/models/operations/listcouponsubscriptionsresponse.md +6 -13
  228. package/docs/models/operations/listcreditnotesresponse.md +6 -13
  229. package/docs/models/operations/listcustomersresponse.md +6 -13
  230. package/docs/models/operations/listinvoicesresponse.md +6 -13
  231. package/docs/models/operations/listitemsresponse.md +6 -13
  232. package/docs/models/operations/listmetricsresponse.md +6 -13
  233. package/docs/models/operations/listplansresponse.md +6 -13
  234. package/docs/models/operations/listpricesresponse.md +6 -13
  235. package/docs/models/operations/listsubscriptionsresponse.md +6 -13
  236. package/docs/models/operations/markinvoiceaspaidresponse.md +6 -13
  237. package/docs/models/operations/pingresponse.md +6 -13
  238. package/docs/models/operations/revertbackfillresponse.md +6 -13
  239. package/docs/models/operations/scheduleplanchangeresponse.md +6 -13
  240. package/docs/models/operations/searcheventsresponse.md +6 -13
  241. package/docs/models/operations/triggerphaseresponse.md +6 -13
  242. package/docs/models/operations/unschedulecancellationresponse.md +6 -13
  243. package/docs/models/operations/unschedulefixedfeequantityresponse.md +6 -13
  244. package/docs/models/operations/unscheduleplanchangeresponse.md +6 -13
  245. package/docs/models/operations/updatecustomerexternalidresponse.md +6 -13
  246. package/docs/models/operations/updatecustomerresponse.md +6 -13
  247. package/docs/models/operations/updatefixedfeequantityresponse.md +6 -13
  248. package/docs/models/operations/updateplanexternalresponse.md +6 -13
  249. package/docs/models/operations/updateplanresponse.md +6 -13
  250. package/docs/models/operations/voidinvoiceresponse.md +6 -13
  251. package/package.json +1 -1
  252. package/docs/models/shared/fivehundrederror.md +0 -12
  253. package/docs/models/shared/fourhundredandoneerror.md +0 -12
  254. package/docs/models/shared/fourhundredandtwentynineerror.md +0 -12
  255. /package/docs/models/{shared → errors}/fivehundrederrorheaders.md +0 -0
  256. /package/docs/models/{shared → errors}/fourhundredandoneerrorheaders.md +0 -0
  257. /package/docs/models/{shared → errors}/fourhundredandtwentynineerrorheaders.md +0 -0
package/dist/sdk/price.js CHANGED
@@ -317,7 +317,7 @@ var Price = /** @class */ (function () {
317
317
  Price.prototype.create = function (req, config) {
318
318
  var _a, _b;
319
319
  return __awaiter(this, void 0, void 0, function () {
320
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
320
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
321
321
  var _d;
322
322
  return __generator(this, function (_e) {
323
323
  switch (_e.label) {
@@ -370,41 +370,18 @@ var Price = /** @class */ (function () {
370
370
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
371
371
  }
372
372
  break;
373
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
374
- if (utils.matchContentType(contentType, "application/json")) {
375
- res.fourHundredError = JSON.parse(decodedRes);
376
- }
377
- else {
378
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
379
- }
380
- break;
373
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
374
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
375
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
376
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
377
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
378
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
379
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
381
380
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
382
381
  if (utils.matchContentType(contentType, "application/json")) {
383
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
384
- }
385
- else {
386
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
387
- }
388
- break;
389
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
390
- if (utils.matchContentType(contentType, "application/json")) {
391
- res.fourHundredAndFourError = JSON.parse(decodedRes);
392
- }
393
- else {
394
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
395
- }
396
- break;
397
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
398
- if (utils.matchContentType(contentType, "application/json")) {
399
- res.fourHundredAndNineError = JSON.parse(decodedRes);
400
- }
401
- else {
402
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
403
- }
404
- break;
405
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
406
- if (utils.matchContentType(contentType, "application/json")) {
407
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
382
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
383
+ err.rawResponse = httpRes;
384
+ throw new errors.FourHundredAndOneError(err);
408
385
  }
409
386
  else {
410
387
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -412,7 +389,9 @@ var Price = /** @class */ (function () {
412
389
  break;
413
390
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
414
391
  if (utils.matchContentType(contentType, "application/json")) {
415
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
392
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
393
+ err.rawResponse = httpRes;
394
+ throw new errors.FourHundredAndTwentyNineError(err);
416
395
  }
417
396
  else {
418
397
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -420,7 +399,9 @@ var Price = /** @class */ (function () {
420
399
  break;
421
400
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
422
401
  if (utils.matchContentType(contentType, "application/json")) {
423
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
402
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
403
+ err.rawResponse = httpRes;
404
+ throw new errors.FiveHundredError(err);
424
405
  }
425
406
  else {
426
407
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -441,7 +422,7 @@ var Price = /** @class */ (function () {
441
422
  Price.prototype.fetch = function (priceId, config) {
442
423
  var _a, _b;
443
424
  return __awaiter(this, void 0, void 0, function () {
444
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
425
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
445
426
  return __generator(this, function (_c) {
446
427
  switch (_c.label) {
447
428
  case 0:
@@ -487,41 +468,18 @@ var Price = /** @class */ (function () {
487
468
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
488
469
  }
489
470
  break;
490
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
491
- if (utils.matchContentType(contentType, "application/json")) {
492
- res.fourHundredError = JSON.parse(decodedRes);
493
- }
494
- else {
495
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
496
- }
497
- break;
471
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
472
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
473
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
474
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
475
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
476
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
477
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
498
478
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
499
479
  if (utils.matchContentType(contentType, "application/json")) {
500
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
501
- }
502
- else {
503
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
504
- }
505
- break;
506
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
507
- if (utils.matchContentType(contentType, "application/json")) {
508
- res.fourHundredAndFourError = JSON.parse(decodedRes);
509
- }
510
- else {
511
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
512
- }
513
- break;
514
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
515
- if (utils.matchContentType(contentType, "application/json")) {
516
- res.fourHundredAndNineError = JSON.parse(decodedRes);
517
- }
518
- else {
519
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
520
- }
521
- break;
522
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
523
- if (utils.matchContentType(contentType, "application/json")) {
524
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
480
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
481
+ err.rawResponse = httpRes;
482
+ throw new errors.FourHundredAndOneError(err);
525
483
  }
526
484
  else {
527
485
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -529,7 +487,9 @@ var Price = /** @class */ (function () {
529
487
  break;
530
488
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
531
489
  if (utils.matchContentType(contentType, "application/json")) {
532
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
490
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
491
+ err.rawResponse = httpRes;
492
+ throw new errors.FourHundredAndTwentyNineError(err);
533
493
  }
534
494
  else {
535
495
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -537,7 +497,9 @@ var Price = /** @class */ (function () {
537
497
  break;
538
498
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
539
499
  if (utils.matchContentType(contentType, "application/json")) {
540
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
500
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
501
+ err.rawResponse = httpRes;
502
+ throw new errors.FiveHundredError(err);
541
503
  }
542
504
  else {
543
505
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -559,7 +521,7 @@ var Price = /** @class */ (function () {
559
521
  Price.prototype.fetchByExternalId = function (externalPriceId, config) {
560
522
  var _a, _b;
561
523
  return __awaiter(this, void 0, void 0, function () {
562
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
524
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
563
525
  return __generator(this, function (_c) {
564
526
  switch (_c.label) {
565
527
  case 0:
@@ -605,41 +567,18 @@ var Price = /** @class */ (function () {
605
567
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
606
568
  }
607
569
  break;
608
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
609
- if (utils.matchContentType(contentType, "application/json")) {
610
- res.fourHundredError = JSON.parse(decodedRes);
611
- }
612
- else {
613
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
614
- }
615
- break;
570
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
571
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
572
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
573
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
574
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
575
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
576
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
616
577
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
617
578
  if (utils.matchContentType(contentType, "application/json")) {
618
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
619
- }
620
- else {
621
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
622
- }
623
- break;
624
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
625
- if (utils.matchContentType(contentType, "application/json")) {
626
- res.fourHundredAndFourError = JSON.parse(decodedRes);
627
- }
628
- else {
629
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
630
- }
631
- break;
632
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
633
- if (utils.matchContentType(contentType, "application/json")) {
634
- res.fourHundredAndNineError = JSON.parse(decodedRes);
635
- }
636
- else {
637
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
638
- }
639
- break;
640
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
641
- if (utils.matchContentType(contentType, "application/json")) {
642
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
579
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
580
+ err.rawResponse = httpRes;
581
+ throw new errors.FourHundredAndOneError(err);
643
582
  }
644
583
  else {
645
584
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -647,7 +586,9 @@ var Price = /** @class */ (function () {
647
586
  break;
648
587
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
649
588
  if (utils.matchContentType(contentType, "application/json")) {
650
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
589
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
590
+ err.rawResponse = httpRes;
591
+ throw new errors.FourHundredAndTwentyNineError(err);
651
592
  }
652
593
  else {
653
594
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -655,7 +596,9 @@ var Price = /** @class */ (function () {
655
596
  break;
656
597
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
657
598
  if (utils.matchContentType(contentType, "application/json")) {
658
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
599
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
600
+ err.rawResponse = httpRes;
601
+ throw new errors.FiveHundredError(err);
659
602
  }
660
603
  else {
661
604
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -676,7 +619,7 @@ var Price = /** @class */ (function () {
676
619
  Price.prototype.list = function (cursor, limit, config) {
677
620
  var _a, _b;
678
621
  return __awaiter(this, void 0, void 0, function () {
679
- var req, baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
622
+ var req, baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
680
623
  return __generator(this, function (_c) {
681
624
  switch (_c.label) {
682
625
  case 0:
@@ -724,41 +667,18 @@ var Price = /** @class */ (function () {
724
667
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
725
668
  }
726
669
  break;
727
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
728
- if (utils.matchContentType(contentType, "application/json")) {
729
- res.fourHundredError = JSON.parse(decodedRes);
730
- }
731
- else {
732
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
733
- }
734
- break;
670
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
671
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
672
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
673
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
674
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
675
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
676
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
735
677
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
736
678
  if (utils.matchContentType(contentType, "application/json")) {
737
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
738
- }
739
- else {
740
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
741
- }
742
- break;
743
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
744
- if (utils.matchContentType(contentType, "application/json")) {
745
- res.fourHundredAndFourError = JSON.parse(decodedRes);
746
- }
747
- else {
748
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
749
- }
750
- break;
751
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
752
- if (utils.matchContentType(contentType, "application/json")) {
753
- res.fourHundredAndNineError = JSON.parse(decodedRes);
754
- }
755
- else {
756
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
757
- }
758
- break;
759
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
760
- if (utils.matchContentType(contentType, "application/json")) {
761
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
679
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
680
+ err.rawResponse = httpRes;
681
+ throw new errors.FourHundredAndOneError(err);
762
682
  }
763
683
  else {
764
684
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -766,7 +686,9 @@ var Price = /** @class */ (function () {
766
686
  break;
767
687
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
768
688
  if (utils.matchContentType(contentType, "application/json")) {
769
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
689
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
690
+ err.rawResponse = httpRes;
691
+ throw new errors.FourHundredAndTwentyNineError(err);
770
692
  }
771
693
  else {
772
694
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -774,7 +696,9 @@ var Price = /** @class */ (function () {
774
696
  break;
775
697
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
776
698
  if (utils.matchContentType(contentType, "application/json")) {
777
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
699
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
700
+ err.rawResponse = httpRes;
701
+ throw new errors.FiveHundredError(err);
778
702
  }
779
703
  else {
780
704
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -158,7 +158,7 @@ var PriceInterval = /** @class */ (function () {
158
158
  PriceInterval.prototype.addEditPriceIntervals = function (subscriptionId, addEditPriceIntervalParams, config) {
159
159
  var _a, _b;
160
160
  return __awaiter(this, void 0, void 0, function () {
161
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
161
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
162
162
  var _d;
163
163
  return __generator(this, function (_e) {
164
164
  switch (_e.label) {
@@ -215,41 +215,18 @@ var PriceInterval = /** @class */ (function () {
215
215
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
216
216
  }
217
217
  break;
218
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
219
- if (utils.matchContentType(contentType, "application/json")) {
220
- res.fourHundredError = JSON.parse(decodedRes);
221
- }
222
- else {
223
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
224
- }
225
- break;
218
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
219
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
220
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
221
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
222
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
223
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
224
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
226
225
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
227
226
  if (utils.matchContentType(contentType, "application/json")) {
228
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
229
- }
230
- else {
231
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
232
- }
233
- break;
234
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
235
- if (utils.matchContentType(contentType, "application/json")) {
236
- res.fourHundredAndFourError = JSON.parse(decodedRes);
237
- }
238
- else {
239
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
240
- }
241
- break;
242
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
243
- if (utils.matchContentType(contentType, "application/json")) {
244
- res.fourHundredAndNineError = JSON.parse(decodedRes);
245
- }
246
- else {
247
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
248
- }
249
- break;
250
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
251
- if (utils.matchContentType(contentType, "application/json")) {
252
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
227
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
228
+ err.rawResponse = httpRes;
229
+ throw new errors.FourHundredAndOneError(err);
253
230
  }
254
231
  else {
255
232
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -257,7 +234,9 @@ var PriceInterval = /** @class */ (function () {
257
234
  break;
258
235
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
259
236
  if (utils.matchContentType(contentType, "application/json")) {
260
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
237
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
238
+ err.rawResponse = httpRes;
239
+ throw new errors.FourHundredAndTwentyNineError(err);
261
240
  }
262
241
  else {
263
242
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -265,7 +244,9 @@ var PriceInterval = /** @class */ (function () {
265
244
  break;
266
245
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
267
246
  if (utils.matchContentType(contentType, "application/json")) {
268
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
247
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
248
+ err.rawResponse = httpRes;
249
+ throw new errors.FiveHundredError(err);
269
250
  }
270
251
  else {
271
252
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
package/dist/sdk/sdk.js CHANGED
@@ -34,9 +34,9 @@ var SDKConfiguration = /** @class */ (function () {
34
34
  function SDKConfiguration(init) {
35
35
  this.language = "typescript";
36
36
  this.openapiDocVersion = "1.0";
37
- this.sdkVersion = "1.20.0";
37
+ this.sdkVersion = "1.20.1";
38
38
  this.genVersion = "2.150.1";
39
- this.userAgent = "speakeasy-sdk/typescript 1.20.0 2.150.1 1.0 orb-billing";
39
+ this.userAgent = "speakeasy-sdk/typescript 1.20.1 2.150.1 1.0 orb-billing";
40
40
  Object.assign(this, init);
41
41
  }
42
42
  return SDKConfiguration;