@payabli/sdk-node 0.0.116 → 0.0.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +31 -2
  2. package/dist/cjs/BaseClient.d.ts +13 -4
  3. package/dist/cjs/BaseClient.js +59 -0
  4. package/dist/cjs/Client.d.ts +88 -88
  5. package/dist/cjs/Client.js +31 -72
  6. package/dist/cjs/api/errors/BadRequestError.js +5 -1
  7. package/dist/cjs/api/errors/ConflictError.js +5 -1
  8. package/dist/cjs/api/errors/ForbiddenError.js +5 -1
  9. package/dist/cjs/api/errors/InternalServerError.js +5 -1
  10. package/dist/cjs/api/errors/ServiceUnavailableError.js +5 -1
  11. package/dist/cjs/api/errors/UnauthorizedError.js +5 -1
  12. package/dist/cjs/api/resources/bill/client/Client.d.ts +34 -35
  13. package/dist/cjs/api/resources/bill/client/Client.js +69 -216
  14. package/dist/cjs/api/resources/boarding/client/Client.d.ts +28 -29
  15. package/dist/cjs/api/resources/boarding/client/Client.js +51 -198
  16. package/dist/cjs/api/resources/chargeBacks/client/Client.d.ts +18 -17
  17. package/dist/cjs/api/resources/chargeBacks/client/Client.js +38 -79
  18. package/dist/cjs/api/resources/checkCapture/client/Client.d.ts +8 -9
  19. package/dist/cjs/api/resources/checkCapture/client/Client.js +11 -28
  20. package/dist/cjs/api/resources/cloud/client/Client.d.ts +18 -19
  21. package/dist/cjs/api/resources/cloud/client/Client.js +33 -89
  22. package/dist/cjs/api/resources/customer/client/Client.d.ts +18 -19
  23. package/dist/cjs/api/resources/customer/client/Client.js +31 -113
  24. package/dist/cjs/api/resources/export/client/Client.d.ts +94 -91
  25. package/dist/cjs/api/resources/export/client/Client.js +205 -582
  26. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.d.ts +12 -13
  27. package/dist/cjs/api/resources/hostedPaymentPages/client/Client.js +19 -62
  28. package/dist/cjs/api/resources/import/client/Client.d.ts +12 -13
  29. package/dist/cjs/api/resources/import/client/Client.js +19 -62
  30. package/dist/cjs/api/resources/invoice/client/Client.d.ts +37 -36
  31. package/dist/cjs/api/resources/invoice/client/Client.js +67 -212
  32. package/dist/cjs/api/resources/invoice/client/requests/AddInvoiceRequest.d.ts +5 -3
  33. package/dist/cjs/api/resources/lineItem/client/Client.d.ts +16 -17
  34. package/dist/cjs/api/resources/lineItem/client/Client.js +27 -96
  35. package/dist/cjs/api/resources/moneyIn/client/Client.d.ts +40 -41
  36. package/dist/cjs/api/resources/moneyIn/client/Client.js +79 -249
  37. package/dist/cjs/api/resources/moneyIn/errors/CaptureError.js +5 -1
  38. package/dist/cjs/api/resources/moneyIn/errors/InvalidTransStatusError.js +5 -1
  39. package/dist/cjs/api/resources/moneyOut/client/Client.d.ts +44 -28
  40. package/dist/cjs/api/resources/moneyOut/client/Client.js +105 -168
  41. package/dist/cjs/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.ts +2 -1
  42. package/dist/cjs/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.ts +3 -1
  43. package/dist/cjs/api/resources/notification/client/Client.d.ts +30 -18
  44. package/dist/cjs/api/resources/notification/client/Client.js +45 -101
  45. package/dist/cjs/api/resources/notificationlogs/client/Client.d.ts +14 -15
  46. package/dist/cjs/api/resources/notificationlogs/client/Client.js +23 -79
  47. package/dist/cjs/api/resources/ocr/client/Client.d.ts +14 -11
  48. package/dist/cjs/api/resources/ocr/client/Client.js +19 -45
  49. package/dist/cjs/api/resources/organization/client/Client.d.ts +20 -21
  50. package/dist/cjs/api/resources/organization/client/Client.js +35 -130
  51. package/dist/cjs/api/resources/paymentLink/client/Client.d.ts +27 -28
  52. package/dist/cjs/api/resources/paymentLink/client/Client.js +46 -167
  53. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataBill.d.ts +1 -1
  54. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.ts +1 -1
  55. package/dist/cjs/api/resources/paymentLink/client/requests/PayLinkDataOut.d.ts +1 -1
  56. package/dist/cjs/api/resources/paymentLink/types/PaymentPageRequestBody.d.ts +2 -2
  57. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.d.ts +20 -21
  58. package/dist/cjs/api/resources/paymentMethodDomain/client/Client.js +35 -130
  59. package/dist/cjs/api/resources/paypoint/client/Client.d.ts +23 -24
  60. package/dist/cjs/api/resources/paypoint/client/Client.js +44 -152
  61. package/dist/cjs/api/resources/query/client/Client.d.ts +72 -73
  62. package/dist/cjs/api/resources/query/client/Client.js +137 -572
  63. package/dist/cjs/api/resources/query/client/requests/ListPayoutOrgRequest.d.ts +1 -0
  64. package/dist/cjs/api/resources/query/client/requests/ListPayoutRequest.d.ts +1 -0
  65. package/dist/cjs/api/resources/query/client/requests/ListTransactionsRequest.d.ts +1 -0
  66. package/dist/cjs/api/resources/statistic/client/Client.d.ts +51 -52
  67. package/dist/cjs/api/resources/statistic/client/Client.js +80 -133
  68. package/dist/cjs/api/resources/statistic/client/requests/BasicStatsRequest.d.ts +2 -2
  69. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.ts +76 -0
  70. package/dist/cjs/api/resources/statistic/types/StatBasicExtendedQueryRecord.js +3 -0
  71. package/dist/cjs/api/resources/statistic/types/index.d.ts +1 -0
  72. package/dist/cjs/api/resources/statistic/types/index.js +1 -0
  73. package/dist/cjs/api/resources/subscription/client/Client.d.ts +14 -15
  74. package/dist/cjs/api/resources/subscription/client/Client.js +23 -79
  75. package/dist/cjs/api/resources/templates/client/Client.d.ts +16 -17
  76. package/dist/cjs/api/resources/templates/client/Client.js +28 -84
  77. package/dist/cjs/api/resources/tokenStorage/client/Client.d.ts +14 -15
  78. package/dist/cjs/api/resources/tokenStorage/client/Client.js +23 -79
  79. package/dist/cjs/api/resources/tokenStorage/types/GetMethodResponse.d.ts +1 -1
  80. package/dist/cjs/api/resources/user/client/Client.d.ts +55 -34
  81. package/dist/cjs/api/resources/user/client/Client.js +84 -222
  82. package/dist/cjs/api/resources/vendor/client/Client.d.ts +14 -15
  83. package/dist/cjs/api/resources/vendor/client/Client.js +23 -79
  84. package/dist/cjs/api/resources/wallet/client/Client.d.ts +14 -15
  85. package/dist/cjs/api/resources/wallet/client/Client.js +23 -79
  86. package/dist/cjs/api/types/ApplicationDetailsRecord.d.ts +2 -2
  87. package/dist/cjs/api/types/Frequency.d.ts +1 -1
  88. package/dist/cjs/api/types/Frequency.js +1 -1
  89. package/dist/cjs/api/types/FrequencyList.d.ts +1 -1
  90. package/dist/cjs/api/types/NotificationContent.d.ts +1 -0
  91. package/dist/cjs/api/types/NotificationContent.js +1 -0
  92. package/dist/cjs/api/types/NotificationStandardRequest.d.ts +1 -0
  93. package/dist/cjs/api/types/NotificationStandardRequest.js +1 -0
  94. package/dist/cjs/api/types/PayorDataResponse.d.ts +1 -1
  95. package/dist/cjs/api/types/QueryResponseSettlements.d.ts +1 -1
  96. package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -0
  97. package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
  98. package/dist/cjs/auth/index.d.ts +1 -0
  99. package/dist/cjs/auth/index.js +5 -0
  100. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  101. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  102. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  103. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  104. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  105. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  106. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  107. package/dist/cjs/core/auth/BearerToken.js +16 -0
  108. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  109. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  110. package/dist/cjs/core/auth/index.d.ts +5 -0
  111. package/dist/cjs/core/auth/index.js +9 -0
  112. package/dist/cjs/core/base64.d.ts +2 -0
  113. package/dist/cjs/core/base64.js +26 -0
  114. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
  115. package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
  116. package/dist/cjs/core/fetcher/Fetcher.js +42 -24
  117. package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
  118. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  119. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  120. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  121. package/dist/cjs/core/fetcher/signals.d.ts +1 -7
  122. package/dist/cjs/core/fetcher/signals.js +0 -12
  123. package/dist/cjs/core/index.d.ts +2 -0
  124. package/dist/cjs/core/index.js +2 -0
  125. package/dist/cjs/core/logging/logger.js +1 -1
  126. package/dist/cjs/core/runtime/runtime.js +11 -10
  127. package/dist/cjs/core/url/join.js +0 -1
  128. package/dist/cjs/errors/PayabliError.js +5 -1
  129. package/dist/cjs/errors/PayabliTimeoutError.js +5 -1
  130. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  131. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  132. package/dist/cjs/version.d.ts +1 -1
  133. package/dist/cjs/version.js +1 -1
  134. package/dist/esm/BaseClient.d.mts +13 -4
  135. package/dist/esm/BaseClient.mjs +24 -1
  136. package/dist/esm/Client.d.mts +88 -88
  137. package/dist/esm/Client.mjs +59 -67
  138. package/dist/esm/api/errors/BadRequestError.mjs +5 -1
  139. package/dist/esm/api/errors/ConflictError.mjs +5 -1
  140. package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
  141. package/dist/esm/api/errors/InternalServerError.mjs +5 -1
  142. package/dist/esm/api/errors/ServiceUnavailableError.mjs +5 -1
  143. package/dist/esm/api/errors/UnauthorizedError.mjs +5 -1
  144. package/dist/esm/api/resources/bill/client/Client.d.mts +34 -35
  145. package/dist/esm/api/resources/bill/client/Client.mjs +67 -214
  146. package/dist/esm/api/resources/boarding/client/Client.d.mts +28 -29
  147. package/dist/esm/api/resources/boarding/client/Client.mjs +50 -197
  148. package/dist/esm/api/resources/chargeBacks/client/Client.d.mts +18 -17
  149. package/dist/esm/api/resources/chargeBacks/client/Client.mjs +36 -77
  150. package/dist/esm/api/resources/checkCapture/client/Client.d.mts +8 -9
  151. package/dist/esm/api/resources/checkCapture/client/Client.mjs +10 -27
  152. package/dist/esm/api/resources/cloud/client/Client.d.mts +18 -19
  153. package/dist/esm/api/resources/cloud/client/Client.mjs +31 -87
  154. package/dist/esm/api/resources/customer/client/Client.d.mts +18 -19
  155. package/dist/esm/api/resources/customer/client/Client.mjs +29 -111
  156. package/dist/esm/api/resources/export/client/Client.d.mts +94 -91
  157. package/dist/esm/api/resources/export/client/Client.mjs +204 -581
  158. package/dist/esm/api/resources/hostedPaymentPages/client/Client.d.mts +12 -13
  159. package/dist/esm/api/resources/hostedPaymentPages/client/Client.mjs +17 -60
  160. package/dist/esm/api/resources/import/client/Client.d.mts +12 -13
  161. package/dist/esm/api/resources/import/client/Client.mjs +17 -60
  162. package/dist/esm/api/resources/invoice/client/Client.d.mts +37 -36
  163. package/dist/esm/api/resources/invoice/client/Client.mjs +65 -210
  164. package/dist/esm/api/resources/invoice/client/requests/AddInvoiceRequest.d.mts +5 -3
  165. package/dist/esm/api/resources/lineItem/client/Client.d.mts +16 -17
  166. package/dist/esm/api/resources/lineItem/client/Client.mjs +25 -94
  167. package/dist/esm/api/resources/moneyIn/client/Client.d.mts +40 -41
  168. package/dist/esm/api/resources/moneyIn/client/Client.mjs +77 -247
  169. package/dist/esm/api/resources/moneyIn/errors/CaptureError.mjs +5 -1
  170. package/dist/esm/api/resources/moneyIn/errors/InvalidTransStatusError.mjs +5 -1
  171. package/dist/esm/api/resources/moneyOut/client/Client.d.mts +44 -28
  172. package/dist/esm/api/resources/moneyOut/client/Client.mjs +103 -166
  173. package/dist/esm/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.d.mts +2 -1
  174. package/dist/esm/api/resources/moneyOutTypes/types/AuthorizePayoutBody.d.mts +3 -1
  175. package/dist/esm/api/resources/notification/client/Client.d.mts +30 -18
  176. package/dist/esm/api/resources/notification/client/Client.mjs +44 -100
  177. package/dist/esm/api/resources/notificationlogs/client/Client.d.mts +14 -15
  178. package/dist/esm/api/resources/notificationlogs/client/Client.mjs +22 -78
  179. package/dist/esm/api/resources/ocr/client/Client.d.mts +14 -11
  180. package/dist/esm/api/resources/ocr/client/Client.mjs +18 -44
  181. package/dist/esm/api/resources/organization/client/Client.d.mts +20 -21
  182. package/dist/esm/api/resources/organization/client/Client.mjs +33 -128
  183. package/dist/esm/api/resources/paymentLink/client/Client.d.mts +27 -28
  184. package/dist/esm/api/resources/paymentLink/client/Client.mjs +44 -165
  185. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataBill.d.mts +1 -1
  186. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataInvoice.d.mts +1 -1
  187. package/dist/esm/api/resources/paymentLink/client/requests/PayLinkDataOut.d.mts +1 -1
  188. package/dist/esm/api/resources/paymentLink/types/PaymentPageRequestBody.d.mts +2 -2
  189. package/dist/esm/api/resources/paymentMethodDomain/client/Client.d.mts +20 -21
  190. package/dist/esm/api/resources/paymentMethodDomain/client/Client.mjs +34 -129
  191. package/dist/esm/api/resources/paypoint/client/Client.d.mts +23 -24
  192. package/dist/esm/api/resources/paypoint/client/Client.mjs +43 -151
  193. package/dist/esm/api/resources/query/client/Client.d.mts +72 -73
  194. package/dist/esm/api/resources/query/client/Client.mjs +136 -571
  195. package/dist/esm/api/resources/query/client/requests/ListPayoutOrgRequest.d.mts +1 -0
  196. package/dist/esm/api/resources/query/client/requests/ListPayoutRequest.d.mts +1 -0
  197. package/dist/esm/api/resources/query/client/requests/ListTransactionsRequest.d.mts +1 -0
  198. package/dist/esm/api/resources/statistic/client/Client.d.mts +51 -52
  199. package/dist/esm/api/resources/statistic/client/Client.mjs +79 -132
  200. package/dist/esm/api/resources/statistic/client/requests/BasicStatsRequest.d.mts +2 -2
  201. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.d.mts +76 -0
  202. package/dist/esm/api/resources/statistic/types/StatBasicExtendedQueryRecord.mjs +2 -0
  203. package/dist/esm/api/resources/statistic/types/index.d.mts +1 -0
  204. package/dist/esm/api/resources/statistic/types/index.mjs +1 -0
  205. package/dist/esm/api/resources/subscription/client/Client.d.mts +14 -15
  206. package/dist/esm/api/resources/subscription/client/Client.mjs +21 -77
  207. package/dist/esm/api/resources/templates/client/Client.d.mts +16 -17
  208. package/dist/esm/api/resources/templates/client/Client.mjs +27 -83
  209. package/dist/esm/api/resources/tokenStorage/client/Client.d.mts +14 -15
  210. package/dist/esm/api/resources/tokenStorage/client/Client.mjs +21 -77
  211. package/dist/esm/api/resources/tokenStorage/types/GetMethodResponse.d.mts +1 -1
  212. package/dist/esm/api/resources/user/client/Client.d.mts +55 -34
  213. package/dist/esm/api/resources/user/client/Client.mjs +83 -221
  214. package/dist/esm/api/resources/vendor/client/Client.d.mts +14 -15
  215. package/dist/esm/api/resources/vendor/client/Client.mjs +22 -78
  216. package/dist/esm/api/resources/wallet/client/Client.d.mts +14 -15
  217. package/dist/esm/api/resources/wallet/client/Client.mjs +22 -78
  218. package/dist/esm/api/types/ApplicationDetailsRecord.d.mts +2 -2
  219. package/dist/esm/api/types/Frequency.d.mts +1 -1
  220. package/dist/esm/api/types/Frequency.mjs +1 -1
  221. package/dist/esm/api/types/FrequencyList.d.mts +1 -1
  222. package/dist/esm/api/types/NotificationContent.d.mts +1 -0
  223. package/dist/esm/api/types/NotificationContent.mjs +1 -0
  224. package/dist/esm/api/types/NotificationStandardRequest.d.mts +1 -0
  225. package/dist/esm/api/types/NotificationStandardRequest.mjs +1 -0
  226. package/dist/esm/api/types/PayorDataResponse.d.mts +1 -1
  227. package/dist/esm/api/types/QueryResponseSettlements.d.mts +1 -1
  228. package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -0
  229. package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
  230. package/dist/esm/auth/index.d.mts +1 -0
  231. package/dist/esm/auth/index.mjs +1 -0
  232. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  233. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  234. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  235. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  236. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  237. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  238. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  239. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  240. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  241. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  242. package/dist/esm/core/auth/index.d.mts +5 -0
  243. package/dist/esm/core/auth/index.mjs +3 -0
  244. package/dist/esm/core/base64.d.mts +2 -0
  245. package/dist/esm/core/base64.mjs +22 -0
  246. package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
  247. package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
  248. package/dist/esm/core/fetcher/Fetcher.mjs +42 -24
  249. package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
  250. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  251. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  252. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  253. package/dist/esm/core/fetcher/signals.d.mts +1 -7
  254. package/dist/esm/core/fetcher/signals.mjs +0 -12
  255. package/dist/esm/core/index.d.mts +2 -0
  256. package/dist/esm/core/index.mjs +2 -0
  257. package/dist/esm/core/logging/logger.mjs +1 -1
  258. package/dist/esm/core/runtime/runtime.mjs +11 -10
  259. package/dist/esm/core/url/join.mjs +0 -1
  260. package/dist/esm/errors/PayabliError.mjs +5 -1
  261. package/dist/esm/errors/PayabliTimeoutError.mjs +5 -1
  262. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  263. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  264. package/dist/esm/version.d.mts +1 -1
  265. package/dist/esm/version.mjs +1 -1
  266. package/package.json +5 -2
  267. package/reference.md +768 -478
  268. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  269. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  270. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  271. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
@@ -43,19 +43,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.User = void 0;
46
+ exports.UserClient = 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 environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
50
52
  const errors = __importStar(require("../../../../errors/index.js"));
51
53
  const Payabli = __importStar(require("../../../index.js"));
52
- class User {
53
- constructor(_options = {}) {
54
- this._options = _options;
54
+ class UserClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
55
57
  }
56
58
  /**
59
+ * Use this endpoint to add a new user to an organization.
60
+ *
57
61
  * @param {Payabli.UserData} request
58
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
62
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
59
63
  *
60
64
  * @throws {@link Payabli.BadRequestError}
61
65
  * @throws {@link Payabli.UnauthorizedError}
@@ -71,7 +75,8 @@ class User {
71
75
  __addUser(request, requestOptions) {
72
76
  return __awaiter(this, void 0, void 0, function* () {
73
77
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
74
- 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);
78
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
79
+ 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);
75
80
  const _response = yield core.fetcher({
76
81
  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, "User"),
77
82
  method: "POST",
@@ -107,25 +112,13 @@ class User {
107
112
  });
108
113
  }
109
114
  }
110
- switch (_response.error.reason) {
111
- case "non-json":
112
- throw new errors.PayabliError({
113
- statusCode: _response.error.statusCode,
114
- body: _response.error.rawBody,
115
- rawResponse: _response.rawResponse,
116
- });
117
- case "timeout":
118
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User.");
119
- case "unknown":
120
- throw new errors.PayabliError({
121
- message: _response.error.errorMessage,
122
- rawResponse: _response.rawResponse,
123
- });
124
- }
115
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User");
125
116
  });
126
117
  }
127
118
  /**
128
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
119
+ * Use this endpoint to refresh the authentication token for a user within an organization.
120
+ *
121
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
129
122
  *
130
123
  * @throws {@link Payabli.BadRequestError}
131
124
  * @throws {@link Payabli.UnauthorizedError}
@@ -141,7 +134,8 @@ class User {
141
134
  __authRefreshUser(requestOptions) {
142
135
  return __awaiter(this, void 0, void 0, function* () {
143
136
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
144
- 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);
137
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
138
+ 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);
145
139
  const _response = yield core.fetcher({
146
140
  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, "User/authrefresh"),
147
141
  method: "POST",
@@ -174,26 +168,14 @@ class User {
174
168
  });
175
169
  }
176
170
  }
177
- switch (_response.error.reason) {
178
- case "non-json":
179
- throw new errors.PayabliError({
180
- statusCode: _response.error.statusCode,
181
- body: _response.error.rawBody,
182
- rawResponse: _response.rawResponse,
183
- });
184
- case "timeout":
185
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/authrefresh.");
186
- case "unknown":
187
- throw new errors.PayabliError({
188
- message: _response.error.errorMessage,
189
- rawResponse: _response.rawResponse,
190
- });
191
- }
171
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User/authrefresh");
192
172
  });
193
173
  }
194
174
  /**
175
+ * Use this endpoint to initiate a password reset for a user within an organization.
176
+ *
195
177
  * @param {Payabli.UserAuthResetRequest} request
196
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
178
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
197
179
  *
198
180
  * @throws {@link Payabli.BadRequestError}
199
181
  * @throws {@link Payabli.UnauthorizedError}
@@ -209,7 +191,8 @@ class User {
209
191
  __authResetUser() {
210
192
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
211
193
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
212
- 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);
194
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
195
+ 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);
213
196
  const _response = yield core.fetcher({
214
197
  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, "User/authreset"),
215
198
  method: "POST",
@@ -245,21 +228,7 @@ class User {
245
228
  });
246
229
  }
247
230
  }
248
- switch (_response.error.reason) {
249
- case "non-json":
250
- throw new errors.PayabliError({
251
- statusCode: _response.error.statusCode,
252
- body: _response.error.rawBody,
253
- rawResponse: _response.rawResponse,
254
- });
255
- case "timeout":
256
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/authreset.");
257
- case "unknown":
258
- throw new errors.PayabliError({
259
- message: _response.error.errorMessage,
260
- rawResponse: _response.rawResponse,
261
- });
262
- }
231
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User/authreset");
263
232
  });
264
233
  }
265
234
  /**
@@ -267,7 +236,7 @@ class User {
267
236
  *
268
237
  * @param {string} provider - Auth provider. This fields is optional and defaults to null for the built-in provider.
269
238
  * @param {Payabli.UserAuthRequest} request
270
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
239
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
271
240
  *
272
241
  * @throws {@link Payabli.BadRequestError}
273
242
  * @throws {@link Payabli.UnauthorizedError}
@@ -283,7 +252,8 @@ class User {
283
252
  __authUser(provider_1) {
284
253
  return __awaiter(this, arguments, void 0, function* (provider, request = {}, requestOptions) {
285
254
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
286
- 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);
255
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
256
+ 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);
287
257
  const _response = yield core.fetcher({
288
258
  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, `User/auth/${core.url.encodePathParam(provider)}`),
289
259
  method: "POST",
@@ -319,26 +289,14 @@ class User {
319
289
  });
320
290
  }
321
291
  }
322
- switch (_response.error.reason) {
323
- case "non-json":
324
- throw new errors.PayabliError({
325
- statusCode: _response.error.statusCode,
326
- body: _response.error.rawBody,
327
- rawResponse: _response.rawResponse,
328
- });
329
- case "timeout":
330
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/auth/{provider}.");
331
- case "unknown":
332
- throw new errors.PayabliError({
333
- message: _response.error.errorMessage,
334
- rawResponse: _response.rawResponse,
335
- });
336
- }
292
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User/auth/{provider}");
337
293
  });
338
294
  }
339
295
  /**
296
+ * Use this endpoint to change the password for a user within an organization.
297
+ *
340
298
  * @param {Payabli.UserAuthPswResetRequest} request
341
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
299
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
342
300
  *
343
301
  * @throws {@link Payabli.BadRequestError}
344
302
  * @throws {@link Payabli.UnauthorizedError}
@@ -354,7 +312,8 @@ class User {
354
312
  __changePswUser() {
355
313
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
356
314
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
357
- 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);
315
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
316
+ 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);
358
317
  const _response = yield core.fetcher({
359
318
  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, "User/authpsw"),
360
319
  method: "PUT",
@@ -390,26 +349,14 @@ class User {
390
349
  });
391
350
  }
392
351
  }
393
- switch (_response.error.reason) {
394
- case "non-json":
395
- throw new errors.PayabliError({
396
- statusCode: _response.error.statusCode,
397
- body: _response.error.rawBody,
398
- rawResponse: _response.rawResponse,
399
- });
400
- case "timeout":
401
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/authpsw.");
402
- case "unknown":
403
- throw new errors.PayabliError({
404
- message: _response.error.errorMessage,
405
- rawResponse: _response.rawResponse,
406
- });
407
- }
352
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/User/authpsw");
408
353
  });
409
354
  }
410
355
  /**
356
+ * Use this endpoint to delete a specific user within an organization.
357
+ *
411
358
  * @param {number} userId - The Payabli-generated `userId` value.
412
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
359
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
413
360
  *
414
361
  * @throws {@link Payabli.BadRequestError}
415
362
  * @throws {@link Payabli.UnauthorizedError}
@@ -425,7 +372,8 @@ class User {
425
372
  __deleteUser(userId, requestOptions) {
426
373
  return __awaiter(this, void 0, void 0, function* () {
427
374
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
428
- 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);
375
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
376
+ 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);
429
377
  const _response = yield core.fetcher({
430
378
  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, `User/${core.url.encodePathParam(userId)}`),
431
379
  method: "DELETE",
@@ -458,27 +406,15 @@ class User {
458
406
  });
459
407
  }
460
408
  }
461
- switch (_response.error.reason) {
462
- case "non-json":
463
- throw new errors.PayabliError({
464
- statusCode: _response.error.statusCode,
465
- body: _response.error.rawBody,
466
- rawResponse: _response.rawResponse,
467
- });
468
- case "timeout":
469
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /User/{userId}.");
470
- case "unknown":
471
- throw new errors.PayabliError({
472
- message: _response.error.errorMessage,
473
- rawResponse: _response.rawResponse,
474
- });
475
- }
409
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/User/{userId}");
476
410
  });
477
411
  }
478
412
  /**
413
+ * Use this endpoint to enable or disable multi-factor authentication (MFA) for a user within an organization.
414
+ *
479
415
  * @param {number} userId - User Identifier
480
416
  * @param {Payabli.MfaData} request
481
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
417
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
482
418
  *
483
419
  * @throws {@link Payabli.BadRequestError}
484
420
  * @throws {@link Payabli.UnauthorizedError}
@@ -494,7 +430,8 @@ class User {
494
430
  __editMfaUser(userId, request, requestOptions) {
495
431
  return __awaiter(this, void 0, void 0, function* () {
496
432
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
497
- 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);
433
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
434
+ 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);
498
435
  const _response = yield core.fetcher({
499
436
  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, `User/mfa/${core.url.encodePathParam(userId)}`),
500
437
  method: "PUT",
@@ -530,27 +467,15 @@ class User {
530
467
  });
531
468
  }
532
469
  }
533
- switch (_response.error.reason) {
534
- case "non-json":
535
- throw new errors.PayabliError({
536
- statusCode: _response.error.statusCode,
537
- body: _response.error.rawBody,
538
- rawResponse: _response.rawResponse,
539
- });
540
- case "timeout":
541
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/mfa/{userId}.");
542
- case "unknown":
543
- throw new errors.PayabliError({
544
- message: _response.error.errorMessage,
545
- rawResponse: _response.rawResponse,
546
- });
547
- }
470
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/User/mfa/{userId}");
548
471
  });
549
472
  }
550
473
  /**
474
+ * Use this endpoint to modify the details of a specific user within an organization.
475
+ *
551
476
  * @param {number} userId - User Identifier
552
477
  * @param {Payabli.UserData} request
553
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
478
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
554
479
  *
555
480
  * @throws {@link Payabli.BadRequestError}
556
481
  * @throws {@link Payabli.UnauthorizedError}
@@ -566,7 +491,8 @@ class User {
566
491
  __editUser(userId, request, requestOptions) {
567
492
  return __awaiter(this, void 0, void 0, function* () {
568
493
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
569
- 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);
494
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
495
+ 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);
570
496
  const _response = yield core.fetcher({
571
497
  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, `User/${core.url.encodePathParam(userId)}`),
572
498
  method: "PUT",
@@ -602,27 +528,15 @@ class User {
602
528
  });
603
529
  }
604
530
  }
605
- switch (_response.error.reason) {
606
- case "non-json":
607
- throw new errors.PayabliError({
608
- statusCode: _response.error.statusCode,
609
- body: _response.error.rawBody,
610
- rawResponse: _response.rawResponse,
611
- });
612
- case "timeout":
613
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/{userId}.");
614
- case "unknown":
615
- throw new errors.PayabliError({
616
- message: _response.error.errorMessage,
617
- rawResponse: _response.rawResponse,
618
- });
619
- }
531
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/User/{userId}");
620
532
  });
621
533
  }
622
534
  /**
535
+ * Use this endpoint to retrieve information about a specific user within an organization.
536
+ *
623
537
  * @param {number} userId - The Payabli-generated `userId` value.
624
538
  * @param {Payabli.GetUserRequest} request
625
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
539
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
626
540
  *
627
541
  * @throws {@link Payabli.BadRequestError}
628
542
  * @throws {@link Payabli.UnauthorizedError}
@@ -648,7 +562,8 @@ class User {
648
562
  if (level != null) {
649
563
  _queryParams.level = level.toString();
650
564
  }
651
- 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);
565
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
566
+ 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);
652
567
  const _response = yield core.fetcher({
653
568
  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, `User/${core.url.encodePathParam(userId)}`),
654
569
  method: "GET",
@@ -681,25 +596,13 @@ class User {
681
596
  });
682
597
  }
683
598
  }
684
- switch (_response.error.reason) {
685
- case "non-json":
686
- throw new errors.PayabliError({
687
- statusCode: _response.error.statusCode,
688
- body: _response.error.rawBody,
689
- rawResponse: _response.rawResponse,
690
- });
691
- case "timeout":
692
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /User/{userId}.");
693
- case "unknown":
694
- throw new errors.PayabliError({
695
- message: _response.error.errorMessage,
696
- rawResponse: _response.rawResponse,
697
- });
698
- }
599
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/User/{userId}");
699
600
  });
700
601
  }
701
602
  /**
702
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
603
+ * Use this endpoint to log a user out from the system.
604
+ *
605
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
703
606
  *
704
607
  * @throws {@link Payabli.BadRequestError}
705
608
  * @throws {@link Payabli.UnauthorizedError}
@@ -715,7 +618,8 @@ class User {
715
618
  __logoutUser(requestOptions) {
716
619
  return __awaiter(this, void 0, void 0, function* () {
717
620
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
718
- 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);
621
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
622
+ 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);
719
623
  const _response = yield core.fetcher({
720
624
  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, "User/authlogout"),
721
625
  method: "GET",
@@ -748,28 +652,16 @@ class User {
748
652
  });
749
653
  }
750
654
  }
751
- switch (_response.error.reason) {
752
- case "non-json":
753
- throw new errors.PayabliError({
754
- statusCode: _response.error.statusCode,
755
- body: _response.error.rawBody,
756
- rawResponse: _response.rawResponse,
757
- });
758
- case "timeout":
759
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /User/authlogout.");
760
- case "unknown":
761
- throw new errors.PayabliError({
762
- message: _response.error.errorMessage,
763
- rawResponse: _response.rawResponse,
764
- });
765
- }
655
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/User/authlogout");
766
656
  });
767
657
  }
768
658
  /**
769
- * @param {string} entry -
770
- * @param {number} entryType -
659
+ * Resends the MFA code to the user via the selected MFA mode (email or SMS).
660
+ *
771
661
  * @param {string} usrname -
772
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
662
+ * @param {string} Entry -
663
+ * @param {number} EntryType -
664
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
773
665
  *
774
666
  * @throws {@link Payabli.BadRequestError}
775
667
  * @throws {@link Payabli.UnauthorizedError}
@@ -777,17 +669,18 @@ class User {
777
669
  * @throws {@link Payabli.ServiceUnavailableError}
778
670
  *
779
671
  * @example
780
- * await client.user.resendMfaCode("Entry", 1, "usrname")
672
+ * await client.user.resendMfaCode("usrname", "Entry", 1)
781
673
  */
782
- resendMfaCode(entry, entryType, usrname, requestOptions) {
783
- return core.HttpResponsePromise.fromPromise(this.__resendMfaCode(entry, entryType, usrname, requestOptions));
674
+ resendMfaCode(usrname, Entry, EntryType, requestOptions) {
675
+ return core.HttpResponsePromise.fromPromise(this.__resendMfaCode(usrname, Entry, EntryType, requestOptions));
784
676
  }
785
- __resendMfaCode(entry, entryType, usrname, requestOptions) {
677
+ __resendMfaCode(usrname, Entry, EntryType, requestOptions) {
786
678
  return __awaiter(this, void 0, void 0, function* () {
787
679
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
788
- 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);
680
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
681
+ 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);
789
682
  const _response = yield core.fetcher({
790
- 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, `User/resendmfa/${core.url.encodePathParam(usrname)}/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(entryType)}`),
683
+ 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, `User/resendmfa/${core.url.encodePathParam(usrname)}/${core.url.encodePathParam(Entry)}/${core.url.encodePathParam(EntryType)}`),
791
684
  method: "POST",
792
685
  headers: _headers,
793
686
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -818,26 +711,14 @@ class User {
818
711
  });
819
712
  }
820
713
  }
821
- switch (_response.error.reason) {
822
- case "non-json":
823
- throw new errors.PayabliError({
824
- statusCode: _response.error.statusCode,
825
- body: _response.error.rawBody,
826
- rawResponse: _response.rawResponse,
827
- });
828
- case "timeout":
829
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/resendmfa/{usrname}/{Entry}/{EntryType}.");
830
- case "unknown":
831
- throw new errors.PayabliError({
832
- message: _response.error.errorMessage,
833
- rawResponse: _response.rawResponse,
834
- });
835
- }
714
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User/resendmfa/{usrname}/{Entry}/{EntryType}");
836
715
  });
837
716
  }
838
717
  /**
718
+ * Use this endpoint to validate the multi-factor authentication (MFA) code for a user within an organization.
719
+ *
839
720
  * @param {Payabli.MfaValidationData} request
840
- * @param {User.RequestOptions} requestOptions - Request-specific configuration.
721
+ * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration.
841
722
  *
842
723
  * @throws {@link Payabli.BadRequestError}
843
724
  * @throws {@link Payabli.UnauthorizedError}
@@ -853,7 +734,8 @@ class User {
853
734
  __validateMfaUser() {
854
735
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
855
736
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
856
- 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);
737
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
738
+ 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);
857
739
  const _response = yield core.fetcher({
858
740
  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, "User/mfa"),
859
741
  method: "POST",
@@ -889,28 +771,8 @@ class User {
889
771
  });
890
772
  }
891
773
  }
892
- switch (_response.error.reason) {
893
- case "non-json":
894
- throw new errors.PayabliError({
895
- statusCode: _response.error.statusCode,
896
- body: _response.error.rawBody,
897
- rawResponse: _response.rawResponse,
898
- });
899
- case "timeout":
900
- throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/mfa.");
901
- case "unknown":
902
- throw new errors.PayabliError({
903
- message: _response.error.errorMessage,
904
- rawResponse: _response.rawResponse,
905
- });
906
- }
907
- });
908
- }
909
- _getCustomAuthorizationHeaders() {
910
- return __awaiter(this, void 0, void 0, function* () {
911
- const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
912
- return { requestToken: apiKeyValue };
774
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/User/mfa");
913
775
  });
914
776
  }
915
777
  }
916
- exports.User = User;
778
+ exports.UserClient = UserClient;
@@ -1,21 +1,21 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
2
3
  import * as core from "../../../../core/index.js";
3
4
  import * as Payabli from "../../../index.js";
4
- export declare namespace Vendor {
5
- interface Options extends BaseClientOptions {
6
- }
5
+ export declare namespace VendorClient {
6
+ type Options = BaseClientOptions;
7
7
  interface RequestOptions extends BaseRequestOptions {
8
8
  }
9
9
  }
10
- export declare class Vendor {
11
- protected readonly _options: Vendor.Options;
12
- constructor(_options?: Vendor.Options);
10
+ export declare class VendorClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<VendorClient.Options>;
12
+ constructor(options?: VendorClient.Options);
13
13
  /**
14
14
  * Creates a vendor in an entrypoint.
15
15
  *
16
16
  * @param {string} entry - Entrypoint identifier.
17
17
  * @param {Payabli.VendorData} request
18
- * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration.
18
+ * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration.
19
19
  *
20
20
  * @throws {@link Payabli.BadRequestError}
21
21
  * @throws {@link Payabli.UnauthorizedError}
@@ -68,13 +68,13 @@ export declare class Vendor {
68
68
  * internalReferenceId: 123
69
69
  * })
70
70
  */
71
- addVendor(entry: string, request: Payabli.VendorData, requestOptions?: Vendor.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
71
+ addVendor(entry: string, request: Payabli.VendorData, requestOptions?: VendorClient.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
72
72
  private __addVendor;
73
73
  /**
74
74
  * Delete a vendor.
75
75
  *
76
76
  * @param {number} idVendor - Vendor ID.
77
- * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration.
77
+ * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration.
78
78
  *
79
79
  * @throws {@link Payabli.BadRequestError}
80
80
  * @throws {@link Payabli.UnauthorizedError}
@@ -84,14 +84,14 @@ export declare class Vendor {
84
84
  * @example
85
85
  * await client.vendor.deleteVendor(1)
86
86
  */
87
- deleteVendor(idVendor: number, requestOptions?: Vendor.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
87
+ deleteVendor(idVendor: number, requestOptions?: VendorClient.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
88
88
  private __deleteVendor;
89
89
  /**
90
90
  * Updates a vendor's information. Send only the fields you need to update.
91
91
  *
92
92
  * @param {number} idVendor - Vendor ID.
93
93
  * @param {Payabli.VendorData} request
94
- * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration.
94
+ * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration.
95
95
  *
96
96
  * @throws {@link Payabli.BadRequestError}
97
97
  * @throws {@link Payabli.UnauthorizedError}
@@ -103,13 +103,13 @@ export declare class Vendor {
103
103
  * name1: "Theodore's Janitorial"
104
104
  * })
105
105
  */
106
- editVendor(idVendor: number, request: Payabli.VendorData, requestOptions?: Vendor.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
106
+ editVendor(idVendor: number, request: Payabli.VendorData, requestOptions?: VendorClient.RequestOptions): core.HttpResponsePromise<Payabli.PayabliApiResponseVendors>;
107
107
  private __editVendor;
108
108
  /**
109
109
  * Retrieves a vendor's details.
110
110
  *
111
111
  * @param {number} idVendor - Vendor ID.
112
- * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration.
112
+ * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration.
113
113
  *
114
114
  * @throws {@link Payabli.BadRequestError}
115
115
  * @throws {@link Payabli.UnauthorizedError}
@@ -119,7 +119,6 @@ export declare class Vendor {
119
119
  * @example
120
120
  * await client.vendor.getVendor(1)
121
121
  */
122
- getVendor(idVendor: number, requestOptions?: Vendor.RequestOptions): core.HttpResponsePromise<Payabli.VendorQueryRecord>;
122
+ getVendor(idVendor: number, requestOptions?: VendorClient.RequestOptions): core.HttpResponsePromise<Payabli.VendorQueryRecord>;
123
123
  private __getVendor;
124
- protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
125
124
  }