@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
package/Client.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "./environments";
5
+ import * as core from "./core";
6
+ import { Blasts } from "./api/resources/blasts/client/Client";
7
+ import { Contacts } from "./api/resources/contacts/client/Client";
8
+ import { Messages } from "./api/resources/messages/client/Client";
9
+ import { Users } from "./api/resources/users/client/Client";
10
+ import { Verifications } from "./api/resources/verifications/client/Client";
11
+ export declare namespace SurgeClient {
12
+ interface Options {
13
+ environment?: core.Supplier<environments.SurgeEnvironment | string>;
14
+ /** Specify a custom URL to connect the client to. */
15
+ baseUrl?: core.Supplier<string>;
16
+ token: core.Supplier<core.BearerToken>;
17
+ fetcher?: core.FetchFunction;
18
+ }
19
+ interface RequestOptions {
20
+ /** The maximum time to wait for a response in seconds. */
21
+ timeoutInSeconds?: number;
22
+ /** The number of times to retry the request. Defaults to 2. */
23
+ maxRetries?: number;
24
+ /** A hook to abort the request. */
25
+ abortSignal?: AbortSignal;
26
+ /** Additional headers to include in the request. */
27
+ headers?: Record<string, string>;
28
+ }
29
+ }
30
+ export declare class SurgeClient {
31
+ protected readonly _options: SurgeClient.Options;
32
+ protected _blasts: Blasts | undefined;
33
+ protected _contacts: Contacts | undefined;
34
+ protected _messages: Messages | undefined;
35
+ protected _users: Users | undefined;
36
+ protected _verifications: Verifications | undefined;
37
+ constructor(_options: SurgeClient.Options);
38
+ get blasts(): Blasts;
39
+ get contacts(): Contacts;
40
+ get messages(): Messages;
41
+ get users(): Users;
42
+ get verifications(): Verifications;
43
+ }
package/Client.js ADDED
@@ -0,0 +1,37 @@
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.SurgeClient = void 0;
7
+ const Client_1 = require("./api/resources/blasts/client/Client");
8
+ const Client_2 = require("./api/resources/contacts/client/Client");
9
+ const Client_3 = require("./api/resources/messages/client/Client");
10
+ const Client_4 = require("./api/resources/users/client/Client");
11
+ const Client_5 = require("./api/resources/verifications/client/Client");
12
+ class SurgeClient {
13
+ constructor(_options) {
14
+ this._options = _options;
15
+ }
16
+ get blasts() {
17
+ var _a;
18
+ return ((_a = this._blasts) !== null && _a !== void 0 ? _a : (this._blasts = new Client_1.Blasts(this._options)));
19
+ }
20
+ get contacts() {
21
+ var _a;
22
+ return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_2.Contacts(this._options)));
23
+ }
24
+ get messages() {
25
+ var _a;
26
+ return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_3.Messages(this._options)));
27
+ }
28
+ get users() {
29
+ var _a;
30
+ return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_4.Users(this._options)));
31
+ }
32
+ get verifications() {
33
+ var _a;
34
+ return ((_a = this._verifications) !== null && _a !== void 0 ? _a : (this._verifications = new Client_5.Verifications(this._options)));
35
+ }
36
+ }
37
+ exports.SurgeClient = SurgeClient;
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Surge.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # Surge 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%2Fsurgemsg%2Ftypescript-sdk)
4
+ [![npm shield](https://img.shields.io/npm/v/@surgeapi/node)](https://www.npmjs.com/package/@surgeapi/node)
5
+
6
+ The Surge TypeScript library provides convenient access to the Surge API from TypeScript.
7
+
8
+ ## Documentation
9
+
10
+ API reference documentation is available [here](https://surge.app).
11
+
12
+ ## Installation
13
+
14
+ ```sh
15
+ npm i -s @surgeapi/node
16
+ ```
17
+
18
+ ## Reference
19
+
20
+ A full reference for this library is available [here](./reference.md).
21
+
22
+ ## Usage
23
+
24
+ Instantiate and use the client with the following:
25
+
26
+ ```typescript
27
+ import { SurgeClient } from "@surgeapi/node";
28
+
29
+ const client = new SurgeClient({ token: "YOUR_TOKEN" });
30
+ await client.messages.send("acct_01j9a43avnfqzbjfch6pygv1td", {
31
+ attachments: [
32
+ {
33
+ url: "https://toretto.family/coronas.gif",
34
+ },
35
+ ],
36
+ body: "Thought you could leave without saying goodbye?",
37
+ conversation: {
38
+ contact: {
39
+ first_name: "Dominic",
40
+ id: "ctc_01j9dy8mdzfn3r0e8x1tbdrdrf",
41
+ last_name: "Toretto",
42
+ phone_number: "+18015551234",
43
+ },
44
+ id: "cnv_01j9e0dgmdfkj86c877ws0znae",
45
+ },
46
+ });
47
+ ```
48
+
49
+ ## Request And Response Types
50
+
51
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
52
+ following namespace:
53
+
54
+ ```typescript
55
+ import { Surge } from "@surgeapi/node";
56
+
57
+ const request: Surge.BlastRequest = {
58
+ ...
59
+ };
60
+ ```
61
+
62
+ ## Exception Handling
63
+
64
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
65
+ will be thrown.
66
+
67
+ ```typescript
68
+ import { SurgeError } from "@surgeapi/node";
69
+
70
+ try {
71
+ await client.messages.send(...);
72
+ } catch (err) {
73
+ if (err instanceof SurgeError) {
74
+ console.log(err.statusCode);
75
+ console.log(err.message);
76
+ console.log(err.body);
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Advanced
82
+
83
+ ### Additional Headers
84
+
85
+ If you would like to send additional headers as part of the request, use the `headers` request option.
86
+
87
+ ```typescript
88
+ const response = await client.messages.send(..., {
89
+ headers: {
90
+ 'X-Custom-Header': 'custom value'
91
+ }
92
+ });
93
+ ```
94
+
95
+ ### Retries
96
+
97
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
98
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
99
+ retry limit (default: 2).
100
+
101
+ A request is deemed retryable when any of the following HTTP status codes is returned:
102
+
103
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
104
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
105
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
106
+
107
+ Use the `maxRetries` request option to configure this behavior.
108
+
109
+ ```typescript
110
+ const response = await client.messages.send(..., {
111
+ maxRetries: 0 // override maxRetries at the request level
112
+ });
113
+ ```
114
+
115
+ ### Timeouts
116
+
117
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
118
+
119
+ ```typescript
120
+ const response = await client.messages.send(..., {
121
+ timeoutInSeconds: 30 // override timeout to 30s
122
+ });
123
+ ```
124
+
125
+ ### Aborting Requests
126
+
127
+ The SDK allows users to abort requests at any point by passing in an abort signal.
128
+
129
+ ```typescript
130
+ const controller = new AbortController();
131
+ const response = await client.messages.send(..., {
132
+ abortSignal: controller.signal
133
+ });
134
+ controller.abort(); // aborts the request
135
+ ```
136
+
137
+ ### Runtime Compatibility
138
+
139
+ The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
140
+ runtimes:
141
+
142
+ - Node.js 18+
143
+ - Vercel
144
+ - Cloudflare Workers
145
+ - Deno v1.25+
146
+ - Bun 1.0+
147
+ - React Native
148
+
149
+ ### Customizing Fetch Client
150
+
151
+ The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an
152
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
153
+
154
+ ```typescript
155
+ import { SurgeClient } from "@surgeapi/node";
156
+
157
+ const client = new SurgeClient({
158
+ ...
159
+ fetcher: // provide your implementation here
160
+ });
161
+ ```
162
+
163
+ ## Contributing
164
+
165
+ While we value open-source contributions to this SDK, this library is generated programmatically.
166
+ Additions made directly to this library would have to be moved over to our generation code,
167
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
168
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
169
+ an issue first to discuss with us!
170
+
171
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors/index";
5
+ import * as Surge from "../index";
6
+ export declare class ConflictError extends errors.SurgeError {
7
+ constructor(body: Surge.VerificationCheckAlreadyVerifiedResponse);
8
+ }
@@ -0,0 +1,51 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ConflictError = void 0;
40
+ const errors = __importStar(require("../../errors/index"));
41
+ class ConflictError extends errors.SurgeError {
42
+ constructor(body) {
43
+ super({
44
+ message: "ConflictError",
45
+ statusCode: 409,
46
+ body: body,
47
+ });
48
+ Object.setPrototypeOf(this, ConflictError.prototype);
49
+ }
50
+ }
51
+ exports.ConflictError = ConflictError;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors/index";
5
+ import * as Surge from "../index";
6
+ export declare class UnprocessableEntityError extends errors.SurgeError {
7
+ constructor(body: Surge.VerificationCheckIncorrectResponse);
8
+ }
@@ -0,0 +1,51 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.UnprocessableEntityError = void 0;
40
+ const errors = __importStar(require("../../errors/index"));
41
+ class UnprocessableEntityError extends errors.SurgeError {
42
+ constructor(body) {
43
+ super({
44
+ message: "UnprocessableEntityError",
45
+ statusCode: 422,
46
+ body: body,
47
+ });
48
+ Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
49
+ }
50
+ }
51
+ exports.UnprocessableEntityError = UnprocessableEntityError;
@@ -0,0 +1,2 @@
1
+ export * from "./ConflictError";
2
+ export * from "./UnprocessableEntityError";
@@ -0,0 +1,18 @@
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("./ConflictError"), exports);
18
+ __exportStar(require("./UnprocessableEntityError"), exports);
package/api/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./errors";
3
+ export * from "./resources";
package/api/index.js ADDED
@@ -0,0 +1,19 @@
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("./types"), exports);
18
+ __exportStar(require("./errors"), exports);
19
+ __exportStar(require("./resources"), exports);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments";
5
+ import * as core from "../../../../core";
6
+ import * as Surge from "../../../index";
7
+ export declare namespace Blasts {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.SurgeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token: core.Supplier<core.BearerToken>;
13
+ fetcher?: core.FetchFunction;
14
+ }
15
+ interface RequestOptions {
16
+ /** The maximum time to wait for a response in seconds. */
17
+ timeoutInSeconds?: number;
18
+ /** The number of times to retry the request. Defaults to 2. */
19
+ maxRetries?: number;
20
+ /** A hook to abort the request. */
21
+ abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
24
+ }
25
+ }
26
+ export declare class Blasts {
27
+ protected readonly _options: Blasts.Options;
28
+ constructor(_options: Blasts.Options);
29
+ /**
30
+ * Sends a Blast.
31
+ *
32
+ * @param {string} accountId - The account for which the blast should be sent.
33
+ * @param {Surge.BlastRequest} request
34
+ * @param {Blasts.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.blasts.send("acct_01j9a43avnfqzbjfch6pygv1td", {
38
+ * attachments: [{
39
+ * url: "https://example.com/image.jpg"
40
+ * }],
41
+ * body: "Join us for our grand opening!",
42
+ * contacts: ["ctc_01j9dy8mdzfn3r0e8x1tbdrdrf"],
43
+ * name: "Grand Opening Announcement",
44
+ * segments: ["seg_01j9dy8mdzfn3r0e8x1tbdrdrf"],
45
+ * send_at: "2024-02-01T15:00:00Z"
46
+ * })
47
+ */
48
+ send(accountId: string, request?: Surge.BlastRequest, requestOptions?: Blasts.RequestOptions): Promise<Surge.BlastResponse>;
49
+ protected _getAuthorizationHeader(): Promise<string>;
50
+ }
@@ -0,0 +1,123 @@
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.Blasts = void 0;
52
+ const environments = __importStar(require("../../../../environments"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const url_join_1 = __importDefault(require("url-join"));
55
+ const errors = __importStar(require("../../../../errors/index"));
56
+ class Blasts {
57
+ constructor(_options) {
58
+ this._options = _options;
59
+ }
60
+ /**
61
+ * Sends a Blast.
62
+ *
63
+ * @param {string} accountId - The account for which the blast should be sent.
64
+ * @param {Surge.BlastRequest} request
65
+ * @param {Blasts.RequestOptions} requestOptions - Request-specific configuration.
66
+ *
67
+ * @example
68
+ * await client.blasts.send("acct_01j9a43avnfqzbjfch6pygv1td", {
69
+ * attachments: [{
70
+ * url: "https://example.com/image.jpg"
71
+ * }],
72
+ * body: "Join us for our grand opening!",
73
+ * contacts: ["ctc_01j9dy8mdzfn3r0e8x1tbdrdrf"],
74
+ * name: "Grand Opening Announcement",
75
+ * segments: ["seg_01j9dy8mdzfn3r0e8x1tbdrdrf"],
76
+ * send_at: "2024-02-01T15:00:00Z"
77
+ * })
78
+ */
79
+ send(accountId_1) {
80
+ return __awaiter(this, arguments, void 0, function* (accountId, request = {}, requestOptions) {
81
+ var _a, _b, _c;
82
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
83
+ 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, `accounts/${encodeURIComponent(accountId)}/blasts`),
84
+ method: "POST",
85
+ 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),
86
+ contentType: "application/json",
87
+ requestType: "json",
88
+ body: request,
89
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
90
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
91
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
+ });
93
+ if (_response.ok) {
94
+ return _response.body;
95
+ }
96
+ if (_response.error.reason === "status-code") {
97
+ throw new errors.SurgeError({
98
+ statusCode: _response.error.statusCode,
99
+ body: _response.error.body,
100
+ });
101
+ }
102
+ switch (_response.error.reason) {
103
+ case "non-json":
104
+ throw new errors.SurgeError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.rawBody,
107
+ });
108
+ case "timeout":
109
+ throw new errors.SurgeTimeoutError("Timeout exceeded when calling POST /accounts/{account_id}/blasts.");
110
+ case "unknown":
111
+ throw new errors.SurgeError({
112
+ message: _response.error.errorMessage,
113
+ });
114
+ }
115
+ });
116
+ }
117
+ _getAuthorizationHeader() {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
120
+ });
121
+ }
122
+ }
123
+ exports.Blasts = Blasts;
@@ -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,30 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Surge from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * attachments: [{
9
+ * url: "https://example.com/image.jpg"
10
+ * }],
11
+ * body: "Join us for our grand opening!",
12
+ * contacts: ["ctc_01j9dy8mdzfn3r0e8x1tbdrdrf"],
13
+ * name: "Grand Opening Announcement",
14
+ * segments: ["seg_01j9dy8mdzfn3r0e8x1tbdrdrf"],
15
+ * send_at: "2024-02-01T15:00:00Z"
16
+ * }
17
+ */
18
+ export interface BlastRequest {
19
+ attachments?: Surge.AttachmentParams[];
20
+ /** The message body. */
21
+ body?: string;
22
+ /** List of contact IDs to send the blast to. */
23
+ contacts?: string[];
24
+ /** Optional name for the blast. */
25
+ name?: string;
26
+ /** List of segment IDs to send the blast to. */
27
+ segments?: string[];
28
+ /** When to send the blast. If not provided, sends immediately. */
29
+ send_at?: string;
30
+ }