@surgeapi/node 0.25.3

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 (326) hide show
  1. package/Client.d.ts +43 -0
  2. package/Client.js +37 -0
  3. package/LICENSE +21 -0
  4. package/README.md +171 -0
  5. package/api/errors/ConflictError.d.ts +8 -0
  6. package/api/errors/ConflictError.js +51 -0
  7. package/api/errors/UnprocessableEntityError.d.ts +8 -0
  8. package/api/errors/UnprocessableEntityError.js +51 -0
  9. package/api/errors/index.d.ts +2 -0
  10. package/api/errors/index.js +18 -0
  11. package/api/index.d.ts +3 -0
  12. package/api/index.js +19 -0
  13. package/api/resources/blasts/client/Client.d.ts +50 -0
  14. package/api/resources/blasts/client/Client.js +123 -0
  15. package/api/resources/blasts/client/index.d.ts +1 -0
  16. package/api/resources/blasts/client/index.js +17 -0
  17. package/api/resources/blasts/client/requests/BlastRequest.d.ts +30 -0
  18. package/api/resources/blasts/client/requests/BlastRequest.js +5 -0
  19. package/api/resources/blasts/client/requests/index.d.ts +1 -0
  20. package/api/resources/blasts/client/requests/index.js +2 -0
  21. package/api/resources/blasts/index.d.ts +1 -0
  22. package/api/resources/blasts/index.js +17 -0
  23. package/api/resources/contacts/client/Client.d.ts +78 -0
  24. package/api/resources/contacts/client/Client.js +224 -0
  25. package/api/resources/contacts/client/index.d.ts +1 -0
  26. package/api/resources/contacts/client/index.js +2 -0
  27. package/api/resources/contacts/index.d.ts +1 -0
  28. package/api/resources/contacts/index.js +17 -0
  29. package/api/resources/index.d.ts +9 -0
  30. package/api/resources/index.js +48 -0
  31. package/api/resources/messages/client/Client.d.ts +55 -0
  32. package/api/resources/messages/client/Client.js +128 -0
  33. package/api/resources/messages/client/index.d.ts +1 -0
  34. package/api/resources/messages/client/index.js +17 -0
  35. package/api/resources/messages/client/requests/MessageRequest.d.ts +28 -0
  36. package/api/resources/messages/client/requests/MessageRequest.js +5 -0
  37. package/api/resources/messages/client/requests/index.d.ts +1 -0
  38. package/api/resources/messages/client/requests/index.js +2 -0
  39. package/api/resources/messages/index.d.ts +1 -0
  40. package/api/resources/messages/index.js +17 -0
  41. package/api/resources/users/client/Client.d.ts +59 -0
  42. package/api/resources/users/client/Client.js +168 -0
  43. package/api/resources/users/client/index.d.ts +1 -0
  44. package/api/resources/users/client/index.js +17 -0
  45. package/api/resources/users/client/requests/UserRequest.d.ts +25 -0
  46. package/api/resources/users/client/requests/UserRequest.js +5 -0
  47. package/api/resources/users/client/requests/index.d.ts +1 -0
  48. package/api/resources/users/client/requests/index.js +2 -0
  49. package/api/resources/users/index.d.ts +1 -0
  50. package/api/resources/users/index.js +17 -0
  51. package/api/resources/verifications/client/Client.d.ts +58 -0
  52. package/api/resources/verifications/client/Client.js +176 -0
  53. package/api/resources/verifications/client/index.d.ts +1 -0
  54. package/api/resources/verifications/client/index.js +17 -0
  55. package/api/resources/verifications/client/requests/VerificationCheckRequest.d.ts +13 -0
  56. package/api/resources/verifications/client/requests/VerificationCheckRequest.js +5 -0
  57. package/api/resources/verifications/client/requests/VerificationRequest.d.ts +13 -0
  58. package/api/resources/verifications/client/requests/VerificationRequest.js +5 -0
  59. package/api/resources/verifications/client/requests/index.d.ts +2 -0
  60. package/api/resources/verifications/client/requests/index.js +2 -0
  61. package/api/resources/verifications/index.d.ts +1 -0
  62. package/api/resources/verifications/index.js +17 -0
  63. package/api/types/AttachmentParams.d.ts +10 -0
  64. package/api/types/AttachmentParams.js +5 -0
  65. package/api/types/AttachmentResponse.d.ts +14 -0
  66. package/api/types/AttachmentResponse.js +5 -0
  67. package/api/types/BlastResponse.d.ts +18 -0
  68. package/api/types/BlastResponse.js +5 -0
  69. package/api/types/BlastResponseAttachmentsItem.d.ts +7 -0
  70. package/api/types/BlastResponseAttachmentsItem.js +5 -0
  71. package/api/types/Contact.d.ts +16 -0
  72. package/api/types/Contact.js +5 -0
  73. package/api/types/ContactRequest.d.ts +18 -0
  74. package/api/types/ContactRequest.js +5 -0
  75. package/api/types/ContactResponse.d.ts +20 -0
  76. package/api/types/ContactResponse.js +5 -0
  77. package/api/types/Conversation.d.ts +12 -0
  78. package/api/types/Conversation.js +5 -0
  79. package/api/types/MessageConversationContactParams.d.ts +16 -0
  80. package/api/types/MessageConversationContactParams.js +5 -0
  81. package/api/types/MessageConversationParams.d.ts +12 -0
  82. package/api/types/MessageConversationParams.js +5 -0
  83. package/api/types/MessageResponse.d.ts +15 -0
  84. package/api/types/MessageResponse.js +5 -0
  85. package/api/types/UserResponse.d.ts +18 -0
  86. package/api/types/UserResponse.js +5 -0
  87. package/api/types/Verification.d.ts +17 -0
  88. package/api/types/Verification.js +5 -0
  89. package/api/types/VerificationCheckAlreadyVerifiedResponse.d.ts +12 -0
  90. package/api/types/VerificationCheckAlreadyVerifiedResponse.js +5 -0
  91. package/api/types/VerificationCheckAlreadyVerifiedResponseResult.d.ts +14 -0
  92. package/api/types/VerificationCheckAlreadyVerifiedResponseResult.js +13 -0
  93. package/api/types/VerificationCheckIncorrectResponse.d.ts +12 -0
  94. package/api/types/VerificationCheckIncorrectResponse.js +5 -0
  95. package/api/types/VerificationCheckIncorrectResponseResult.d.ts +12 -0
  96. package/api/types/VerificationCheckIncorrectResponseResult.js +11 -0
  97. package/api/types/VerificationCheckOkResponse.d.ts +21 -0
  98. package/api/types/VerificationCheckOkResponse.js +5 -0
  99. package/api/types/VerificationCheckOkResponseResult.d.ts +21 -0
  100. package/api/types/VerificationCheckOkResponseResult.js +13 -0
  101. package/api/types/VerificationStatus.d.ts +13 -0
  102. package/api/types/VerificationStatus.js +12 -0
  103. package/api/types/index.d.ts +20 -0
  104. package/api/types/index.js +36 -0
  105. package/core/auth/BasicAuth.d.ts +8 -0
  106. package/core/auth/BasicAuth.js +26 -0
  107. package/core/auth/BearerToken.d.ts +5 -0
  108. package/core/auth/BearerToken.js +15 -0
  109. package/core/auth/index.d.ts +2 -0
  110. package/core/auth/index.js +7 -0
  111. package/core/fetcher/APIResponse.d.ts +10 -0
  112. package/core/fetcher/APIResponse.js +2 -0
  113. package/core/fetcher/Fetcher.d.ts +39 -0
  114. package/core/fetcher/Fetcher.js +100 -0
  115. package/core/fetcher/Supplier.d.ts +4 -0
  116. package/core/fetcher/Supplier.js +22 -0
  117. package/core/fetcher/createRequestUrl.d.ts +1 -0
  118. package/core/fetcher/createRequestUrl.js +12 -0
  119. package/core/fetcher/getFetchFn.d.ts +4 -0
  120. package/core/fetcher/getFetchFn.js +68 -0
  121. package/core/fetcher/getHeader.d.ts +1 -0
  122. package/core/fetcher/getHeader.js +11 -0
  123. package/core/fetcher/getRequestBody.d.ts +7 -0
  124. package/core/fetcher/getRequestBody.js +23 -0
  125. package/core/fetcher/getResponseBody.d.ts +1 -0
  126. package/core/fetcher/getResponseBody.js +54 -0
  127. package/core/fetcher/index.d.ts +5 -0
  128. package/core/fetcher/index.js +9 -0
  129. package/core/fetcher/makeRequest.d.ts +1 -0
  130. package/core/fetcher/makeRequest.js +42 -0
  131. package/core/fetcher/requestWithRetries.d.ts +1 -0
  132. package/core/fetcher/requestWithRetries.js +40 -0
  133. package/core/fetcher/signals.d.ts +11 -0
  134. package/core/fetcher/signals.js +36 -0
  135. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  136. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  137. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  138. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  139. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  140. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  141. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  142. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  143. package/core/index.d.ts +3 -0
  144. package/core/index.js +19 -0
  145. package/core/json.d.ts +15 -0
  146. package/core/json.js +24 -0
  147. package/core/runtime/index.d.ts +1 -0
  148. package/core/runtime/index.js +5 -0
  149. package/core/runtime/runtime.d.ts +9 -0
  150. package/core/runtime/runtime.js +103 -0
  151. package/dist/Client.d.ts +43 -0
  152. package/dist/Client.js +37 -0
  153. package/dist/api/errors/ConflictError.d.ts +8 -0
  154. package/dist/api/errors/ConflictError.js +51 -0
  155. package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
  156. package/dist/api/errors/UnprocessableEntityError.js +51 -0
  157. package/dist/api/errors/index.d.ts +2 -0
  158. package/dist/api/errors/index.js +18 -0
  159. package/dist/api/index.d.ts +3 -0
  160. package/dist/api/index.js +19 -0
  161. package/dist/api/resources/blasts/client/Client.d.ts +50 -0
  162. package/dist/api/resources/blasts/client/Client.js +123 -0
  163. package/dist/api/resources/blasts/client/index.d.ts +1 -0
  164. package/dist/api/resources/blasts/client/index.js +17 -0
  165. package/dist/api/resources/blasts/client/requests/BlastRequest.d.ts +30 -0
  166. package/dist/api/resources/blasts/client/requests/BlastRequest.js +5 -0
  167. package/dist/api/resources/blasts/client/requests/index.d.ts +1 -0
  168. package/dist/api/resources/blasts/client/requests/index.js +2 -0
  169. package/dist/api/resources/blasts/index.d.ts +1 -0
  170. package/dist/api/resources/blasts/index.js +17 -0
  171. package/dist/api/resources/contacts/client/Client.d.ts +78 -0
  172. package/dist/api/resources/contacts/client/Client.js +224 -0
  173. package/dist/api/resources/contacts/client/index.d.ts +1 -0
  174. package/dist/api/resources/contacts/client/index.js +2 -0
  175. package/dist/api/resources/contacts/index.d.ts +1 -0
  176. package/dist/api/resources/contacts/index.js +17 -0
  177. package/dist/api/resources/index.d.ts +9 -0
  178. package/dist/api/resources/index.js +48 -0
  179. package/dist/api/resources/messages/client/Client.d.ts +55 -0
  180. package/dist/api/resources/messages/client/Client.js +128 -0
  181. package/dist/api/resources/messages/client/index.d.ts +1 -0
  182. package/dist/api/resources/messages/client/index.js +17 -0
  183. package/dist/api/resources/messages/client/requests/MessageRequest.d.ts +28 -0
  184. package/dist/api/resources/messages/client/requests/MessageRequest.js +5 -0
  185. package/dist/api/resources/messages/client/requests/index.d.ts +1 -0
  186. package/dist/api/resources/messages/client/requests/index.js +2 -0
  187. package/dist/api/resources/messages/index.d.ts +1 -0
  188. package/dist/api/resources/messages/index.js +17 -0
  189. package/dist/api/resources/users/client/Client.d.ts +59 -0
  190. package/dist/api/resources/users/client/Client.js +168 -0
  191. package/dist/api/resources/users/client/index.d.ts +1 -0
  192. package/dist/api/resources/users/client/index.js +17 -0
  193. package/dist/api/resources/users/client/requests/UserRequest.d.ts +25 -0
  194. package/dist/api/resources/users/client/requests/UserRequest.js +5 -0
  195. package/dist/api/resources/users/client/requests/index.d.ts +1 -0
  196. package/dist/api/resources/users/client/requests/index.js +2 -0
  197. package/dist/api/resources/users/index.d.ts +1 -0
  198. package/dist/api/resources/users/index.js +17 -0
  199. package/dist/api/resources/verifications/client/Client.d.ts +58 -0
  200. package/dist/api/resources/verifications/client/Client.js +176 -0
  201. package/dist/api/resources/verifications/client/index.d.ts +1 -0
  202. package/dist/api/resources/verifications/client/index.js +17 -0
  203. package/dist/api/resources/verifications/client/requests/VerificationCheckRequest.d.ts +13 -0
  204. package/dist/api/resources/verifications/client/requests/VerificationCheckRequest.js +5 -0
  205. package/dist/api/resources/verifications/client/requests/VerificationRequest.d.ts +13 -0
  206. package/dist/api/resources/verifications/client/requests/VerificationRequest.js +5 -0
  207. package/dist/api/resources/verifications/client/requests/index.d.ts +2 -0
  208. package/dist/api/resources/verifications/client/requests/index.js +2 -0
  209. package/dist/api/resources/verifications/index.d.ts +1 -0
  210. package/dist/api/resources/verifications/index.js +17 -0
  211. package/dist/api/types/AttachmentParams.d.ts +10 -0
  212. package/dist/api/types/AttachmentParams.js +5 -0
  213. package/dist/api/types/AttachmentResponse.d.ts +14 -0
  214. package/dist/api/types/AttachmentResponse.js +5 -0
  215. package/dist/api/types/BlastResponse.d.ts +18 -0
  216. package/dist/api/types/BlastResponse.js +5 -0
  217. package/dist/api/types/BlastResponseAttachmentsItem.d.ts +7 -0
  218. package/dist/api/types/BlastResponseAttachmentsItem.js +5 -0
  219. package/dist/api/types/Contact.d.ts +16 -0
  220. package/dist/api/types/Contact.js +5 -0
  221. package/dist/api/types/ContactRequest.d.ts +18 -0
  222. package/dist/api/types/ContactRequest.js +5 -0
  223. package/dist/api/types/ContactResponse.d.ts +20 -0
  224. package/dist/api/types/ContactResponse.js +5 -0
  225. package/dist/api/types/Conversation.d.ts +12 -0
  226. package/dist/api/types/Conversation.js +5 -0
  227. package/dist/api/types/MessageConversationContactParams.d.ts +16 -0
  228. package/dist/api/types/MessageConversationContactParams.js +5 -0
  229. package/dist/api/types/MessageConversationParams.d.ts +12 -0
  230. package/dist/api/types/MessageConversationParams.js +5 -0
  231. package/dist/api/types/MessageResponse.d.ts +15 -0
  232. package/dist/api/types/MessageResponse.js +5 -0
  233. package/dist/api/types/UserResponse.d.ts +18 -0
  234. package/dist/api/types/UserResponse.js +5 -0
  235. package/dist/api/types/Verification.d.ts +17 -0
  236. package/dist/api/types/Verification.js +5 -0
  237. package/dist/api/types/VerificationCheckAlreadyVerifiedResponse.d.ts +12 -0
  238. package/dist/api/types/VerificationCheckAlreadyVerifiedResponse.js +5 -0
  239. package/dist/api/types/VerificationCheckAlreadyVerifiedResponseResult.d.ts +14 -0
  240. package/dist/api/types/VerificationCheckAlreadyVerifiedResponseResult.js +13 -0
  241. package/dist/api/types/VerificationCheckIncorrectResponse.d.ts +12 -0
  242. package/dist/api/types/VerificationCheckIncorrectResponse.js +5 -0
  243. package/dist/api/types/VerificationCheckIncorrectResponseResult.d.ts +12 -0
  244. package/dist/api/types/VerificationCheckIncorrectResponseResult.js +11 -0
  245. package/dist/api/types/VerificationCheckOkResponse.d.ts +21 -0
  246. package/dist/api/types/VerificationCheckOkResponse.js +5 -0
  247. package/dist/api/types/VerificationCheckOkResponseResult.d.ts +21 -0
  248. package/dist/api/types/VerificationCheckOkResponseResult.js +13 -0
  249. package/dist/api/types/VerificationStatus.d.ts +13 -0
  250. package/dist/api/types/VerificationStatus.js +12 -0
  251. package/dist/api/types/index.d.ts +20 -0
  252. package/dist/api/types/index.js +36 -0
  253. package/dist/core/auth/BasicAuth.d.ts +8 -0
  254. package/dist/core/auth/BasicAuth.js +26 -0
  255. package/dist/core/auth/BearerToken.d.ts +5 -0
  256. package/dist/core/auth/BearerToken.js +15 -0
  257. package/dist/core/auth/index.d.ts +2 -0
  258. package/dist/core/auth/index.js +7 -0
  259. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  260. package/dist/core/fetcher/APIResponse.js +2 -0
  261. package/dist/core/fetcher/Fetcher.d.ts +39 -0
  262. package/dist/core/fetcher/Fetcher.js +100 -0
  263. package/dist/core/fetcher/Supplier.d.ts +4 -0
  264. package/dist/core/fetcher/Supplier.js +22 -0
  265. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  266. package/dist/core/fetcher/createRequestUrl.js +12 -0
  267. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  268. package/dist/core/fetcher/getFetchFn.js +68 -0
  269. package/dist/core/fetcher/getHeader.d.ts +1 -0
  270. package/dist/core/fetcher/getHeader.js +11 -0
  271. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  272. package/dist/core/fetcher/getRequestBody.js +23 -0
  273. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  274. package/dist/core/fetcher/getResponseBody.js +54 -0
  275. package/dist/core/fetcher/index.d.ts +5 -0
  276. package/dist/core/fetcher/index.js +9 -0
  277. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  278. package/dist/core/fetcher/makeRequest.js +42 -0
  279. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  280. package/dist/core/fetcher/requestWithRetries.js +40 -0
  281. package/dist/core/fetcher/signals.d.ts +11 -0
  282. package/dist/core/fetcher/signals.js +36 -0
  283. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  284. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  285. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  286. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  287. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  288. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  289. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  290. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  291. package/dist/core/index.d.ts +3 -0
  292. package/dist/core/index.js +19 -0
  293. package/dist/core/json.d.ts +15 -0
  294. package/dist/core/json.js +24 -0
  295. package/dist/core/runtime/index.d.ts +1 -0
  296. package/dist/core/runtime/index.js +5 -0
  297. package/dist/core/runtime/runtime.d.ts +9 -0
  298. package/dist/core/runtime/runtime.js +103 -0
  299. package/dist/environments.d.ts +7 -0
  300. package/dist/environments.js +9 -0
  301. package/dist/errors/SurgeError.d.ts +12 -0
  302. package/dist/errors/SurgeError.js +33 -0
  303. package/dist/errors/SurgeTimeoutError.d.ts +6 -0
  304. package/dist/errors/SurgeTimeoutError.js +13 -0
  305. package/dist/errors/index.d.ts +2 -0
  306. package/dist/errors/index.js +7 -0
  307. package/dist/index.d.ts +4 -0
  308. package/dist/index.js +44 -0
  309. package/dist/version.d.ts +1 -0
  310. package/dist/version.js +4 -0
  311. package/environments.d.ts +7 -0
  312. package/environments.js +9 -0
  313. package/errors/SurgeError.d.ts +12 -0
  314. package/errors/SurgeError.js +33 -0
  315. package/errors/SurgeTimeoutError.d.ts +6 -0
  316. package/errors/SurgeTimeoutError.js +13 -0
  317. package/errors/index.d.ts +2 -0
  318. package/errors/index.js +7 -0
  319. package/index.d.ts +4 -0
  320. package/index.js +44 -0
  321. package/jest.config.mjs +8 -0
  322. package/package.json +44 -0
  323. package/reference.md +681 -0
  324. package/scripts/rename-to-esm-files.js +115 -0
  325. package/version.d.ts +1 -0
  326. package/version.js +4 -0
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Verifications = void 0;
52
+ const environments = __importStar(require("../../../../environments"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const Surge = __importStar(require("../../../index"));
55
+ const url_join_1 = __importDefault(require("url-join"));
56
+ const errors = __importStar(require("../../../../errors/index"));
57
+ class Verifications {
58
+ constructor(_options) {
59
+ this._options = _options;
60
+ }
61
+ /**
62
+ * Creates a new Verification and sends the code to the given phone number.
63
+ *
64
+ * @param {Surge.VerificationRequest} request
65
+ * @param {Verifications.RequestOptions} requestOptions - Request-specific configuration.
66
+ *
67
+ * @example
68
+ * await client.verifications.create({
69
+ * phone_number: "+18015551234"
70
+ * })
71
+ */
72
+ create(request, requestOptions) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, _b, _c;
75
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
76
+ url: (0, url_join_1.default)((_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.SurgeEnvironment.Default, "verifications"),
77
+ method: "POST",
78
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
79
+ contentType: "application/json",
80
+ requestType: "json",
81
+ body: request,
82
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
83
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
84
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
85
+ });
86
+ if (_response.ok) {
87
+ return _response.body;
88
+ }
89
+ if (_response.error.reason === "status-code") {
90
+ throw new errors.SurgeError({
91
+ statusCode: _response.error.statusCode,
92
+ body: _response.error.body,
93
+ });
94
+ }
95
+ switch (_response.error.reason) {
96
+ case "non-json":
97
+ throw new errors.SurgeError({
98
+ statusCode: _response.error.statusCode,
99
+ body: _response.error.rawBody,
100
+ });
101
+ case "timeout":
102
+ throw new errors.SurgeTimeoutError("Timeout exceeded when calling POST /verifications.");
103
+ case "unknown":
104
+ throw new errors.SurgeError({
105
+ message: _response.error.errorMessage,
106
+ });
107
+ }
108
+ });
109
+ }
110
+ /**
111
+ * Checks the code against a verification.
112
+ *
113
+ * @param {string} id -
114
+ * @param {Surge.VerificationCheckRequest} request
115
+ * @param {Verifications.RequestOptions} requestOptions - Request-specific configuration.
116
+ *
117
+ * @throws {@link Surge.ConflictError}
118
+ * @throws {@link Surge.UnprocessableEntityError}
119
+ *
120
+ * @example
121
+ * await client.verifications.check("vfn_01jayh15c2f2xamftg0xpyq1nj", {
122
+ * code: "123456"
123
+ * })
124
+ */
125
+ check(id, request, requestOptions) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ var _a, _b, _c;
128
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
129
+ url: (0, url_join_1.default)((_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.SurgeEnvironment.Default, `verifications/${encodeURIComponent(id)}/checks`),
130
+ method: "POST",
131
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
132
+ contentType: "application/json",
133
+ requestType: "json",
134
+ body: request,
135
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
136
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
137
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
138
+ });
139
+ if (_response.ok) {
140
+ return _response.body;
141
+ }
142
+ if (_response.error.reason === "status-code") {
143
+ switch (_response.error.statusCode) {
144
+ case 409:
145
+ throw new Surge.ConflictError(_response.error.body);
146
+ case 422:
147
+ throw new Surge.UnprocessableEntityError(_response.error.body);
148
+ default:
149
+ throw new errors.SurgeError({
150
+ statusCode: _response.error.statusCode,
151
+ body: _response.error.body,
152
+ });
153
+ }
154
+ }
155
+ switch (_response.error.reason) {
156
+ case "non-json":
157
+ throw new errors.SurgeError({
158
+ statusCode: _response.error.statusCode,
159
+ body: _response.error.rawBody,
160
+ });
161
+ case "timeout":
162
+ throw new errors.SurgeTimeoutError("Timeout exceeded when calling POST /verifications/{id}/checks.");
163
+ case "unknown":
164
+ throw new errors.SurgeError({
165
+ message: _response.error.errorMessage,
166
+ });
167
+ }
168
+ });
169
+ }
170
+ _getAuthorizationHeader() {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
173
+ });
174
+ }
175
+ }
176
+ exports.Verifications = Verifications;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * code: "123456"
8
+ * }
9
+ */
10
+ export interface VerificationCheckRequest {
11
+ /** The Verification code that was received. */
12
+ code: string;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * phone_number: "+18015551234"
8
+ * }
9
+ */
10
+ export interface VerificationRequest {
11
+ /** The phone number to be verified. In E.164 format. */
12
+ phone_number: string;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { type VerificationRequest } from "./VerificationRequest";
2
+ export { type VerificationCheckRequest } from "./VerificationCheckRequest";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Params for creating an attachment
6
+ */
7
+ export interface AttachmentParams {
8
+ /** The URL of the attachment. */
9
+ url: string;
10
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Response schema for single attachment
6
+ */
7
+ export interface AttachmentResponse {
8
+ /** Unique identifier for the object. */
9
+ id?: string;
10
+ /** The type of attachment. */
11
+ type?: string;
12
+ /** The URL of the attachment. */
13
+ url?: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * Response schema for single blast
7
+ */
8
+ export interface BlastResponse {
9
+ attachments?: Surge.BlastResponseAttachmentsItem[];
10
+ /** The message body. */
11
+ body?: string;
12
+ /** Unique identifier for the object. */
13
+ id?: string;
14
+ /** Optional name for the blast. */
15
+ name?: string;
16
+ /** When the blast will be or was sent. */
17
+ send_at?: string;
18
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface BlastResponseAttachmentsItem {
5
+ /** The URL of the attachment. */
6
+ url?: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * A contact who has consented to receive messages
6
+ */
7
+ export interface Contact {
8
+ /** The contact's first name. */
9
+ first_name?: string;
10
+ /** Unique identifier for the object. */
11
+ id: string;
12
+ /** The contact's last name. */
13
+ last_name?: string;
14
+ /** The contact's phone number in E.164 format. */
15
+ phone_number: string;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * POST body for creating a contact
6
+ */
7
+ export interface ContactRequest {
8
+ /** The contact's email address. */
9
+ email?: string;
10
+ /** The contact's first name. */
11
+ first_name?: string;
12
+ /** The contact's last name. */
13
+ last_name?: string;
14
+ /** Additional metadata about the contact. */
15
+ metadata?: Record<string, unknown>;
16
+ /** The contact's phone number in E.164 format. */
17
+ phone_number: string;
18
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Response schema for single contact
6
+ */
7
+ export interface ContactResponse {
8
+ /** The contact's email address. */
9
+ email?: string;
10
+ /** The contact's first name. */
11
+ first_name?: string;
12
+ /** Unique identifier for the object. */
13
+ id?: string;
14
+ /** The contact's last name. */
15
+ last_name?: string;
16
+ /** Additional metadata about the contact. */
17
+ metadata?: Record<string, unknown>;
18
+ /** The contact's phone number in E.164 format. */
19
+ phone_number?: string;
20
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * A conversation with a Contact
7
+ */
8
+ export interface Conversation {
9
+ contact: Surge.Contact;
10
+ /** Unique identifier for the object. */
11
+ id: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Params for selecting or creating a new contact for sending a message. Either the id or the phone number must be given.
6
+ */
7
+ export interface MessageConversationContactParams {
8
+ /** The contact's first name in case a new contact is created. */
9
+ first_name?: string;
10
+ /** The unique identifier for an existing contact. */
11
+ id?: string;
12
+ /** The message's last name in case a new contact is created. */
13
+ last_name?: string;
14
+ /** The contact's phone number in E.164 format. */
15
+ phone_number?: string;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * Params for selecting or creating a new conversation. Either the id or the Contact must be given.
7
+ */
8
+ export interface MessageConversationParams {
9
+ contact?: Surge.MessageConversationContactParams;
10
+ /** Unique identifier for the object. */
11
+ id?: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * Response schema for single message
7
+ */
8
+ export interface MessageResponse {
9
+ attachments?: Surge.AttachmentResponse[];
10
+ /** The message body. */
11
+ body?: string;
12
+ conversation?: Surge.Conversation;
13
+ /** Unique identifier for the object. */
14
+ id?: string;
15
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Response schema for single user
6
+ */
7
+ export interface UserResponse {
8
+ /** The user's first name. */
9
+ first_name?: string;
10
+ /** Unique identifier for the object. */
11
+ id?: string;
12
+ /** The user's last name. */
13
+ last_name?: string;
14
+ /** Set of key-value pairs that will be stored with the user. */
15
+ metadata?: Record<string, unknown>;
16
+ /** URL of a photo to be used as the user's avatar. */
17
+ photo_url?: string;
18
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * A phone number verification
7
+ */
8
+ export interface Verification {
9
+ /** The number of times the code has been attempted. */
10
+ attempt_count: number;
11
+ /** Unique identifier for the object. */
12
+ id: string;
13
+ /** The phone number being verified. In E.164 format. */
14
+ phone_number: string;
15
+ /** The current status of the verification. */
16
+ status: Surge.VerificationStatus;
17
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * The response returned from checking a Verification code
7
+ */
8
+ export interface VerificationCheckAlreadyVerifiedResponse {
9
+ /** The result of the code check. */
10
+ result?: Surge.VerificationCheckAlreadyVerifiedResponseResult;
11
+ verification?: Surge.Verification;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * The result of the code check.
6
+ */
7
+ export type VerificationCheckAlreadyVerifiedResponseResult = "ok" | "incorrect" | "exhausted" | "expired" | "already_verified";
8
+ export declare const VerificationCheckAlreadyVerifiedResponseResult: {
9
+ readonly Ok: "ok";
10
+ readonly Incorrect: "incorrect";
11
+ readonly Exhausted: "exhausted";
12
+ readonly Expired: "expired";
13
+ readonly AlreadyVerified: "already_verified";
14
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VerificationCheckAlreadyVerifiedResponseResult = void 0;
7
+ exports.VerificationCheckAlreadyVerifiedResponseResult = {
8
+ Ok: "ok",
9
+ Incorrect: "incorrect",
10
+ Exhausted: "exhausted",
11
+ Expired: "expired",
12
+ AlreadyVerified: "already_verified",
13
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../index";
5
+ /**
6
+ * The response returned from checking a Verification code
7
+ */
8
+ export interface VerificationCheckIncorrectResponse {
9
+ /** The result of the code check. */
10
+ result?: Surge.VerificationCheckIncorrectResponseResult;
11
+ verification?: Surge.Verification;
12
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });