@crylabsorg/suward-sdk 0.0.20

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 (459) hide show
  1. package/README.md +308 -0
  2. package/dist/cjs/BaseClient.d.ts +42 -0
  3. package/dist/cjs/BaseClient.js +77 -0
  4. package/dist/cjs/Client.d.ts +29 -0
  5. package/dist/cjs/Client.js +88 -0
  6. package/dist/cjs/api/errors/BadRequestError.d.ts +6 -0
  7. package/dist/cjs/api/errors/BadRequestError.js +54 -0
  8. package/dist/cjs/api/errors/InternalServerError.d.ts +6 -0
  9. package/dist/cjs/api/errors/InternalServerError.js +54 -0
  10. package/dist/cjs/api/errors/NotFoundError.d.ts +6 -0
  11. package/dist/cjs/api/errors/NotFoundError.js +54 -0
  12. package/dist/cjs/api/errors/UnauthorizedError.d.ts +6 -0
  13. package/dist/cjs/api/errors/UnauthorizedError.js +54 -0
  14. package/dist/cjs/api/errors/index.d.ts +4 -0
  15. package/dist/cjs/api/errors/index.js +20 -0
  16. package/dist/cjs/api/index.d.ts +3 -0
  17. package/dist/cjs/api/index.js +19 -0
  18. package/dist/cjs/api/resources/index.d.ts +6 -0
  19. package/dist/cjs/api/resources/index.js +45 -0
  20. package/dist/cjs/api/resources/payments/client/Client.d.ts +107 -0
  21. package/dist/cjs/api/resources/payments/client/Client.js +416 -0
  22. package/dist/cjs/api/resources/payments/client/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/payments/client/index.js +17 -0
  24. package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.ts +17 -0
  25. package/dist/cjs/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.js +3 -0
  26. package/dist/cjs/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.ts +13 -0
  27. package/dist/cjs/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.js +3 -0
  28. package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.d.ts +10 -0
  29. package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.js +3 -0
  30. package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.d.ts +13 -0
  31. package/dist/cjs/api/resources/payments/client/requests/GetV1PaymentsRequest.js +3 -0
  32. package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.d.ts +10 -0
  33. package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.js +3 -0
  34. package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.d.ts +10 -0
  35. package/dist/cjs/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.js +3 -0
  36. package/dist/cjs/api/resources/payments/client/requests/index.d.ts +6 -0
  37. package/dist/cjs/api/resources/payments/client/requests/index.js +2 -0
  38. package/dist/cjs/api/resources/payments/exports.d.ts +2 -0
  39. package/dist/cjs/api/resources/payments/exports.js +21 -0
  40. package/dist/cjs/api/resources/payments/index.d.ts +2 -0
  41. package/dist/cjs/api/resources/payments/index.js +18 -0
  42. package/dist/cjs/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.ts +2 -0
  43. package/dist/cjs/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.js +3 -0
  44. package/dist/cjs/api/resources/payments/types/GetV1PaymentsRequestOrder.d.ts +5 -0
  45. package/dist/cjs/api/resources/payments/types/GetV1PaymentsRequestOrder.js +8 -0
  46. package/dist/cjs/api/resources/payments/types/index.d.ts +2 -0
  47. package/dist/cjs/api/resources/payments/types/index.js +18 -0
  48. package/dist/cjs/api/resources/staticWallets/client/Client.d.ts +106 -0
  49. package/dist/cjs/api/resources/staticWallets/client/Client.js +463 -0
  50. package/dist/cjs/api/resources/staticWallets/client/index.d.ts +1 -0
  51. package/dist/cjs/api/resources/staticWallets/client/index.js +17 -0
  52. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.ts +12 -0
  53. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.js +3 -0
  54. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.ts +25 -0
  55. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.js +13 -0
  56. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.ts +14 -0
  57. package/dist/cjs/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.js +3 -0
  58. package/dist/cjs/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.d.ts +10 -0
  59. package/dist/cjs/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.js +3 -0
  60. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.d.ts +13 -0
  61. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.js +3 -0
  62. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.ts +17 -0
  63. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.js +3 -0
  64. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.d.ts +10 -0
  65. package/dist/cjs/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.js +3 -0
  66. package/dist/cjs/api/resources/staticWallets/client/requests/index.d.ts +7 -0
  67. package/dist/cjs/api/resources/staticWallets/client/requests/index.js +5 -0
  68. package/dist/cjs/api/resources/staticWallets/exports.d.ts +2 -0
  69. package/dist/cjs/api/resources/staticWallets/exports.js +21 -0
  70. package/dist/cjs/api/resources/staticWallets/index.d.ts +2 -0
  71. package/dist/cjs/api/resources/staticWallets/index.js +18 -0
  72. package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.d.ts +5 -0
  73. package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.js +8 -0
  74. package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.d.ts +5 -0
  75. package/dist/cjs/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.js +8 -0
  76. package/dist/cjs/api/resources/staticWallets/types/index.d.ts +2 -0
  77. package/dist/cjs/api/resources/staticWallets/types/index.js +18 -0
  78. package/dist/cjs/api/types/ControllerErrorResponse.d.ts +5 -0
  79. package/dist/cjs/api/types/ControllerErrorResponse.js +3 -0
  80. package/dist/cjs/api/types/CryptopayAssetId.d.ts +32 -0
  81. package/dist/cjs/api/types/CryptopayAssetId.js +35 -0
  82. package/dist/cjs/api/types/CryptopayListPaymentsResponse.d.ts +6 -0
  83. package/dist/cjs/api/types/CryptopayListPaymentsResponse.js +3 -0
  84. package/dist/cjs/api/types/CryptopayListStaticDepositsResponse.d.ts +6 -0
  85. package/dist/cjs/api/types/CryptopayListStaticDepositsResponse.js +3 -0
  86. package/dist/cjs/api/types/CryptopayListStaticWalletsResponse.d.ts +6 -0
  87. package/dist/cjs/api/types/CryptopayListStaticWalletsResponse.js +3 -0
  88. package/dist/cjs/api/types/CryptopayPaymentResponse.d.ts +28 -0
  89. package/dist/cjs/api/types/CryptopayPaymentResponse.js +3 -0
  90. package/dist/cjs/api/types/CryptopayPaymentStatusEnum.d.ts +7 -0
  91. package/dist/cjs/api/types/CryptopayPaymentStatusEnum.js +10 -0
  92. package/dist/cjs/api/types/CryptopayPaymentSubStatusEnum.d.ts +16 -0
  93. package/dist/cjs/api/types/CryptopayPaymentSubStatusEnum.js +19 -0
  94. package/dist/cjs/api/types/CryptopayPublicPaymentResponse.d.ts +18 -0
  95. package/dist/cjs/api/types/CryptopayPublicPaymentResponse.js +3 -0
  96. package/dist/cjs/api/types/CryptopayPublicRedirect.d.ts +4 -0
  97. package/dist/cjs/api/types/CryptopayPublicRedirect.js +3 -0
  98. package/dist/cjs/api/types/CryptopayRedirectConfigDto.d.ts +15 -0
  99. package/dist/cjs/api/types/CryptopayRedirectConfigDto.js +14 -0
  100. package/dist/cjs/api/types/CryptopayStaticDepositResponse.d.ts +31 -0
  101. package/dist/cjs/api/types/CryptopayStaticDepositResponse.js +14 -0
  102. package/dist/cjs/api/types/CryptopayStaticWalletResponse.d.ts +13 -0
  103. package/dist/cjs/api/types/CryptopayStaticWalletResponse.js +3 -0
  104. package/dist/cjs/api/types/CryptopayTransactionResponse.d.ts +6 -0
  105. package/dist/cjs/api/types/CryptopayTransactionResponse.js +3 -0
  106. package/dist/cjs/api/types/WebhookPaymentEvent.d.ts +26 -0
  107. package/dist/cjs/api/types/WebhookPaymentEvent.js +12 -0
  108. package/dist/cjs/api/types/WebhookStaticDepositEvent.d.ts +29 -0
  109. package/dist/cjs/api/types/WebhookStaticDepositEvent.js +11 -0
  110. package/dist/cjs/api/types/index.d.ts +16 -0
  111. package/dist/cjs/api/types/index.js +32 -0
  112. package/dist/cjs/auth/HeaderAuthProvider.d.ts +20 -0
  113. package/dist/cjs/auth/HeaderAuthProvider.js +80 -0
  114. package/dist/cjs/auth/index.d.ts +1 -0
  115. package/dist/cjs/auth/index.js +5 -0
  116. package/dist/cjs/core/auth/AuthProvider.d.ts +8 -0
  117. package/dist/cjs/core/auth/AuthProvider.js +9 -0
  118. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  119. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  120. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  121. package/dist/cjs/core/auth/BasicAuth.js +33 -0
  122. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  123. package/dist/cjs/core/auth/BearerToken.js +16 -0
  124. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  125. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  126. package/dist/cjs/core/auth/index.d.ts +5 -0
  127. package/dist/cjs/core/auth/index.js +11 -0
  128. package/dist/cjs/core/base64.d.ts +2 -0
  129. package/dist/cjs/core/base64.js +26 -0
  130. package/dist/cjs/core/exports.d.ts +1 -0
  131. package/dist/cjs/core/exports.js +17 -0
  132. package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
  133. package/dist/cjs/core/fetcher/APIResponse.js +2 -0
  134. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
  135. package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
  136. package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
  137. package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
  138. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
  139. package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
  140. package/dist/cjs/core/fetcher/Fetcher.d.ts +56 -0
  141. package/dist/cjs/core/fetcher/Fetcher.js +327 -0
  142. package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
  143. package/dist/cjs/core/fetcher/Headers.js +84 -0
  144. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
  145. package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
  146. package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
  147. package/dist/cjs/core/fetcher/RawResponse.js +44 -0
  148. package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
  149. package/dist/cjs/core/fetcher/Supplier.js +22 -0
  150. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
  151. package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
  152. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
  153. package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
  154. package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
  155. package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
  156. package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
  157. package/dist/cjs/core/fetcher/getHeader.js +11 -0
  158. package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
  159. package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
  160. package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
  161. package/dist/cjs/core/fetcher/getResponseBody.js +80 -0
  162. package/dist/cjs/core/fetcher/index.d.ts +13 -0
  163. package/dist/cjs/core/fetcher/index.js +19 -0
  164. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  165. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  166. package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -0
  167. package/dist/cjs/core/fetcher/makeRequest.js +61 -0
  168. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
  169. package/dist/cjs/core/fetcher/requestWithRetries.js +70 -0
  170. package/dist/cjs/core/fetcher/signals.d.ts +5 -0
  171. package/dist/cjs/core/fetcher/signals.js +32 -0
  172. package/dist/cjs/core/headers.d.ts +2 -0
  173. package/dist/cjs/core/headers.js +31 -0
  174. package/dist/cjs/core/index.d.ts +7 -0
  175. package/dist/cjs/core/index.js +46 -0
  176. package/dist/cjs/core/json.d.ts +15 -0
  177. package/dist/cjs/core/json.js +24 -0
  178. package/dist/cjs/core/logging/exports.d.ts +18 -0
  179. package/dist/cjs/core/logging/exports.js +45 -0
  180. package/dist/cjs/core/logging/index.d.ts +1 -0
  181. package/dist/cjs/core/logging/index.js +17 -0
  182. package/dist/cjs/core/logging/logger.d.ts +126 -0
  183. package/dist/cjs/core/logging/logger.js +144 -0
  184. package/dist/cjs/core/runtime/index.d.ts +1 -0
  185. package/dist/cjs/core/runtime/index.js +5 -0
  186. package/dist/cjs/core/runtime/runtime.d.ts +9 -0
  187. package/dist/cjs/core/runtime/runtime.js +104 -0
  188. package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
  189. package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
  190. package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
  191. package/dist/cjs/core/url/encodePathParam.js +21 -0
  192. package/dist/cjs/core/url/index.d.ts +4 -0
  193. package/dist/cjs/core/url/index.js +11 -0
  194. package/dist/cjs/core/url/join.d.ts +1 -0
  195. package/dist/cjs/core/url/join.js +68 -0
  196. package/dist/cjs/core/url/qs.d.ts +7 -0
  197. package/dist/cjs/core/url/qs.js +76 -0
  198. package/dist/cjs/core/webhooks/computeHmacSignature.d.ts +9 -0
  199. package/dist/cjs/core/webhooks/computeHmacSignature.js +84 -0
  200. package/dist/cjs/core/webhooks/fetchJwks.d.ts +15 -0
  201. package/dist/cjs/core/webhooks/fetchJwks.js +156 -0
  202. package/dist/cjs/core/webhooks/index.d.ts +8 -0
  203. package/dist/cjs/core/webhooks/index.js +11 -0
  204. package/dist/cjs/core/webhooks/timingSafeEqual.d.ts +1 -0
  205. package/dist/cjs/core/webhooks/timingSafeEqual.js +85 -0
  206. package/dist/cjs/core/webhooks/types.d.ts +1 -0
  207. package/dist/cjs/core/webhooks/types.js +2 -0
  208. package/dist/cjs/core/webhooks/verifyAsymmetricSignature.d.ts +10 -0
  209. package/dist/cjs/core/webhooks/verifyAsymmetricSignature.js +210 -0
  210. package/dist/cjs/environments.d.ts +4 -0
  211. package/dist/cjs/environments.js +7 -0
  212. package/dist/cjs/errors/SuwardSDKError.d.ts +14 -0
  213. package/dist/cjs/errors/SuwardSDKError.js +35 -0
  214. package/dist/cjs/errors/SuwardSDKTimeoutError.d.ts +6 -0
  215. package/dist/cjs/errors/SuwardSDKTimeoutError.js +18 -0
  216. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  217. package/dist/cjs/errors/handleNonStatusCodeError.js +68 -0
  218. package/dist/cjs/errors/index.d.ts +2 -0
  219. package/dist/cjs/errors/index.js +7 -0
  220. package/dist/cjs/exports.d.ts +1 -0
  221. package/dist/cjs/exports.js +17 -0
  222. package/dist/cjs/index.d.ts +7 -0
  223. package/dist/cjs/index.js +49 -0
  224. package/dist/cjs/version.d.ts +1 -0
  225. package/dist/cjs/version.js +4 -0
  226. package/dist/cjs/webhooks/WebhooksHelper.d.ts +9 -0
  227. package/dist/cjs/webhooks/WebhooksHelper.js +87 -0
  228. package/dist/cjs/webhooks/index.d.ts +1 -0
  229. package/dist/cjs/webhooks/index.js +5 -0
  230. package/dist/esm/BaseClient.d.mts +42 -0
  231. package/dist/esm/BaseClient.mjs +40 -0
  232. package/dist/esm/Client.d.mts +29 -0
  233. package/dist/esm/Client.mjs +51 -0
  234. package/dist/esm/api/errors/BadRequestError.d.mts +6 -0
  235. package/dist/esm/api/errors/BadRequestError.mjs +17 -0
  236. package/dist/esm/api/errors/InternalServerError.d.mts +6 -0
  237. package/dist/esm/api/errors/InternalServerError.mjs +17 -0
  238. package/dist/esm/api/errors/NotFoundError.d.mts +6 -0
  239. package/dist/esm/api/errors/NotFoundError.mjs +17 -0
  240. package/dist/esm/api/errors/UnauthorizedError.d.mts +6 -0
  241. package/dist/esm/api/errors/UnauthorizedError.mjs +17 -0
  242. package/dist/esm/api/errors/index.d.mts +4 -0
  243. package/dist/esm/api/errors/index.mjs +4 -0
  244. package/dist/esm/api/index.d.mts +3 -0
  245. package/dist/esm/api/index.mjs +3 -0
  246. package/dist/esm/api/resources/index.d.mts +6 -0
  247. package/dist/esm/api/resources/index.mjs +6 -0
  248. package/dist/esm/api/resources/payments/client/Client.d.mts +107 -0
  249. package/dist/esm/api/resources/payments/client/Client.mjs +379 -0
  250. package/dist/esm/api/resources/payments/client/index.d.mts +1 -0
  251. package/dist/esm/api/resources/payments/client/index.mjs +1 -0
  252. package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.d.mts +17 -0
  253. package/dist/esm/api/resources/payments/client/requests/CryptopayCreatePaymentRequest.mjs +2 -0
  254. package/dist/esm/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.d.mts +13 -0
  255. package/dist/esm/api/resources/payments/client/requests/CryptopaySimulatePaymentRequest.mjs +2 -0
  256. package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.d.mts +10 -0
  257. package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsPaymentIdRequest.mjs +2 -0
  258. package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.d.mts +13 -0
  259. package/dist/esm/api/resources/payments/client/requests/GetV1PaymentsRequest.mjs +2 -0
  260. package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.d.mts +10 -0
  261. package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdActivateRequest.mjs +2 -0
  262. package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.d.mts +10 -0
  263. package/dist/esm/api/resources/payments/client/requests/PostV1PaymentsPaymentIdCancelRequest.mjs +2 -0
  264. package/dist/esm/api/resources/payments/client/requests/index.d.mts +6 -0
  265. package/dist/esm/api/resources/payments/client/requests/index.mjs +1 -0
  266. package/dist/esm/api/resources/payments/exports.d.mts +2 -0
  267. package/dist/esm/api/resources/payments/exports.mjs +3 -0
  268. package/dist/esm/api/resources/payments/index.d.mts +2 -0
  269. package/dist/esm/api/resources/payments/index.mjs +2 -0
  270. package/dist/esm/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.d.mts +2 -0
  271. package/dist/esm/api/resources/payments/types/GetV1PaymentsPaymentIdResponse.mjs +2 -0
  272. package/dist/esm/api/resources/payments/types/GetV1PaymentsRequestOrder.d.mts +5 -0
  273. package/dist/esm/api/resources/payments/types/GetV1PaymentsRequestOrder.mjs +5 -0
  274. package/dist/esm/api/resources/payments/types/index.d.mts +2 -0
  275. package/dist/esm/api/resources/payments/types/index.mjs +2 -0
  276. package/dist/esm/api/resources/staticWallets/client/Client.d.mts +106 -0
  277. package/dist/esm/api/resources/staticWallets/client/Client.mjs +426 -0
  278. package/dist/esm/api/resources/staticWallets/client/index.d.mts +1 -0
  279. package/dist/esm/api/resources/staticWallets/client/index.mjs +1 -0
  280. package/dist/esm/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.d.mts +12 -0
  281. package/dist/esm/api/resources/staticWallets/client/requests/CryptopayCreateStaticWalletRequest.mjs +2 -0
  282. package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.d.mts +25 -0
  283. package/dist/esm/api/resources/staticWallets/client/requests/CryptopaySimulateStaticDepositRequest.mjs +10 -0
  284. package/dist/esm/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.d.mts +14 -0
  285. package/dist/esm/api/resources/staticWallets/client/requests/CryptopayUpdateStaticWalletRequest.mjs +2 -0
  286. package/dist/esm/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.d.mts +10 -0
  287. package/dist/esm/api/resources/staticWallets/client/requests/DeleteV1StaticWalletsStaticWalletIdRequest.mjs +2 -0
  288. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.d.mts +13 -0
  289. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsRequest.mjs +2 -0
  290. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.d.mts +17 -0
  291. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdDepositsRequest.mjs +2 -0
  292. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.d.mts +10 -0
  293. package/dist/esm/api/resources/staticWallets/client/requests/GetV1StaticWalletsStaticWalletIdRequest.mjs +2 -0
  294. package/dist/esm/api/resources/staticWallets/client/requests/index.d.mts +7 -0
  295. package/dist/esm/api/resources/staticWallets/client/requests/index.mjs +1 -0
  296. package/dist/esm/api/resources/staticWallets/exports.d.mts +2 -0
  297. package/dist/esm/api/resources/staticWallets/exports.mjs +3 -0
  298. package/dist/esm/api/resources/staticWallets/index.d.mts +2 -0
  299. package/dist/esm/api/resources/staticWallets/index.mjs +2 -0
  300. package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.d.mts +5 -0
  301. package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsRequestOrder.mjs +5 -0
  302. package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.d.mts +5 -0
  303. package/dist/esm/api/resources/staticWallets/types/GetV1StaticWalletsStaticWalletIdDepositsRequestOrder.mjs +5 -0
  304. package/dist/esm/api/resources/staticWallets/types/index.d.mts +2 -0
  305. package/dist/esm/api/resources/staticWallets/types/index.mjs +2 -0
  306. package/dist/esm/api/types/ControllerErrorResponse.d.mts +5 -0
  307. package/dist/esm/api/types/ControllerErrorResponse.mjs +2 -0
  308. package/dist/esm/api/types/CryptopayAssetId.d.mts +32 -0
  309. package/dist/esm/api/types/CryptopayAssetId.mjs +32 -0
  310. package/dist/esm/api/types/CryptopayListPaymentsResponse.d.mts +6 -0
  311. package/dist/esm/api/types/CryptopayListPaymentsResponse.mjs +2 -0
  312. package/dist/esm/api/types/CryptopayListStaticDepositsResponse.d.mts +6 -0
  313. package/dist/esm/api/types/CryptopayListStaticDepositsResponse.mjs +2 -0
  314. package/dist/esm/api/types/CryptopayListStaticWalletsResponse.d.mts +6 -0
  315. package/dist/esm/api/types/CryptopayListStaticWalletsResponse.mjs +2 -0
  316. package/dist/esm/api/types/CryptopayPaymentResponse.d.mts +28 -0
  317. package/dist/esm/api/types/CryptopayPaymentResponse.mjs +2 -0
  318. package/dist/esm/api/types/CryptopayPaymentStatusEnum.d.mts +7 -0
  319. package/dist/esm/api/types/CryptopayPaymentStatusEnum.mjs +7 -0
  320. package/dist/esm/api/types/CryptopayPaymentSubStatusEnum.d.mts +16 -0
  321. package/dist/esm/api/types/CryptopayPaymentSubStatusEnum.mjs +16 -0
  322. package/dist/esm/api/types/CryptopayPublicPaymentResponse.d.mts +18 -0
  323. package/dist/esm/api/types/CryptopayPublicPaymentResponse.mjs +2 -0
  324. package/dist/esm/api/types/CryptopayPublicRedirect.d.mts +4 -0
  325. package/dist/esm/api/types/CryptopayPublicRedirect.mjs +2 -0
  326. package/dist/esm/api/types/CryptopayRedirectConfigDto.d.mts +15 -0
  327. package/dist/esm/api/types/CryptopayRedirectConfigDto.mjs +11 -0
  328. package/dist/esm/api/types/CryptopayStaticDepositResponse.d.mts +31 -0
  329. package/dist/esm/api/types/CryptopayStaticDepositResponse.mjs +11 -0
  330. package/dist/esm/api/types/CryptopayStaticWalletResponse.d.mts +13 -0
  331. package/dist/esm/api/types/CryptopayStaticWalletResponse.mjs +2 -0
  332. package/dist/esm/api/types/CryptopayTransactionResponse.d.mts +6 -0
  333. package/dist/esm/api/types/CryptopayTransactionResponse.mjs +2 -0
  334. package/dist/esm/api/types/WebhookPaymentEvent.d.mts +26 -0
  335. package/dist/esm/api/types/WebhookPaymentEvent.mjs +9 -0
  336. package/dist/esm/api/types/WebhookStaticDepositEvent.d.mts +29 -0
  337. package/dist/esm/api/types/WebhookStaticDepositEvent.mjs +8 -0
  338. package/dist/esm/api/types/index.d.mts +16 -0
  339. package/dist/esm/api/types/index.mjs +16 -0
  340. package/dist/esm/auth/HeaderAuthProvider.d.mts +20 -0
  341. package/dist/esm/auth/HeaderAuthProvider.mjs +43 -0
  342. package/dist/esm/auth/index.d.mts +1 -0
  343. package/dist/esm/auth/index.mjs +1 -0
  344. package/dist/esm/core/auth/AuthProvider.d.mts +8 -0
  345. package/dist/esm/core/auth/AuthProvider.mjs +6 -0
  346. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  347. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  348. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  349. package/dist/esm/core/auth/BasicAuth.mjs +30 -0
  350. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  351. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  352. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  353. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  354. package/dist/esm/core/auth/index.d.mts +5 -0
  355. package/dist/esm/core/auth/index.mjs +4 -0
  356. package/dist/esm/core/base64.d.mts +2 -0
  357. package/dist/esm/core/base64.mjs +22 -0
  358. package/dist/esm/core/exports.d.mts +1 -0
  359. package/dist/esm/core/exports.mjs +1 -0
  360. package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
  361. package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
  362. package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
  363. package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
  364. package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
  365. package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
  366. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
  367. package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
  368. package/dist/esm/core/fetcher/Fetcher.d.mts +56 -0
  369. package/dist/esm/core/fetcher/Fetcher.mjs +323 -0
  370. package/dist/esm/core/fetcher/Headers.d.mts +2 -0
  371. package/dist/esm/core/fetcher/Headers.mjs +82 -0
  372. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
  373. package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
  374. package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
  375. package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
  376. package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
  377. package/dist/esm/core/fetcher/Supplier.mjs +19 -0
  378. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
  379. package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
  380. package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
  381. package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
  382. package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
  383. package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
  384. package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
  385. package/dist/esm/core/fetcher/getHeader.mjs +8 -0
  386. package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
  387. package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
  388. package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
  389. package/dist/esm/core/fetcher/getResponseBody.mjs +77 -0
  390. package/dist/esm/core/fetcher/index.d.mts +13 -0
  391. package/dist/esm/core/fetcher/index.mjs +7 -0
  392. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  393. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  394. package/dist/esm/core/fetcher/makeRequest.d.mts +6 -0
  395. package/dist/esm/core/fetcher/makeRequest.mjs +55 -0
  396. package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
  397. package/dist/esm/core/fetcher/requestWithRetries.mjs +67 -0
  398. package/dist/esm/core/fetcher/signals.d.mts +5 -0
  399. package/dist/esm/core/fetcher/signals.mjs +28 -0
  400. package/dist/esm/core/headers.d.mts +2 -0
  401. package/dist/esm/core/headers.mjs +27 -0
  402. package/dist/esm/core/index.d.mts +7 -0
  403. package/dist/esm/core/index.mjs +7 -0
  404. package/dist/esm/core/json.d.mts +15 -0
  405. package/dist/esm/core/json.mjs +19 -0
  406. package/dist/esm/core/logging/exports.d.mts +18 -0
  407. package/dist/esm/core/logging/exports.mjs +9 -0
  408. package/dist/esm/core/logging/index.d.mts +1 -0
  409. package/dist/esm/core/logging/index.mjs +1 -0
  410. package/dist/esm/core/logging/logger.d.mts +126 -0
  411. package/dist/esm/core/logging/logger.mjs +138 -0
  412. package/dist/esm/core/runtime/index.d.mts +1 -0
  413. package/dist/esm/core/runtime/index.mjs +1 -0
  414. package/dist/esm/core/runtime/runtime.d.mts +9 -0
  415. package/dist/esm/core/runtime/runtime.mjs +101 -0
  416. package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
  417. package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
  418. package/dist/esm/core/url/encodePathParam.d.mts +1 -0
  419. package/dist/esm/core/url/encodePathParam.mjs +18 -0
  420. package/dist/esm/core/url/index.d.mts +4 -0
  421. package/dist/esm/core/url/index.mjs +4 -0
  422. package/dist/esm/core/url/join.d.mts +1 -0
  423. package/dist/esm/core/url/join.mjs +65 -0
  424. package/dist/esm/core/url/qs.d.mts +7 -0
  425. package/dist/esm/core/url/qs.mjs +73 -0
  426. package/dist/esm/core/webhooks/computeHmacSignature.d.mts +9 -0
  427. package/dist/esm/core/webhooks/computeHmacSignature.mjs +48 -0
  428. package/dist/esm/core/webhooks/fetchJwks.d.mts +15 -0
  429. package/dist/esm/core/webhooks/fetchJwks.mjs +153 -0
  430. package/dist/esm/core/webhooks/index.d.mts +8 -0
  431. package/dist/esm/core/webhooks/index.mjs +4 -0
  432. package/dist/esm/core/webhooks/timingSafeEqual.d.mts +1 -0
  433. package/dist/esm/core/webhooks/timingSafeEqual.mjs +49 -0
  434. package/dist/esm/core/webhooks/types.d.mts +1 -0
  435. package/dist/esm/core/webhooks/types.mjs +1 -0
  436. package/dist/esm/core/webhooks/verifyAsymmetricSignature.d.mts +10 -0
  437. package/dist/esm/core/webhooks/verifyAsymmetricSignature.mjs +174 -0
  438. package/dist/esm/environments.d.mts +4 -0
  439. package/dist/esm/environments.mjs +4 -0
  440. package/dist/esm/errors/SuwardSDKError.d.mts +14 -0
  441. package/dist/esm/errors/SuwardSDKError.mjs +31 -0
  442. package/dist/esm/errors/SuwardSDKTimeoutError.d.mts +6 -0
  443. package/dist/esm/errors/SuwardSDKTimeoutError.mjs +14 -0
  444. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  445. package/dist/esm/errors/handleNonStatusCodeError.mjs +32 -0
  446. package/dist/esm/errors/index.d.mts +2 -0
  447. package/dist/esm/errors/index.mjs +2 -0
  448. package/dist/esm/exports.d.mts +1 -0
  449. package/dist/esm/exports.mjs +1 -0
  450. package/dist/esm/index.d.mts +7 -0
  451. package/dist/esm/index.mjs +6 -0
  452. package/dist/esm/version.d.mts +1 -0
  453. package/dist/esm/version.mjs +1 -0
  454. package/dist/esm/webhooks/WebhooksHelper.d.mts +9 -0
  455. package/dist/esm/webhooks/WebhooksHelper.mjs +50 -0
  456. package/dist/esm/webhooks/index.d.mts +1 -0
  457. package/dist/esm/webhooks/index.mjs +1 -0
  458. package/package.json +90 -0
  459. package/reference.md +771 -0
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # Suward TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fcrylabsorg%2Fsuward-sdk-ts)
4
+ [![npm shield](https://img.shields.io/npm/v/@crylabsorg/suward-sdk)](https://www.npmjs.com/package/@crylabsorg/suward-sdk)
5
+
6
+ The Suward TypeScript library provides convenient access to the Suward APIs from TypeScript.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Environments](#environments)
14
+ - [Request and Response Types](#request-and-response-types)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Advanced](#advanced)
17
+ - [Subpackage Exports](#subpackage-exports)
18
+ - [Additional Headers](#additional-headers)
19
+ - [Additional Query String Parameters](#additional-query-string-parameters)
20
+ - [Retries](#retries)
21
+ - [Timeouts](#timeouts)
22
+ - [Aborting Requests](#aborting-requests)
23
+ - [Access Raw Response Data](#access-raw-response-data)
24
+ - [Logging](#logging)
25
+ - [Custom Fetch](#custom-fetch)
26
+ - [Runtime Compatibility](#runtime-compatibility)
27
+ - [Contributing](#contributing)
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ npm i -s @crylabsorg/suward-sdk
33
+ ```
34
+
35
+ ## Reference
36
+
37
+ A full reference for this library is available [here](https://github.com/crylabsorg/suward-sdk-ts/blob/HEAD/./reference.md).
38
+
39
+ ## Usage
40
+
41
+ Instantiate and use the client with the following:
42
+
43
+ ```typescript
44
+ import { SuwardSDKClient } from "@crylabsorg/suward-sdk";
45
+
46
+ const client = new SuwardSDKClient({ apiKey: "YOUR_API_KEY" });
47
+ await client.payments.createPayment();
48
+ ```
49
+
50
+ ## Environments
51
+
52
+ This SDK allows you to configure different environments for API requests.
53
+
54
+ ```typescript
55
+ import { SuwardSDKClient, SuwardSDKEnvironment } from "@crylabsorg/suward-sdk";
56
+
57
+ const client = new SuwardSDKClient({
58
+ environment: SuwardSDKEnvironment.Default,
59
+ });
60
+ ```
61
+
62
+ ## Request and Response Types
63
+
64
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
65
+ following namespace:
66
+
67
+ ```typescript
68
+ import { SuwardSDK } from "@crylabsorg/suward-sdk";
69
+
70
+ const request: SuwardSDK.GetV1PaymentsRequest = {
71
+ ...
72
+ };
73
+ ```
74
+
75
+ ## Exception Handling
76
+
77
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
78
+ will be thrown.
79
+
80
+ ```typescript
81
+ import { SuwardSDKError } from "@crylabsorg/suward-sdk";
82
+
83
+ try {
84
+ await client.payments.createPayment(...);
85
+ } catch (err) {
86
+ if (err instanceof SuwardSDKError) {
87
+ console.log(err.statusCode);
88
+ console.log(err.message);
89
+ console.log(err.body);
90
+ console.log(err.rawResponse);
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Advanced
96
+
97
+ ### Subpackage Exports
98
+
99
+ This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.
100
+
101
+ ```typescript
102
+ import { PaymentsClient } from '@crylabsorg/suward-sdk/payments';
103
+
104
+ const client = new PaymentsClient({...});
105
+ ```
106
+
107
+ ### Additional Headers
108
+
109
+ If you would like to send additional headers as part of the request, use the `headers` request option.
110
+
111
+ ```typescript
112
+ import { SuwardSDKClient } from "@crylabsorg/suward-sdk";
113
+
114
+ const client = new SuwardSDKClient({
115
+ ...
116
+ headers: {
117
+ 'X-Custom-Header': 'custom value'
118
+ }
119
+ });
120
+
121
+ const response = await client.payments.createPayment(..., {
122
+ headers: {
123
+ 'X-Custom-Header': 'custom value'
124
+ }
125
+ });
126
+ ```
127
+
128
+ ### Additional Query String Parameters
129
+
130
+ If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
131
+
132
+ ```typescript
133
+ const response = await client.payments.createPayment(..., {
134
+ queryParams: {
135
+ 'customQueryParamKey': 'custom query param value'
136
+ }
137
+ });
138
+ ```
139
+
140
+ ### Retries
141
+
142
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
143
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
144
+ retry limit (default: 2).
145
+
146
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
147
+
148
+ **`legacy`** (current default): retries on
149
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
150
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
151
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
152
+
153
+ **`recommended`**: retries on
154
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
155
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
156
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
157
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
158
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
159
+
160
+ Use the `maxRetries` request option to configure this behavior.
161
+
162
+ ```typescript
163
+ const response = await client.payments.createPayment(..., {
164
+ maxRetries: 0 // override maxRetries at the request level
165
+ });
166
+ ```
167
+
168
+ ### Timeouts
169
+
170
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
171
+
172
+ ```typescript
173
+ const response = await client.payments.createPayment(..., {
174
+ timeoutInSeconds: 30 // override timeout to 30s
175
+ });
176
+ ```
177
+
178
+ ### Aborting Requests
179
+
180
+ The SDK allows users to abort requests at any point by passing in an abort signal.
181
+
182
+ ```typescript
183
+ const controller = new AbortController();
184
+ const response = await client.payments.createPayment(..., {
185
+ abortSignal: controller.signal
186
+ });
187
+ controller.abort(); // aborts the request
188
+ ```
189
+
190
+ ### Access Raw Response Data
191
+
192
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
193
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
194
+
195
+ ```typescript
196
+ const { data, rawResponse } = await client.payments.createPayment(...).withRawResponse();
197
+
198
+ console.log(data);
199
+ console.log(rawResponse.headers['X-My-Header']);
200
+ ```
201
+
202
+ ### Logging
203
+
204
+ The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.
205
+
206
+ ```typescript
207
+ import { SuwardSDKClient, logging } from "@crylabsorg/suward-sdk";
208
+
209
+ const client = new SuwardSDKClient({
210
+ ...
211
+ logging: {
212
+ level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
213
+ logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
214
+ silent: false, // defaults to true, set to false to enable logging
215
+ }
216
+ });
217
+ ```
218
+ The `logging` object can have the following properties:
219
+ - `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
220
+ - `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
221
+ - `silent`: Whether to silence the logger. Defaults to `true`.
222
+
223
+ The `level` property can be one of the following values:
224
+ - `logging.LogLevel.Debug`
225
+ - `logging.LogLevel.Info`
226
+ - `logging.LogLevel.Warn`
227
+ - `logging.LogLevel.Error`
228
+
229
+ To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.
230
+
231
+ <details>
232
+ <summary>Custom logger examples</summary>
233
+
234
+ Here's an example using the popular `winston` logging library.
235
+ ```ts
236
+ import winston from 'winston';
237
+
238
+ const winstonLogger = winston.createLogger({...});
239
+
240
+ const logger: logging.ILogger = {
241
+ debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
242
+ info: (msg, ...args) => winstonLogger.info(msg, ...args),
243
+ warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
244
+ error: (msg, ...args) => winstonLogger.error(msg, ...args),
245
+ };
246
+ ```
247
+
248
+ Here's an example using the popular `pino` logging library.
249
+
250
+ ```ts
251
+ import pino from 'pino';
252
+
253
+ const pinoLogger = pino({...});
254
+
255
+ const logger: logging.ILogger = {
256
+ debug: (msg, ...args) => pinoLogger.debug(args, msg),
257
+ info: (msg, ...args) => pinoLogger.info(args, msg),
258
+ warn: (msg, ...args) => pinoLogger.warn(args, msg),
259
+ error: (msg, ...args) => pinoLogger.error(args, msg),
260
+ };
261
+ ```
262
+ </details>
263
+
264
+
265
+ ### Custom Fetch
266
+
267
+ The SDK provides a low-level `fetch` method for making custom HTTP requests while still
268
+ benefiting from SDK-level configuration like authentication, retries, timeouts, and logging.
269
+ This is useful for calling API endpoints not yet supported in the SDK.
270
+
271
+ ```typescript
272
+ const response = await client.fetch("/v1/custom/endpoint", {
273
+ method: "GET",
274
+ }, {
275
+ timeoutInSeconds: 30,
276
+ maxRetries: 3,
277
+ headers: {
278
+ "X-Custom-Header": "custom-value",
279
+ },
280
+ });
281
+
282
+ const data = await response.json();
283
+ ```
284
+
285
+ ### Runtime Compatibility
286
+
287
+
288
+ The SDK works in the following runtimes:
289
+
290
+
291
+
292
+ - Node.js 18+
293
+ - Vercel
294
+ - Cloudflare Workers
295
+ - Deno v1.25+
296
+ - Bun 1.0+
297
+ - React Native
298
+
299
+
300
+ ## Contributing
301
+
302
+ While we value open-source contributions to this SDK, this library is generated programmatically.
303
+ Additions made directly to this library would have to be moved over to our generation code,
304
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
305
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
306
+ an issue first to discuss with us!
307
+
308
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,42 @@
1
+ import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
2
+ import * as core from "./core/index.js";
3
+ import type * as environments from "./environments.js";
4
+ export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
5
+ export type BaseClientOptions = {
6
+ environment?: core.Supplier<environments.SuwardSDKEnvironment | string>;
7
+ /** Specify a custom URL to connect the client to. */
8
+ baseUrl?: core.Supplier<string>;
9
+ /** Additional headers to include in requests. */
10
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
11
+ /** The default maximum time to wait for a response in seconds. */
12
+ timeoutInSeconds?: number;
13
+ /** The default number of times to retry the request. Defaults to 2. */
14
+ maxRetries?: number;
15
+ /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
16
+ fetch?: typeof fetch;
17
+ /** Configure logging for the client. */
18
+ logging?: core.logging.LogConfig | core.logging.Logger;
19
+ /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
20
+ auth?: AuthOption;
21
+ } & HeaderAuthProvider.AuthOptions;
22
+ export interface BaseRequestOptions {
23
+ /** The maximum time to wait for a response in seconds. */
24
+ timeoutInSeconds?: number;
25
+ /** The number of times to retry the request. Defaults to 2. */
26
+ maxRetries?: number;
27
+ /** A hook to abort the request. */
28
+ abortSignal?: AbortSignal;
29
+ /** Additional query string parameters to include in the request. */
30
+ queryParams?: Record<string, unknown>;
31
+ /** Additional headers to include in the request. */
32
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
33
+ }
34
+ export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
35
+ logging: core.logging.Logger;
36
+ authProvider?: core.AuthProvider;
37
+ };
38
+ export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
39
+ authProvider: core.AuthProvider;
40
+ };
41
+ export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
42
+ export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.normalizeClientOptions = normalizeClientOptions;
38
+ exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
39
+ const HeaderAuthProvider_js_1 = require("./auth/HeaderAuthProvider.js");
40
+ const headers_js_1 = require("./core/headers.js");
41
+ const core = __importStar(require("./core/index.js"));
42
+ function normalizeClientOptions(options) {
43
+ const headers = (0, headers_js_1.mergeHeaders)({
44
+ "X-Fern-Language": "JavaScript",
45
+ "X-Fern-SDK-Name": "@crylabsorg/suward-sdk",
46
+ "X-Fern-SDK-Version": "0.0.20",
47
+ "User-Agent": "@crylabsorg/suward-sdk/0.0.20",
48
+ "X-Fern-Runtime": core.RUNTIME.type,
49
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
50
+ }, options === null || options === void 0 ? void 0 : options.headers);
51
+ return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
52
+ }
53
+ function normalizeClientOptionsWithAuth(options) {
54
+ var _a;
55
+ const normalized = normalizeClientOptions(options);
56
+ if (options.auth === false) {
57
+ normalized.authProvider = new core.NoOpAuthProvider();
58
+ return normalized;
59
+ }
60
+ if (options.auth != null) {
61
+ if (typeof options.auth === "function") {
62
+ normalized.authProvider = { getAuthRequest: options.auth };
63
+ return normalized;
64
+ }
65
+ if (core.isAuthProvider(options.auth)) {
66
+ normalized.authProvider = options.auth;
67
+ return normalized;
68
+ }
69
+ Object.assign(normalized, options.auth);
70
+ }
71
+ const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
72
+ (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider_js_1.HeaderAuthProvider(normalizedWithNoOpAuthProvider));
73
+ return normalized;
74
+ }
75
+ function withNoOpAuthProvider(options) {
76
+ return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
77
+ }
@@ -0,0 +1,29 @@
1
+ import { PaymentsClient } from "./api/resources/payments/client/Client.js";
2
+ import { StaticWalletsClient } from "./api/resources/staticWallets/client/Client.js";
3
+ import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
4
+ import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
5
+ import * as core from "./core/index.js";
6
+ export declare namespace SuwardSDKClient {
7
+ type Options = BaseClientOptions;
8
+ interface RequestOptions extends BaseRequestOptions {
9
+ }
10
+ }
11
+ export declare class SuwardSDKClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<SuwardSDKClient.Options>;
13
+ protected _payments: PaymentsClient | undefined;
14
+ protected _staticWallets: StaticWalletsClient | undefined;
15
+ constructor(options?: SuwardSDKClient.Options);
16
+ get payments(): PaymentsClient;
17
+ get staticWallets(): StaticWalletsClient;
18
+ /**
19
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
20
+ * This is useful for making requests to endpoints not yet supported in the SDK.
21
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
22
+ *
23
+ * @param {Request | string | URL} input - The URL, path, or Request object.
24
+ * @param {RequestInit} init - Standard fetch RequestInit options.
25
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
26
+ * @returns {Promise<Response>} A standard Response object.
27
+ */
28
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
29
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.SuwardSDKClient = void 0;
47
+ const Client_js_1 = require("./api/resources/payments/client/Client.js");
48
+ const Client_js_2 = require("./api/resources/staticWallets/client/Client.js");
49
+ const BaseClient_js_1 = require("./BaseClient.js");
50
+ const core = __importStar(require("./core/index.js"));
51
+ class SuwardSDKClient {
52
+ constructor(options = {}) {
53
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
54
+ }
55
+ get payments() {
56
+ var _a;
57
+ return ((_a = this._payments) !== null && _a !== void 0 ? _a : (this._payments = new Client_js_1.PaymentsClient(this._options)));
58
+ }
59
+ get staticWallets() {
60
+ var _a;
61
+ return ((_a = this._staticWallets) !== null && _a !== void 0 ? _a : (this._staticWallets = new Client_js_2.StaticWalletsClient(this._options)));
62
+ }
63
+ /**
64
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
65
+ * This is useful for making requests to endpoints not yet supported in the SDK.
66
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
67
+ *
68
+ * @param {Request | string | URL} input - The URL, path, or Request object.
69
+ * @param {RequestInit} init - Standard fetch RequestInit options.
70
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
71
+ * @returns {Promise<Response>} A standard Response object.
72
+ */
73
+ fetch(input, init, requestOptions) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ var _a;
76
+ return core.makePassthroughRequest(input, init, {
77
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
78
+ headers: this._options.headers,
79
+ timeoutInSeconds: this._options.timeoutInSeconds,
80
+ maxRetries: this._options.maxRetries,
81
+ fetch: this._options.fetch,
82
+ logging: this._options.logging,
83
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
84
+ }, requestOptions);
85
+ });
86
+ }
87
+ }
88
+ exports.SuwardSDKClient = SuwardSDKClient;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as SuwardSDK from "../index.js";
4
+ export declare class BadRequestError extends errors.SuwardSDKError {
5
+ constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.BadRequestError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class BadRequestError extends errors.SuwardSDKError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "BadRequestError",
43
+ statusCode: 400,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "BadRequestError";
52
+ }
53
+ }
54
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as SuwardSDK from "../index.js";
4
+ export declare class InternalServerError extends errors.SuwardSDKError {
5
+ constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.InternalServerError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class InternalServerError extends errors.SuwardSDKError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "InternalServerError",
43
+ statusCode: 500,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "InternalServerError";
52
+ }
53
+ }
54
+ exports.InternalServerError = InternalServerError;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as SuwardSDK from "../index.js";
4
+ export declare class NotFoundError extends errors.SuwardSDKError {
5
+ constructor(body: SuwardSDK.ControllerErrorResponse, rawResponse?: core.RawResponse);
6
+ }