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
@@ -166,7 +166,7 @@ var Subscription = /** @class */ (function () {
166
166
  Subscription.prototype.cancel = function (subscriptionId, cancelSubscriptionParams, config) {
167
167
  var _a, _b;
168
168
  return __awaiter(this, void 0, void 0, function () {
169
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
169
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
170
170
  var _d;
171
171
  return __generator(this, function (_e) {
172
172
  switch (_e.label) {
@@ -223,41 +223,18 @@ var Subscription = /** @class */ (function () {
223
223
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
224
224
  }
225
225
  break;
226
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
227
- if (utils.matchContentType(contentType, "application/json")) {
228
- res.fourHundredError = JSON.parse(decodedRes);
229
- }
230
- else {
231
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
232
- }
233
- break;
226
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
227
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
228
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
229
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
230
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
231
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
232
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
234
233
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
235
234
  if (utils.matchContentType(contentType, "application/json")) {
236
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
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) == 404:
243
- if (utils.matchContentType(contentType, "application/json")) {
244
- res.fourHundredAndFourError = 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) == 409:
251
- if (utils.matchContentType(contentType, "application/json")) {
252
- res.fourHundredAndNineError = JSON.parse(decodedRes);
253
- }
254
- else {
255
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
256
- }
257
- break;
258
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
259
- if (utils.matchContentType(contentType, "application/json")) {
260
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
235
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
236
+ err.rawResponse = httpRes;
237
+ throw new errors.FourHundredAndOneError(err);
261
238
  }
262
239
  else {
263
240
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -265,7 +242,9 @@ var Subscription = /** @class */ (function () {
265
242
  break;
266
243
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
267
244
  if (utils.matchContentType(contentType, "application/json")) {
268
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
245
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
246
+ err.rawResponse = httpRes;
247
+ throw new errors.FourHundredAndTwentyNineError(err);
269
248
  }
270
249
  else {
271
250
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -273,7 +252,9 @@ var Subscription = /** @class */ (function () {
273
252
  break;
274
253
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
275
254
  if (utils.matchContentType(contentType, "application/json")) {
276
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
255
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
256
+ err.rawResponse = httpRes;
257
+ throw new errors.FiveHundredError(err);
277
258
  }
278
259
  else {
279
260
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -695,7 +676,7 @@ var Subscription = /** @class */ (function () {
695
676
  Subscription.prototype.create = function (req, config) {
696
677
  var _a, _b;
697
678
  return __awaiter(this, void 0, void 0, function () {
698
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
679
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
699
680
  var _d;
700
681
  return __generator(this, function (_e) {
701
682
  switch (_e.label) {
@@ -751,41 +732,18 @@ var Subscription = /** @class */ (function () {
751
732
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
752
733
  }
753
734
  break;
754
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
755
- if (utils.matchContentType(contentType, "application/json")) {
756
- res.fourHundredError = JSON.parse(decodedRes);
757
- }
758
- else {
759
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
760
- }
761
- break;
735
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
736
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
737
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
738
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
739
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
740
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
741
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
762
742
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
763
743
  if (utils.matchContentType(contentType, "application/json")) {
764
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
765
- }
766
- else {
767
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
768
- }
769
- break;
770
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
771
- if (utils.matchContentType(contentType, "application/json")) {
772
- res.fourHundredAndFourError = JSON.parse(decodedRes);
773
- }
774
- else {
775
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
776
- }
777
- break;
778
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
779
- if (utils.matchContentType(contentType, "application/json")) {
780
- res.fourHundredAndNineError = JSON.parse(decodedRes);
781
- }
782
- else {
783
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
784
- }
785
- break;
786
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
787
- if (utils.matchContentType(contentType, "application/json")) {
788
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
744
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
745
+ err.rawResponse = httpRes;
746
+ throw new errors.FourHundredAndOneError(err);
789
747
  }
790
748
  else {
791
749
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -793,7 +751,9 @@ var Subscription = /** @class */ (function () {
793
751
  break;
794
752
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
795
753
  if (utils.matchContentType(contentType, "application/json")) {
796
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
754
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
755
+ err.rawResponse = httpRes;
756
+ throw new errors.FourHundredAndTwentyNineError(err);
797
757
  }
798
758
  else {
799
759
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -801,7 +761,9 @@ var Subscription = /** @class */ (function () {
801
761
  break;
802
762
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
803
763
  if (utils.matchContentType(contentType, "application/json")) {
804
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
764
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
765
+ err.rawResponse = httpRes;
766
+ throw new errors.FiveHundredError(err);
805
767
  }
806
768
  else {
807
769
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -822,7 +784,7 @@ var Subscription = /** @class */ (function () {
822
784
  Subscription.prototype.fetch = function (subscriptionId, config) {
823
785
  var _a, _b;
824
786
  return __awaiter(this, void 0, void 0, function () {
825
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
787
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
826
788
  return __generator(this, function (_c) {
827
789
  switch (_c.label) {
828
790
  case 0:
@@ -868,41 +830,18 @@ var Subscription = /** @class */ (function () {
868
830
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
869
831
  }
870
832
  break;
871
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
872
- if (utils.matchContentType(contentType, "application/json")) {
873
- res.fourHundredError = JSON.parse(decodedRes);
874
- }
875
- else {
876
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
877
- }
878
- break;
833
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
834
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
835
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
836
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
837
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
838
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
839
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
879
840
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
880
841
  if (utils.matchContentType(contentType, "application/json")) {
881
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
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) == 404:
888
- if (utils.matchContentType(contentType, "application/json")) {
889
- res.fourHundredAndFourError = 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) == 409:
896
- if (utils.matchContentType(contentType, "application/json")) {
897
- res.fourHundredAndNineError = JSON.parse(decodedRes);
898
- }
899
- else {
900
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
901
- }
902
- break;
903
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
904
- if (utils.matchContentType(contentType, "application/json")) {
905
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
842
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
843
+ err.rawResponse = httpRes;
844
+ throw new errors.FourHundredAndOneError(err);
906
845
  }
907
846
  else {
908
847
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -910,7 +849,9 @@ var Subscription = /** @class */ (function () {
910
849
  break;
911
850
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
912
851
  if (utils.matchContentType(contentType, "application/json")) {
913
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
852
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
853
+ err.rawResponse = httpRes;
854
+ throw new errors.FourHundredAndTwentyNineError(err);
914
855
  }
915
856
  else {
916
857
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -918,7 +859,9 @@ var Subscription = /** @class */ (function () {
918
859
  break;
919
860
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
920
861
  if (utils.matchContentType(contentType, "application/json")) {
921
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
862
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
863
+ err.rawResponse = httpRes;
864
+ throw new errors.FiveHundredError(err);
922
865
  }
923
866
  else {
924
867
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -945,7 +888,7 @@ var Subscription = /** @class */ (function () {
945
888
  Subscription.prototype.fetchCosts = function (req, config) {
946
889
  var _a, _b;
947
890
  return __awaiter(this, void 0, void 0, function () {
948
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
891
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
949
892
  return __generator(this, function (_c) {
950
893
  switch (_c.label) {
951
894
  case 0:
@@ -992,41 +935,18 @@ var Subscription = /** @class */ (function () {
992
935
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
993
936
  }
994
937
  break;
995
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
996
- if (utils.matchContentType(contentType, "application/json")) {
997
- res.fourHundredError = JSON.parse(decodedRes);
998
- }
999
- else {
1000
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1001
- }
1002
- break;
938
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
939
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
940
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
941
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
942
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
943
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
944
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1003
945
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1004
946
  if (utils.matchContentType(contentType, "application/json")) {
1005
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1006
- }
1007
- else {
1008
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1009
- }
1010
- break;
1011
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1012
- if (utils.matchContentType(contentType, "application/json")) {
1013
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1014
- }
1015
- else {
1016
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1017
- }
1018
- break;
1019
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1020
- if (utils.matchContentType(contentType, "application/json")) {
1021
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1022
- }
1023
- else {
1024
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1025
- }
1026
- break;
1027
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1028
- if (utils.matchContentType(contentType, "application/json")) {
1029
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
947
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
948
+ err.rawResponse = httpRes;
949
+ throw new errors.FourHundredAndOneError(err);
1030
950
  }
1031
951
  else {
1032
952
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1034,7 +954,9 @@ var Subscription = /** @class */ (function () {
1034
954
  break;
1035
955
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1036
956
  if (utils.matchContentType(contentType, "application/json")) {
1037
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
957
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
958
+ err.rawResponse = httpRes;
959
+ throw new errors.FourHundredAndTwentyNineError(err);
1038
960
  }
1039
961
  else {
1040
962
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1042,7 +964,9 @@ var Subscription = /** @class */ (function () {
1042
964
  break;
1043
965
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1044
966
  if (utils.matchContentType(contentType, "application/json")) {
1045
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
967
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
968
+ err.rawResponse = httpRes;
969
+ throw new errors.FiveHundredError(err);
1046
970
  }
1047
971
  else {
1048
972
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1065,7 +989,7 @@ var Subscription = /** @class */ (function () {
1065
989
  Subscription.prototype.fetchSchedule = function (req, config) {
1066
990
  var _a, _b;
1067
991
  return __awaiter(this, void 0, void 0, function () {
1068
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
992
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1069
993
  return __generator(this, function (_c) {
1070
994
  switch (_c.label) {
1071
995
  case 0:
@@ -1112,41 +1036,18 @@ var Subscription = /** @class */ (function () {
1112
1036
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1113
1037
  }
1114
1038
  break;
1115
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1116
- if (utils.matchContentType(contentType, "application/json")) {
1117
- res.fourHundredError = JSON.parse(decodedRes);
1118
- }
1119
- else {
1120
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1121
- }
1122
- break;
1039
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1040
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1041
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1042
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1043
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1044
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1045
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1123
1046
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1124
1047
  if (utils.matchContentType(contentType, "application/json")) {
1125
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1126
- }
1127
- else {
1128
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1129
- }
1130
- break;
1131
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1132
- if (utils.matchContentType(contentType, "application/json")) {
1133
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1134
- }
1135
- else {
1136
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1137
- }
1138
- break;
1139
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1140
- if (utils.matchContentType(contentType, "application/json")) {
1141
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1142
- }
1143
- else {
1144
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1145
- }
1146
- break;
1147
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1148
- if (utils.matchContentType(contentType, "application/json")) {
1149
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1048
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1049
+ err.rawResponse = httpRes;
1050
+ throw new errors.FourHundredAndOneError(err);
1150
1051
  }
1151
1052
  else {
1152
1053
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1154,7 +1055,9 @@ var Subscription = /** @class */ (function () {
1154
1055
  break;
1155
1056
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1156
1057
  if (utils.matchContentType(contentType, "application/json")) {
1157
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1058
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1059
+ err.rawResponse = httpRes;
1060
+ throw new errors.FourHundredAndTwentyNineError(err);
1158
1061
  }
1159
1062
  else {
1160
1063
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1162,7 +1065,9 @@ var Subscription = /** @class */ (function () {
1162
1065
  break;
1163
1066
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1164
1067
  if (utils.matchContentType(contentType, "application/json")) {
1165
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1068
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1069
+ err.rawResponse = httpRes;
1070
+ throw new errors.FiveHundredError(err);
1166
1071
  }
1167
1072
  else {
1168
1073
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1338,7 +1243,7 @@ var Subscription = /** @class */ (function () {
1338
1243
  Subscription.prototype.fetchUsage = function (req, config) {
1339
1244
  var _a, _b;
1340
1245
  return __awaiter(this, void 0, void 0, function () {
1341
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1246
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1342
1247
  return __generator(this, function (_c) {
1343
1248
  switch (_c.label) {
1344
1249
  case 0:
@@ -1385,41 +1290,18 @@ var Subscription = /** @class */ (function () {
1385
1290
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1386
1291
  }
1387
1292
  break;
1388
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1389
- if (utils.matchContentType(contentType, "application/json")) {
1390
- res.fourHundredError = JSON.parse(decodedRes);
1391
- }
1392
- else {
1393
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1394
- }
1395
- break;
1293
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1294
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1295
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1296
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1297
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1298
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1299
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1396
1300
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1397
1301
  if (utils.matchContentType(contentType, "application/json")) {
1398
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1399
- }
1400
- else {
1401
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1402
- }
1403
- break;
1404
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1405
- if (utils.matchContentType(contentType, "application/json")) {
1406
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1407
- }
1408
- else {
1409
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1410
- }
1411
- break;
1412
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1413
- if (utils.matchContentType(contentType, "application/json")) {
1414
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1415
- }
1416
- else {
1417
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1418
- }
1419
- break;
1420
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1421
- if (utils.matchContentType(contentType, "application/json")) {
1422
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1302
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1303
+ err.rawResponse = httpRes;
1304
+ throw new errors.FourHundredAndOneError(err);
1423
1305
  }
1424
1306
  else {
1425
1307
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1427,7 +1309,9 @@ var Subscription = /** @class */ (function () {
1427
1309
  break;
1428
1310
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1429
1311
  if (utils.matchContentType(contentType, "application/json")) {
1430
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1312
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1313
+ err.rawResponse = httpRes;
1314
+ throw new errors.FourHundredAndTwentyNineError(err);
1431
1315
  }
1432
1316
  else {
1433
1317
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1435,7 +1319,9 @@ var Subscription = /** @class */ (function () {
1435
1319
  break;
1436
1320
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1437
1321
  if (utils.matchContentType(contentType, "application/json")) {
1438
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1322
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1323
+ err.rawResponse = httpRes;
1324
+ throw new errors.FiveHundredError(err);
1439
1325
  }
1440
1326
  else {
1441
1327
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1461,7 +1347,7 @@ var Subscription = /** @class */ (function () {
1461
1347
  Subscription.prototype.list = function (req, config) {
1462
1348
  var _a, _b;
1463
1349
  return __awaiter(this, void 0, void 0, function () {
1464
- var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1350
+ var baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1465
1351
  return __generator(this, function (_c) {
1466
1352
  switch (_c.label) {
1467
1353
  case 0:
@@ -1508,41 +1394,18 @@ var Subscription = /** @class */ (function () {
1508
1394
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1509
1395
  }
1510
1396
  break;
1511
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1512
- if (utils.matchContentType(contentType, "application/json")) {
1513
- res.fourHundredError = JSON.parse(decodedRes);
1514
- }
1515
- else {
1516
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1517
- }
1518
- break;
1397
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1398
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1399
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1400
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1401
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1402
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1403
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1519
1404
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1520
1405
  if (utils.matchContentType(contentType, "application/json")) {
1521
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1522
- }
1523
- else {
1524
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1525
- }
1526
- break;
1527
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1528
- if (utils.matchContentType(contentType, "application/json")) {
1529
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1530
- }
1531
- else {
1532
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1533
- }
1534
- break;
1535
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1536
- if (utils.matchContentType(contentType, "application/json")) {
1537
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1538
- }
1539
- else {
1540
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1541
- }
1542
- break;
1543
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1544
- if (utils.matchContentType(contentType, "application/json")) {
1545
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1406
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1407
+ err.rawResponse = httpRes;
1408
+ throw new errors.FourHundredAndOneError(err);
1546
1409
  }
1547
1410
  else {
1548
1411
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1550,7 +1413,9 @@ var Subscription = /** @class */ (function () {
1550
1413
  break;
1551
1414
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1552
1415
  if (utils.matchContentType(contentType, "application/json")) {
1553
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1416
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1417
+ err.rawResponse = httpRes;
1418
+ throw new errors.FourHundredAndTwentyNineError(err);
1554
1419
  }
1555
1420
  else {
1556
1421
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1558,7 +1423,9 @@ var Subscription = /** @class */ (function () {
1558
1423
  break;
1559
1424
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1560
1425
  if (utils.matchContentType(contentType, "application/json")) {
1561
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1426
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1427
+ err.rawResponse = httpRes;
1428
+ throw new errors.FiveHundredError(err);
1562
1429
  }
1563
1430
  else {
1564
1431
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1606,7 +1473,7 @@ var Subscription = /** @class */ (function () {
1606
1473
  Subscription.prototype.schedulePlanChange = function (subscriptionId, subscriptionPlanChange, config) {
1607
1474
  var _a, _b;
1608
1475
  return __awaiter(this, void 0, void 0, function () {
1609
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1476
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1610
1477
  var _d;
1611
1478
  return __generator(this, function (_e) {
1612
1479
  switch (_e.label) {
@@ -1663,41 +1530,18 @@ var Subscription = /** @class */ (function () {
1663
1530
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1664
1531
  }
1665
1532
  break;
1666
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1667
- if (utils.matchContentType(contentType, "application/json")) {
1668
- res.fourHundredError = JSON.parse(decodedRes);
1669
- }
1670
- else {
1671
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1672
- }
1673
- break;
1533
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1534
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1535
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1536
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1537
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1538
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1539
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1674
1540
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1675
1541
  if (utils.matchContentType(contentType, "application/json")) {
1676
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1677
- }
1678
- else {
1679
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1680
- }
1681
- break;
1682
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1683
- if (utils.matchContentType(contentType, "application/json")) {
1684
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1685
- }
1686
- else {
1687
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1688
- }
1689
- break;
1690
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1691
- if (utils.matchContentType(contentType, "application/json")) {
1692
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1693
- }
1694
- else {
1695
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1696
- }
1697
- break;
1698
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1699
- if (utils.matchContentType(contentType, "application/json")) {
1700
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1542
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1543
+ err.rawResponse = httpRes;
1544
+ throw new errors.FourHundredAndOneError(err);
1701
1545
  }
1702
1546
  else {
1703
1547
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1705,7 +1549,9 @@ var Subscription = /** @class */ (function () {
1705
1549
  break;
1706
1550
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1707
1551
  if (utils.matchContentType(contentType, "application/json")) {
1708
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1552
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1553
+ err.rawResponse = httpRes;
1554
+ throw new errors.FourHundredAndTwentyNineError(err);
1709
1555
  }
1710
1556
  else {
1711
1557
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1713,7 +1559,9 @@ var Subscription = /** @class */ (function () {
1713
1559
  break;
1714
1560
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1715
1561
  if (utils.matchContentType(contentType, "application/json")) {
1716
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1562
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1563
+ err.rawResponse = httpRes;
1564
+ throw new errors.FiveHundredError(err);
1717
1565
  }
1718
1566
  else {
1719
1567
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1734,7 +1582,7 @@ var Subscription = /** @class */ (function () {
1734
1582
  Subscription.prototype.triggerPhase = function (subscriptionId, triggerSubscriptionPhaseParams, config) {
1735
1583
  var _a, _b;
1736
1584
  return __awaiter(this, void 0, void 0, function () {
1737
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1585
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1738
1586
  var _d;
1739
1587
  return __generator(this, function (_e) {
1740
1588
  switch (_e.label) {
@@ -1791,41 +1639,18 @@ var Subscription = /** @class */ (function () {
1791
1639
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1792
1640
  }
1793
1641
  break;
1794
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1795
- if (utils.matchContentType(contentType, "application/json")) {
1796
- res.fourHundredError = JSON.parse(decodedRes);
1797
- }
1798
- else {
1799
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1800
- }
1801
- break;
1642
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1643
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1644
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1645
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1646
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1647
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1648
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1802
1649
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1803
1650
  if (utils.matchContentType(contentType, "application/json")) {
1804
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1805
- }
1806
- else {
1807
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1808
- }
1809
- break;
1810
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1811
- if (utils.matchContentType(contentType, "application/json")) {
1812
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1813
- }
1814
- else {
1815
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1816
- }
1817
- break;
1818
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1819
- if (utils.matchContentType(contentType, "application/json")) {
1820
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1821
- }
1822
- else {
1823
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1824
- }
1825
- break;
1826
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1827
- if (utils.matchContentType(contentType, "application/json")) {
1828
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1651
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1652
+ err.rawResponse = httpRes;
1653
+ throw new errors.FourHundredAndOneError(err);
1829
1654
  }
1830
1655
  else {
1831
1656
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1833,7 +1658,9 @@ var Subscription = /** @class */ (function () {
1833
1658
  break;
1834
1659
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1835
1660
  if (utils.matchContentType(contentType, "application/json")) {
1836
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1661
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1662
+ err.rawResponse = httpRes;
1663
+ throw new errors.FourHundredAndTwentyNineError(err);
1837
1664
  }
1838
1665
  else {
1839
1666
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1841,7 +1668,9 @@ var Subscription = /** @class */ (function () {
1841
1668
  break;
1842
1669
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1843
1670
  if (utils.matchContentType(contentType, "application/json")) {
1844
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1671
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1672
+ err.rawResponse = httpRes;
1673
+ throw new errors.FiveHundredError(err);
1845
1674
  }
1846
1675
  else {
1847
1676
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1865,7 +1694,7 @@ var Subscription = /** @class */ (function () {
1865
1694
  Subscription.prototype.unscheduleCancellation = function (subscriptionId, config) {
1866
1695
  var _a, _b;
1867
1696
  return __awaiter(this, void 0, void 0, function () {
1868
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1697
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1869
1698
  return __generator(this, function (_c) {
1870
1699
  switch (_c.label) {
1871
1700
  case 0:
@@ -1911,41 +1740,18 @@ var Subscription = /** @class */ (function () {
1911
1740
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1912
1741
  }
1913
1742
  break;
1914
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1915
- if (utils.matchContentType(contentType, "application/json")) {
1916
- res.fourHundredError = JSON.parse(decodedRes);
1917
- }
1918
- else {
1919
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1920
- }
1921
- break;
1743
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1744
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1745
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1746
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1747
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1748
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1749
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1922
1750
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1923
1751
  if (utils.matchContentType(contentType, "application/json")) {
1924
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1925
- }
1926
- else {
1927
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1928
- }
1929
- break;
1930
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1931
- if (utils.matchContentType(contentType, "application/json")) {
1932
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1933
- }
1934
- else {
1935
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1936
- }
1937
- break;
1938
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1939
- if (utils.matchContentType(contentType, "application/json")) {
1940
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1941
- }
1942
- else {
1943
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1944
- }
1945
- break;
1946
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1947
- if (utils.matchContentType(contentType, "application/json")) {
1948
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1752
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1753
+ err.rawResponse = httpRes;
1754
+ throw new errors.FourHundredAndOneError(err);
1949
1755
  }
1950
1756
  else {
1951
1757
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1953,7 +1759,9 @@ var Subscription = /** @class */ (function () {
1953
1759
  break;
1954
1760
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1955
1761
  if (utils.matchContentType(contentType, "application/json")) {
1956
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1762
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1763
+ err.rawResponse = httpRes;
1764
+ throw new errors.FourHundredAndTwentyNineError(err);
1957
1765
  }
1958
1766
  else {
1959
1767
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1961,7 +1769,9 @@ var Subscription = /** @class */ (function () {
1961
1769
  break;
1962
1770
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1963
1771
  if (utils.matchContentType(contentType, "application/json")) {
1964
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1772
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1773
+ err.rawResponse = httpRes;
1774
+ throw new errors.FiveHundredError(err);
1965
1775
  }
1966
1776
  else {
1967
1777
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1984,7 +1794,7 @@ var Subscription = /** @class */ (function () {
1984
1794
  Subscription.prototype.unscheduleFixedFeeQuantity = function (subscriptionId, unscheduleFixedFeeQuantityChangeParams, config) {
1985
1795
  var _a, _b;
1986
1796
  return __awaiter(this, void 0, void 0, function () {
1987
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1797
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1988
1798
  var _d;
1989
1799
  return __generator(this, function (_e) {
1990
1800
  switch (_e.label) {
@@ -2041,41 +1851,18 @@ var Subscription = /** @class */ (function () {
2041
1851
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2042
1852
  }
2043
1853
  break;
2044
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
2045
- if (utils.matchContentType(contentType, "application/json")) {
2046
- res.fourHundredError = JSON.parse(decodedRes);
2047
- }
2048
- else {
2049
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2050
- }
2051
- break;
1854
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1855
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1856
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1857
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1858
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1859
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1860
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2052
1861
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
2053
1862
  if (utils.matchContentType(contentType, "application/json")) {
2054
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
2055
- }
2056
- else {
2057
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2058
- }
2059
- break;
2060
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
2061
- if (utils.matchContentType(contentType, "application/json")) {
2062
- res.fourHundredAndFourError = JSON.parse(decodedRes);
2063
- }
2064
- else {
2065
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2066
- }
2067
- break;
2068
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
2069
- if (utils.matchContentType(contentType, "application/json")) {
2070
- res.fourHundredAndNineError = JSON.parse(decodedRes);
2071
- }
2072
- else {
2073
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2074
- }
2075
- break;
2076
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
2077
- if (utils.matchContentType(contentType, "application/json")) {
2078
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1863
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1864
+ err.rawResponse = httpRes;
1865
+ throw new errors.FourHundredAndOneError(err);
2079
1866
  }
2080
1867
  else {
2081
1868
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2083,7 +1870,9 @@ var Subscription = /** @class */ (function () {
2083
1870
  break;
2084
1871
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
2085
1872
  if (utils.matchContentType(contentType, "application/json")) {
2086
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1873
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1874
+ err.rawResponse = httpRes;
1875
+ throw new errors.FourHundredAndTwentyNineError(err);
2087
1876
  }
2088
1877
  else {
2089
1878
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2091,7 +1880,9 @@ var Subscription = /** @class */ (function () {
2091
1880
  break;
2092
1881
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
2093
1882
  if (utils.matchContentType(contentType, "application/json")) {
2094
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1883
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1884
+ err.rawResponse = httpRes;
1885
+ throw new errors.FiveHundredError(err);
2095
1886
  }
2096
1887
  else {
2097
1888
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2112,7 +1903,7 @@ var Subscription = /** @class */ (function () {
2112
1903
  Subscription.prototype.unschedulePlanChange = function (subscriptionId, config) {
2113
1904
  var _a, _b;
2114
1905
  return __awaiter(this, void 0, void 0, function () {
2115
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1906
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
2116
1907
  return __generator(this, function (_c) {
2117
1908
  switch (_c.label) {
2118
1909
  case 0:
@@ -2158,41 +1949,18 @@ var Subscription = /** @class */ (function () {
2158
1949
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2159
1950
  }
2160
1951
  break;
2161
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
2162
- if (utils.matchContentType(contentType, "application/json")) {
2163
- res.fourHundredError = JSON.parse(decodedRes);
2164
- }
2165
- else {
2166
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2167
- }
2168
- break;
1952
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1953
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1954
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1955
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1956
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1957
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1958
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2169
1959
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
2170
1960
  if (utils.matchContentType(contentType, "application/json")) {
2171
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
2172
- }
2173
- else {
2174
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2175
- }
2176
- break;
2177
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
2178
- if (utils.matchContentType(contentType, "application/json")) {
2179
- res.fourHundredAndFourError = JSON.parse(decodedRes);
2180
- }
2181
- else {
2182
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2183
- }
2184
- break;
2185
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
2186
- if (utils.matchContentType(contentType, "application/json")) {
2187
- res.fourHundredAndNineError = JSON.parse(decodedRes);
2188
- }
2189
- else {
2190
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2191
- }
2192
- break;
2193
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
2194
- if (utils.matchContentType(contentType, "application/json")) {
2195
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1961
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1962
+ err.rawResponse = httpRes;
1963
+ throw new errors.FourHundredAndOneError(err);
2196
1964
  }
2197
1965
  else {
2198
1966
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2200,7 +1968,9 @@ var Subscription = /** @class */ (function () {
2200
1968
  break;
2201
1969
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
2202
1970
  if (utils.matchContentType(contentType, "application/json")) {
2203
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1971
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1972
+ err.rawResponse = httpRes;
1973
+ throw new errors.FourHundredAndTwentyNineError(err);
2204
1974
  }
2205
1975
  else {
2206
1976
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2208,7 +1978,9 @@ var Subscription = /** @class */ (function () {
2208
1978
  break;
2209
1979
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
2210
1980
  if (utils.matchContentType(contentType, "application/json")) {
2211
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1981
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1982
+ err.rawResponse = httpRes;
1983
+ throw new errors.FiveHundredError(err);
2212
1984
  }
2213
1985
  else {
2214
1986
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2239,7 +2011,7 @@ var Subscription = /** @class */ (function () {
2239
2011
  Subscription.prototype.updateFixedFeeQuantity = function (subscriptionId, fixedFeeQuantityChange, config) {
2240
2012
  var _a, _b;
2241
2013
  return __awaiter(this, void 0, void 0, function () {
2242
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
2014
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
2243
2015
  var _d;
2244
2016
  return __generator(this, function (_e) {
2245
2017
  switch (_e.label) {
@@ -2296,41 +2068,18 @@ var Subscription = /** @class */ (function () {
2296
2068
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2297
2069
  }
2298
2070
  break;
2299
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
2300
- if (utils.matchContentType(contentType, "application/json")) {
2301
- res.fourHundredError = JSON.parse(decodedRes);
2302
- }
2303
- else {
2304
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2305
- }
2306
- break;
2071
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
2072
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
2073
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
2074
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
2075
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
2076
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
2077
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2307
2078
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
2308
2079
  if (utils.matchContentType(contentType, "application/json")) {
2309
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
2310
- }
2311
- else {
2312
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2313
- }
2314
- break;
2315
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
2316
- if (utils.matchContentType(contentType, "application/json")) {
2317
- res.fourHundredAndFourError = JSON.parse(decodedRes);
2318
- }
2319
- else {
2320
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2321
- }
2322
- break;
2323
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
2324
- if (utils.matchContentType(contentType, "application/json")) {
2325
- res.fourHundredAndNineError = JSON.parse(decodedRes);
2326
- }
2327
- else {
2328
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
2329
- }
2330
- break;
2331
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
2332
- if (utils.matchContentType(contentType, "application/json")) {
2333
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
2080
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
2081
+ err.rawResponse = httpRes;
2082
+ throw new errors.FourHundredAndOneError(err);
2334
2083
  }
2335
2084
  else {
2336
2085
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2338,7 +2087,9 @@ var Subscription = /** @class */ (function () {
2338
2087
  break;
2339
2088
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
2340
2089
  if (utils.matchContentType(contentType, "application/json")) {
2341
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
2090
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
2091
+ err.rawResponse = httpRes;
2092
+ throw new errors.FourHundredAndTwentyNineError(err);
2342
2093
  }
2343
2094
  else {
2344
2095
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -2346,7 +2097,9 @@ var Subscription = /** @class */ (function () {
2346
2097
  break;
2347
2098
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
2348
2099
  if (utils.matchContentType(contentType, "application/json")) {
2349
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
2100
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
2101
+ err.rawResponse = httpRes;
2102
+ throw new errors.FiveHundredError(err);
2350
2103
  }
2351
2104
  else {
2352
2105
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);