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
@@ -200,7 +200,7 @@ var Customer = /** @class */ (function () {
200
200
  Customer.prototype.amend = function (customerId, updateEvent, timeframeEnd, timeframeStart, config) {
201
201
  var _a, _b;
202
202
  return __awaiter(this, void 0, void 0, function () {
203
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
203
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
204
204
  var _d;
205
205
  return __generator(this, function (_e) {
206
206
  switch (_e.label) {
@@ -260,41 +260,18 @@ var Customer = /** @class */ (function () {
260
260
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
261
261
  }
262
262
  break;
263
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
264
- if (utils.matchContentType(contentType, "application/json")) {
265
- res.fourHundredError = JSON.parse(decodedRes);
266
- }
267
- else {
268
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
269
- }
270
- break;
263
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
264
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
265
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
266
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
267
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
268
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
269
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
271
270
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
272
271
  if (utils.matchContentType(contentType, "application/json")) {
273
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
274
- }
275
- else {
276
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
277
- }
278
- break;
279
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
280
- if (utils.matchContentType(contentType, "application/json")) {
281
- res.fourHundredAndFourError = JSON.parse(decodedRes);
282
- }
283
- else {
284
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
285
- }
286
- break;
287
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
288
- if (utils.matchContentType(contentType, "application/json")) {
289
- res.fourHundredAndNineError = JSON.parse(decodedRes);
290
- }
291
- else {
292
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
293
- }
294
- break;
295
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
296
- if (utils.matchContentType(contentType, "application/json")) {
297
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
272
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
273
+ err.rawResponse = httpRes;
274
+ throw new errors.FourHundredAndOneError(err);
298
275
  }
299
276
  else {
300
277
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -302,7 +279,9 @@ var Customer = /** @class */ (function () {
302
279
  break;
303
280
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
304
281
  if (utils.matchContentType(contentType, "application/json")) {
305
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
282
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
283
+ err.rawResponse = httpRes;
284
+ throw new errors.FourHundredAndTwentyNineError(err);
306
285
  }
307
286
  else {
308
287
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -310,7 +289,9 @@ var Customer = /** @class */ (function () {
310
289
  break;
311
290
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
312
291
  if (utils.matchContentType(contentType, "application/json")) {
313
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
292
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
293
+ err.rawResponse = httpRes;
294
+ throw new errors.FiveHundredError(err);
314
295
  }
315
296
  else {
316
297
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -406,7 +387,7 @@ var Customer = /** @class */ (function () {
406
387
  Customer.prototype.amendByExternalId = function (externalCustomerId, updateEvent, timeframeEnd, timeframeStart, config) {
407
388
  var _a, _b;
408
389
  return __awaiter(this, void 0, void 0, function () {
409
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
390
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
410
391
  var _d;
411
392
  return __generator(this, function (_e) {
412
393
  switch (_e.label) {
@@ -466,41 +447,18 @@ var Customer = /** @class */ (function () {
466
447
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
467
448
  }
468
449
  break;
469
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
470
- if (utils.matchContentType(contentType, "application/json")) {
471
- res.fourHundredError = JSON.parse(decodedRes);
472
- }
473
- else {
474
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
475
- }
476
- break;
450
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
451
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
452
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
453
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
454
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
455
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
456
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
477
457
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
478
458
  if (utils.matchContentType(contentType, "application/json")) {
479
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
480
- }
481
- else {
482
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
483
- }
484
- break;
485
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
486
- if (utils.matchContentType(contentType, "application/json")) {
487
- res.fourHundredAndFourError = JSON.parse(decodedRes);
488
- }
489
- else {
490
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
491
- }
492
- break;
493
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
494
- if (utils.matchContentType(contentType, "application/json")) {
495
- res.fourHundredAndNineError = JSON.parse(decodedRes);
496
- }
497
- else {
498
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
499
- }
500
- break;
501
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
502
- if (utils.matchContentType(contentType, "application/json")) {
503
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
459
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
460
+ err.rawResponse = httpRes;
461
+ throw new errors.FourHundredAndOneError(err);
504
462
  }
505
463
  else {
506
464
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -508,7 +466,9 @@ var Customer = /** @class */ (function () {
508
466
  break;
509
467
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
510
468
  if (utils.matchContentType(contentType, "application/json")) {
511
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
469
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
470
+ err.rawResponse = httpRes;
471
+ throw new errors.FourHundredAndTwentyNineError(err);
512
472
  }
513
473
  else {
514
474
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -516,7 +476,9 @@ var Customer = /** @class */ (function () {
516
476
  break;
517
477
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
518
478
  if (utils.matchContentType(contentType, "application/json")) {
519
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
479
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
480
+ err.rawResponse = httpRes;
481
+ throw new errors.FiveHundredError(err);
520
482
  }
521
483
  else {
522
484
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -546,7 +508,7 @@ var Customer = /** @class */ (function () {
546
508
  Customer.prototype.create = function (req, config) {
547
509
  var _a, _b;
548
510
  return __awaiter(this, void 0, void 0, function () {
549
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
511
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
550
512
  var _d;
551
513
  return __generator(this, function (_e) {
552
514
  switch (_e.label) {
@@ -602,41 +564,18 @@ var Customer = /** @class */ (function () {
602
564
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
603
565
  }
604
566
  break;
605
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
606
- if (utils.matchContentType(contentType, "application/json")) {
607
- res.fourHundredError = JSON.parse(decodedRes);
608
- }
609
- else {
610
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
611
- }
612
- break;
567
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
568
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
569
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
570
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
571
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
572
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
573
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
613
574
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
614
575
  if (utils.matchContentType(contentType, "application/json")) {
615
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
616
- }
617
- else {
618
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
619
- }
620
- break;
621
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
622
- if (utils.matchContentType(contentType, "application/json")) {
623
- res.fourHundredAndFourError = JSON.parse(decodedRes);
624
- }
625
- else {
626
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
627
- }
628
- break;
629
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
630
- if (utils.matchContentType(contentType, "application/json")) {
631
- res.fourHundredAndNineError = JSON.parse(decodedRes);
632
- }
633
- else {
634
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
635
- }
636
- break;
637
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
638
- if (utils.matchContentType(contentType, "application/json")) {
639
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
576
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
577
+ err.rawResponse = httpRes;
578
+ throw new errors.FourHundredAndOneError(err);
640
579
  }
641
580
  else {
642
581
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -644,7 +583,9 @@ var Customer = /** @class */ (function () {
644
583
  break;
645
584
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
646
585
  if (utils.matchContentType(contentType, "application/json")) {
647
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
586
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
587
+ err.rawResponse = httpRes;
588
+ throw new errors.FourHundredAndTwentyNineError(err);
648
589
  }
649
590
  else {
650
591
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -652,7 +593,9 @@ var Customer = /** @class */ (function () {
652
593
  break;
653
594
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
654
595
  if (utils.matchContentType(contentType, "application/json")) {
655
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
596
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
597
+ err.rawResponse = httpRes;
598
+ throw new errors.FiveHundredError(err);
656
599
  }
657
600
  else {
658
601
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -674,7 +617,7 @@ var Customer = /** @class */ (function () {
674
617
  Customer.prototype.createBalanceTransaction = function (customerId, newCustomerBalanceTransaction, config) {
675
618
  var _a, _b;
676
619
  return __awaiter(this, void 0, void 0, function () {
677
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
620
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
678
621
  var _d;
679
622
  return __generator(this, function (_e) {
680
623
  switch (_e.label) {
@@ -731,41 +674,18 @@ var Customer = /** @class */ (function () {
731
674
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
732
675
  }
733
676
  break;
734
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
735
- if (utils.matchContentType(contentType, "application/json")) {
736
- res.fourHundredError = JSON.parse(decodedRes);
737
- }
738
- else {
739
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
740
- }
741
- break;
677
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
678
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
679
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
680
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
681
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
682
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
683
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
742
684
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
743
685
  if (utils.matchContentType(contentType, "application/json")) {
744
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
745
- }
746
- else {
747
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
748
- }
749
- break;
750
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
751
- if (utils.matchContentType(contentType, "application/json")) {
752
- res.fourHundredAndFourError = JSON.parse(decodedRes);
753
- }
754
- else {
755
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
756
- }
757
- break;
758
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
759
- if (utils.matchContentType(contentType, "application/json")) {
760
- res.fourHundredAndNineError = JSON.parse(decodedRes);
761
- }
762
- else {
763
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
764
- }
765
- break;
766
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
767
- if (utils.matchContentType(contentType, "application/json")) {
768
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
686
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
687
+ err.rawResponse = httpRes;
688
+ throw new errors.FourHundredAndOneError(err);
769
689
  }
770
690
  else {
771
691
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -773,7 +693,9 @@ var Customer = /** @class */ (function () {
773
693
  break;
774
694
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
775
695
  if (utils.matchContentType(contentType, "application/json")) {
776
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
696
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
697
+ err.rawResponse = httpRes;
698
+ throw new errors.FourHundredAndTwentyNineError(err);
777
699
  }
778
700
  else {
779
701
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -781,7 +703,9 @@ var Customer = /** @class */ (function () {
781
703
  break;
782
704
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
783
705
  if (utils.matchContentType(contentType, "application/json")) {
784
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
706
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
707
+ err.rawResponse = httpRes;
708
+ throw new errors.FiveHundredError(err);
785
709
  }
786
710
  else {
787
711
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -814,7 +738,7 @@ var Customer = /** @class */ (function () {
814
738
  Customer.prototype.delete = function (customerId, config) {
815
739
  var _a, _b;
816
740
  return __awaiter(this, void 0, void 0, function () {
817
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
741
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
818
742
  return __generator(this, function (_c) {
819
743
  switch (_c.label) {
820
744
  case 0:
@@ -860,41 +784,18 @@ var Customer = /** @class */ (function () {
860
784
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
861
785
  }
862
786
  break;
863
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
864
- if (utils.matchContentType(contentType, "application/json")) {
865
- res.fourHundredError = JSON.parse(decodedRes);
866
- }
867
- else {
868
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
869
- }
870
- break;
787
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
788
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
789
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
790
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
791
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
792
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
793
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
871
794
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
872
795
  if (utils.matchContentType(contentType, "application/json")) {
873
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
874
- }
875
- else {
876
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
877
- }
878
- break;
879
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
880
- if (utils.matchContentType(contentType, "application/json")) {
881
- res.fourHundredAndFourError = JSON.parse(decodedRes);
882
- }
883
- else {
884
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
885
- }
886
- break;
887
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
888
- if (utils.matchContentType(contentType, "application/json")) {
889
- res.fourHundredAndNineError = JSON.parse(decodedRes);
890
- }
891
- else {
892
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
893
- }
894
- break;
895
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
896
- if (utils.matchContentType(contentType, "application/json")) {
897
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
796
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
797
+ err.rawResponse = httpRes;
798
+ throw new errors.FourHundredAndOneError(err);
898
799
  }
899
800
  else {
900
801
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -902,7 +803,9 @@ var Customer = /** @class */ (function () {
902
803
  break;
903
804
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
904
805
  if (utils.matchContentType(contentType, "application/json")) {
905
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
806
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
807
+ err.rawResponse = httpRes;
808
+ throw new errors.FourHundredAndTwentyNineError(err);
906
809
  }
907
810
  else {
908
811
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -910,7 +813,9 @@ var Customer = /** @class */ (function () {
910
813
  break;
911
814
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
912
815
  if (utils.matchContentType(contentType, "application/json")) {
913
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
816
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
817
+ err.rawResponse = httpRes;
818
+ throw new errors.FiveHundredError(err);
914
819
  }
915
820
  else {
916
821
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -934,7 +839,7 @@ var Customer = /** @class */ (function () {
934
839
  Customer.prototype.fetch = function (customerId, config) {
935
840
  var _a, _b;
936
841
  return __awaiter(this, void 0, void 0, function () {
937
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
842
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
938
843
  return __generator(this, function (_c) {
939
844
  switch (_c.label) {
940
845
  case 0:
@@ -980,41 +885,18 @@ var Customer = /** @class */ (function () {
980
885
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
981
886
  }
982
887
  break;
983
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
984
- if (utils.matchContentType(contentType, "application/json")) {
985
- res.fourHundredError = JSON.parse(decodedRes);
986
- }
987
- else {
988
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
989
- }
990
- break;
888
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
889
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
890
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
891
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
892
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
893
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
894
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
991
895
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
992
896
  if (utils.matchContentType(contentType, "application/json")) {
993
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
994
- }
995
- else {
996
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
997
- }
998
- break;
999
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1000
- if (utils.matchContentType(contentType, "application/json")) {
1001
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1002
- }
1003
- else {
1004
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1005
- }
1006
- break;
1007
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1008
- if (utils.matchContentType(contentType, "application/json")) {
1009
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1010
- }
1011
- else {
1012
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1013
- }
1014
- break;
1015
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1016
- if (utils.matchContentType(contentType, "application/json")) {
1017
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
897
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
898
+ err.rawResponse = httpRes;
899
+ throw new errors.FourHundredAndOneError(err);
1018
900
  }
1019
901
  else {
1020
902
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1022,7 +904,9 @@ var Customer = /** @class */ (function () {
1022
904
  break;
1023
905
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1024
906
  if (utils.matchContentType(contentType, "application/json")) {
1025
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
907
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
908
+ err.rawResponse = httpRes;
909
+ throw new errors.FourHundredAndTwentyNineError(err);
1026
910
  }
1027
911
  else {
1028
912
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1030,7 +914,9 @@ var Customer = /** @class */ (function () {
1030
914
  break;
1031
915
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1032
916
  if (utils.matchContentType(contentType, "application/json")) {
1033
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
917
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
918
+ err.rawResponse = httpRes;
919
+ throw new errors.FiveHundredError(err);
1034
920
  }
1035
921
  else {
1036
922
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1054,7 +940,7 @@ var Customer = /** @class */ (function () {
1054
940
  Customer.prototype.fetchByExternalId = function (externalCustomerId, config) {
1055
941
  var _a, _b;
1056
942
  return __awaiter(this, void 0, void 0, function () {
1057
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
943
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1058
944
  return __generator(this, function (_c) {
1059
945
  switch (_c.label) {
1060
946
  case 0:
@@ -1100,41 +986,18 @@ var Customer = /** @class */ (function () {
1100
986
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1101
987
  }
1102
988
  break;
1103
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1104
- if (utils.matchContentType(contentType, "application/json")) {
1105
- res.fourHundredError = JSON.parse(decodedRes);
1106
- }
1107
- else {
1108
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1109
- }
1110
- break;
989
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
990
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
991
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
992
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
993
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
994
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
995
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1111
996
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1112
997
  if (utils.matchContentType(contentType, "application/json")) {
1113
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1114
- }
1115
- else {
1116
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1117
- }
1118
- break;
1119
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1120
- if (utils.matchContentType(contentType, "application/json")) {
1121
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1122
- }
1123
- else {
1124
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1125
- }
1126
- break;
1127
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1128
- if (utils.matchContentType(contentType, "application/json")) {
1129
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1130
- }
1131
- else {
1132
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1133
- }
1134
- break;
1135
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1136
- if (utils.matchContentType(contentType, "application/json")) {
1137
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
998
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
999
+ err.rawResponse = httpRes;
1000
+ throw new errors.FourHundredAndOneError(err);
1138
1001
  }
1139
1002
  else {
1140
1003
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1142,7 +1005,9 @@ var Customer = /** @class */ (function () {
1142
1005
  break;
1143
1006
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1144
1007
  if (utils.matchContentType(contentType, "application/json")) {
1145
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1008
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1009
+ err.rawResponse = httpRes;
1010
+ throw new errors.FourHundredAndTwentyNineError(err);
1146
1011
  }
1147
1012
  else {
1148
1013
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1150,7 +1015,9 @@ var Customer = /** @class */ (function () {
1150
1015
  break;
1151
1016
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1152
1017
  if (utils.matchContentType(contentType, "application/json")) {
1153
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1018
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1019
+ err.rawResponse = httpRes;
1020
+ throw new errors.FiveHundredError(err);
1154
1021
  }
1155
1022
  else {
1156
1023
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1273,7 +1140,7 @@ var Customer = /** @class */ (function () {
1273
1140
  Customer.prototype.fetchCosts = function (req, config) {
1274
1141
  var _a, _b;
1275
1142
  return __awaiter(this, void 0, void 0, function () {
1276
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1143
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1277
1144
  return __generator(this, function (_c) {
1278
1145
  switch (_c.label) {
1279
1146
  case 0:
@@ -1320,41 +1187,18 @@ var Customer = /** @class */ (function () {
1320
1187
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1321
1188
  }
1322
1189
  break;
1323
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1324
- if (utils.matchContentType(contentType, "application/json")) {
1325
- res.fourHundredError = JSON.parse(decodedRes);
1326
- }
1327
- else {
1328
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1329
- }
1330
- break;
1190
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1191
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1192
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1193
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1194
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1195
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1196
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1331
1197
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1332
1198
  if (utils.matchContentType(contentType, "application/json")) {
1333
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1334
- }
1335
- else {
1336
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1337
- }
1338
- break;
1339
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1340
- if (utils.matchContentType(contentType, "application/json")) {
1341
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1342
- }
1343
- else {
1344
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1345
- }
1346
- break;
1347
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1348
- if (utils.matchContentType(contentType, "application/json")) {
1349
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1350
- }
1351
- else {
1352
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1353
- }
1354
- break;
1355
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1356
- if (utils.matchContentType(contentType, "application/json")) {
1357
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1199
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1200
+ err.rawResponse = httpRes;
1201
+ throw new errors.FourHundredAndOneError(err);
1358
1202
  }
1359
1203
  else {
1360
1204
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1362,7 +1206,9 @@ var Customer = /** @class */ (function () {
1362
1206
  break;
1363
1207
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1364
1208
  if (utils.matchContentType(contentType, "application/json")) {
1365
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1209
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1210
+ err.rawResponse = httpRes;
1211
+ throw new errors.FourHundredAndTwentyNineError(err);
1366
1212
  }
1367
1213
  else {
1368
1214
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1370,7 +1216,9 @@ var Customer = /** @class */ (function () {
1370
1216
  break;
1371
1217
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1372
1218
  if (utils.matchContentType(contentType, "application/json")) {
1373
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1219
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1220
+ err.rawResponse = httpRes;
1221
+ throw new errors.FiveHundredError(err);
1374
1222
  }
1375
1223
  else {
1376
1224
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1493,7 +1341,7 @@ var Customer = /** @class */ (function () {
1493
1341
  Customer.prototype.fetchCostsByExternalId = function (req, config) {
1494
1342
  var _a, _b;
1495
1343
  return __awaiter(this, void 0, void 0, function () {
1496
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1344
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1497
1345
  return __generator(this, function (_c) {
1498
1346
  switch (_c.label) {
1499
1347
  case 0:
@@ -1540,41 +1388,18 @@ var Customer = /** @class */ (function () {
1540
1388
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1541
1389
  }
1542
1390
  break;
1543
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1544
- if (utils.matchContentType(contentType, "application/json")) {
1545
- res.fourHundredError = JSON.parse(decodedRes);
1546
- }
1547
- else {
1548
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1549
- }
1550
- break;
1391
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1392
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1393
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1394
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1395
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1396
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1397
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1551
1398
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1552
1399
  if (utils.matchContentType(contentType, "application/json")) {
1553
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1554
- }
1555
- else {
1556
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1557
- }
1558
- break;
1559
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1560
- if (utils.matchContentType(contentType, "application/json")) {
1561
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1562
- }
1563
- else {
1564
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1565
- }
1566
- break;
1567
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1568
- if (utils.matchContentType(contentType, "application/json")) {
1569
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1570
- }
1571
- else {
1572
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1573
- }
1574
- break;
1575
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1576
- if (utils.matchContentType(contentType, "application/json")) {
1577
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1400
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1401
+ err.rawResponse = httpRes;
1402
+ throw new errors.FourHundredAndOneError(err);
1578
1403
  }
1579
1404
  else {
1580
1405
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1582,7 +1407,9 @@ var Customer = /** @class */ (function () {
1582
1407
  break;
1583
1408
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1584
1409
  if (utils.matchContentType(contentType, "application/json")) {
1585
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1410
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1411
+ err.rawResponse = httpRes;
1412
+ throw new errors.FourHundredAndTwentyNineError(err);
1586
1413
  }
1587
1414
  else {
1588
1415
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1590,7 +1417,9 @@ var Customer = /** @class */ (function () {
1590
1417
  break;
1591
1418
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1592
1419
  if (utils.matchContentType(contentType, "application/json")) {
1593
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1420
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1421
+ err.rawResponse = httpRes;
1422
+ throw new errors.FiveHundredError(err);
1594
1423
  }
1595
1424
  else {
1596
1425
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1615,7 +1444,7 @@ var Customer = /** @class */ (function () {
1615
1444
  Customer.prototype.list = function (req, config) {
1616
1445
  var _a, _b;
1617
1446
  return __awaiter(this, void 0, void 0, function () {
1618
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1447
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1619
1448
  return __generator(this, function (_c) {
1620
1449
  switch (_c.label) {
1621
1450
  case 0:
@@ -1662,41 +1491,18 @@ var Customer = /** @class */ (function () {
1662
1491
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1663
1492
  }
1664
1493
  break;
1665
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1666
- if (utils.matchContentType(contentType, "application/json")) {
1667
- res.fourHundredError = JSON.parse(decodedRes);
1668
- }
1669
- else {
1670
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1671
- }
1672
- break;
1494
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1495
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1496
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1497
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1498
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1499
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1500
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1673
1501
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1674
1502
  if (utils.matchContentType(contentType, "application/json")) {
1675
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1676
- }
1677
- else {
1678
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1679
- }
1680
- break;
1681
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1682
- if (utils.matchContentType(contentType, "application/json")) {
1683
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1684
- }
1685
- else {
1686
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1687
- }
1688
- break;
1689
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1690
- if (utils.matchContentType(contentType, "application/json")) {
1691
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1692
- }
1693
- else {
1694
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1695
- }
1696
- break;
1697
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1698
- if (utils.matchContentType(contentType, "application/json")) {
1699
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1503
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1504
+ err.rawResponse = httpRes;
1505
+ throw new errors.FourHundredAndOneError(err);
1700
1506
  }
1701
1507
  else {
1702
1508
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1704,7 +1510,9 @@ var Customer = /** @class */ (function () {
1704
1510
  break;
1705
1511
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1706
1512
  if (utils.matchContentType(contentType, "application/json")) {
1707
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1513
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1514
+ err.rawResponse = httpRes;
1515
+ throw new errors.FourHundredAndTwentyNineError(err);
1708
1516
  }
1709
1517
  else {
1710
1518
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1712,7 +1520,9 @@ var Customer = /** @class */ (function () {
1712
1520
  break;
1713
1521
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1714
1522
  if (utils.matchContentType(contentType, "application/json")) {
1715
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1523
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1524
+ err.rawResponse = httpRes;
1525
+ throw new errors.FiveHundredError(err);
1716
1526
  }
1717
1527
  else {
1718
1528
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1754,7 +1564,7 @@ var Customer = /** @class */ (function () {
1754
1564
  Customer.prototype.listBalanceTransactions = function (req, config) {
1755
1565
  var _a, _b;
1756
1566
  return __awaiter(this, void 0, void 0, function () {
1757
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1567
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1758
1568
  return __generator(this, function (_c) {
1759
1569
  switch (_c.label) {
1760
1570
  case 0:
@@ -1801,41 +1611,18 @@ var Customer = /** @class */ (function () {
1801
1611
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1802
1612
  }
1803
1613
  break;
1804
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1805
- if (utils.matchContentType(contentType, "application/json")) {
1806
- res.fourHundredError = JSON.parse(decodedRes);
1807
- }
1808
- else {
1809
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1810
- }
1811
- break;
1614
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1615
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1616
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1617
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1618
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1619
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1620
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1812
1621
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1813
1622
  if (utils.matchContentType(contentType, "application/json")) {
1814
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1815
- }
1816
- else {
1817
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1818
- }
1819
- break;
1820
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1821
- if (utils.matchContentType(contentType, "application/json")) {
1822
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1823
- }
1824
- else {
1825
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1826
- }
1827
- break;
1828
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1829
- if (utils.matchContentType(contentType, "application/json")) {
1830
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1831
- }
1832
- else {
1833
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1834
- }
1835
- break;
1836
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1837
- if (utils.matchContentType(contentType, "application/json")) {
1838
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1623
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1624
+ err.rawResponse = httpRes;
1625
+ throw new errors.FourHundredAndOneError(err);
1839
1626
  }
1840
1627
  else {
1841
1628
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1843,7 +1630,9 @@ var Customer = /** @class */ (function () {
1843
1630
  break;
1844
1631
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1845
1632
  if (utils.matchContentType(contentType, "application/json")) {
1846
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1633
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1634
+ err.rawResponse = httpRes;
1635
+ throw new errors.FourHundredAndTwentyNineError(err);
1847
1636
  }
1848
1637
  else {
1849
1638
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1851,7 +1640,9 @@ var Customer = /** @class */ (function () {
1851
1640
  break;
1852
1641
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1853
1642
  if (utils.matchContentType(contentType, "application/json")) {
1854
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1643
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1644
+ err.rawResponse = httpRes;
1645
+ throw new errors.FiveHundredError(err);
1855
1646
  }
1856
1647
  else {
1857
1648
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1875,7 +1666,7 @@ var Customer = /** @class */ (function () {
1875
1666
  Customer.prototype.updateByExternalId = function (externalCustomerId, editCustomer, config) {
1876
1667
  var _a, _b;
1877
1668
  return __awaiter(this, void 0, void 0, function () {
1878
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1669
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1879
1670
  var _d;
1880
1671
  return __generator(this, function (_e) {
1881
1672
  switch (_e.label) {
@@ -1932,41 +1723,18 @@ var Customer = /** @class */ (function () {
1932
1723
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1933
1724
  }
1934
1725
  break;
1935
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1936
- if (utils.matchContentType(contentType, "application/json")) {
1937
- res.fourHundredError = JSON.parse(decodedRes);
1938
- }
1939
- else {
1940
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1941
- }
1942
- break;
1726
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1727
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1728
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1729
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1730
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1731
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1732
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1943
1733
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1944
1734
  if (utils.matchContentType(contentType, "application/json")) {
1945
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1946
- }
1947
- else {
1948
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1949
- }
1950
- break;
1951
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1952
- if (utils.matchContentType(contentType, "application/json")) {
1953
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1954
- }
1955
- else {
1956
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1957
- }
1958
- break;
1959
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1960
- if (utils.matchContentType(contentType, "application/json")) {
1961
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1962
- }
1963
- else {
1964
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1965
- }
1966
- break;
1967
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1968
- if (utils.matchContentType(contentType, "application/json")) {
1969
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1735
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1736
+ err.rawResponse = httpRes;
1737
+ throw new errors.FourHundredAndOneError(err);
1970
1738
  }
1971
1739
  else {
1972
1740
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1974,7 +1742,9 @@ var Customer = /** @class */ (function () {
1974
1742
  break;
1975
1743
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1976
1744
  if (utils.matchContentType(contentType, "application/json")) {
1977
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1745
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1746
+ err.rawResponse = httpRes;
1747
+ throw new errors.FourHundredAndTwentyNineError(err);
1978
1748
  }
1979
1749
  else {
1980
1750
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1982,7 +1752,9 @@ var Customer = /** @class */ (function () {
1982
1752
  break;
1983
1753
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1984
1754
  if (utils.matchContentType(contentType, "application/json")) {
1985
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1755
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1756
+ err.rawResponse = httpRes;
1757
+ throw new errors.FiveHundredError(err);
1986
1758
  }
1987
1759
  else {
1988
1760
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2005,7 +1777,7 @@ var Customer = /** @class */ (function () {
2005
1777
  Customer.prototype.updateCustomer = function (customerId, editCustomer, config) {
2006
1778
  var _a, _b;
2007
1779
  return __awaiter(this, void 0, void 0, function () {
2008
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1780
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
2009
1781
  var _d;
2010
1782
  return __generator(this, function (_e) {
2011
1783
  switch (_e.label) {
@@ -2062,41 +1834,18 @@ var Customer = /** @class */ (function () {
2062
1834
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2063
1835
  }
2064
1836
  break;
2065
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
2066
- if (utils.matchContentType(contentType, "application/json")) {
2067
- res.fourHundredError = JSON.parse(decodedRes);
2068
- }
2069
- else {
2070
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2071
- }
2072
- break;
1837
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1838
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1839
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1840
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1841
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1842
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1843
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2073
1844
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
2074
1845
  if (utils.matchContentType(contentType, "application/json")) {
2075
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
2076
- }
2077
- else {
2078
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2079
- }
2080
- break;
2081
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
2082
- if (utils.matchContentType(contentType, "application/json")) {
2083
- res.fourHundredAndFourError = JSON.parse(decodedRes);
2084
- }
2085
- else {
2086
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2087
- }
2088
- break;
2089
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
2090
- if (utils.matchContentType(contentType, "application/json")) {
2091
- res.fourHundredAndNineError = JSON.parse(decodedRes);
2092
- }
2093
- else {
2094
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2095
- }
2096
- break;
2097
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
2098
- if (utils.matchContentType(contentType, "application/json")) {
2099
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1846
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1847
+ err.rawResponse = httpRes;
1848
+ throw new errors.FourHundredAndOneError(err);
2100
1849
  }
2101
1850
  else {
2102
1851
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2104,7 +1853,9 @@ var Customer = /** @class */ (function () {
2104
1853
  break;
2105
1854
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
2106
1855
  if (utils.matchContentType(contentType, "application/json")) {
2107
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1856
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1857
+ err.rawResponse = httpRes;
1858
+ throw new errors.FourHundredAndTwentyNineError(err);
2108
1859
  }
2109
1860
  else {
2110
1861
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2112,7 +1863,9 @@ var Customer = /** @class */ (function () {
2112
1863
  break;
2113
1864
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
2114
1865
  if (utils.matchContentType(contentType, "application/json")) {
2115
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1866
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1867
+ err.rawResponse = httpRes;
1868
+ throw new errors.FiveHundredError(err);
2116
1869
  }
2117
1870
  else {
2118
1871
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);