@payabli/sdk-node 0.0.116 → 0.0.123

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 (271) hide show
  1. package/README.md +31 -2
  2. package/dist/cjs/BaseClient.d.ts +13 -4
  3. package/dist/cjs/BaseClient.js +59 -0
  4. package/dist/cjs/Client.d.ts +88 -88
  5. package/dist/cjs/Client.js +31 -72
  6. package/dist/cjs/api/errors/BadRequestError.js +5 -1
  7. package/dist/cjs/api/errors/ConflictError.js +5 -1
  8. package/dist/cjs/api/errors/ForbiddenError.js +5 -1
  9. package/dist/cjs/api/errors/InternalServerError.js +5 -1
  10. package/dist/cjs/api/errors/ServiceUnavailableError.js +5 -1
  11. package/dist/cjs/api/errors/UnauthorizedError.js +5 -1
  12. package/dist/cjs/api/resources/bill/client/Client.d.ts +34 -35
  13. package/dist/cjs/api/resources/bill/client/Client.js +69 -216
  14. package/dist/cjs/api/resources/boarding/client/Client.d.ts +28 -29
  15. package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
  16. package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +18 -17
  17. package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
  18. package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +8 -9
  19. package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
  20. package/dist/cjs/api/resources/cloud/client/Client.d.ts +18 -19
  21. package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
  22. package/dist/cjs/api/resources/customer/client/Client.d.ts +18 -19
  23. package/dist/cjs/api/resources/customer/client/Client.js +31 -113
  24. package/dist/cjs/api/resources/export/client/Client.d.ts +94 -91
  25. package/dist/cjs/api/resources/export/client/Client.js +205 -582
  26. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +12 -13
  27. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
  28. package/dist/cjs/api/resources/import/client/Client.d.ts +12 -13
  29. package/dist/cjs/api/resources/import/client/Client.js +19 -62
  30. package/dist/cjs/api/resources/invoice/client/Client.d.ts +37 -36
  31. package/dist/cjs/api/resources/invoice/client/Client.js +67 -212
  32. package/dist/cjs/api/resources/invoice/client/requests/AddInvoiceRequest.d.ts +5 -3
  33. package/dist/cjs/api/resources/lineItem/client/Client.d.ts +16 -17
  34. package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
  35. package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +40 -41
  36. package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
  37. package/dist/cjs/api/resources/moneyIn/errors/CaptureError.js +5 -1
  38. package/dist/cjs/api/resources/moneyIn/errors/InvalidTransStatusError.js +5 -1
  39. package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +44 -28
  40. package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
  41. package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
  42. package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
  43. package/dist/cjs/api/resources/notification/client/Client.d.ts +30 -18
  44. package/dist/cjs/api/resources/notification/client/Client.js +45 -101
  45. package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +14 -15
  46. package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
  47. package/dist/cjs/api/resources/ocr/client/Client.d.ts +14 -11
  48. package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
  49. package/dist/cjs/api/resources/organization/client/Client.d.ts +20 -21
  50. package/dist/cjs/api/resources/organization/client/Client.js +35 -130
  51. package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +27 -28
  52. package/dist/cjs/api/resources/paymentLink/client/Client.js +46 -167
  53. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataBill.d.ts +1 -1
  54. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.ts +1 -1
  55. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataOut.d.ts +1 -1
  56. package/dist/cjs/api/resources/paymentLink/types/PaymentPageRequestBody.d.ts +2 -2
  57. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +20 -21
  58. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
  59. package/dist/cjs/api/resources/paypoint/client/Client.d.ts +23 -24
  60. package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
  61. package/dist/cjs/api/resources/query/client/Client.d.ts +72 -73
  62. package/dist/cjs/api/resources/query/client/Client.js +137 -572
  63. package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
  64. package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
  65. package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
  66. package/dist/cjs/api/resources/statistic/client/Client.d.ts +51 -52
  67. package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
  68. package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
  69. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
  70. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
  71. package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
  72. package/dist/cjs/api/resources/statistic/types/index.js +1 -0
  73. package/dist/cjs/api/resources/subscription/client/Client.d.ts +14 -15
  74. package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
  75. package/dist/cjs/api/resources/templates/client/Client.d.ts +16 -17
  76. package/dist/cjs/api/resources/templates/client/Client.js +28 -84
  77. package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +14 -15
  78. package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
  79. package/dist/cjs/api/resources/tokenStorage/types/GetMethodResponse.d.ts +1 -1
  80. package/dist/cjs/api/resources/user/client/Client.d.ts +55 -34
  81. package/dist/cjs/api/resources/user/client/Client.js +84 -222
  82. package/dist/cjs/api/resources/vendor/client/Client.d.ts +14 -15
  83. package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
  84. package/dist/cjs/api/resources/wallet/client/Client.d.ts +14 -15
  85. package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
  86. package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
  87. package/dist/cjs/api/types/Frequency.d.ts +1 -1
  88. package/dist/cjs/api/types/Frequency.js +1 -1
  89. package/dist/cjs/api/types/FrequencyList.d.ts +1 -1
  90. package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
  91. package/dist/cjs/api/types/NotificationContent.js +1 -0
  92. package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
  93. package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
  94. package/dist/cjs/api/types/PayorDataResponse.d.ts +1 -1
  95. package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
  96. package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -0
  97. package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
  98. package/dist/cjs/auth/index.d.ts +1 -0
  99. package/dist/cjs/auth/index.js +5 -0
  100. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  101. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  102. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  103. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  104. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  105. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  106. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  107. package/dist/cjs/core/auth/BearerToken.js +16 -0
  108. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  109. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  110. package/dist/cjs/core/auth/index.d.ts +5 -0
  111. package/dist/cjs/core/auth/index.js +9 -0
  112. package/dist/cjs/core/base64.d.ts +2 -0
  113. package/dist/cjs/core/base64.js +26 -0
  114. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
  115. package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
  116. package/dist/cjs/core/fetcher/Fetcher.js +42 -24
  117. package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
  118. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  119. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  120. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  121. package/dist/cjs/core/fetcher/signals.d.ts +1 -7
  122. package/dist/cjs/core/fetcher/signals.js +0 -12
  123. package/dist/cjs/core/index.d.ts +2 -0
  124. package/dist/cjs/core/index.js +2 -0
  125. package/dist/cjs/core/logging/logger.js +1 -1
  126. package/dist/cjs/core/runtime/runtime.js +11 -10
  127. package/dist/cjs/core/url/join.js +0 -1
  128. package/dist/cjs/errors/PayabliError.js +5 -1
  129. package/dist/cjs/errors/PayabliTimeoutError.js +5 -1
  130. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  131. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  132. package/dist/cjs/version.d.ts +1 -1
  133. package/dist/cjs/version.js +1 -1
  134. package/dist/esm/BaseClient.d.mts +13 -4
  135. package/dist/esm/BaseClient.mjs +24 -1
  136. package/dist/esm/Client.d.mts +88 -88
  137. package/dist/esm/Client.mjs +59 -67
  138. package/dist/esm/api/errors/BadRequestError.mjs +5 -1
  139. package/dist/esm/api/errors/ConflictError.mjs +5 -1
  140. package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
  141. package/dist/esm/api/errors/InternalServerError.mjs +5 -1
  142. package/dist/esm/api/errors/ServiceUnavailableError.mjs +5 -1
  143. package/dist/esm/api/errors/UnauthorizedError.mjs +5 -1
  144. package/dist/esm/api/resources/bill/client/Client.d.mts +34 -35
  145. package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
  146. package/dist/esm/api/resources/boarding/client/Client.d.mts +28 -29
  147. package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
  148. package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +18 -17
  149. package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
  150. package/dist/esm/api/resources/checkCapture/client/Client.d.mts +8 -9
  151. package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
  152. package/dist/esm/api/resources/cloud/client/Client.d.mts +18 -19
  153. package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
  154. package/dist/esm/api/resources/customer/client/Client.d.mts +18 -19
  155. package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
  156. package/dist/esm/api/resources/export/client/Client.d.mts +94 -91
  157. package/dist/esm/api/resources/export/client/Client.mjs +204 -581
  158. package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +12 -13
  159. package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
  160. package/dist/esm/api/resources/import/client/Client.d.mts +12 -13
  161. package/dist/esm/api/resources/import/client/Client.mjs +17 -60
  162. package/dist/esm/api/resources/invoice/client/Client.d.mts +37 -36
  163. package/dist/esm/api/resources/invoice/client/Client.mjs +65 -210
  164. package/dist/esm/api/resources/invoice/client/requests/AddInvoiceRequest.d.mts +5 -3
  165. package/dist/esm/api/resources/lineItem/client/Client.d.mts +16 -17
  166. package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
  167. package/dist/esm/api/resources/moneyIn/client/Client.d.mts +40 -41
  168. package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
  169. package/dist/esm/api/resources/moneyIn/errors/CaptureError.mjs +5 -1
  170. package/dist/esm/api/resources/moneyIn/errors/InvalidTransStatusError.mjs +5 -1
  171. package/dist/esm/api/resources/moneyOut/client/Client.d.mts +44 -28
  172. package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
  173. package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
  174. package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
  175. package/dist/esm/api/resources/notification/client/Client.d.mts +30 -18
  176. package/dist/esm/api/resources/notification/client/Client.mjs +44 -100
  177. package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +14 -15
  178. package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
  179. package/dist/esm/api/resources/ocr/client/Client.d.mts +14 -11
  180. package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
  181. package/dist/esm/api/resources/organization/client/Client.d.mts +20 -21
  182. package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
  183. package/dist/esm/api/resources/paymentLink/client/Client.d.mts +27 -28
  184. package/dist/esm/api/resources/paymentLink/client/Client.mjs +44 -165
  185. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataBill.d.mts +1 -1
  186. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.mts +1 -1
  187. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataOut.d.mts +1 -1
  188. package/dist/esm/api/resources/paymentLink/types/PaymentPageRequestBody.d.mts +2 -2
  189. package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +20 -21
  190. package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
  191. package/dist/esm/api/resources/paypoint/client/Client.d.mts +23 -24
  192. package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
  193. package/dist/esm/api/resources/query/client/Client.d.mts +72 -73
  194. package/dist/esm/api/resources/query/client/Client.mjs +136 -571
  195. package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
  196. package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
  197. package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
  198. package/dist/esm/api/resources/statistic/client/Client.d.mts +51 -52
  199. package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
  200. package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
  201. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
  202. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
  203. package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
  204. package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
  205. package/dist/esm/api/resources/subscription/client/Client.d.mts +14 -15
  206. package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
  207. package/dist/esm/api/resources/templates/client/Client.d.mts +16 -17
  208. package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
  209. package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +14 -15
  210. package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
  211. package/dist/esm/api/resources/tokenStorage/types/GetMethodResponse.d.mts +1 -1
  212. package/dist/esm/api/resources/user/client/Client.d.mts +55 -34
  213. package/dist/esm/api/resources/user/client/Client.mjs +83 -221
  214. package/dist/esm/api/resources/vendor/client/Client.d.mts +14 -15
  215. package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
  216. package/dist/esm/api/resources/wallet/client/Client.d.mts +14 -15
  217. package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
  218. package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
  219. package/dist/esm/api/types/Frequency.d.mts +1 -1
  220. package/dist/esm/api/types/Frequency.mjs +1 -1
  221. package/dist/esm/api/types/FrequencyList.d.mts +1 -1
  222. package/dist/esm/api/types/NotificationContent.d.mts +1 -0
  223. package/dist/esm/api/types/NotificationContent.mjs +1 -0
  224. package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
  225. package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
  226. package/dist/esm/api/types/PayorDataResponse.d.mts +1 -1
  227. package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
  228. package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -0
  229. package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
  230. package/dist/esm/auth/index.d.mts +1 -0
  231. package/dist/esm/auth/index.mjs +1 -0
  232. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  233. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  234. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  235. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  236. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  237. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  238. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  239. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  240. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  241. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  242. package/dist/esm/core/auth/index.d.mts +5 -0
  243. package/dist/esm/core/auth/index.mjs +3 -0
  244. package/dist/esm/core/base64.d.mts +2 -0
  245. package/dist/esm/core/base64.mjs +22 -0
  246. package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
  247. package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
  248. package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
  249. package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
  250. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  251. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  252. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  253. package/dist/esm/core/fetcher/signals.d.mts +1 -7
  254. package/dist/esm/core/fetcher/signals.mjs +0 -12
  255. package/dist/esm/core/index.d.mts +2 -0
  256. package/dist/esm/core/index.mjs +2 -0
  257. package/dist/esm/core/logging/logger.mjs +1 -1
  258. package/dist/esm/core/runtime/runtime.mjs +11 -10
  259. package/dist/esm/core/url/join.mjs +0 -1
  260. package/dist/esm/errors/PayabliError.mjs +5 -1
  261. package/dist/esm/errors/PayabliTimeoutError.mjs +5 -1
  262. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  263. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  264. package/dist/esm/version.d.mts +1 -1
  265. package/dist/esm/version.mjs +1 -1
  266. package/package.json +5 -2
  267. package/reference.md +768 -478
  268. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  269. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  270. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  271. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
@@ -8,15 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
11
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
12
13
  import * as core from "../../../../core/index.mjs";
13
14
  import { toJson } from "../../../../core/json.mjs";
14
15
  import * as environments from "../../../../environments.mjs";
16
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
15
17
  import * as errors from "../../../../errors/index.mjs";
16
18
  import * as Payabli from "../../../index.mjs";
17
- export class Query {
18
- constructor(_options = {}) {
19
- this._options = _options;
19
+ export class QueryClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
20
22
  }
21
23
  /**
22
24
  * Retrieve a list of batches and their details, including settled and
@@ -24,7 +26,7 @@ export class Query {
24
26
  *
25
27
  * @param {Payabli.Entry} entry
26
28
  * @param {Payabli.ListBatchDetailsRequest} request
27
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
29
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
28
30
  *
29
31
  * @throws {@link Payabli.BadRequestError}
30
32
  * @throws {@link Payabli.UnauthorizedError}
@@ -61,7 +63,8 @@ export class Query {
61
63
  if (sortBy != null) {
62
64
  _queryParams.sortBy = sortBy;
63
65
  }
64
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
66
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
67
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
65
68
  const _response = yield core.fetcher({
66
69
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batchDetails/${core.url.encodePathParam(entry)}`),
67
70
  method: "GET",
@@ -94,21 +97,7 @@ export class Query {
94
97
  });
95
98
  }
96
99
  }
97
- switch (_response.error.reason) {
98
- case "non-json":
99
- throw new errors.PayabliError({
100
- statusCode: _response.error.statusCode,
101
- body: _response.error.rawBody,
102
- rawResponse: _response.rawResponse,
103
- });
104
- case "timeout":
105
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchDetails/{entry}.");
106
- case "unknown":
107
- throw new errors.PayabliError({
108
- message: _response.error.errorMessage,
109
- rawResponse: _response.rawResponse,
110
- });
111
- }
100
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchDetails/{entry}");
112
101
  });
113
102
  }
114
103
  /**
@@ -116,7 +105,7 @@ export class Query {
116
105
  *
117
106
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
118
107
  * @param {Payabli.ListBatchDetailsOrgRequest} request
119
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
108
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
120
109
  *
121
110
  * @throws {@link Payabli.BadRequestError}
122
111
  * @throws {@link Payabli.UnauthorizedError}
@@ -153,7 +142,8 @@ export class Query {
153
142
  if (sortBy != null) {
154
143
  _queryParams.sortBy = sortBy;
155
144
  }
156
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
145
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
146
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
157
147
  const _response = yield core.fetcher({
158
148
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batchDetails/org/${core.url.encodePathParam(orgId)}`),
159
149
  method: "GET",
@@ -186,21 +176,7 @@ export class Query {
186
176
  });
187
177
  }
188
178
  }
189
- switch (_response.error.reason) {
190
- case "non-json":
191
- throw new errors.PayabliError({
192
- statusCode: _response.error.statusCode,
193
- body: _response.error.rawBody,
194
- rawResponse: _response.rawResponse,
195
- });
196
- case "timeout":
197
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchDetails/org/{orgId}.");
198
- case "unknown":
199
- throw new errors.PayabliError({
200
- message: _response.error.errorMessage,
201
- rawResponse: _response.rawResponse,
202
- });
203
- }
179
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchDetails/org/{orgId}");
204
180
  });
205
181
  }
206
182
  /**
@@ -208,7 +184,7 @@ export class Query {
208
184
  *
209
185
  * @param {Payabli.Entry} entry
210
186
  * @param {Payabli.ListBatchesRequest} request
211
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
187
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
212
188
  *
213
189
  * @throws {@link Payabli.BadRequestError}
214
190
  * @throws {@link Payabli.UnauthorizedError}
@@ -245,7 +221,8 @@ export class Query {
245
221
  if (sortBy != null) {
246
222
  _queryParams.sortBy = sortBy;
247
223
  }
248
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
224
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
225
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
249
226
  const _response = yield core.fetcher({
250
227
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batches/${core.url.encodePathParam(entry)}`),
251
228
  method: "GET",
@@ -278,21 +255,7 @@ export class Query {
278
255
  });
279
256
  }
280
257
  }
281
- switch (_response.error.reason) {
282
- case "non-json":
283
- throw new errors.PayabliError({
284
- statusCode: _response.error.statusCode,
285
- body: _response.error.rawBody,
286
- rawResponse: _response.rawResponse,
287
- });
288
- case "timeout":
289
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batches/{entry}.");
290
- case "unknown":
291
- throw new errors.PayabliError({
292
- message: _response.error.errorMessage,
293
- rawResponse: _response.rawResponse,
294
- });
295
- }
258
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batches/{entry}");
296
259
  });
297
260
  }
298
261
  /**
@@ -300,7 +263,7 @@ export class Query {
300
263
  *
301
264
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
302
265
  * @param {Payabli.ListBatchesOrgRequest} request
303
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
266
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
304
267
  *
305
268
  * @throws {@link Payabli.BadRequestError}
306
269
  * @throws {@link Payabli.UnauthorizedError}
@@ -337,7 +300,8 @@ export class Query {
337
300
  if (sortBy != null) {
338
301
  _queryParams.sortBy = sortBy;
339
302
  }
340
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
303
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
304
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
341
305
  const _response = yield core.fetcher({
342
306
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batches/org/${core.url.encodePathParam(orgId)}`),
343
307
  method: "GET",
@@ -370,21 +334,7 @@ export class Query {
370
334
  });
371
335
  }
372
336
  }
373
- switch (_response.error.reason) {
374
- case "non-json":
375
- throw new errors.PayabliError({
376
- statusCode: _response.error.statusCode,
377
- body: _response.error.rawBody,
378
- rawResponse: _response.rawResponse,
379
- });
380
- case "timeout":
381
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batches/org/{orgId}.");
382
- case "unknown":
383
- throw new errors.PayabliError({
384
- message: _response.error.errorMessage,
385
- rawResponse: _response.rawResponse,
386
- });
387
- }
337
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batches/org/{orgId}");
388
338
  });
389
339
  }
390
340
  /**
@@ -392,7 +342,7 @@ export class Query {
392
342
  *
393
343
  * @param {Payabli.Entry} entry
394
344
  * @param {Payabli.ListBatchesOutRequest} request
395
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
345
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
396
346
  *
397
347
  * @throws {@link Payabli.BadRequestError}
398
348
  * @throws {@link Payabli.UnauthorizedError}
@@ -429,7 +379,8 @@ export class Query {
429
379
  if (sortBy != null) {
430
380
  _queryParams.sortBy = sortBy;
431
381
  }
432
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
382
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
383
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
433
384
  const _response = yield core.fetcher({
434
385
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batchesOut/${core.url.encodePathParam(entry)}`),
435
386
  method: "GET",
@@ -462,21 +413,7 @@ export class Query {
462
413
  });
463
414
  }
464
415
  }
465
- switch (_response.error.reason) {
466
- case "non-json":
467
- throw new errors.PayabliError({
468
- statusCode: _response.error.statusCode,
469
- body: _response.error.rawBody,
470
- rawResponse: _response.rawResponse,
471
- });
472
- case "timeout":
473
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchesOut/{entry}.");
474
- case "unknown":
475
- throw new errors.PayabliError({
476
- message: _response.error.errorMessage,
477
- rawResponse: _response.rawResponse,
478
- });
479
- }
416
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchesOut/{entry}");
480
417
  });
481
418
  }
482
419
  /**
@@ -484,7 +421,7 @@ export class Query {
484
421
  *
485
422
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
486
423
  * @param {Payabli.ListBatchesOutOrgRequest} request
487
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
424
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
488
425
  *
489
426
  * @throws {@link Payabli.BadRequestError}
490
427
  * @throws {@link Payabli.UnauthorizedError}
@@ -521,7 +458,8 @@ export class Query {
521
458
  if (sortBy != null) {
522
459
  _queryParams.sortBy = sortBy;
523
460
  }
524
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
461
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
462
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
525
463
  const _response = yield core.fetcher({
526
464
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/batchesOut/org/${core.url.encodePathParam(orgId)}`),
527
465
  method: "GET",
@@ -554,21 +492,7 @@ export class Query {
554
492
  });
555
493
  }
556
494
  }
557
- switch (_response.error.reason) {
558
- case "non-json":
559
- throw new errors.PayabliError({
560
- statusCode: _response.error.statusCode,
561
- body: _response.error.rawBody,
562
- rawResponse: _response.rawResponse,
563
- });
564
- case "timeout":
565
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchesOut/org/{orgId}.");
566
- case "unknown":
567
- throw new errors.PayabliError({
568
- message: _response.error.errorMessage,
569
- rawResponse: _response.rawResponse,
570
- });
571
- }
495
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchesOut/org/{orgId}");
572
496
  });
573
497
  }
574
498
  /**
@@ -576,7 +500,7 @@ export class Query {
576
500
  *
577
501
  * @param {Payabli.Entry} entry
578
502
  * @param {Payabli.ListChargebacksRequest} request
579
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
503
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
580
504
  *
581
505
  * @throws {@link Payabli.BadRequestError}
582
506
  * @throws {@link Payabli.UnauthorizedError}
@@ -613,7 +537,8 @@ export class Query {
613
537
  if (sortBy != null) {
614
538
  _queryParams.sortBy = sortBy;
615
539
  }
616
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
540
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
541
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
617
542
  const _response = yield core.fetcher({
618
543
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/chargebacks/${core.url.encodePathParam(entry)}`),
619
544
  method: "GET",
@@ -646,21 +571,7 @@ export class Query {
646
571
  });
647
572
  }
648
573
  }
649
- switch (_response.error.reason) {
650
- case "non-json":
651
- throw new errors.PayabliError({
652
- statusCode: _response.error.statusCode,
653
- body: _response.error.rawBody,
654
- rawResponse: _response.rawResponse,
655
- });
656
- case "timeout":
657
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/chargebacks/{entry}.");
658
- case "unknown":
659
- throw new errors.PayabliError({
660
- message: _response.error.errorMessage,
661
- rawResponse: _response.rawResponse,
662
- });
663
- }
574
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/chargebacks/{entry}");
664
575
  });
665
576
  }
666
577
  /**
@@ -668,7 +579,7 @@ export class Query {
668
579
  *
669
580
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
670
581
  * @param {Payabli.ListChargebacksOrgRequest} request
671
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
582
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
672
583
  *
673
584
  * @throws {@link Payabli.BadRequestError}
674
585
  * @throws {@link Payabli.UnauthorizedError}
@@ -705,7 +616,8 @@ export class Query {
705
616
  if (sortBy != null) {
706
617
  _queryParams.sortBy = sortBy;
707
618
  }
708
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
619
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
620
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
709
621
  const _response = yield core.fetcher({
710
622
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/chargebacks/org/${core.url.encodePathParam(orgId)}`),
711
623
  method: "GET",
@@ -738,21 +650,7 @@ export class Query {
738
650
  });
739
651
  }
740
652
  }
741
- switch (_response.error.reason) {
742
- case "non-json":
743
- throw new errors.PayabliError({
744
- statusCode: _response.error.statusCode,
745
- body: _response.error.rawBody,
746
- rawResponse: _response.rawResponse,
747
- });
748
- case "timeout":
749
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/chargebacks/org/{orgId}.");
750
- case "unknown":
751
- throw new errors.PayabliError({
752
- message: _response.error.errorMessage,
753
- rawResponse: _response.rawResponse,
754
- });
755
- }
653
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/chargebacks/org/{orgId}");
756
654
  });
757
655
  }
758
656
  /**
@@ -760,7 +658,7 @@ export class Query {
760
658
  *
761
659
  * @param {Payabli.Entry} entry
762
660
  * @param {Payabli.ListCustomersRequest} request
763
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
661
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
764
662
  *
765
663
  * @throws {@link Payabli.BadRequestError}
766
664
  * @throws {@link Payabli.UnauthorizedError}
@@ -797,7 +695,8 @@ export class Query {
797
695
  if (sortBy != null) {
798
696
  _queryParams.sortBy = sortBy;
799
697
  }
800
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
698
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
699
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
801
700
  const _response = yield core.fetcher({
802
701
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/customers/${core.url.encodePathParam(entry)}`),
803
702
  method: "GET",
@@ -830,21 +729,7 @@ export class Query {
830
729
  });
831
730
  }
832
731
  }
833
- switch (_response.error.reason) {
834
- case "non-json":
835
- throw new errors.PayabliError({
836
- statusCode: _response.error.statusCode,
837
- body: _response.error.rawBody,
838
- rawResponse: _response.rawResponse,
839
- });
840
- case "timeout":
841
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/customers/{entry}.");
842
- case "unknown":
843
- throw new errors.PayabliError({
844
- message: _response.error.errorMessage,
845
- rawResponse: _response.rawResponse,
846
- });
847
- }
732
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/customers/{entry}");
848
733
  });
849
734
  }
850
735
  /**
@@ -852,7 +737,7 @@ export class Query {
852
737
  *
853
738
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
854
739
  * @param {Payabli.ListCustomersOrgRequest} request
855
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
740
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
856
741
  *
857
742
  * @throws {@link Payabli.BadRequestError}
858
743
  * @throws {@link Payabli.UnauthorizedError}
@@ -889,7 +774,8 @@ export class Query {
889
774
  if (sortBy != null) {
890
775
  _queryParams.sortBy = sortBy;
891
776
  }
892
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
777
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
778
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
893
779
  const _response = yield core.fetcher({
894
780
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/customers/org/${core.url.encodePathParam(orgId)}`),
895
781
  method: "GET",
@@ -922,21 +808,7 @@ export class Query {
922
808
  });
923
809
  }
924
810
  }
925
- switch (_response.error.reason) {
926
- case "non-json":
927
- throw new errors.PayabliError({
928
- statusCode: _response.error.statusCode,
929
- body: _response.error.rawBody,
930
- rawResponse: _response.rawResponse,
931
- });
932
- case "timeout":
933
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/customers/org/{orgId}.");
934
- case "unknown":
935
- throw new errors.PayabliError({
936
- message: _response.error.errorMessage,
937
- rawResponse: _response.rawResponse,
938
- });
939
- }
811
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/customers/org/{orgId}");
940
812
  });
941
813
  }
942
814
  /**
@@ -944,7 +816,7 @@ export class Query {
944
816
  *
945
817
  * @param {Payabli.Entry} entry
946
818
  * @param {Payabli.ListNotificationReportsRequest} request
947
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
819
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
948
820
  *
949
821
  * @throws {@link Payabli.BadRequestError}
950
822
  * @throws {@link Payabli.UnauthorizedError}
@@ -978,7 +850,8 @@ export class Query {
978
850
  if (sortBy != null) {
979
851
  _queryParams.sortBy = sortBy;
980
852
  }
981
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
853
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
854
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
982
855
  const _response = yield core.fetcher({
983
856
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/notificationReports/${core.url.encodePathParam(entry)}`),
984
857
  method: "GET",
@@ -1014,21 +887,7 @@ export class Query {
1014
887
  });
1015
888
  }
1016
889
  }
1017
- switch (_response.error.reason) {
1018
- case "non-json":
1019
- throw new errors.PayabliError({
1020
- statusCode: _response.error.statusCode,
1021
- body: _response.error.rawBody,
1022
- rawResponse: _response.rawResponse,
1023
- });
1024
- case "timeout":
1025
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/notificationReports/{entry}.");
1026
- case "unknown":
1027
- throw new errors.PayabliError({
1028
- message: _response.error.errorMessage,
1029
- rawResponse: _response.rawResponse,
1030
- });
1031
- }
890
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/notificationReports/{entry}");
1032
891
  });
1033
892
  }
1034
893
  /**
@@ -1036,7 +895,7 @@ export class Query {
1036
895
  *
1037
896
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1038
897
  * @param {Payabli.ListNotificationReportsOrgRequest} request
1039
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
898
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1040
899
  *
1041
900
  * @throws {@link Payabli.BadRequestError}
1042
901
  * @throws {@link Payabli.UnauthorizedError}
@@ -1070,7 +929,8 @@ export class Query {
1070
929
  if (sortBy != null) {
1071
930
  _queryParams.sortBy = sortBy;
1072
931
  }
1073
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
932
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
933
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1074
934
  const _response = yield core.fetcher({
1075
935
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/notificationReports/org/${core.url.encodePathParam(orgId)}`),
1076
936
  method: "GET",
@@ -1106,21 +966,7 @@ export class Query {
1106
966
  });
1107
967
  }
1108
968
  }
1109
- switch (_response.error.reason) {
1110
- case "non-json":
1111
- throw new errors.PayabliError({
1112
- statusCode: _response.error.statusCode,
1113
- body: _response.error.rawBody,
1114
- rawResponse: _response.rawResponse,
1115
- });
1116
- case "timeout":
1117
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/notificationReports/org/{orgId}.");
1118
- case "unknown":
1119
- throw new errors.PayabliError({
1120
- message: _response.error.errorMessage,
1121
- rawResponse: _response.rawResponse,
1122
- });
1123
- }
969
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/notificationReports/org/{orgId}");
1124
970
  });
1125
971
  }
1126
972
  /**
@@ -1128,7 +974,7 @@ export class Query {
1128
974
  *
1129
975
  * @param {Payabli.Entry} entry
1130
976
  * @param {Payabli.ListNotificationsRequest} request
1131
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
977
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1132
978
  *
1133
979
  * @throws {@link Payabli.BadRequestError}
1134
980
  * @throws {@link Payabli.UnauthorizedError}
@@ -1162,7 +1008,8 @@ export class Query {
1162
1008
  if (sortBy != null) {
1163
1009
  _queryParams.sortBy = sortBy;
1164
1010
  }
1165
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1011
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1012
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1166
1013
  const _response = yield core.fetcher({
1167
1014
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/notifications/${core.url.encodePathParam(entry)}`),
1168
1015
  method: "GET",
@@ -1195,21 +1042,7 @@ export class Query {
1195
1042
  });
1196
1043
  }
1197
1044
  }
1198
- switch (_response.error.reason) {
1199
- case "non-json":
1200
- throw new errors.PayabliError({
1201
- statusCode: _response.error.statusCode,
1202
- body: _response.error.rawBody,
1203
- rawResponse: _response.rawResponse,
1204
- });
1205
- case "timeout":
1206
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/notifications/{entry}.");
1207
- case "unknown":
1208
- throw new errors.PayabliError({
1209
- message: _response.error.errorMessage,
1210
- rawResponse: _response.rawResponse,
1211
- });
1212
- }
1045
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/notifications/{entry}");
1213
1046
  });
1214
1047
  }
1215
1048
  /**
@@ -1217,7 +1050,7 @@ export class Query {
1217
1050
  *
1218
1051
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1219
1052
  * @param {Payabli.ListNotificationsOrgRequest} request
1220
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1053
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1221
1054
  *
1222
1055
  * @throws {@link Payabli.BadRequestError}
1223
1056
  * @throws {@link Payabli.UnauthorizedError}
@@ -1251,7 +1084,8 @@ export class Query {
1251
1084
  if (sortBy != null) {
1252
1085
  _queryParams.sortBy = sortBy;
1253
1086
  }
1254
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1087
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1088
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1255
1089
  const _response = yield core.fetcher({
1256
1090
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/notifications/org/${core.url.encodePathParam(orgId)}`),
1257
1091
  method: "GET",
@@ -1284,21 +1118,7 @@ export class Query {
1284
1118
  });
1285
1119
  }
1286
1120
  }
1287
- switch (_response.error.reason) {
1288
- case "non-json":
1289
- throw new errors.PayabliError({
1290
- statusCode: _response.error.statusCode,
1291
- body: _response.error.rawBody,
1292
- rawResponse: _response.rawResponse,
1293
- });
1294
- case "timeout":
1295
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/notifications/org/{orgId}.");
1296
- case "unknown":
1297
- throw new errors.PayabliError({
1298
- message: _response.error.errorMessage,
1299
- rawResponse: _response.rawResponse,
1300
- });
1301
- }
1121
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/notifications/org/{orgId}");
1302
1122
  });
1303
1123
  }
1304
1124
  /**
@@ -1306,7 +1126,7 @@ export class Query {
1306
1126
  *
1307
1127
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1308
1128
  * @param {Payabli.ListOrganizationsRequest} request
1309
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1129
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1310
1130
  *
1311
1131
  * @throws {@link Payabli.BadRequestError}
1312
1132
  * @throws {@link Payabli.UnauthorizedError}
@@ -1343,7 +1163,8 @@ export class Query {
1343
1163
  if (sortBy != null) {
1344
1164
  _queryParams.sortBy = sortBy;
1345
1165
  }
1346
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1166
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1167
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1347
1168
  const _response = yield core.fetcher({
1348
1169
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/organizations/${core.url.encodePathParam(orgId)}`),
1349
1170
  method: "GET",
@@ -1376,21 +1197,7 @@ export class Query {
1376
1197
  });
1377
1198
  }
1378
1199
  }
1379
- switch (_response.error.reason) {
1380
- case "non-json":
1381
- throw new errors.PayabliError({
1382
- statusCode: _response.error.statusCode,
1383
- body: _response.error.rawBody,
1384
- rawResponse: _response.rawResponse,
1385
- });
1386
- case "timeout":
1387
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/organizations/{orgId}.");
1388
- case "unknown":
1389
- throw new errors.PayabliError({
1390
- message: _response.error.errorMessage,
1391
- rawResponse: _response.rawResponse,
1392
- });
1393
- }
1200
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/organizations/{orgId}");
1394
1201
  });
1395
1202
  }
1396
1203
  /**
@@ -1398,7 +1205,7 @@ export class Query {
1398
1205
  *
1399
1206
  * @param {Payabli.Entry} entry
1400
1207
  * @param {Payabli.ListPayoutRequest} request
1401
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1208
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1402
1209
  *
1403
1210
  * @throws {@link Payabli.BadRequestError}
1404
1211
  * @throws {@link Payabli.UnauthorizedError}
@@ -1435,7 +1242,8 @@ export class Query {
1435
1242
  if (sortBy != null) {
1436
1243
  _queryParams.sortBy = sortBy;
1437
1244
  }
1438
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1245
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1246
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1439
1247
  const _response = yield core.fetcher({
1440
1248
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/payouts/${core.url.encodePathParam(entry)}`),
1441
1249
  method: "GET",
@@ -1468,21 +1276,7 @@ export class Query {
1468
1276
  });
1469
1277
  }
1470
1278
  }
1471
- switch (_response.error.reason) {
1472
- case "non-json":
1473
- throw new errors.PayabliError({
1474
- statusCode: _response.error.statusCode,
1475
- body: _response.error.rawBody,
1476
- rawResponse: _response.rawResponse,
1477
- });
1478
- case "timeout":
1479
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/payouts/{entry}.");
1480
- case "unknown":
1481
- throw new errors.PayabliError({
1482
- message: _response.error.errorMessage,
1483
- rawResponse: _response.rawResponse,
1484
- });
1485
- }
1279
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/payouts/{entry}");
1486
1280
  });
1487
1281
  }
1488
1282
  /**
@@ -1490,7 +1284,7 @@ export class Query {
1490
1284
  *
1491
1285
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1492
1286
  * @param {Payabli.ListPayoutOrgRequest} request
1493
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1287
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1494
1288
  *
1495
1289
  * @throws {@link Payabli.BadRequestError}
1496
1290
  * @throws {@link Payabli.UnauthorizedError}
@@ -1527,7 +1321,8 @@ export class Query {
1527
1321
  if (sortBy != null) {
1528
1322
  _queryParams.sortBy = sortBy;
1529
1323
  }
1530
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1324
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1325
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1531
1326
  const _response = yield core.fetcher({
1532
1327
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/payouts/org/${core.url.encodePathParam(orgId)}`),
1533
1328
  method: "GET",
@@ -1560,21 +1355,7 @@ export class Query {
1560
1355
  });
1561
1356
  }
1562
1357
  }
1563
- switch (_response.error.reason) {
1564
- case "non-json":
1565
- throw new errors.PayabliError({
1566
- statusCode: _response.error.statusCode,
1567
- body: _response.error.rawBody,
1568
- rawResponse: _response.rawResponse,
1569
- });
1570
- case "timeout":
1571
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/payouts/org/{orgId}.");
1572
- case "unknown":
1573
- throw new errors.PayabliError({
1574
- message: _response.error.errorMessage,
1575
- rawResponse: _response.rawResponse,
1576
- });
1577
- }
1358
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/payouts/org/{orgId}");
1578
1359
  });
1579
1360
  }
1580
1361
  /**
@@ -1582,7 +1363,7 @@ export class Query {
1582
1363
  *
1583
1364
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1584
1365
  * @param {Payabli.ListPaypointsRequest} request
1585
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1366
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1586
1367
  *
1587
1368
  * @throws {@link Payabli.BadRequestError}
1588
1369
  * @throws {@link Payabli.UnauthorizedError}
@@ -1619,7 +1400,8 @@ export class Query {
1619
1400
  if (sortBy != null) {
1620
1401
  _queryParams.sortBy = sortBy;
1621
1402
  }
1622
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1403
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1404
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1623
1405
  const _response = yield core.fetcher({
1624
1406
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/paypoints/${core.url.encodePathParam(orgId)}`),
1625
1407
  method: "GET",
@@ -1652,21 +1434,7 @@ export class Query {
1652
1434
  });
1653
1435
  }
1654
1436
  }
1655
- switch (_response.error.reason) {
1656
- case "non-json":
1657
- throw new errors.PayabliError({
1658
- statusCode: _response.error.statusCode,
1659
- body: _response.error.rawBody,
1660
- rawResponse: _response.rawResponse,
1661
- });
1662
- case "timeout":
1663
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/paypoints/{orgId}.");
1664
- case "unknown":
1665
- throw new errors.PayabliError({
1666
- message: _response.error.errorMessage,
1667
- rawResponse: _response.rawResponse,
1668
- });
1669
- }
1437
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/paypoints/{orgId}");
1670
1438
  });
1671
1439
  }
1672
1440
  /**
@@ -1674,7 +1442,7 @@ export class Query {
1674
1442
  *
1675
1443
  * @param {Payabli.Entry} entry
1676
1444
  * @param {Payabli.ListSettlementsRequest} request
1677
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1445
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1678
1446
  *
1679
1447
  * @throws {@link Payabli.BadRequestError}
1680
1448
  * @throws {@link Payabli.UnauthorizedError}
@@ -1711,7 +1479,8 @@ export class Query {
1711
1479
  if (sortBy != null) {
1712
1480
  _queryParams.sortBy = sortBy;
1713
1481
  }
1714
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1482
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1483
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1715
1484
  const _response = yield core.fetcher({
1716
1485
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/settlements/${core.url.encodePathParam(entry)}`),
1717
1486
  method: "GET",
@@ -1744,21 +1513,7 @@ export class Query {
1744
1513
  });
1745
1514
  }
1746
1515
  }
1747
- switch (_response.error.reason) {
1748
- case "non-json":
1749
- throw new errors.PayabliError({
1750
- statusCode: _response.error.statusCode,
1751
- body: _response.error.rawBody,
1752
- rawResponse: _response.rawResponse,
1753
- });
1754
- case "timeout":
1755
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/settlements/{entry}.");
1756
- case "unknown":
1757
- throw new errors.PayabliError({
1758
- message: _response.error.errorMessage,
1759
- rawResponse: _response.rawResponse,
1760
- });
1761
- }
1516
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/settlements/{entry}");
1762
1517
  });
1763
1518
  }
1764
1519
  /**
@@ -1766,7 +1521,7 @@ export class Query {
1766
1521
  *
1767
1522
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1768
1523
  * @param {Payabli.ListSettlementsOrgRequest} request
1769
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1524
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1770
1525
  *
1771
1526
  * @throws {@link Payabli.BadRequestError}
1772
1527
  * @throws {@link Payabli.UnauthorizedError}
@@ -1803,7 +1558,8 @@ export class Query {
1803
1558
  if (sortBy != null) {
1804
1559
  _queryParams.sortBy = sortBy;
1805
1560
  }
1806
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1561
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1562
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1807
1563
  const _response = yield core.fetcher({
1808
1564
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/settlements/org/${core.url.encodePathParam(orgId)}`),
1809
1565
  method: "GET",
@@ -1836,21 +1592,7 @@ export class Query {
1836
1592
  });
1837
1593
  }
1838
1594
  }
1839
- switch (_response.error.reason) {
1840
- case "non-json":
1841
- throw new errors.PayabliError({
1842
- statusCode: _response.error.statusCode,
1843
- body: _response.error.rawBody,
1844
- rawResponse: _response.rawResponse,
1845
- });
1846
- case "timeout":
1847
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/settlements/org/{orgId}.");
1848
- case "unknown":
1849
- throw new errors.PayabliError({
1850
- message: _response.error.errorMessage,
1851
- rawResponse: _response.rawResponse,
1852
- });
1853
- }
1595
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/settlements/org/{orgId}");
1854
1596
  });
1855
1597
  }
1856
1598
  /**
@@ -1858,7 +1600,7 @@ export class Query {
1858
1600
  *
1859
1601
  * @param {Payabli.Entry} entry
1860
1602
  * @param {Payabli.ListSubscriptionsRequest} request
1861
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1603
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1862
1604
  *
1863
1605
  * @throws {@link Payabli.BadRequestError}
1864
1606
  * @throws {@link Payabli.UnauthorizedError}
@@ -1895,7 +1637,8 @@ export class Query {
1895
1637
  if (sortBy != null) {
1896
1638
  _queryParams.sortBy = sortBy;
1897
1639
  }
1898
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1640
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1641
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1899
1642
  const _response = yield core.fetcher({
1900
1643
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/subscriptions/${core.url.encodePathParam(entry)}`),
1901
1644
  method: "GET",
@@ -1928,21 +1671,7 @@ export class Query {
1928
1671
  });
1929
1672
  }
1930
1673
  }
1931
- switch (_response.error.reason) {
1932
- case "non-json":
1933
- throw new errors.PayabliError({
1934
- statusCode: _response.error.statusCode,
1935
- body: _response.error.rawBody,
1936
- rawResponse: _response.rawResponse,
1937
- });
1938
- case "timeout":
1939
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/subscriptions/{entry}.");
1940
- case "unknown":
1941
- throw new errors.PayabliError({
1942
- message: _response.error.errorMessage,
1943
- rawResponse: _response.rawResponse,
1944
- });
1945
- }
1674
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/subscriptions/{entry}");
1946
1675
  });
1947
1676
  }
1948
1677
  /**
@@ -1950,7 +1679,7 @@ export class Query {
1950
1679
  *
1951
1680
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1952
1681
  * @param {Payabli.ListSubscriptionsOrgRequest} request
1953
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1682
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
1954
1683
  *
1955
1684
  * @throws {@link Payabli.BadRequestError}
1956
1685
  * @throws {@link Payabli.UnauthorizedError}
@@ -1987,7 +1716,8 @@ export class Query {
1987
1716
  if (sortBy != null) {
1988
1717
  _queryParams.sortBy = sortBy;
1989
1718
  }
1990
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1719
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1720
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1991
1721
  const _response = yield core.fetcher({
1992
1722
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/subscriptions/org/${core.url.encodePathParam(orgId)}`),
1993
1723
  method: "GET",
@@ -2020,21 +1750,7 @@ export class Query {
2020
1750
  });
2021
1751
  }
2022
1752
  }
2023
- switch (_response.error.reason) {
2024
- case "non-json":
2025
- throw new errors.PayabliError({
2026
- statusCode: _response.error.statusCode,
2027
- body: _response.error.rawBody,
2028
- rawResponse: _response.rawResponse,
2029
- });
2030
- case "timeout":
2031
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/subscriptions/org/{orgId}.");
2032
- case "unknown":
2033
- throw new errors.PayabliError({
2034
- message: _response.error.errorMessage,
2035
- rawResponse: _response.rawResponse,
2036
- });
2037
- }
1753
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/subscriptions/org/{orgId}");
2038
1754
  });
2039
1755
  }
2040
1756
  /**
@@ -2049,7 +1765,7 @@ export class Query {
2049
1765
  *
2050
1766
  * @param {Payabli.Entry} entry
2051
1767
  * @param {Payabli.ListTransactionsRequest} request
2052
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1768
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2053
1769
  *
2054
1770
  * @throws {@link Payabli.BadRequestError}
2055
1771
  * @throws {@link Payabli.UnauthorizedError}
@@ -2086,7 +1802,8 @@ export class Query {
2086
1802
  if (sortBy != null) {
2087
1803
  _queryParams.sortBy = sortBy;
2088
1804
  }
2089
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1805
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1806
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2090
1807
  const _response = yield core.fetcher({
2091
1808
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/transactions/${core.url.encodePathParam(entry)}`),
2092
1809
  method: "GET",
@@ -2119,21 +1836,7 @@ export class Query {
2119
1836
  });
2120
1837
  }
2121
1838
  }
2122
- switch (_response.error.reason) {
2123
- case "non-json":
2124
- throw new errors.PayabliError({
2125
- statusCode: _response.error.statusCode,
2126
- body: _response.error.rawBody,
2127
- rawResponse: _response.rawResponse,
2128
- });
2129
- case "timeout":
2130
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transactions/{entry}.");
2131
- case "unknown":
2132
- throw new errors.PayabliError({
2133
- message: _response.error.errorMessage,
2134
- rawResponse: _response.rawResponse,
2135
- });
2136
- }
1839
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transactions/{entry}");
2137
1840
  });
2138
1841
  }
2139
1842
  /**
@@ -2155,7 +1858,7 @@ export class Query {
2155
1858
  *
2156
1859
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2157
1860
  * @param {Payabli.ListTransactionsOrgRequest} request
2158
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1861
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2159
1862
  *
2160
1863
  * @throws {@link Payabli.BadRequestError}
2161
1864
  * @throws {@link Payabli.UnauthorizedError}
@@ -2192,7 +1895,8 @@ export class Query {
2192
1895
  if (sortBy != null) {
2193
1896
  _queryParams.sortBy = sortBy;
2194
1897
  }
2195
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1898
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1899
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2196
1900
  const _response = yield core.fetcher({
2197
1901
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/transactions/org/${core.url.encodePathParam(orgId)}`),
2198
1902
  method: "GET",
@@ -2225,21 +1929,7 @@ export class Query {
2225
1929
  });
2226
1930
  }
2227
1931
  }
2228
- switch (_response.error.reason) {
2229
- case "non-json":
2230
- throw new errors.PayabliError({
2231
- statusCode: _response.error.statusCode,
2232
- body: _response.error.rawBody,
2233
- rawResponse: _response.rawResponse,
2234
- });
2235
- case "timeout":
2236
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transactions/org/{orgId}.");
2237
- case "unknown":
2238
- throw new errors.PayabliError({
2239
- message: _response.error.errorMessage,
2240
- rawResponse: _response.rawResponse,
2241
- });
2242
- }
1932
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transactions/org/{orgId}");
2243
1933
  });
2244
1934
  }
2245
1935
  /**
@@ -2248,7 +1938,7 @@ export class Query {
2248
1938
  * @param {Payabli.Entry} entry
2249
1939
  * @param {number} transferId - The numeric identifier for the transfer, assigned by Payabli.
2250
1940
  * @param {Payabli.ListTransfersPaypointRequest} request
2251
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
1941
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2252
1942
  *
2253
1943
  * @throws {@link Payabli.BadRequestError}
2254
1944
  * @throws {@link Payabli.UnauthorizedError}
@@ -2281,7 +1971,8 @@ export class Query {
2281
1971
  if (sortBy != null) {
2282
1972
  _queryParams.sortBy = sortBy;
2283
1973
  }
2284
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1974
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1975
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2285
1976
  const _response = yield core.fetcher({
2286
1977
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/transferDetails/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(transferId)}`),
2287
1978
  method: "GET",
@@ -2314,21 +2005,7 @@ export class Query {
2314
2005
  });
2315
2006
  }
2316
2007
  }
2317
- switch (_response.error.reason) {
2318
- case "non-json":
2319
- throw new errors.PayabliError({
2320
- statusCode: _response.error.statusCode,
2321
- body: _response.error.rawBody,
2322
- rawResponse: _response.rawResponse,
2323
- });
2324
- case "timeout":
2325
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transferDetails/{entry}/{transferId}.");
2326
- case "unknown":
2327
- throw new errors.PayabliError({
2328
- message: _response.error.errorMessage,
2329
- rawResponse: _response.rawResponse,
2330
- });
2331
- }
2008
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transferDetails/{entry}/{transferId}");
2332
2009
  });
2333
2010
  }
2334
2011
  /**
@@ -2336,7 +2013,7 @@ export class Query {
2336
2013
  *
2337
2014
  * @param {Payabli.Entry} entry
2338
2015
  * @param {Payabli.ListTransfersRequest} request
2339
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2016
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2340
2017
  *
2341
2018
  * @throws {@link Payabli.BadRequestError}
2342
2019
  * @throws {@link Payabli.UnauthorizedError}
@@ -2372,7 +2049,7 @@ export class Query {
2372
2049
  if (sortBy != null) {
2373
2050
  _queryParams.sortBy = sortBy;
2374
2051
  }
2375
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2052
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2376
2053
  const _response = yield core.fetcher({
2377
2054
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/transfers/${core.url.encodePathParam(entry)}`),
2378
2055
  method: "GET",
@@ -2405,28 +2082,14 @@ export class Query {
2405
2082
  });
2406
2083
  }
2407
2084
  }
2408
- switch (_response.error.reason) {
2409
- case "non-json":
2410
- throw new errors.PayabliError({
2411
- statusCode: _response.error.statusCode,
2412
- body: _response.error.rawBody,
2413
- rawResponse: _response.rawResponse,
2414
- });
2415
- case "timeout":
2416
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transfers/{entry}.");
2417
- case "unknown":
2418
- throw new errors.PayabliError({
2419
- message: _response.error.errorMessage,
2420
- rawResponse: _response.rawResponse,
2421
- });
2422
- }
2085
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transfers/{entry}");
2423
2086
  });
2424
2087
  }
2425
2088
  /**
2426
2089
  * Retrieve a list of transfers for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.
2427
2090
  *
2428
2091
  * @param {Payabli.ListTransfersRequestOrg} request
2429
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2092
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2430
2093
  *
2431
2094
  * @throws {@link Payabli.BadRequestError}
2432
2095
  * @throws {@link Payabli.UnauthorizedError}
@@ -2463,7 +2126,7 @@ export class Query {
2463
2126
  if (sortBy != null) {
2464
2127
  _queryParams.sortBy = sortBy;
2465
2128
  }
2466
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2129
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2467
2130
  const _response = yield core.fetcher({
2468
2131
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/transfers/org/${core.url.encodePathParam(orgId)}`),
2469
2132
  method: "GET",
@@ -2496,21 +2159,7 @@ export class Query {
2496
2159
  });
2497
2160
  }
2498
2161
  }
2499
- switch (_response.error.reason) {
2500
- case "non-json":
2501
- throw new errors.PayabliError({
2502
- statusCode: _response.error.statusCode,
2503
- body: _response.error.rawBody,
2504
- rawResponse: _response.rawResponse,
2505
- });
2506
- case "timeout":
2507
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transfers/org/{orgId}.");
2508
- case "unknown":
2509
- throw new errors.PayabliError({
2510
- message: _response.error.errorMessage,
2511
- rawResponse: _response.rawResponse,
2512
- });
2513
- }
2162
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transfers/org/{orgId}");
2514
2163
  });
2515
2164
  }
2516
2165
  /**
@@ -2518,7 +2167,7 @@ export class Query {
2518
2167
  *
2519
2168
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2520
2169
  * @param {Payabli.ListUsersOrgRequest} request
2521
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2170
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2522
2171
  *
2523
2172
  * @throws {@link Payabli.BadRequestError}
2524
2173
  * @throws {@link Payabli.UnauthorizedError}
@@ -2552,7 +2201,8 @@ export class Query {
2552
2201
  if (sortBy != null) {
2553
2202
  _queryParams.sortBy = sortBy;
2554
2203
  }
2555
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2204
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2205
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2556
2206
  const _response = yield core.fetcher({
2557
2207
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/users/org/${core.url.encodePathParam(orgId)}`),
2558
2208
  method: "GET",
@@ -2585,21 +2235,7 @@ export class Query {
2585
2235
  });
2586
2236
  }
2587
2237
  }
2588
- switch (_response.error.reason) {
2589
- case "non-json":
2590
- throw new errors.PayabliError({
2591
- statusCode: _response.error.statusCode,
2592
- body: _response.error.rawBody,
2593
- rawResponse: _response.rawResponse,
2594
- });
2595
- case "timeout":
2596
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/users/org/{orgId}.");
2597
- case "unknown":
2598
- throw new errors.PayabliError({
2599
- message: _response.error.errorMessage,
2600
- rawResponse: _response.rawResponse,
2601
- });
2602
- }
2238
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/users/org/{orgId}");
2603
2239
  });
2604
2240
  }
2605
2241
  /**
@@ -2607,7 +2243,7 @@ export class Query {
2607
2243
  *
2608
2244
  * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2609
2245
  * @param {Payabli.ListUsersPaypointRequest} request
2610
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2246
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2611
2247
  *
2612
2248
  * @throws {@link Payabli.BadRequestError}
2613
2249
  * @throws {@link Payabli.UnauthorizedError}
@@ -2641,7 +2277,8 @@ export class Query {
2641
2277
  if (sortBy != null) {
2642
2278
  _queryParams.sortBy = sortBy;
2643
2279
  }
2644
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2280
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2281
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2645
2282
  const _response = yield core.fetcher({
2646
2283
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/users/point/${core.url.encodePathParam(entry)}`),
2647
2284
  method: "GET",
@@ -2674,21 +2311,7 @@ export class Query {
2674
2311
  });
2675
2312
  }
2676
2313
  }
2677
- switch (_response.error.reason) {
2678
- case "non-json":
2679
- throw new errors.PayabliError({
2680
- statusCode: _response.error.statusCode,
2681
- body: _response.error.rawBody,
2682
- rawResponse: _response.rawResponse,
2683
- });
2684
- case "timeout":
2685
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/users/point/{entry}.");
2686
- case "unknown":
2687
- throw new errors.PayabliError({
2688
- message: _response.error.errorMessage,
2689
- rawResponse: _response.rawResponse,
2690
- });
2691
- }
2314
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/users/point/{entry}");
2692
2315
  });
2693
2316
  }
2694
2317
  /**
@@ -2696,7 +2319,7 @@ export class Query {
2696
2319
  *
2697
2320
  * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2698
2321
  * @param {Payabli.ListVendorsRequest} request
2699
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2322
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2700
2323
  *
2701
2324
  * @throws {@link Payabli.BadRequestError}
2702
2325
  * @throws {@link Payabli.UnauthorizedError}
@@ -2733,7 +2356,8 @@ export class Query {
2733
2356
  if (sortBy != null) {
2734
2357
  _queryParams.sortBy = sortBy;
2735
2358
  }
2736
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2359
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2360
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2737
2361
  const _response = yield core.fetcher({
2738
2362
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/vendors/${core.url.encodePathParam(entry)}`),
2739
2363
  method: "GET",
@@ -2766,21 +2390,7 @@ export class Query {
2766
2390
  });
2767
2391
  }
2768
2392
  }
2769
- switch (_response.error.reason) {
2770
- case "non-json":
2771
- throw new errors.PayabliError({
2772
- statusCode: _response.error.statusCode,
2773
- body: _response.error.rawBody,
2774
- rawResponse: _response.rawResponse,
2775
- });
2776
- case "timeout":
2777
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vendors/{entry}.");
2778
- case "unknown":
2779
- throw new errors.PayabliError({
2780
- message: _response.error.errorMessage,
2781
- rawResponse: _response.rawResponse,
2782
- });
2783
- }
2393
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vendors/{entry}");
2784
2394
  });
2785
2395
  }
2786
2396
  /**
@@ -2788,7 +2398,7 @@ export class Query {
2788
2398
  *
2789
2399
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2790
2400
  * @param {Payabli.ListVendorsOrgRequest} request
2791
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2401
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2792
2402
  *
2793
2403
  * @throws {@link Payabli.BadRequestError}
2794
2404
  * @throws {@link Payabli.UnauthorizedError}
@@ -2825,7 +2435,8 @@ export class Query {
2825
2435
  if (sortBy != null) {
2826
2436
  _queryParams.sortBy = sortBy;
2827
2437
  }
2828
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2438
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2439
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2829
2440
  const _response = yield core.fetcher({
2830
2441
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/vendors/org/${core.url.encodePathParam(orgId)}`),
2831
2442
  method: "GET",
@@ -2858,21 +2469,7 @@ export class Query {
2858
2469
  });
2859
2470
  }
2860
2471
  }
2861
- switch (_response.error.reason) {
2862
- case "non-json":
2863
- throw new errors.PayabliError({
2864
- statusCode: _response.error.statusCode,
2865
- body: _response.error.rawBody,
2866
- rawResponse: _response.rawResponse,
2867
- });
2868
- case "timeout":
2869
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vendors/org/{orgId}.");
2870
- case "unknown":
2871
- throw new errors.PayabliError({
2872
- message: _response.error.errorMessage,
2873
- rawResponse: _response.rawResponse,
2874
- });
2875
- }
2472
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vendors/org/{orgId}");
2876
2473
  });
2877
2474
  }
2878
2475
  /**
@@ -2880,7 +2477,7 @@ export class Query {
2880
2477
  *
2881
2478
  * @param {Payabli.Entry} entry
2882
2479
  * @param {Payabli.ListVcardsRequest} request
2883
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2480
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2884
2481
  *
2885
2482
  * @throws {@link Payabli.BadRequestError}
2886
2483
  * @throws {@link Payabli.UnauthorizedError}
@@ -2917,7 +2514,8 @@ export class Query {
2917
2514
  if (sortBy != null) {
2918
2515
  _queryParams.sortBy = sortBy;
2919
2516
  }
2920
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2517
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2518
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2921
2519
  const _response = yield core.fetcher({
2922
2520
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/vcards/${core.url.encodePathParam(entry)}`),
2923
2521
  method: "GET",
@@ -2950,21 +2548,7 @@ export class Query {
2950
2548
  });
2951
2549
  }
2952
2550
  }
2953
- switch (_response.error.reason) {
2954
- case "non-json":
2955
- throw new errors.PayabliError({
2956
- statusCode: _response.error.statusCode,
2957
- body: _response.error.rawBody,
2958
- rawResponse: _response.rawResponse,
2959
- });
2960
- case "timeout":
2961
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vcards/{entry}.");
2962
- case "unknown":
2963
- throw new errors.PayabliError({
2964
- message: _response.error.errorMessage,
2965
- rawResponse: _response.rawResponse,
2966
- });
2967
- }
2551
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vcards/{entry}");
2968
2552
  });
2969
2553
  }
2970
2554
  /**
@@ -2972,7 +2556,7 @@ export class Query {
2972
2556
  *
2973
2557
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2974
2558
  * @param {Payabli.ListVcardsOrgRequest} request
2975
- * @param {Query.RequestOptions} requestOptions - Request-specific configuration.
2559
+ * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration.
2976
2560
  *
2977
2561
  * @throws {@link Payabli.BadRequestError}
2978
2562
  * @throws {@link Payabli.UnauthorizedError}
@@ -3009,7 +2593,8 @@ export class Query {
3009
2593
  if (sortBy != null) {
3010
2594
  _queryParams.sortBy = sortBy;
3011
2595
  }
3012
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2596
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2597
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
3013
2598
  const _response = yield core.fetcher({
3014
2599
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PayabliEnvironment.Sandbox, `Query/vcards/org/${core.url.encodePathParam(orgId)}`),
3015
2600
  method: "GET",
@@ -3042,27 +2627,7 @@ export class Query {
3042
2627
  });
3043
2628
  }
3044
2629
  }
3045
- switch (_response.error.reason) {
3046
- case "non-json":
3047
- throw new errors.PayabliError({
3048
- statusCode: _response.error.statusCode,
3049
- body: _response.error.rawBody,
3050
- rawResponse: _response.rawResponse,
3051
- });
3052
- case "timeout":
3053
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vcards/org/{orgId}.");
3054
- case "unknown":
3055
- throw new errors.PayabliError({
3056
- message: _response.error.errorMessage,
3057
- rawResponse: _response.rawResponse,
3058
- });
3059
- }
3060
- });
3061
- }
3062
- _getCustomAuthorizationHeaders() {
3063
- return __awaiter(this, void 0, void 0, function* () {
3064
- const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
3065
- return { requestToken: apiKeyValue };
2630
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vcards/org/{orgId}");
3066
2631
  });
3067
2632
  }
3068
2633
  }