@azure/communication-chat 1.6.0-alpha.20240731.2 → 1.6.0-alpha.20250625.1

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 (439) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +134 -45
  3. package/dist/browser/chatClient.d.ts +201 -0
  4. package/dist/browser/chatClient.d.ts.map +1 -0
  5. package/{dist-esm/src → dist/browser}/chatClient.js +12 -11
  6. package/dist/browser/chatClient.js.map +1 -0
  7. package/dist/browser/chatThreadClient.d.ts +113 -0
  8. package/dist/browser/chatThreadClient.d.ts.map +1 -0
  9. package/{dist-esm/src → dist/browser}/chatThreadClient.js +18 -7
  10. package/dist/browser/chatThreadClient.js.map +1 -0
  11. package/dist/browser/credential/communicationTokenCredentialPolicy.d.ts +9 -0
  12. package/dist/browser/credential/communicationTokenCredentialPolicy.d.ts.map +1 -0
  13. package/{dist-esm/src → dist/browser}/credential/communicationTokenCredentialPolicy.js +2 -2
  14. package/dist/browser/credential/communicationTokenCredentialPolicy.js.map +1 -0
  15. package/dist/browser/generated/src/chatApiClient.d.ts +18 -0
  16. package/dist/browser/generated/src/chatApiClient.d.ts.map +1 -0
  17. package/{dist-esm/src → dist/browser}/generated/src/chatApiClient.js +3 -3
  18. package/dist/browser/generated/src/chatApiClient.js.map +1 -0
  19. package/dist/browser/generated/src/index.d.ts +4 -0
  20. package/dist/browser/generated/src/index.d.ts.map +1 -0
  21. package/{dist-esm/src → dist/browser}/generated/src/index.js +3 -3
  22. package/dist/browser/generated/src/index.js.map +1 -0
  23. package/dist/browser/generated/src/models/index.d.ts +497 -0
  24. package/dist/browser/generated/src/models/index.d.ts.map +1 -0
  25. package/{dist-esm/src → dist/browser}/generated/src/models/index.js +8 -0
  26. package/dist/browser/generated/src/models/index.js.map +1 -0
  27. package/dist/browser/generated/src/models/mappers.d.ts +38 -0
  28. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -0
  29. package/{dist-esm/src → dist/browser}/generated/src/models/mappers.js +100 -0
  30. package/dist/browser/generated/src/models/mappers.js.map +1 -0
  31. package/dist/browser/generated/src/models/parameters.d.ts +22 -0
  32. package/dist/browser/generated/src/models/parameters.d.ts.map +1 -0
  33. package/{dist-esm/src → dist/browser}/generated/src/models/parameters.js +2 -2
  34. package/dist/browser/generated/src/models/parameters.js.map +1 -0
  35. package/dist/browser/generated/src/operations/chat.d.ts +36 -0
  36. package/dist/browser/generated/src/operations/chat.d.ts.map +1 -0
  37. package/{dist-esm/src → dist/browser}/generated/src/operations/chat.js +3 -3
  38. package/dist/browser/generated/src/operations/chat.js.map +1 -0
  39. package/dist/browser/generated/src/operations/chatThread.d.ts +121 -0
  40. package/dist/browser/generated/src/operations/chatThread.d.ts.map +1 -0
  41. package/{dist-esm/src → dist/browser}/generated/src/operations/chatThread.js +3 -3
  42. package/dist/browser/generated/src/operations/chatThread.js.map +1 -0
  43. package/dist/browser/generated/src/operations/index.d.ts +3 -0
  44. package/dist/browser/generated/src/operations/index.d.ts.map +1 -0
  45. package/dist/browser/generated/src/operations/index.js +10 -0
  46. package/dist/browser/generated/src/operations/index.js.map +1 -0
  47. package/dist/browser/generated/src/operationsInterfaces/chat.d.ts +28 -0
  48. package/dist/browser/generated/src/operationsInterfaces/chat.d.ts.map +1 -0
  49. package/dist/browser/generated/src/operationsInterfaces/chat.js.map +1 -0
  50. package/dist/browser/generated/src/operationsInterfaces/chatThread.d.ts +113 -0
  51. package/dist/browser/generated/src/operationsInterfaces/chatThread.d.ts.map +1 -0
  52. package/dist/browser/generated/src/operationsInterfaces/chatThread.js.map +1 -0
  53. package/dist/browser/generated/src/operationsInterfaces/index.d.ts +3 -0
  54. package/dist/browser/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  55. package/dist/browser/generated/src/operationsInterfaces/index.js +10 -0
  56. package/dist/browser/generated/src/operationsInterfaces/index.js.map +1 -0
  57. package/dist/browser/generated/src/tracing.d.ts +2 -0
  58. package/dist/browser/generated/src/tracing.d.ts.map +1 -0
  59. package/{dist-esm/src → dist/browser}/generated/src/tracing.js +1 -1
  60. package/{dist-esm/src → dist/browser}/generated/src/tracing.js.map +1 -1
  61. package/dist/browser/index.d.ts +7 -0
  62. package/dist/browser/index.d.ts.map +1 -0
  63. package/dist/browser/index.js +9 -0
  64. package/dist/browser/index.js.map +1 -0
  65. package/dist/browser/models/events.d.ts +4 -0
  66. package/dist/browser/models/events.d.ts.map +1 -0
  67. package/dist/browser/models/events.js +4 -0
  68. package/{dist-esm/src → dist/browser}/models/events.js.map +1 -1
  69. package/dist/browser/models/logger.d.ts +2 -0
  70. package/dist/browser/models/logger.d.ts.map +1 -0
  71. package/{dist-esm/src → dist/browser}/models/logger.js +1 -1
  72. package/{dist-esm/src → dist/browser}/models/logger.js.map +1 -1
  73. package/dist/browser/models/mappers.d.ts +55 -0
  74. package/dist/browser/models/mappers.d.ts.map +1 -0
  75. package/{dist-esm/src → dist/browser}/models/mappers.js +22 -5
  76. package/dist/browser/models/mappers.js.map +1 -0
  77. package/dist/browser/models/models.d.ts +128 -0
  78. package/dist/browser/models/models.d.ts.map +1 -0
  79. package/dist/browser/models/models.js +4 -0
  80. package/dist/browser/models/models.js.map +1 -0
  81. package/dist/browser/models/options.d.ts +116 -0
  82. package/dist/browser/models/options.d.ts.map +1 -0
  83. package/dist/browser/models/options.js.map +1 -0
  84. package/dist/browser/models/requests.d.ts +18 -0
  85. package/dist/browser/models/requests.d.ts.map +1 -0
  86. package/dist/browser/models/requests.js +4 -0
  87. package/dist/browser/models/requests.js.map +1 -0
  88. package/dist/browser/models/uuid.d.ts +8 -0
  89. package/dist/browser/models/uuid.d.ts.map +1 -0
  90. package/{dist-esm/src → dist/browser}/models/uuid.js +3 -3
  91. package/dist/browser/models/uuid.js.map +1 -0
  92. package/dist/browser/package.json +3 -0
  93. package/dist/browser/signaling/signalingClient-browser.d.mts.map +1 -0
  94. package/dist/browser/signaling/signalingClient-browser.mjs.map +1 -0
  95. package/dist/browser/signaling/signalingClient.d.ts +6 -0
  96. package/dist/browser/signaling/signalingClient.js +13 -0
  97. package/dist/browser/signaling/signalingClientOptions.d.ts +6 -0
  98. package/dist/browser/signaling/signalingClientOptions.d.ts.map +1 -0
  99. package/dist/browser/signaling/signalingClientOptions.js +4 -0
  100. package/dist/browser/signaling/signalingClientOptions.js.map +1 -0
  101. package/dist/commonjs/chatClient.d.ts +201 -0
  102. package/dist/commonjs/chatClient.d.ts.map +1 -0
  103. package/dist/commonjs/chatClient.js +245 -0
  104. package/dist/commonjs/chatClient.js.map +1 -0
  105. package/dist/commonjs/chatThreadClient.d.ts +113 -0
  106. package/dist/commonjs/chatThreadClient.d.ts.map +1 -0
  107. package/dist/commonjs/chatThreadClient.js +391 -0
  108. package/dist/commonjs/chatThreadClient.js.map +1 -0
  109. package/dist/commonjs/credential/communicationTokenCredentialPolicy.d.ts +9 -0
  110. package/dist/commonjs/credential/communicationTokenCredentialPolicy.d.ts.map +1 -0
  111. package/dist/commonjs/credential/communicationTokenCredentialPolicy.js +22 -0
  112. package/dist/commonjs/credential/communicationTokenCredentialPolicy.js.map +1 -0
  113. package/dist/commonjs/generated/src/chatApiClient.d.ts +18 -0
  114. package/dist/commonjs/generated/src/chatApiClient.d.ts.map +1 -0
  115. package/dist/commonjs/generated/src/chatApiClient.js +75 -0
  116. package/dist/commonjs/generated/src/chatApiClient.js.map +1 -0
  117. package/dist/commonjs/generated/src/index.d.ts +4 -0
  118. package/dist/commonjs/generated/src/index.d.ts.map +1 -0
  119. package/dist/commonjs/generated/src/index.js +16 -0
  120. package/dist/commonjs/generated/src/index.js.map +1 -0
  121. package/dist/commonjs/generated/src/models/index.d.ts +497 -0
  122. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -0
  123. package/dist/commonjs/generated/src/models/index.js +43 -0
  124. package/dist/commonjs/generated/src/models/index.js.map +1 -0
  125. package/dist/commonjs/generated/src/models/mappers.d.ts +38 -0
  126. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -0
  127. package/dist/commonjs/generated/src/models/mappers.js +944 -0
  128. package/dist/commonjs/generated/src/models/mappers.js.map +1 -0
  129. package/dist/commonjs/generated/src/models/parameters.d.ts +22 -0
  130. package/dist/commonjs/generated/src/models/parameters.d.ts.map +1 -0
  131. package/dist/commonjs/generated/src/models/parameters.js +166 -0
  132. package/dist/commonjs/generated/src/models/parameters.js.map +1 -0
  133. package/dist/commonjs/generated/src/operations/chat.d.ts +36 -0
  134. package/dist/commonjs/generated/src/operations/chat.d.ts.map +1 -0
  135. package/dist/commonjs/generated/src/operations/chat.js +191 -0
  136. package/dist/commonjs/generated/src/operations/chat.js.map +1 -0
  137. package/dist/commonjs/generated/src/operations/chatThread.d.ts +121 -0
  138. package/dist/commonjs/generated/src/operations/chatThread.d.ts.map +1 -0
  139. package/dist/commonjs/generated/src/operations/chatThread.js +700 -0
  140. package/dist/commonjs/generated/src/operations/chatThread.js.map +1 -0
  141. package/dist/commonjs/generated/src/operations/index.d.ts +3 -0
  142. package/dist/commonjs/generated/src/operations/index.d.ts.map +1 -0
  143. package/dist/commonjs/generated/src/operations/index.js +13 -0
  144. package/dist/commonjs/generated/src/operations/index.js.map +1 -0
  145. package/dist/commonjs/generated/src/operationsInterfaces/chat.d.ts +28 -0
  146. package/dist/commonjs/generated/src/operationsInterfaces/chat.d.ts.map +1 -0
  147. package/dist/commonjs/generated/src/operationsInterfaces/chat.js +10 -0
  148. package/dist/commonjs/generated/src/operationsInterfaces/chat.js.map +1 -0
  149. package/dist/commonjs/generated/src/operationsInterfaces/chatThread.d.ts +113 -0
  150. package/dist/commonjs/generated/src/operationsInterfaces/chatThread.d.ts.map +1 -0
  151. package/dist/commonjs/generated/src/operationsInterfaces/chatThread.js +10 -0
  152. package/dist/commonjs/generated/src/operationsInterfaces/chatThread.js.map +1 -0
  153. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts +3 -0
  154. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  155. package/dist/commonjs/generated/src/operationsInterfaces/index.js +13 -0
  156. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +1 -0
  157. package/dist/commonjs/generated/src/tracing.d.ts +2 -0
  158. package/dist/commonjs/generated/src/tracing.d.ts.map +1 -0
  159. package/dist/commonjs/generated/src/tracing.js +17 -0
  160. package/dist/commonjs/generated/src/tracing.js.map +1 -0
  161. package/dist/commonjs/index.d.ts +7 -0
  162. package/dist/commonjs/index.d.ts.map +1 -0
  163. package/dist/commonjs/index.js +12 -0
  164. package/dist/commonjs/index.js.map +1 -0
  165. package/dist/commonjs/models/events.d.ts +4 -0
  166. package/dist/commonjs/models/events.d.ts.map +1 -0
  167. package/dist/commonjs/models/events.js +5 -0
  168. package/dist/commonjs/models/events.js.map +1 -0
  169. package/dist/commonjs/models/logger.d.ts +2 -0
  170. package/dist/commonjs/models/logger.d.ts.map +1 -0
  171. package/dist/commonjs/models/logger.js +8 -0
  172. package/dist/commonjs/models/logger.js.map +1 -0
  173. package/dist/commonjs/models/mappers.d.ts +55 -0
  174. package/dist/commonjs/models/mappers.d.ts.map +1 -0
  175. package/dist/commonjs/models/mappers.js +139 -0
  176. package/dist/commonjs/models/mappers.js.map +1 -0
  177. package/dist/commonjs/models/models.d.ts +128 -0
  178. package/dist/commonjs/models/models.d.ts.map +1 -0
  179. package/dist/commonjs/models/models.js +5 -0
  180. package/dist/commonjs/models/models.js.map +1 -0
  181. package/dist/commonjs/models/options.d.ts +116 -0
  182. package/dist/commonjs/models/options.d.ts.map +1 -0
  183. package/dist/commonjs/models/options.js +3 -0
  184. package/dist/commonjs/models/options.js.map +1 -0
  185. package/dist/commonjs/models/requests.d.ts +18 -0
  186. package/dist/commonjs/models/requests.d.ts.map +1 -0
  187. package/dist/commonjs/models/requests.js +5 -0
  188. package/dist/commonjs/models/requests.js.map +1 -0
  189. package/dist/commonjs/models/uuid.d.ts +8 -0
  190. package/dist/commonjs/models/uuid.d.ts.map +1 -0
  191. package/dist/commonjs/models/uuid.js +16 -0
  192. package/dist/commonjs/models/uuid.js.map +1 -0
  193. package/dist/commonjs/package.json +3 -0
  194. package/dist/commonjs/signaling/signalingClient.d.ts +6 -0
  195. package/dist/commonjs/signaling/signalingClient.d.ts.map +1 -0
  196. package/dist/commonjs/signaling/signalingClient.js +11 -0
  197. package/dist/commonjs/signaling/signalingClient.js.map +1 -0
  198. package/dist/commonjs/signaling/signalingClientOptions.d.ts +6 -0
  199. package/dist/commonjs/signaling/signalingClientOptions.d.ts.map +1 -0
  200. package/dist/commonjs/signaling/signalingClientOptions.js +5 -0
  201. package/dist/commonjs/signaling/signalingClientOptions.js.map +1 -0
  202. package/dist/commonjs/tsdoc-metadata.json +11 -0
  203. package/dist/esm/chatClient.d.ts +201 -0
  204. package/dist/esm/chatClient.d.ts.map +1 -0
  205. package/dist/esm/chatClient.js +241 -0
  206. package/dist/esm/chatClient.js.map +1 -0
  207. package/dist/esm/chatThreadClient.d.ts +113 -0
  208. package/dist/esm/chatThreadClient.d.ts.map +1 -0
  209. package/dist/esm/chatThreadClient.js +387 -0
  210. package/dist/esm/chatThreadClient.js.map +1 -0
  211. package/dist/esm/credential/communicationTokenCredentialPolicy.d.ts +9 -0
  212. package/dist/esm/credential/communicationTokenCredentialPolicy.d.ts.map +1 -0
  213. package/dist/esm/credential/communicationTokenCredentialPolicy.js +18 -0
  214. package/dist/esm/credential/communicationTokenCredentialPolicy.js.map +1 -0
  215. package/dist/esm/generated/src/chatApiClient.d.ts +18 -0
  216. package/dist/esm/generated/src/chatApiClient.d.ts.map +1 -0
  217. package/dist/esm/generated/src/chatApiClient.js +70 -0
  218. package/dist/esm/generated/src/chatApiClient.js.map +1 -0
  219. package/dist/esm/generated/src/index.d.ts +4 -0
  220. package/dist/esm/generated/src/index.d.ts.map +1 -0
  221. package/dist/esm/generated/src/index.js +11 -0
  222. package/dist/esm/generated/src/index.js.map +1 -0
  223. package/dist/esm/generated/src/models/index.d.ts +497 -0
  224. package/dist/esm/generated/src/models/index.d.ts.map +1 -0
  225. package/dist/esm/generated/src/models/index.js +40 -0
  226. package/dist/esm/generated/src/models/index.js.map +1 -0
  227. package/dist/esm/generated/src/models/mappers.d.ts +38 -0
  228. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -0
  229. package/dist/esm/generated/src/models/mappers.js +941 -0
  230. package/dist/esm/generated/src/models/mappers.js.map +1 -0
  231. package/dist/esm/generated/src/models/parameters.d.ts +22 -0
  232. package/dist/esm/generated/src/models/parameters.d.ts.map +1 -0
  233. package/dist/esm/generated/src/models/parameters.js +163 -0
  234. package/dist/esm/generated/src/models/parameters.js.map +1 -0
  235. package/dist/esm/generated/src/operations/chat.d.ts +36 -0
  236. package/dist/esm/generated/src/operations/chat.d.ts.map +1 -0
  237. package/dist/esm/generated/src/operations/chat.js +186 -0
  238. package/dist/esm/generated/src/operations/chat.js.map +1 -0
  239. package/dist/esm/generated/src/operations/chatThread.d.ts +121 -0
  240. package/dist/esm/generated/src/operations/chatThread.d.ts.map +1 -0
  241. package/dist/esm/generated/src/operations/chatThread.js +695 -0
  242. package/dist/esm/generated/src/operations/chatThread.js.map +1 -0
  243. package/dist/esm/generated/src/operations/index.d.ts +3 -0
  244. package/dist/esm/generated/src/operations/index.d.ts.map +1 -0
  245. package/dist/esm/generated/src/operations/index.js +10 -0
  246. package/dist/esm/generated/src/operations/index.js.map +1 -0
  247. package/dist/esm/generated/src/operationsInterfaces/chat.d.ts +28 -0
  248. package/dist/esm/generated/src/operationsInterfaces/chat.d.ts.map +1 -0
  249. package/{dist-esm/src/generated/src/operationsInterfaces/index.js → dist/esm/generated/src/operationsInterfaces/chat.js} +2 -3
  250. package/dist/esm/generated/src/operationsInterfaces/chat.js.map +1 -0
  251. package/dist/esm/generated/src/operationsInterfaces/chatThread.d.ts +113 -0
  252. package/dist/esm/generated/src/operationsInterfaces/chatThread.d.ts.map +1 -0
  253. package/{dist-esm/src/generated/src/operations/index.js → dist/esm/generated/src/operationsInterfaces/chatThread.js} +2 -3
  254. package/dist/esm/generated/src/operationsInterfaces/chatThread.js.map +1 -0
  255. package/dist/esm/generated/src/operationsInterfaces/index.d.ts +3 -0
  256. package/dist/esm/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  257. package/dist/esm/generated/src/operationsInterfaces/index.js +10 -0
  258. package/dist/esm/generated/src/operationsInterfaces/index.js.map +1 -0
  259. package/dist/esm/generated/src/tracing.d.ts +2 -0
  260. package/dist/esm/generated/src/tracing.d.ts.map +1 -0
  261. package/dist/esm/generated/src/tracing.js +14 -0
  262. package/dist/esm/generated/src/tracing.js.map +1 -0
  263. package/dist/esm/index.d.ts +7 -0
  264. package/dist/esm/index.d.ts.map +1 -0
  265. package/dist/esm/index.js +9 -0
  266. package/dist/esm/index.js.map +1 -0
  267. package/dist/esm/models/events.d.ts +4 -0
  268. package/dist/esm/models/events.d.ts.map +1 -0
  269. package/dist/esm/models/events.js +4 -0
  270. package/dist/esm/models/events.js.map +1 -0
  271. package/dist/esm/models/logger.d.ts +2 -0
  272. package/dist/esm/models/logger.d.ts.map +1 -0
  273. package/dist/esm/models/logger.js +5 -0
  274. package/dist/esm/models/logger.js.map +1 -0
  275. package/dist/esm/models/mappers.d.ts +55 -0
  276. package/dist/esm/models/mappers.d.ts.map +1 -0
  277. package/dist/esm/models/mappers.js +125 -0
  278. package/dist/esm/models/mappers.js.map +1 -0
  279. package/dist/esm/models/models.d.ts +128 -0
  280. package/dist/esm/models/models.d.ts.map +1 -0
  281. package/dist/esm/models/models.js +4 -0
  282. package/dist/esm/models/models.js.map +1 -0
  283. package/dist/esm/models/options.d.ts +116 -0
  284. package/dist/esm/models/options.d.ts.map +1 -0
  285. package/dist/esm/models/options.js +2 -0
  286. package/dist/esm/models/options.js.map +1 -0
  287. package/dist/esm/models/requests.d.ts +18 -0
  288. package/dist/esm/models/requests.d.ts.map +1 -0
  289. package/dist/esm/models/requests.js +4 -0
  290. package/dist/esm/models/requests.js.map +1 -0
  291. package/dist/esm/models/uuid.d.ts +8 -0
  292. package/dist/esm/models/uuid.d.ts.map +1 -0
  293. package/dist/esm/models/uuid.js +13 -0
  294. package/dist/esm/models/uuid.js.map +1 -0
  295. package/dist/esm/package.json +3 -0
  296. package/dist/esm/signaling/signalingClient.d.ts +6 -0
  297. package/dist/esm/signaling/signalingClient.d.ts.map +1 -0
  298. package/dist/esm/signaling/signalingClient.js +7 -0
  299. package/dist/esm/signaling/signalingClient.js.map +1 -0
  300. package/dist/esm/signaling/signalingClientOptions.d.ts +6 -0
  301. package/dist/esm/signaling/signalingClientOptions.d.ts.map +1 -0
  302. package/dist/esm/signaling/signalingClientOptions.js +4 -0
  303. package/dist/esm/signaling/signalingClientOptions.js.map +1 -0
  304. package/dist/react-native/chatClient.d.ts +201 -0
  305. package/dist/react-native/chatClient.d.ts.map +1 -0
  306. package/dist/react-native/chatClient.js +241 -0
  307. package/dist/react-native/chatClient.js.map +1 -0
  308. package/dist/react-native/chatThreadClient.d.ts +113 -0
  309. package/dist/react-native/chatThreadClient.d.ts.map +1 -0
  310. package/dist/react-native/chatThreadClient.js +387 -0
  311. package/dist/react-native/chatThreadClient.js.map +1 -0
  312. package/dist/react-native/credential/communicationTokenCredentialPolicy.d.ts +9 -0
  313. package/dist/react-native/credential/communicationTokenCredentialPolicy.d.ts.map +1 -0
  314. package/dist/react-native/credential/communicationTokenCredentialPolicy.js +18 -0
  315. package/dist/react-native/credential/communicationTokenCredentialPolicy.js.map +1 -0
  316. package/dist/react-native/generated/src/chatApiClient.d.ts +18 -0
  317. package/dist/react-native/generated/src/chatApiClient.d.ts.map +1 -0
  318. package/dist/react-native/generated/src/chatApiClient.js +70 -0
  319. package/dist/react-native/generated/src/chatApiClient.js.map +1 -0
  320. package/dist/react-native/generated/src/index.d.ts +4 -0
  321. package/dist/react-native/generated/src/index.d.ts.map +1 -0
  322. package/dist/react-native/generated/src/index.js +11 -0
  323. package/dist/react-native/generated/src/index.js.map +1 -0
  324. package/dist/react-native/generated/src/models/index.d.ts +497 -0
  325. package/dist/react-native/generated/src/models/index.d.ts.map +1 -0
  326. package/dist/react-native/generated/src/models/index.js +40 -0
  327. package/dist/react-native/generated/src/models/index.js.map +1 -0
  328. package/dist/react-native/generated/src/models/mappers.d.ts +38 -0
  329. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -0
  330. package/dist/react-native/generated/src/models/mappers.js +941 -0
  331. package/dist/react-native/generated/src/models/mappers.js.map +1 -0
  332. package/dist/react-native/generated/src/models/parameters.d.ts +22 -0
  333. package/dist/react-native/generated/src/models/parameters.d.ts.map +1 -0
  334. package/dist/react-native/generated/src/models/parameters.js +163 -0
  335. package/dist/react-native/generated/src/models/parameters.js.map +1 -0
  336. package/dist/react-native/generated/src/operations/chat.d.ts +36 -0
  337. package/dist/react-native/generated/src/operations/chat.d.ts.map +1 -0
  338. package/dist/react-native/generated/src/operations/chat.js +186 -0
  339. package/dist/react-native/generated/src/operations/chat.js.map +1 -0
  340. package/dist/react-native/generated/src/operations/chatThread.d.ts +121 -0
  341. package/dist/react-native/generated/src/operations/chatThread.d.ts.map +1 -0
  342. package/dist/react-native/generated/src/operations/chatThread.js +695 -0
  343. package/dist/react-native/generated/src/operations/chatThread.js.map +1 -0
  344. package/dist/react-native/generated/src/operations/index.d.ts +3 -0
  345. package/dist/react-native/generated/src/operations/index.d.ts.map +1 -0
  346. package/dist/react-native/generated/src/operations/index.js +10 -0
  347. package/dist/react-native/generated/src/operations/index.js.map +1 -0
  348. package/dist/react-native/generated/src/operationsInterfaces/chat.d.ts +28 -0
  349. package/dist/react-native/generated/src/operationsInterfaces/chat.d.ts.map +1 -0
  350. package/dist/react-native/generated/src/operationsInterfaces/chat.js +9 -0
  351. package/dist/react-native/generated/src/operationsInterfaces/chat.js.map +1 -0
  352. package/dist/react-native/generated/src/operationsInterfaces/chatThread.d.ts +113 -0
  353. package/dist/react-native/generated/src/operationsInterfaces/chatThread.d.ts.map +1 -0
  354. package/dist/react-native/generated/src/operationsInterfaces/chatThread.js +9 -0
  355. package/dist/react-native/generated/src/operationsInterfaces/chatThread.js.map +1 -0
  356. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts +3 -0
  357. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  358. package/dist/react-native/generated/src/operationsInterfaces/index.js +10 -0
  359. package/dist/react-native/generated/src/operationsInterfaces/index.js.map +1 -0
  360. package/dist/react-native/generated/src/tracing.d.ts +2 -0
  361. package/dist/react-native/generated/src/tracing.d.ts.map +1 -0
  362. package/dist/react-native/generated/src/tracing.js +14 -0
  363. package/dist/react-native/generated/src/tracing.js.map +1 -0
  364. package/dist/react-native/index.d.ts +7 -0
  365. package/dist/react-native/index.d.ts.map +1 -0
  366. package/dist/react-native/index.js +9 -0
  367. package/dist/react-native/index.js.map +1 -0
  368. package/dist/react-native/models/events.d.ts +4 -0
  369. package/dist/react-native/models/events.d.ts.map +1 -0
  370. package/dist/react-native/models/events.js +4 -0
  371. package/dist/react-native/models/events.js.map +1 -0
  372. package/dist/react-native/models/logger.d.ts +2 -0
  373. package/dist/react-native/models/logger.d.ts.map +1 -0
  374. package/dist/react-native/models/logger.js +5 -0
  375. package/dist/react-native/models/logger.js.map +1 -0
  376. package/dist/react-native/models/mappers.d.ts +55 -0
  377. package/dist/react-native/models/mappers.d.ts.map +1 -0
  378. package/dist/react-native/models/mappers.js +125 -0
  379. package/dist/react-native/models/mappers.js.map +1 -0
  380. package/dist/react-native/models/models.d.ts +128 -0
  381. package/dist/react-native/models/models.d.ts.map +1 -0
  382. package/dist/react-native/models/models.js +4 -0
  383. package/dist/react-native/models/models.js.map +1 -0
  384. package/dist/react-native/models/options.d.ts +116 -0
  385. package/dist/react-native/models/options.d.ts.map +1 -0
  386. package/dist/react-native/models/options.js +2 -0
  387. package/dist/react-native/models/options.js.map +1 -0
  388. package/dist/react-native/models/requests.d.ts +18 -0
  389. package/dist/react-native/models/requests.d.ts.map +1 -0
  390. package/dist/react-native/models/requests.js +4 -0
  391. package/dist/react-native/models/requests.js.map +1 -0
  392. package/dist/react-native/models/uuid.d.ts +8 -0
  393. package/dist/react-native/models/uuid.d.ts.map +1 -0
  394. package/dist/react-native/models/uuid.js +13 -0
  395. package/dist/react-native/models/uuid.js.map +1 -0
  396. package/dist/react-native/package.json +3 -0
  397. package/dist/react-native/signaling/signalingClient-react-native.d.mts.map +1 -0
  398. package/dist/react-native/signaling/signalingClient-react-native.mjs.map +1 -0
  399. package/dist/react-native/signaling/signalingClient.d.ts +6 -0
  400. package/dist/react-native/signaling/signalingClient.js +13 -0
  401. package/dist/react-native/signaling/signalingClientOptions.d.ts +6 -0
  402. package/dist/react-native/signaling/signalingClientOptions.d.ts.map +1 -0
  403. package/dist/react-native/signaling/signalingClientOptions.js +4 -0
  404. package/dist/react-native/signaling/signalingClientOptions.js.map +1 -0
  405. package/package.json +75 -70
  406. package/dist/index.js +0 -2770
  407. package/dist/index.js.map +0 -1
  408. package/dist-esm/src/chatClient.js.map +0 -1
  409. package/dist-esm/src/chatThreadClient.js.map +0 -1
  410. package/dist-esm/src/credential/communicationTokenCredentialPolicy.js.map +0 -1
  411. package/dist-esm/src/generated/src/chatApiClient.js.map +0 -1
  412. package/dist-esm/src/generated/src/index.js.map +0 -1
  413. package/dist-esm/src/generated/src/models/index.js.map +0 -1
  414. package/dist-esm/src/generated/src/models/mappers.js.map +0 -1
  415. package/dist-esm/src/generated/src/models/parameters.js.map +0 -1
  416. package/dist-esm/src/generated/src/operations/chat.js.map +0 -1
  417. package/dist-esm/src/generated/src/operations/chatThread.js.map +0 -1
  418. package/dist-esm/src/generated/src/operations/index.js.map +0 -1
  419. package/dist-esm/src/generated/src/operationsInterfaces/chat.js.map +0 -1
  420. package/dist-esm/src/generated/src/operationsInterfaces/chatThread.js.map +0 -1
  421. package/dist-esm/src/generated/src/operationsInterfaces/index.js.map +0 -1
  422. package/dist-esm/src/index.js +0 -9
  423. package/dist-esm/src/index.js.map +0 -1
  424. package/dist-esm/src/models/events.js +0 -4
  425. package/dist-esm/src/models/mappers.js.map +0 -1
  426. package/dist-esm/src/models/models.js +0 -4
  427. package/dist-esm/src/models/models.js.map +0 -1
  428. package/dist-esm/src/models/options.js.map +0 -1
  429. package/dist-esm/src/models/requests.js +0 -4
  430. package/dist-esm/src/models/requests.js.map +0 -1
  431. package/dist-esm/src/models/uuid.js.map +0 -1
  432. package/dist-esm/src/signaling/signalingClient.browser.js +0 -12
  433. package/dist-esm/src/signaling/signalingClient.browser.js.map +0 -1
  434. package/dist-esm/src/signaling/signalingClient.js +0 -17
  435. package/dist-esm/src/signaling/signalingClient.js.map +0 -1
  436. package/types/communication-chat.d.ts +0 -676
  437. /package/{dist-esm/src → dist/browser}/generated/src/operationsInterfaces/chat.js +0 -0
  438. /package/{dist-esm/src → dist/browser}/generated/src/operationsInterfaces/chatThread.js +0 -0
  439. /package/{dist-esm/src → dist/browser}/models/options.js +0 -0
package/dist/index.js DELETED
@@ -1,2770 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var communicationSignaling = require('@azure/communication-signaling');
7
- var communicationCommon = require('@azure/communication-common');
8
- var logger$1 = require('@azure/logger');
9
- var coreRestPipeline = require('@azure/core-rest-pipeline');
10
- var coreTracing = require('@azure/core-tracing');
11
- var coreClient = require('@azure/core-client');
12
- var events = require('events');
13
- var uuid = require('uuid');
14
-
15
- function _interopNamespaceDefault(e) {
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
33
-
34
- // Copyright (c) Microsoft Corporation.
35
- // Licensed under the MIT license.
36
- const mapToCreateChatThreadOptionsRestModel = (options) => {
37
- const { participants, idempotencyToken } = options, rest = tslib.__rest(options, ["participants", "idempotencyToken"]);
38
- return Object.assign({ repeatabilityRequestId: idempotencyToken }, rest);
39
- };
40
- /**
41
- * @internal
42
- * Mapping chat participant customer model to chat participant REST model
43
- */
44
- const mapToChatParticipantRestModel = (chatParticipant) => {
45
- const { id } = chatParticipant, rest = tslib.__rest(chatParticipant, ["id"]);
46
- return Object.assign(Object.assign({}, rest), { communicationIdentifier: communicationCommon.serializeCommunicationIdentifier(id) });
47
- };
48
- /**
49
- * @internal
50
- * Mapping add participants request to add chat participants request REST model
51
- */
52
- const mapToAddChatParticipantsRequestRestModel = (addParticipantsRequest) => {
53
- var _a;
54
- return {
55
- participants: (_a = addParticipantsRequest.participants) === null || _a === void 0 ? void 0 : _a.map((participant) => mapToChatParticipantRestModel(participant)),
56
- };
57
- };
58
- /**
59
- * @internal
60
- * Mapping chat participant REST model to chat participant SDK model
61
- */
62
- const mapToChatParticipantSdkModel = (chatParticipant) => {
63
- const { communicationIdentifier } = chatParticipant, rest = tslib.__rest(chatParticipant, ["communicationIdentifier"]);
64
- return Object.assign(Object.assign({}, rest), { id: communicationCommon.deserializeCommunicationIdentifier(communicationIdentifier) });
65
- };
66
- /**
67
- * @internal
68
- */
69
- const mapToChatContentSdkModel = (content) => {
70
- const { participants, initiatorCommunicationIdentifier } = content, otherChatContents = tslib.__rest(content, ["participants", "initiatorCommunicationIdentifier"]);
71
- let result = Object.assign({}, otherChatContents);
72
- if (initiatorCommunicationIdentifier) {
73
- const initiator = communicationCommon.deserializeCommunicationIdentifier(initiatorCommunicationIdentifier);
74
- result = Object.assign(Object.assign({}, result), { initiator });
75
- }
76
- if (participants) {
77
- result = Object.assign(Object.assign({}, result), { participants: participants === null || participants === void 0 ? void 0 : participants.map((participant) => mapToChatParticipantSdkModel(participant)) });
78
- }
79
- return result;
80
- };
81
- /**
82
- * @internal
83
- * Mapping chat message REST model to chat message SDK model
84
- */
85
- const mapToChatMessageSdkModel = (chatMessage) => {
86
- const { content, senderCommunicationIdentifier } = chatMessage, otherChatMessage = tslib.__rest(chatMessage, ["content", "senderCommunicationIdentifier"]);
87
- let result = Object.assign({}, otherChatMessage);
88
- if (content) {
89
- result = Object.assign(Object.assign({}, result), { content: mapToChatContentSdkModel(content) });
90
- }
91
- if (senderCommunicationIdentifier) {
92
- const sender = communicationCommon.deserializeCommunicationIdentifier(senderCommunicationIdentifier);
93
- result = Object.assign(Object.assign({}, result), { sender });
94
- }
95
- return result;
96
- };
97
- /**
98
- * @internal
99
- * Mapping chat thread REST model to chat thread SDK model
100
- */
101
- const mapToChatThreadPropertiesSdkModel = (chatThread) => {
102
- const { createdByCommunicationIdentifier } = chatThread, rest = tslib.__rest(chatThread, ["createdByCommunicationIdentifier"]);
103
- if (createdByCommunicationIdentifier) {
104
- return Object.assign(Object.assign({}, rest), { createdBy: communicationCommon.deserializeCommunicationIdentifier(createdByCommunicationIdentifier) });
105
- }
106
- else {
107
- return Object.assign({}, rest);
108
- }
109
- };
110
- /**
111
- * @internal
112
- * Mapping chat thread REST model to chat thread SDK model
113
- */
114
- const mapToCreateChatThreadResultSdkModel = (result) => {
115
- const { chatThread } = result, rest = tslib.__rest(result, ["chatThread"]);
116
- if (chatThread) {
117
- return Object.assign(Object.assign({}, rest), { chatThread: mapToChatThreadPropertiesSdkModel(chatThread) });
118
- }
119
- else {
120
- return Object.assign({}, rest);
121
- }
122
- };
123
- /**
124
- * @internal
125
- * Mapping read receipt REST model to read receipt SDK model
126
- */
127
- const mapToReadReceiptSdkModel = (readReceipt) => {
128
- const { senderCommunicationIdentifier } = readReceipt, rest = tslib.__rest(readReceipt, ["senderCommunicationIdentifier"]);
129
- return Object.assign(Object.assign({}, rest), { sender: communicationCommon.deserializeCommunicationIdentifier(senderCommunicationIdentifier) });
130
- };
131
-
132
- /*
133
- * Copyright (c) Microsoft Corporation.
134
- * Licensed under the MIT License.
135
- *
136
- * Code generated by Microsoft (R) AutoRest Code Generator.
137
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
138
- */
139
- const tracingClient = coreTracing.createTracingClient({
140
- namespace: "Azure.Communication",
141
- packageName: "@azure/communication-chat",
142
- packageVersion: "1.5.0",
143
- });
144
-
145
- /*
146
- * Copyright (c) Microsoft Corporation.
147
- * Licensed under the MIT License.
148
- *
149
- * Code generated by Microsoft (R) AutoRest Code Generator.
150
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
151
- */
152
- const ChatMessageReadReceiptsCollection = {
153
- type: {
154
- name: "Composite",
155
- className: "ChatMessageReadReceiptsCollection",
156
- modelProperties: {
157
- value: {
158
- serializedName: "value",
159
- required: true,
160
- type: {
161
- name: "Sequence",
162
- element: {
163
- type: {
164
- name: "Composite",
165
- className: "ChatMessageReadReceipt",
166
- },
167
- },
168
- },
169
- },
170
- nextLink: {
171
- serializedName: "nextLink",
172
- readOnly: true,
173
- type: {
174
- name: "String",
175
- },
176
- },
177
- },
178
- },
179
- };
180
- const ChatMessageReadReceipt = {
181
- type: {
182
- name: "Composite",
183
- className: "ChatMessageReadReceipt",
184
- modelProperties: {
185
- senderCommunicationIdentifier: {
186
- serializedName: "senderCommunicationIdentifier",
187
- type: {
188
- name: "Composite",
189
- className: "CommunicationIdentifierModel",
190
- },
191
- },
192
- chatMessageId: {
193
- serializedName: "chatMessageId",
194
- required: true,
195
- type: {
196
- name: "String",
197
- },
198
- },
199
- readOn: {
200
- serializedName: "readOn",
201
- required: true,
202
- type: {
203
- name: "DateTime",
204
- },
205
- },
206
- },
207
- },
208
- };
209
- const CommunicationIdentifierModel = {
210
- type: {
211
- name: "Composite",
212
- className: "CommunicationIdentifierModel",
213
- modelProperties: {
214
- kind: {
215
- serializedName: "kind",
216
- type: {
217
- name: "String",
218
- },
219
- },
220
- rawId: {
221
- serializedName: "rawId",
222
- type: {
223
- name: "String",
224
- },
225
- },
226
- communicationUser: {
227
- serializedName: "communicationUser",
228
- type: {
229
- name: "Composite",
230
- className: "CommunicationUserIdentifierModel",
231
- },
232
- },
233
- phoneNumber: {
234
- serializedName: "phoneNumber",
235
- type: {
236
- name: "Composite",
237
- className: "PhoneNumberIdentifierModel",
238
- },
239
- },
240
- microsoftTeamsUser: {
241
- serializedName: "microsoftTeamsUser",
242
- type: {
243
- name: "Composite",
244
- className: "MicrosoftTeamsUserIdentifierModel",
245
- },
246
- },
247
- microsoftTeamsApp: {
248
- serializedName: "microsoftTeamsApp",
249
- type: {
250
- name: "Composite",
251
- className: "MicrosoftTeamsAppIdentifierModel",
252
- },
253
- },
254
- },
255
- },
256
- };
257
- const CommunicationUserIdentifierModel = {
258
- type: {
259
- name: "Composite",
260
- className: "CommunicationUserIdentifierModel",
261
- modelProperties: {
262
- id: {
263
- serializedName: "id",
264
- required: true,
265
- type: {
266
- name: "String",
267
- },
268
- },
269
- },
270
- },
271
- };
272
- const PhoneNumberIdentifierModel = {
273
- type: {
274
- name: "Composite",
275
- className: "PhoneNumberIdentifierModel",
276
- modelProperties: {
277
- value: {
278
- serializedName: "value",
279
- required: true,
280
- type: {
281
- name: "String",
282
- },
283
- },
284
- },
285
- },
286
- };
287
- const MicrosoftTeamsUserIdentifierModel = {
288
- type: {
289
- name: "Composite",
290
- className: "MicrosoftTeamsUserIdentifierModel",
291
- modelProperties: {
292
- userId: {
293
- serializedName: "userId",
294
- required: true,
295
- type: {
296
- name: "String",
297
- },
298
- },
299
- isAnonymous: {
300
- serializedName: "isAnonymous",
301
- type: {
302
- name: "Boolean",
303
- },
304
- },
305
- cloud: {
306
- serializedName: "cloud",
307
- type: {
308
- name: "String",
309
- },
310
- },
311
- },
312
- },
313
- };
314
- const MicrosoftTeamsAppIdentifierModel = {
315
- type: {
316
- name: "Composite",
317
- className: "MicrosoftTeamsAppIdentifierModel",
318
- modelProperties: {
319
- appId: {
320
- serializedName: "appId",
321
- required: true,
322
- type: {
323
- name: "String",
324
- },
325
- },
326
- cloud: {
327
- serializedName: "cloud",
328
- type: {
329
- name: "String",
330
- },
331
- },
332
- },
333
- },
334
- };
335
- const CommunicationErrorResponse = {
336
- type: {
337
- name: "Composite",
338
- className: "CommunicationErrorResponse",
339
- modelProperties: {
340
- error: {
341
- serializedName: "error",
342
- type: {
343
- name: "Composite",
344
- className: "ChatError",
345
- },
346
- },
347
- },
348
- },
349
- };
350
- const ChatError = {
351
- type: {
352
- name: "Composite",
353
- className: "ChatError",
354
- modelProperties: {
355
- code: {
356
- serializedName: "code",
357
- required: true,
358
- type: {
359
- name: "String",
360
- },
361
- },
362
- message: {
363
- serializedName: "message",
364
- required: true,
365
- type: {
366
- name: "String",
367
- },
368
- },
369
- target: {
370
- serializedName: "target",
371
- readOnly: true,
372
- type: {
373
- name: "String",
374
- },
375
- },
376
- details: {
377
- serializedName: "details",
378
- readOnly: true,
379
- type: {
380
- name: "Sequence",
381
- element: {
382
- type: {
383
- name: "Composite",
384
- className: "ChatError",
385
- },
386
- },
387
- },
388
- },
389
- innerError: {
390
- serializedName: "innererror",
391
- type: {
392
- name: "Composite",
393
- className: "ChatError",
394
- },
395
- },
396
- },
397
- },
398
- };
399
- const SendReadReceiptRequest = {
400
- type: {
401
- name: "Composite",
402
- className: "SendReadReceiptRequest",
403
- modelProperties: {
404
- chatMessageId: {
405
- serializedName: "chatMessageId",
406
- required: true,
407
- type: {
408
- name: "String",
409
- },
410
- },
411
- },
412
- },
413
- };
414
- const SendChatMessageRequest = {
415
- type: {
416
- name: "Composite",
417
- className: "SendChatMessageRequest",
418
- modelProperties: {
419
- content: {
420
- serializedName: "content",
421
- required: true,
422
- type: {
423
- name: "String",
424
- },
425
- },
426
- senderDisplayName: {
427
- serializedName: "senderDisplayName",
428
- type: {
429
- name: "String",
430
- },
431
- },
432
- type: {
433
- serializedName: "type",
434
- type: {
435
- name: "Enum",
436
- allowedValues: [
437
- "text",
438
- "html",
439
- "topicUpdated",
440
- "participantAdded",
441
- "participantRemoved",
442
- ],
443
- },
444
- },
445
- metadata: {
446
- serializedName: "metadata",
447
- type: {
448
- name: "Dictionary",
449
- value: { type: { name: "String" } },
450
- },
451
- },
452
- },
453
- },
454
- };
455
- const SendChatMessageResult = {
456
- type: {
457
- name: "Composite",
458
- className: "SendChatMessageResult",
459
- modelProperties: {
460
- id: {
461
- serializedName: "id",
462
- required: true,
463
- type: {
464
- name: "String",
465
- },
466
- },
467
- },
468
- },
469
- };
470
- const ChatMessagesCollection = {
471
- type: {
472
- name: "Composite",
473
- className: "ChatMessagesCollection",
474
- modelProperties: {
475
- value: {
476
- serializedName: "value",
477
- required: true,
478
- type: {
479
- name: "Sequence",
480
- element: {
481
- type: {
482
- name: "Composite",
483
- className: "ChatMessage",
484
- },
485
- },
486
- },
487
- },
488
- nextLink: {
489
- serializedName: "nextLink",
490
- readOnly: true,
491
- type: {
492
- name: "String",
493
- },
494
- },
495
- },
496
- },
497
- };
498
- const ChatMessage = {
499
- type: {
500
- name: "Composite",
501
- className: "ChatMessage",
502
- modelProperties: {
503
- id: {
504
- serializedName: "id",
505
- required: true,
506
- type: {
507
- name: "String",
508
- },
509
- },
510
- type: {
511
- serializedName: "type",
512
- required: true,
513
- type: {
514
- name: "Enum",
515
- allowedValues: [
516
- "text",
517
- "html",
518
- "topicUpdated",
519
- "participantAdded",
520
- "participantRemoved",
521
- ],
522
- },
523
- },
524
- sequenceId: {
525
- serializedName: "sequenceId",
526
- required: true,
527
- type: {
528
- name: "String",
529
- },
530
- },
531
- version: {
532
- serializedName: "version",
533
- required: true,
534
- type: {
535
- name: "String",
536
- },
537
- },
538
- content: {
539
- serializedName: "content",
540
- type: {
541
- name: "Composite",
542
- className: "ChatMessageContent",
543
- },
544
- },
545
- senderDisplayName: {
546
- serializedName: "senderDisplayName",
547
- type: {
548
- name: "String",
549
- },
550
- },
551
- createdOn: {
552
- serializedName: "createdOn",
553
- required: true,
554
- type: {
555
- name: "DateTime",
556
- },
557
- },
558
- senderCommunicationIdentifier: {
559
- serializedName: "senderCommunicationIdentifier",
560
- type: {
561
- name: "Composite",
562
- className: "CommunicationIdentifierModel",
563
- },
564
- },
565
- deletedOn: {
566
- serializedName: "deletedOn",
567
- type: {
568
- name: "DateTime",
569
- },
570
- },
571
- editedOn: {
572
- serializedName: "editedOn",
573
- type: {
574
- name: "DateTime",
575
- },
576
- },
577
- metadata: {
578
- serializedName: "metadata",
579
- type: {
580
- name: "Dictionary",
581
- value: { type: { name: "String" } },
582
- },
583
- },
584
- },
585
- },
586
- };
587
- const ChatMessageContent = {
588
- type: {
589
- name: "Composite",
590
- className: "ChatMessageContent",
591
- modelProperties: {
592
- message: {
593
- serializedName: "message",
594
- type: {
595
- name: "String",
596
- },
597
- },
598
- topic: {
599
- serializedName: "topic",
600
- type: {
601
- name: "String",
602
- },
603
- },
604
- participants: {
605
- serializedName: "participants",
606
- type: {
607
- name: "Sequence",
608
- element: {
609
- type: {
610
- name: "Composite",
611
- className: "ChatParticipant",
612
- },
613
- },
614
- },
615
- },
616
- attachments: {
617
- serializedName: "attachments",
618
- type: {
619
- name: "Sequence",
620
- element: {
621
- type: {
622
- name: "Composite",
623
- className: "ChatAttachment",
624
- },
625
- },
626
- },
627
- },
628
- initiatorCommunicationIdentifier: {
629
- serializedName: "initiatorCommunicationIdentifier",
630
- type: {
631
- name: "Composite",
632
- className: "CommunicationIdentifierModel",
633
- },
634
- },
635
- },
636
- },
637
- };
638
- const ChatParticipant = {
639
- type: {
640
- name: "Composite",
641
- className: "ChatParticipant",
642
- modelProperties: {
643
- communicationIdentifier: {
644
- serializedName: "communicationIdentifier",
645
- type: {
646
- name: "Composite",
647
- className: "CommunicationIdentifierModel",
648
- },
649
- },
650
- displayName: {
651
- serializedName: "displayName",
652
- type: {
653
- name: "String",
654
- },
655
- },
656
- shareHistoryTime: {
657
- serializedName: "shareHistoryTime",
658
- type: {
659
- name: "DateTime",
660
- },
661
- },
662
- },
663
- },
664
- };
665
- const ChatAttachment = {
666
- type: {
667
- name: "Composite",
668
- className: "ChatAttachment",
669
- modelProperties: {
670
- id: {
671
- serializedName: "id",
672
- required: true,
673
- type: {
674
- name: "String",
675
- },
676
- },
677
- attachmentType: {
678
- serializedName: "attachmentType",
679
- required: true,
680
- type: {
681
- name: "Enum",
682
- allowedValues: ["image", "file"],
683
- },
684
- },
685
- name: {
686
- serializedName: "name",
687
- type: {
688
- name: "String",
689
- },
690
- },
691
- url: {
692
- serializedName: "url",
693
- type: {
694
- name: "String",
695
- },
696
- },
697
- previewUrl: {
698
- serializedName: "previewUrl",
699
- type: {
700
- name: "String",
701
- },
702
- },
703
- },
704
- },
705
- };
706
- const UpdateChatMessageRequest = {
707
- type: {
708
- name: "Composite",
709
- className: "UpdateChatMessageRequest",
710
- modelProperties: {
711
- content: {
712
- serializedName: "content",
713
- type: {
714
- name: "String",
715
- },
716
- },
717
- metadata: {
718
- serializedName: "metadata",
719
- type: {
720
- name: "Dictionary",
721
- value: { type: { name: "String" } },
722
- },
723
- },
724
- },
725
- },
726
- };
727
- const ChatParticipantsCollection = {
728
- type: {
729
- name: "Composite",
730
- className: "ChatParticipantsCollection",
731
- modelProperties: {
732
- value: {
733
- serializedName: "value",
734
- required: true,
735
- type: {
736
- name: "Sequence",
737
- element: {
738
- type: {
739
- name: "Composite",
740
- className: "ChatParticipant",
741
- },
742
- },
743
- },
744
- },
745
- nextLink: {
746
- serializedName: "nextLink",
747
- readOnly: true,
748
- type: {
749
- name: "String",
750
- },
751
- },
752
- },
753
- },
754
- };
755
- const AddChatParticipantsRequest = {
756
- type: {
757
- name: "Composite",
758
- className: "AddChatParticipantsRequest",
759
- modelProperties: {
760
- participants: {
761
- serializedName: "participants",
762
- required: true,
763
- type: {
764
- name: "Sequence",
765
- element: {
766
- type: {
767
- name: "Composite",
768
- className: "ChatParticipant",
769
- },
770
- },
771
- },
772
- },
773
- },
774
- },
775
- };
776
- const AddChatParticipantsResult = {
777
- type: {
778
- name: "Composite",
779
- className: "AddChatParticipantsResult",
780
- modelProperties: {
781
- invalidParticipants: {
782
- serializedName: "invalidParticipants",
783
- readOnly: true,
784
- type: {
785
- name: "Sequence",
786
- element: {
787
- type: {
788
- name: "Composite",
789
- className: "ChatError",
790
- },
791
- },
792
- },
793
- },
794
- },
795
- },
796
- };
797
- const CreateChatThreadRequest = {
798
- type: {
799
- name: "Composite",
800
- className: "CreateChatThreadRequest",
801
- modelProperties: {
802
- topic: {
803
- serializedName: "topic",
804
- required: true,
805
- type: {
806
- name: "String",
807
- },
808
- },
809
- participants: {
810
- serializedName: "participants",
811
- type: {
812
- name: "Sequence",
813
- element: {
814
- type: {
815
- name: "Composite",
816
- className: "ChatParticipant",
817
- },
818
- },
819
- },
820
- },
821
- },
822
- },
823
- };
824
- const CreateChatThreadResult = {
825
- type: {
826
- name: "Composite",
827
- className: "CreateChatThreadResult",
828
- modelProperties: {
829
- chatThread: {
830
- serializedName: "chatThread",
831
- type: {
832
- name: "Composite",
833
- className: "ChatThreadProperties",
834
- },
835
- },
836
- invalidParticipants: {
837
- serializedName: "invalidParticipants",
838
- readOnly: true,
839
- type: {
840
- name: "Sequence",
841
- element: {
842
- type: {
843
- name: "Composite",
844
- className: "ChatError",
845
- },
846
- },
847
- },
848
- },
849
- },
850
- },
851
- };
852
- const ChatThreadProperties = {
853
- type: {
854
- name: "Composite",
855
- className: "ChatThreadProperties",
856
- modelProperties: {
857
- id: {
858
- serializedName: "id",
859
- required: true,
860
- type: {
861
- name: "String",
862
- },
863
- },
864
- topic: {
865
- serializedName: "topic",
866
- required: true,
867
- type: {
868
- name: "String",
869
- },
870
- },
871
- createdOn: {
872
- serializedName: "createdOn",
873
- required: true,
874
- type: {
875
- name: "DateTime",
876
- },
877
- },
878
- createdByCommunicationIdentifier: {
879
- serializedName: "createdByCommunicationIdentifier",
880
- type: {
881
- name: "Composite",
882
- className: "CommunicationIdentifierModel",
883
- },
884
- },
885
- deletedOn: {
886
- serializedName: "deletedOn",
887
- type: {
888
- name: "DateTime",
889
- },
890
- },
891
- },
892
- },
893
- };
894
- const ChatThreadsItemCollection = {
895
- type: {
896
- name: "Composite",
897
- className: "ChatThreadsItemCollection",
898
- modelProperties: {
899
- value: {
900
- serializedName: "value",
901
- required: true,
902
- type: {
903
- name: "Sequence",
904
- element: {
905
- type: {
906
- name: "Composite",
907
- className: "ChatThreadItem",
908
- },
909
- },
910
- },
911
- },
912
- nextLink: {
913
- serializedName: "nextLink",
914
- readOnly: true,
915
- type: {
916
- name: "String",
917
- },
918
- },
919
- },
920
- },
921
- };
922
- const ChatThreadItem = {
923
- type: {
924
- name: "Composite",
925
- className: "ChatThreadItem",
926
- modelProperties: {
927
- id: {
928
- serializedName: "id",
929
- required: true,
930
- type: {
931
- name: "String",
932
- },
933
- },
934
- topic: {
935
- serializedName: "topic",
936
- required: true,
937
- type: {
938
- name: "String",
939
- },
940
- },
941
- deletedOn: {
942
- serializedName: "deletedOn",
943
- type: {
944
- name: "DateTime",
945
- },
946
- },
947
- lastMessageReceivedOn: {
948
- serializedName: "lastMessageReceivedOn",
949
- readOnly: true,
950
- type: {
951
- name: "DateTime",
952
- },
953
- },
954
- },
955
- },
956
- };
957
- const UpdateChatThreadRequest = {
958
- type: {
959
- name: "Composite",
960
- className: "UpdateChatThreadRequest",
961
- modelProperties: {
962
- topic: {
963
- serializedName: "topic",
964
- type: {
965
- name: "String",
966
- },
967
- },
968
- },
969
- },
970
- };
971
- const SendTypingNotificationRequest = {
972
- type: {
973
- name: "Composite",
974
- className: "SendTypingNotificationRequest",
975
- modelProperties: {
976
- senderDisplayName: {
977
- serializedName: "senderDisplayName",
978
- type: {
979
- name: "String",
980
- },
981
- },
982
- },
983
- },
984
- };
985
-
986
- var Mappers = /*#__PURE__*/Object.freeze({
987
- __proto__: null,
988
- AddChatParticipantsRequest: AddChatParticipantsRequest,
989
- AddChatParticipantsResult: AddChatParticipantsResult,
990
- ChatAttachment: ChatAttachment,
991
- ChatError: ChatError,
992
- ChatMessage: ChatMessage,
993
- ChatMessageContent: ChatMessageContent,
994
- ChatMessageReadReceipt: ChatMessageReadReceipt,
995
- ChatMessageReadReceiptsCollection: ChatMessageReadReceiptsCollection,
996
- ChatMessagesCollection: ChatMessagesCollection,
997
- ChatParticipant: ChatParticipant,
998
- ChatParticipantsCollection: ChatParticipantsCollection,
999
- ChatThreadItem: ChatThreadItem,
1000
- ChatThreadProperties: ChatThreadProperties,
1001
- ChatThreadsItemCollection: ChatThreadsItemCollection,
1002
- CommunicationErrorResponse: CommunicationErrorResponse,
1003
- CommunicationIdentifierModel: CommunicationIdentifierModel,
1004
- CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
1005
- CreateChatThreadRequest: CreateChatThreadRequest,
1006
- CreateChatThreadResult: CreateChatThreadResult,
1007
- MicrosoftTeamsAppIdentifierModel: MicrosoftTeamsAppIdentifierModel,
1008
- MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
1009
- PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
1010
- SendChatMessageRequest: SendChatMessageRequest,
1011
- SendChatMessageResult: SendChatMessageResult,
1012
- SendReadReceiptRequest: SendReadReceiptRequest,
1013
- SendTypingNotificationRequest: SendTypingNotificationRequest,
1014
- UpdateChatMessageRequest: UpdateChatMessageRequest,
1015
- UpdateChatThreadRequest: UpdateChatThreadRequest
1016
- });
1017
-
1018
- /*
1019
- * Copyright (c) Microsoft Corporation.
1020
- * Licensed under the MIT License.
1021
- *
1022
- * Code generated by Microsoft (R) AutoRest Code Generator.
1023
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1024
- */
1025
- const accept = {
1026
- parameterPath: "accept",
1027
- mapper: {
1028
- defaultValue: "application/json",
1029
- isConstant: true,
1030
- serializedName: "Accept",
1031
- type: {
1032
- name: "String",
1033
- },
1034
- },
1035
- };
1036
- const endpoint = {
1037
- parameterPath: "endpoint",
1038
- mapper: {
1039
- serializedName: "endpoint",
1040
- required: true,
1041
- type: {
1042
- name: "String",
1043
- },
1044
- },
1045
- skipEncoding: true,
1046
- };
1047
- const chatThreadId = {
1048
- parameterPath: "chatThreadId",
1049
- mapper: {
1050
- serializedName: "chatThreadId",
1051
- required: true,
1052
- type: {
1053
- name: "String",
1054
- },
1055
- },
1056
- };
1057
- const maxPageSize = {
1058
- parameterPath: ["options", "maxPageSize"],
1059
- mapper: {
1060
- serializedName: "maxPageSize",
1061
- type: {
1062
- name: "Number",
1063
- },
1064
- },
1065
- };
1066
- const skip = {
1067
- parameterPath: ["options", "skip"],
1068
- mapper: {
1069
- serializedName: "skip",
1070
- type: {
1071
- name: "Number",
1072
- },
1073
- },
1074
- };
1075
- const apiVersion = {
1076
- parameterPath: "apiVersion",
1077
- mapper: {
1078
- defaultValue: "2024-03-07",
1079
- isConstant: true,
1080
- serializedName: "api-version",
1081
- type: {
1082
- name: "String",
1083
- },
1084
- },
1085
- };
1086
- const contentType = {
1087
- parameterPath: ["options", "contentType"],
1088
- mapper: {
1089
- defaultValue: "application/json",
1090
- isConstant: true,
1091
- serializedName: "Content-Type",
1092
- type: {
1093
- name: "String",
1094
- },
1095
- },
1096
- };
1097
- const sendReadReceiptRequest = {
1098
- parameterPath: "sendReadReceiptRequest",
1099
- mapper: SendReadReceiptRequest,
1100
- };
1101
- const sendChatMessageRequest = {
1102
- parameterPath: "sendChatMessageRequest",
1103
- mapper: SendChatMessageRequest,
1104
- };
1105
- const startTime = {
1106
- parameterPath: ["options", "startTime"],
1107
- mapper: {
1108
- serializedName: "startTime",
1109
- type: {
1110
- name: "DateTime",
1111
- },
1112
- },
1113
- };
1114
- const chatMessageId = {
1115
- parameterPath: "chatMessageId",
1116
- mapper: {
1117
- serializedName: "chatMessageId",
1118
- required: true,
1119
- type: {
1120
- name: "String",
1121
- },
1122
- },
1123
- };
1124
- const contentType1 = {
1125
- parameterPath: ["options", "contentType"],
1126
- mapper: {
1127
- defaultValue: "application/merge-patch+json",
1128
- isConstant: true,
1129
- serializedName: "Content-Type",
1130
- type: {
1131
- name: "String",
1132
- },
1133
- },
1134
- };
1135
- const updateChatMessageRequest = {
1136
- parameterPath: "updateChatMessageRequest",
1137
- mapper: UpdateChatMessageRequest,
1138
- };
1139
- const participantCommunicationIdentifier = {
1140
- parameterPath: "participantCommunicationIdentifier",
1141
- mapper: CommunicationIdentifierModel,
1142
- };
1143
- const addChatParticipantsRequest = {
1144
- parameterPath: "addChatParticipantsRequest",
1145
- mapper: AddChatParticipantsRequest,
1146
- };
1147
- const updateChatThreadRequest = {
1148
- parameterPath: "updateChatThreadRequest",
1149
- mapper: UpdateChatThreadRequest,
1150
- };
1151
- const sendTypingNotificationRequest = {
1152
- parameterPath: ["options", "sendTypingNotificationRequest"],
1153
- mapper: SendTypingNotificationRequest,
1154
- };
1155
- const nextLink = {
1156
- parameterPath: "nextLink",
1157
- mapper: {
1158
- serializedName: "nextLink",
1159
- required: true,
1160
- type: {
1161
- name: "String",
1162
- },
1163
- },
1164
- skipEncoding: true,
1165
- };
1166
- const createChatThreadRequest = {
1167
- parameterPath: "createChatThreadRequest",
1168
- mapper: CreateChatThreadRequest,
1169
- };
1170
- const repeatabilityRequestId = {
1171
- parameterPath: ["options", "repeatabilityRequestId"],
1172
- mapper: {
1173
- serializedName: "repeatability-request-id",
1174
- type: {
1175
- name: "String",
1176
- },
1177
- },
1178
- };
1179
-
1180
- /*
1181
- * Copyright (c) Microsoft Corporation.
1182
- * Licensed under the MIT License.
1183
- *
1184
- * Code generated by Microsoft (R) AutoRest Code Generator.
1185
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1186
- */
1187
- /** Class containing ChatThread operations. */
1188
- class ChatThreadImpl {
1189
- /**
1190
- * Initialize a new instance of the class ChatThread class.
1191
- * @param client Reference to the service client
1192
- */
1193
- constructor(client) {
1194
- this.client = client;
1195
- }
1196
- /**
1197
- * Gets chat message read receipts for a thread.
1198
- * @param chatThreadId Thread id to get the chat message read receipts for.
1199
- * @param options The options parameters.
1200
- */
1201
- async listChatReadReceipts(chatThreadId, options) {
1202
- return tracingClient.withSpan("ChatApiClient.listChatReadReceipts", options !== null && options !== void 0 ? options : {}, async (options) => {
1203
- return this.client.sendOperationRequest({ chatThreadId, options }, listChatReadReceiptsOperationSpec);
1204
- });
1205
- }
1206
- /**
1207
- * Sends a read receipt event to a thread, on behalf of a user.
1208
- * @param chatThreadId Thread id to send the read receipt event to.
1209
- * @param sendReadReceiptRequest Read receipt details.
1210
- * @param options The options parameters.
1211
- */
1212
- async sendChatReadReceipt(chatThreadId, sendReadReceiptRequest, options) {
1213
- return tracingClient.withSpan("ChatApiClient.sendChatReadReceipt", options !== null && options !== void 0 ? options : {}, async (options) => {
1214
- return this.client.sendOperationRequest({ chatThreadId, sendReadReceiptRequest, options }, sendChatReadReceiptOperationSpec);
1215
- });
1216
- }
1217
- /**
1218
- * Sends a message to a thread.
1219
- * @param chatThreadId The thread id to send the message to.
1220
- * @param sendChatMessageRequest Details of the message to send.
1221
- * @param options The options parameters.
1222
- */
1223
- async sendChatMessage(chatThreadId, sendChatMessageRequest, options) {
1224
- return tracingClient.withSpan("ChatApiClient.sendChatMessage", options !== null && options !== void 0 ? options : {}, async (options) => {
1225
- return this.client.sendOperationRequest({ chatThreadId, sendChatMessageRequest, options }, sendChatMessageOperationSpec);
1226
- });
1227
- }
1228
- /**
1229
- * Gets a list of messages from a thread.
1230
- * @param chatThreadId The thread id of the message.
1231
- * @param options The options parameters.
1232
- */
1233
- async listChatMessages(chatThreadId, options) {
1234
- return tracingClient.withSpan("ChatApiClient.listChatMessages", options !== null && options !== void 0 ? options : {}, async (options) => {
1235
- return this.client.sendOperationRequest({ chatThreadId, options }, listChatMessagesOperationSpec);
1236
- });
1237
- }
1238
- /**
1239
- * Gets a message by id.
1240
- * @param chatThreadId The thread id to which the message was sent.
1241
- * @param chatMessageId The message id.
1242
- * @param options The options parameters.
1243
- */
1244
- async getChatMessage(chatThreadId, chatMessageId, options) {
1245
- return tracingClient.withSpan("ChatApiClient.getChatMessage", options !== null && options !== void 0 ? options : {}, async (options) => {
1246
- return this.client.sendOperationRequest({ chatThreadId, chatMessageId, options }, getChatMessageOperationSpec);
1247
- });
1248
- }
1249
- /**
1250
- * Updates a message.
1251
- * @param chatThreadId The thread id to which the message was sent.
1252
- * @param chatMessageId The message id.
1253
- * @param updateChatMessageRequest Details of the request to update the message.
1254
- * @param options The options parameters.
1255
- */
1256
- async updateChatMessage(chatThreadId, chatMessageId, updateChatMessageRequest, options) {
1257
- return tracingClient.withSpan("ChatApiClient.updateChatMessage", options !== null && options !== void 0 ? options : {}, async (options) => {
1258
- return this.client.sendOperationRequest({ chatThreadId, chatMessageId, updateChatMessageRequest, options }, updateChatMessageOperationSpec);
1259
- });
1260
- }
1261
- /**
1262
- * Deletes a message.
1263
- * @param chatThreadId The thread id to which the message was sent.
1264
- * @param chatMessageId The message id.
1265
- * @param options The options parameters.
1266
- */
1267
- async deleteChatMessage(chatThreadId, chatMessageId, options) {
1268
- return tracingClient.withSpan("ChatApiClient.deleteChatMessage", options !== null && options !== void 0 ? options : {}, async (options) => {
1269
- return this.client.sendOperationRequest({ chatThreadId, chatMessageId, options }, deleteChatMessageOperationSpec);
1270
- });
1271
- }
1272
- /**
1273
- * Gets the participants of a thread.
1274
- * @param chatThreadId Thread id to get participants for.
1275
- * @param options The options parameters.
1276
- */
1277
- async listChatParticipants(chatThreadId, options) {
1278
- return tracingClient.withSpan("ChatApiClient.listChatParticipants", options !== null && options !== void 0 ? options : {}, async (options) => {
1279
- return this.client.sendOperationRequest({ chatThreadId, options }, listChatParticipantsOperationSpec);
1280
- });
1281
- }
1282
- /**
1283
- * Remove a participant from a thread.
1284
- * @param chatThreadId Thread id to remove the participant from.
1285
- * @param participantCommunicationIdentifier Id of the thread participant to remove from the thread.
1286
- * @param options The options parameters.
1287
- */
1288
- async removeChatParticipant(chatThreadId, participantCommunicationIdentifier, options) {
1289
- return tracingClient.withSpan("ChatApiClient.removeChatParticipant", options !== null && options !== void 0 ? options : {}, async (options) => {
1290
- return this.client.sendOperationRequest({ chatThreadId, participantCommunicationIdentifier, options }, removeChatParticipantOperationSpec);
1291
- });
1292
- }
1293
- /**
1294
- * Adds thread participants to a thread. If participants already exist, no change occurs.
1295
- * @param chatThreadId Id of the thread to add participants to.
1296
- * @param addChatParticipantsRequest Thread participants to be added to the thread.
1297
- * @param options The options parameters.
1298
- */
1299
- async addChatParticipants(chatThreadId, addChatParticipantsRequest, options) {
1300
- return tracingClient.withSpan("ChatApiClient.addChatParticipants", options !== null && options !== void 0 ? options : {}, async (options) => {
1301
- return this.client.sendOperationRequest({ chatThreadId, addChatParticipantsRequest, options }, addChatParticipantsOperationSpec);
1302
- });
1303
- }
1304
- /**
1305
- * Updates a thread's properties.
1306
- * @param chatThreadId The id of the thread to update.
1307
- * @param updateChatThreadRequest Request payload for updating a chat thread.
1308
- * @param options The options parameters.
1309
- */
1310
- async updateChatThreadProperties(chatThreadId, updateChatThreadRequest, options) {
1311
- return tracingClient.withSpan("ChatApiClient.updateChatThreadProperties", options !== null && options !== void 0 ? options : {}, async (options) => {
1312
- return this.client.sendOperationRequest({ chatThreadId, updateChatThreadRequest, options }, updateChatThreadPropertiesOperationSpec);
1313
- });
1314
- }
1315
- /**
1316
- * Gets a chat thread's properties.
1317
- * @param chatThreadId Id of the thread.
1318
- * @param options The options parameters.
1319
- */
1320
- async getChatThreadProperties(chatThreadId, options) {
1321
- return tracingClient.withSpan("ChatApiClient.getChatThreadProperties", options !== null && options !== void 0 ? options : {}, async (options) => {
1322
- return this.client.sendOperationRequest({ chatThreadId, options }, getChatThreadPropertiesOperationSpec);
1323
- });
1324
- }
1325
- /**
1326
- * Posts a typing event to a thread, on behalf of a user.
1327
- * @param chatThreadId Id of the thread.
1328
- * @param options The options parameters.
1329
- */
1330
- async sendTypingNotification(chatThreadId, options) {
1331
- return tracingClient.withSpan("ChatApiClient.sendTypingNotification", options !== null && options !== void 0 ? options : {}, async (options) => {
1332
- return this.client.sendOperationRequest({ chatThreadId, options }, sendTypingNotificationOperationSpec);
1333
- });
1334
- }
1335
- /**
1336
- * ListChatReadReceiptsNext
1337
- * @param chatThreadId Thread id to get the chat message read receipts for.
1338
- * @param nextLink The nextLink from the previous successful call to the ListChatReadReceipts method.
1339
- * @param options The options parameters.
1340
- */
1341
- async listChatReadReceiptsNext(chatThreadId, nextLink, options) {
1342
- return tracingClient.withSpan("ChatApiClient.listChatReadReceiptsNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1343
- return this.client.sendOperationRequest({ chatThreadId, nextLink, options }, listChatReadReceiptsNextOperationSpec);
1344
- });
1345
- }
1346
- /**
1347
- * ListChatMessagesNext
1348
- * @param chatThreadId The thread id of the message.
1349
- * @param nextLink The nextLink from the previous successful call to the ListChatMessages method.
1350
- * @param options The options parameters.
1351
- */
1352
- async listChatMessagesNext(chatThreadId, nextLink, options) {
1353
- return tracingClient.withSpan("ChatApiClient.listChatMessagesNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1354
- return this.client.sendOperationRequest({ chatThreadId, nextLink, options }, listChatMessagesNextOperationSpec);
1355
- });
1356
- }
1357
- /**
1358
- * ListChatParticipantsNext
1359
- * @param chatThreadId Thread id to get participants for.
1360
- * @param nextLink The nextLink from the previous successful call to the ListChatParticipants method.
1361
- * @param options The options parameters.
1362
- */
1363
- async listChatParticipantsNext(chatThreadId, nextLink, options) {
1364
- return tracingClient.withSpan("ChatApiClient.listChatParticipantsNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1365
- return this.client.sendOperationRequest({ chatThreadId, nextLink, options }, listChatParticipantsNextOperationSpec);
1366
- });
1367
- }
1368
- }
1369
- // Operation Specifications
1370
- const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1371
- const listChatReadReceiptsOperationSpec = {
1372
- path: "/chat/threads/{chatThreadId}/readReceipts",
1373
- httpMethod: "GET",
1374
- responses: {
1375
- 200: {
1376
- bodyMapper: ChatMessageReadReceiptsCollection,
1377
- },
1378
- 401: {
1379
- bodyMapper: CommunicationErrorResponse,
1380
- isError: true,
1381
- },
1382
- 403: {
1383
- bodyMapper: CommunicationErrorResponse,
1384
- isError: true,
1385
- },
1386
- 429: {
1387
- bodyMapper: CommunicationErrorResponse,
1388
- isError: true,
1389
- },
1390
- 503: {
1391
- bodyMapper: CommunicationErrorResponse,
1392
- isError: true,
1393
- },
1394
- },
1395
- queryParameters: [
1396
- maxPageSize,
1397
- skip,
1398
- apiVersion,
1399
- ],
1400
- urlParameters: [endpoint, chatThreadId],
1401
- headerParameters: [accept],
1402
- serializer: serializer$1,
1403
- };
1404
- const sendChatReadReceiptOperationSpec = {
1405
- path: "/chat/threads/{chatThreadId}/readReceipts",
1406
- httpMethod: "POST",
1407
- responses: {
1408
- 200: {},
1409
- 401: {
1410
- bodyMapper: CommunicationErrorResponse,
1411
- isError: true,
1412
- },
1413
- 403: {
1414
- bodyMapper: CommunicationErrorResponse,
1415
- isError: true,
1416
- },
1417
- 429: {
1418
- bodyMapper: CommunicationErrorResponse,
1419
- isError: true,
1420
- },
1421
- 503: {
1422
- bodyMapper: CommunicationErrorResponse,
1423
- isError: true,
1424
- },
1425
- },
1426
- requestBody: sendReadReceiptRequest,
1427
- queryParameters: [apiVersion],
1428
- urlParameters: [endpoint, chatThreadId],
1429
- headerParameters: [accept, contentType],
1430
- mediaType: "json",
1431
- serializer: serializer$1,
1432
- };
1433
- const sendChatMessageOperationSpec = {
1434
- path: "/chat/threads/{chatThreadId}/messages",
1435
- httpMethod: "POST",
1436
- responses: {
1437
- 201: {
1438
- bodyMapper: SendChatMessageResult,
1439
- },
1440
- 401: {
1441
- bodyMapper: CommunicationErrorResponse,
1442
- isError: true,
1443
- },
1444
- 403: {
1445
- bodyMapper: CommunicationErrorResponse,
1446
- isError: true,
1447
- },
1448
- 429: {
1449
- bodyMapper: CommunicationErrorResponse,
1450
- isError: true,
1451
- },
1452
- 503: {
1453
- bodyMapper: CommunicationErrorResponse,
1454
- isError: true,
1455
- },
1456
- },
1457
- requestBody: sendChatMessageRequest,
1458
- queryParameters: [apiVersion],
1459
- urlParameters: [endpoint, chatThreadId],
1460
- headerParameters: [accept, contentType],
1461
- mediaType: "json",
1462
- serializer: serializer$1,
1463
- };
1464
- const listChatMessagesOperationSpec = {
1465
- path: "/chat/threads/{chatThreadId}/messages",
1466
- httpMethod: "GET",
1467
- responses: {
1468
- 200: {
1469
- bodyMapper: ChatMessagesCollection,
1470
- },
1471
- 401: {
1472
- bodyMapper: CommunicationErrorResponse,
1473
- isError: true,
1474
- },
1475
- 403: {
1476
- bodyMapper: CommunicationErrorResponse,
1477
- isError: true,
1478
- },
1479
- 429: {
1480
- bodyMapper: CommunicationErrorResponse,
1481
- isError: true,
1482
- },
1483
- 503: {
1484
- bodyMapper: CommunicationErrorResponse,
1485
- isError: true,
1486
- },
1487
- },
1488
- queryParameters: [
1489
- maxPageSize,
1490
- apiVersion,
1491
- startTime,
1492
- ],
1493
- urlParameters: [endpoint, chatThreadId],
1494
- headerParameters: [accept],
1495
- serializer: serializer$1,
1496
- };
1497
- const getChatMessageOperationSpec = {
1498
- path: "/chat/threads/{chatThreadId}/messages/{chatMessageId}",
1499
- httpMethod: "GET",
1500
- responses: {
1501
- 200: {
1502
- bodyMapper: ChatMessage,
1503
- },
1504
- 401: {
1505
- bodyMapper: CommunicationErrorResponse,
1506
- isError: true,
1507
- },
1508
- 403: {
1509
- bodyMapper: CommunicationErrorResponse,
1510
- isError: true,
1511
- },
1512
- 429: {
1513
- bodyMapper: CommunicationErrorResponse,
1514
- isError: true,
1515
- },
1516
- 503: {
1517
- bodyMapper: CommunicationErrorResponse,
1518
- isError: true,
1519
- },
1520
- },
1521
- queryParameters: [apiVersion],
1522
- urlParameters: [
1523
- endpoint,
1524
- chatThreadId,
1525
- chatMessageId,
1526
- ],
1527
- headerParameters: [accept],
1528
- serializer: serializer$1,
1529
- };
1530
- const updateChatMessageOperationSpec = {
1531
- path: "/chat/threads/{chatThreadId}/messages/{chatMessageId}",
1532
- httpMethod: "PATCH",
1533
- responses: {
1534
- 204: {},
1535
- 401: {
1536
- bodyMapper: CommunicationErrorResponse,
1537
- isError: true,
1538
- },
1539
- 403: {
1540
- bodyMapper: CommunicationErrorResponse,
1541
- isError: true,
1542
- },
1543
- 429: {
1544
- bodyMapper: CommunicationErrorResponse,
1545
- isError: true,
1546
- },
1547
- 503: {
1548
- bodyMapper: CommunicationErrorResponse,
1549
- isError: true,
1550
- },
1551
- },
1552
- requestBody: updateChatMessageRequest,
1553
- queryParameters: [apiVersion],
1554
- urlParameters: [
1555
- endpoint,
1556
- chatThreadId,
1557
- chatMessageId,
1558
- ],
1559
- headerParameters: [accept, contentType1],
1560
- mediaType: "json",
1561
- serializer: serializer$1,
1562
- };
1563
- const deleteChatMessageOperationSpec = {
1564
- path: "/chat/threads/{chatThreadId}/messages/{chatMessageId}",
1565
- httpMethod: "DELETE",
1566
- responses: {
1567
- 204: {},
1568
- 401: {
1569
- bodyMapper: CommunicationErrorResponse,
1570
- isError: true,
1571
- },
1572
- 403: {
1573
- bodyMapper: CommunicationErrorResponse,
1574
- isError: true,
1575
- },
1576
- 429: {
1577
- bodyMapper: CommunicationErrorResponse,
1578
- isError: true,
1579
- },
1580
- 503: {
1581
- bodyMapper: CommunicationErrorResponse,
1582
- isError: true,
1583
- },
1584
- },
1585
- queryParameters: [apiVersion],
1586
- urlParameters: [
1587
- endpoint,
1588
- chatThreadId,
1589
- chatMessageId,
1590
- ],
1591
- headerParameters: [accept],
1592
- serializer: serializer$1,
1593
- };
1594
- const listChatParticipantsOperationSpec = {
1595
- path: "/chat/threads/{chatThreadId}/participants",
1596
- httpMethod: "GET",
1597
- responses: {
1598
- 200: {
1599
- bodyMapper: ChatParticipantsCollection,
1600
- },
1601
- 401: {
1602
- bodyMapper: CommunicationErrorResponse,
1603
- isError: true,
1604
- },
1605
- 403: {
1606
- bodyMapper: CommunicationErrorResponse,
1607
- isError: true,
1608
- },
1609
- 429: {
1610
- bodyMapper: CommunicationErrorResponse,
1611
- isError: true,
1612
- },
1613
- 503: {
1614
- bodyMapper: CommunicationErrorResponse,
1615
- isError: true,
1616
- },
1617
- },
1618
- queryParameters: [
1619
- maxPageSize,
1620
- skip,
1621
- apiVersion,
1622
- ],
1623
- urlParameters: [endpoint, chatThreadId],
1624
- headerParameters: [accept],
1625
- serializer: serializer$1,
1626
- };
1627
- const removeChatParticipantOperationSpec = {
1628
- path: "/chat/threads/{chatThreadId}/participants/:remove",
1629
- httpMethod: "POST",
1630
- responses: {
1631
- 204: {},
1632
- 401: {
1633
- bodyMapper: CommunicationErrorResponse,
1634
- isError: true,
1635
- },
1636
- 403: {
1637
- bodyMapper: CommunicationErrorResponse,
1638
- isError: true,
1639
- },
1640
- 429: {
1641
- bodyMapper: CommunicationErrorResponse,
1642
- isError: true,
1643
- },
1644
- 503: {
1645
- bodyMapper: CommunicationErrorResponse,
1646
- isError: true,
1647
- },
1648
- },
1649
- requestBody: participantCommunicationIdentifier,
1650
- queryParameters: [apiVersion],
1651
- urlParameters: [endpoint, chatThreadId],
1652
- headerParameters: [accept, contentType],
1653
- mediaType: "json",
1654
- serializer: serializer$1,
1655
- };
1656
- const addChatParticipantsOperationSpec = {
1657
- path: "/chat/threads/{chatThreadId}/participants/:add",
1658
- httpMethod: "POST",
1659
- responses: {
1660
- 201: {
1661
- bodyMapper: AddChatParticipantsResult,
1662
- },
1663
- 401: {
1664
- bodyMapper: CommunicationErrorResponse,
1665
- isError: true,
1666
- },
1667
- 403: {
1668
- bodyMapper: CommunicationErrorResponse,
1669
- isError: true,
1670
- },
1671
- 429: {
1672
- bodyMapper: CommunicationErrorResponse,
1673
- isError: true,
1674
- },
1675
- 503: {
1676
- bodyMapper: CommunicationErrorResponse,
1677
- isError: true,
1678
- },
1679
- },
1680
- requestBody: addChatParticipantsRequest,
1681
- queryParameters: [apiVersion],
1682
- urlParameters: [endpoint, chatThreadId],
1683
- headerParameters: [accept, contentType],
1684
- mediaType: "json",
1685
- serializer: serializer$1,
1686
- };
1687
- const updateChatThreadPropertiesOperationSpec = {
1688
- path: "/chat/threads/{chatThreadId}",
1689
- httpMethod: "PATCH",
1690
- responses: {
1691
- 204: {},
1692
- 401: {
1693
- bodyMapper: CommunicationErrorResponse,
1694
- isError: true,
1695
- },
1696
- 403: {
1697
- bodyMapper: CommunicationErrorResponse,
1698
- isError: true,
1699
- },
1700
- 429: {
1701
- bodyMapper: CommunicationErrorResponse,
1702
- isError: true,
1703
- },
1704
- 503: {
1705
- bodyMapper: CommunicationErrorResponse,
1706
- isError: true,
1707
- },
1708
- },
1709
- requestBody: updateChatThreadRequest,
1710
- queryParameters: [apiVersion],
1711
- urlParameters: [endpoint, chatThreadId],
1712
- headerParameters: [accept, contentType1],
1713
- mediaType: "json",
1714
- serializer: serializer$1,
1715
- };
1716
- const getChatThreadPropertiesOperationSpec = {
1717
- path: "/chat/threads/{chatThreadId}",
1718
- httpMethod: "GET",
1719
- responses: {
1720
- 200: {
1721
- bodyMapper: ChatThreadProperties,
1722
- },
1723
- 401: {
1724
- bodyMapper: CommunicationErrorResponse,
1725
- isError: true,
1726
- },
1727
- 403: {
1728
- bodyMapper: CommunicationErrorResponse,
1729
- isError: true,
1730
- },
1731
- 429: {
1732
- bodyMapper: CommunicationErrorResponse,
1733
- isError: true,
1734
- },
1735
- 503: {
1736
- bodyMapper: CommunicationErrorResponse,
1737
- isError: true,
1738
- },
1739
- },
1740
- queryParameters: [apiVersion],
1741
- urlParameters: [endpoint, chatThreadId],
1742
- headerParameters: [accept],
1743
- serializer: serializer$1,
1744
- };
1745
- const sendTypingNotificationOperationSpec = {
1746
- path: "/chat/threads/{chatThreadId}/typing",
1747
- httpMethod: "POST",
1748
- responses: {
1749
- 200: {},
1750
- 401: {
1751
- bodyMapper: CommunicationErrorResponse,
1752
- isError: true,
1753
- },
1754
- 403: {
1755
- bodyMapper: CommunicationErrorResponse,
1756
- isError: true,
1757
- },
1758
- 429: {
1759
- bodyMapper: CommunicationErrorResponse,
1760
- isError: true,
1761
- },
1762
- 503: {
1763
- bodyMapper: CommunicationErrorResponse,
1764
- isError: true,
1765
- },
1766
- },
1767
- requestBody: sendTypingNotificationRequest,
1768
- queryParameters: [apiVersion],
1769
- urlParameters: [endpoint, chatThreadId],
1770
- headerParameters: [accept, contentType],
1771
- mediaType: "json",
1772
- serializer: serializer$1,
1773
- };
1774
- const listChatReadReceiptsNextOperationSpec = {
1775
- path: "{nextLink}",
1776
- httpMethod: "GET",
1777
- responses: {
1778
- 200: {
1779
- bodyMapper: ChatMessageReadReceiptsCollection,
1780
- },
1781
- 401: {
1782
- bodyMapper: CommunicationErrorResponse,
1783
- isError: true,
1784
- },
1785
- 403: {
1786
- bodyMapper: CommunicationErrorResponse,
1787
- isError: true,
1788
- },
1789
- 429: {
1790
- bodyMapper: CommunicationErrorResponse,
1791
- isError: true,
1792
- },
1793
- 503: {
1794
- bodyMapper: CommunicationErrorResponse,
1795
- isError: true,
1796
- },
1797
- },
1798
- urlParameters: [
1799
- endpoint,
1800
- chatThreadId,
1801
- nextLink,
1802
- ],
1803
- headerParameters: [accept],
1804
- serializer: serializer$1,
1805
- };
1806
- const listChatMessagesNextOperationSpec = {
1807
- path: "{nextLink}",
1808
- httpMethod: "GET",
1809
- responses: {
1810
- 200: {
1811
- bodyMapper: ChatMessagesCollection,
1812
- },
1813
- 401: {
1814
- bodyMapper: CommunicationErrorResponse,
1815
- isError: true,
1816
- },
1817
- 403: {
1818
- bodyMapper: CommunicationErrorResponse,
1819
- isError: true,
1820
- },
1821
- 429: {
1822
- bodyMapper: CommunicationErrorResponse,
1823
- isError: true,
1824
- },
1825
- 503: {
1826
- bodyMapper: CommunicationErrorResponse,
1827
- isError: true,
1828
- },
1829
- },
1830
- urlParameters: [
1831
- endpoint,
1832
- chatThreadId,
1833
- nextLink,
1834
- ],
1835
- headerParameters: [accept],
1836
- serializer: serializer$1,
1837
- };
1838
- const listChatParticipantsNextOperationSpec = {
1839
- path: "{nextLink}",
1840
- httpMethod: "GET",
1841
- responses: {
1842
- 200: {
1843
- bodyMapper: ChatParticipantsCollection,
1844
- },
1845
- 401: {
1846
- bodyMapper: CommunicationErrorResponse,
1847
- isError: true,
1848
- },
1849
- 403: {
1850
- bodyMapper: CommunicationErrorResponse,
1851
- isError: true,
1852
- },
1853
- 429: {
1854
- bodyMapper: CommunicationErrorResponse,
1855
- isError: true,
1856
- },
1857
- 503: {
1858
- bodyMapper: CommunicationErrorResponse,
1859
- isError: true,
1860
- },
1861
- },
1862
- urlParameters: [
1863
- endpoint,
1864
- chatThreadId,
1865
- nextLink,
1866
- ],
1867
- headerParameters: [accept],
1868
- serializer: serializer$1,
1869
- };
1870
-
1871
- /*
1872
- * Copyright (c) Microsoft Corporation.
1873
- * Licensed under the MIT License.
1874
- *
1875
- * Code generated by Microsoft (R) AutoRest Code Generator.
1876
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1877
- */
1878
- /** Class containing Chat operations. */
1879
- class ChatImpl {
1880
- /**
1881
- * Initialize a new instance of the class Chat class.
1882
- * @param client Reference to the service client
1883
- */
1884
- constructor(client) {
1885
- this.client = client;
1886
- }
1887
- /**
1888
- * Creates a chat thread.
1889
- * @param createChatThreadRequest Request payload for creating a chat thread.
1890
- * @param options The options parameters.
1891
- */
1892
- async createChatThread(createChatThreadRequest, options) {
1893
- return tracingClient.withSpan("ChatApiClient.createChatThread", options !== null && options !== void 0 ? options : {}, async (options) => {
1894
- return this.client.sendOperationRequest({ createChatThreadRequest, options }, createChatThreadOperationSpec);
1895
- });
1896
- }
1897
- /**
1898
- * Gets the list of chat threads of a user.
1899
- * @param options The options parameters.
1900
- */
1901
- async listChatThreads(options) {
1902
- return tracingClient.withSpan("ChatApiClient.listChatThreads", options !== null && options !== void 0 ? options : {}, async (options) => {
1903
- return this.client.sendOperationRequest({ options }, listChatThreadsOperationSpec);
1904
- });
1905
- }
1906
- /**
1907
- * Deletes a thread.
1908
- * @param chatThreadId Id of the thread to be deleted.
1909
- * @param options The options parameters.
1910
- */
1911
- async deleteChatThread(chatThreadId, options) {
1912
- return tracingClient.withSpan("ChatApiClient.deleteChatThread", options !== null && options !== void 0 ? options : {}, async (options) => {
1913
- return this.client.sendOperationRequest({ chatThreadId, options }, deleteChatThreadOperationSpec);
1914
- });
1915
- }
1916
- /**
1917
- * ListChatThreadsNext
1918
- * @param nextLink The nextLink from the previous successful call to the ListChatThreads method.
1919
- * @param options The options parameters.
1920
- */
1921
- async listChatThreadsNext(nextLink, options) {
1922
- return tracingClient.withSpan("ChatApiClient.listChatThreadsNext", options !== null && options !== void 0 ? options : {}, async (options) => {
1923
- return this.client.sendOperationRequest({ nextLink, options }, listChatThreadsNextOperationSpec);
1924
- });
1925
- }
1926
- }
1927
- // Operation Specifications
1928
- const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1929
- const createChatThreadOperationSpec = {
1930
- path: "/chat/threads",
1931
- httpMethod: "POST",
1932
- responses: {
1933
- 201: {
1934
- bodyMapper: CreateChatThreadResult,
1935
- },
1936
- 401: {
1937
- bodyMapper: CommunicationErrorResponse,
1938
- isError: true,
1939
- },
1940
- 403: {
1941
- bodyMapper: CommunicationErrorResponse,
1942
- isError: true,
1943
- },
1944
- 429: {
1945
- bodyMapper: CommunicationErrorResponse,
1946
- isError: true,
1947
- },
1948
- 503: {
1949
- bodyMapper: CommunicationErrorResponse,
1950
- isError: true,
1951
- },
1952
- },
1953
- requestBody: createChatThreadRequest,
1954
- queryParameters: [apiVersion],
1955
- urlParameters: [endpoint],
1956
- headerParameters: [
1957
- accept,
1958
- contentType,
1959
- repeatabilityRequestId,
1960
- ],
1961
- mediaType: "json",
1962
- serializer,
1963
- };
1964
- const listChatThreadsOperationSpec = {
1965
- path: "/chat/threads",
1966
- httpMethod: "GET",
1967
- responses: {
1968
- 200: {
1969
- bodyMapper: ChatThreadsItemCollection,
1970
- },
1971
- 401: {
1972
- bodyMapper: CommunicationErrorResponse,
1973
- isError: true,
1974
- },
1975
- 403: {
1976
- bodyMapper: CommunicationErrorResponse,
1977
- isError: true,
1978
- },
1979
- 429: {
1980
- bodyMapper: CommunicationErrorResponse,
1981
- isError: true,
1982
- },
1983
- 503: {
1984
- bodyMapper: CommunicationErrorResponse,
1985
- isError: true,
1986
- },
1987
- },
1988
- queryParameters: [
1989
- maxPageSize,
1990
- apiVersion,
1991
- startTime,
1992
- ],
1993
- urlParameters: [endpoint],
1994
- headerParameters: [accept],
1995
- serializer,
1996
- };
1997
- const deleteChatThreadOperationSpec = {
1998
- path: "/chat/threads/{chatThreadId}",
1999
- httpMethod: "DELETE",
2000
- responses: {
2001
- 204: {},
2002
- 401: {
2003
- bodyMapper: CommunicationErrorResponse,
2004
- isError: true,
2005
- },
2006
- 403: {
2007
- bodyMapper: CommunicationErrorResponse,
2008
- isError: true,
2009
- },
2010
- 429: {
2011
- bodyMapper: CommunicationErrorResponse,
2012
- isError: true,
2013
- },
2014
- 503: {
2015
- bodyMapper: CommunicationErrorResponse,
2016
- isError: true,
2017
- },
2018
- },
2019
- queryParameters: [apiVersion],
2020
- urlParameters: [endpoint, chatThreadId],
2021
- headerParameters: [accept],
2022
- serializer,
2023
- };
2024
- const listChatThreadsNextOperationSpec = {
2025
- path: "{nextLink}",
2026
- httpMethod: "GET",
2027
- responses: {
2028
- 200: {
2029
- bodyMapper: ChatThreadsItemCollection,
2030
- },
2031
- 401: {
2032
- bodyMapper: CommunicationErrorResponse,
2033
- isError: true,
2034
- },
2035
- 403: {
2036
- bodyMapper: CommunicationErrorResponse,
2037
- isError: true,
2038
- },
2039
- 429: {
2040
- bodyMapper: CommunicationErrorResponse,
2041
- isError: true,
2042
- },
2043
- 503: {
2044
- bodyMapper: CommunicationErrorResponse,
2045
- isError: true,
2046
- },
2047
- },
2048
- urlParameters: [endpoint, nextLink],
2049
- headerParameters: [accept],
2050
- serializer,
2051
- };
2052
-
2053
- /*
2054
- * Copyright (c) Microsoft Corporation.
2055
- * Licensed under the MIT License.
2056
- *
2057
- * Code generated by Microsoft (R) AutoRest Code Generator.
2058
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
2059
- */
2060
- class ChatApiClient extends coreClient__namespace.ServiceClient {
2061
- /**
2062
- * Initializes a new instance of the ChatApiClient class.
2063
- * @param endpoint The endpoint of the Azure Communication resource.
2064
- * @param options The parameter options
2065
- */
2066
- constructor(endpoint, options) {
2067
- var _a, _b;
2068
- if (endpoint === undefined) {
2069
- throw new Error("'endpoint' cannot be null");
2070
- }
2071
- // Initializing default values for options
2072
- if (!options) {
2073
- options = {};
2074
- }
2075
- const defaults = {
2076
- requestContentType: "application/json; charset=utf-8",
2077
- };
2078
- const packageDetails = `azsdk-js-communication-chat/1.5.0`;
2079
- const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2080
- ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2081
- : `${packageDetails}`;
2082
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2083
- userAgentPrefix,
2084
- }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
2085
- super(optionsWithDefaults);
2086
- // Parameter assignments
2087
- this.endpoint = endpoint;
2088
- // Assigning values to Constant parameters
2089
- this.apiVersion = options.apiVersion || "2024-03-07";
2090
- this.chatThread = new ChatThreadImpl(this);
2091
- this.chat = new ChatImpl(this);
2092
- this.addCustomApiVersionPolicy(options.apiVersion);
2093
- }
2094
- /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
2095
- addCustomApiVersionPolicy(apiVersion) {
2096
- if (!apiVersion) {
2097
- return;
2098
- }
2099
- const apiVersionPolicy = {
2100
- name: "CustomApiVersionPolicy",
2101
- async sendRequest(request, next) {
2102
- const param = request.url.split("?");
2103
- if (param.length > 1) {
2104
- const newParams = param[1].split("&").map((item) => {
2105
- if (item.indexOf("api-version") > -1) {
2106
- return "api-version=" + apiVersion;
2107
- }
2108
- else {
2109
- return item;
2110
- }
2111
- });
2112
- request.url = param[0] + "?" + newParams.join("&");
2113
- }
2114
- return next(request);
2115
- },
2116
- };
2117
- this.pipeline.addPolicy(apiVersionPolicy);
2118
- }
2119
- }
2120
-
2121
- // Copyright (c) Microsoft Corporation.
2122
- // Licensed under the MIT license.
2123
- const logger = logger$1.createClientLogger("communication-chat");
2124
-
2125
- // Copyright (c) Microsoft Corporation.
2126
- // Licensed under the MIT license.
2127
- /**
2128
- * Creates a new CommunicationTokenCredentialPolicy factory.
2129
- *
2130
- * @param credential - The CommunicationTokenCredential implementation that can supply the user credential.
2131
- */
2132
- const createCommunicationTokenCredentialPolicy = (credential) => {
2133
- const policyOptions = {
2134
- credential: {
2135
- getToken: (_scopes, options) => credential.getToken({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal }),
2136
- },
2137
- scopes: [],
2138
- };
2139
- return coreRestPipeline.bearerTokenAuthenticationPolicy(policyOptions);
2140
- };
2141
-
2142
- // Copyright (c) Microsoft Corporation.
2143
- // Licensed under the MIT license.
2144
- const minimumTypingIntervalInMilliSeconds = 8000;
2145
- /**
2146
- * The client to do chat operations
2147
- */
2148
- class ChatThreadClient {
2149
- constructor(endpoint, threadId, credential, options = {}) {
2150
- this.endpoint = endpoint;
2151
- this.timeOfLastTypingRequest = undefined;
2152
- this.threadId = threadId;
2153
- this.tokenCredential = credential;
2154
- const internalPipelineOptions = Object.assign(Object.assign({}, options), {
2155
- loggingOptions: {
2156
- logger: logger.info,
2157
- },
2158
- });
2159
- this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
2160
- const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
2161
- this.client.pipeline.addPolicy(authPolicy);
2162
- }
2163
- /**
2164
- * Gets a chat thread.
2165
- * Returns the chat thread.
2166
- * @param options - Operation options.
2167
- */
2168
- getProperties(options = {}) {
2169
- return tracingClient.withSpan("ChatClient-GetProperties", options, async (updatedOptions) => {
2170
- const result = await this.client.chatThread.getChatThreadProperties(this.threadId, updatedOptions);
2171
- return mapToChatThreadPropertiesSdkModel(result);
2172
- });
2173
- }
2174
- /**
2175
- * Updates a thread's topic.
2176
- * @param topic - The topic needs to be updated to.
2177
- * @param options - Operation options.
2178
- */
2179
- updateTopic(topic, options = {}) {
2180
- return tracingClient.withSpan("ChatThreadClient-UpdateTopic", options, async (updatedOptions) => {
2181
- await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
2182
- });
2183
- }
2184
- /**
2185
- * Sends a chat message to a thread identified by threadId.
2186
- * Returns the id of the created message.
2187
- * @param request - Request for sending a message.
2188
- * @param options - Operation options.
2189
- */
2190
- sendMessage(request, options = {}) {
2191
- return tracingClient.withSpan("ChatThreadClient-SendMessage", options, async (updatedOptions) => {
2192
- // reset typing notification clock
2193
- this.timeOfLastTypingRequest = undefined;
2194
- const result = await this.client.chatThread.sendChatMessage(this.threadId, Object.assign(Object.assign({}, request), options), updatedOptions);
2195
- return result;
2196
- });
2197
- }
2198
- /**
2199
- * Gets a chat message identified by messageId.
2200
- * Returns the specific message.
2201
- * @param messageId - The message id of the message.
2202
- * @param options - Operation options.
2203
- */
2204
- getMessage(messageId, options = {}) {
2205
- return tracingClient.withSpan("ChatThreadClient-GetMessage", options, async (updatedOptions) => {
2206
- const result = await this.client.chatThread.getChatMessage(this.threadId, messageId, updatedOptions);
2207
- return mapToChatMessageSdkModel(result);
2208
- });
2209
- }
2210
- listMessagesPage(pageSettings_1) {
2211
- return tslib.__asyncGenerator(this, arguments, function* listMessagesPage_1(pageSettings, options = {}) {
2212
- if (!pageSettings.continuationToken) {
2213
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatMessages(this.threadId, options));
2214
- pageSettings.continuationToken = currentSetResponse.nextLink;
2215
- if (currentSetResponse.value) {
2216
- yield yield tslib.__await(currentSetResponse.value.map(mapToChatMessageSdkModel, this));
2217
- }
2218
- }
2219
- while (pageSettings.continuationToken) {
2220
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatMessagesNext(this.threadId, pageSettings.continuationToken, options));
2221
- pageSettings.continuationToken = currentSetResponse.nextLink;
2222
- if (currentSetResponse.value) {
2223
- yield yield tslib.__await(currentSetResponse.value.map(mapToChatMessageSdkModel, this));
2224
- }
2225
- else {
2226
- break;
2227
- }
2228
- }
2229
- });
2230
- }
2231
- listMessagesAll(options) {
2232
- return tslib.__asyncGenerator(this, arguments, function* listMessagesAll_1() {
2233
- var _a, e_1, _b, _c;
2234
- try {
2235
- for (var _d = true, _e = tslib.__asyncValues(this.listMessagesPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
2236
- _c = _f.value;
2237
- _d = false;
2238
- const page = _c;
2239
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
2240
- }
2241
- }
2242
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2243
- finally {
2244
- try {
2245
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
2246
- }
2247
- finally { if (e_1) throw e_1.error; }
2248
- }
2249
- });
2250
- }
2251
- /**
2252
- * Gets a list of message from a thread identified by threadId.
2253
- * Returns the list of the messages.
2254
- * @param options - Get messages options.
2255
- */
2256
- listMessages(options = {}) {
2257
- const { span, updatedOptions } = tracingClient.startSpan("ChatThreadClient-ListMessages", options);
2258
- try {
2259
- const iter = this.listMessagesAll(updatedOptions);
2260
- return {
2261
- next() {
2262
- return iter.next();
2263
- },
2264
- [Symbol.asyncIterator]() {
2265
- return this;
2266
- },
2267
- byPage: (settings = {}) => {
2268
- return this.listMessagesPage(settings, updatedOptions);
2269
- },
2270
- };
2271
- }
2272
- catch (e) {
2273
- span.setStatus({
2274
- status: "error",
2275
- error: e,
2276
- });
2277
- throw e;
2278
- }
2279
- finally {
2280
- span.end();
2281
- }
2282
- }
2283
- /**
2284
- * Deletes a message identified by threadId and messageId
2285
- * @param messageId - The message id of the message.
2286
- * @param options - Operation options.
2287
- */
2288
- deleteMessage(messageId, options = {}) {
2289
- return tracingClient.withSpan("ChatThreadClient-DeleteMessage", options, async (updatedOptions) => {
2290
- await this.client.chatThread.deleteChatMessage(this.threadId, messageId, updatedOptions);
2291
- });
2292
- }
2293
- /**
2294
- * Updates a message identified by threadId and messageId
2295
- * @param messageId - The message id of the message.
2296
- * @param options - Operation options.
2297
- */
2298
- async updateMessage(messageId, options = {}) {
2299
- return tracingClient.withSpan("ChatThreadClient-UpdateMessage", options, async (updatedOptions) => {
2300
- await this.client.chatThread.updateChatMessage(this.threadId, messageId, options, updatedOptions);
2301
- });
2302
- }
2303
- /**
2304
- * Adds the details of chat participants belonging to the thread identified by threadId.
2305
- * @param request - Thread participants' details to add in the thread roster
2306
- * @param options - Operation options.
2307
- */
2308
- async addParticipants(request, options = {}) {
2309
- return tracingClient.withSpan("ChatThreadClient-AddParticipants", options, async (updatedOptions) => {
2310
- const result = await this.client.chatThread.addChatParticipants(this.threadId, mapToAddChatParticipantsRequestRestModel(request), updatedOptions);
2311
- return result;
2312
- });
2313
- }
2314
- listParticipantsPage(continuationState_1) {
2315
- return tslib.__asyncGenerator(this, arguments, function* listParticipantsPage_1(continuationState, options = {}) {
2316
- if (!continuationState.continuationToken) {
2317
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatParticipants(this.threadId, options));
2318
- continuationState.continuationToken = currentSetResponse.nextLink;
2319
- if (currentSetResponse.value) {
2320
- yield yield tslib.__await(currentSetResponse.value.map(mapToChatParticipantSdkModel, this));
2321
- }
2322
- }
2323
- while (continuationState.continuationToken) {
2324
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatParticipantsNext(this.threadId, continuationState.continuationToken, options));
2325
- continuationState.continuationToken = currentSetResponse.nextLink;
2326
- if (currentSetResponse.value) {
2327
- yield yield tslib.__await(currentSetResponse.value.map(mapToChatParticipantSdkModel, this));
2328
- }
2329
- else {
2330
- break;
2331
- }
2332
- }
2333
- });
2334
- }
2335
- listParticipantsAll(options) {
2336
- return tslib.__asyncGenerator(this, arguments, function* listParticipantsAll_1() {
2337
- var _a, e_2, _b, _c;
2338
- try {
2339
- for (var _d = true, _e = tslib.__asyncValues(this.listParticipantsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
2340
- _c = _f.value;
2341
- _d = false;
2342
- const page = _c;
2343
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
2344
- }
2345
- }
2346
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2347
- finally {
2348
- try {
2349
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
2350
- }
2351
- finally { if (e_2) throw e_2.error; }
2352
- }
2353
- });
2354
- }
2355
- /**
2356
- * Gets the participants of the thread identified by threadId.
2357
- * Returns the lists of the participants.
2358
- * @param options - Operation options.
2359
- */
2360
- listParticipants(options = {}) {
2361
- const { span, updatedOptions } = tracingClient.startSpan("ChatThreadClient-ListParticipants", options);
2362
- try {
2363
- const iter = this.listParticipantsAll(updatedOptions);
2364
- return {
2365
- next() {
2366
- return iter.next();
2367
- },
2368
- [Symbol.asyncIterator]() {
2369
- return this;
2370
- },
2371
- byPage: (settings = {}) => {
2372
- return this.listParticipantsPage(settings, updatedOptions);
2373
- },
2374
- };
2375
- }
2376
- catch (e) {
2377
- span.setStatus({
2378
- status: "error",
2379
- error: e,
2380
- });
2381
- throw e;
2382
- }
2383
- finally {
2384
- span.end();
2385
- }
2386
- }
2387
- /**
2388
- * Removes participant from the thread identified by threadId.
2389
- * @param participant - Thread participant to remove from the thread roster
2390
- * @param options - Operation options.
2391
- */
2392
- async removeParticipant(participant, options = {}) {
2393
- return tracingClient.withSpan("ChatThreadClient-RemoveParticipant", options, async (updatedOptions) => {
2394
- await this.client.chatThread.removeChatParticipant(this.threadId, communicationCommon.serializeCommunicationIdentifier(participant), updatedOptions);
2395
- });
2396
- }
2397
- /**
2398
- * Sends a typing notification to the thread.
2399
- * Doesn't attempt to send if the time since last notification is smaller than the minimum typing interval
2400
- * @param options - - Operation options
2401
- * @returns True if the typing message notification could be sent, otherwise false.
2402
- */
2403
- async sendTypingNotification(options = {}) {
2404
- return tracingClient.withSpan("ChatThreadClient-SendTypingNotification", options, async (updatedOptions) => {
2405
- const dateNow = new Date();
2406
- const { senderDisplayName } = updatedOptions, restOptions = tslib.__rest(updatedOptions, ["senderDisplayName"]);
2407
- if (this.canPostTypingNotification(dateNow)) {
2408
- this.timeOfLastTypingRequest = dateNow;
2409
- await this.client.chatThread.sendTypingNotification(this.threadId, Object.assign({ sendTypingNotificationRequest: { senderDisplayName: senderDisplayName } }, restOptions));
2410
- return true;
2411
- }
2412
- logger.info(`Typing Notification NOT Send. [thread_id=${this.threadId}]`);
2413
- return false;
2414
- });
2415
- }
2416
- /**
2417
- * Sends a read receipt to the thread identified by threadId.
2418
- * @param request - Request for sending a read receipt
2419
- * @param options - Operation options.
2420
- */
2421
- async sendReadReceipt(request, options = {}) {
2422
- return tracingClient.withSpan("ChatThreadClient-SendReadReceipt", options, async (updatedOptions) => {
2423
- await this.client.chatThread.sendChatReadReceipt(this.threadId, request, updatedOptions);
2424
- });
2425
- }
2426
- listReadReceiptsPage(continuationState_1) {
2427
- return tslib.__asyncGenerator(this, arguments, function* listReadReceiptsPage_1(continuationState, options = {}) {
2428
- if (!continuationState.continuationToken) {
2429
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatReadReceipts(this.threadId, options));
2430
- continuationState.continuationToken = currentSetResponse.nextLink;
2431
- if (currentSetResponse.value) {
2432
- yield yield tslib.__await(currentSetResponse.value.map(mapToReadReceiptSdkModel, this));
2433
- }
2434
- }
2435
- while (continuationState.continuationToken) {
2436
- const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatReadReceiptsNext(this.threadId, continuationState.continuationToken, options));
2437
- continuationState.continuationToken = currentSetResponse.nextLink;
2438
- if (currentSetResponse.value) {
2439
- yield yield tslib.__await(currentSetResponse.value.map(mapToReadReceiptSdkModel, this));
2440
- }
2441
- else {
2442
- break;
2443
- }
2444
- }
2445
- });
2446
- }
2447
- listReadReceiptsAll(options) {
2448
- return tslib.__asyncGenerator(this, arguments, function* listReadReceiptsAll_1() {
2449
- var _a, e_3, _b, _c;
2450
- try {
2451
- for (var _d = true, _e = tslib.__asyncValues(this.listReadReceiptsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
2452
- _c = _f.value;
2453
- _d = false;
2454
- const page = _c;
2455
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
2456
- }
2457
- }
2458
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2459
- finally {
2460
- try {
2461
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
2462
- }
2463
- finally { if (e_3) throw e_3.error; }
2464
- }
2465
- });
2466
- }
2467
- /**
2468
- * Gets a list of read receipt from a thread identified by threadId.
2469
- * Returns the list of the messages.
2470
- * @param options - Get messages options.
2471
- */
2472
- listReadReceipts(options = {}) {
2473
- const { span, updatedOptions } = tracingClient.startSpan("ChatThreadClient-ListChatReadReceipts", options);
2474
- try {
2475
- const iter = this.listReadReceiptsAll(updatedOptions);
2476
- return {
2477
- next() {
2478
- return iter.next();
2479
- },
2480
- [Symbol.asyncIterator]() {
2481
- return this;
2482
- },
2483
- byPage: (settings = {}) => {
2484
- return this.listReadReceiptsPage(settings, updatedOptions);
2485
- },
2486
- };
2487
- }
2488
- catch (e) {
2489
- span.setStatus({
2490
- status: "error",
2491
- error: e,
2492
- });
2493
- throw e;
2494
- }
2495
- finally {
2496
- span.end();
2497
- }
2498
- }
2499
- canPostTypingNotification(dateNow) {
2500
- if (this.timeOfLastTypingRequest) {
2501
- const timeSinceLastRequestInMilliSeconds = dateNow.getTime() - this.timeOfLastTypingRequest.getTime();
2502
- if (timeSinceLastRequestInMilliSeconds < minimumTypingIntervalInMilliSeconds) {
2503
- logger.info(`Typing interval check failed. [last_request=${this.timeOfLastTypingRequest}]`);
2504
- return false;
2505
- }
2506
- }
2507
- return true;
2508
- }
2509
- }
2510
-
2511
- // Copyright (c) Microsoft Corporation.
2512
- // Licensed under the MIT license.
2513
- /**
2514
- * Generated Universally Unique Identifier
2515
- *
2516
- * @returns RFC4122 v4 UUID.
2517
- * @internal
2518
- */
2519
- function generateUuid() {
2520
- return uuid.v4();
2521
- }
2522
-
2523
- // Copyright (c) Microsoft Corporation.
2524
- // Licensed under the MIT license.
2525
- const getSignalingClient = (credential, logger, options) => {
2526
- var _a, _b, _c;
2527
- if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
2528
- // In React Native
2529
- return new communicationSignaling.CommunicationSignalingClient(credential, logger, {
2530
- environment: (_a = options === null || options === void 0 ? void 0 : options.environment) !== null && _a !== void 0 ? _a : undefined,
2531
- resourceEndpoint: (_b = options === null || options === void 0 ? void 0 : options.resourceEndpoint) !== null && _b !== void 0 ? _b : undefined,
2532
- gatewayApiVersion: (_c = options === null || options === void 0 ? void 0 : options.gatewayApiVersion) !== null && _c !== void 0 ? _c : undefined,
2533
- });
2534
- }
2535
- // In node js
2536
- return undefined;
2537
- };
2538
-
2539
- // Copyright (c) Microsoft Corporation.
2540
- // Licensed under the MIT license.
2541
- /// <reference lib="esnext.asynciterable" />
2542
- /**
2543
- * The client to do chat operations
2544
- */
2545
- class ChatClient {
2546
- /**
2547
- * Creates an instance of the ChatClient for a given resource and user.
2548
- *
2549
- * @param endpoint - The url of the Communication Services resource.
2550
- * @param credential - The token credential. Use AzureCommunicationTokenCredential from \@azure/communication-common to create a credential.
2551
- * @param options - Additional client options.
2552
- */
2553
- constructor(endpoint, credential, options = {}) {
2554
- this.endpoint = endpoint;
2555
- this.signalingClient = undefined;
2556
- this.emitter = new events.EventEmitter();
2557
- this.isRealtimeNotificationsStarted = false;
2558
- this.tokenCredential = credential;
2559
- const internalPipelineOptions = Object.assign(Object.assign({}, options), {
2560
- loggingOptions: {
2561
- logger: logger.info,
2562
- },
2563
- });
2564
- this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
2565
- const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
2566
- this.client.pipeline.addPolicy(authPolicy);
2567
- this.clientOptions = Object.assign({}, options);
2568
- this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
2569
- this.signalingClient = getSignalingClient(credential, logger, this.clientOptions.signalingClientOptions);
2570
- }
2571
- /**
2572
- * Returns ChatThreadClient with the specific thread id.
2573
- * @param threadId - Thread ID for the ChatThreadClient
2574
- */
2575
- getChatThreadClient(threadId) {
2576
- return new ChatThreadClient(this.endpoint, threadId, this.tokenCredential, this.clientOptions);
2577
- }
2578
- /**
2579
- * Creates a chat thread.
2580
- * Returns thread client with the id of the created thread.
2581
- * @param request - Request for creating a chat thread.
2582
- * @param options - Operation options.
2583
- */
2584
- async createChatThread(request, options = {}) {
2585
- return tracingClient.withSpan("ChatClient-CreateChatThread", options, async (updatedOptions) => {
2586
- var _a, _b;
2587
- // We generate an UUID if the user does not provide an idempotencyToken value
2588
- updatedOptions.idempotencyToken = (_a = updatedOptions.idempotencyToken) !== null && _a !== void 0 ? _a : generateUuid();
2589
- const updatedRestModelOptions = mapToCreateChatThreadOptionsRestModel(updatedOptions);
2590
- const result = await this.client.chat.createChatThread({
2591
- topic: request.topic,
2592
- participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
2593
- }, updatedRestModelOptions);
2594
- return mapToCreateChatThreadResultSdkModel(result);
2595
- });
2596
- }
2597
- listChatThreadsPage(continuationState_1) {
2598
- return tslib.__asyncGenerator(this, arguments, function* listChatThreadsPage_1(continuationState, options = {}) {
2599
- if (!continuationState.continuationToken) {
2600
- const currentSetResponse = yield tslib.__await(this.client.chat.listChatThreads(options));
2601
- continuationState.continuationToken = currentSetResponse.nextLink;
2602
- if (currentSetResponse.value) {
2603
- yield yield tslib.__await(currentSetResponse.value);
2604
- }
2605
- }
2606
- while (continuationState.continuationToken) {
2607
- const currentSetResponse = yield tslib.__await(this.client.chat.listChatThreadsNext(continuationState.continuationToken, options));
2608
- continuationState.continuationToken = currentSetResponse.nextLink;
2609
- if (currentSetResponse.value) {
2610
- yield yield tslib.__await(currentSetResponse.value);
2611
- }
2612
- else {
2613
- break;
2614
- }
2615
- }
2616
- });
2617
- }
2618
- listChatThreadsAll(options) {
2619
- return tslib.__asyncGenerator(this, arguments, function* listChatThreadsAll_1() {
2620
- var _a, e_1, _b, _c;
2621
- try {
2622
- for (var _d = true, _e = tslib.__asyncValues(this.listChatThreadsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
2623
- _c = _f.value;
2624
- _d = false;
2625
- const page = _c;
2626
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
2627
- }
2628
- }
2629
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2630
- finally {
2631
- try {
2632
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
2633
- }
2634
- finally { if (e_1) throw e_1.error; }
2635
- }
2636
- });
2637
- }
2638
- /**
2639
- * Gets the list of chat threads of a user.
2640
- * @param options - List chat threads options.
2641
- */
2642
- listChatThreads(options = {}) {
2643
- const { span, updatedOptions } = tracingClient.startSpan("ChatClient-ListChatThreads", options);
2644
- try {
2645
- const iter = this.listChatThreadsAll(updatedOptions);
2646
- return {
2647
- next() {
2648
- return iter.next();
2649
- },
2650
- [Symbol.asyncIterator]() {
2651
- return this;
2652
- },
2653
- byPage: (settings = {}) => {
2654
- return this.listChatThreadsPage(settings, updatedOptions);
2655
- },
2656
- };
2657
- }
2658
- catch (e) {
2659
- span.setStatus({
2660
- error: e,
2661
- status: "error",
2662
- });
2663
- throw e;
2664
- }
2665
- finally {
2666
- span.end();
2667
- }
2668
- }
2669
- /**
2670
- * Deletes a chat thread.
2671
- * @param threadId - The ID of the thread to delete.
2672
- * @param options - Operation options.
2673
- */
2674
- async deleteChatThread(threadId, options = {}) {
2675
- return tracingClient.withSpan("ChatClient-DeleteChatThread", options, async (updatedOptions) => {
2676
- await this.client.chat.deleteChatThread(threadId, updatedOptions);
2677
- });
2678
- }
2679
- /**
2680
- * Start receiving realtime notifications.
2681
- * Call this function before subscribing to any event.
2682
- */
2683
- async startRealtimeNotifications() {
2684
- if (this.signalingClient === undefined) {
2685
- throw new Error("Realtime notifications are not supported in node js.");
2686
- }
2687
- if (this.isRealtimeNotificationsStarted) {
2688
- return;
2689
- }
2690
- this.isRealtimeNotificationsStarted = true;
2691
- await this.signalingClient.start();
2692
- this.subscribeToSignalingEvents();
2693
- }
2694
- /**
2695
- * Stop receiving realtime notifications.
2696
- * This function would unsubscribe to all events.
2697
- */
2698
- async stopRealtimeNotifications() {
2699
- if (this.signalingClient === undefined) {
2700
- throw new Error("Realtime notifications are not supported in node js.");
2701
- }
2702
- this.isRealtimeNotificationsStarted = false;
2703
- await this.signalingClient.stop();
2704
- this.emitter.removeAllListeners();
2705
- }
2706
- on(event, listener) {
2707
- if (this.signalingClient === undefined) {
2708
- throw new Error("Realtime notifications are only supported in the browser.");
2709
- }
2710
- if (!this.isRealtimeNotificationsStarted &&
2711
- event !== "realTimeNotificationConnected" &&
2712
- event !== "realTimeNotificationDisconnected") {
2713
- throw new Error("You must call startRealtimeNotifications before you can subscribe to events.");
2714
- }
2715
- this.emitter.on(event, listener);
2716
- }
2717
- off(event, listener) {
2718
- if (this.signalingClient === undefined) {
2719
- throw new Error("Realtime notifications are only supported in the browser.");
2720
- }
2721
- this.emitter.removeListener(event, listener);
2722
- }
2723
- subscribeToSignalingEvents() {
2724
- if (this.signalingClient === undefined) {
2725
- throw new Error("Realtime notifications are only supported in the browser.");
2726
- }
2727
- this.signalingClient.on("connectionChanged", (payload) => {
2728
- if (payload === communicationSignaling.ConnectionState.Connected) {
2729
- this.emitter.emit("realTimeNotificationConnected");
2730
- }
2731
- else if (payload === communicationSignaling.ConnectionState.Disconnected) {
2732
- this.emitter.emit("realTimeNotificationDisconnected");
2733
- }
2734
- });
2735
- this.signalingClient.on("chatMessageReceived", (payload) => {
2736
- this.emitter.emit("chatMessageReceived", payload);
2737
- });
2738
- this.signalingClient.on("chatMessageEdited", (payload) => {
2739
- this.emitter.emit("chatMessageEdited", payload);
2740
- });
2741
- this.signalingClient.on("chatMessageDeleted", (payload) => {
2742
- this.emitter.emit("chatMessageDeleted", payload);
2743
- });
2744
- this.signalingClient.on("typingIndicatorReceived", (payload) => {
2745
- this.emitter.emit("typingIndicatorReceived", payload);
2746
- });
2747
- this.signalingClient.on("readReceiptReceived", (payload) => {
2748
- this.emitter.emit("readReceiptReceived", payload);
2749
- });
2750
- this.signalingClient.on("chatThreadCreated", (payload) => {
2751
- this.emitter.emit("chatThreadCreated", payload);
2752
- });
2753
- this.signalingClient.on("chatThreadDeleted", (payload) => {
2754
- this.emitter.emit("chatThreadDeleted", payload);
2755
- });
2756
- this.signalingClient.on("chatThreadPropertiesUpdated", (payload) => {
2757
- this.emitter.emit("chatThreadPropertiesUpdated", payload);
2758
- });
2759
- this.signalingClient.on("participantsAdded", (payload) => {
2760
- this.emitter.emit("participantsAdded", payload);
2761
- });
2762
- this.signalingClient.on("participantsRemoved", (payload) => {
2763
- this.emitter.emit("participantsRemoved", payload);
2764
- });
2765
- }
2766
- }
2767
-
2768
- exports.ChatClient = ChatClient;
2769
- exports.ChatThreadClient = ChatThreadClient;
2770
- //# sourceMappingURL=index.js.map