@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,15 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Templates = exports.Organizations = exports.NumberLookup = exports.Messages = exports.Contacts = void 0;
5
+ var contacts_1 = require("./contacts.js");
6
+ Object.defineProperty(exports, "Contacts", { enumerable: true, get: function () { return contacts_1.Contacts; } });
7
+ var messages_1 = require("./messages.js");
8
+ Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
9
+ var number_lookup_1 = require("./number-lookup.js");
10
+ Object.defineProperty(exports, "NumberLookup", { enumerable: true, get: function () { return number_lookup_1.NumberLookup; } });
11
+ var organizations_1 = require("./organizations/organizations.js");
12
+ Object.defineProperty(exports, "Organizations", { enumerable: true, get: function () { return organizations_1.Organizations; } });
13
+ var templates_1 = require("./templates.js");
14
+ Object.defineProperty(exports, "Templates", { enumerable: true, get: function () { return templates_1.Templates; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAOoB;AANlB,oGAAA,QAAQ,OAAA;AAOV,0CAMoB;AALlB,oGAAA,QAAQ,OAAA;AAMV,oDAIyB;AAHvB,6GAAA,YAAY,OAAA;AAId,kEAKuC;AAJrC,8GAAA,aAAa,OAAA;AAKf,4CASqB;AARnB,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export { Contacts, } from "./contacts.mjs";
3
+ export { Messages, } from "./messages.mjs";
4
+ export { NumberLookup, } from "./number-lookup.mjs";
5
+ export { Organizations, } from "./organizations/organizations.mjs";
6
+ export { Templates, } from "./templates.mjs";
7
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAMT;OACM,EACL,QAAQ,GAKT;OACM,EACL,YAAY,GAGb;OACM,EACL,aAAa,GAId;OACM,EACL,SAAS,GAQV"}
@@ -0,0 +1,222 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class Messages extends APIResource {
5
+ /**
6
+ * Retrieves comprehensive details about a specific message using the message ID.
7
+ * Returns complete message data including delivery status, channel information,
8
+ * template details, contact information, and pricing. The customer ID is extracted
9
+ * from the authentication token to ensure the message belongs to the authenticated
10
+ * customer.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const message = await client.messages.retrieve(
15
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
16
+ * );
17
+ * ```
18
+ */
19
+ retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse>;
20
+ /**
21
+ * Sends a message to a phone number using the default template. This endpoint is
22
+ * rate limited to 5 messages per customer per day. The customer ID is extracted
23
+ * from the authentication token.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * await client.messages.sendQuickMessage({
28
+ * customMessage: 'Hello, this is a test message!',
29
+ * phoneNumber: '+1234567890',
30
+ * });
31
+ * ```
32
+ */
33
+ sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void>;
34
+ /**
35
+ * Sends a message to a specific contact using a template. The message can be sent
36
+ * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
37
+ * a webhook URL to receive delivery status updates. The customer ID is extracted
38
+ * from the authentication token.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * await client.messages.sendToContact({
43
+ * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
44
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
45
+ * });
46
+ * ```
47
+ */
48
+ sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void>;
49
+ /**
50
+ * Sends a message to a phone number using a template. The phone number doesn't
51
+ * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
52
+ * Optionally specify a webhook URL to receive delivery status updates. The
53
+ * customer ID is extracted from the authentication token.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * await client.messages.sendToPhone({
58
+ * phoneNumber: '+1234567890',
59
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
60
+ * });
61
+ * ```
62
+ */
63
+ sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void>;
64
+ }
65
+ /**
66
+ * Represents a sent message with comprehensive delivery and template information
67
+ * (v2)
68
+ */
69
+ export interface MessageRetrieveResponse {
70
+ /**
71
+ * The unique identifier of the message
72
+ */
73
+ id?: string;
74
+ /**
75
+ * The messaging channel used (e.g., SMS, WhatsApp)
76
+ */
77
+ channel?: string;
78
+ /**
79
+ * The unique identifier of the contact who received the message
80
+ */
81
+ contactId?: string;
82
+ /**
83
+ * The final price charged for sending this message
84
+ */
85
+ correctedPrice?: number | null;
86
+ /**
87
+ * The date and time when the message was created
88
+ */
89
+ createdAt?: string;
90
+ /**
91
+ * The unique identifier of the customer who sent the message
92
+ */
93
+ customerId?: string;
94
+ /**
95
+ * A chronological list of status change events for this message. Each event
96
+ * includes a status and timestamp, following industry standards (Twilio, SendGrid,
97
+ * Mailgun). Events are ordered chronologically from oldest to newest.
98
+ */
99
+ events?: Array<MessageRetrieveResponse.Event> | null;
100
+ /**
101
+ * The message body content with variables substituted
102
+ */
103
+ messageBody?: MessageRetrieveResponse.MessageBody | null;
104
+ /**
105
+ * The phone number of the recipient (E.164 format)
106
+ */
107
+ phoneNumber?: string;
108
+ /**
109
+ * The phone number in international format
110
+ */
111
+ phoneNumberInternational?: string;
112
+ /**
113
+ * The region code of the phone number (e.g., US, GB, DE)
114
+ */
115
+ regionCode?: string;
116
+ /**
117
+ * The delivery status of the message (e.g., sent, delivered, failed, read)
118
+ */
119
+ status?: string;
120
+ /**
121
+ * The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
122
+ */
123
+ templateCategory?: string;
124
+ /**
125
+ * The unique identifier of the template used for this message (null if no template
126
+ * was used)
127
+ */
128
+ templateId?: string | null;
129
+ /**
130
+ * The display name of the template
131
+ */
132
+ templateName?: string;
133
+ }
134
+ export declare namespace MessageRetrieveResponse {
135
+ /**
136
+ * Represents a status change event in a message's lifecycle Follows industry
137
+ * standards (Twilio, SendGrid, Mailgun pattern)
138
+ */
139
+ interface Event {
140
+ /**
141
+ * Optional human-readable description of the event Useful for error messages or
142
+ * additional context
143
+ */
144
+ description?: string | null;
145
+ /**
146
+ * The status of the message at this point in time Examples: "queued", "sent",
147
+ * "delivered", "read", "failed"
148
+ */
149
+ status?: string;
150
+ /**
151
+ * When this status change occurred (ISO 8601 format)
152
+ */
153
+ timestamp?: string;
154
+ }
155
+ /**
156
+ * The message body content with variables substituted
157
+ */
158
+ interface MessageBody {
159
+ buttons?: Array<MessageBody.Button> | null;
160
+ content?: string;
161
+ footer?: string | null;
162
+ header?: string | null;
163
+ }
164
+ namespace MessageBody {
165
+ interface Button {
166
+ type?: string;
167
+ value?: string;
168
+ }
169
+ }
170
+ }
171
+ export interface MessageSendQuickMessageParams {
172
+ /**
173
+ * The custom message content to include in the template
174
+ */
175
+ customMessage: string;
176
+ /**
177
+ * The phone number to send the message to, in international format (e.g.,
178
+ * +1234567890)
179
+ */
180
+ phoneNumber: string;
181
+ }
182
+ export interface MessageSendToContactParams {
183
+ /**
184
+ * The unique identifier of the contact to send the message to
185
+ */
186
+ contactId: string;
187
+ /**
188
+ * The unique identifier of the template to use for the message
189
+ */
190
+ templateId: string;
191
+ /**
192
+ * Optional key-value pairs of template variables to replace in the template body.
193
+ * For example, if your template contains "Hello {{name}}", you would provide {
194
+ * "name": "John Doe" }
195
+ */
196
+ templateVariables?: {
197
+ [key: string]: string;
198
+ } | null;
199
+ }
200
+ export interface MessageSendToPhoneParams {
201
+ /**
202
+ * The phone number to send the message to, in international format (e.g.,
203
+ * +1234567890)
204
+ */
205
+ phoneNumber: string;
206
+ /**
207
+ * The unique identifier of the template to use for the message
208
+ */
209
+ templateId: string;
210
+ /**
211
+ * Optional key-value pairs of template variables to replace in the template body.
212
+ * For example, if your template contains "Hello {{name}}", you would provide {
213
+ * "name": "John Doe" }
214
+ */
215
+ templateVariables?: {
216
+ [key: string]: string;
217
+ } | null;
218
+ }
219
+ export declare namespace Messages {
220
+ export { type MessageRetrieveResponse as MessageRetrieveResponse, type MessageSendQuickMessageParams as MessageSendQuickMessageParams, type MessageSendToContactParams as MessageSendToContactParams, type MessageSendToPhoneParams as MessageSendToPhoneParams, };
221
+ }
222
+ //# sourceMappingURL=messages.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,222 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class Messages extends APIResource {
5
+ /**
6
+ * Retrieves comprehensive details about a specific message using the message ID.
7
+ * Returns complete message data including delivery status, channel information,
8
+ * template details, contact information, and pricing. The customer ID is extracted
9
+ * from the authentication token to ensure the message belongs to the authenticated
10
+ * customer.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const message = await client.messages.retrieve(
15
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
16
+ * );
17
+ * ```
18
+ */
19
+ retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse>;
20
+ /**
21
+ * Sends a message to a phone number using the default template. This endpoint is
22
+ * rate limited to 5 messages per customer per day. The customer ID is extracted
23
+ * from the authentication token.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * await client.messages.sendQuickMessage({
28
+ * customMessage: 'Hello, this is a test message!',
29
+ * phoneNumber: '+1234567890',
30
+ * });
31
+ * ```
32
+ */
33
+ sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void>;
34
+ /**
35
+ * Sends a message to a specific contact using a template. The message can be sent
36
+ * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
37
+ * a webhook URL to receive delivery status updates. The customer ID is extracted
38
+ * from the authentication token.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * await client.messages.sendToContact({
43
+ * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
44
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
45
+ * });
46
+ * ```
47
+ */
48
+ sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void>;
49
+ /**
50
+ * Sends a message to a phone number using a template. The phone number doesn't
51
+ * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
52
+ * Optionally specify a webhook URL to receive delivery status updates. The
53
+ * customer ID is extracted from the authentication token.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * await client.messages.sendToPhone({
58
+ * phoneNumber: '+1234567890',
59
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
60
+ * });
61
+ * ```
62
+ */
63
+ sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void>;
64
+ }
65
+ /**
66
+ * Represents a sent message with comprehensive delivery and template information
67
+ * (v2)
68
+ */
69
+ export interface MessageRetrieveResponse {
70
+ /**
71
+ * The unique identifier of the message
72
+ */
73
+ id?: string;
74
+ /**
75
+ * The messaging channel used (e.g., SMS, WhatsApp)
76
+ */
77
+ channel?: string;
78
+ /**
79
+ * The unique identifier of the contact who received the message
80
+ */
81
+ contactId?: string;
82
+ /**
83
+ * The final price charged for sending this message
84
+ */
85
+ correctedPrice?: number | null;
86
+ /**
87
+ * The date and time when the message was created
88
+ */
89
+ createdAt?: string;
90
+ /**
91
+ * The unique identifier of the customer who sent the message
92
+ */
93
+ customerId?: string;
94
+ /**
95
+ * A chronological list of status change events for this message. Each event
96
+ * includes a status and timestamp, following industry standards (Twilio, SendGrid,
97
+ * Mailgun). Events are ordered chronologically from oldest to newest.
98
+ */
99
+ events?: Array<MessageRetrieveResponse.Event> | null;
100
+ /**
101
+ * The message body content with variables substituted
102
+ */
103
+ messageBody?: MessageRetrieveResponse.MessageBody | null;
104
+ /**
105
+ * The phone number of the recipient (E.164 format)
106
+ */
107
+ phoneNumber?: string;
108
+ /**
109
+ * The phone number in international format
110
+ */
111
+ phoneNumberInternational?: string;
112
+ /**
113
+ * The region code of the phone number (e.g., US, GB, DE)
114
+ */
115
+ regionCode?: string;
116
+ /**
117
+ * The delivery status of the message (e.g., sent, delivered, failed, read)
118
+ */
119
+ status?: string;
120
+ /**
121
+ * The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
122
+ */
123
+ templateCategory?: string;
124
+ /**
125
+ * The unique identifier of the template used for this message (null if no template
126
+ * was used)
127
+ */
128
+ templateId?: string | null;
129
+ /**
130
+ * The display name of the template
131
+ */
132
+ templateName?: string;
133
+ }
134
+ export declare namespace MessageRetrieveResponse {
135
+ /**
136
+ * Represents a status change event in a message's lifecycle Follows industry
137
+ * standards (Twilio, SendGrid, Mailgun pattern)
138
+ */
139
+ interface Event {
140
+ /**
141
+ * Optional human-readable description of the event Useful for error messages or
142
+ * additional context
143
+ */
144
+ description?: string | null;
145
+ /**
146
+ * The status of the message at this point in time Examples: "queued", "sent",
147
+ * "delivered", "read", "failed"
148
+ */
149
+ status?: string;
150
+ /**
151
+ * When this status change occurred (ISO 8601 format)
152
+ */
153
+ timestamp?: string;
154
+ }
155
+ /**
156
+ * The message body content with variables substituted
157
+ */
158
+ interface MessageBody {
159
+ buttons?: Array<MessageBody.Button> | null;
160
+ content?: string;
161
+ footer?: string | null;
162
+ header?: string | null;
163
+ }
164
+ namespace MessageBody {
165
+ interface Button {
166
+ type?: string;
167
+ value?: string;
168
+ }
169
+ }
170
+ }
171
+ export interface MessageSendQuickMessageParams {
172
+ /**
173
+ * The custom message content to include in the template
174
+ */
175
+ customMessage: string;
176
+ /**
177
+ * The phone number to send the message to, in international format (e.g.,
178
+ * +1234567890)
179
+ */
180
+ phoneNumber: string;
181
+ }
182
+ export interface MessageSendToContactParams {
183
+ /**
184
+ * The unique identifier of the contact to send the message to
185
+ */
186
+ contactId: string;
187
+ /**
188
+ * The unique identifier of the template to use for the message
189
+ */
190
+ templateId: string;
191
+ /**
192
+ * Optional key-value pairs of template variables to replace in the template body.
193
+ * For example, if your template contains "Hello {{name}}", you would provide {
194
+ * "name": "John Doe" }
195
+ */
196
+ templateVariables?: {
197
+ [key: string]: string;
198
+ } | null;
199
+ }
200
+ export interface MessageSendToPhoneParams {
201
+ /**
202
+ * The phone number to send the message to, in international format (e.g.,
203
+ * +1234567890)
204
+ */
205
+ phoneNumber: string;
206
+ /**
207
+ * The unique identifier of the template to use for the message
208
+ */
209
+ templateId: string;
210
+ /**
211
+ * Optional key-value pairs of template variables to replace in the template body.
212
+ * For example, if your template contains "Hello {{name}}", you would provide {
213
+ * "name": "John Doe" }
214
+ */
215
+ templateVariables?: {
216
+ [key: string]: string;
217
+ } | null;
218
+ }
219
+ export declare namespace Messages {
220
+ export { type MessageRetrieveResponse as MessageRetrieveResponse, type MessageSendQuickMessageParams as MessageSendQuickMessageParams, type MessageSendToContactParams as MessageSendToContactParams, type MessageSendToPhoneParams as MessageSendToPhoneParams, };
221
+ }
222
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Messages = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const headers_1 = require("../internal/headers.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ class Messages extends resource_1.APIResource {
9
+ /**
10
+ * Retrieves comprehensive details about a specific message using the message ID.
11
+ * Returns complete message data including delivery status, channel information,
12
+ * template details, contact information, and pricing. The customer ID is extracted
13
+ * from the authentication token to ensure the message belongs to the authenticated
14
+ * customer.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const message = await client.messages.retrieve(
19
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
20
+ * );
21
+ * ```
22
+ */
23
+ retrieve(id, options) {
24
+ return this._client.get((0, path_1.path) `/v2/messages/${id}`, options);
25
+ }
26
+ /**
27
+ * Sends a message to a phone number using the default template. This endpoint is
28
+ * rate limited to 5 messages per customer per day. The customer ID is extracted
29
+ * from the authentication token.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * await client.messages.sendQuickMessage({
34
+ * customMessage: 'Hello, this is a test message!',
35
+ * phoneNumber: '+1234567890',
36
+ * });
37
+ * ```
38
+ */
39
+ sendQuickMessage(body, options) {
40
+ return this._client.post('/v2/messages/quick-message', {
41
+ body,
42
+ ...options,
43
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
44
+ });
45
+ }
46
+ /**
47
+ * Sends a message to a specific contact using a template. The message can be sent
48
+ * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
49
+ * a webhook URL to receive delivery status updates. The customer ID is extracted
50
+ * from the authentication token.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * await client.messages.sendToContact({
55
+ * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
56
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
57
+ * });
58
+ * ```
59
+ */
60
+ sendToContact(body, options) {
61
+ return this._client.post('/v2/messages/contact', {
62
+ body,
63
+ ...options,
64
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
65
+ });
66
+ }
67
+ /**
68
+ * Sends a message to a phone number using a template. The phone number doesn't
69
+ * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
70
+ * Optionally specify a webhook URL to receive delivery status updates. The
71
+ * customer ID is extracted from the authentication token.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * await client.messages.sendToPhone({
76
+ * phoneNumber: '+1234567890',
77
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
78
+ * });
79
+ * ```
80
+ */
81
+ sendToPhone(body, options) {
82
+ return this._client.post('/v2/messages/phone', {
83
+ body,
84
+ ...options,
85
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
86
+ });
87
+ }
88
+ }
89
+ exports.Messages = Messages;
90
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,IAAmC,EAAE,OAAwB;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,IAAgC,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,IAA8B,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAnFD,4BAmFC"}
@@ -0,0 +1,86 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ export class Messages extends APIResource {
6
+ /**
7
+ * Retrieves comprehensive details about a specific message using the message ID.
8
+ * Returns complete message data including delivery status, channel information,
9
+ * template details, contact information, and pricing. The customer ID is extracted
10
+ * from the authentication token to ensure the message belongs to the authenticated
11
+ * customer.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const message = await client.messages.retrieve(
16
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
17
+ * );
18
+ * ```
19
+ */
20
+ retrieve(id, options) {
21
+ return this._client.get(path `/v2/messages/${id}`, options);
22
+ }
23
+ /**
24
+ * Sends a message to a phone number using the default template. This endpoint is
25
+ * rate limited to 5 messages per customer per day. The customer ID is extracted
26
+ * from the authentication token.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * await client.messages.sendQuickMessage({
31
+ * customMessage: 'Hello, this is a test message!',
32
+ * phoneNumber: '+1234567890',
33
+ * });
34
+ * ```
35
+ */
36
+ sendQuickMessage(body, options) {
37
+ return this._client.post('/v2/messages/quick-message', {
38
+ body,
39
+ ...options,
40
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
41
+ });
42
+ }
43
+ /**
44
+ * Sends a message to a specific contact using a template. The message can be sent
45
+ * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
46
+ * a webhook URL to receive delivery status updates. The customer ID is extracted
47
+ * from the authentication token.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * await client.messages.sendToContact({
52
+ * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
53
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
54
+ * });
55
+ * ```
56
+ */
57
+ sendToContact(body, options) {
58
+ return this._client.post('/v2/messages/contact', {
59
+ body,
60
+ ...options,
61
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
62
+ });
63
+ }
64
+ /**
65
+ * Sends a message to a phone number using a template. The phone number doesn't
66
+ * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
67
+ * Optionally specify a webhook URL to receive delivery status updates. The
68
+ * customer ID is extracted from the authentication token.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * await client.messages.sendToPhone({
73
+ * phoneNumber: '+1234567890',
74
+ * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
75
+ * });
76
+ * ```
77
+ */
78
+ sendToPhone(body, options) {
79
+ return this._client.post('/v2/messages/phone', {
80
+ body,
81
+ ...options,
82
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
83
+ });
84
+ }
85
+ }
86
+ //# sourceMappingURL=messages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,IAAmC,EAAE,OAAwB;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,IAAgC,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,IAA8B,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}