@amityco/ts-sdk 0.0.1-beta.40 → 0.0.1-beta.42.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 (282) hide show
  1. package/README.md +3 -1
  2. package/dist/@types/core/model.d.ts +3 -1
  3. package/dist/@types/core/model.d.ts.map +1 -1
  4. package/dist/@types/domains/category.d.ts +1 -1
  5. package/dist/@types/domains/category.d.ts.map +1 -1
  6. package/dist/@types/domains/comment.d.ts +1 -1
  7. package/dist/@types/domains/comment.d.ts.map +1 -1
  8. package/dist/@types/domains/community.d.ts +1 -1
  9. package/dist/@types/domains/community.d.ts.map +1 -1
  10. package/dist/@types/domains/message.d.ts +1 -1
  11. package/dist/@types/domains/message.d.ts.map +1 -1
  12. package/dist/@types/domains/post.d.ts +1 -1
  13. package/dist/@types/domains/post.d.ts.map +1 -1
  14. package/dist/@types/domains/subChannel.d.ts +1 -1
  15. package/dist/@types/domains/subChannel.d.ts.map +1 -1
  16. package/dist/category/api/queryCategories.d.ts.map +1 -1
  17. package/dist/category/observers/liveCategories.d.ts.map +1 -1
  18. package/dist/channel/api/addChannelMembers.d.ts.map +1 -1
  19. package/dist/channel/api/addChannelMembersRole.d.ts.map +1 -1
  20. package/dist/channel/api/banChannelMembers.d.ts.map +1 -1
  21. package/dist/channel/api/createChannel.d.ts.map +1 -1
  22. package/dist/channel/api/getChannel.d.ts.map +1 -1
  23. package/dist/channel/api/joinChannel.d.ts.map +1 -1
  24. package/dist/channel/api/leaveChannel.d.ts.map +1 -1
  25. package/dist/channel/api/queryChannelMembers.d.ts.map +1 -1
  26. package/dist/channel/api/queryChannels.d.ts.map +1 -1
  27. package/dist/channel/api/removeChannelMembers.d.ts.map +1 -1
  28. package/dist/channel/api/removeChannelMembersRole.d.ts +1 -1
  29. package/dist/channel/api/removeChannelMembersRole.d.ts.map +1 -1
  30. package/dist/channel/api/startReading.d.ts +3 -3
  31. package/dist/channel/api/startReading.d.ts.map +1 -1
  32. package/dist/channel/api/stopReading.d.ts +2 -2
  33. package/dist/channel/api/stopReading.d.ts.map +1 -1
  34. package/dist/channel/api/unbanChannelMembers.d.ts.map +1 -1
  35. package/dist/channel/api/updateChannel.d.ts.map +1 -1
  36. package/dist/channel/observers/liveChannel.d.ts.map +1 -1
  37. package/dist/client/api/connectClient.d.ts.map +1 -1
  38. package/dist/client/api/disconnectClient.d.ts.map +1 -1
  39. package/dist/client/api/renewal.d.ts.map +1 -1
  40. package/dist/comment/api/createComment.d.ts.map +1 -1
  41. package/dist/comment/api/deleteComment.d.ts.map +1 -1
  42. package/dist/comment/api/getComment.d.ts.map +1 -1
  43. package/dist/comment/api/getComments.d.ts.map +1 -1
  44. package/dist/comment/api/queryComments.d.ts.map +1 -1
  45. package/dist/comment/api/tests/queryComments.test.d.ts +2 -0
  46. package/dist/comment/api/tests/queryComments.test.d.ts.map +1 -0
  47. package/dist/comment/api/updateComment.d.ts.map +1 -1
  48. package/dist/comment/observers/liveComments.d.ts.map +1 -1
  49. package/dist/community/api/addCommunityMembers.d.ts.map +1 -1
  50. package/dist/community/api/addCommunityMembersRoles.d.ts.map +1 -1
  51. package/dist/community/api/createCommunity.d.ts.map +1 -1
  52. package/dist/community/api/deleteCommunity.d.ts.map +1 -1
  53. package/dist/community/api/getCommunity.d.ts.map +1 -1
  54. package/dist/community/api/getRecommendedCommunities.d.ts.map +1 -1
  55. package/dist/community/api/getTopTrendingCommunities.d.ts.map +1 -1
  56. package/dist/community/api/joinCommunity.d.ts.map +1 -1
  57. package/dist/community/api/leaveCommunity.d.ts.map +1 -1
  58. package/dist/community/api/queryCommunities.d.ts.map +1 -1
  59. package/dist/community/api/queryCommunityMembers.d.ts.map +1 -1
  60. package/dist/community/api/removeCommunityMembers.d.ts.map +1 -1
  61. package/dist/community/api/removeCommunityMembersRoles.d.ts.map +1 -1
  62. package/dist/community/api/updateCommunity.d.ts.map +1 -1
  63. package/dist/community/observers/liveCommunities.d.ts.map +1 -1
  64. package/dist/core/model/idResolvers.d.ts.map +1 -1
  65. package/dist/core/model/identifyModel.d.ts.map +1 -1
  66. package/dist/core/model/index.d.ts +1 -1
  67. package/dist/core/model/index.d.ts.map +1 -1
  68. package/dist/core/transports/http.d.ts.map +1 -1
  69. package/dist/feed/api/queryGlobalFeed.d.ts.map +1 -1
  70. package/dist/file/api/createFile.d.ts.map +1 -1
  71. package/dist/file/api/createImage.d.ts.map +1 -1
  72. package/dist/file/api/createVideo.d.ts.map +1 -1
  73. package/dist/file/api/deleteFile.d.ts.map +1 -1
  74. package/dist/file/api/getFile.d.ts.map +1 -1
  75. package/dist/follow/api/acceptFollower.d.ts.map +1 -1
  76. package/dist/follow/api/declineFollower.d.ts.map +1 -1
  77. package/dist/follow/api/follow.d.ts.map +1 -1
  78. package/dist/follow/api/getFollowInfo.d.ts.map +1 -1
  79. package/dist/follow/api/queryFollowers.d.ts.map +1 -1
  80. package/dist/follow/api/queryFollowings.d.ts.map +1 -1
  81. package/dist/follow/api/unfollow.d.ts.map +1 -1
  82. package/dist/follow/observers/index.d.ts +1 -0
  83. package/dist/follow/observers/index.d.ts.map +1 -1
  84. package/dist/follow/observers/liveFollowInfo.d.ts +21 -0
  85. package/dist/follow/observers/liveFollowInfo.d.ts.map +1 -0
  86. package/dist/follow/observers/tests/liveFollowInfo.test.d.ts +2 -0
  87. package/dist/follow/observers/tests/liveFollowInfo.test.d.ts.map +1 -0
  88. package/dist/index.cjs.js +511 -109
  89. package/dist/index.esm.js +511 -110
  90. package/dist/index.umd.js +2 -2
  91. package/dist/message/api/createMessage.d.ts +2 -1
  92. package/dist/message/api/createMessage.d.ts.map +1 -1
  93. package/dist/message/api/deleteMessage.d.ts.map +1 -1
  94. package/dist/message/api/getMessage.d.ts.map +1 -1
  95. package/dist/message/api/queryMessages.d.ts.map +1 -1
  96. package/dist/message/api/updateMessage.d.ts.map +1 -1
  97. package/dist/message/observers/liveMessages.d.ts.map +1 -1
  98. package/dist/message/utils/index.d.ts +3 -2
  99. package/dist/message/utils/index.d.ts.map +1 -1
  100. package/dist/poll/api/closePoll.d.ts.map +1 -1
  101. package/dist/poll/api/createPoll.d.ts.map +1 -1
  102. package/dist/poll/api/deletePoll.d.ts.map +1 -1
  103. package/dist/poll/api/getPoll.d.ts.map +1 -1
  104. package/dist/poll/api/votePoll.d.ts.map +1 -1
  105. package/dist/post/api/approvePost.d.ts.map +1 -1
  106. package/dist/post/api/createPost.d.ts.map +1 -1
  107. package/dist/post/api/declinePost.d.ts.map +1 -1
  108. package/dist/post/api/deletePost.d.ts.map +1 -1
  109. package/dist/post/api/getPost.d.ts.map +1 -1
  110. package/dist/post/api/getPosts.d.ts.map +1 -1
  111. package/dist/post/api/queryPosts.d.ts.map +1 -1
  112. package/dist/post/api/updatePost.d.ts.map +1 -1
  113. package/dist/post/observers/livePosts.d.ts.map +1 -1
  114. package/dist/reaction/api/addReaction.d.ts.map +1 -1
  115. package/dist/reaction/api/queryReactions.d.ts.map +1 -1
  116. package/dist/reaction/api/removeReaction.d.ts.map +1 -1
  117. package/dist/report/api/createReport.d.ts.map +1 -1
  118. package/dist/report/api/deleteReport.d.ts.map +1 -1
  119. package/dist/report/api/isReportedByMe.d.ts.map +1 -1
  120. package/dist/stream/api/createStream.d.ts.map +1 -1
  121. package/dist/stream/api/deleteStream.d.ts.map +1 -1
  122. package/dist/stream/api/getStream.d.ts.map +1 -1
  123. package/dist/stream/api/queryStreams.d.ts.map +1 -1
  124. package/dist/stream/api/updateStream.d.ts.map +1 -1
  125. package/dist/subChannel/api/createSubChannel.d.ts.map +1 -1
  126. package/dist/subChannel/api/deleteSubChannel.d.ts.map +1 -1
  127. package/dist/subChannel/api/getSubChannel.d.ts.map +1 -1
  128. package/dist/subChannel/api/querySubChannels.d.ts.map +1 -1
  129. package/dist/subChannel/api/updateSubChannel.d.ts.map +1 -1
  130. package/dist/user/api/getUser.d.ts.map +1 -1
  131. package/dist/user/api/getUsers.d.ts.map +1 -1
  132. package/dist/user/api/queryUsers.d.ts.map +1 -1
  133. package/dist/user/api/updateUser.d.ts.map +1 -1
  134. package/dist/utils/liveObject.d.ts +1 -1
  135. package/dist/utils/liveObject.d.ts.map +1 -1
  136. package/dist/utils/tests/dummy/comment.d.ts +77 -0
  137. package/dist/utils/tests/dummy/comment.d.ts.map +1 -0
  138. package/dist/utils/tests/dummy/community.d.ts +1 -1
  139. package/dist/utils/tests/dummy/index.d.ts +1 -0
  140. package/dist/utils/tests/dummy/index.d.ts.map +1 -1
  141. package/dist/utils/tests/dummy/post.d.ts +0 -12
  142. package/dist/utils/tests/dummy/post.d.ts.map +1 -1
  143. package/package.json +1 -1
  144. package/src/@types/core/model.ts +3 -1
  145. package/src/@types/domains/category.ts +1 -1
  146. package/src/@types/domains/comment.ts +1 -1
  147. package/src/@types/domains/community.ts +1 -1
  148. package/src/@types/domains/message.ts +1 -1
  149. package/src/@types/domains/post.ts +1 -1
  150. package/src/@types/domains/subChannel.ts +1 -1
  151. package/src/category/api/queryCategories.ts +5 -1
  152. package/src/category/observers/liveCategories.ts +3 -1
  153. package/src/category/observers/tests/liveCategories.test.ts +1 -3
  154. package/src/channel/api/addChannelMembers.ts +4 -0
  155. package/src/channel/api/addChannelMembersRole.ts +4 -0
  156. package/src/channel/api/banChannelMembers.ts +4 -0
  157. package/src/channel/api/createChannel.ts +4 -0
  158. package/src/channel/api/getChannel.ts +4 -0
  159. package/src/channel/api/joinChannel.ts +4 -0
  160. package/src/channel/api/leaveChannel.ts +4 -0
  161. package/src/channel/api/queryChannelMembers.ts +4 -0
  162. package/src/channel/api/queryChannels.ts +4 -0
  163. package/src/channel/api/removeChannelMembers.ts +4 -0
  164. package/src/channel/api/removeChannelMembersRole.ts +5 -1
  165. package/src/channel/api/startReading.ts +7 -3
  166. package/src/channel/api/stopReading.ts +6 -2
  167. package/src/channel/api/unbanChannelMembers.ts +4 -0
  168. package/src/channel/api/updateChannel.ts +4 -0
  169. package/src/channel/observers/liveChannel.ts +16 -1
  170. package/src/client/api/connectClient.ts +4 -0
  171. package/src/client/api/disconnectClient.ts +4 -0
  172. package/src/client/api/getToken.ts +1 -1
  173. package/src/client/api/renewal.ts +4 -0
  174. package/src/client/api/tests/getToken.test.ts +2 -2
  175. package/src/comment/api/createComment.ts +4 -0
  176. package/src/comment/api/deleteComment.ts +4 -0
  177. package/src/comment/api/getComment.ts +4 -0
  178. package/src/comment/api/getComments.ts +4 -0
  179. package/src/comment/api/queryComments.ts +6 -1
  180. package/src/comment/api/tests/createComment.test.ts +17 -112
  181. package/src/comment/api/tests/queryComments.test.ts +147 -0
  182. package/src/comment/api/tests/updateComment.test.ts +14 -85
  183. package/src/comment/api/updateComment.ts +4 -0
  184. package/src/comment/observers/liveComments.ts +3 -1
  185. package/src/community/api/addCommunityMembers.ts +4 -0
  186. package/src/community/api/addCommunityMembersRoles.ts +4 -0
  187. package/src/community/api/createCommunity.ts +4 -0
  188. package/src/community/api/deleteCommunity.ts +4 -0
  189. package/src/community/api/getCommunity.ts +4 -0
  190. package/src/community/api/getRecommendedCommunities.ts +4 -0
  191. package/src/community/api/getTopTrendingCommunities.ts +4 -0
  192. package/src/community/api/joinCommunity.ts +4 -0
  193. package/src/community/api/leaveCommunity.ts +4 -0
  194. package/src/community/api/queryCommunities.ts +6 -1
  195. package/src/community/api/queryCommunityMembers.ts +4 -0
  196. package/src/community/api/removeCommunityMembers.ts +4 -0
  197. package/src/community/api/removeCommunityMembersRoles.ts +4 -0
  198. package/src/community/api/test/queryCommunity.test.ts +30 -0
  199. package/src/community/api/updateCommunity.ts +4 -0
  200. package/src/community/observers/liveCommunities.ts +4 -1
  201. package/src/community/observers/tests/liveCommunities.test.ts +2 -2
  202. package/src/core/model/idResolvers.ts +1 -0
  203. package/src/core/model/identifyModel.ts +2 -1
  204. package/src/core/model/index.ts +11 -2
  205. package/src/core/transports/http.ts +5 -0
  206. package/src/core/transports/test/http.test.ts +12 -0
  207. package/src/feed/api/queryGlobalFeed.ts +4 -0
  208. package/src/file/api/createFile.ts +4 -0
  209. package/src/file/api/createImage.ts +4 -0
  210. package/src/file/api/createVideo.ts +4 -0
  211. package/src/file/api/deleteFile.ts +4 -0
  212. package/src/file/api/getFile.ts +4 -0
  213. package/src/follow/api/acceptFollower.ts +4 -0
  214. package/src/follow/api/declineFollower.ts +4 -0
  215. package/src/follow/api/follow.ts +4 -0
  216. package/src/follow/api/getFollowInfo.ts +8 -8
  217. package/src/follow/api/queryFollowers.ts +4 -0
  218. package/src/follow/api/queryFollowings.ts +4 -0
  219. package/src/follow/api/unfollow.ts +4 -0
  220. package/src/follow/observers/index.ts +1 -0
  221. package/src/follow/observers/liveFollowInfo.ts +29 -0
  222. package/src/follow/observers/tests/liveFollowInfo.test.ts +198 -0
  223. package/src/message/api/createMessage.ts +24 -7
  224. package/src/message/api/deleteMessage.ts +4 -0
  225. package/src/message/api/getMessage.ts +4 -0
  226. package/src/message/api/queryMessages.ts +4 -0
  227. package/src/message/api/tests/createMessage.test.ts +42 -2
  228. package/src/message/api/tests/queryMessages.test.ts +30 -0
  229. package/src/message/api/updateMessage.ts +4 -0
  230. package/src/message/observers/liveMessages.ts +14 -15
  231. package/src/message/tests/observers/liveMessages.test.ts +2 -2
  232. package/src/message/utils/index.ts +10 -1
  233. package/src/poll/api/closePoll.ts +4 -0
  234. package/src/poll/api/createPoll.ts +4 -0
  235. package/src/poll/api/deletePoll.ts +4 -0
  236. package/src/poll/api/getPoll.ts +4 -0
  237. package/src/poll/api/votePoll.ts +4 -0
  238. package/src/post/api/approvePost.ts +4 -0
  239. package/src/post/api/createPost.ts +4 -0
  240. package/src/post/api/declinePost.ts +4 -0
  241. package/src/post/api/deletePost.ts +4 -0
  242. package/src/post/api/getPost.ts +4 -0
  243. package/src/post/api/getPosts.ts +3 -0
  244. package/src/post/api/queryPosts.ts +6 -1
  245. package/src/post/api/tests/queryPosts.test.ts +30 -0
  246. package/src/post/api/updatePost.ts +4 -0
  247. package/src/post/observers/livePosts.ts +4 -2
  248. package/src/post/observers/tests/livePosts.test.ts +4 -5
  249. package/src/reaction/api/addReaction.ts +4 -0
  250. package/src/reaction/api/queryReactions.ts +4 -0
  251. package/src/reaction/api/removeReaction.ts +4 -0
  252. package/src/reaction/api/tests/addReaction.test.ts +13 -0
  253. package/src/reaction/api/tests/removeReaction.test.ts +13 -0
  254. package/src/report/api/createReport.ts +4 -0
  255. package/src/report/api/deleteReport.ts +4 -0
  256. package/src/report/api/isReportedByMe.ts +4 -0
  257. package/src/stream/api/createStream.ts +4 -0
  258. package/src/stream/api/deleteStream.ts +3 -0
  259. package/src/stream/api/getStream.ts +4 -0
  260. package/src/stream/api/queryStreams.ts +4 -0
  261. package/src/stream/api/updateStream.ts +3 -0
  262. package/src/subChannel/api/createSubChannel.ts +4 -0
  263. package/src/subChannel/api/deleteSubChannel.ts +4 -0
  264. package/src/subChannel/api/getSubChannel.ts +4 -0
  265. package/src/subChannel/api/querySubChannels.ts +6 -1
  266. package/src/subChannel/api/updateSubChannel.ts +4 -0
  267. package/src/subChannel/observers/liveSubChannels.ts +2 -2
  268. package/src/subChannel/observers/tests/liveSubChannels.test.ts +5 -2
  269. package/src/user/api/getUser.ts +4 -0
  270. package/src/user/api/getUsers.ts +3 -0
  271. package/src/user/api/queryUsers.ts +4 -0
  272. package/src/user/api/updateUser.ts +4 -0
  273. package/src/utils/liveObject.ts +1 -4
  274. package/src/utils/tests/dummy/comment.ts +268 -0
  275. package/src/utils/tests/dummy/index.ts +1 -0
  276. package/src/utils/tests/dummy/post.ts +0 -114
  277. package/dist/post/tests/api/getPost.test.d.ts +0 -2
  278. package/dist/post/tests/api/getPost.test.d.ts.map +0 -1
  279. package/dist/post/tests/api/queryPosts.test.d.ts +0 -2
  280. package/dist/post/tests/api/queryPosts.test.d.ts.map +0 -1
  281. package/src/post/tests/api/getPost.test.ts +0 -98
  282. package/src/post/tests/api/queryPosts.test.ts +0 -123
@@ -5,6 +5,9 @@ import { fireEvent } from '~/core/events';
5
5
 
6
6
  import { prepareChannelPayload } from '../utils';
7
7
 
8
+ /* begin_public_function
9
+ id: channel.member.add
10
+ */
8
11
  /**
9
12
  * ```js
10
13
  * import { addChannelMembers } from '@amityco/ts-sdk'
@@ -51,3 +54,4 @@ export const addChannelMembers = async (
51
54
  channelUser => channelUser.channelId === channelId && channelUser.membership === 'member',
52
55
  );
53
56
  };
57
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.moderation.add_roles
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { addChannelMembersRole } from '@amityco/ts-sdk'
@@ -42,3 +45,4 @@ export const addChannelMembersRole = async (
42
45
  channelUser => channelUser.channelId === channelId && channelUser.roles.includes(roleId),
43
46
  );
44
47
  };
48
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.moderation.ban_members
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { banChannelMembers } from '@amityco/ts-sdk'
@@ -43,3 +46,4 @@ export const banChannelMembers = async (
43
46
  cachedAt,
44
47
  };
45
48
  };
49
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.create
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { createChannel } from '@amityco/ts-sdk'
@@ -49,3 +52,4 @@ export const createChannel = async <T extends Amity.ChannelType>(
49
52
  cachedAt,
50
53
  };
51
54
  };
55
+ /* end_public_function */
@@ -9,6 +9,9 @@ import { pushToTombstone } from '~/cache/api/pushToTombstone';
9
9
 
10
10
  import { prepareChannelPayload } from '../utils';
11
11
 
12
+ /* begin_public_function
13
+ id: channel.get
14
+ */
12
15
  /**
13
16
  * ```js
14
17
  * import { getChannel } from '@amityco/ts-sdk'
@@ -57,6 +60,7 @@ export const getChannel = async (
57
60
  cachedAt,
58
61
  };
59
62
  };
63
+ /* end_public_function */
60
64
 
61
65
  /**
62
66
  * ```js
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.join
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { joinChannel } from '@amityco/ts-sdk'
@@ -36,3 +39,4 @@ export const joinChannel = async (channelId: Amity.Channel['channelId']): Promis
36
39
  channelUser => channelUser.channelId === channelId && channelUser.membership === 'member',
37
40
  );
38
41
  };
42
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.leave
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { leaveChannel } from '@amityco/ts-sdk'
@@ -36,3 +39,4 @@ export const leaveChannel = async (channelId: Amity.Channel['channelId']): Promi
36
39
  channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member',
37
40
  );
38
41
  };
42
+ /* end_public_function */
@@ -7,6 +7,9 @@ import { getResolver } from '~/core/model';
7
7
  import { pullFromCache, pushToCache } from '~/cache/api';
8
8
  import { ingestInCache } from '~/cache/api/ingestInCache';
9
9
 
10
+ /* begin_public_function
11
+ id: channel.member.query, channel.member.search
12
+ */
10
13
  /**
11
14
  * ```js
12
15
  * import { queryChannelMembers } from '@amityco/ts-sdk'
@@ -73,6 +76,7 @@ export const queryChannelMembers = async (
73
76
  prevPage,
74
77
  };
75
78
  };
79
+ /* end_public_function */
76
80
 
77
81
  /**
78
82
  * ```js
@@ -8,6 +8,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
8
8
 
9
9
  import { prepareChannelPayload } from '../utils';
10
10
 
11
+ /* begin_public_function
12
+ id: channel.query
13
+ */
11
14
  /**
12
15
  * ```js
13
16
  * import { queryChannels } from '@amityco/ts-sdk'
@@ -73,6 +76,7 @@ export const queryChannels = async (
73
76
 
74
77
  return { data: channels, cachedAt, prevPage, nextPage };
75
78
  };
79
+ /* end_public_function */
76
80
 
77
81
  /**
78
82
  * ```js
@@ -5,6 +5,9 @@ import { fireEvent } from '~/core/events';
5
5
 
6
6
  import { prepareChannelPayload } from '../utils';
7
7
 
8
+ /* begin_public_function
9
+ id: channel.member.remove
10
+ */
8
11
  /**
9
12
  * ```js
10
13
  * import { removeChannelMembers } from '@amityco/ts-sdk'
@@ -51,3 +54,4 @@ export const removeChannelMembers = async (
51
54
  channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member',
52
55
  );
53
56
  };
57
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.moderation.remove_roles
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { removeChannelMembersRole } from '@amityco/ts-sdk'
@@ -14,7 +17,7 @@ import { prepareChannelPayload } from '../utils';
14
17
  *
15
18
  * @param channelId The ID of the {@link Amity.Channel} to perform
16
19
  * @param roleId The ID of the {@link Amity.Role} to apply
17
- * @param userId Array of IDs of the {@link Amity.User} to perform
20
+ * @param userIds Array of IDs of the {@link Amity.User} to perform
18
21
  * @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
19
22
  *
20
23
  * @category Channel API
@@ -42,3 +45,4 @@ export const removeChannelMembersRole = async (
42
45
  channelUser => channelUser.channelId === channelId && !channelUser.roles.includes(roleId),
43
46
  );
44
47
  };
48
+ /* end_public_function */
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
2
2
  import { synchronousWSCall } from '~/core/transports';
3
3
  import { pullFromCache, pushToCache } from '~/cache/api';
4
4
 
5
+ /* begin_public_function
6
+ id: channel.start_reading
7
+ */
5
8
  /**
6
9
  * ```js
7
10
  * import { startReading } from '@amityco/ts-sdk'
@@ -10,9 +13,9 @@ import { pullFromCache, pushToCache } from '~/cache/api';
10
13
  *
11
14
  * Mark all messages as read and start reading message inside channel
12
15
  *
13
- * @param {string} subChannelId - The channel ID to start reading.
14
- * @param {string} userId - The user ID of channel member.
15
- * @return {Promise<boolean>>} A success boolean if the channel reading of the sub channel had begun.
16
+ * @param subChannelId - The channel ID to start reading.
17
+ * @param userId - The user ID of channel member.
18
+ * @return A success boolean if the channel reading of the sub channel had begun.
16
19
  *
17
20
  * @category Message API
18
21
  * @async
@@ -51,3 +54,4 @@ export const startReading = async (subChannelId: string, userId = getActiveClien
51
54
 
52
55
  return !!result;
53
56
  };
57
+ /* end_public_function */
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
2
2
  import { synchronousWSCall } from '~/core/transports';
3
3
  import { pullFromCache, pushToCache } from '~/cache/api';
4
4
 
5
+ /* begin_public_function
6
+ id: channel.stop_reading
7
+ */
5
8
  /**
6
9
  * ```js
7
10
  * import { stopReading } from '@amityco/ts-sdk'
@@ -10,8 +13,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
10
13
  *
11
14
  * Stop reading message inside channel
12
15
  *
13
- * @param {string} subChannelId - The channel ID to stop reading.
14
- * @return {Promise<boolean>>} A success boolean if the sub channel reading was halted.
16
+ * @param subChannelId - The channel ID to stop reading.
17
+ * @return A success boolean if the sub channel reading was halted.
15
18
  *
16
19
  * @category Message API
17
20
  * @async
@@ -47,3 +50,4 @@ export const stopReading = async (subChannelId: string) => {
47
50
 
48
51
  return !!result;
49
52
  };
53
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.moderation.unban_members
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { unbanChannelMembers } from '@amityco/ts-sdk'
@@ -44,3 +47,4 @@ export const unbanChannelMembers = async (
44
47
  cachedAt,
45
48
  };
46
49
  };
50
+ /* end_public_function */
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareChannelPayload } from '../utils';
6
6
 
7
+ /* begin_public_function
8
+ id: channel.update
9
+ */
7
10
  /**
8
11
  * ```js
9
12
  * import { updateChannel } from '@amityco/ts-sdk'
@@ -43,3 +46,4 @@ export const updateChannel = async (
43
46
  cachedAt,
44
47
  };
45
48
  };
49
+ /* end_public_function */
@@ -1,7 +1,17 @@
1
1
  import { liveObject } from '~/utils/liveObject';
2
2
  import { onMessageCreated } from '~/message/events';
3
3
  import { getChannel } from '../api';
4
- import { onChannelDeleted, onChannelJoined, onChannelMuted, onChannelUpdated } from '../events';
4
+ import {
5
+ onChannelDeleted,
6
+ onChannelJoined,
7
+ onChannelLeft,
8
+ onChannelMemberAdded,
9
+ onChannelMemberBanned,
10
+ onChannelMemberRemoved,
11
+ onChannelMemberUnbanned,
12
+ onChannelMuted,
13
+ onChannelUpdated,
14
+ } from '../events';
5
15
 
6
16
  /**
7
17
  * ```js
@@ -30,6 +40,11 @@ export const liveChannel = (
30
40
  onChannelUpdated,
31
41
  onChannelDeleted,
32
42
  onChannelJoined,
43
+ onChannelLeft,
44
+ onChannelMemberAdded,
45
+ onChannelMemberRemoved,
46
+ onChannelMemberBanned,
47
+ onChannelMemberUnbanned,
33
48
  onChannelMuted,
34
49
  () => onMessageCreated(() => null), // watch unread count
35
50
  ]);
@@ -33,6 +33,9 @@ import { setClientToken } from '../utils/setClientToken';
33
33
  */
34
34
  const subscriptions: Amity.Unsubscriber[] = [];
35
35
 
36
+ /* begin_public_function
37
+ id: client.login
38
+ */
36
39
  /**
37
40
  * ```js
38
41
  * import { connectClient } from '@amityco/ts-sdk/client/api'
@@ -168,3 +171,4 @@ export const connectClient = async (
168
171
 
169
172
  return client.ws.connected;
170
173
  };
174
+ /* end_public_function */
@@ -1,6 +1,9 @@
1
1
  import { getActiveClient } from './activeClient';
2
2
  import { setSessionState } from './setSessionState';
3
3
 
4
+ /* begin_public_function
5
+ id: client.logout
6
+ */
4
7
  /**
5
8
  * ```js
6
9
  * import { disconnectClient } from '@amityco/ts-sdk'
@@ -57,3 +60,4 @@ export const disconnectClient = async (): Promise<boolean> => {
57
60
 
58
61
  return !client.ws.connected;
59
62
  };
63
+ /* end_public_function */
@@ -26,7 +26,7 @@ export const getToken = async (params: {
26
26
  const deviceInfo = getDeviceInfo();
27
27
 
28
28
  const { data } = await client.http.post<Amity.Tokens & { users: Amity.User[] }>(
29
- '/api/v3/sessions',
29
+ '/api/v4/sessions',
30
30
  {
31
31
  ...params,
32
32
  deviceInfo,
@@ -6,6 +6,9 @@ import { setClientToken as refreshToken } from '../utils/setClientToken';
6
6
  import { getActiveClient } from './activeClient';
7
7
  import { connectClient } from './connectClient';
8
8
 
9
+ /* begin_public_function
10
+ id: client.renew_access_token
11
+ */
9
12
  /*
10
13
  * Renewal defintion accepted by SessionHandler interface
11
14
  *
@@ -72,3 +75,4 @@ export const renewal = (): Amity.AccessTokenRenewal => {
72
75
  },
73
76
  };
74
77
  };
78
+ /* end_public_function */
@@ -8,8 +8,8 @@ describe('getToken', () => {
8
8
  const deviceId = 'test-deviceId';
9
9
  const params = { userId, displayName, deviceId };
10
10
 
11
- test('it should call v3/sessions api', async () => {
12
- const expected = '/api/v3/sessions';
11
+ test('it should call v4/sessions api', async () => {
12
+ const expected = '/api/v4/sessions';
13
13
  const mockApi = jest.fn().mockResolvedValue(sessionResponse);
14
14
  client.http.post = mockApi;
15
15
 
@@ -5,6 +5,9 @@ import { fireEvent } from '~/core/events';
5
5
 
6
6
  import { getPost } from '~/post/api/getPost';
7
7
 
8
+ /* begin_public_function
9
+ id: comment.create
10
+ */
8
11
  /**
9
12
  * ```js
10
13
  * import { createComment } from '@amityco/ts-sdk'
@@ -60,3 +63,4 @@ export const createComment = async (
60
63
  cachedAt,
61
64
  };
62
65
  };
66
+ /* end_public_function */
@@ -9,6 +9,9 @@ import { scheduleTask } from '~/core/microtasks';
9
9
 
10
10
  import { getComment } from './getComment';
11
11
 
12
+ /* begin_public_function
13
+ id: comment.soft_delete, comment.hard_delete
14
+ */
12
15
  /**
13
16
  * ```js
14
17
  * import { deleteComment } from '@amityco/ts-sdk'
@@ -75,3 +78,4 @@ export const deleteComment = async (
75
78
 
76
79
  return deleted;
77
80
  };
81
+ /* end_public_function */
@@ -6,6 +6,9 @@ import { isInTombstone } from '~/cache/api/isInTombstone';
6
6
  import { checkIfShouldGoesToTombstone } from '~/cache/utils';
7
7
  import { pushToTombstone } from '~/cache/api/pushToTombstone';
8
8
 
9
+ /* begin_public_function
10
+ id: comment.get
11
+ */
9
12
  /**
10
13
  * ```js
11
14
  * import { getComment } from '@amityco/ts-sdk'
@@ -54,6 +57,7 @@ export const getComment = async (
54
57
  cachedAt,
55
58
  };
56
59
  };
60
+ /* end_public_function */
57
61
 
58
62
  /**
59
63
  * ```js
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
3
3
  import { pullFromCache } from '~/cache/api';
4
4
  import { ingestInCache } from '~/cache/api/ingestInCache';
5
5
 
6
+ /* begin_public_function
7
+ id: comment.get_by_ids
8
+ */
6
9
  /**
7
10
  * ```js
8
11
  * import { getComments } from '@amityco/ts-sdk'
@@ -38,6 +41,7 @@ export const getComments = async (
38
41
  cachedAt,
39
42
  };
40
43
  };
44
+ /* end_public_function */
41
45
 
42
46
  /**
43
47
  * ```js
@@ -5,6 +5,9 @@ import { pullFromCache, pushToCache } from '~/cache/api';
5
5
  import { ingestInCache } from '~/cache/api/ingestInCache';
6
6
  import { getResolver } from '~/core/model';
7
7
 
8
+ /* begin_public_function
9
+ id: comment.query
10
+ */
8
11
  /**
9
12
  * ```js
10
13
  * import { queryComments } from '@amityco/ts-sdk'
@@ -25,7 +28,7 @@ export const queryComments = async (
25
28
  const client = getActiveClient();
26
29
  client.log('comment/queryComments', query);
27
30
 
28
- const { page = { limit: 10 }, ...params } = query;
31
+ const { page = { limit: 10 }, includeDeleted, ...params } = query;
29
32
 
30
33
  const options = {
31
34
  type: params.sortBy ? 'pagination' : undefined,
@@ -41,6 +44,7 @@ export const queryComments = async (
41
44
  {
42
45
  params: {
43
46
  ...params,
47
+ isDeleted: includeDeleted === false ? false : undefined,
44
48
  // filterByParentId, API-FIX: backend does not support this boolean LOL. what the hell seriously.
45
49
  options,
46
50
  },
@@ -70,6 +74,7 @@ export const queryComments = async (
70
74
 
71
75
  return { data: comments, cachedAt, prevPage, nextPage };
72
76
  };
77
+ /* end_public_function */
73
78
 
74
79
  /**
75
80
  * ```js
@@ -7,122 +7,27 @@ import {
7
7
  imageComment11,
8
8
  textImageComment11,
9
9
  textMentionComment11,
10
- textWithParentComment11,
10
+ comment12,
11
11
  post11,
12
- textCommentPayload,
13
- imageCommentPayload,
14
- textImageCommentPayload,
15
- textCommentMentionPayload,
16
- textCommentParentIdPayload,
17
- file11,
18
- user11,
19
- user12,
20
- post12,
12
+ imageCommentResponse,
13
+ textCommentParentIdResponse,
14
+ textCommentResponse,
15
+ textImageCommentResponse,
16
+ textMentionCommentResponse,
17
+ imageCommentRequestPayload,
18
+ textCommentParentIdRequestPayload,
19
+ textCommentRequestPayload,
20
+ textCommentWithMentionRequestPayload,
21
+ textImageCommentRequestPayload,
21
22
  } from '~/utils/tests';
22
23
  import { ASCApiError } from '~/core/errors';
23
24
  import { createComment } from '../createComment';
24
25
 
25
- const createTextCommentResponse = {
26
- data: {
27
- ...textCommentPayload,
28
- files: [],
29
- commentChildren: [],
30
- },
31
- };
32
-
33
- const createImageCommentResponse = {
34
- data: {
35
- ...imageCommentPayload,
36
- files: [],
37
- commentChildren: [],
38
- },
39
- };
40
-
41
- const createTextImageCommentResponse = {
42
- data: {
43
- ...textImageCommentPayload,
44
- files: [],
45
- commentChildren: [],
46
- },
47
- };
48
-
49
- const createTextMentionCommentResponse = {
50
- data: {
51
- ...textCommentMentionPayload,
52
- files: [],
53
- commentChildren: [],
54
- },
55
- };
56
-
57
- const createTextCommentParentIdResponse = {
58
- data: {
59
- ...textCommentParentIdPayload,
60
- files: [],
61
- commentChildren: [],
62
- },
63
- };
64
-
65
26
  const getPostResponse = {
66
27
  data: post11,
67
28
  cachedAt: 1673337034544,
68
29
  };
69
30
 
70
- const textCommentRequestPayload: Parameters<typeof createComment>[0] = {
71
- referenceId: post11.postId,
72
- referenceType: 'post',
73
- data: {
74
- text: 'test',
75
- },
76
- };
77
-
78
- const textCommentParentIdRequestPayload: Parameters<typeof createComment>[0] = {
79
- referenceId: post11.postId,
80
- referenceType: 'post',
81
- parentId: post12.postId,
82
- data: {
83
- text: 'test',
84
- },
85
- };
86
-
87
- const imageCommentRequestPayload: Parameters<typeof createComment>[0] = {
88
- referenceId: post11.postId,
89
- referenceType: 'post',
90
- attachments: [
91
- {
92
- type: 'image',
93
- fileId: file11.fileId,
94
- },
95
- ],
96
- };
97
-
98
- const textImageCommentRequestPayload: Parameters<typeof createComment>[0] = {
99
- referenceId: post11.postId,
100
- referenceType: 'post',
101
- data: {
102
- text: 'test',
103
- },
104
- attachments: [
105
- {
106
- type: 'image',
107
- fileId: file11.fileId,
108
- },
109
- ],
110
- };
111
-
112
- const textCommentWithMentionRequestPayload: Parameters<typeof createComment>[0] = {
113
- referenceId: post11.postId,
114
- referenceType: 'post',
115
- data: {
116
- text: 'test',
117
- },
118
- mentionees: [
119
- {
120
- type: 'user',
121
- userIds: [user11._id, user12._id],
122
- },
123
- ],
124
- };
125
-
126
31
  jest.mock('~/post/api/getPost', () => ({
127
32
  getPost: jest.fn(() => Promise.resolve(getPostResponse)),
128
33
  }));
@@ -133,7 +38,7 @@ describe('createComment', () => {
133
38
 
134
39
  // integration_test_id: 2f83eabc-46db-43d8-89c6-1b5339d6a273
135
40
  it('creates a text comment and returns the new valid comment', async () => {
136
- client.http.post = jest.fn().mockResolvedValueOnce(createTextCommentResponse);
41
+ client.http.post = jest.fn().mockResolvedValueOnce(textCommentResponse);
137
42
 
138
43
  const newComment = await createComment(textCommentRequestPayload);
139
44
 
@@ -146,7 +51,7 @@ describe('createComment', () => {
146
51
 
147
52
  // integration_test_id: 81e7d5bc-6881-4f9b-b8d4-deb5fe67200c
148
53
  it('creates a image comment and returns the new valid comment', async () => {
149
- client.http.post = jest.fn().mockResolvedValueOnce(createImageCommentResponse);
54
+ client.http.post = jest.fn().mockResolvedValueOnce(imageCommentResponse);
150
55
 
151
56
  const newComment = await createComment(imageCommentRequestPayload);
152
57
 
@@ -159,7 +64,7 @@ describe('createComment', () => {
159
64
 
160
65
  // integration_test_id: 015838a8-3267-4253-920a-9ae83197cf22
161
66
  it('creates an image + text comment and returns the new valid comment', async () => {
162
- client.http.post = jest.fn().mockResolvedValueOnce(createTextImageCommentResponse);
67
+ client.http.post = jest.fn().mockResolvedValueOnce(textImageCommentResponse);
163
68
 
164
69
  const newComment = await createComment(textImageCommentRequestPayload);
165
70
 
@@ -172,7 +77,7 @@ describe('createComment', () => {
172
77
 
173
78
  // integration_test_id: c2285355-f3b6-4e22-926b-11bcf0393161
174
79
  it('creates text comment with mention and returns the new valid comment', async () => {
175
- client.http.post = jest.fn().mockResolvedValueOnce(createTextMentionCommentResponse);
80
+ client.http.post = jest.fn().mockResolvedValueOnce(textMentionCommentResponse);
176
81
 
177
82
  const newComment = await createComment(textCommentWithMentionRequestPayload);
178
83
 
@@ -185,7 +90,7 @@ describe('createComment', () => {
185
90
 
186
91
  // integration_test_id: cb1bfe11-c11a-4324-aeb5-03370da820ad
187
92
  it('creates text comment with parent_id and returns the new valid comment', async () => {
188
- client.http.post = jest.fn().mockResolvedValueOnce(createTextCommentParentIdResponse);
93
+ client.http.post = jest.fn().mockResolvedValueOnce(textCommentParentIdResponse);
189
94
 
190
95
  const newComment = await createComment(textCommentParentIdRequestPayload);
191
96
 
@@ -193,7 +98,7 @@ describe('createComment', () => {
193
98
  '/api/v3/comments',
194
99
  textCommentParentIdRequestPayload,
195
100
  );
196
- expect(newComment.data).toEqual(textWithParentComment11);
101
+ expect(newComment.data).toEqual(comment12);
197
102
  });
198
103
 
199
104
  // integration_test_id: 7f411488-abba-46d1-8707-a1d8adbd7242