sendblue 3.10.1 → 3.12.0

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 (263) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +7 -7
  3. package/client.d.mts +46 -7
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +46 -7
  6. package/client.d.ts.map +1 -1
  7. package/client.js +54 -6
  8. package/client.js.map +1 -1
  9. package/client.mjs +54 -6
  10. package/client.mjs.map +1 -1
  11. package/core/streaming.d.mts +33 -0
  12. package/core/streaming.d.mts.map +1 -0
  13. package/core/streaming.d.ts +33 -0
  14. package/core/streaming.d.ts.map +1 -0
  15. package/core/streaming.js +263 -0
  16. package/core/streaming.js.map +1 -0
  17. package/core/streaming.mjs +258 -0
  18. package/core/streaming.mjs.map +1 -0
  19. package/internal/decoders/line.d.mts +17 -0
  20. package/internal/decoders/line.d.mts.map +1 -0
  21. package/internal/decoders/line.d.ts +17 -0
  22. package/internal/decoders/line.d.ts.map +1 -0
  23. package/internal/decoders/line.js +113 -0
  24. package/internal/decoders/line.js.map +1 -0
  25. package/internal/decoders/line.mjs +108 -0
  26. package/internal/decoders/line.mjs.map +1 -0
  27. package/internal/parse.d.mts.map +1 -1
  28. package/internal/parse.d.ts.map +1 -1
  29. package/internal/parse.js +10 -0
  30. package/internal/parse.js.map +1 -1
  31. package/internal/parse.mjs +10 -0
  32. package/internal/parse.mjs.map +1 -1
  33. package/internal/request-options.d.mts +2 -0
  34. package/internal/request-options.d.mts.map +1 -1
  35. package/internal/request-options.d.ts +2 -0
  36. package/internal/request-options.d.ts.map +1 -1
  37. package/internal/request-options.js.map +1 -1
  38. package/internal/request-options.mjs.map +1 -1
  39. package/internal/tslib.js +17 -17
  40. package/package.json +11 -1
  41. package/resources/auth/auth.d.mts +10 -0
  42. package/resources/auth/auth.d.mts.map +1 -0
  43. package/resources/auth/auth.d.ts +10 -0
  44. package/resources/auth/auth.d.ts.map +1 -0
  45. package/resources/auth/auth.js +17 -0
  46. package/resources/auth/auth.js.map +1 -0
  47. package/resources/auth/auth.mjs +12 -0
  48. package/resources/auth/auth.mjs.map +1 -0
  49. package/resources/auth/index.d.mts +3 -0
  50. package/resources/auth/index.d.mts.map +1 -0
  51. package/resources/auth/index.d.ts +3 -0
  52. package/resources/auth/index.d.ts.map +1 -0
  53. package/resources/auth/index.js +9 -0
  54. package/resources/auth/index.js.map +1 -0
  55. package/resources/auth/index.mjs +4 -0
  56. package/resources/auth/index.mjs.map +1 -0
  57. package/resources/auth/tokens.d.mts +77 -0
  58. package/resources/auth/tokens.d.mts.map +1 -0
  59. package/resources/auth/tokens.d.ts +77 -0
  60. package/resources/auth/tokens.d.ts.map +1 -0
  61. package/resources/auth/tokens.js +51 -0
  62. package/resources/auth/tokens.js.map +1 -0
  63. package/resources/auth/tokens.mjs +47 -0
  64. package/resources/auth/tokens.mjs.map +1 -0
  65. package/resources/auth.d.mts +2 -0
  66. package/resources/auth.d.mts.map +1 -0
  67. package/resources/auth.d.ts +2 -0
  68. package/resources/auth.d.ts.map +1 -0
  69. package/resources/auth.js +6 -0
  70. package/resources/auth.js.map +1 -0
  71. package/resources/auth.mjs +3 -0
  72. package/resources/auth.mjs.map +1 -0
  73. package/resources/contacts/contacts.d.mts +8 -0
  74. package/resources/contacts/contacts.d.mts.map +1 -1
  75. package/resources/contacts/contacts.d.ts +8 -0
  76. package/resources/contacts/contacts.d.ts.map +1 -1
  77. package/resources/contacts/contacts.js.map +1 -1
  78. package/resources/contacts/contacts.mjs.map +1 -1
  79. package/resources/events.d.mts +45 -0
  80. package/resources/events.d.mts.map +1 -0
  81. package/resources/events.d.ts +45 -0
  82. package/resources/events.d.ts.map +1 -0
  83. package/resources/events.js +37 -0
  84. package/resources/events.js.map +1 -0
  85. package/resources/events.mjs +33 -0
  86. package/resources/events.mjs.map +1 -0
  87. package/resources/groups.d.mts +25 -0
  88. package/resources/groups.d.mts.map +1 -1
  89. package/resources/groups.d.ts +25 -0
  90. package/resources/groups.d.ts.map +1 -1
  91. package/resources/index.d.mts +8 -2
  92. package/resources/index.d.mts.map +1 -1
  93. package/resources/index.d.ts +8 -2
  94. package/resources/index.d.ts.map +1 -1
  95. package/resources/index.js +13 -1
  96. package/resources/index.js.map +1 -1
  97. package/resources/index.mjs +6 -0
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/lines/call-forwarding.d.mts +3 -0
  100. package/resources/lines/call-forwarding.d.mts.map +1 -1
  101. package/resources/lines/call-forwarding.d.ts +3 -0
  102. package/resources/lines/call-forwarding.d.ts.map +1 -1
  103. package/resources/lines/call-forwarding.js +3 -0
  104. package/resources/lines/call-forwarding.js.map +1 -1
  105. package/resources/lines/call-forwarding.mjs +3 -0
  106. package/resources/lines/call-forwarding.mjs.map +1 -1
  107. package/resources/lines/index.d.mts +1 -1
  108. package/resources/lines/index.d.mts.map +1 -1
  109. package/resources/lines/index.d.ts +1 -1
  110. package/resources/lines/index.d.ts.map +1 -1
  111. package/resources/lines/index.js.map +1 -1
  112. package/resources/lines/index.mjs.map +1 -1
  113. package/resources/lines/lines.d.mts +30 -0
  114. package/resources/lines/lines.d.mts.map +1 -1
  115. package/resources/lines/lines.d.ts +30 -0
  116. package/resources/lines/lines.d.ts.map +1 -1
  117. package/resources/lines/lines.js +15 -0
  118. package/resources/lines/lines.js.map +1 -1
  119. package/resources/lines/lines.mjs +15 -0
  120. package/resources/lines/lines.mjs.map +1 -1
  121. package/resources/location.d.mts +156 -0
  122. package/resources/location.d.mts.map +1 -0
  123. package/resources/location.d.ts +156 -0
  124. package/resources/location.d.ts.map +1 -0
  125. package/resources/location.js +57 -0
  126. package/resources/location.js.map +1 -0
  127. package/resources/location.mjs +53 -0
  128. package/resources/location.mjs.map +1 -0
  129. package/resources/messages.d.mts +507 -9
  130. package/resources/messages.d.mts.map +1 -1
  131. package/resources/messages.d.ts +507 -9
  132. package/resources/messages.d.ts.map +1 -1
  133. package/resources/messages.js +16 -2
  134. package/resources/messages.js.map +1 -1
  135. package/resources/messages.mjs +16 -2
  136. package/resources/messages.mjs.map +1 -1
  137. package/resources/request-location.d.mts +54 -0
  138. package/resources/request-location.d.mts.map +1 -0
  139. package/resources/request-location.d.ts +54 -0
  140. package/resources/request-location.d.ts.map +1 -0
  141. package/resources/request-location.js +30 -0
  142. package/resources/request-location.js.map +1 -0
  143. package/resources/request-location.mjs +26 -0
  144. package/resources/request-location.mjs.map +1 -0
  145. package/resources/send-carousel.d.mts +67 -0
  146. package/resources/send-carousel.d.mts.map +1 -1
  147. package/resources/send-carousel.d.ts +67 -0
  148. package/resources/send-carousel.d.ts.map +1 -1
  149. package/resources/v2/groups.d.mts +82 -0
  150. package/resources/v2/groups.d.mts.map +1 -0
  151. package/resources/v2/groups.d.ts +82 -0
  152. package/resources/v2/groups.d.ts.map +1 -0
  153. package/resources/v2/groups.js +27 -0
  154. package/resources/v2/groups.js.map +1 -0
  155. package/resources/v2/groups.mjs +23 -0
  156. package/resources/v2/groups.mjs.map +1 -0
  157. package/resources/v2/index.d.mts +1 -0
  158. package/resources/v2/index.d.mts.map +1 -1
  159. package/resources/v2/index.d.ts +1 -0
  160. package/resources/v2/index.d.ts.map +1 -1
  161. package/resources/v2/index.js +3 -1
  162. package/resources/v2/index.js.map +1 -1
  163. package/resources/v2/index.mjs +1 -0
  164. package/resources/v2/index.mjs.map +1 -1
  165. package/resources/v2/v2.d.mts +4 -0
  166. package/resources/v2/v2.d.mts.map +1 -1
  167. package/resources/v2/v2.d.ts +4 -0
  168. package/resources/v2/v2.d.ts.map +1 -1
  169. package/resources/v2/v2.js +4 -0
  170. package/resources/v2/v2.js.map +1 -1
  171. package/resources/v2/v2.mjs +4 -0
  172. package/resources/v2/v2.mjs.map +1 -1
  173. package/resources/verified-contacts.d.mts +152 -0
  174. package/resources/verified-contacts.d.mts.map +1 -0
  175. package/resources/verified-contacts.d.ts +152 -0
  176. package/resources/verified-contacts.d.ts.map +1 -0
  177. package/resources/verified-contacts.js +56 -0
  178. package/resources/verified-contacts.js.map +1 -0
  179. package/resources/verified-contacts.mjs +52 -0
  180. package/resources/verified-contacts.mjs.map +1 -0
  181. package/resources/verify/index.d.mts +3 -0
  182. package/resources/verify/index.d.mts.map +1 -0
  183. package/resources/verify/index.d.ts +3 -0
  184. package/resources/verify/index.d.ts.map +1 -0
  185. package/resources/verify/index.js +9 -0
  186. package/resources/verify/index.js.map +1 -0
  187. package/resources/verify/index.mjs +4 -0
  188. package/resources/verify/index.mjs.map +1 -0
  189. package/resources/verify/verifications.d.mts +45 -0
  190. package/resources/verify/verifications.d.mts.map +1 -0
  191. package/resources/verify/verifications.d.ts +45 -0
  192. package/resources/verify/verifications.d.ts.map +1 -0
  193. package/resources/verify/verifications.js +19 -0
  194. package/resources/verify/verifications.js.map +1 -0
  195. package/resources/verify/verifications.mjs +15 -0
  196. package/resources/verify/verifications.mjs.map +1 -0
  197. package/resources/verify/verify.d.mts +10 -0
  198. package/resources/verify/verify.d.mts.map +1 -0
  199. package/resources/verify/verify.d.ts +10 -0
  200. package/resources/verify/verify.d.ts.map +1 -0
  201. package/resources/verify/verify.js +17 -0
  202. package/resources/verify/verify.js.map +1 -0
  203. package/resources/verify/verify.mjs +12 -0
  204. package/resources/verify/verify.mjs.map +1 -0
  205. package/resources/verify.d.mts +2 -0
  206. package/resources/verify.d.mts.map +1 -0
  207. package/resources/verify.d.ts +2 -0
  208. package/resources/verify.d.ts.map +1 -0
  209. package/resources/verify.js +6 -0
  210. package/resources/verify.js.map +1 -0
  211. package/resources/verify.mjs +3 -0
  212. package/resources/verify.mjs.map +1 -0
  213. package/resources/webhooks.d.mts +26 -10
  214. package/resources/webhooks.d.mts.map +1 -1
  215. package/resources/webhooks.d.ts +26 -10
  216. package/resources/webhooks.d.ts.map +1 -1
  217. package/resources/webhooks.js +13 -2
  218. package/resources/webhooks.js.map +1 -1
  219. package/resources/webhooks.mjs +13 -2
  220. package/resources/webhooks.mjs.map +1 -1
  221. package/src/client.ts +116 -15
  222. package/src/core/streaming.ts +319 -0
  223. package/src/internal/decoders/line.ts +135 -0
  224. package/src/internal/parse.ts +14 -0
  225. package/src/internal/request-options.ts +2 -0
  226. package/src/resources/auth/auth.ts +19 -0
  227. package/src/resources/auth/index.ts +4 -0
  228. package/src/resources/auth/tokens.ts +101 -0
  229. package/src/resources/auth.ts +3 -0
  230. package/src/resources/contacts/contacts.ts +10 -0
  231. package/src/resources/events.ts +75 -0
  232. package/src/resources/groups.ts +28 -0
  233. package/src/resources/index.ts +26 -1
  234. package/src/resources/lines/call-forwarding.ts +3 -0
  235. package/src/resources/lines/index.ts +1 -1
  236. package/src/resources/lines/lines.ts +44 -0
  237. package/src/resources/location.ts +237 -0
  238. package/src/resources/messages.ts +634 -9
  239. package/src/resources/request-location.ts +72 -0
  240. package/src/resources/send-carousel.ts +76 -0
  241. package/src/resources/v2/groups.ts +106 -0
  242. package/src/resources/v2/index.ts +1 -0
  243. package/src/resources/v2/v2.ts +6 -0
  244. package/src/resources/verified-contacts.ts +204 -0
  245. package/src/resources/verify/index.ts +9 -0
  246. package/src/resources/verify/verifications.ts +75 -0
  247. package/src/resources/verify/verify.ts +25 -0
  248. package/src/resources/verify.ts +3 -0
  249. package/src/resources/webhooks.ts +27 -10
  250. package/src/streaming.ts +2 -0
  251. package/src/version.ts +1 -1
  252. package/streaming.d.mts +3 -0
  253. package/streaming.d.mts.map +1 -0
  254. package/streaming.d.ts +3 -0
  255. package/streaming.d.ts.map +1 -0
  256. package/streaming.js +6 -0
  257. package/streaming.js.map +1 -0
  258. package/streaming.mjs +3 -0
  259. package/streaming.mjs.map +1 -0
  260. package/version.d.mts +1 -1
  261. package/version.d.ts +1 -1
  262. package/version.js +1 -1
  263. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,WAAW,sBAAmB;AAC1C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,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAE3D;;WAEG;QACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;KACrE;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EACD,SAAS,GACT,cAAc,GACd,eAAe,GACf,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,iBAAiB,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
@@ -9,6 +9,11 @@ const resource_1 = require("../core/resource.js");
9
9
  class Webhooks extends resource_1.APIResource {
10
10
  /**
11
11
  * Add new webhooks to the account. Webhooks are appended to existing ones.
12
+ *
13
+ * With a line-scoped temporary bearer token, only receive webhooks can be added.
14
+ * String webhook URLs are automatically scoped to the token's phone numbers;
15
+ * webhook objects must use `sendblue_numbers` within the token's allowed phone
16
+ * numbers.
12
17
  */
13
18
  create(body, options) {
14
19
  return this._client.post('/api/account/webhooks', { body, ...options });
@@ -20,13 +25,19 @@ class Webhooks extends resource_1.APIResource {
20
25
  return this._client.put('/api/account/webhooks', { body, ...options });
21
26
  }
22
27
  /**
23
- * Get all webhooks configured for the authenticated account
28
+ * Get webhooks configured for the authenticated account.
29
+ *
30
+ * With a line-scoped temporary bearer token, this returns receive webhooks for the
31
+ * token's phone numbers.
24
32
  */
25
33
  list(options) {
26
34
  return this._client.get('/api/account/webhooks', options);
27
35
  }
28
36
  /**
29
- * Delete specific webhooks from the account
37
+ * Delete specific webhooks from the account.
38
+ *
39
+ * With a line-scoped temporary bearer token, this can only remove receive webhooks
40
+ * for the token's phone numbers.
30
41
  */
31
42
  delete(body, options) {
32
43
  return this._client.delete('/api/account/webhooks', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AA5BD,4BA4BC"}
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAvCD,4BAuCC"}
@@ -6,6 +6,11 @@ import { APIResource } from "../core/resource.mjs";
6
6
  export class Webhooks extends APIResource {
7
7
  /**
8
8
  * Add new webhooks to the account. Webhooks are appended to existing ones.
9
+ *
10
+ * With a line-scoped temporary bearer token, only receive webhooks can be added.
11
+ * String webhook URLs are automatically scoped to the token's phone numbers;
12
+ * webhook objects must use `sendblue_numbers` within the token's allowed phone
13
+ * numbers.
9
14
  */
10
15
  create(body, options) {
11
16
  return this._client.post('/api/account/webhooks', { body, ...options });
@@ -17,13 +22,19 @@ export class Webhooks extends APIResource {
17
22
  return this._client.put('/api/account/webhooks', { body, ...options });
18
23
  }
19
24
  /**
20
- * Get all webhooks configured for the authenticated account
25
+ * Get webhooks configured for the authenticated account.
26
+ *
27
+ * With a line-scoped temporary bearer token, this returns receive webhooks for the
28
+ * token's phone numbers.
21
29
  */
22
30
  list(options) {
23
31
  return this._client.get('/api/account/webhooks', options);
24
32
  }
25
33
  /**
26
- * Delete specific webhooks from the account
34
+ * Delete specific webhooks from the account.
35
+ *
36
+ * With a line-scoped temporary bearer token, this can only remove receive webhooks
37
+ * for the token's phone numbers.
27
38
  */
28
39
  delete(body, options) {
29
40
  return this._client.delete('/api/account/webhooks', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAK/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF"}
1
+ {"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAK/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -17,7 +17,17 @@ import * as Errors from './core/error';
17
17
  import * as Uploads from './core/uploads';
18
18
  import * as API from './resources/index';
19
19
  import { APIPromise } from './core/api-promise';
20
+ import { AccountEvent, EventStreamParams, Events } from './resources/events';
20
21
  import { GroupModifyParams, GroupModifyResponse, GroupSendMessageParams, Groups } from './resources/groups';
22
+ import {
23
+ Location,
24
+ LocationListParams,
25
+ LocationListResponse,
26
+ LocationRetrieveParams,
27
+ LocationRetrieveResponse,
28
+ LocationWatchParams,
29
+ LocationWatchResponse,
30
+ } from './resources/location';
21
31
  import { LookupLookupNumberParams, LookupLookupNumberResponse, Lookups } from './resources/lookups';
22
32
  import { MediaObjectUploadParams, MediaObjectUploadResponse, MediaObjects } from './resources/media-objects';
23
33
  import {
@@ -28,14 +38,27 @@ import {
28
38
  MessageResponse,
29
39
  MessageRetrieveResponse,
30
40
  MessageSendParams,
41
+ MessageUpdateAppCardParams,
31
42
  Messages,
32
43
  } from './resources/messages';
44
+ import {
45
+ RequestLocation,
46
+ RequestLocationCreateParams,
47
+ RequestLocationCreateResponse,
48
+ } from './resources/request-location';
33
49
  import { SendCarousel, SendCarouselSendParams, SendCarouselSendResponse } from './resources/send-carousel';
34
50
  import {
35
51
  TypingIndicatorSendParams,
36
52
  TypingIndicatorSendResponse,
37
53
  TypingIndicators,
38
54
  } from './resources/typing-indicators';
55
+ import {
56
+ VerifiedContactCreateParams,
57
+ VerifiedContactCreateResponse,
58
+ VerifiedContactListResponse,
59
+ VerifiedContactRetrieveResponse,
60
+ VerifiedContacts,
61
+ } from './resources/verified-contacts';
39
62
  import {
40
63
  WebhookConfiguration,
41
64
  WebhookCreateParams,
@@ -47,6 +70,7 @@ import {
47
70
  WebhookUpdateResponse,
48
71
  Webhooks,
49
72
  } from './resources/webhooks';
73
+ import { Auth } from './resources/auth/auth';
50
74
  import {
51
75
  Contact,
52
76
  ContactCountResponse,
@@ -64,8 +88,9 @@ import {
64
88
  ContactVerifyResponse,
65
89
  Contacts,
66
90
  } from './resources/contacts/contacts';
67
- import { Lines } from './resources/lines/lines';
91
+ import { LineGetStateResponse, LineState, Lines } from './resources/lines/lines';
68
92
  import { V2 } from './resources/v2/v2';
93
+ import { Verify } from './resources/verify/verify';
69
94
  import { type Fetch } from './internal/builtin-types';
70
95
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
71
96
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -90,6 +115,12 @@ export interface ClientOptions {
90
115
  */
91
116
  apiSecret?: string | undefined;
92
117
 
118
+ /**
119
+ * Short-lived bearer token. Use this instead of `apiKey` and `apiSecret`
120
+ * when credentials are issued by a token broker such as Vercel Connect.
121
+ */
122
+ accessToken?: string | undefined;
123
+
93
124
  /**
94
125
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
95
126
  *
@@ -163,8 +194,9 @@ export interface ClientOptions {
163
194
  * API Client for interfacing with the Sendblue API API.
164
195
  */
165
196
  export class SendblueAPI {
166
- apiKey: string;
167
- apiSecret: string;
197
+ apiKey: string | undefined;
198
+ apiSecret: string | undefined;
199
+ accessToken: string | undefined;
168
200
 
169
201
  baseURL: string;
170
202
  maxRetries: number;
@@ -191,27 +223,33 @@ export class SendblueAPI {
191
223
  * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
192
224
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
193
225
  */
194
- constructor({
195
- baseURL = readEnv('SENDBLUE_API_BASE_URL'),
196
- apiKey = readEnv('SENDBLUE_API_API_KEY'),
197
- apiSecret = readEnv('SENDBLUE_API_API_SECRET'),
198
- ...opts
199
- }: ClientOptions = {}) {
200
- if (apiKey === undefined) {
226
+ constructor(input: ClientOptions = {}) {
227
+ const { baseURL = readEnv('SENDBLUE_API_BASE_URL'), accessToken, ...opts } = input;
228
+ // An explicitly supplied bearer token takes precedence over ambient
229
+ // key-pair environment variables. Explicitly combining either auth mode is
230
+ // still rejected because it is ambiguous and can leak permanent credentials.
231
+ const apiKey = accessToken === undefined ? input.apiKey ?? readEnv('SENDBLUE_API_API_KEY') : input.apiKey;
232
+ const apiSecret =
233
+ accessToken === undefined ? input.apiSecret ?? readEnv('SENDBLUE_API_API_SECRET') : input.apiSecret;
234
+ if (accessToken !== undefined && (apiKey !== undefined || apiSecret !== undefined)) {
235
+ throw new Errors.SendblueAPIError('accessToken cannot be combined with apiKey or apiSecret.');
236
+ }
237
+ if (accessToken === undefined && apiKey === undefined) {
201
238
  throw new Errors.SendblueAPIError(
202
- "The SENDBLUE_API_API_KEY environment variable is missing or empty; either provide it, or instantiate the SendblueAPI client with an apiKey option, like new SendblueAPI({ apiKey: 'My API Key' }).",
239
+ 'The SENDBLUE_API_API_KEY environment variable is missing or empty; provide apiKey and apiSecret, or instantiate the client with an accessToken.',
203
240
  );
204
241
  }
205
- if (apiSecret === undefined) {
242
+ if (accessToken === undefined && apiSecret === undefined) {
206
243
  throw new Errors.SendblueAPIError(
207
- "The SENDBLUE_API_API_SECRET environment variable is missing or empty; either provide it, or instantiate the SendblueAPI client with an apiSecret option, like new SendblueAPI({ apiSecret: 'My API Secret' }).",
244
+ 'The SENDBLUE_API_API_SECRET environment variable is missing or empty; provide apiKey and apiSecret, or instantiate the client with an accessToken.',
208
245
  );
209
246
  }
210
247
 
211
248
  const options: ClientOptions = {
249
+ ...opts,
212
250
  apiKey,
213
251
  apiSecret,
214
- ...opts,
252
+ accessToken,
215
253
  baseURL: baseURL || `https://api.sendblue.co`,
216
254
  };
217
255
 
@@ -246,6 +284,7 @@ export class SendblueAPI {
246
284
 
247
285
  this.apiKey = apiKey;
248
286
  this.apiSecret = apiSecret;
287
+ this.accessToken = accessToken;
249
288
  }
250
289
 
251
290
  /**
@@ -263,6 +302,7 @@ export class SendblueAPI {
263
302
  fetchOptions: this.fetchOptions,
264
303
  apiKey: this.apiKey,
265
304
  apiSecret: this.apiSecret,
305
+ accessToken: this.accessToken,
266
306
  ...options,
267
307
  });
268
308
  return client;
@@ -284,6 +324,9 @@ export class SendblueAPI {
284
324
  }
285
325
 
286
326
  protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
327
+ if (this.accessToken !== undefined) {
328
+ return buildHeaders([{ Authorization: `Bearer ${this.accessToken}` }]);
329
+ }
287
330
  return buildHeaders([await this.apiKeyAuth(opts), await this.apiSecretAuth(opts)]);
288
331
  }
289
332
 
@@ -843,7 +886,28 @@ export class SendblueAPI {
843
886
  */
844
887
  sendCarousel: API.SendCarousel = new API.SendCarousel(this);
845
888
  v2: API.V2 = new API.V2(this);
889
+ /**
890
+ * Sendblue line configuration and health state
891
+ */
846
892
  lines: API.Lines = new API.Lines(this);
893
+ /**
894
+ * Operations for sending and managing messages
895
+ */
896
+ requestLocation: API.RequestLocation = new API.RequestLocation(this);
897
+ /**
898
+ * Operations for sending and managing messages
899
+ */
900
+ location: API.Location = new API.Location(this);
901
+ /**
902
+ * Operations for managing verified-contact access to shared iMessage lines
903
+ */
904
+ verifiedContacts: API.VerifiedContacts = new API.VerifiedContacts(this);
905
+ auth: API.Auth = new API.Auth(this);
906
+ /**
907
+ * Authenticated live account events and recovery contracts
908
+ */
909
+ events: API.Events = new API.Events(this);
910
+ verify: API.Verify = new API.Verify(this);
847
911
  }
848
912
 
849
913
  SendblueAPI.Messages = Messages;
@@ -856,6 +920,12 @@ SendblueAPI.Webhooks = Webhooks;
856
920
  SendblueAPI.SendCarousel = SendCarousel;
857
921
  SendblueAPI.V2 = V2;
858
922
  SendblueAPI.Lines = Lines;
923
+ SendblueAPI.RequestLocation = RequestLocation;
924
+ SendblueAPI.Location = Location;
925
+ SendblueAPI.VerifiedContacts = VerifiedContacts;
926
+ SendblueAPI.Auth = Auth;
927
+ SendblueAPI.Events = Events;
928
+ SendblueAPI.Verify = Verify;
859
929
 
860
930
  export declare namespace SendblueAPI {
861
931
  export type RequestOptions = Opts.RequestOptions;
@@ -869,6 +939,7 @@ export declare namespace SendblueAPI {
869
939
  type MessageListParams as MessageListParams,
870
940
  type MessageGetStatusParams as MessageGetStatusParams,
871
941
  type MessageSendParams as MessageSendParams,
942
+ type MessageUpdateAppCardParams as MessageUpdateAppCardParams,
872
943
  };
873
944
 
874
945
  export {
@@ -934,5 +1005,35 @@ export declare namespace SendblueAPI {
934
1005
 
935
1006
  export { V2 as V2 };
936
1007
 
937
- export { Lines as Lines };
1008
+ export { Lines as Lines, type LineState as LineState, type LineGetStateResponse as LineGetStateResponse };
1009
+
1010
+ export {
1011
+ RequestLocation as RequestLocation,
1012
+ type RequestLocationCreateResponse as RequestLocationCreateResponse,
1013
+ type RequestLocationCreateParams as RequestLocationCreateParams,
1014
+ };
1015
+
1016
+ export {
1017
+ Location as Location,
1018
+ type LocationRetrieveResponse as LocationRetrieveResponse,
1019
+ type LocationListResponse as LocationListResponse,
1020
+ type LocationWatchResponse as LocationWatchResponse,
1021
+ type LocationRetrieveParams as LocationRetrieveParams,
1022
+ type LocationListParams as LocationListParams,
1023
+ type LocationWatchParams as LocationWatchParams,
1024
+ };
1025
+
1026
+ export {
1027
+ VerifiedContacts as VerifiedContacts,
1028
+ type VerifiedContactCreateResponse as VerifiedContactCreateResponse,
1029
+ type VerifiedContactRetrieveResponse as VerifiedContactRetrieveResponse,
1030
+ type VerifiedContactListResponse as VerifiedContactListResponse,
1031
+ type VerifiedContactCreateParams as VerifiedContactCreateParams,
1032
+ };
1033
+
1034
+ export { Auth as Auth };
1035
+
1036
+ export { Events as Events, type AccountEvent as AccountEvent, type EventStreamParams as EventStreamParams };
1037
+
1038
+ export { Verify as Verify };
938
1039
  }
@@ -0,0 +1,319 @@
1
+ import { SendblueAPIError } from './error';
2
+ import { type ReadableStream } from '../internal/shim-types';
3
+ import { makeReadableStream } from '../internal/shims';
4
+ import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line';
5
+ import { ReadableStreamToAsyncIterable } from '../internal/shims';
6
+ import { isAbortError } from '../internal/errors';
7
+ import { encodeUTF8 } from '../internal/utils/bytes';
8
+ import { loggerFor } from '../internal/utils/log';
9
+ import type { SendblueAPI } from '../client';
10
+
11
+ type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
12
+
13
+ export type ServerSentEvent = {
14
+ event: string | null;
15
+ data: string;
16
+ raw: string[];
17
+ };
18
+
19
+ export class Stream<Item> implements AsyncIterable<Item> {
20
+ controller: AbortController;
21
+ #client: SendblueAPI | undefined;
22
+
23
+ constructor(
24
+ private iterator: () => AsyncIterator<Item>,
25
+ controller: AbortController,
26
+ client?: SendblueAPI,
27
+ ) {
28
+ this.controller = controller;
29
+ this.#client = client;
30
+ }
31
+
32
+ static fromSSEResponse<Item>(
33
+ response: Response,
34
+ controller: AbortController,
35
+ client?: SendblueAPI,
36
+ ): Stream<Item> {
37
+ let consumed = false;
38
+ const logger = client ? loggerFor(client) : console;
39
+
40
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
41
+ if (consumed) {
42
+ throw new SendblueAPIError(
43
+ 'Cannot iterate over a consumed stream, use `.tee()` to split the stream.',
44
+ );
45
+ }
46
+ consumed = true;
47
+ let done = false;
48
+ try {
49
+ for await (const sse of _iterSSEMessages(response, controller)) {
50
+ try {
51
+ yield JSON.parse(sse.data) as Item;
52
+ } catch (e) {
53
+ logger.error(`Could not parse message into JSON:`, sse.data);
54
+ logger.error(`From chunk:`, sse.raw);
55
+ throw e;
56
+ }
57
+ }
58
+ done = true;
59
+ } catch (e) {
60
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
61
+ if (isAbortError(e)) return;
62
+ throw e;
63
+ } finally {
64
+ // If the user `break`s, abort the ongoing request.
65
+ if (!done) controller.abort();
66
+ }
67
+ }
68
+
69
+ return new Stream(iterator, controller, client);
70
+ }
71
+
72
+ /**
73
+ * Generates a Stream from a newline-separated ReadableStream
74
+ * where each item is a JSON value.
75
+ */
76
+ static fromReadableStream<Item>(
77
+ readableStream: ReadableStream,
78
+ controller: AbortController,
79
+ client?: SendblueAPI,
80
+ ): Stream<Item> {
81
+ let consumed = false;
82
+
83
+ async function* iterLines(): AsyncGenerator<string, void, unknown> {
84
+ const lineDecoder = new LineDecoder();
85
+
86
+ const iter = ReadableStreamToAsyncIterable<Bytes>(readableStream);
87
+ for await (const chunk of iter) {
88
+ for (const line of lineDecoder.decode(chunk)) {
89
+ yield line;
90
+ }
91
+ }
92
+
93
+ for (const line of lineDecoder.flush()) {
94
+ yield line;
95
+ }
96
+ }
97
+
98
+ async function* iterator(): AsyncIterator<Item, any, undefined> {
99
+ if (consumed) {
100
+ throw new SendblueAPIError(
101
+ 'Cannot iterate over a consumed stream, use `.tee()` to split the stream.',
102
+ );
103
+ }
104
+ consumed = true;
105
+ let done = false;
106
+ try {
107
+ for await (const line of iterLines()) {
108
+ if (done) continue;
109
+ if (line) yield JSON.parse(line) as Item;
110
+ }
111
+ done = true;
112
+ } catch (e) {
113
+ // If the user calls `stream.controller.abort()`, we should exit without throwing.
114
+ if (isAbortError(e)) return;
115
+ throw e;
116
+ } finally {
117
+ // If the user `break`s, abort the ongoing request.
118
+ if (!done) controller.abort();
119
+ }
120
+ }
121
+
122
+ return new Stream(iterator, controller, client);
123
+ }
124
+
125
+ [Symbol.asyncIterator](): AsyncIterator<Item> {
126
+ return this.iterator();
127
+ }
128
+
129
+ /**
130
+ * Splits the stream into two streams which can be
131
+ * independently read from at different speeds.
132
+ */
133
+ tee(): [Stream<Item>, Stream<Item>] {
134
+ const left: Array<Promise<IteratorResult<Item>>> = [];
135
+ const right: Array<Promise<IteratorResult<Item>>> = [];
136
+ const iterator = this.iterator();
137
+
138
+ const teeIterator = (queue: Array<Promise<IteratorResult<Item>>>): AsyncIterator<Item> => {
139
+ return {
140
+ next: () => {
141
+ if (queue.length === 0) {
142
+ const result = iterator.next();
143
+ left.push(result);
144
+ right.push(result);
145
+ }
146
+ return queue.shift()!;
147
+ },
148
+ };
149
+ };
150
+
151
+ return [
152
+ new Stream(() => teeIterator(left), this.controller, this.#client),
153
+ new Stream(() => teeIterator(right), this.controller, this.#client),
154
+ ];
155
+ }
156
+
157
+ /**
158
+ * Converts this stream to a newline-separated ReadableStream of
159
+ * JSON stringified values in the stream
160
+ * which can be turned back into a Stream with `Stream.fromReadableStream()`.
161
+ */
162
+ toReadableStream(): ReadableStream {
163
+ const self = this;
164
+ let iter: AsyncIterator<Item>;
165
+
166
+ return makeReadableStream({
167
+ async start() {
168
+ iter = self[Symbol.asyncIterator]();
169
+ },
170
+ async pull(ctrl: any) {
171
+ try {
172
+ const { value, done } = await iter.next();
173
+ if (done) return ctrl.close();
174
+
175
+ const bytes = encodeUTF8(JSON.stringify(value) + '\n');
176
+
177
+ ctrl.enqueue(bytes);
178
+ } catch (err) {
179
+ ctrl.error(err);
180
+ }
181
+ },
182
+ async cancel() {
183
+ await iter.return?.();
184
+ },
185
+ });
186
+ }
187
+ }
188
+
189
+ export async function* _iterSSEMessages(
190
+ response: Response,
191
+ controller: AbortController,
192
+ ): AsyncGenerator<ServerSentEvent, void, unknown> {
193
+ if (!response.body) {
194
+ controller.abort();
195
+ if (
196
+ typeof (globalThis as any).navigator !== 'undefined' &&
197
+ (globalThis as any).navigator.product === 'ReactNative'
198
+ ) {
199
+ throw new SendblueAPIError(
200
+ `The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`,
201
+ );
202
+ }
203
+ throw new SendblueAPIError(`Attempted to iterate over a response with no body`);
204
+ }
205
+
206
+ const sseDecoder = new SSEDecoder();
207
+ const lineDecoder = new LineDecoder();
208
+
209
+ const iter = ReadableStreamToAsyncIterable<Bytes>(response.body);
210
+ for await (const sseChunk of iterSSEChunks(iter)) {
211
+ for (const line of lineDecoder.decode(sseChunk)) {
212
+ const sse = sseDecoder.decode(line);
213
+ if (sse) yield sse;
214
+ }
215
+ }
216
+
217
+ for (const line of lineDecoder.flush()) {
218
+ const sse = sseDecoder.decode(line);
219
+ if (sse) yield sse;
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Given an async iterable iterator, iterates over it and yields full
225
+ * SSE chunks, i.e. yields when a double new-line is encountered.
226
+ */
227
+ async function* iterSSEChunks(iterator: AsyncIterableIterator<Bytes>): AsyncGenerator<Uint8Array> {
228
+ let data = new Uint8Array();
229
+
230
+ for await (const chunk of iterator) {
231
+ if (chunk == null) {
232
+ continue;
233
+ }
234
+
235
+ const binaryChunk =
236
+ chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
237
+ : typeof chunk === 'string' ? encodeUTF8(chunk)
238
+ : chunk;
239
+
240
+ let newData = new Uint8Array(data.length + binaryChunk.length);
241
+ newData.set(data);
242
+ newData.set(binaryChunk, data.length);
243
+ data = newData;
244
+
245
+ let patternIndex;
246
+ while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) {
247
+ yield data.slice(0, patternIndex);
248
+ data = data.slice(patternIndex);
249
+ }
250
+ }
251
+
252
+ if (data.length > 0) {
253
+ yield data;
254
+ }
255
+ }
256
+
257
+ class SSEDecoder {
258
+ private data: string[];
259
+ private event: string | null;
260
+ private chunks: string[];
261
+
262
+ constructor() {
263
+ this.event = null;
264
+ this.data = [];
265
+ this.chunks = [];
266
+ }
267
+
268
+ decode(line: string) {
269
+ if (line.endsWith('\r')) {
270
+ line = line.substring(0, line.length - 1);
271
+ }
272
+
273
+ if (!line) {
274
+ // empty line and we didn't previously encounter any messages
275
+ if (!this.event && !this.data.length) return null;
276
+
277
+ const sse: ServerSentEvent = {
278
+ event: this.event,
279
+ data: this.data.join('\n'),
280
+ raw: this.chunks,
281
+ };
282
+
283
+ this.event = null;
284
+ this.data = [];
285
+ this.chunks = [];
286
+
287
+ return sse;
288
+ }
289
+
290
+ this.chunks.push(line);
291
+
292
+ if (line.startsWith(':')) {
293
+ return null;
294
+ }
295
+
296
+ let [fieldname, _, value] = partition(line, ':');
297
+
298
+ if (value.startsWith(' ')) {
299
+ value = value.substring(1);
300
+ }
301
+
302
+ if (fieldname === 'event') {
303
+ this.event = value;
304
+ } else if (fieldname === 'data') {
305
+ this.data.push(value);
306
+ }
307
+
308
+ return null;
309
+ }
310
+ }
311
+
312
+ function partition(str: string, delimiter: string): [string, string, string] {
313
+ const index = str.indexOf(delimiter);
314
+ if (index !== -1) {
315
+ return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
316
+ }
317
+
318
+ return [str, '', ''];
319
+ }