@sentdm/sentdm 0.3.5

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 (379) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +201 -0
  3. package/README.md +393 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +200 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +200 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +486 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +482 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +35 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +32 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/request-options.d.mts +75 -0
  109. package/internal/request-options.d.mts.map +1 -0
  110. package/internal/request-options.d.ts +75 -0
  111. package/internal/request-options.d.ts.map +1 -0
  112. package/internal/request-options.js +14 -0
  113. package/internal/request-options.js.map +1 -0
  114. package/internal/request-options.mjs +10 -0
  115. package/internal/request-options.mjs.map +1 -0
  116. package/internal/shim-types.d.mts +17 -0
  117. package/internal/shim-types.d.mts.map +1 -0
  118. package/internal/shim-types.d.ts +17 -0
  119. package/internal/shim-types.d.ts.map +1 -0
  120. package/internal/shim-types.js +4 -0
  121. package/internal/shim-types.js.map +1 -0
  122. package/internal/shim-types.mjs +3 -0
  123. package/internal/shim-types.mjs.map +1 -0
  124. package/internal/shims.d.mts +20 -0
  125. package/internal/shims.d.mts.map +1 -0
  126. package/internal/shims.d.ts +20 -0
  127. package/internal/shims.d.ts.map +1 -0
  128. package/internal/shims.js +92 -0
  129. package/internal/shims.js.map +1 -0
  130. package/internal/shims.mjs +85 -0
  131. package/internal/shims.mjs.map +1 -0
  132. package/internal/to-file.d.mts +45 -0
  133. package/internal/to-file.d.mts.map +1 -0
  134. package/internal/to-file.d.ts +45 -0
  135. package/internal/to-file.d.ts.map +1 -0
  136. package/internal/to-file.js +91 -0
  137. package/internal/to-file.js.map +1 -0
  138. package/internal/to-file.mjs +88 -0
  139. package/internal/to-file.mjs.map +1 -0
  140. package/internal/tslib.js +81 -0
  141. package/internal/tslib.mjs +17 -0
  142. package/internal/types.d.mts +69 -0
  143. package/internal/types.d.mts.map +1 -0
  144. package/internal/types.d.ts +69 -0
  145. package/internal/types.d.ts.map +1 -0
  146. package/internal/types.js +4 -0
  147. package/internal/types.js.map +1 -0
  148. package/internal/types.mjs +3 -0
  149. package/internal/types.mjs.map +1 -0
  150. package/internal/uploads.d.mts +42 -0
  151. package/internal/uploads.d.mts.map +1 -0
  152. package/internal/uploads.d.ts +42 -0
  153. package/internal/uploads.d.ts.map +1 -0
  154. package/internal/uploads.js +141 -0
  155. package/internal/uploads.js.map +1 -0
  156. package/internal/uploads.mjs +131 -0
  157. package/internal/uploads.mjs.map +1 -0
  158. package/internal/utils/base64.d.mts +3 -0
  159. package/internal/utils/base64.d.mts.map +1 -0
  160. package/internal/utils/base64.d.ts +3 -0
  161. package/internal/utils/base64.d.ts.map +1 -0
  162. package/internal/utils/base64.js +38 -0
  163. package/internal/utils/base64.js.map +1 -0
  164. package/internal/utils/base64.mjs +33 -0
  165. package/internal/utils/base64.mjs.map +1 -0
  166. package/internal/utils/bytes.d.mts +4 -0
  167. package/internal/utils/bytes.d.mts.map +1 -0
  168. package/internal/utils/bytes.d.ts +4 -0
  169. package/internal/utils/bytes.d.ts.map +1 -0
  170. package/internal/utils/bytes.js +31 -0
  171. package/internal/utils/bytes.js.map +1 -0
  172. package/internal/utils/bytes.mjs +26 -0
  173. package/internal/utils/bytes.mjs.map +1 -0
  174. package/internal/utils/env.d.mts +9 -0
  175. package/internal/utils/env.d.mts.map +1 -0
  176. package/internal/utils/env.d.ts +9 -0
  177. package/internal/utils/env.d.ts.map +1 -0
  178. package/internal/utils/env.js +22 -0
  179. package/internal/utils/env.js.map +1 -0
  180. package/internal/utils/env.mjs +18 -0
  181. package/internal/utils/env.mjs.map +1 -0
  182. package/internal/utils/log.d.mts +37 -0
  183. package/internal/utils/log.d.mts.map +1 -0
  184. package/internal/utils/log.d.ts +37 -0
  185. package/internal/utils/log.d.ts.map +1 -0
  186. package/internal/utils/log.js +87 -0
  187. package/internal/utils/log.js.map +1 -0
  188. package/internal/utils/log.mjs +81 -0
  189. package/internal/utils/log.mjs.map +1 -0
  190. package/internal/utils/path.d.mts +15 -0
  191. package/internal/utils/path.d.mts.map +1 -0
  192. package/internal/utils/path.d.ts +15 -0
  193. package/internal/utils/path.d.ts.map +1 -0
  194. package/internal/utils/path.js +79 -0
  195. package/internal/utils/path.js.map +1 -0
  196. package/internal/utils/path.mjs +74 -0
  197. package/internal/utils/path.mjs.map +1 -0
  198. package/internal/utils/sleep.d.mts +2 -0
  199. package/internal/utils/sleep.d.mts.map +1 -0
  200. package/internal/utils/sleep.d.ts +2 -0
  201. package/internal/utils/sleep.d.ts.map +1 -0
  202. package/internal/utils/sleep.js +7 -0
  203. package/internal/utils/sleep.js.map +1 -0
  204. package/internal/utils/sleep.mjs +3 -0
  205. package/internal/utils/sleep.mjs.map +1 -0
  206. package/internal/utils/uuid.d.mts +5 -0
  207. package/internal/utils/uuid.d.mts.map +1 -0
  208. package/internal/utils/uuid.d.ts +5 -0
  209. package/internal/utils/uuid.d.ts.map +1 -0
  210. package/internal/utils/uuid.js +19 -0
  211. package/internal/utils/uuid.js.map +1 -0
  212. package/internal/utils/uuid.mjs +15 -0
  213. package/internal/utils/uuid.mjs.map +1 -0
  214. package/internal/utils/values.d.mts +18 -0
  215. package/internal/utils/values.d.mts.map +1 -0
  216. package/internal/utils/values.d.ts +18 -0
  217. package/internal/utils/values.d.ts.map +1 -0
  218. package/internal/utils/values.js +112 -0
  219. package/internal/utils/values.js.map +1 -0
  220. package/internal/utils/values.mjs +94 -0
  221. package/internal/utils/values.mjs.map +1 -0
  222. package/internal/utils.d.mts +7 -0
  223. package/internal/utils.d.mts.map +1 -0
  224. package/internal/utils.d.ts +7 -0
  225. package/internal/utils.d.ts.map +1 -0
  226. package/internal/utils.js +11 -0
  227. package/internal/utils.js.map +1 -0
  228. package/internal/utils.mjs +8 -0
  229. package/internal/utils.mjs.map +1 -0
  230. package/package.json +137 -0
  231. package/resource.d.mts +2 -0
  232. package/resource.d.mts.map +1 -0
  233. package/resource.d.ts +2 -0
  234. package/resource.d.ts.map +1 -0
  235. package/resource.js +6 -0
  236. package/resource.js.map +1 -0
  237. package/resource.mjs +2 -0
  238. package/resource.mjs.map +1 -0
  239. package/resources/contacts.d.mts +103 -0
  240. package/resources/contacts.d.mts.map +1 -0
  241. package/resources/contacts.d.ts +103 -0
  242. package/resources/contacts.d.ts.map +1 -0
  243. package/resources/contacts.js +33 -0
  244. package/resources/contacts.js.map +1 -0
  245. package/resources/contacts.mjs +29 -0
  246. package/resources/contacts.mjs.map +1 -0
  247. package/resources/index.d.mts +6 -0
  248. package/resources/index.d.mts.map +1 -0
  249. package/resources/index.d.ts +6 -0
  250. package/resources/index.d.ts.map +1 -0
  251. package/resources/index.js +15 -0
  252. package/resources/index.js.map +1 -0
  253. package/resources/index.mjs +7 -0
  254. package/resources/index.mjs.map +1 -0
  255. package/resources/messages.d.mts +222 -0
  256. package/resources/messages.d.mts.map +1 -0
  257. package/resources/messages.d.ts +222 -0
  258. package/resources/messages.d.ts.map +1 -0
  259. package/resources/messages.js +90 -0
  260. package/resources/messages.js.map +1 -0
  261. package/resources/messages.mjs +86 -0
  262. package/resources/messages.mjs.map +1 -0
  263. package/resources/number-lookup.d.mts +59 -0
  264. package/resources/number-lookup.d.mts.map +1 -0
  265. package/resources/number-lookup.d.ts +59 -0
  266. package/resources/number-lookup.d.ts.map +1 -0
  267. package/resources/number-lookup.js +17 -0
  268. package/resources/number-lookup.js.map +1 -0
  269. package/resources/number-lookup.mjs +13 -0
  270. package/resources/number-lookup.mjs.map +1 -0
  271. package/resources/organizations/index.d.mts +3 -0
  272. package/resources/organizations/index.d.mts.map +1 -0
  273. package/resources/organizations/index.d.ts +3 -0
  274. package/resources/organizations/index.d.ts.map +1 -0
  275. package/resources/organizations/index.js +9 -0
  276. package/resources/organizations/index.js.map +1 -0
  277. package/resources/organizations/index.mjs +4 -0
  278. package/resources/organizations/index.mjs.map +1 -0
  279. package/resources/organizations/organizations.d.mts +63 -0
  280. package/resources/organizations/organizations.d.mts.map +1 -0
  281. package/resources/organizations/organizations.d.ts +63 -0
  282. package/resources/organizations/organizations.d.ts.map +1 -0
  283. package/resources/organizations/organizations.js +46 -0
  284. package/resources/organizations/organizations.js.map +1 -0
  285. package/resources/organizations/organizations.mjs +41 -0
  286. package/resources/organizations/organizations.mjs.map +1 -0
  287. package/resources/organizations/users.d.mts +126 -0
  288. package/resources/organizations/users.d.mts.map +1 -0
  289. package/resources/organizations/users.d.ts +126 -0
  290. package/resources/organizations/users.d.ts.map +1 -0
  291. package/resources/organizations/users.js +95 -0
  292. package/resources/organizations/users.js.map +1 -0
  293. package/resources/organizations/users.mjs +91 -0
  294. package/resources/organizations/users.mjs.map +1 -0
  295. package/resources/organizations.d.mts +2 -0
  296. package/resources/organizations.d.mts.map +1 -0
  297. package/resources/organizations.d.ts +2 -0
  298. package/resources/organizations.d.ts.map +1 -0
  299. package/resources/organizations.js +6 -0
  300. package/resources/organizations.js.map +1 -0
  301. package/resources/organizations.mjs +3 -0
  302. package/resources/organizations.mjs.map +1 -0
  303. package/resources/templates.d.mts +333 -0
  304. package/resources/templates.d.mts.map +1 -0
  305. package/resources/templates.d.ts +333 -0
  306. package/resources/templates.d.ts.map +1 -0
  307. package/resources/templates.js +84 -0
  308. package/resources/templates.js.map +1 -0
  309. package/resources/templates.mjs +80 -0
  310. package/resources/templates.mjs.map +1 -0
  311. package/resources.d.mts +2 -0
  312. package/resources.d.mts.map +1 -0
  313. package/resources.d.ts +2 -0
  314. package/resources.d.ts.map +1 -0
  315. package/resources.js +5 -0
  316. package/resources.js.map +1 -0
  317. package/resources.mjs +2 -0
  318. package/resources.mjs.map +1 -0
  319. package/src/api-promise.ts +2 -0
  320. package/src/client.ts +832 -0
  321. package/src/core/README.md +3 -0
  322. package/src/core/api-promise.ts +92 -0
  323. package/src/core/error.ts +130 -0
  324. package/src/core/resource.ts +11 -0
  325. package/src/core/uploads.ts +2 -0
  326. package/src/error.ts +2 -0
  327. package/src/index.ts +22 -0
  328. package/src/internal/README.md +3 -0
  329. package/src/internal/builtin-types.ts +93 -0
  330. package/src/internal/detect-platform.ts +196 -0
  331. package/src/internal/errors.ts +33 -0
  332. package/src/internal/headers.ts +97 -0
  333. package/src/internal/parse.ts +50 -0
  334. package/src/internal/request-options.ts +91 -0
  335. package/src/internal/shim-types.ts +26 -0
  336. package/src/internal/shims.ts +107 -0
  337. package/src/internal/to-file.ts +154 -0
  338. package/src/internal/types.ts +95 -0
  339. package/src/internal/uploads.ts +187 -0
  340. package/src/internal/utils/base64.ts +40 -0
  341. package/src/internal/utils/bytes.ts +32 -0
  342. package/src/internal/utils/env.ts +18 -0
  343. package/src/internal/utils/log.ts +128 -0
  344. package/src/internal/utils/path.ts +88 -0
  345. package/src/internal/utils/sleep.ts +3 -0
  346. package/src/internal/utils/uuid.ts +17 -0
  347. package/src/internal/utils/values.ts +105 -0
  348. package/src/internal/utils.ts +8 -0
  349. package/src/lib/.keep +4 -0
  350. package/src/resource.ts +2 -0
  351. package/src/resources/contacts.ts +142 -0
  352. package/src/resources/index.ts +38 -0
  353. package/src/resources/messages.ts +283 -0
  354. package/src/resources/number-lookup.ts +80 -0
  355. package/src/resources/organizations/index.ts +18 -0
  356. package/src/resources/organizations/organizations.ts +116 -0
  357. package/src/resources/organizations/users.ts +189 -0
  358. package/src/resources/organizations.ts +3 -0
  359. package/src/resources/templates.ts +430 -0
  360. package/src/resources.ts +1 -0
  361. package/src/tsconfig.json +11 -0
  362. package/src/uploads.ts +2 -0
  363. package/src/version.ts +1 -0
  364. package/uploads.d.mts +2 -0
  365. package/uploads.d.mts.map +1 -0
  366. package/uploads.d.ts +2 -0
  367. package/uploads.d.ts.map +1 -0
  368. package/uploads.js +6 -0
  369. package/uploads.js.map +1 -0
  370. package/uploads.mjs +2 -0
  371. package/uploads.mjs.map +1 -0
  372. package/version.d.mts +2 -0
  373. package/version.d.mts.map +1 -0
  374. package/version.d.ts +2 -0
  375. package/version.d.ts.map +1 -0
  376. package/version.js +5 -0
  377. package/version.js.map +1 -0
  378. package/version.mjs +2 -0
  379. package/version.mjs.map +1 -0
@@ -0,0 +1,142 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Contacts extends APIResource {
8
+ /**
9
+ * Retrieves a paginated list of contacts for the authenticated customer. Supports
10
+ * server-side pagination with configurable page size. The customer ID is extracted
11
+ * from the authentication token.
12
+ */
13
+ list(query: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse> {
14
+ return this._client.get('/v2/contacts', { query, ...options });
15
+ }
16
+
17
+ /**
18
+ * Retrieves a contact by their phone number for the authenticated customer. Phone
19
+ * number should be in international format (e.g., +1234567890). The customer ID is
20
+ * extracted from the authentication token.
21
+ */
22
+ retrieveByPhone(
23
+ query: ContactRetrieveByPhoneParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<ContactListItem> {
26
+ return this._client.get('/v2/contacts/phone', { query, ...options });
27
+ }
28
+
29
+ /**
30
+ * Retrieves a specific contact by their unique identifier for the authenticated
31
+ * customer. The customer ID is extracted from the authentication token. Returns
32
+ * detailed contact information including phone number and creation timestamp.
33
+ */
34
+ retrieveID(query: ContactRetrieveIDParams, options?: RequestOptions): APIPromise<ContactListItem> {
35
+ return this._client.get('/v2/contacts/id', { query, ...options });
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Represents a contact in the customer's contact list
41
+ */
42
+ export interface ContactListItem {
43
+ /**
44
+ * The unique identifier of the contact
45
+ */
46
+ id?: string;
47
+
48
+ /**
49
+ * Comma-separated list of available messaging channels for this contact (e.g.,
50
+ * "sms,whatsapp")
51
+ */
52
+ availableChannels?: string;
53
+
54
+ /**
55
+ * The country calling code (e.g., 1 for US/Canada)
56
+ */
57
+ countryCode?: string;
58
+
59
+ /**
60
+ * The default messaging channel to use for this contact (e.g., "sms" or
61
+ * "whatsapp")
62
+ */
63
+ defaultChannel?: string;
64
+
65
+ /**
66
+ * The phone number formatted in E.164 standard (e.g., +1234567890)
67
+ */
68
+ formatE164?: string;
69
+
70
+ /**
71
+ * The phone number formatted for international dialing (e.g., +1 234-567-890)
72
+ */
73
+ formatInternational?: string;
74
+
75
+ /**
76
+ * The phone number formatted for national dialing (e.g., (234) 567-890)
77
+ */
78
+ formatNational?: string;
79
+
80
+ /**
81
+ * The phone number formatted according to RFC 3966 (e.g., tel:+1-234-567-890)
82
+ */
83
+ formatRfc?: string;
84
+
85
+ /**
86
+ * The phone number in its original format
87
+ */
88
+ phoneNumber?: string;
89
+
90
+ /**
91
+ * The ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
92
+ */
93
+ regionCode?: string;
94
+ }
95
+
96
+ export interface ContactListResponse {
97
+ items?: Array<ContactListItem>;
98
+
99
+ page?: number;
100
+
101
+ pageSize?: number;
102
+
103
+ totalCount?: number;
104
+
105
+ totalPages?: number;
106
+ }
107
+
108
+ export interface ContactListParams {
109
+ /**
110
+ * The page number (zero-indexed). Default is 0.
111
+ */
112
+ page: number;
113
+
114
+ /**
115
+ * The number of items per page. Default is 20.
116
+ */
117
+ pageSize: number;
118
+ }
119
+
120
+ export interface ContactRetrieveByPhoneParams {
121
+ /**
122
+ * The phone number in international format (e.g., +1234567890)
123
+ */
124
+ phoneNumber: string;
125
+ }
126
+
127
+ export interface ContactRetrieveIDParams {
128
+ /**
129
+ * The unique identifier (GUID) of the resource to retrieve
130
+ */
131
+ id: string;
132
+ }
133
+
134
+ export declare namespace Contacts {
135
+ export {
136
+ type ContactListItem as ContactListItem,
137
+ type ContactListResponse as ContactListResponse,
138
+ type ContactListParams as ContactListParams,
139
+ type ContactRetrieveByPhoneParams as ContactRetrieveByPhoneParams,
140
+ type ContactRetrieveIDParams as ContactRetrieveIDParams,
141
+ };
142
+ }
@@ -0,0 +1,38 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Contacts,
5
+ type ContactListItem,
6
+ type ContactListResponse,
7
+ type ContactListParams,
8
+ type ContactRetrieveByPhoneParams,
9
+ type ContactRetrieveIDParams,
10
+ } from './contacts';
11
+ export {
12
+ Messages,
13
+ type MessageRetrieveResponse,
14
+ type MessageSendQuickMessageParams,
15
+ type MessageSendToContactParams,
16
+ type MessageSendToPhoneParams,
17
+ } from './messages';
18
+ export {
19
+ NumberLookup,
20
+ type NumberLookupRetrieveResponse,
21
+ type NumberLookupRetrieveParams,
22
+ } from './number-lookup';
23
+ export {
24
+ Organizations,
25
+ type ProfileSummary,
26
+ type OrganizationListResponse,
27
+ type OrganizationRetrieveProfilesResponse,
28
+ } from './organizations/organizations';
29
+ export {
30
+ Templates,
31
+ type TemplateBodyContent,
32
+ type TemplateDefinition,
33
+ type TemplateResponse,
34
+ type TemplateVariable,
35
+ type TemplateListResponse,
36
+ type TemplateCreateParams,
37
+ type TemplateListParams,
38
+ } from './templates';
@@ -0,0 +1,283 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { buildHeaders } from '../internal/headers';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Messages extends APIResource {
10
+ /**
11
+ * Retrieves comprehensive details about a specific message using the message ID.
12
+ * Returns complete message data including delivery status, channel information,
13
+ * template details, contact information, and pricing. The customer ID is extracted
14
+ * from the authentication token to ensure the message belongs to the authenticated
15
+ * customer.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const message = await client.messages.retrieve(
20
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
21
+ * );
22
+ * ```
23
+ */
24
+ retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse> {
25
+ return this._client.get(path`/v2/messages/${id}`, options);
26
+ }
27
+
28
+ /**
29
+ * Sends a message to a phone number using the default template. This endpoint is
30
+ * rate limited to 5 messages per customer per day. The customer ID is extracted
31
+ * from the authentication token.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * await client.messages.sendQuickMessage({
36
+ * customMessage: 'Hello, this is a test message!',
37
+ * phoneNumber: '+1234567890',
38
+ * });
39
+ * ```
40
+ */
41
+ sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void> {
42
+ return this._client.post('/v2/messages/quick-message', {
43
+ body,
44
+ ...options,
45
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Sends a message to a specific contact using a template. The message can be sent
51
+ * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
52
+ * a webhook URL to receive delivery status updates. The customer ID is extracted
53
+ * from the authentication token.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * await client.messages.sendToContact({
58
+ * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
59
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
60
+ * });
61
+ * ```
62
+ */
63
+ sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void> {
64
+ return this._client.post('/v2/messages/contact', {
65
+ body,
66
+ ...options,
67
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
68
+ });
69
+ }
70
+
71
+ /**
72
+ * Sends a message to a phone number using a template. The phone number doesn't
73
+ * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
74
+ * Optionally specify a webhook URL to receive delivery status updates. The
75
+ * customer ID is extracted from the authentication token.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * await client.messages.sendToPhone({
80
+ * phoneNumber: '+1234567890',
81
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
82
+ * });
83
+ * ```
84
+ */
85
+ sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void> {
86
+ return this._client.post('/v2/messages/phone', {
87
+ body,
88
+ ...options,
89
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
90
+ });
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Represents a sent message with comprehensive delivery and template information
96
+ * (v2)
97
+ */
98
+ export interface MessageRetrieveResponse {
99
+ /**
100
+ * The unique identifier of the message
101
+ */
102
+ id?: string;
103
+
104
+ /**
105
+ * The messaging channel used (e.g., SMS, WhatsApp)
106
+ */
107
+ channel?: string;
108
+
109
+ /**
110
+ * The unique identifier of the contact who received the message
111
+ */
112
+ contactId?: string;
113
+
114
+ /**
115
+ * The final price charged for sending this message
116
+ */
117
+ correctedPrice?: number | null;
118
+
119
+ /**
120
+ * The date and time when the message was created
121
+ */
122
+ createdAt?: string;
123
+
124
+ /**
125
+ * The unique identifier of the customer who sent the message
126
+ */
127
+ customerId?: string;
128
+
129
+ /**
130
+ * A chronological list of status change events for this message. Each event
131
+ * includes a status and timestamp, following industry standards (Twilio, SendGrid,
132
+ * Mailgun). Events are ordered chronologically from oldest to newest.
133
+ */
134
+ events?: Array<MessageRetrieveResponse.Event> | null;
135
+
136
+ /**
137
+ * The message body content with variables substituted
138
+ */
139
+ messageBody?: MessageRetrieveResponse.MessageBody | null;
140
+
141
+ /**
142
+ * The phone number of the recipient (E.164 format)
143
+ */
144
+ phoneNumber?: string;
145
+
146
+ /**
147
+ * The phone number in international format
148
+ */
149
+ phoneNumberInternational?: string;
150
+
151
+ /**
152
+ * The region code of the phone number (e.g., US, GB, DE)
153
+ */
154
+ regionCode?: string;
155
+
156
+ /**
157
+ * The delivery status of the message (e.g., sent, delivered, failed, read)
158
+ */
159
+ status?: string;
160
+
161
+ /**
162
+ * The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
163
+ */
164
+ templateCategory?: string;
165
+
166
+ /**
167
+ * The unique identifier of the template used for this message (null if no template
168
+ * was used)
169
+ */
170
+ templateId?: string | null;
171
+
172
+ /**
173
+ * The display name of the template
174
+ */
175
+ templateName?: string;
176
+ }
177
+
178
+ export namespace MessageRetrieveResponse {
179
+ /**
180
+ * Represents a status change event in a message's lifecycle Follows industry
181
+ * standards (Twilio, SendGrid, Mailgun pattern)
182
+ */
183
+ export interface Event {
184
+ /**
185
+ * Optional human-readable description of the event Useful for error messages or
186
+ * additional context
187
+ */
188
+ description?: string | null;
189
+
190
+ /**
191
+ * The status of the message at this point in time Examples: "queued", "sent",
192
+ * "delivered", "read", "failed"
193
+ */
194
+ status?: string;
195
+
196
+ /**
197
+ * When this status change occurred (ISO 8601 format)
198
+ */
199
+ timestamp?: string;
200
+ }
201
+
202
+ /**
203
+ * The message body content with variables substituted
204
+ */
205
+ export interface MessageBody {
206
+ buttons?: Array<MessageBody.Button> | null;
207
+
208
+ content?: string;
209
+
210
+ footer?: string | null;
211
+
212
+ header?: string | null;
213
+ }
214
+
215
+ export namespace MessageBody {
216
+ export interface Button {
217
+ type?: string;
218
+
219
+ value?: string;
220
+ }
221
+ }
222
+ }
223
+
224
+ export interface MessageSendQuickMessageParams {
225
+ /**
226
+ * The custom message content to include in the template
227
+ */
228
+ customMessage: string;
229
+
230
+ /**
231
+ * The phone number to send the message to, in international format (e.g.,
232
+ * +1234567890)
233
+ */
234
+ phoneNumber: string;
235
+ }
236
+
237
+ export interface MessageSendToContactParams {
238
+ /**
239
+ * The unique identifier of the contact to send the message to
240
+ */
241
+ contactId: string;
242
+
243
+ /**
244
+ * The unique identifier of the template to use for the message
245
+ */
246
+ templateId: string;
247
+
248
+ /**
249
+ * Optional key-value pairs of template variables to replace in the template body.
250
+ * For example, if your template contains "Hello {{name}}", you would provide {
251
+ * "name": "John Doe" }
252
+ */
253
+ templateVariables?: { [key: string]: string } | null;
254
+ }
255
+
256
+ export interface MessageSendToPhoneParams {
257
+ /**
258
+ * The phone number to send the message to, in international format (e.g.,
259
+ * +1234567890)
260
+ */
261
+ phoneNumber: string;
262
+
263
+ /**
264
+ * The unique identifier of the template to use for the message
265
+ */
266
+ templateId: string;
267
+
268
+ /**
269
+ * Optional key-value pairs of template variables to replace in the template body.
270
+ * For example, if your template contains "Hello {{name}}", you would provide {
271
+ * "name": "John Doe" }
272
+ */
273
+ templateVariables?: { [key: string]: string } | null;
274
+ }
275
+
276
+ export declare namespace Messages {
277
+ export {
278
+ type MessageRetrieveResponse as MessageRetrieveResponse,
279
+ type MessageSendQuickMessageParams as MessageSendQuickMessageParams,
280
+ type MessageSendToContactParams as MessageSendToContactParams,
281
+ type MessageSendToPhoneParams as MessageSendToPhoneParams,
282
+ };
283
+ }
@@ -0,0 +1,80 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class NumberLookup extends APIResource {
8
+ /**
9
+ * Retrieves detailed information about a phone number including validation,
10
+ * formatting, country information, and available messaging channels. The customer
11
+ * ID is extracted from the authentication token.
12
+ */
13
+ retrieve(
14
+ query: NumberLookupRetrieveParams,
15
+ options?: RequestOptions,
16
+ ): APIPromise<NumberLookupRetrieveResponse> {
17
+ return this._client.get('/v2/number-lookup', { query, ...options });
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Response containing phone number lookup data
23
+ */
24
+ export interface NumberLookupRetrieveResponse {
25
+ /**
26
+ * The country calling code (e.g., 1 for US/Canada)
27
+ */
28
+ countryCode?: string;
29
+
30
+ /**
31
+ * The phone number formatted in E.164 standard (e.g., +1234567890)
32
+ */
33
+ formatE164?: string;
34
+
35
+ /**
36
+ * The phone number formatted for international dialing (e.g., +1 234-567-890)
37
+ */
38
+ formatInternational?: string;
39
+
40
+ /**
41
+ * The phone number formatted for national dialing (e.g., (234) 567-890)
42
+ */
43
+ formatNational?: string;
44
+
45
+ /**
46
+ * The phone number formatted according to RFC 3966 (e.g., tel:+1-234-567-890)
47
+ */
48
+ formatRfc?: string;
49
+
50
+ /**
51
+ * The type of phone number (e.g., mobile, fixed_line, voip)
52
+ */
53
+ numberType?: string;
54
+
55
+ /**
56
+ * The phone number in its original format
57
+ */
58
+ phoneNumber?: string;
59
+
60
+ /**
61
+ * The timezones associated with the phone number
62
+ */
63
+ phoneTimezones?: string;
64
+
65
+ /**
66
+ * The ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
67
+ */
68
+ regionCode?: string;
69
+ }
70
+
71
+ export interface NumberLookupRetrieveParams {
72
+ phoneNumber: string;
73
+ }
74
+
75
+ export declare namespace NumberLookup {
76
+ export {
77
+ type NumberLookupRetrieveResponse as NumberLookupRetrieveResponse,
78
+ type NumberLookupRetrieveParams as NumberLookupRetrieveParams,
79
+ };
80
+ }
@@ -0,0 +1,18 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Organizations,
5
+ type ProfileSummary,
6
+ type OrganizationListResponse,
7
+ type OrganizationRetrieveProfilesResponse,
8
+ } from './organizations';
9
+ export {
10
+ Users,
11
+ type CustomerUser,
12
+ type UserListResponse,
13
+ type UserRetrieveParams,
14
+ type UserListParams,
15
+ type UserDeleteParams,
16
+ type UserInviteParams,
17
+ type UserUpdateRoleParams,
18
+ } from './users';
@@ -0,0 +1,116 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as OrganizationsAPI from './organizations';
5
+ import * as UsersAPI from './users';
6
+ import {
7
+ CustomerUser,
8
+ UserDeleteParams,
9
+ UserInviteParams,
10
+ UserListParams,
11
+ UserListResponse,
12
+ UserRetrieveParams,
13
+ UserUpdateRoleParams,
14
+ Users,
15
+ } from './users';
16
+ import { APIPromise } from '../../core/api-promise';
17
+ import { RequestOptions } from '../../internal/request-options';
18
+ import { path } from '../../internal/utils/path';
19
+
20
+ export class Organizations extends APIResource {
21
+ users: UsersAPI.Users = new UsersAPI.Users(this._client);
22
+
23
+ /**
24
+ * Retrieves all organizations that the authenticated user has access to, including
25
+ * the sender profiles within each organization that the user can access. Returns
26
+ * organization details with nested profiles filtered by user permissions.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const organizations = await client.organizations.list();
31
+ * ```
32
+ */
33
+ list(options?: RequestOptions): APIPromise<OrganizationListResponse> {
34
+ return this._client.get('/v2/organizations', options);
35
+ }
36
+
37
+ /**
38
+ * Retrieves all sender profiles within an organization that the authenticated user
39
+ * has access to. Returns filtered list based on user's permissions.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const response =
44
+ * await client.organizations.retrieveProfiles(
45
+ * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
46
+ * );
47
+ * ```
48
+ */
49
+ retrieveProfiles(
50
+ orgID: string,
51
+ options?: RequestOptions,
52
+ ): APIPromise<OrganizationRetrieveProfilesResponse> {
53
+ return this._client.get(path`/v2/organizations/${orgID}/profiles`, options);
54
+ }
55
+ }
56
+
57
+ export interface ProfileSummary {
58
+ id?: string;
59
+
60
+ createdAt?: string;
61
+
62
+ description?: string | null;
63
+
64
+ icon?: string | null;
65
+
66
+ name?: string;
67
+
68
+ shortName?: string | null;
69
+ }
70
+
71
+ export interface OrganizationListResponse {
72
+ organizations?: Array<OrganizationListResponse.Organization>;
73
+ }
74
+
75
+ export namespace OrganizationListResponse {
76
+ export interface Organization {
77
+ id?: string;
78
+
79
+ createdAt?: string;
80
+
81
+ description?: string | null;
82
+
83
+ icon?: string | null;
84
+
85
+ name?: string;
86
+
87
+ profiles?: Array<OrganizationsAPI.ProfileSummary>;
88
+ }
89
+ }
90
+
91
+ export interface OrganizationRetrieveProfilesResponse {
92
+ organizationId?: string;
93
+
94
+ profiles?: Array<ProfileSummary>;
95
+ }
96
+
97
+ Organizations.Users = Users;
98
+
99
+ export declare namespace Organizations {
100
+ export {
101
+ type ProfileSummary as ProfileSummary,
102
+ type OrganizationListResponse as OrganizationListResponse,
103
+ type OrganizationRetrieveProfilesResponse as OrganizationRetrieveProfilesResponse,
104
+ };
105
+
106
+ export {
107
+ Users as Users,
108
+ type CustomerUser as CustomerUser,
109
+ type UserListResponse as UserListResponse,
110
+ type UserRetrieveParams as UserRetrieveParams,
111
+ type UserListParams as UserListParams,
112
+ type UserDeleteParams as UserDeleteParams,
113
+ type UserInviteParams as UserInviteParams,
114
+ type UserUpdateRoleParams as UserUpdateRoleParams,
115
+ };
116
+ }