orb-billing 1.20.0 → 1.20.2

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 (278) hide show
  1. package/README.md +1 -1
  2. package/dist/sdk/availability.js +17 -36
  3. package/dist/sdk/coupon.js +85 -180
  4. package/dist/sdk/credit.js +102 -216
  5. package/dist/sdk/creditnote.js +34 -72
  6. package/dist/sdk/customer.js +221 -468
  7. package/dist/sdk/event.js +153 -324
  8. package/dist/sdk/invoice.js +136 -288
  9. package/dist/sdk/item.js +34 -72
  10. package/dist/sdk/metric.js +51 -108
  11. package/dist/sdk/models/errors/fivehundrederror.d.ts +11 -0
  12. package/dist/sdk/models/{shared → errors}/fivehundrederror.js +21 -11
  13. package/dist/sdk/models/errors/fourhundredandoneerror.d.ts +11 -0
  14. package/dist/sdk/models/{shared → errors}/fourhundredandoneerror.js +21 -15
  15. package/dist/sdk/models/errors/fourhundredandtwentynineerror.d.ts +11 -0
  16. package/dist/sdk/models/{shared → errors}/fourhundredandtwentynineerror.js +21 -15
  17. package/dist/sdk/models/errors/index.d.ts +3 -0
  18. package/dist/sdk/models/errors/index.js +3 -0
  19. package/dist/sdk/models/operations/addeditpriceintervals.d.ts +0 -28
  20. package/dist/sdk/models/operations/addeditpriceintervals.js +0 -28
  21. package/dist/sdk/models/operations/amendevent.d.ts +0 -28
  22. package/dist/sdk/models/operations/amendevent.js +0 -28
  23. package/dist/sdk/models/operations/amendusage.d.ts +0 -28
  24. package/dist/sdk/models/operations/amendusage.js +0 -28
  25. package/dist/sdk/models/operations/amendusageexternalcustomerid.d.ts +0 -28
  26. package/dist/sdk/models/operations/amendusageexternalcustomerid.js +0 -28
  27. package/dist/sdk/models/operations/archivecoupon.d.ts +0 -28
  28. package/dist/sdk/models/operations/archivecoupon.js +0 -28
  29. package/dist/sdk/models/operations/cancelsubscription.d.ts +0 -28
  30. package/dist/sdk/models/operations/cancelsubscription.js +0 -28
  31. package/dist/sdk/models/operations/closebackfill.d.ts +0 -28
  32. package/dist/sdk/models/operations/closebackfill.js +0 -28
  33. package/dist/sdk/models/operations/createbackfill.d.ts +0 -28
  34. package/dist/sdk/models/operations/createbackfill.js +0 -28
  35. package/dist/sdk/models/operations/createcoupon.d.ts +0 -28
  36. package/dist/sdk/models/operations/createcoupon.js +0 -28
  37. package/dist/sdk/models/operations/createcustomer.d.ts +0 -28
  38. package/dist/sdk/models/operations/createcustomer.js +0 -28
  39. package/dist/sdk/models/operations/createcustomerbalancetransaction.d.ts +0 -28
  40. package/dist/sdk/models/operations/createcustomerbalancetransaction.js +0 -28
  41. package/dist/sdk/models/operations/createinvoice.d.ts +0 -28
  42. package/dist/sdk/models/operations/createinvoice.js +0 -28
  43. package/dist/sdk/models/operations/createinvoicelineitem.d.ts +0 -28
  44. package/dist/sdk/models/operations/createinvoicelineitem.js +0 -28
  45. package/dist/sdk/models/operations/createledgerentry.d.ts +0 -29
  46. package/dist/sdk/models/operations/createledgerentry.js +0 -52
  47. package/dist/sdk/models/operations/createledgerentryexternalid.d.ts +0 -29
  48. package/dist/sdk/models/operations/createledgerentryexternalid.js +0 -52
  49. package/dist/sdk/models/operations/createmetric.d.ts +0 -28
  50. package/dist/sdk/models/operations/createmetric.js +0 -28
  51. package/dist/sdk/models/operations/createplan.d.ts +0 -28
  52. package/dist/sdk/models/operations/createplan.js +0 -28
  53. package/dist/sdk/models/operations/createprice.d.ts +0 -29
  54. package/dist/sdk/models/operations/createprice.js +0 -52
  55. package/dist/sdk/models/operations/createsubscription.d.ts +0 -28
  56. package/dist/sdk/models/operations/createsubscription.js +0 -28
  57. package/dist/sdk/models/operations/deletecustomer.d.ts +0 -28
  58. package/dist/sdk/models/operations/deletecustomer.js +0 -28
  59. package/dist/sdk/models/operations/deprecateevent.d.ts +0 -28
  60. package/dist/sdk/models/operations/deprecateevent.js +0 -28
  61. package/dist/sdk/models/operations/fetchbackfill.d.ts +0 -28
  62. package/dist/sdk/models/operations/fetchbackfill.js +0 -28
  63. package/dist/sdk/models/operations/fetchcoupon.d.ts +0 -28
  64. package/dist/sdk/models/operations/fetchcoupon.js +0 -28
  65. package/dist/sdk/models/operations/fetchcreditnote.d.ts +0 -28
  66. package/dist/sdk/models/operations/fetchcreditnote.js +0 -28
  67. package/dist/sdk/models/operations/fetchcustomer.d.ts +0 -28
  68. package/dist/sdk/models/operations/fetchcustomer.js +0 -28
  69. package/dist/sdk/models/operations/fetchcustomercosts.d.ts +0 -28
  70. package/dist/sdk/models/operations/fetchcustomercosts.js +0 -28
  71. package/dist/sdk/models/operations/fetchcustomercostsexternalid.d.ts +0 -28
  72. package/dist/sdk/models/operations/fetchcustomercostsexternalid.js +0 -28
  73. package/dist/sdk/models/operations/fetchcustomercredits.d.ts +0 -28
  74. package/dist/sdk/models/operations/fetchcustomercredits.js +0 -28
  75. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.d.ts +0 -28
  76. package/dist/sdk/models/operations/fetchcustomercreditsexternalid.js +0 -28
  77. package/dist/sdk/models/operations/fetchcustomercreditsledger.d.ts +0 -28
  78. package/dist/sdk/models/operations/fetchcustomercreditsledger.js +0 -28
  79. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.d.ts +0 -28
  80. package/dist/sdk/models/operations/fetchcustomercreditsledgerexternalid.js +0 -28
  81. package/dist/sdk/models/operations/fetchcustomerexternalid.d.ts +0 -28
  82. package/dist/sdk/models/operations/fetchcustomerexternalid.js +0 -28
  83. package/dist/sdk/models/operations/fetchinvoice.d.ts +0 -28
  84. package/dist/sdk/models/operations/fetchinvoice.js +0 -28
  85. package/dist/sdk/models/operations/fetchitem.d.ts +0 -28
  86. package/dist/sdk/models/operations/fetchitem.js +0 -28
  87. package/dist/sdk/models/operations/fetchmetric.d.ts +0 -28
  88. package/dist/sdk/models/operations/fetchmetric.js +0 -28
  89. package/dist/sdk/models/operations/fetchplan.d.ts +0 -28
  90. package/dist/sdk/models/operations/fetchplan.js +0 -28
  91. package/dist/sdk/models/operations/fetchplanexternalid.d.ts +0 -28
  92. package/dist/sdk/models/operations/fetchplanexternalid.js +0 -28
  93. package/dist/sdk/models/operations/fetchprice.d.ts +0 -29
  94. package/dist/sdk/models/operations/fetchprice.js +0 -52
  95. package/dist/sdk/models/operations/fetchpriceexternalid.d.ts +0 -29
  96. package/dist/sdk/models/operations/fetchpriceexternalid.js +0 -52
  97. package/dist/sdk/models/operations/fetchsubscription.d.ts +0 -28
  98. package/dist/sdk/models/operations/fetchsubscription.js +0 -28
  99. package/dist/sdk/models/operations/fetchsubscriptioncosts.d.ts +0 -28
  100. package/dist/sdk/models/operations/fetchsubscriptioncosts.js +0 -28
  101. package/dist/sdk/models/operations/fetchsubscriptionschedule.d.ts +0 -28
  102. package/dist/sdk/models/operations/fetchsubscriptionschedule.js +0 -28
  103. package/dist/sdk/models/operations/fetchsubscriptionusage.d.ts +0 -29
  104. package/dist/sdk/models/operations/fetchsubscriptionusage.js +0 -52
  105. package/dist/sdk/models/operations/fetchupcominginvoice.d.ts +0 -28
  106. package/dist/sdk/models/operations/fetchupcominginvoice.js +0 -28
  107. package/dist/sdk/models/operations/ingest.d.ts +0 -28
  108. package/dist/sdk/models/operations/ingest.js +0 -28
  109. package/dist/sdk/models/operations/issueinvoice.d.ts +0 -28
  110. package/dist/sdk/models/operations/issueinvoice.js +0 -28
  111. package/dist/sdk/models/operations/listbackfills.d.ts +0 -28
  112. package/dist/sdk/models/operations/listbackfills.js +0 -28
  113. package/dist/sdk/models/operations/listbalancetransactions.d.ts +0 -28
  114. package/dist/sdk/models/operations/listbalancetransactions.js +0 -28
  115. package/dist/sdk/models/operations/listcoupons.d.ts +0 -28
  116. package/dist/sdk/models/operations/listcoupons.js +0 -28
  117. package/dist/sdk/models/operations/listcouponsubscriptions.d.ts +0 -28
  118. package/dist/sdk/models/operations/listcouponsubscriptions.js +0 -28
  119. package/dist/sdk/models/operations/listcreditnotes.d.ts +0 -28
  120. package/dist/sdk/models/operations/listcreditnotes.js +0 -28
  121. package/dist/sdk/models/operations/listcustomers.d.ts +0 -28
  122. package/dist/sdk/models/operations/listcustomers.js +0 -28
  123. package/dist/sdk/models/operations/listinvoices.d.ts +0 -28
  124. package/dist/sdk/models/operations/listinvoices.js +0 -28
  125. package/dist/sdk/models/operations/listitems.d.ts +0 -28
  126. package/dist/sdk/models/operations/listitems.js +0 -28
  127. package/dist/sdk/models/operations/listmetrics.d.ts +0 -28
  128. package/dist/sdk/models/operations/listmetrics.js +0 -28
  129. package/dist/sdk/models/operations/listplans.d.ts +0 -28
  130. package/dist/sdk/models/operations/listplans.js +0 -28
  131. package/dist/sdk/models/operations/listprices.d.ts +0 -28
  132. package/dist/sdk/models/operations/listprices.js +0 -28
  133. package/dist/sdk/models/operations/listsubscriptions.d.ts +0 -28
  134. package/dist/sdk/models/operations/listsubscriptions.js +0 -28
  135. package/dist/sdk/models/operations/markinvoiceaspaid.d.ts +0 -28
  136. package/dist/sdk/models/operations/markinvoiceaspaid.js +0 -28
  137. package/dist/sdk/models/operations/ping.d.ts +0 -28
  138. package/dist/sdk/models/operations/ping.js +0 -28
  139. package/dist/sdk/models/operations/revertbackfill.d.ts +0 -28
  140. package/dist/sdk/models/operations/revertbackfill.js +0 -28
  141. package/dist/sdk/models/operations/scheduleplanchange.d.ts +0 -28
  142. package/dist/sdk/models/operations/scheduleplanchange.js +0 -28
  143. package/dist/sdk/models/operations/searchevents.d.ts +0 -28
  144. package/dist/sdk/models/operations/searchevents.js +0 -28
  145. package/dist/sdk/models/operations/triggerphase.d.ts +0 -28
  146. package/dist/sdk/models/operations/triggerphase.js +0 -28
  147. package/dist/sdk/models/operations/unschedulecancellation.d.ts +0 -28
  148. package/dist/sdk/models/operations/unschedulecancellation.js +0 -28
  149. package/dist/sdk/models/operations/unschedulefixedfeequantity.d.ts +0 -28
  150. package/dist/sdk/models/operations/unschedulefixedfeequantity.js +0 -28
  151. package/dist/sdk/models/operations/unscheduleplanchange.d.ts +0 -28
  152. package/dist/sdk/models/operations/unscheduleplanchange.js +0 -28
  153. package/dist/sdk/models/operations/updatecustomer.d.ts +0 -28
  154. package/dist/sdk/models/operations/updatecustomer.js +0 -28
  155. package/dist/sdk/models/operations/updatecustomerexternalid.d.ts +0 -28
  156. package/dist/sdk/models/operations/updatecustomerexternalid.js +0 -28
  157. package/dist/sdk/models/operations/updatefixedfeequantity.d.ts +0 -28
  158. package/dist/sdk/models/operations/updatefixedfeequantity.js +0 -28
  159. package/dist/sdk/models/operations/updateplan.d.ts +0 -28
  160. package/dist/sdk/models/operations/updateplan.js +0 -28
  161. package/dist/sdk/models/operations/updateplanexternal.d.ts +0 -28
  162. package/dist/sdk/models/operations/updateplanexternal.js +0 -28
  163. package/dist/sdk/models/operations/voidinvoice.d.ts +0 -28
  164. package/dist/sdk/models/operations/voidinvoice.js +0 -28
  165. package/dist/sdk/models/shared/index.d.ts +0 -3
  166. package/dist/sdk/models/shared/index.js +0 -3
  167. package/dist/sdk/models/shared/security.d.ts +1 -1
  168. package/dist/sdk/models/shared/security.js +1 -1
  169. package/dist/sdk/plan.js +102 -216
  170. package/dist/sdk/price.js +68 -144
  171. package/dist/sdk/priceinterval.js +17 -36
  172. package/dist/sdk/sdk.js +2 -2
  173. package/dist/sdk/subscription.js +221 -468
  174. package/docs/models/errors/fivehundrederror.md +12 -0
  175. package/docs/models/errors/fourhundredandoneerror.md +12 -0
  176. package/docs/models/errors/fourhundredandtwentynineerror.md +12 -0
  177. package/docs/models/operations/addeditpriceintervalsresponse.md +6 -13
  178. package/docs/models/operations/amendeventresponse.md +6 -13
  179. package/docs/models/operations/amendusageexternalcustomeridresponse.md +6 -13
  180. package/docs/models/operations/amendusageresponse.md +6 -13
  181. package/docs/models/operations/archivecouponresponse.md +6 -13
  182. package/docs/models/operations/cancelsubscriptionresponse.md +6 -13
  183. package/docs/models/operations/closebackfillresponse.md +6 -13
  184. package/docs/models/operations/createbackfillresponse.md +6 -13
  185. package/docs/models/operations/createcouponresponse.md +6 -13
  186. package/docs/models/operations/createcustomerbalancetransactionresponse.md +6 -13
  187. package/docs/models/operations/createcustomerresponse.md +6 -13
  188. package/docs/models/operations/createinvoicelineitemresponse.md +6 -13
  189. package/docs/models/operations/createinvoiceresponse.md +6 -13
  190. package/docs/models/operations/createledgerentryexternalidresponse.md +6 -13
  191. package/docs/models/operations/createledgerentryresponse.md +6 -13
  192. package/docs/models/operations/createmetricresponse.md +6 -13
  193. package/docs/models/operations/createplanresponse.md +6 -13
  194. package/docs/models/operations/createpriceresponse.md +6 -13
  195. package/docs/models/operations/createsubscriptionresponse.md +6 -13
  196. package/docs/models/operations/deletecustomerresponse.md +6 -13
  197. package/docs/models/operations/deprecateeventresponse.md +6 -13
  198. package/docs/models/operations/fetchbackfillresponse.md +6 -13
  199. package/docs/models/operations/fetchcouponresponse.md +6 -13
  200. package/docs/models/operations/fetchcreditnoteresponse.md +6 -13
  201. package/docs/models/operations/fetchcustomercostsexternalidresponse.md +6 -13
  202. package/docs/models/operations/fetchcustomercostsresponse.md +6 -13
  203. package/docs/models/operations/fetchcustomercreditsexternalidresponse.md +6 -13
  204. package/docs/models/operations/fetchcustomercreditsledgerexternalidresponse.md +6 -13
  205. package/docs/models/operations/fetchcustomercreditsledgerresponse.md +6 -13
  206. package/docs/models/operations/fetchcustomercreditsresponse.md +6 -13
  207. package/docs/models/operations/fetchcustomerexternalidresponse.md +6 -13
  208. package/docs/models/operations/fetchcustomerresponse.md +6 -13
  209. package/docs/models/operations/fetchinvoiceresponse.md +6 -13
  210. package/docs/models/operations/fetchitemresponse.md +6 -13
  211. package/docs/models/operations/fetchmetricresponse.md +6 -13
  212. package/docs/models/operations/fetchplanexternalidresponse.md +6 -13
  213. package/docs/models/operations/fetchplanresponse.md +6 -13
  214. package/docs/models/operations/fetchpriceexternalidresponse.md +6 -13
  215. package/docs/models/operations/fetchpriceresponse.md +6 -13
  216. package/docs/models/operations/fetchsubscriptioncostsresponse.md +6 -13
  217. package/docs/models/operations/fetchsubscriptionresponse.md +6 -13
  218. package/docs/models/operations/fetchsubscriptionscheduleresponse.md +6 -13
  219. package/docs/models/operations/fetchsubscriptionusageresponse.md +6 -13
  220. package/docs/models/operations/fetchupcominginvoiceresponse.md +6 -13
  221. package/docs/models/operations/ingestresponse.md +6 -13
  222. package/docs/models/operations/issueinvoiceresponse.md +6 -13
  223. package/docs/models/operations/listbackfillsresponse.md +6 -13
  224. package/docs/models/operations/listbalancetransactionsresponse.md +6 -13
  225. package/docs/models/operations/listcouponsresponse.md +6 -13
  226. package/docs/models/operations/listcouponsubscriptionsresponse.md +6 -13
  227. package/docs/models/operations/listcreditnotesresponse.md +6 -13
  228. package/docs/models/operations/listcustomersresponse.md +6 -13
  229. package/docs/models/operations/listinvoicesresponse.md +6 -13
  230. package/docs/models/operations/listitemsresponse.md +6 -13
  231. package/docs/models/operations/listmetricsresponse.md +6 -13
  232. package/docs/models/operations/listplansresponse.md +6 -13
  233. package/docs/models/operations/listpricesresponse.md +6 -13
  234. package/docs/models/operations/listsubscriptionsresponse.md +6 -13
  235. package/docs/models/operations/markinvoiceaspaidresponse.md +6 -13
  236. package/docs/models/operations/pingresponse.md +6 -13
  237. package/docs/models/operations/revertbackfillresponse.md +6 -13
  238. package/docs/models/operations/scheduleplanchangeresponse.md +6 -13
  239. package/docs/models/operations/searcheventsresponse.md +6 -13
  240. package/docs/models/operations/triggerphaseresponse.md +6 -13
  241. package/docs/models/operations/unschedulecancellationresponse.md +6 -13
  242. package/docs/models/operations/unschedulefixedfeequantityresponse.md +6 -13
  243. package/docs/models/operations/unscheduleplanchangeresponse.md +6 -13
  244. package/docs/models/operations/updatecustomerexternalidresponse.md +6 -13
  245. package/docs/models/operations/updatecustomerresponse.md +6 -13
  246. package/docs/models/operations/updatefixedfeequantityresponse.md +6 -13
  247. package/docs/models/operations/updateplanexternalresponse.md +6 -13
  248. package/docs/models/operations/updateplanresponse.md +6 -13
  249. package/docs/models/operations/voidinvoiceresponse.md +6 -13
  250. package/docs/models/shared/security.md +1 -1
  251. package/docs/sdks/availability/README.md +1 -1
  252. package/docs/sdks/coupon/README.md +5 -5
  253. package/docs/sdks/credit/README.md +6 -6
  254. package/docs/sdks/creditnote/README.md +2 -2
  255. package/docs/sdks/customer/README.md +13 -13
  256. package/docs/sdks/event/README.md +9 -9
  257. package/docs/sdks/invoice/README.md +8 -8
  258. package/docs/sdks/item/README.md +2 -2
  259. package/docs/sdks/metric/README.md +3 -3
  260. package/docs/sdks/plan/README.md +6 -6
  261. package/docs/sdks/price/README.md +4 -4
  262. package/docs/sdks/priceinterval/README.md +1 -1
  263. package/docs/sdks/subscription/README.md +13 -13
  264. package/package.json +1 -1
  265. package/dist/sdk/models/shared/fivehundrederror.d.ts +0 -13
  266. package/dist/sdk/models/shared/fourhundredandoneerror.d.ts +0 -16
  267. package/dist/sdk/models/shared/fourhundredandtwentynineerror.d.ts +0 -16
  268. package/docs/models/shared/fivehundrederror.md +0 -12
  269. package/docs/models/shared/fivehundrederrortype.md +0 -8
  270. package/docs/models/shared/fourhundredandoneerror.md +0 -12
  271. package/docs/models/shared/fourhundredandoneerrorstatus.md +0 -8
  272. package/docs/models/shared/fourhundredandoneerrortype.md +0 -8
  273. package/docs/models/shared/fourhundredandtwentynineerror.md +0 -12
  274. package/docs/models/shared/fourhundredandtwentynineerrorstatus.md +0 -8
  275. package/docs/models/shared/fourhundredandtwentynineerrortype.md +0 -8
  276. /package/docs/models/{shared → errors}/fivehundrederrorheaders.md +0 -0
  277. /package/docs/models/{shared → errors}/fourhundredandoneerrorheaders.md +0 -0
  278. /package/docs/models/{shared → errors}/fourhundredandtwentynineerrorheaders.md +0 -0
package/dist/sdk/event.js CHANGED
@@ -144,7 +144,7 @@ var Event = /** @class */ (function () {
144
144
  Event.prototype.amend = function (eventId, amendedEvent, config) {
145
145
  var _a, _b;
146
146
  return __awaiter(this, void 0, void 0, function () {
147
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
147
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
148
148
  var _d;
149
149
  return __generator(this, function (_e) {
150
150
  switch (_e.label) {
@@ -201,41 +201,18 @@ var Event = /** @class */ (function () {
201
201
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
202
202
  }
203
203
  break;
204
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
205
- if (utils.matchContentType(contentType, "application/json")) {
206
- res.fourHundredError = JSON.parse(decodedRes);
207
- }
208
- else {
209
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
210
- }
211
- break;
204
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
205
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
206
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
207
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
208
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
209
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
210
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
212
211
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
213
212
  if (utils.matchContentType(contentType, "application/json")) {
214
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
215
- }
216
- else {
217
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
218
- }
219
- break;
220
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
221
- if (utils.matchContentType(contentType, "application/json")) {
222
- res.fourHundredAndFourError = JSON.parse(decodedRes);
223
- }
224
- else {
225
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
226
- }
227
- break;
228
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
229
- if (utils.matchContentType(contentType, "application/json")) {
230
- res.fourHundredAndNineError = JSON.parse(decodedRes);
231
- }
232
- else {
233
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
234
- }
235
- break;
236
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
237
- if (utils.matchContentType(contentType, "application/json")) {
238
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
213
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
214
+ err.rawResponse = httpRes;
215
+ throw new errors.FourHundredAndOneError(err);
239
216
  }
240
217
  else {
241
218
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -243,7 +220,9 @@ var Event = /** @class */ (function () {
243
220
  break;
244
221
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
245
222
  if (utils.matchContentType(contentType, "application/json")) {
246
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
223
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
224
+ err.rawResponse = httpRes;
225
+ throw new errors.FourHundredAndTwentyNineError(err);
247
226
  }
248
227
  else {
249
228
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -251,7 +230,9 @@ var Event = /** @class */ (function () {
251
230
  break;
252
231
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
253
232
  if (utils.matchContentType(contentType, "application/json")) {
254
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
233
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
234
+ err.rawResponse = httpRes;
235
+ throw new errors.FiveHundredError(err);
255
236
  }
256
237
  else {
257
238
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -274,7 +255,7 @@ var Event = /** @class */ (function () {
274
255
  Event.prototype.closeBackfill = function (backfillId, config) {
275
256
  var _a, _b;
276
257
  return __awaiter(this, void 0, void 0, function () {
277
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
258
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
278
259
  return __generator(this, function (_c) {
279
260
  switch (_c.label) {
280
261
  case 0:
@@ -320,41 +301,18 @@ var Event = /** @class */ (function () {
320
301
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
321
302
  }
322
303
  break;
323
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
324
- if (utils.matchContentType(contentType, "application/json")) {
325
- res.fourHundredError = JSON.parse(decodedRes);
326
- }
327
- else {
328
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
329
- }
330
- break;
304
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
305
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
306
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
307
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
308
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
309
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
310
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
331
311
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
332
312
  if (utils.matchContentType(contentType, "application/json")) {
333
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
334
- }
335
- else {
336
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
337
- }
338
- break;
339
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
340
- if (utils.matchContentType(contentType, "application/json")) {
341
- res.fourHundredAndFourError = JSON.parse(decodedRes);
342
- }
343
- else {
344
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
345
- }
346
- break;
347
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
348
- if (utils.matchContentType(contentType, "application/json")) {
349
- res.fourHundredAndNineError = JSON.parse(decodedRes);
350
- }
351
- else {
352
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
353
- }
354
- break;
355
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
356
- if (utils.matchContentType(contentType, "application/json")) {
357
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
313
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
314
+ err.rawResponse = httpRes;
315
+ throw new errors.FourHundredAndOneError(err);
358
316
  }
359
317
  else {
360
318
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -362,7 +320,9 @@ var Event = /** @class */ (function () {
362
320
  break;
363
321
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
364
322
  if (utils.matchContentType(contentType, "application/json")) {
365
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
323
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
324
+ err.rawResponse = httpRes;
325
+ throw new errors.FourHundredAndTwentyNineError(err);
366
326
  }
367
327
  else {
368
328
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -370,7 +330,9 @@ var Event = /** @class */ (function () {
370
330
  break;
371
331
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
372
332
  if (utils.matchContentType(contentType, "application/json")) {
373
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
333
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
334
+ err.rawResponse = httpRes;
335
+ throw new errors.FiveHundredError(err);
374
336
  }
375
337
  else {
376
338
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -410,7 +372,7 @@ var Event = /** @class */ (function () {
410
372
  Event.prototype.create = function (req, config) {
411
373
  var _a, _b;
412
374
  return __awaiter(this, void 0, void 0, function () {
413
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
375
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
414
376
  var _d;
415
377
  return __generator(this, function (_e) {
416
378
  switch (_e.label) {
@@ -466,41 +428,18 @@ var Event = /** @class */ (function () {
466
428
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
467
429
  }
468
430
  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;
431
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
432
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
433
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
434
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
435
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
436
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
437
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
477
438
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
478
439
  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);
440
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
441
+ err.rawResponse = httpRes;
442
+ throw new errors.FourHundredAndOneError(err);
504
443
  }
505
444
  else {
506
445
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -508,7 +447,9 @@ var Event = /** @class */ (function () {
508
447
  break;
509
448
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
510
449
  if (utils.matchContentType(contentType, "application/json")) {
511
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
450
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
451
+ err.rawResponse = httpRes;
452
+ throw new errors.FourHundredAndTwentyNineError(err);
512
453
  }
513
454
  else {
514
455
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -516,7 +457,9 @@ var Event = /** @class */ (function () {
516
457
  break;
517
458
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
518
459
  if (utils.matchContentType(contentType, "application/json")) {
519
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
460
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
461
+ err.rawResponse = httpRes;
462
+ throw new errors.FiveHundredError(err);
520
463
  }
521
464
  else {
522
465
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -564,7 +507,7 @@ var Event = /** @class */ (function () {
564
507
  Event.prototype.deprecateEvent = function (eventId, config) {
565
508
  var _a, _b;
566
509
  return __awaiter(this, void 0, void 0, function () {
567
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
510
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
568
511
  return __generator(this, function (_c) {
569
512
  switch (_c.label) {
570
513
  case 0:
@@ -610,41 +553,18 @@ var Event = /** @class */ (function () {
610
553
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
611
554
  }
612
555
  break;
613
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
614
- if (utils.matchContentType(contentType, "application/json")) {
615
- res.fourHundredError = JSON.parse(decodedRes);
616
- }
617
- else {
618
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
619
- }
620
- break;
556
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
557
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
558
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
559
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
560
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
561
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
562
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
621
563
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
622
564
  if (utils.matchContentType(contentType, "application/json")) {
623
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
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) == 404:
630
- if (utils.matchContentType(contentType, "application/json")) {
631
- res.fourHundredAndFourError = 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) == 409:
638
- if (utils.matchContentType(contentType, "application/json")) {
639
- res.fourHundredAndNineError = JSON.parse(decodedRes);
640
- }
641
- else {
642
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
643
- }
644
- break;
645
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
646
- if (utils.matchContentType(contentType, "application/json")) {
647
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
565
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
566
+ err.rawResponse = httpRes;
567
+ throw new errors.FourHundredAndOneError(err);
648
568
  }
649
569
  else {
650
570
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -652,7 +572,9 @@ var Event = /** @class */ (function () {
652
572
  break;
653
573
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
654
574
  if (utils.matchContentType(contentType, "application/json")) {
655
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
575
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
576
+ err.rawResponse = httpRes;
577
+ throw new errors.FourHundredAndTwentyNineError(err);
656
578
  }
657
579
  else {
658
580
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -660,7 +582,9 @@ var Event = /** @class */ (function () {
660
582
  break;
661
583
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
662
584
  if (utils.matchContentType(contentType, "application/json")) {
663
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
585
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
586
+ err.rawResponse = httpRes;
587
+ throw new errors.FiveHundredError(err);
664
588
  }
665
589
  else {
666
590
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -681,7 +605,7 @@ var Event = /** @class */ (function () {
681
605
  Event.prototype.fetch = function (backfillId, config) {
682
606
  var _a, _b;
683
607
  return __awaiter(this, void 0, void 0, function () {
684
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
608
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
685
609
  return __generator(this, function (_c) {
686
610
  switch (_c.label) {
687
611
  case 0:
@@ -727,41 +651,18 @@ var Event = /** @class */ (function () {
727
651
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
728
652
  }
729
653
  break;
730
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
731
- if (utils.matchContentType(contentType, "application/json")) {
732
- res.fourHundredError = JSON.parse(decodedRes);
733
- }
734
- else {
735
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
736
- }
737
- break;
654
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
655
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
656
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
657
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
658
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
659
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
660
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
738
661
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
739
662
  if (utils.matchContentType(contentType, "application/json")) {
740
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
741
- }
742
- else {
743
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
744
- }
745
- break;
746
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
747
- if (utils.matchContentType(contentType, "application/json")) {
748
- res.fourHundredAndFourError = JSON.parse(decodedRes);
749
- }
750
- else {
751
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
752
- }
753
- break;
754
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
755
- if (utils.matchContentType(contentType, "application/json")) {
756
- res.fourHundredAndNineError = JSON.parse(decodedRes);
757
- }
758
- else {
759
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
760
- }
761
- break;
762
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
763
- if (utils.matchContentType(contentType, "application/json")) {
764
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
663
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
664
+ err.rawResponse = httpRes;
665
+ throw new errors.FourHundredAndOneError(err);
765
666
  }
766
667
  else {
767
668
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -769,7 +670,9 @@ var Event = /** @class */ (function () {
769
670
  break;
770
671
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
771
672
  if (utils.matchContentType(contentType, "application/json")) {
772
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
673
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
674
+ err.rawResponse = httpRes;
675
+ throw new errors.FourHundredAndTwentyNineError(err);
773
676
  }
774
677
  else {
775
678
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -777,7 +680,9 @@ var Event = /** @class */ (function () {
777
680
  break;
778
681
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
779
682
  if (utils.matchContentType(contentType, "application/json")) {
780
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
683
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
684
+ err.rawResponse = httpRes;
685
+ throw new errors.FiveHundredError(err);
781
686
  }
782
687
  else {
783
688
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -972,7 +877,7 @@ var Event = /** @class */ (function () {
972
877
  Event.prototype.ingest = function (ingestRequestBody, backfillId, debug, config) {
973
878
  var _a, _b;
974
879
  return __awaiter(this, void 0, void 0, function () {
975
- var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
880
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
976
881
  var _d;
977
882
  return __generator(this, function (_e) {
978
883
  switch (_e.label) {
@@ -1031,41 +936,18 @@ var Event = /** @class */ (function () {
1031
936
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1032
937
  }
1033
938
  break;
1034
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1035
- if (utils.matchContentType(contentType, "application/json")) {
1036
- res.fourHundredError = JSON.parse(decodedRes);
1037
- }
1038
- else {
1039
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1040
- }
1041
- break;
939
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
940
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
941
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
942
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
943
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
944
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
945
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1042
946
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1043
947
  if (utils.matchContentType(contentType, "application/json")) {
1044
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1045
- }
1046
- else {
1047
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1048
- }
1049
- break;
1050
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1051
- if (utils.matchContentType(contentType, "application/json")) {
1052
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1053
- }
1054
- else {
1055
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1056
- }
1057
- break;
1058
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1059
- if (utils.matchContentType(contentType, "application/json")) {
1060
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1061
- }
1062
- else {
1063
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1064
- }
1065
- break;
1066
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1067
- if (utils.matchContentType(contentType, "application/json")) {
1068
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
948
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
949
+ err.rawResponse = httpRes;
950
+ throw new errors.FourHundredAndOneError(err);
1069
951
  }
1070
952
  else {
1071
953
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1073,7 +955,9 @@ var Event = /** @class */ (function () {
1073
955
  break;
1074
956
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1075
957
  if (utils.matchContentType(contentType, "application/json")) {
1076
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
958
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
959
+ err.rawResponse = httpRes;
960
+ throw new errors.FourHundredAndTwentyNineError(err);
1077
961
  }
1078
962
  else {
1079
963
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1081,7 +965,9 @@ var Event = /** @class */ (function () {
1081
965
  break;
1082
966
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1083
967
  if (utils.matchContentType(contentType, "application/json")) {
1084
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
968
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
969
+ err.rawResponse = httpRes;
970
+ throw new errors.FiveHundredError(err);
1085
971
  }
1086
972
  else {
1087
973
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1106,7 +992,7 @@ var Event = /** @class */ (function () {
1106
992
  Event.prototype.listBackfills = function (cursor, limit, config) {
1107
993
  var _a, _b;
1108
994
  return __awaiter(this, void 0, void 0, function () {
1109
- var req, baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
995
+ var req, baseURL, url, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1110
996
  return __generator(this, function (_c) {
1111
997
  switch (_c.label) {
1112
998
  case 0:
@@ -1154,41 +1040,18 @@ var Event = /** @class */ (function () {
1154
1040
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1155
1041
  }
1156
1042
  break;
1157
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1158
- if (utils.matchContentType(contentType, "application/json")) {
1159
- res.fourHundredError = JSON.parse(decodedRes);
1160
- }
1161
- else {
1162
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1163
- }
1164
- break;
1043
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1044
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1045
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1046
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1047
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1048
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1049
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1165
1050
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1166
1051
  if (utils.matchContentType(contentType, "application/json")) {
1167
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1168
- }
1169
- else {
1170
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1171
- }
1172
- break;
1173
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1174
- if (utils.matchContentType(contentType, "application/json")) {
1175
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1176
- }
1177
- else {
1178
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1179
- }
1180
- break;
1181
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1182
- if (utils.matchContentType(contentType, "application/json")) {
1183
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1184
- }
1185
- else {
1186
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1187
- }
1188
- break;
1189
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1190
- if (utils.matchContentType(contentType, "application/json")) {
1191
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1052
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1053
+ err.rawResponse = httpRes;
1054
+ throw new errors.FourHundredAndOneError(err);
1192
1055
  }
1193
1056
  else {
1194
1057
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1196,7 +1059,9 @@ var Event = /** @class */ (function () {
1196
1059
  break;
1197
1060
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1198
1061
  if (utils.matchContentType(contentType, "application/json")) {
1199
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1062
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1063
+ err.rawResponse = httpRes;
1064
+ throw new errors.FourHundredAndTwentyNineError(err);
1200
1065
  }
1201
1066
  else {
1202
1067
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1204,7 +1069,9 @@ var Event = /** @class */ (function () {
1204
1069
  break;
1205
1070
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1206
1071
  if (utils.matchContentType(contentType, "application/json")) {
1207
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1072
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1073
+ err.rawResponse = httpRes;
1074
+ throw new errors.FiveHundredError(err);
1208
1075
  }
1209
1076
  else {
1210
1077
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1230,7 +1097,7 @@ var Event = /** @class */ (function () {
1230
1097
  Event.prototype.revertBackfill = function (backfillId, config) {
1231
1098
  var _a, _b;
1232
1099
  return __awaiter(this, void 0, void 0, function () {
1233
- var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes;
1100
+ var req, baseURL, url, client, globalSecurity, properties, headers, httpRes, contentType, res, decodedRes, err, err, err;
1234
1101
  return __generator(this, function (_c) {
1235
1102
  switch (_c.label) {
1236
1103
  case 0:
@@ -1276,41 +1143,18 @@ var Event = /** @class */ (function () {
1276
1143
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1277
1144
  }
1278
1145
  break;
1279
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1280
- if (utils.matchContentType(contentType, "application/json")) {
1281
- res.fourHundredError = JSON.parse(decodedRes);
1282
- }
1283
- else {
1284
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1285
- }
1286
- break;
1146
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1147
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1148
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1149
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1150
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1151
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1152
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1287
1153
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1288
1154
  if (utils.matchContentType(contentType, "application/json")) {
1289
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1290
- }
1291
- else {
1292
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1293
- }
1294
- break;
1295
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1296
- if (utils.matchContentType(contentType, "application/json")) {
1297
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1298
- }
1299
- else {
1300
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1301
- }
1302
- break;
1303
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1304
- if (utils.matchContentType(contentType, "application/json")) {
1305
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1306
- }
1307
- else {
1308
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1309
- }
1310
- break;
1311
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1312
- if (utils.matchContentType(contentType, "application/json")) {
1313
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1155
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1156
+ err.rawResponse = httpRes;
1157
+ throw new errors.FourHundredAndOneError(err);
1314
1158
  }
1315
1159
  else {
1316
1160
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1318,7 +1162,9 @@ var Event = /** @class */ (function () {
1318
1162
  break;
1319
1163
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1320
1164
  if (utils.matchContentType(contentType, "application/json")) {
1321
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1165
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1166
+ err.rawResponse = httpRes;
1167
+ throw new errors.FourHundredAndTwentyNineError(err);
1322
1168
  }
1323
1169
  else {
1324
1170
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1326,7 +1172,9 @@ var Event = /** @class */ (function () {
1326
1172
  break;
1327
1173
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1328
1174
  if (utils.matchContentType(contentType, "application/json")) {
1329
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1175
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1176
+ err.rawResponse = httpRes;
1177
+ throw new errors.FiveHundredError(err);
1330
1178
  }
1331
1179
  else {
1332
1180
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1361,7 +1209,7 @@ var Event = /** @class */ (function () {
1361
1209
  Event.prototype.search = function (req, config) {
1362
1210
  var _a, _b;
1363
1211
  return __awaiter(this, void 0, void 0, function () {
1364
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes;
1212
+ var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, httpRes, contentType, res, decodedRes, err, err, err;
1365
1213
  var _d;
1366
1214
  return __generator(this, function (_e) {
1367
1215
  switch (_e.label) {
@@ -1418,41 +1266,18 @@ var Event = /** @class */ (function () {
1418
1266
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1419
1267
  }
1420
1268
  break;
1421
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400:
1422
- if (utils.matchContentType(contentType, "application/json")) {
1423
- res.fourHundredError = JSON.parse(decodedRes);
1424
- }
1425
- else {
1426
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1427
- }
1428
- break;
1269
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 400 ||
1270
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404 ||
1271
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409 ||
1272
+ (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413 ||
1273
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1274
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1275
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1429
1276
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 401:
1430
1277
  if (utils.matchContentType(contentType, "application/json")) {
1431
- res.fourHundredAndOneError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndOneError);
1432
- }
1433
- else {
1434
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1435
- }
1436
- break;
1437
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
1438
- if (utils.matchContentType(contentType, "application/json")) {
1439
- res.fourHundredAndFourError = JSON.parse(decodedRes);
1440
- }
1441
- else {
1442
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1443
- }
1444
- break;
1445
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 409:
1446
- if (utils.matchContentType(contentType, "application/json")) {
1447
- res.fourHundredAndNineError = JSON.parse(decodedRes);
1448
- }
1449
- else {
1450
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1451
- }
1452
- break;
1453
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 413:
1454
- if (utils.matchContentType(contentType, "application/json")) {
1455
- res.fourHundredAndThirteenError = JSON.parse(decodedRes);
1278
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndOneError);
1279
+ err.rawResponse = httpRes;
1280
+ throw new errors.FourHundredAndOneError(err);
1456
1281
  }
1457
1282
  else {
1458
1283
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1460,7 +1285,9 @@ var Event = /** @class */ (function () {
1460
1285
  break;
1461
1286
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 429:
1462
1287
  if (utils.matchContentType(contentType, "application/json")) {
1463
- res.fourHundredAndTwentyNineError = utils.objectToClass(JSON.parse(decodedRes), shared.FourHundredAndTwentyNineError);
1288
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FourHundredAndTwentyNineError);
1289
+ err.rawResponse = httpRes;
1290
+ throw new errors.FourHundredAndTwentyNineError(err);
1464
1291
  }
1465
1292
  else {
1466
1293
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
@@ -1468,7 +1295,9 @@ var Event = /** @class */ (function () {
1468
1295
  break;
1469
1296
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 500:
1470
1297
  if (utils.matchContentType(contentType, "application/json")) {
1471
- res.fiveHundredError = utils.objectToClass(JSON.parse(decodedRes), shared.FiveHundredError);
1298
+ err = utils.objectToClass(JSON.parse(decodedRes), errors.FiveHundredError);
1299
+ err.rawResponse = httpRes;
1300
+ throw new errors.FiveHundredError(err);
1472
1301
  }
1473
1302
  else {
1474
1303
  throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);