@payabli/sdk-node 0.0.116 → 0.0.117

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 (230) hide show
  1. package/README.md +24 -7
  2. package/dist/cjs/BaseClient.d.ts +10 -1
  3. package/dist/cjs/BaseClient.js +57 -0
  4. package/dist/cjs/Client.d.ts +87 -86
  5. package/dist/cjs/Client.js +31 -72
  6. package/dist/cjs/api/resources/bill/client/Client.d.ts +33 -33
  7. package/dist/cjs/api/resources/bill/client/Client.js +69 -216
  8. package/dist/cjs/api/resources/boarding/client/Client.d.ts +27 -27
  9. package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
  10. package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +17 -15
  11. package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
  12. package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +7 -7
  13. package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
  14. package/dist/cjs/api/resources/cloud/client/Client.d.ts +17 -17
  15. package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
  16. package/dist/cjs/api/resources/customer/client/Client.d.ts +17 -17
  17. package/dist/cjs/api/resources/customer/client/Client.js +31 -113
  18. package/dist/cjs/api/resources/export/client/Client.d.ts +93 -89
  19. package/dist/cjs/api/resources/export/client/Client.js +205 -582
  20. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +11 -11
  21. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
  22. package/dist/cjs/api/resources/import/client/Client.d.ts +11 -11
  23. package/dist/cjs/api/resources/import/client/Client.js +19 -62
  24. package/dist/cjs/api/resources/invoice/client/Client.d.ts +31 -31
  25. package/dist/cjs/api/resources/invoice/client/Client.js +62 -209
  26. package/dist/cjs/api/resources/lineItem/client/Client.d.ts +15 -15
  27. package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
  28. package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +39 -39
  29. package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
  30. package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +43 -26
  31. package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
  32. package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
  33. package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
  34. package/dist/cjs/api/resources/notification/client/Client.d.ts +16 -16
  35. package/dist/cjs/api/resources/notification/client/Client.js +32 -101
  36. package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +13 -13
  37. package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
  38. package/dist/cjs/api/resources/ocr/client/Client.d.ts +13 -9
  39. package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
  40. package/dist/cjs/api/resources/organization/client/Client.d.ts +19 -19
  41. package/dist/cjs/api/resources/organization/client/Client.js +35 -130
  42. package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +23 -23
  43. package/dist/cjs/api/resources/paymentLink/client/Client.js +43 -164
  44. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +19 -19
  45. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
  46. package/dist/cjs/api/resources/paypoint/client/Client.d.ts +22 -22
  47. package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
  48. package/dist/cjs/api/resources/query/client/Client.d.ts +71 -71
  49. package/dist/cjs/api/resources/query/client/Client.js +137 -572
  50. package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
  51. package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
  52. package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
  53. package/dist/cjs/api/resources/statistic/client/Client.d.ts +50 -50
  54. package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
  55. package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
  56. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
  57. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
  58. package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
  59. package/dist/cjs/api/resources/statistic/types/index.js +1 -0
  60. package/dist/cjs/api/resources/subscription/client/Client.d.ts +13 -13
  61. package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
  62. package/dist/cjs/api/resources/templates/client/Client.d.ts +15 -15
  63. package/dist/cjs/api/resources/templates/client/Client.js +28 -84
  64. package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +13 -13
  65. package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
  66. package/dist/cjs/api/resources/user/client/Client.d.ts +54 -32
  67. package/dist/cjs/api/resources/user/client/Client.js +84 -222
  68. package/dist/cjs/api/resources/vendor/client/Client.d.ts +13 -13
  69. package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
  70. package/dist/cjs/api/resources/wallet/client/Client.d.ts +13 -13
  71. package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
  72. package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
  73. package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
  74. package/dist/cjs/api/types/NotificationContent.js +1 -0
  75. package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
  76. package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
  77. package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
  78. package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -0
  79. package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
  80. package/dist/cjs/auth/index.d.ts +1 -0
  81. package/dist/cjs/auth/index.js +5 -0
  82. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  83. package/dist/cjs/{version.js → core/auth/AuthProvider.js} +0 -2
  84. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  85. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  86. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  87. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  88. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  89. package/dist/cjs/core/auth/BearerToken.js +16 -0
  90. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  91. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  92. package/dist/cjs/core/auth/index.d.ts +5 -0
  93. package/dist/cjs/core/auth/index.js +9 -0
  94. package/dist/cjs/core/base64.d.ts +2 -0
  95. package/dist/cjs/core/base64.js +26 -0
  96. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
  97. package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
  98. package/dist/cjs/core/fetcher/Fetcher.js +42 -24
  99. package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
  100. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  101. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  102. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  103. package/dist/cjs/core/fetcher/signals.d.ts +1 -7
  104. package/dist/cjs/core/fetcher/signals.js +0 -12
  105. package/dist/cjs/core/index.d.ts +2 -0
  106. package/dist/cjs/core/index.js +2 -0
  107. package/dist/cjs/core/logging/logger.js +1 -1
  108. package/dist/cjs/core/runtime/runtime.js +11 -10
  109. package/dist/cjs/core/url/join.js +0 -1
  110. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  111. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  112. package/dist/esm/BaseClient.d.mts +10 -1
  113. package/dist/esm/BaseClient.mjs +22 -1
  114. package/dist/esm/Client.d.mts +87 -86
  115. package/dist/esm/Client.mjs +59 -67
  116. package/dist/esm/api/resources/bill/client/Client.d.mts +33 -33
  117. package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
  118. package/dist/esm/api/resources/boarding/client/Client.d.mts +27 -27
  119. package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
  120. package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +17 -15
  121. package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
  122. package/dist/esm/api/resources/checkCapture/client/Client.d.mts +7 -7
  123. package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
  124. package/dist/esm/api/resources/cloud/client/Client.d.mts +17 -17
  125. package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
  126. package/dist/esm/api/resources/customer/client/Client.d.mts +17 -17
  127. package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
  128. package/dist/esm/api/resources/export/client/Client.d.mts +93 -89
  129. package/dist/esm/api/resources/export/client/Client.mjs +204 -581
  130. package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +11 -11
  131. package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
  132. package/dist/esm/api/resources/import/client/Client.d.mts +11 -11
  133. package/dist/esm/api/resources/import/client/Client.mjs +17 -60
  134. package/dist/esm/api/resources/invoice/client/Client.d.mts +31 -31
  135. package/dist/esm/api/resources/invoice/client/Client.mjs +60 -207
  136. package/dist/esm/api/resources/lineItem/client/Client.d.mts +15 -15
  137. package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
  138. package/dist/esm/api/resources/moneyIn/client/Client.d.mts +39 -39
  139. package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
  140. package/dist/esm/api/resources/moneyOut/client/Client.d.mts +43 -26
  141. package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
  142. package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
  143. package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
  144. package/dist/esm/api/resources/notification/client/Client.d.mts +16 -16
  145. package/dist/esm/api/resources/notification/client/Client.mjs +31 -100
  146. package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +13 -13
  147. package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
  148. package/dist/esm/api/resources/ocr/client/Client.d.mts +13 -9
  149. package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
  150. package/dist/esm/api/resources/organization/client/Client.d.mts +19 -19
  151. package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
  152. package/dist/esm/api/resources/paymentLink/client/Client.d.mts +23 -23
  153. package/dist/esm/api/resources/paymentLink/client/Client.mjs +41 -162
  154. package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +19 -19
  155. package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
  156. package/dist/esm/api/resources/paypoint/client/Client.d.mts +22 -22
  157. package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
  158. package/dist/esm/api/resources/query/client/Client.d.mts +71 -71
  159. package/dist/esm/api/resources/query/client/Client.mjs +136 -571
  160. package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
  161. package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
  162. package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
  163. package/dist/esm/api/resources/statistic/client/Client.d.mts +50 -50
  164. package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
  165. package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
  166. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
  167. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
  168. package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
  169. package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
  170. package/dist/esm/api/resources/subscription/client/Client.d.mts +13 -13
  171. package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
  172. package/dist/esm/api/resources/templates/client/Client.d.mts +15 -15
  173. package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
  174. package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +13 -13
  175. package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
  176. package/dist/esm/api/resources/user/client/Client.d.mts +54 -32
  177. package/dist/esm/api/resources/user/client/Client.mjs +83 -221
  178. package/dist/esm/api/resources/vendor/client/Client.d.mts +13 -13
  179. package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
  180. package/dist/esm/api/resources/wallet/client/Client.d.mts +13 -13
  181. package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
  182. package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
  183. package/dist/esm/api/types/NotificationContent.d.mts +1 -0
  184. package/dist/esm/api/types/NotificationContent.mjs +1 -0
  185. package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
  186. package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
  187. package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
  188. package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -0
  189. package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
  190. package/dist/esm/auth/index.d.mts +1 -0
  191. package/dist/esm/auth/index.mjs +1 -0
  192. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  193. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  194. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  195. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  196. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  197. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  198. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  199. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  200. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  201. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  202. package/dist/esm/core/auth/index.d.mts +5 -0
  203. package/dist/esm/core/auth/index.mjs +3 -0
  204. package/dist/esm/core/base64.d.mts +2 -0
  205. package/dist/esm/core/base64.mjs +22 -0
  206. package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
  207. package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
  208. package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
  209. package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
  210. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  211. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  212. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  213. package/dist/esm/core/fetcher/signals.d.mts +1 -7
  214. package/dist/esm/core/fetcher/signals.mjs +0 -12
  215. package/dist/esm/core/index.d.mts +2 -0
  216. package/dist/esm/core/index.mjs +2 -0
  217. package/dist/esm/core/logging/logger.mjs +1 -1
  218. package/dist/esm/core/runtime/runtime.mjs +11 -10
  219. package/dist/esm/core/url/join.mjs +0 -1
  220. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  221. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  222. package/package.json +4 -4
  223. package/reference.md +761 -473
  224. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  225. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  226. package/dist/cjs/version.d.ts +0 -1
  227. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  228. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
  229. package/dist/esm/version.d.mts +0 -1
  230. package/dist/esm/version.mjs +0 -1
@@ -43,16 +43,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.Export = void 0;
46
+ exports.ExportClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
47
48
  const headers_js_1 = require("../../../../core/headers.js");
48
49
  const core = __importStar(require("../../../../core/index.js"));
49
50
  const json_js_1 = require("../../../../core/json.js");
50
51
  const environments = __importStar(require("../../../../environments.js"));
52
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
51
53
  const errors = __importStar(require("../../../../errors/index.js"));
52
54
  const Payabli = __importStar(require("../../../index.js"));
53
- class Export {
54
- constructor(_options = {}) {
55
- this._options = _options;
55
+ class ExportClient {
56
+ constructor(options = {}) {
57
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
56
58
  }
57
59
  /**
58
60
  * Export a list of boarding applications for an organization. Use filters to limit results.
@@ -60,7 +62,7 @@ class Export {
60
62
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
61
63
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
62
64
  * @param {Payabli.ExportApplicationsRequest} request
63
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
65
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
64
66
  *
65
67
  * @throws {@link Payabli.BadRequestError}
66
68
  * @throws {@link Payabli.UnauthorizedError}
@@ -94,7 +96,8 @@ class Export {
94
96
  if (parameters != null) {
95
97
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
96
98
  }
97
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
99
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
100
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
98
101
  const _response = yield core.fetcher({
99
102
  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, `Export/boarding/${core.url.encodePathParam(format)}/${core.url.encodePathParam(orgId)}`),
100
103
  method: "GET",
@@ -127,28 +130,16 @@ class Export {
127
130
  });
128
131
  }
129
132
  }
130
- switch (_response.error.reason) {
131
- case "non-json":
132
- throw new errors.PayabliError({
133
- statusCode: _response.error.statusCode,
134
- body: _response.error.rawBody,
135
- rawResponse: _response.rawResponse,
136
- });
137
- case "timeout":
138
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/boarding/{format}/{orgId}.");
139
- case "unknown":
140
- throw new errors.PayabliError({
141
- message: _response.error.errorMessage,
142
- rawResponse: _response.rawResponse,
143
- });
144
- }
133
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/boarding/{format}/{orgId}");
145
134
  });
146
135
  }
147
136
  /**
148
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
137
+ * This endpoint is deprecated. Export batch details for a paypoint. Use filters to limit results.
138
+ *
149
139
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
140
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
150
141
  * @param {Payabli.ExportBatchDetailsRequest} request
151
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
142
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
152
143
  *
153
144
  * @throws {@link Payabli.BadRequestError}
154
145
  * @throws {@link Payabli.UnauthorizedError}
@@ -156,17 +147,17 @@ class Export {
156
147
  * @throws {@link Payabli.ServiceUnavailableError}
157
148
  *
158
149
  * @example
159
- * await client.export.exportBatchDetails("8cfec329267", "csv", {
150
+ * await client.export.exportBatchDetails("csv", "8cfec329267", {
160
151
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
161
152
  * fromRecord: 251,
162
153
  * limitRecord: 1000
163
154
  * })
164
155
  */
165
- exportBatchDetails(entry, format, request = {}, requestOptions) {
166
- return core.HttpResponsePromise.fromPromise(this.__exportBatchDetails(entry, format, request, requestOptions));
156
+ exportBatchDetails(format, entry, request = {}, requestOptions) {
157
+ return core.HttpResponsePromise.fromPromise(this.__exportBatchDetails(format, entry, request, requestOptions));
167
158
  }
168
- __exportBatchDetails(entry_1, format_1) {
169
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
159
+ __exportBatchDetails(format_1, entry_1) {
160
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
170
161
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
171
162
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
172
163
  const _queryParams = {};
@@ -182,7 +173,8 @@ class Export {
182
173
  if (parameters != null) {
183
174
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
184
175
  }
185
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
176
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
177
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
186
178
  const _response = yield core.fetcher({
187
179
  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, `Export/batchDetails/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
188
180
  method: "GET",
@@ -215,28 +207,16 @@ class Export {
215
207
  });
216
208
  }
217
209
  }
218
- switch (_response.error.reason) {
219
- case "non-json":
220
- throw new errors.PayabliError({
221
- statusCode: _response.error.statusCode,
222
- body: _response.error.rawBody,
223
- rawResponse: _response.rawResponse,
224
- });
225
- case "timeout":
226
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batchDetails/{format}/{entry}.");
227
- case "unknown":
228
- throw new errors.PayabliError({
229
- message: _response.error.errorMessage,
230
- rawResponse: _response.rawResponse,
231
- });
232
- }
210
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batchDetails/{format}/{entry}");
233
211
  });
234
212
  }
235
213
  /**
214
+ * This endpoint is deprecated. Export batch details for an organization. Use filters to limit results.
215
+ *
236
216
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
237
217
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
238
218
  * @param {Payabli.ExportBatchDetailsOrgRequest} request
239
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
219
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
240
220
  *
241
221
  * @throws {@link Payabli.BadRequestError}
242
222
  * @throws {@link Payabli.UnauthorizedError}
@@ -270,7 +250,8 @@ class Export {
270
250
  if (parameters != null) {
271
251
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
272
252
  }
273
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
253
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
254
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
274
255
  const _response = yield core.fetcher({
275
256
  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, `Export/batchDetails/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
276
257
  method: "GET",
@@ -303,30 +284,16 @@ class Export {
303
284
  });
304
285
  }
305
286
  }
306
- switch (_response.error.reason) {
307
- case "non-json":
308
- throw new errors.PayabliError({
309
- statusCode: _response.error.statusCode,
310
- body: _response.error.rawBody,
311
- rawResponse: _response.rawResponse,
312
- });
313
- case "timeout":
314
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batchDetails/{format}/org/{orgId}.");
315
- case "unknown":
316
- throw new errors.PayabliError({
317
- message: _response.error.errorMessage,
318
- rawResponse: _response.rawResponse,
319
- });
320
- }
287
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batchDetails/{format}/org/{orgId}");
321
288
  });
322
289
  }
323
290
  /**
324
291
  * Export a list of batches for an entrypoint. Use filters to limit results.
325
292
  *
326
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
327
293
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
294
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
328
295
  * @param {Payabli.ExportBatchesRequest} request
329
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
296
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
330
297
  *
331
298
  * @throws {@link Payabli.BadRequestError}
332
299
  * @throws {@link Payabli.UnauthorizedError}
@@ -334,17 +301,17 @@ class Export {
334
301
  * @throws {@link Payabli.ServiceUnavailableError}
335
302
  *
336
303
  * @example
337
- * await client.export.exportBatches("8cfec329267", "csv", {
304
+ * await client.export.exportBatches("csv", "8cfec329267", {
338
305
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
339
306
  * fromRecord: 251,
340
307
  * limitRecord: 1000
341
308
  * })
342
309
  */
343
- exportBatches(entry, format, request = {}, requestOptions) {
344
- return core.HttpResponsePromise.fromPromise(this.__exportBatches(entry, format, request, requestOptions));
310
+ exportBatches(format, entry, request = {}, requestOptions) {
311
+ return core.HttpResponsePromise.fromPromise(this.__exportBatches(format, entry, request, requestOptions));
345
312
  }
346
- __exportBatches(entry_1, format_1) {
347
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
313
+ __exportBatches(format_1, entry_1) {
314
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
348
315
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
349
316
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
350
317
  const _queryParams = {};
@@ -360,7 +327,8 @@ class Export {
360
327
  if (parameters != null) {
361
328
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
362
329
  }
363
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
330
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
331
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
364
332
  const _response = yield core.fetcher({
365
333
  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, `Export/batches/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
366
334
  method: "GET",
@@ -393,21 +361,7 @@ class Export {
393
361
  });
394
362
  }
395
363
  }
396
- switch (_response.error.reason) {
397
- case "non-json":
398
- throw new errors.PayabliError({
399
- statusCode: _response.error.statusCode,
400
- body: _response.error.rawBody,
401
- rawResponse: _response.rawResponse,
402
- });
403
- case "timeout":
404
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batches/{format}/{entry}.");
405
- case "unknown":
406
- throw new errors.PayabliError({
407
- message: _response.error.errorMessage,
408
- rawResponse: _response.rawResponse,
409
- });
410
- }
364
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batches/{format}/{entry}");
411
365
  });
412
366
  }
413
367
  /**
@@ -416,7 +370,7 @@ class Export {
416
370
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
417
371
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
418
372
  * @param {Payabli.ExportBatchesOrgRequest} request
419
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
373
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
420
374
  *
421
375
  * @throws {@link Payabli.BadRequestError}
422
376
  * @throws {@link Payabli.UnauthorizedError}
@@ -450,7 +404,8 @@ class Export {
450
404
  if (parameters != null) {
451
405
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
452
406
  }
453
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
407
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
408
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
454
409
  const _response = yield core.fetcher({
455
410
  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, `Export/batches/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
456
411
  method: "GET",
@@ -483,30 +438,16 @@ class Export {
483
438
  });
484
439
  }
485
440
  }
486
- switch (_response.error.reason) {
487
- case "non-json":
488
- throw new errors.PayabliError({
489
- statusCode: _response.error.statusCode,
490
- body: _response.error.rawBody,
491
- rawResponse: _response.rawResponse,
492
- });
493
- case "timeout":
494
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batches/{format}/org/{orgId}.");
495
- case "unknown":
496
- throw new errors.PayabliError({
497
- message: _response.error.errorMessage,
498
- rawResponse: _response.rawResponse,
499
- });
500
- }
441
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batches/{format}/org/{orgId}");
501
442
  });
502
443
  }
503
444
  /**
504
445
  * Export a list of money out batches for a paypoint. Use filters to limit results.
505
446
  *
506
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
507
447
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
448
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
508
449
  * @param {Payabli.ExportBatchesOutRequest} request
509
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
450
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
510
451
  *
511
452
  * @throws {@link Payabli.BadRequestError}
512
453
  * @throws {@link Payabli.UnauthorizedError}
@@ -514,17 +455,17 @@ class Export {
514
455
  * @throws {@link Payabli.ServiceUnavailableError}
515
456
  *
516
457
  * @example
517
- * await client.export.exportBatchesOut("8cfec329267", "csv", {
458
+ * await client.export.exportBatchesOut("csv", "8cfec329267", {
518
459
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
519
460
  * fromRecord: 251,
520
461
  * limitRecord: 1000
521
462
  * })
522
463
  */
523
- exportBatchesOut(entry, format, request = {}, requestOptions) {
524
- return core.HttpResponsePromise.fromPromise(this.__exportBatchesOut(entry, format, request, requestOptions));
464
+ exportBatchesOut(format, entry, request = {}, requestOptions) {
465
+ return core.HttpResponsePromise.fromPromise(this.__exportBatchesOut(format, entry, request, requestOptions));
525
466
  }
526
- __exportBatchesOut(entry_1, format_1) {
527
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
467
+ __exportBatchesOut(format_1, entry_1) {
468
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
528
469
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
529
470
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
530
471
  const _queryParams = {};
@@ -540,7 +481,8 @@ class Export {
540
481
  if (parameters != null) {
541
482
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
542
483
  }
543
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
484
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
485
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
544
486
  const _response = yield core.fetcher({
545
487
  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, `Export/batchesOut/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
546
488
  method: "GET",
@@ -573,21 +515,7 @@ class Export {
573
515
  });
574
516
  }
575
517
  }
576
- switch (_response.error.reason) {
577
- case "non-json":
578
- throw new errors.PayabliError({
579
- statusCode: _response.error.statusCode,
580
- body: _response.error.rawBody,
581
- rawResponse: _response.rawResponse,
582
- });
583
- case "timeout":
584
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batchesOut/{format}/{entry}.");
585
- case "unknown":
586
- throw new errors.PayabliError({
587
- message: _response.error.errorMessage,
588
- rawResponse: _response.rawResponse,
589
- });
590
- }
518
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batchesOut/{format}/{entry}");
591
519
  });
592
520
  }
593
521
  /**
@@ -596,7 +524,7 @@ class Export {
596
524
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
597
525
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
598
526
  * @param {Payabli.ExportBatchesOutOrgRequest} request
599
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
527
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
600
528
  *
601
529
  * @throws {@link Payabli.BadRequestError}
602
530
  * @throws {@link Payabli.UnauthorizedError}
@@ -630,7 +558,8 @@ class Export {
630
558
  if (parameters != null) {
631
559
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
632
560
  }
633
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
561
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
562
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
634
563
  const _response = yield core.fetcher({
635
564
  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, `Export/batchesOut/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
636
565
  method: "GET",
@@ -663,30 +592,16 @@ class Export {
663
592
  });
664
593
  }
665
594
  }
666
- switch (_response.error.reason) {
667
- case "non-json":
668
- throw new errors.PayabliError({
669
- statusCode: _response.error.statusCode,
670
- body: _response.error.rawBody,
671
- rawResponse: _response.rawResponse,
672
- });
673
- case "timeout":
674
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/batchesOut/{format}/org/{orgId}.");
675
- case "unknown":
676
- throw new errors.PayabliError({
677
- message: _response.error.errorMessage,
678
- rawResponse: _response.rawResponse,
679
- });
680
- }
595
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/batchesOut/{format}/org/{orgId}");
681
596
  });
682
597
  }
683
598
  /**
684
599
  * Export a list of bills for an entrypoint. Use filters to limit results.
685
600
  *
686
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
687
601
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
602
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
688
603
  * @param {Payabli.ExportBillsRequest} request
689
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
604
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
690
605
  *
691
606
  * @throws {@link Payabli.BadRequestError}
692
607
  * @throws {@link Payabli.UnauthorizedError}
@@ -694,17 +609,17 @@ class Export {
694
609
  * @throws {@link Payabli.ServiceUnavailableError}
695
610
  *
696
611
  * @example
697
- * await client.export.exportBills("8cfec329267", "csv", {
612
+ * await client.export.exportBills("csv", "8cfec329267", {
698
613
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
699
614
  * fromRecord: 251,
700
615
  * limitRecord: 1000
701
616
  * })
702
617
  */
703
- exportBills(entry, format, request = {}, requestOptions) {
704
- return core.HttpResponsePromise.fromPromise(this.__exportBills(entry, format, request, requestOptions));
618
+ exportBills(format, entry, request = {}, requestOptions) {
619
+ return core.HttpResponsePromise.fromPromise(this.__exportBills(format, entry, request, requestOptions));
705
620
  }
706
- __exportBills(entry_1, format_1) {
707
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
621
+ __exportBills(format_1, entry_1) {
622
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
708
623
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
709
624
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
710
625
  const _queryParams = {};
@@ -720,7 +635,8 @@ class Export {
720
635
  if (parameters != null) {
721
636
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
722
637
  }
723
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
638
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
639
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
724
640
  const _response = yield core.fetcher({
725
641
  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, `Export/bills/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
726
642
  method: "GET",
@@ -753,21 +669,7 @@ class Export {
753
669
  });
754
670
  }
755
671
  }
756
- switch (_response.error.reason) {
757
- case "non-json":
758
- throw new errors.PayabliError({
759
- statusCode: _response.error.statusCode,
760
- body: _response.error.rawBody,
761
- rawResponse: _response.rawResponse,
762
- });
763
- case "timeout":
764
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/bills/{format}/{entry}.");
765
- case "unknown":
766
- throw new errors.PayabliError({
767
- message: _response.error.errorMessage,
768
- rawResponse: _response.rawResponse,
769
- });
770
- }
672
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/bills/{format}/{entry}");
771
673
  });
772
674
  }
773
675
  /**
@@ -776,7 +678,7 @@ class Export {
776
678
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
777
679
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
778
680
  * @param {Payabli.ExportBillsOrgRequest} request
779
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
681
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
780
682
  *
781
683
  * @throws {@link Payabli.BadRequestError}
782
684
  * @throws {@link Payabli.UnauthorizedError}
@@ -810,7 +712,8 @@ class Export {
810
712
  if (parameters != null) {
811
713
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
812
714
  }
813
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
715
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
716
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
814
717
  const _response = yield core.fetcher({
815
718
  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, `Export/bills/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
816
719
  method: "GET",
@@ -843,30 +746,16 @@ class Export {
843
746
  });
844
747
  }
845
748
  }
846
- switch (_response.error.reason) {
847
- case "non-json":
848
- throw new errors.PayabliError({
849
- statusCode: _response.error.statusCode,
850
- body: _response.error.rawBody,
851
- rawResponse: _response.rawResponse,
852
- });
853
- case "timeout":
854
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/bills/{format}/org/{orgId}.");
855
- case "unknown":
856
- throw new errors.PayabliError({
857
- message: _response.error.errorMessage,
858
- rawResponse: _response.rawResponse,
859
- });
860
- }
749
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/bills/{format}/org/{orgId}");
861
750
  });
862
751
  }
863
752
  /**
864
753
  * Export a list of chargebacks and ACH returns for an entrypoint. Use filters to limit results.
865
754
  *
866
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
867
755
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
756
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
868
757
  * @param {Payabli.ExportChargebacksRequest} request
869
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
758
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
870
759
  *
871
760
  * @throws {@link Payabli.BadRequestError}
872
761
  * @throws {@link Payabli.UnauthorizedError}
@@ -874,17 +763,17 @@ class Export {
874
763
  * @throws {@link Payabli.ServiceUnavailableError}
875
764
  *
876
765
  * @example
877
- * await client.export.exportChargebacks("8cfec329267", "csv", {
766
+ * await client.export.exportChargebacks("csv", "8cfec329267", {
878
767
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
879
768
  * fromRecord: 251,
880
769
  * limitRecord: 1000
881
770
  * })
882
771
  */
883
- exportChargebacks(entry, format, request = {}, requestOptions) {
884
- return core.HttpResponsePromise.fromPromise(this.__exportChargebacks(entry, format, request, requestOptions));
772
+ exportChargebacks(format, entry, request = {}, requestOptions) {
773
+ return core.HttpResponsePromise.fromPromise(this.__exportChargebacks(format, entry, request, requestOptions));
885
774
  }
886
- __exportChargebacks(entry_1, format_1) {
887
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
775
+ __exportChargebacks(format_1, entry_1) {
776
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
888
777
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
889
778
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
890
779
  const _queryParams = {};
@@ -900,7 +789,8 @@ class Export {
900
789
  if (parameters != null) {
901
790
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
902
791
  }
903
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
792
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
793
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
904
794
  const _response = yield core.fetcher({
905
795
  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, `Export/chargebacks/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
906
796
  method: "GET",
@@ -933,21 +823,7 @@ class Export {
933
823
  });
934
824
  }
935
825
  }
936
- switch (_response.error.reason) {
937
- case "non-json":
938
- throw new errors.PayabliError({
939
- statusCode: _response.error.statusCode,
940
- body: _response.error.rawBody,
941
- rawResponse: _response.rawResponse,
942
- });
943
- case "timeout":
944
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/chargebacks/{format}/{entry}.");
945
- case "unknown":
946
- throw new errors.PayabliError({
947
- message: _response.error.errorMessage,
948
- rawResponse: _response.rawResponse,
949
- });
950
- }
826
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/chargebacks/{format}/{entry}");
951
827
  });
952
828
  }
953
829
  /**
@@ -956,7 +832,7 @@ class Export {
956
832
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
957
833
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
958
834
  * @param {Payabli.ExportChargebacksOrgRequest} request
959
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
835
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
960
836
  *
961
837
  * @throws {@link Payabli.BadRequestError}
962
838
  * @throws {@link Payabli.UnauthorizedError}
@@ -990,7 +866,8 @@ class Export {
990
866
  if (parameters != null) {
991
867
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
992
868
  }
993
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
869
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
870
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
994
871
  const _response = yield core.fetcher({
995
872
  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, `Export/chargebacks/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
996
873
  method: "GET",
@@ -1023,30 +900,16 @@ class Export {
1023
900
  });
1024
901
  }
1025
902
  }
1026
- switch (_response.error.reason) {
1027
- case "non-json":
1028
- throw new errors.PayabliError({
1029
- statusCode: _response.error.statusCode,
1030
- body: _response.error.rawBody,
1031
- rawResponse: _response.rawResponse,
1032
- });
1033
- case "timeout":
1034
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/chargebacks/{format}/org/{orgId}.");
1035
- case "unknown":
1036
- throw new errors.PayabliError({
1037
- message: _response.error.errorMessage,
1038
- rawResponse: _response.rawResponse,
1039
- });
1040
- }
903
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/chargebacks/{format}/org/{orgId}");
1041
904
  });
1042
905
  }
1043
906
  /**
1044
907
  * Export a list of customers for an entrypoint. Use filters to limit results.
1045
908
  *
1046
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1047
909
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
910
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1048
911
  * @param {Payabli.ExportCustomersRequest} request
1049
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
912
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1050
913
  *
1051
914
  * @throws {@link Payabli.BadRequestError}
1052
915
  * @throws {@link Payabli.UnauthorizedError}
@@ -1054,17 +917,17 @@ class Export {
1054
917
  * @throws {@link Payabli.ServiceUnavailableError}
1055
918
  *
1056
919
  * @example
1057
- * await client.export.exportCustomers("8cfec329267", "csv", {
920
+ * await client.export.exportCustomers("csv", "8cfec329267", {
1058
921
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
1059
922
  * fromRecord: 251,
1060
923
  * limitRecord: 1000
1061
924
  * })
1062
925
  */
1063
- exportCustomers(entry, format, request = {}, requestOptions) {
1064
- return core.HttpResponsePromise.fromPromise(this.__exportCustomers(entry, format, request, requestOptions));
926
+ exportCustomers(format, entry, request = {}, requestOptions) {
927
+ return core.HttpResponsePromise.fromPromise(this.__exportCustomers(format, entry, request, requestOptions));
1065
928
  }
1066
- __exportCustomers(entry_1, format_1) {
1067
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
929
+ __exportCustomers(format_1, entry_1) {
930
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
1068
931
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1069
932
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
1070
933
  const _queryParams = {};
@@ -1080,7 +943,8 @@ class Export {
1080
943
  if (parameters != null) {
1081
944
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1082
945
  }
1083
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
946
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
947
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1084
948
  const _response = yield core.fetcher({
1085
949
  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, `Export/customers/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
1086
950
  method: "GET",
@@ -1113,21 +977,7 @@ class Export {
1113
977
  });
1114
978
  }
1115
979
  }
1116
- switch (_response.error.reason) {
1117
- case "non-json":
1118
- throw new errors.PayabliError({
1119
- statusCode: _response.error.statusCode,
1120
- body: _response.error.rawBody,
1121
- rawResponse: _response.rawResponse,
1122
- });
1123
- case "timeout":
1124
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/customers/{format}/{entry}.");
1125
- case "unknown":
1126
- throw new errors.PayabliError({
1127
- message: _response.error.errorMessage,
1128
- rawResponse: _response.rawResponse,
1129
- });
1130
- }
980
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/customers/{format}/{entry}");
1131
981
  });
1132
982
  }
1133
983
  /**
@@ -1136,7 +986,7 @@ class Export {
1136
986
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1137
987
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1138
988
  * @param {Payabli.ExportCustomersOrgRequest} request
1139
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
989
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1140
990
  *
1141
991
  * @throws {@link Payabli.BadRequestError}
1142
992
  * @throws {@link Payabli.UnauthorizedError}
@@ -1170,7 +1020,8 @@ class Export {
1170
1020
  if (parameters != null) {
1171
1021
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1172
1022
  }
1173
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1023
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1024
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1174
1025
  const _response = yield core.fetcher({
1175
1026
  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, `Export/customers/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
1176
1027
  method: "GET",
@@ -1203,30 +1054,16 @@ class Export {
1203
1054
  });
1204
1055
  }
1205
1056
  }
1206
- switch (_response.error.reason) {
1207
- case "non-json":
1208
- throw new errors.PayabliError({
1209
- statusCode: _response.error.statusCode,
1210
- body: _response.error.rawBody,
1211
- rawResponse: _response.rawResponse,
1212
- });
1213
- case "timeout":
1214
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/customers/{format}/org/{orgId}.");
1215
- case "unknown":
1216
- throw new errors.PayabliError({
1217
- message: _response.error.errorMessage,
1218
- rawResponse: _response.rawResponse,
1219
- });
1220
- }
1057
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/customers/{format}/org/{orgId}");
1221
1058
  });
1222
1059
  }
1223
1060
  /**
1224
1061
  * Export list of invoices for an entrypoint. Use filters to limit results.
1225
1062
  *
1226
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1227
1063
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1064
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1228
1065
  * @param {Payabli.ExportInvoicesRequest} request
1229
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1066
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1230
1067
  *
1231
1068
  * @throws {@link Payabli.BadRequestError}
1232
1069
  * @throws {@link Payabli.UnauthorizedError}
@@ -1234,17 +1071,17 @@ class Export {
1234
1071
  * @throws {@link Payabli.ServiceUnavailableError}
1235
1072
  *
1236
1073
  * @example
1237
- * await client.export.exportInvoices("8cfec329267", "csv", {
1074
+ * await client.export.exportInvoices("csv", "8cfec329267", {
1238
1075
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
1239
1076
  * fromRecord: 251,
1240
1077
  * limitRecord: 1000
1241
1078
  * })
1242
1079
  */
1243
- exportInvoices(entry, format, request = {}, requestOptions) {
1244
- return core.HttpResponsePromise.fromPromise(this.__exportInvoices(entry, format, request, requestOptions));
1080
+ exportInvoices(format, entry, request = {}, requestOptions) {
1081
+ return core.HttpResponsePromise.fromPromise(this.__exportInvoices(format, entry, request, requestOptions));
1245
1082
  }
1246
- __exportInvoices(entry_1, format_1) {
1247
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
1083
+ __exportInvoices(format_1, entry_1) {
1084
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
1248
1085
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1249
1086
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
1250
1087
  const _queryParams = {};
@@ -1260,7 +1097,8 @@ class Export {
1260
1097
  if (parameters != null) {
1261
1098
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1262
1099
  }
1263
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1100
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1101
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1264
1102
  const _response = yield core.fetcher({
1265
1103
  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, `Export/invoices/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
1266
1104
  method: "GET",
@@ -1293,21 +1131,7 @@ class Export {
1293
1131
  });
1294
1132
  }
1295
1133
  }
1296
- switch (_response.error.reason) {
1297
- case "non-json":
1298
- throw new errors.PayabliError({
1299
- statusCode: _response.error.statusCode,
1300
- body: _response.error.rawBody,
1301
- rawResponse: _response.rawResponse,
1302
- });
1303
- case "timeout":
1304
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/invoices/{format}/{entry}.");
1305
- case "unknown":
1306
- throw new errors.PayabliError({
1307
- message: _response.error.errorMessage,
1308
- rawResponse: _response.rawResponse,
1309
- });
1310
- }
1134
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/invoices/{format}/{entry}");
1311
1135
  });
1312
1136
  }
1313
1137
  /**
@@ -1316,7 +1140,7 @@ class Export {
1316
1140
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1317
1141
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1318
1142
  * @param {Payabli.ExportInvoicesOrgRequest} request
1319
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1143
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1320
1144
  *
1321
1145
  * @throws {@link Payabli.BadRequestError}
1322
1146
  * @throws {@link Payabli.UnauthorizedError}
@@ -1350,7 +1174,8 @@ class Export {
1350
1174
  if (parameters != null) {
1351
1175
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1352
1176
  }
1353
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1177
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1178
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1354
1179
  const _response = yield core.fetcher({
1355
1180
  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, `Export/invoices/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
1356
1181
  method: "GET",
@@ -1383,21 +1208,7 @@ class Export {
1383
1208
  });
1384
1209
  }
1385
1210
  }
1386
- switch (_response.error.reason) {
1387
- case "non-json":
1388
- throw new errors.PayabliError({
1389
- statusCode: _response.error.statusCode,
1390
- body: _response.error.rawBody,
1391
- rawResponse: _response.rawResponse,
1392
- });
1393
- case "timeout":
1394
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/invoices/{format}/org/{orgId}.");
1395
- case "unknown":
1396
- throw new errors.PayabliError({
1397
- message: _response.error.errorMessage,
1398
- rawResponse: _response.rawResponse,
1399
- });
1400
- }
1211
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/invoices/{format}/org/{orgId}");
1401
1212
  });
1402
1213
  }
1403
1214
  /**
@@ -1406,7 +1217,7 @@ class Export {
1406
1217
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1407
1218
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1408
1219
  * @param {Payabli.ExportOrganizationsRequest} request
1409
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1220
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1410
1221
  *
1411
1222
  * @throws {@link Payabli.BadRequestError}
1412
1223
  * @throws {@link Payabli.UnauthorizedError}
@@ -1440,7 +1251,8 @@ class Export {
1440
1251
  if (parameters != null) {
1441
1252
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1442
1253
  }
1443
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1254
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1255
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1444
1256
  const _response = yield core.fetcher({
1445
1257
  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, `Export/organizations/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
1446
1258
  method: "GET",
@@ -1473,30 +1285,16 @@ class Export {
1473
1285
  });
1474
1286
  }
1475
1287
  }
1476
- switch (_response.error.reason) {
1477
- case "non-json":
1478
- throw new errors.PayabliError({
1479
- statusCode: _response.error.statusCode,
1480
- body: _response.error.rawBody,
1481
- rawResponse: _response.rawResponse,
1482
- });
1483
- case "timeout":
1484
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/organizations/{format}/org/{orgId}.");
1485
- case "unknown":
1486
- throw new errors.PayabliError({
1487
- message: _response.error.errorMessage,
1488
- rawResponse: _response.rawResponse,
1489
- });
1490
- }
1288
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/organizations/{format}/org/{orgId}");
1491
1289
  });
1492
1290
  }
1493
1291
  /**
1494
1292
  * Export a list of payouts and their statuses for an entrypoint. Use filters to limit results.
1495
1293
  *
1496
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1497
1294
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1295
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1498
1296
  * @param {Payabli.ExportPayoutRequest} request
1499
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1297
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1500
1298
  *
1501
1299
  * @throws {@link Payabli.BadRequestError}
1502
1300
  * @throws {@link Payabli.UnauthorizedError}
@@ -1504,17 +1302,17 @@ class Export {
1504
1302
  * @throws {@link Payabli.ServiceUnavailableError}
1505
1303
  *
1506
1304
  * @example
1507
- * await client.export.exportPayout("8cfec329267", "csv", {
1305
+ * await client.export.exportPayout("csv", "8cfec329267", {
1508
1306
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
1509
1307
  * fromRecord: 251,
1510
1308
  * limitRecord: 1000
1511
1309
  * })
1512
1310
  */
1513
- exportPayout(entry, format, request = {}, requestOptions) {
1514
- return core.HttpResponsePromise.fromPromise(this.__exportPayout(entry, format, request, requestOptions));
1311
+ exportPayout(format, entry, request = {}, requestOptions) {
1312
+ return core.HttpResponsePromise.fromPromise(this.__exportPayout(format, entry, request, requestOptions));
1515
1313
  }
1516
- __exportPayout(entry_1, format_1) {
1517
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
1314
+ __exportPayout(format_1, entry_1) {
1315
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
1518
1316
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1519
1317
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
1520
1318
  const _queryParams = {};
@@ -1530,7 +1328,8 @@ class Export {
1530
1328
  if (parameters != null) {
1531
1329
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1532
1330
  }
1533
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1331
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1332
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1534
1333
  const _response = yield core.fetcher({
1535
1334
  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, `Export/payouts/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
1536
1335
  method: "GET",
@@ -1563,21 +1362,7 @@ class Export {
1563
1362
  });
1564
1363
  }
1565
1364
  }
1566
- switch (_response.error.reason) {
1567
- case "non-json":
1568
- throw new errors.PayabliError({
1569
- statusCode: _response.error.statusCode,
1570
- body: _response.error.rawBody,
1571
- rawResponse: _response.rawResponse,
1572
- });
1573
- case "timeout":
1574
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/payouts/{format}/{entry}.");
1575
- case "unknown":
1576
- throw new errors.PayabliError({
1577
- message: _response.error.errorMessage,
1578
- rawResponse: _response.rawResponse,
1579
- });
1580
- }
1365
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/payouts/{format}/{entry}");
1581
1366
  });
1582
1367
  }
1583
1368
  /**
@@ -1586,7 +1371,7 @@ class Export {
1586
1371
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1587
1372
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1588
1373
  * @param {Payabli.ExportPayoutOrgRequest} request
1589
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1374
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1590
1375
  *
1591
1376
  * @throws {@link Payabli.BadRequestError}
1592
1377
  * @throws {@link Payabli.UnauthorizedError}
@@ -1620,7 +1405,8 @@ class Export {
1620
1405
  if (parameters != null) {
1621
1406
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1622
1407
  }
1623
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1408
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1409
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1624
1410
  const _response = yield core.fetcher({
1625
1411
  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, `Export/payouts/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
1626
1412
  method: "GET",
@@ -1653,21 +1439,7 @@ class Export {
1653
1439
  });
1654
1440
  }
1655
1441
  }
1656
- switch (_response.error.reason) {
1657
- case "non-json":
1658
- throw new errors.PayabliError({
1659
- statusCode: _response.error.statusCode,
1660
- body: _response.error.rawBody,
1661
- rawResponse: _response.rawResponse,
1662
- });
1663
- case "timeout":
1664
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/payouts/{format}/org/{orgId}.");
1665
- case "unknown":
1666
- throw new errors.PayabliError({
1667
- message: _response.error.errorMessage,
1668
- rawResponse: _response.rawResponse,
1669
- });
1670
- }
1442
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/payouts/{format}/org/{orgId}");
1671
1443
  });
1672
1444
  }
1673
1445
  /**
@@ -1676,7 +1448,7 @@ class Export {
1676
1448
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1677
1449
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1678
1450
  * @param {Payabli.ExportPaypointsRequest} request
1679
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1451
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1680
1452
  *
1681
1453
  * @throws {@link Payabli.BadRequestError}
1682
1454
  * @throws {@link Payabli.UnauthorizedError}
@@ -1710,7 +1482,8 @@ class Export {
1710
1482
  if (parameters != null) {
1711
1483
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1712
1484
  }
1713
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1485
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1486
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1714
1487
  const _response = yield core.fetcher({
1715
1488
  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, `Export/paypoints/${core.url.encodePathParam(format)}/${core.url.encodePathParam(orgId)}`),
1716
1489
  method: "GET",
@@ -1743,30 +1516,16 @@ class Export {
1743
1516
  });
1744
1517
  }
1745
1518
  }
1746
- switch (_response.error.reason) {
1747
- case "non-json":
1748
- throw new errors.PayabliError({
1749
- statusCode: _response.error.statusCode,
1750
- body: _response.error.rawBody,
1751
- rawResponse: _response.rawResponse,
1752
- });
1753
- case "timeout":
1754
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/paypoints/{format}/{orgId}.");
1755
- case "unknown":
1756
- throw new errors.PayabliError({
1757
- message: _response.error.errorMessage,
1758
- rawResponse: _response.rawResponse,
1759
- });
1760
- }
1519
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/paypoints/{format}/{orgId}");
1761
1520
  });
1762
1521
  }
1763
1522
  /**
1764
1523
  * Export a list of settled transactions for an entrypoint. Use filters to limit results.
1765
1524
  *
1766
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1767
1525
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1526
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1768
1527
  * @param {Payabli.ExportSettlementsRequest} request
1769
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1528
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1770
1529
  *
1771
1530
  * @throws {@link Payabli.BadRequestError}
1772
1531
  * @throws {@link Payabli.UnauthorizedError}
@@ -1774,17 +1533,17 @@ class Export {
1774
1533
  * @throws {@link Payabli.ServiceUnavailableError}
1775
1534
  *
1776
1535
  * @example
1777
- * await client.export.exportSettlements("8cfec329267", "csv", {
1536
+ * await client.export.exportSettlements("csv", "8cfec329267", {
1778
1537
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
1779
1538
  * fromRecord: 251,
1780
1539
  * limitRecord: 1000
1781
1540
  * })
1782
1541
  */
1783
- exportSettlements(entry, format, request = {}, requestOptions) {
1784
- return core.HttpResponsePromise.fromPromise(this.__exportSettlements(entry, format, request, requestOptions));
1542
+ exportSettlements(format, entry, request = {}, requestOptions) {
1543
+ return core.HttpResponsePromise.fromPromise(this.__exportSettlements(format, entry, request, requestOptions));
1785
1544
  }
1786
- __exportSettlements(entry_1, format_1) {
1787
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
1545
+ __exportSettlements(format_1, entry_1) {
1546
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
1788
1547
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1789
1548
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
1790
1549
  const _queryParams = {};
@@ -1800,7 +1559,8 @@ class Export {
1800
1559
  if (parameters != null) {
1801
1560
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1802
1561
  }
1803
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1562
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1563
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1804
1564
  const _response = yield core.fetcher({
1805
1565
  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, `Export/settlements/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
1806
1566
  method: "GET",
@@ -1833,21 +1593,7 @@ class Export {
1833
1593
  });
1834
1594
  }
1835
1595
  }
1836
- switch (_response.error.reason) {
1837
- case "non-json":
1838
- throw new errors.PayabliError({
1839
- statusCode: _response.error.statusCode,
1840
- body: _response.error.rawBody,
1841
- rawResponse: _response.rawResponse,
1842
- });
1843
- case "timeout":
1844
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/settlements/{format}/{entry}.");
1845
- case "unknown":
1846
- throw new errors.PayabliError({
1847
- message: _response.error.errorMessage,
1848
- rawResponse: _response.rawResponse,
1849
- });
1850
- }
1596
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/settlements/{format}/{entry}");
1851
1597
  });
1852
1598
  }
1853
1599
  /**
@@ -1856,7 +1602,7 @@ class Export {
1856
1602
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1857
1603
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
1858
1604
  * @param {Payabli.ExportSettlementsOrgRequest} request
1859
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1605
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1860
1606
  *
1861
1607
  * @throws {@link Payabli.BadRequestError}
1862
1608
  * @throws {@link Payabli.UnauthorizedError}
@@ -1890,7 +1636,8 @@ class Export {
1890
1636
  if (parameters != null) {
1891
1637
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1892
1638
  }
1893
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1639
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1640
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1894
1641
  const _response = yield core.fetcher({
1895
1642
  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, `Export/settlements/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
1896
1643
  method: "GET",
@@ -1923,30 +1670,16 @@ class Export {
1923
1670
  });
1924
1671
  }
1925
1672
  }
1926
- switch (_response.error.reason) {
1927
- case "non-json":
1928
- throw new errors.PayabliError({
1929
- statusCode: _response.error.statusCode,
1930
- body: _response.error.rawBody,
1931
- rawResponse: _response.rawResponse,
1932
- });
1933
- case "timeout":
1934
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/settlements/{format}/org/{orgId}.");
1935
- case "unknown":
1936
- throw new errors.PayabliError({
1937
- message: _response.error.errorMessage,
1938
- rawResponse: _response.rawResponse,
1939
- });
1940
- }
1673
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/settlements/{format}/org/{orgId}");
1941
1674
  });
1942
1675
  }
1943
1676
  /**
1944
1677
  * Export a list of subscriptions for an entrypoint. Use filters to limit results.
1945
1678
  *
1946
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1947
1679
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1680
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
1948
1681
  * @param {Payabli.ExportSubscriptionsRequest} request
1949
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1682
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
1950
1683
  *
1951
1684
  * @throws {@link Payabli.BadRequestError}
1952
1685
  * @throws {@link Payabli.UnauthorizedError}
@@ -1954,17 +1687,17 @@ class Export {
1954
1687
  * @throws {@link Payabli.ServiceUnavailableError}
1955
1688
  *
1956
1689
  * @example
1957
- * await client.export.exportSubscriptions("8cfec329267", "csv", {
1690
+ * await client.export.exportSubscriptions("csv", "8cfec329267", {
1958
1691
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
1959
1692
  * fromRecord: 251,
1960
1693
  * limitRecord: 1000
1961
1694
  * })
1962
1695
  */
1963
- exportSubscriptions(entry, format, request = {}, requestOptions) {
1964
- return core.HttpResponsePromise.fromPromise(this.__exportSubscriptions(entry, format, request, requestOptions));
1696
+ exportSubscriptions(format, entry, request = {}, requestOptions) {
1697
+ return core.HttpResponsePromise.fromPromise(this.__exportSubscriptions(format, entry, request, requestOptions));
1965
1698
  }
1966
- __exportSubscriptions(entry_1, format_1) {
1967
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
1699
+ __exportSubscriptions(format_1, entry_1) {
1700
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
1968
1701
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1969
1702
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
1970
1703
  const _queryParams = {};
@@ -1980,7 +1713,8 @@ class Export {
1980
1713
  if (parameters != null) {
1981
1714
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
1982
1715
  }
1983
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1716
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1717
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1984
1718
  const _response = yield core.fetcher({
1985
1719
  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, `Export/subscriptions/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
1986
1720
  method: "GET",
@@ -2013,21 +1747,7 @@ class Export {
2013
1747
  });
2014
1748
  }
2015
1749
  }
2016
- switch (_response.error.reason) {
2017
- case "non-json":
2018
- throw new errors.PayabliError({
2019
- statusCode: _response.error.statusCode,
2020
- body: _response.error.rawBody,
2021
- rawResponse: _response.rawResponse,
2022
- });
2023
- case "timeout":
2024
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/subscriptions/{format}/{entry}.");
2025
- case "unknown":
2026
- throw new errors.PayabliError({
2027
- message: _response.error.errorMessage,
2028
- rawResponse: _response.rawResponse,
2029
- });
2030
- }
1750
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/subscriptions/{format}/{entry}");
2031
1751
  });
2032
1752
  }
2033
1753
  /**
@@ -2036,7 +1756,7 @@ class Export {
2036
1756
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
2037
1757
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2038
1758
  * @param {Payabli.ExportSubscriptionsOrgRequest} request
2039
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1759
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2040
1760
  *
2041
1761
  * @throws {@link Payabli.BadRequestError}
2042
1762
  * @throws {@link Payabli.UnauthorizedError}
@@ -2070,7 +1790,8 @@ class Export {
2070
1790
  if (parameters != null) {
2071
1791
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
2072
1792
  }
2073
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1793
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1794
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2074
1795
  const _response = yield core.fetcher({
2075
1796
  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, `Export/subscriptions/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
2076
1797
  method: "GET",
@@ -2103,30 +1824,16 @@ class Export {
2103
1824
  });
2104
1825
  }
2105
1826
  }
2106
- switch (_response.error.reason) {
2107
- case "non-json":
2108
- throw new errors.PayabliError({
2109
- statusCode: _response.error.statusCode,
2110
- body: _response.error.rawBody,
2111
- rawResponse: _response.rawResponse,
2112
- });
2113
- case "timeout":
2114
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/subscriptions/{format}/org/{orgId}.");
2115
- case "unknown":
2116
- throw new errors.PayabliError({
2117
- message: _response.error.errorMessage,
2118
- rawResponse: _response.rawResponse,
2119
- });
2120
- }
1827
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/subscriptions/{format}/org/{orgId}");
2121
1828
  });
2122
1829
  }
2123
1830
  /**
2124
1831
  * Export a list of transactions for an entrypoint in a file in XLXS or CSV format. Use filters to limit results. If you don't specify a date range in the request, the last two months of data are returned.
2125
1832
  *
2126
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2127
1833
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1834
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2128
1835
  * @param {Payabli.ExportTransactionsRequest} request
2129
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1836
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2130
1837
  *
2131
1838
  * @throws {@link Payabli.BadRequestError}
2132
1839
  * @throws {@link Payabli.UnauthorizedError}
@@ -2134,17 +1841,17 @@ class Export {
2134
1841
  * @throws {@link Payabli.ServiceUnavailableError}
2135
1842
  *
2136
1843
  * @example
2137
- * await client.export.exportTransactions("8cfec329267", "csv", {
1844
+ * await client.export.exportTransactions("csv", "8cfec329267", {
2138
1845
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
2139
1846
  * fromRecord: 251,
2140
1847
  * limitRecord: 1000
2141
1848
  * })
2142
1849
  */
2143
- exportTransactions(entry, format, request = {}, requestOptions) {
2144
- return core.HttpResponsePromise.fromPromise(this.__exportTransactions(entry, format, request, requestOptions));
1850
+ exportTransactions(format, entry, request = {}, requestOptions) {
1851
+ return core.HttpResponsePromise.fromPromise(this.__exportTransactions(format, entry, request, requestOptions));
2145
1852
  }
2146
- __exportTransactions(entry_1, format_1) {
2147
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
1853
+ __exportTransactions(format_1, entry_1) {
1854
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
2148
1855
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2149
1856
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
2150
1857
  const _queryParams = {};
@@ -2160,7 +1867,8 @@ class Export {
2160
1867
  if (parameters != null) {
2161
1868
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
2162
1869
  }
2163
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1870
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1871
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2164
1872
  const _response = yield core.fetcher({
2165
1873
  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, `Export/transactions/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
2166
1874
  method: "GET",
@@ -2193,21 +1901,7 @@ class Export {
2193
1901
  });
2194
1902
  }
2195
1903
  }
2196
- switch (_response.error.reason) {
2197
- case "non-json":
2198
- throw new errors.PayabliError({
2199
- statusCode: _response.error.statusCode,
2200
- body: _response.error.rawBody,
2201
- rawResponse: _response.rawResponse,
2202
- });
2203
- case "timeout":
2204
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/transactions/{format}/{entry}.");
2205
- case "unknown":
2206
- throw new errors.PayabliError({
2207
- message: _response.error.errorMessage,
2208
- rawResponse: _response.rawResponse,
2209
- });
2210
- }
1904
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/transactions/{format}/{entry}");
2211
1905
  });
2212
1906
  }
2213
1907
  /**
@@ -2216,7 +1910,7 @@ class Export {
2216
1910
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
2217
1911
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2218
1912
  * @param {Payabli.ExportTransactionsOrgRequest} request
2219
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1913
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2220
1914
  *
2221
1915
  * @throws {@link Payabli.BadRequestError}
2222
1916
  * @throws {@link Payabli.UnauthorizedError}
@@ -2250,7 +1944,8 @@ class Export {
2250
1944
  if (parameters != null) {
2251
1945
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
2252
1946
  }
2253
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1947
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1948
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2254
1949
  const _response = yield core.fetcher({
2255
1950
  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, `Export/transactions/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
2256
1951
  method: "GET",
@@ -2283,31 +1978,17 @@ class Export {
2283
1978
  });
2284
1979
  }
2285
1980
  }
2286
- switch (_response.error.reason) {
2287
- case "non-json":
2288
- throw new errors.PayabliError({
2289
- statusCode: _response.error.statusCode,
2290
- body: _response.error.rawBody,
2291
- rawResponse: _response.rawResponse,
2292
- });
2293
- case "timeout":
2294
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/transactions/{format}/org/{orgId}.");
2295
- case "unknown":
2296
- throw new errors.PayabliError({
2297
- message: _response.error.errorMessage,
2298
- rawResponse: _response.rawResponse,
2299
- });
2300
- }
1981
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/transactions/{format}/org/{orgId}");
2301
1982
  });
2302
1983
  }
2303
1984
  /**
2304
1985
  * Export a list of transfer details for an entrypoint. Use filters to limit results.
2305
1986
  *
2306
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2307
1987
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
1988
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2308
1989
  * @param {number} transferId - Transfer identifier.
2309
1990
  * @param {Payabli.ExportTransferDetailsRequest} request
2310
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
1991
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2311
1992
  *
2312
1993
  * @throws {@link Payabli.BadRequestError}
2313
1994
  * @throws {@link Payabli.UnauthorizedError}
@@ -2315,18 +1996,18 @@ class Export {
2315
1996
  * @throws {@link Payabli.ServiceUnavailableError}
2316
1997
  *
2317
1998
  * @example
2318
- * await client.export.exportTransferDetails("8cfec329267", "csv", 1000000, {
1999
+ * await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, {
2319
2000
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
2320
2001
  * fromRecord: 251,
2321
2002
  * limitRecord: 1000,
2322
2003
  * sortBy: "desc(field_name)"
2323
2004
  * })
2324
2005
  */
2325
- exportTransferDetails(entry, format, transferId, request = {}, requestOptions) {
2326
- return core.HttpResponsePromise.fromPromise(this.__exportTransferDetails(entry, format, transferId, request, requestOptions));
2006
+ exportTransferDetails(format, entry, transferId, request = {}, requestOptions) {
2007
+ return core.HttpResponsePromise.fromPromise(this.__exportTransferDetails(format, entry, transferId, request, requestOptions));
2327
2008
  }
2328
- __exportTransferDetails(entry_1, format_1, transferId_1) {
2329
- return __awaiter(this, arguments, void 0, function* (entry, format, transferId, request = {}, requestOptions) {
2009
+ __exportTransferDetails(format_1, entry_1, transferId_1) {
2010
+ return __awaiter(this, arguments, void 0, function* (format, entry, transferId, request = {}, requestOptions) {
2330
2011
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2331
2012
  const { columnsExport, fromRecord, limitRecord, parameters, sortBy } = request;
2332
2013
  const _queryParams = {};
@@ -2345,7 +2026,8 @@ class Export {
2345
2026
  if (sortBy != null) {
2346
2027
  _queryParams.sortBy = sortBy;
2347
2028
  }
2348
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2029
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2030
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2349
2031
  const _response = yield core.fetcher({
2350
2032
  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, `Export/transferDetails/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(transferId)}`),
2351
2033
  method: "GET",
@@ -2378,21 +2060,7 @@ class Export {
2378
2060
  });
2379
2061
  }
2380
2062
  }
2381
- switch (_response.error.reason) {
2382
- case "non-json":
2383
- throw new errors.PayabliError({
2384
- statusCode: _response.error.statusCode,
2385
- body: _response.error.rawBody,
2386
- rawResponse: _response.rawResponse,
2387
- });
2388
- case "timeout":
2389
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/transferDetails/{format}/{entry}/{transferId}.");
2390
- case "unknown":
2391
- throw new errors.PayabliError({
2392
- message: _response.error.errorMessage,
2393
- rawResponse: _response.rawResponse,
2394
- });
2395
- }
2063
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/transferDetails/{format}/{entry}/{transferId}");
2396
2064
  });
2397
2065
  }
2398
2066
  /**
@@ -2400,7 +2068,7 @@ class Export {
2400
2068
  *
2401
2069
  * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2402
2070
  * @param {Payabli.ExportTransfersRequest} request
2403
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
2071
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2404
2072
  *
2405
2073
  * @throws {@link Payabli.BadRequestError}
2406
2074
  * @throws {@link Payabli.UnauthorizedError}
@@ -2438,7 +2106,8 @@ class Export {
2438
2106
  if (sortBy != null) {
2439
2107
  _queryParams.sortBy = sortBy;
2440
2108
  }
2441
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2109
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2110
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2442
2111
  const _response = yield core.fetcher({
2443
2112
  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, `Export/transfers/${core.url.encodePathParam(entry)}`),
2444
2113
  method: "GET",
@@ -2471,30 +2140,16 @@ class Export {
2471
2140
  });
2472
2141
  }
2473
2142
  }
2474
- switch (_response.error.reason) {
2475
- case "non-json":
2476
- throw new errors.PayabliError({
2477
- statusCode: _response.error.statusCode,
2478
- body: _response.error.rawBody,
2479
- rawResponse: _response.rawResponse,
2480
- });
2481
- case "timeout":
2482
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/transfers/{entry}.");
2483
- case "unknown":
2484
- throw new errors.PayabliError({
2485
- message: _response.error.errorMessage,
2486
- rawResponse: _response.rawResponse,
2487
- });
2488
- }
2143
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/transfers/{entry}");
2489
2144
  });
2490
2145
  }
2491
2146
  /**
2492
2147
  * Export a list of vendors for an entrypoint. Use filters to limit results.
2493
2148
  *
2494
- * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2495
2149
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
2150
+ * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
2496
2151
  * @param {Payabli.ExportVendorsRequest} request
2497
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
2152
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2498
2153
  *
2499
2154
  * @throws {@link Payabli.BadRequestError}
2500
2155
  * @throws {@link Payabli.UnauthorizedError}
@@ -2502,17 +2157,17 @@ class Export {
2502
2157
  * @throws {@link Payabli.ServiceUnavailableError}
2503
2158
  *
2504
2159
  * @example
2505
- * await client.export.exportVendors("8cfec329267", "csv", {
2160
+ * await client.export.exportVendors("csv", "8cfec329267", {
2506
2161
  * columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name",
2507
2162
  * fromRecord: 251,
2508
2163
  * limitRecord: 1000
2509
2164
  * })
2510
2165
  */
2511
- exportVendors(entry, format, request = {}, requestOptions) {
2512
- return core.HttpResponsePromise.fromPromise(this.__exportVendors(entry, format, request, requestOptions));
2166
+ exportVendors(format, entry, request = {}, requestOptions) {
2167
+ return core.HttpResponsePromise.fromPromise(this.__exportVendors(format, entry, request, requestOptions));
2513
2168
  }
2514
- __exportVendors(entry_1, format_1) {
2515
- return __awaiter(this, arguments, void 0, function* (entry, format, request = {}, requestOptions) {
2169
+ __exportVendors(format_1, entry_1) {
2170
+ return __awaiter(this, arguments, void 0, function* (format, entry, request = {}, requestOptions) {
2516
2171
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2517
2172
  const { columnsExport, fromRecord, limitRecord, parameters } = request;
2518
2173
  const _queryParams = {};
@@ -2528,7 +2183,8 @@ class Export {
2528
2183
  if (parameters != null) {
2529
2184
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
2530
2185
  }
2531
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2186
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2187
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2532
2188
  const _response = yield core.fetcher({
2533
2189
  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, `Export/vendors/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`),
2534
2190
  method: "GET",
@@ -2561,21 +2217,7 @@ class Export {
2561
2217
  });
2562
2218
  }
2563
2219
  }
2564
- switch (_response.error.reason) {
2565
- case "non-json":
2566
- throw new errors.PayabliError({
2567
- statusCode: _response.error.statusCode,
2568
- body: _response.error.rawBody,
2569
- rawResponse: _response.rawResponse,
2570
- });
2571
- case "timeout":
2572
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/vendors/{format}/{entry}.");
2573
- case "unknown":
2574
- throw new errors.PayabliError({
2575
- message: _response.error.errorMessage,
2576
- rawResponse: _response.rawResponse,
2577
- });
2578
- }
2220
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/vendors/{format}/{entry}");
2579
2221
  });
2580
2222
  }
2581
2223
  /**
@@ -2584,7 +2226,7 @@ class Export {
2584
2226
  * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV.
2585
2227
  * @param {number} orgId - The numeric identifier for organization, assigned by Payabli.
2586
2228
  * @param {Payabli.ExportVendorsOrgRequest} request
2587
- * @param {Export.RequestOptions} requestOptions - Request-specific configuration.
2229
+ * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration.
2588
2230
  *
2589
2231
  * @throws {@link Payabli.BadRequestError}
2590
2232
  * @throws {@link Payabli.UnauthorizedError}
@@ -2618,7 +2260,8 @@ class Export {
2618
2260
  if (parameters != null) {
2619
2261
  _queryParams.parameters = (0, json_js_1.toJson)(parameters);
2620
2262
  }
2621
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2263
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
2264
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
2622
2265
  const _response = yield core.fetcher({
2623
2266
  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, `Export/vendors/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`),
2624
2267
  method: "GET",
@@ -2651,28 +2294,8 @@ class Export {
2651
2294
  });
2652
2295
  }
2653
2296
  }
2654
- switch (_response.error.reason) {
2655
- case "non-json":
2656
- throw new errors.PayabliError({
2657
- statusCode: _response.error.statusCode,
2658
- body: _response.error.rawBody,
2659
- rawResponse: _response.rawResponse,
2660
- });
2661
- case "timeout":
2662
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/vendors/{format}/org/{orgId}.");
2663
- case "unknown":
2664
- throw new errors.PayabliError({
2665
- message: _response.error.errorMessage,
2666
- rawResponse: _response.rawResponse,
2667
- });
2668
- }
2669
- });
2670
- }
2671
- _getCustomAuthorizationHeaders() {
2672
- return __awaiter(this, void 0, void 0, function* () {
2673
- const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
2674
- return { requestToken: apiKeyValue };
2297
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/Export/vendors/{format}/org/{orgId}");
2675
2298
  });
2676
2299
  }
2677
2300
  }
2678
- exports.Export = Export;
2301
+ exports.ExportClient = ExportClient;