@amityco/ts-sdk 0.0.1-02f0fa3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +390 -0
- package/README.md +137 -0
- package/dist/@types/core/cache.d.ts +21 -0
- package/dist/@types/core/cache.d.ts.map +1 -0
- package/dist/@types/core/errors.d.ts +32 -0
- package/dist/@types/core/errors.d.ts.map +1 -0
- package/dist/@types/core/events.d.ts +46 -0
- package/dist/@types/core/events.d.ts.map +1 -0
- package/dist/@types/core/model.d.ts +41 -0
- package/dist/@types/core/model.d.ts.map +1 -0
- package/dist/@types/core/payload.d.ts +88 -0
- package/dist/@types/core/payload.d.ts.map +1 -0
- package/dist/@types/core/permissions.d.ts +71 -0
- package/dist/@types/core/permissions.d.ts.map +1 -0
- package/dist/@types/core/query.d.ts +72 -0
- package/dist/@types/core/query.d.ts.map +1 -0
- package/dist/@types/core/store.d.ts +46 -0
- package/dist/@types/core/store.d.ts.map +1 -0
- package/dist/@types/core/transport.d.ts +27 -0
- package/dist/@types/core/transport.d.ts.map +1 -0
- package/dist/@types/domains/category.d.ts +11 -0
- package/dist/@types/domains/category.d.ts.map +1 -0
- package/dist/@types/domains/channel.d.ts +26 -0
- package/dist/@types/domains/channel.d.ts.map +1 -0
- package/dist/@types/domains/client.d.ts +31 -0
- package/dist/@types/domains/client.d.ts.map +1 -0
- package/dist/@types/domains/comment.d.ts +17 -0
- package/dist/@types/domains/comment.d.ts.map +1 -0
- package/dist/@types/domains/community.d.ts +24 -0
- package/dist/@types/domains/community.d.ts.map +1 -0
- package/dist/@types/domains/content.d.ts +26 -0
- package/dist/@types/domains/content.d.ts.map +1 -0
- package/dist/@types/domains/feed.d.ts +14 -0
- package/dist/@types/domains/feed.d.ts.map +1 -0
- package/dist/@types/domains/file.d.ts +29 -0
- package/dist/@types/domains/file.d.ts.map +1 -0
- package/dist/@types/domains/group.d.ts +26 -0
- package/dist/@types/domains/group.d.ts.map +1 -0
- package/dist/@types/domains/message.d.ts +16 -0
- package/dist/@types/domains/message.d.ts.map +1 -0
- package/dist/@types/domains/partials.d.ts +42 -0
- package/dist/@types/domains/partials.d.ts.map +1 -0
- package/dist/@types/domains/post.d.ts +22 -0
- package/dist/@types/domains/post.d.ts.map +1 -0
- package/dist/@types/domains/reaction.d.ts +24 -0
- package/dist/@types/domains/reaction.d.ts.map +1 -0
- package/dist/@types/domains/stream.d.ts +47 -0
- package/dist/@types/domains/stream.d.ts.map +1 -0
- package/dist/@types/domains/user.d.ts +12 -0
- package/dist/@types/domains/user.d.ts.map +1 -0
- package/dist/@types/global.d.ts +13 -0
- package/dist/@types/global.d.ts.map +1 -0
- package/dist/@types/index.d.ts +23 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/category/api/getCategory.d.ts +16 -0
- package/dist/category/api/getCategory.d.ts.map +1 -0
- package/dist/category/api/index.d.ts +3 -0
- package/dist/category/api/index.d.ts.map +1 -0
- package/dist/category/api/queryCategories.d.ts +23 -0
- package/dist/category/api/queryCategories.d.ts.map +1 -0
- package/dist/channel/api/addChannelMembers.d.ts +17 -0
- package/dist/channel/api/addChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/addChannelMembersRole.d.ts +18 -0
- package/dist/channel/api/addChannelMembersRole.d.ts.map +1 -0
- package/dist/channel/api/createChannel.d.ts +19 -0
- package/dist/channel/api/createChannel.d.ts.map +1 -0
- package/dist/channel/api/deleteChannel.d.ts +16 -0
- package/dist/channel/api/deleteChannel.d.ts.map +1 -0
- package/dist/channel/api/getChannel.d.ts +32 -0
- package/dist/channel/api/getChannel.d.ts.map +1 -0
- package/dist/channel/api/getChannels.d.ts +32 -0
- package/dist/channel/api/getChannels.d.ts.map +1 -0
- package/dist/channel/api/index.d.ts +14 -0
- package/dist/channel/api/index.d.ts.map +1 -0
- package/dist/channel/api/joinChannel.d.ts +16 -0
- package/dist/channel/api/joinChannel.d.ts.map +1 -0
- package/dist/channel/api/leaveChannel.d.ts +16 -0
- package/dist/channel/api/leaveChannel.d.ts.map +1 -0
- package/dist/channel/api/queryChannelMembers.d.ts +42 -0
- package/dist/channel/api/queryChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/queryChannels.d.ts +43 -0
- package/dist/channel/api/queryChannels.d.ts.map +1 -0
- package/dist/channel/api/removeChannelMembers.d.ts +17 -0
- package/dist/channel/api/removeChannelMembers.d.ts.map +1 -0
- package/dist/channel/api/removeChannelMembersRole.d.ts +18 -0
- package/dist/channel/api/removeChannelMembersRole.d.ts.map +1 -0
- package/dist/channel/api/updateChannel.d.ts +17 -0
- package/dist/channel/api/updateChannel.d.ts.map +1 -0
- package/dist/channel/events/index.d.ts +7 -0
- package/dist/channel/events/index.d.ts.map +1 -0
- package/dist/channel/events/onChannelCreated.d.ts +17 -0
- package/dist/channel/events/onChannelCreated.d.ts.map +1 -0
- package/dist/channel/events/onChannelDeleted.d.ts +17 -0
- package/dist/channel/events/onChannelDeleted.d.ts.map +1 -0
- package/dist/channel/events/onChannelJoined.d.ts +17 -0
- package/dist/channel/events/onChannelJoined.d.ts.map +1 -0
- package/dist/channel/events/onChannelLeft.d.ts +17 -0
- package/dist/channel/events/onChannelLeft.d.ts.map +1 -0
- package/dist/channel/events/onChannelUpdated.d.ts +17 -0
- package/dist/channel/events/onChannelUpdated.d.ts.map +1 -0
- package/dist/channel/events/onMemberAdded.d.ts +17 -0
- package/dist/channel/events/onMemberAdded.d.ts.map +1 -0
- package/dist/channel/events/onMemberRemoved.d.ts +17 -0
- package/dist/channel/events/onMemberRemoved.d.ts.map +1 -0
- package/dist/channel/observers/index.d.ts +2 -0
- package/dist/channel/observers/index.d.ts.map +1 -0
- package/dist/channel/observers/observeChannel.d.ts +20 -0
- package/dist/channel/observers/observeChannel.d.ts.map +1 -0
- package/dist/client/api/activeClient.d.ts +17 -0
- package/dist/client/api/activeClient.d.ts.map +1 -0
- package/dist/client/api/clearCache.d.ts +15 -0
- package/dist/client/api/clearCache.d.ts.map +1 -0
- package/dist/client/api/connectClient.d.ts +26 -0
- package/dist/client/api/connectClient.d.ts.map +1 -0
- package/dist/client/api/createClient.d.ts +17 -0
- package/dist/client/api/createClient.d.ts.map +1 -0
- package/dist/client/api/disconnectClient.d.ts +16 -0
- package/dist/client/api/disconnectClient.d.ts.map +1 -0
- package/dist/client/api/enableCache.d.ts +15 -0
- package/dist/client/api/enableCache.d.ts.map +1 -0
- package/dist/client/api/getToken.d.ts +19 -0
- package/dist/client/api/getToken.d.ts.map +1 -0
- package/dist/client/api/index.d.ts +8 -0
- package/dist/client/api/index.d.ts.map +1 -0
- package/dist/client/api/isConnected.d.ts +14 -0
- package/dist/client/api/isConnected.d.ts.map +1 -0
- package/dist/client/events/index.d.ts +2 -0
- package/dist/client/events/index.d.ts.map +1 -0
- package/dist/client/events/onClientDisconnected.d.ts +17 -0
- package/dist/client/events/onClientDisconnected.d.ts.map +1 -0
- package/dist/comment/api/createComment.d.ts +16 -0
- package/dist/comment/api/createComment.d.ts.map +1 -0
- package/dist/comment/api/deleteComment.d.ts +16 -0
- package/dist/comment/api/deleteComment.d.ts.map +1 -0
- package/dist/comment/api/getComment.d.ts +32 -0
- package/dist/comment/api/getComment.d.ts.map +1 -0
- package/dist/comment/api/getComments.d.ts +32 -0
- package/dist/comment/api/getComments.d.ts.map +1 -0
- package/dist/comment/api/index.d.ts +7 -0
- package/dist/comment/api/index.d.ts.map +1 -0
- package/dist/comment/api/queryComments.d.ts +53 -0
- package/dist/comment/api/queryComments.d.ts.map +1 -0
- package/dist/comment/api/updateComment.d.ts +19 -0
- package/dist/comment/api/updateComment.d.ts.map +1 -0
- package/dist/comment/events/index.d.ts +4 -0
- package/dist/comment/events/index.d.ts.map +1 -0
- package/dist/comment/events/onCommentCreated.d.ts +17 -0
- package/dist/comment/events/onCommentCreated.d.ts.map +1 -0
- package/dist/comment/events/onCommentDeleted.d.ts +17 -0
- package/dist/comment/events/onCommentDeleted.d.ts.map +1 -0
- package/dist/comment/events/onCommentUpdated.d.ts +17 -0
- package/dist/comment/events/onCommentUpdated.d.ts.map +1 -0
- package/dist/comment/observers/index.d.ts +3 -0
- package/dist/comment/observers/index.d.ts.map +1 -0
- package/dist/comment/observers/observeComment.d.ts +20 -0
- package/dist/comment/observers/observeComment.d.ts.map +1 -0
- package/dist/comment/observers/observeComments.d.ts +22 -0
- package/dist/comment/observers/observeComments.d.ts.map +1 -0
- package/dist/community/api/addCommunityMembers.d.ts +17 -0
- package/dist/community/api/addCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/addCommunityMembersRole.d.ts +18 -0
- package/dist/community/api/addCommunityMembersRole.d.ts.map +1 -0
- package/dist/community/api/createCommunity.d.ts +20 -0
- package/dist/community/api/createCommunity.d.ts.map +1 -0
- package/dist/community/api/deleteCommunity.d.ts +16 -0
- package/dist/community/api/deleteCommunity.d.ts.map +1 -0
- package/dist/community/api/getCommunities.d.ts +32 -0
- package/dist/community/api/getCommunities.d.ts.map +1 -0
- package/dist/community/api/getCommunity.d.ts +32 -0
- package/dist/community/api/getCommunity.d.ts.map +1 -0
- package/dist/community/api/index.d.ts +14 -0
- package/dist/community/api/index.d.ts.map +1 -0
- package/dist/community/api/joinCommunity.d.ts +16 -0
- package/dist/community/api/joinCommunity.d.ts.map +1 -0
- package/dist/community/api/leaveCommunity.d.ts +16 -0
- package/dist/community/api/leaveCommunity.d.ts.map +1 -0
- package/dist/community/api/queryCommunities.d.ts +46 -0
- package/dist/community/api/queryCommunities.d.ts.map +1 -0
- package/dist/community/api/queryCommunityMembers.d.ts +42 -0
- package/dist/community/api/queryCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/removeCommunityMembers.d.ts +17 -0
- package/dist/community/api/removeCommunityMembers.d.ts.map +1 -0
- package/dist/community/api/removeCommunityMembersRole.d.ts +18 -0
- package/dist/community/api/removeCommunityMembersRole.d.ts.map +1 -0
- package/dist/community/api/updateCommunity.d.ts +17 -0
- package/dist/community/api/updateCommunity.d.ts.map +1 -0
- package/dist/community/events/index.d.ts +6 -0
- package/dist/community/events/index.d.ts.map +1 -0
- package/dist/community/events/onCommunityCreated.d.ts +17 -0
- package/dist/community/events/onCommunityCreated.d.ts.map +1 -0
- package/dist/community/events/onCommunityDeleted.d.ts +17 -0
- package/dist/community/events/onCommunityDeleted.d.ts.map +1 -0
- package/dist/community/events/onCommunityJoined.d.ts +17 -0
- package/dist/community/events/onCommunityJoined.d.ts.map +1 -0
- package/dist/community/events/onCommunityLeft.d.ts +17 -0
- package/dist/community/events/onCommunityLeft.d.ts.map +1 -0
- package/dist/community/events/onCommunityUpdated.d.ts +17 -0
- package/dist/community/events/onCommunityUpdated.d.ts.map +1 -0
- package/dist/community/observers/index.d.ts +2 -0
- package/dist/community/observers/index.d.ts.map +1 -0
- package/dist/community/observers/observeCommunity.d.ts +20 -0
- package/dist/community/observers/observeCommunity.d.ts.map +1 -0
- package/dist/core/cache/drop.d.ts +11 -0
- package/dist/core/cache/drop.d.ts.map +1 -0
- package/dist/core/cache/index.d.ts +19 -0
- package/dist/core/cache/index.d.ts.map +1 -0
- package/dist/core/cache/ingest.d.ts +10 -0
- package/dist/core/cache/ingest.d.ts.map +1 -0
- package/dist/core/cache/merge.d.ts +10 -0
- package/dist/core/cache/merge.d.ts.map +1 -0
- package/dist/core/cache/mutate.d.ts +10 -0
- package/dist/core/cache/mutate.d.ts.map +1 -0
- package/dist/core/cache/pull.d.ts +11 -0
- package/dist/core/cache/pull.d.ts.map +1 -0
- package/dist/core/cache/push.d.ts +10 -0
- package/dist/core/cache/push.d.ts.map +1 -0
- package/dist/core/cache/sync.d.ts +10 -0
- package/dist/core/cache/sync.d.ts.map +1 -0
- package/dist/core/debug.d.ts +15 -0
- package/dist/core/debug.d.ts.map +1 -0
- package/dist/core/device.d.ts +7 -0
- package/dist/core/device.d.ts.map +1 -0
- package/dist/core/errors.d.ts +59 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/events.d.ts +33 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/model/idResolvers.d.ts +20 -0
- package/dist/core/model/idResolvers.d.ts.map +1 -0
- package/dist/core/model/identifyModel.d.ts +8 -0
- package/dist/core/model/identifyModel.d.ts.map +1 -0
- package/dist/core/model/index.d.ts +4 -0
- package/dist/core/model/index.d.ts.map +1 -0
- package/dist/core/model/toRecord.d.ts +10 -0
- package/dist/core/model/toRecord.d.ts.map +1 -0
- package/dist/core/query/decorate.d.ts +23 -0
- package/dist/core/query/decorate.d.ts.map +1 -0
- package/dist/core/query/filtering.d.ts +12 -0
- package/dist/core/query/filtering.d.ts.map +1 -0
- package/dist/core/query/index.d.ts +6 -0
- package/dist/core/query/index.d.ts.map +1 -0
- package/dist/core/query/paging.d.ts +58 -0
- package/dist/core/query/paging.d.ts.map +1 -0
- package/dist/core/query/query.d.ts +121 -0
- package/dist/core/query/query.d.ts.map +1 -0
- package/dist/core/query/sorting.d.ts +39 -0
- package/dist/core/query/sorting.d.ts.map +1 -0
- package/dist/core/stores/index.d.ts +3 -0
- package/dist/core/stores/index.d.ts.map +1 -0
- package/dist/core/stores/memory.d.ts +30 -0
- package/dist/core/stores/memory.d.ts.map +1 -0
- package/dist/core/stores/persistent.d.ts +13 -0
- package/dist/core/stores/persistent.d.ts.map +1 -0
- package/dist/core/transports.d.ts +49 -0
- package/dist/core/transports.d.ts.map +1 -0
- package/dist/core/uuid.d.ts +2 -0
- package/dist/core/uuid.d.ts.map +1 -0
- package/dist/feed/api/index.d.ts +2 -0
- package/dist/feed/api/index.d.ts.map +1 -0
- package/dist/feed/api/queryGlobalFeed.d.ts +23 -0
- package/dist/feed/api/queryGlobalFeed.d.ts.map +1 -0
- package/dist/file/api/createFile.d.ts +16 -0
- package/dist/file/api/createFile.d.ts.map +1 -0
- package/dist/file/api/deleteFile.d.ts +16 -0
- package/dist/file/api/deleteFile.d.ts.map +1 -0
- package/dist/file/api/fileUrlWithSize.d.ts +9 -0
- package/dist/file/api/fileUrlWithSize.d.ts.map +1 -0
- package/dist/file/api/getFile.d.ts +32 -0
- package/dist/file/api/getFile.d.ts.map +1 -0
- package/dist/file/api/index.d.ts +5 -0
- package/dist/file/api/index.d.ts.map +1 -0
- package/dist/file/observers/index.d.ts +2 -0
- package/dist/file/observers/index.d.ts.map +1 -0
- package/dist/file/observers/observeFile.d.ts +20 -0
- package/dist/file/observers/observeFile.d.ts.map +1 -0
- package/dist/index.cjs.js +4884 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +4734 -0
- package/dist/index.umd.js +4880 -0
- package/dist/message/api/createMessage.d.ts +38 -0
- package/dist/message/api/createMessage.d.ts.map +1 -0
- package/dist/message/api/deleteMessage.d.ts +32 -0
- package/dist/message/api/deleteMessage.d.ts.map +1 -0
- package/dist/message/api/getMessage.d.ts +32 -0
- package/dist/message/api/getMessage.d.ts.map +1 -0
- package/dist/message/api/getMessages.d.ts +32 -0
- package/dist/message/api/getMessages.d.ts.map +1 -0
- package/dist/message/api/index.d.ts +7 -0
- package/dist/message/api/index.d.ts.map +1 -0
- package/dist/message/api/queryMessages.d.ts +55 -0
- package/dist/message/api/queryMessages.d.ts.map +1 -0
- package/dist/message/api/updateMessage.d.ts +38 -0
- package/dist/message/api/updateMessage.d.ts.map +1 -0
- package/dist/message/events/index.d.ts +4 -0
- package/dist/message/events/index.d.ts.map +1 -0
- package/dist/message/events/onMessageCreated.d.ts +17 -0
- package/dist/message/events/onMessageCreated.d.ts.map +1 -0
- package/dist/message/events/onMessageDeleted.d.ts +17 -0
- package/dist/message/events/onMessageDeleted.d.ts.map +1 -0
- package/dist/message/events/onMessageUpdated.d.ts +17 -0
- package/dist/message/events/onMessageUpdated.d.ts.map +1 -0
- package/dist/message/observers/index.d.ts +3 -0
- package/dist/message/observers/index.d.ts.map +1 -0
- package/dist/message/observers/observeMessage.d.ts +22 -0
- package/dist/message/observers/observeMessage.d.ts.map +1 -0
- package/dist/message/observers/observeMessages.d.ts +19 -0
- package/dist/message/observers/observeMessages.d.ts.map +1 -0
- package/dist/post/api/createPost.d.ts +21 -0
- package/dist/post/api/createPost.d.ts.map +1 -0
- package/dist/post/api/deletePost.d.ts +16 -0
- package/dist/post/api/deletePost.d.ts.map +1 -0
- package/dist/post/api/getPost.d.ts +32 -0
- package/dist/post/api/getPost.d.ts.map +1 -0
- package/dist/post/api/getPosts.d.ts +32 -0
- package/dist/post/api/getPosts.d.ts.map +1 -0
- package/dist/post/api/index.d.ts +7 -0
- package/dist/post/api/index.d.ts.map +1 -0
- package/dist/post/api/queryPosts.d.ts +45 -0
- package/dist/post/api/queryPosts.d.ts.map +1 -0
- package/dist/post/api/updatePost.d.ts +19 -0
- package/dist/post/api/updatePost.d.ts.map +1 -0
- package/dist/post/events/index.d.ts +4 -0
- package/dist/post/events/index.d.ts.map +1 -0
- package/dist/post/events/onPostCreated.d.ts +17 -0
- package/dist/post/events/onPostCreated.d.ts.map +1 -0
- package/dist/post/events/onPostDeleted.d.ts +17 -0
- package/dist/post/events/onPostDeleted.d.ts.map +1 -0
- package/dist/post/events/onPostUpdated.d.ts +17 -0
- package/dist/post/events/onPostUpdated.d.ts.map +1 -0
- package/dist/post/observers/index.d.ts +3 -0
- package/dist/post/observers/index.d.ts.map +1 -0
- package/dist/post/observers/observePost.d.ts +20 -0
- package/dist/post/observers/observePost.d.ts.map +1 -0
- package/dist/post/observers/observePosts.d.ts +25 -0
- package/dist/post/observers/observePosts.d.ts.map +1 -0
- package/dist/reaction/api/addReaction.d.ts +36 -0
- package/dist/reaction/api/addReaction.d.ts.map +1 -0
- package/dist/reaction/api/index.d.ts +3 -0
- package/dist/reaction/api/index.d.ts.map +1 -0
- package/dist/reaction/api/removeReaction.d.ts +36 -0
- package/dist/reaction/api/removeReaction.d.ts.map +1 -0
- package/dist/reaction/events/index.d.ts +2 -0
- package/dist/reaction/events/index.d.ts.map +1 -0
- package/dist/reaction/events/onReactionAdded.d.ts +17 -0
- package/dist/reaction/events/onReactionAdded.d.ts.map +1 -0
- package/dist/reaction/events/onReactionRemoved.d.ts +17 -0
- package/dist/reaction/events/onReactionRemoved.d.ts.map +1 -0
- package/dist/reaction/utils/dispatchReactable.d.ts +3 -0
- package/dist/reaction/utils/dispatchReactable.d.ts.map +1 -0
- package/dist/reaction/utils/fetchReference.d.ts +3 -0
- package/dist/reaction/utils/fetchReference.d.ts.map +1 -0
- package/dist/reaction/utils/index.d.ts +3 -0
- package/dist/reaction/utils/index.d.ts.map +1 -0
- package/dist/report/api/createReport.d.ts +16 -0
- package/dist/report/api/createReport.d.ts.map +1 -0
- package/dist/report/api/deleteReport.d.ts +16 -0
- package/dist/report/api/deleteReport.d.ts.map +1 -0
- package/dist/report/api/index.d.ts +4 -0
- package/dist/report/api/index.d.ts.map +1 -0
- package/dist/report/api/isReportedByMe.d.ts +16 -0
- package/dist/report/api/isReportedByMe.d.ts.map +1 -0
- package/dist/report/constants/referenceTypes.d.ts +24 -0
- package/dist/report/constants/referenceTypes.d.ts.map +1 -0
- package/dist/role/api/getRole.d.ts +32 -0
- package/dist/role/api/getRole.d.ts.map +1 -0
- package/dist/role/api/index.d.ts +3 -0
- package/dist/role/api/index.d.ts.map +1 -0
- package/dist/role/api/queryRoles.d.ts +42 -0
- package/dist/role/api/queryRoles.d.ts.map +1 -0
- package/dist/stream/api/createStream.d.ts +18 -0
- package/dist/stream/api/createStream.d.ts.map +1 -0
- package/dist/stream/api/deleteStream.d.ts +16 -0
- package/dist/stream/api/deleteStream.d.ts.map +1 -0
- package/dist/stream/api/getStream.d.ts +12 -0
- package/dist/stream/api/getStream.d.ts.map +1 -0
- package/dist/stream/api/index.d.ts +6 -0
- package/dist/stream/api/index.d.ts.map +1 -0
- package/dist/stream/api/queryStreams.d.ts +23 -0
- package/dist/stream/api/queryStreams.d.ts.map +1 -0
- package/dist/stream/api/updateStream.d.ts +17 -0
- package/dist/stream/api/updateStream.d.ts.map +1 -0
- package/dist/stream/events/index.d.ts +4 -0
- package/dist/stream/events/index.d.ts.map +1 -0
- package/dist/stream/events/onStreamRecorded.d.ts +17 -0
- package/dist/stream/events/onStreamRecorded.d.ts.map +1 -0
- package/dist/stream/events/onStreamStarted.d.ts +17 -0
- package/dist/stream/events/onStreamStarted.d.ts.map +1 -0
- package/dist/stream/events/onStreamStopped.d.ts +17 -0
- package/dist/stream/events/onStreamStopped.d.ts.map +1 -0
- package/dist/user/api/getUser.d.ts +32 -0
- package/dist/user/api/getUser.d.ts.map +1 -0
- package/dist/user/api/getUsers.d.ts +32 -0
- package/dist/user/api/getUsers.d.ts.map +1 -0
- package/dist/user/api/index.d.ts +5 -0
- package/dist/user/api/index.d.ts.map +1 -0
- package/dist/user/api/queryUsers.d.ts +43 -0
- package/dist/user/api/queryUsers.d.ts.map +1 -0
- package/dist/user/api/updateUser.d.ts +17 -0
- package/dist/user/api/updateUser.d.ts.map +1 -0
- package/dist/user/events/index.d.ts +2 -0
- package/dist/user/events/index.d.ts.map +1 -0
- package/dist/user/events/onUserUpdated.d.ts +17 -0
- package/dist/user/events/onUserUpdated.d.ts.map +1 -0
- package/dist/user/observers/index.d.ts +2 -0
- package/dist/user/observers/index.d.ts.map +1 -0
- package/dist/user/observers/observeUser.d.ts +19 -0
- package/dist/user/observers/observeUser.d.ts.map +1 -0
- package/package.json +59 -0
- package/rollup.config.js +41 -0
- package/src/@types/core/cache.ts +22 -0
- package/src/@types/core/errors.ts +34 -0
- package/src/@types/core/events.ts +60 -0
- package/src/@types/core/model.ts +51 -0
- package/src/@types/core/payload.ts +102 -0
- package/src/@types/core/permissions.ts +76 -0
- package/src/@types/core/query.ts +95 -0
- package/src/@types/core/store.ts +52 -0
- package/src/@types/core/transport.ts +32 -0
- package/src/@types/domains/category.ts +15 -0
- package/src/@types/domains/channel.ts +38 -0
- package/src/@types/domains/client.ts +36 -0
- package/src/@types/domains/comment.ts +26 -0
- package/src/@types/domains/community.ts +35 -0
- package/src/@types/domains/content.ts +35 -0
- package/src/@types/domains/feed.ts +16 -0
- package/src/@types/domains/file.ts +41 -0
- package/src/@types/domains/group.ts +38 -0
- package/src/@types/domains/message.ts +27 -0
- package/src/@types/domains/partials.ts +52 -0
- package/src/@types/domains/post.ts +31 -0
- package/src/@types/domains/reaction.ts +30 -0
- package/src/@types/domains/stream.ts +57 -0
- package/src/@types/domains/user.ts +18 -0
- package/src/@types/global.ts +25 -0
- package/src/@types/index.ts +31 -0
- package/src/category/api/getCategory.ts +35 -0
- package/src/category/api/index.ts +2 -0
- package/src/category/api/queryCategories.ts +49 -0
- package/src/channel/api/addChannelMembers.ts +45 -0
- package/src/channel/api/addChannelMembersRole.ts +43 -0
- package/src/channel/api/createChannel.ts +37 -0
- package/src/channel/api/deleteChannel.ts +34 -0
- package/src/channel/api/getChannel.ts +59 -0
- package/src/channel/api/getChannels.ts +63 -0
- package/src/channel/api/index.ts +18 -0
- package/src/channel/api/joinChannel.ts +38 -0
- package/src/channel/api/leaveChannel.ts +38 -0
- package/src/channel/api/queryChannelMembers.ts +79 -0
- package/src/channel/api/queryChannels.ts +89 -0
- package/src/channel/api/removeChannelMembers.ts +45 -0
- package/src/channel/api/removeChannelMembersRole.ts +43 -0
- package/src/channel/api/updateChannel.ts +38 -0
- package/src/channel/events/index.ts +6 -0
- package/src/channel/events/onChannelCreated.ts +37 -0
- package/src/channel/events/onChannelDeleted.ts +37 -0
- package/src/channel/events/onChannelJoined.ts +37 -0
- package/src/channel/events/onChannelLeft.ts +37 -0
- package/src/channel/events/onChannelUpdated.ts +37 -0
- package/src/channel/events/onMemberAdded.ts +37 -0
- package/src/channel/events/onMemberRemoved.ts +37 -0
- package/src/channel/observers/index.ts +1 -0
- package/src/channel/observers/observeChannel.ts +80 -0
- package/src/client/api/activeClient.ts +33 -0
- package/src/client/api/clearCache.ts +23 -0
- package/src/client/api/connectClient.ts +63 -0
- package/src/client/api/createClient.ts +56 -0
- package/src/client/api/disconnectClient.ts +31 -0
- package/src/client/api/enableCache.ts +35 -0
- package/src/client/api/getToken.ts +35 -0
- package/src/client/api/index.ts +7 -0
- package/src/client/api/isConnected.ts +24 -0
- package/src/client/events/index.ts +1 -0
- package/src/client/events/onClientDisconnected.ts +29 -0
- package/src/comment/api/createComment.ts +43 -0
- package/src/comment/api/deleteComment.ts +40 -0
- package/src/comment/api/getComment.ts +59 -0
- package/src/comment/api/getComments.ts +63 -0
- package/src/comment/api/index.ts +7 -0
- package/src/comment/api/queryComments.ts +169 -0
- package/src/comment/api/updateComment.ts +41 -0
- package/src/comment/events/index.ts +3 -0
- package/src/comment/events/onCommentCreated.ts +39 -0
- package/src/comment/events/onCommentDeleted.ts +39 -0
- package/src/comment/events/onCommentUpdated.ts +39 -0
- package/src/comment/observers/index.ts +2 -0
- package/src/comment/observers/observeComment.ts +73 -0
- package/src/comment/observers/observeComments.ts +61 -0
- package/src/community/api/addCommunityMembers.ts +46 -0
- package/src/community/api/addCommunityMembersRole.ts +43 -0
- package/src/community/api/createCommunity.ts +43 -0
- package/src/community/api/deleteCommunity.ts +35 -0
- package/src/community/api/getCommunities.ts +63 -0
- package/src/community/api/getCommunity.ts +58 -0
- package/src/community/api/index.ts +17 -0
- package/src/community/api/joinCommunity.ts +41 -0
- package/src/community/api/leaveCommunity.ts +41 -0
- package/src/community/api/queryCommunities.ts +92 -0
- package/src/community/api/queryCommunityMembers.ts +78 -0
- package/src/community/api/removeCommunityMembers.ts +46 -0
- package/src/community/api/removeCommunityMembersRole.ts +43 -0
- package/src/community/api/updateCommunity.ts +40 -0
- package/src/community/events/index.ts +6 -0
- package/src/community/events/onCommunityCreated.ts +37 -0
- package/src/community/events/onCommunityDeleted.ts +37 -0
- package/src/community/events/onCommunityJoined.ts +37 -0
- package/src/community/events/onCommunityLeft.ts +37 -0
- package/src/community/events/onCommunityUpdated.ts +37 -0
- package/src/community/observers/index.ts +1 -0
- package/src/community/observers/observeCommunity.ts +74 -0
- package/src/core/cache/drop.ts +24 -0
- package/src/core/cache/index.ts +24 -0
- package/src/core/cache/ingest.ts +24 -0
- package/src/core/cache/merge.ts +19 -0
- package/src/core/cache/mutate.ts +25 -0
- package/src/core/cache/pull.ts +31 -0
- package/src/core/cache/push.ts +41 -0
- package/src/core/cache/sync.ts +41 -0
- package/src/core/debug.ts +26 -0
- package/src/core/device.ts +38 -0
- package/src/core/errors.ts +85 -0
- package/src/core/events.ts +93 -0
- package/src/core/model/idResolvers.ts +66 -0
- package/src/core/model/identifyModel.ts +32 -0
- package/src/core/model/index.ts +3 -0
- package/src/core/model/toRecord.ts +11 -0
- package/src/core/query/decorate.ts +64 -0
- package/src/core/query/filtering.ts +17 -0
- package/src/core/query/index.ts +5 -0
- package/src/core/query/paging.ts +166 -0
- package/src/core/query/query.ts +300 -0
- package/src/core/query/sorting.ts +50 -0
- package/src/core/stores/index.ts +2 -0
- package/src/core/stores/memory.ts +59 -0
- package/src/core/stores/persistent.ts +63 -0
- package/src/core/transports.ts +157 -0
- package/src/core/uuid.ts +2 -0
- package/src/feed/api/index.ts +1 -0
- package/src/feed/api/queryGlobalFeed.ts +50 -0
- package/src/file/api/createFile.ts +51 -0
- package/src/file/api/deleteFile.ts +35 -0
- package/src/file/api/fileUrlWithSize.ts +13 -0
- package/src/file/api/getFile.ts +60 -0
- package/src/file/api/index.ts +4 -0
- package/src/file/observers/index.ts +1 -0
- package/src/file/observers/observeFile.ts +57 -0
- package/src/index.ts +55 -0
- package/src/message/api/createMessage.ts +90 -0
- package/src/message/api/deleteMessage.ts +75 -0
- package/src/message/api/getMessage.ts +60 -0
- package/src/message/api/getMessages.ts +63 -0
- package/src/message/api/index.ts +6 -0
- package/src/message/api/queryMessages.ts +145 -0
- package/src/message/api/updateMessage.ts +79 -0
- package/src/message/events/index.ts +3 -0
- package/src/message/events/onMessageCreated.ts +39 -0
- package/src/message/events/onMessageDeleted.ts +39 -0
- package/src/message/events/onMessageUpdated.ts +39 -0
- package/src/message/observers/index.ts +2 -0
- package/src/message/observers/observeMessage.ts +76 -0
- package/src/message/observers/observeMessages.ts +60 -0
- package/src/post/api/createPost.ts +45 -0
- package/src/post/api/deletePost.ts +43 -0
- package/src/post/api/getPost.ts +60 -0
- package/src/post/api/getPosts.ts +63 -0
- package/src/post/api/index.ts +7 -0
- package/src/post/api/queryPosts.ts +86 -0
- package/src/post/api/updatePost.ts +42 -0
- package/src/post/events/index.ts +3 -0
- package/src/post/events/onPostCreated.ts +39 -0
- package/src/post/events/onPostDeleted.ts +39 -0
- package/src/post/events/onPostUpdated.ts +39 -0
- package/src/post/observers/index.ts +2 -0
- package/src/post/observers/observePost.ts +72 -0
- package/src/post/observers/observePosts.ts +66 -0
- package/src/reaction/api/addReaction.ts +84 -0
- package/src/reaction/api/index.ts +2 -0
- package/src/reaction/api/removeReaction.ts +84 -0
- package/src/reaction/events/index.ts +1 -0
- package/src/reaction/events/onReactionAdded.ts +43 -0
- package/src/reaction/events/onReactionRemoved.ts +41 -0
- package/src/reaction/utils/dispatchReactable.ts +19 -0
- package/src/reaction/utils/fetchReference.ts +18 -0
- package/src/reaction/utils/index.ts +2 -0
- package/src/report/api/createReport.ts +40 -0
- package/src/report/api/deleteReport.ts +40 -0
- package/src/report/api/index.ts +4 -0
- package/src/report/api/isReportedByMe.ts +37 -0
- package/src/report/constants/referenceTypes.ts +22 -0
- package/src/role/api/getRole.ts +53 -0
- package/src/role/api/index.ts +2 -0
- package/src/role/api/queryRoles.ts +79 -0
- package/src/stream/api/createStream.ts +33 -0
- package/src/stream/api/deleteStream.ts +38 -0
- package/src/stream/api/getStream.ts +29 -0
- package/src/stream/api/index.ts +7 -0
- package/src/stream/api/queryStreams.ts +44 -0
- package/src/stream/api/updateStream.ts +36 -0
- package/src/stream/events/index.ts +3 -0
- package/src/stream/events/onStreamRecorded.ts +39 -0
- package/src/stream/events/onStreamStarted.ts +39 -0
- package/src/stream/events/onStreamStopped.ts +39 -0
- package/src/user/api/getUser.ts +59 -0
- package/src/user/api/getUsers.ts +60 -0
- package/src/user/api/index.ts +5 -0
- package/src/user/api/queryUsers.ts +88 -0
- package/src/user/api/updateUser.ts +44 -0
- package/src/user/events/index.ts +1 -0
- package/src/user/events/onUserUpdated.ts +39 -0
- package/src/user/observers/index.ts +1 -0
- package/src/user/observers/observeUser.ts +64 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Amity {
|
|
5
|
+
const enum StreamStatus {
|
|
6
|
+
IDLE = 'idle',
|
|
7
|
+
LIVE = 'live',
|
|
8
|
+
ENDED = 'ended',
|
|
9
|
+
RECORDED = 'recorded',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type MultiFormat<T> = {
|
|
13
|
+
flv?: T
|
|
14
|
+
mp4?: T
|
|
15
|
+
m3u8?: T
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type StreamPlatform = {
|
|
19
|
+
name: string
|
|
20
|
+
version: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type StreamEndpoint = {
|
|
24
|
+
url: string
|
|
25
|
+
components: {
|
|
26
|
+
origin: string
|
|
27
|
+
appName: string
|
|
28
|
+
streamName: string
|
|
29
|
+
query: string
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type StreamRecording = {
|
|
34
|
+
url: string
|
|
35
|
+
duration: number
|
|
36
|
+
startTime: number
|
|
37
|
+
stopTime: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type Stream = {
|
|
41
|
+
streamId: string
|
|
42
|
+
title: string
|
|
43
|
+
thumbnailFileId?: Amity.File<'image'>['fileId']
|
|
44
|
+
description?: string
|
|
45
|
+
status: StreamStatus
|
|
46
|
+
platform: StreamPlatform
|
|
47
|
+
|
|
48
|
+
streamerUrl: StreamEndpoint
|
|
49
|
+
watcherUrl: MultiFormat<StreamEndpoint>
|
|
50
|
+
recordings: MultiFormat<StreamRecording>[]
|
|
51
|
+
}
|
|
52
|
+
& Amity.Metadata
|
|
53
|
+
& Amity.Timestamps
|
|
54
|
+
& Amity.SoftDelete
|
|
55
|
+
& Amity.Syncable
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Amity {
|
|
5
|
+
type User = {
|
|
6
|
+
userId: string
|
|
7
|
+
displayName?: string
|
|
8
|
+
avatarFileId?: Amity.File<'image'>['fileId']
|
|
9
|
+
description?: string
|
|
10
|
+
}
|
|
11
|
+
& Amity.Metadata
|
|
12
|
+
& Amity.Taggable
|
|
13
|
+
& Amity.Flaggable
|
|
14
|
+
& Amity.Accredited
|
|
15
|
+
& Amity.Timestamps
|
|
16
|
+
& Amity.Syncable
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P] }
|
|
5
|
+
|
|
6
|
+
type Patch<T, K extends keyof T> = Partial<Pick<T, K>>
|
|
7
|
+
|
|
8
|
+
type Unwrap<T> = (
|
|
9
|
+
T extends Promise<infer U> ? U :
|
|
10
|
+
T extends (...args: any) => Promise<infer U> ? U :
|
|
11
|
+
T extends (...args: any) => infer U ? U :
|
|
12
|
+
T
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
interface ObjectConstructor {
|
|
16
|
+
keys<T>(o: T): ObjectKeys<T>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type ObjectKeys<T> = (
|
|
20
|
+
T extends object ? (keyof T)[] :
|
|
21
|
+
T extends number ? [] :
|
|
22
|
+
T extends Array<any> | string ? string[] :
|
|
23
|
+
never
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import './global' // global types (system)
|
|
2
|
+
|
|
3
|
+
import './core/errors' // global errors
|
|
4
|
+
import './core/permissions' // permissions enum
|
|
5
|
+
|
|
6
|
+
import './core/payload' // backend payload definition
|
|
7
|
+
import './core/events' // sdk events definitions
|
|
8
|
+
import './core/query' // createQuery, runQuery
|
|
9
|
+
import './core/store' // store definition
|
|
10
|
+
import './core/cache' // cache.pull('user', ...)
|
|
11
|
+
|
|
12
|
+
// domains
|
|
13
|
+
import './domains/client' // client definition
|
|
14
|
+
|
|
15
|
+
import './domains/user'
|
|
16
|
+
import './domains/file'
|
|
17
|
+
|
|
18
|
+
import './domains/partials' // small model partials (CreatedAt, etc...)
|
|
19
|
+
import './domains/content' // content partial
|
|
20
|
+
import './domains/reaction'
|
|
21
|
+
|
|
22
|
+
import './domains/group'
|
|
23
|
+
import './domains/channel'
|
|
24
|
+
import './domains/message'
|
|
25
|
+
|
|
26
|
+
import './domains/community'
|
|
27
|
+
import './domains/category'
|
|
28
|
+
import './domains/post'
|
|
29
|
+
import './domains/comment'
|
|
30
|
+
|
|
31
|
+
import './domains/stream'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { getCategory } from '@amityco/ts-sdk'
|
|
9
|
+
* const category = await getCategory('foo')
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fetches a {@link Amity.Category} object
|
|
13
|
+
*
|
|
14
|
+
* @param categoryId the ID of the {@link Amity.Category} to fetch
|
|
15
|
+
* @returns the associated {@link Amity.Category} object
|
|
16
|
+
*
|
|
17
|
+
* @category Category API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export const getCategory = async (
|
|
21
|
+
categoryId: Amity.Category['categoryId']
|
|
22
|
+
) => {
|
|
23
|
+
const client = getActiveClient()
|
|
24
|
+
client.log('category/getCategory', categoryId)
|
|
25
|
+
|
|
26
|
+
const { data } = await client.http.get<Amity.CategoryPayload>(
|
|
27
|
+
`/api/v3/community-categories/${categoryId}`
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
decoratePayload(data)
|
|
31
|
+
ingestInCache(data)
|
|
32
|
+
|
|
33
|
+
const { categories } = data
|
|
34
|
+
return categories[0]
|
|
35
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload, toPage, toToken } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
import { toRecord } from '~/core/model'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ```js
|
|
9
|
+
* import { queryCategories } from '@amityco/ts-sdk'
|
|
10
|
+
* const categories = await queryCategories()
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Queries a paginable list of {@link Amity.Category} objects
|
|
14
|
+
*
|
|
15
|
+
* @param query The query parameters
|
|
16
|
+
* @returns A page of {@link Amity.Category} objects
|
|
17
|
+
*
|
|
18
|
+
* @category Community API
|
|
19
|
+
* @async
|
|
20
|
+
**/
|
|
21
|
+
export const queryCategories = async (query?: {
|
|
22
|
+
sortBy?: 'lastCreated' | 'firstCreated' | 'name'
|
|
23
|
+
isDeleted?: Amity.Category['isDeleted']
|
|
24
|
+
page?: Amity.Page
|
|
25
|
+
}) => {
|
|
26
|
+
const client = getActiveClient()
|
|
27
|
+
client.log('category/queryCategories', query)
|
|
28
|
+
|
|
29
|
+
const { page, ...params } = query ?? {}
|
|
30
|
+
|
|
31
|
+
const { data } = await client.http.get<Amity.CategoryPayload & Amity.Pagination>(
|
|
32
|
+
`/api/v3/community-categories`, { params : {
|
|
33
|
+
...params,
|
|
34
|
+
options: {
|
|
35
|
+
token: toToken(page, 'skiplimit')
|
|
36
|
+
}
|
|
37
|
+
} })
|
|
38
|
+
|
|
39
|
+
const { paging, ...response } = data
|
|
40
|
+
|
|
41
|
+
decoratePayload(response as unknown as Record<string, any[]>)
|
|
42
|
+
ingestInCache(response as unknown as Record<string, any[]>)
|
|
43
|
+
|
|
44
|
+
const prevPage = toPage(paging?.previous)
|
|
45
|
+
const nextPage = toPage(paging?.next)
|
|
46
|
+
|
|
47
|
+
const { categories } = response
|
|
48
|
+
return [toRecord(categories), { prevPage, nextPage }] as const
|
|
49
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
import { fireEvent } from '~/core/events'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ```js
|
|
9
|
+
* import { addChannelMembers } from '@amityco/ts-sdk'
|
|
10
|
+
* const updated = await addChannelMembers(channelId, ['foo', 'bar'])
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Adds a list of {@link Amity.User} to a {@link Amity.Channel}
|
|
14
|
+
*
|
|
15
|
+
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
16
|
+
* @param userIds The list of IDs {@link Amity.User} to add
|
|
17
|
+
* @returns A success boolean if the {@link Amity.User} were added to the {@link Amity.Channel}
|
|
18
|
+
*
|
|
19
|
+
* @category Channel API
|
|
20
|
+
* @async
|
|
21
|
+
*/
|
|
22
|
+
export const addChannelMembers = async (
|
|
23
|
+
channelId: Amity.Channel['channelId'],
|
|
24
|
+
userIds: Amity.User['userId'][]
|
|
25
|
+
) => {
|
|
26
|
+
const client = getActiveClient()
|
|
27
|
+
client.log('channel/addChannelMembers', channelId, userIds)
|
|
28
|
+
|
|
29
|
+
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
30
|
+
`/api/v3/channels/${channelId}/users`,
|
|
31
|
+
{ channelId, userIds }
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
decoratePayload(data)
|
|
35
|
+
ingestInCache(data)
|
|
36
|
+
fireEvent('v3.channel.didAddUsers', {
|
|
37
|
+
channels: data.channels!,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const { channelUsers } = data
|
|
41
|
+
return !!channelUsers.find(
|
|
42
|
+
channelUser =>
|
|
43
|
+
channelUser.channelId === channelId && channelUser.membership === 'member'
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { addChannelMembersRole } from '@amityco/ts-sdk'
|
|
9
|
+
* const updated = await addChannelMembersRole(channelId, 'foo', ['bar'])
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Adds an {@link Amity.Role} to a list of {@link Amity.User} on a {@link Amity.Channel}
|
|
13
|
+
*
|
|
14
|
+
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
15
|
+
* @param roleId The ID of the {@link Amity.Role} to apply
|
|
16
|
+
* @param userId Array of IDs of the {@link Amity.User} to perform
|
|
17
|
+
* @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Channel}
|
|
18
|
+
*
|
|
19
|
+
* @category Channel API
|
|
20
|
+
* @async
|
|
21
|
+
*/
|
|
22
|
+
export const addChannelMembersRole = async (
|
|
23
|
+
channelId: Amity.Channel['channelId'],
|
|
24
|
+
roleId: Amity.Role['roleId'],
|
|
25
|
+
userIds: Amity.User['userId'][]
|
|
26
|
+
) => {
|
|
27
|
+
const client = getActiveClient()
|
|
28
|
+
client.log('channel/addChannelMembersRole', channelId, roleId, userIds)
|
|
29
|
+
|
|
30
|
+
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
31
|
+
`/api/v3/channels/${channelId}/users/roles`,
|
|
32
|
+
{ channelId, role: roleId, userIds }
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
decoratePayload(data)
|
|
36
|
+
ingestInCache(data)
|
|
37
|
+
|
|
38
|
+
const { channelUsers } = data
|
|
39
|
+
return !!channelUsers.find(
|
|
40
|
+
channelUser =>
|
|
41
|
+
channelUser.channelId === channelId && channelUser.roles.includes(roleId)
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { createChannel } from '@amityco/ts-sdk'
|
|
9
|
+
* const created = await createChannel({ channelId: 'foobar', displayName: 'foobar' })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Creates an {@link Amity.Channel}
|
|
13
|
+
*
|
|
14
|
+
* @param bundle The data necessary to create a new {@link Amity.Channel}
|
|
15
|
+
* @returns The newly created {@link Amity.Channel}
|
|
16
|
+
*
|
|
17
|
+
* @category Channel API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export const createChannel = async <T extends Amity.ChannelType>(
|
|
21
|
+
bundle: { type: T, userIds?: Amity.User['userId'] }
|
|
22
|
+
& Pick<Amity.Channel<T>, 'displayName' | 'avatarFileId' | 'tags' | 'metadata'>
|
|
23
|
+
) => {
|
|
24
|
+
const client = getActiveClient()
|
|
25
|
+
client.log('user/createChannel', bundle)
|
|
26
|
+
|
|
27
|
+
const { data } = await client.http.post<Amity.ChannelPayload>(
|
|
28
|
+
'/api/v3/channels', bundle,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
decoratePayload(data)
|
|
32
|
+
ingestInCache(data)
|
|
33
|
+
// no need for event, fired by server
|
|
34
|
+
|
|
35
|
+
const { channels } = data
|
|
36
|
+
return channels[0]
|
|
37
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { getChannel } from './getChannel'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ```js
|
|
7
|
+
* import { deleteChannel } from '@amityco/ts-sdk'
|
|
8
|
+
* const success = await deleteChannel('foobar')
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Deletes a {@link Amity.Channel}
|
|
12
|
+
*
|
|
13
|
+
* @param channelId The {@link Amity.Channel} ID to delete
|
|
14
|
+
* @return A success boolean if the {@link Amity.Channel} was deleted
|
|
15
|
+
*
|
|
16
|
+
* @category Channel API
|
|
17
|
+
* @async
|
|
18
|
+
*/
|
|
19
|
+
export const deleteChannel = async (
|
|
20
|
+
channelId: Amity.Channel['channelId'],
|
|
21
|
+
) => {
|
|
22
|
+
const client = getActiveClient()
|
|
23
|
+
client.log('channel/deleteChannel', channelId)
|
|
24
|
+
|
|
25
|
+
// API-FIX: This endpoint has not been implemented yet.
|
|
26
|
+
await client.http.delete<{ success: boolean }>(
|
|
27
|
+
`/api/v3/channels/${channelId}`
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const deleted = await getChannel(channelId)
|
|
31
|
+
// no need for event, fired by server
|
|
32
|
+
|
|
33
|
+
return deleted
|
|
34
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { ingestInCache, pullFromCache } from '~/core/cache'
|
|
4
|
+
import { decoratePayload } from '~/core/query'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { getChannel } from '@amityco/ts-sdk'
|
|
9
|
+
* const channel = await getChannel('foobar')
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fetches a {@link Amity.Channel} object
|
|
13
|
+
*
|
|
14
|
+
* @param channelId the ID of the {@link Amity.Channel} to fetch
|
|
15
|
+
* @returns the associated {@link Amity.Channel} object
|
|
16
|
+
*
|
|
17
|
+
* @category Channel API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export const getChannel = async (
|
|
21
|
+
channelId: Amity.Channel['channelId'],
|
|
22
|
+
) => {
|
|
23
|
+
const client = getActiveClient()
|
|
24
|
+
client.log('channel/getChannel', channelId)
|
|
25
|
+
|
|
26
|
+
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
27
|
+
const { data } = await client.http.get<Amity.ChannelPayload>(
|
|
28
|
+
`/api/v3/channels/${channelId}`,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
decoratePayload(data)
|
|
32
|
+
ingestInCache(data)
|
|
33
|
+
|
|
34
|
+
const { channels } = data
|
|
35
|
+
return channels.find(channel => channel.channelId === channelId)!
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* ```js
|
|
40
|
+
* import { getChannel } from '@amityco/ts-sdk'
|
|
41
|
+
* const channel = getChannel.locally('foobar')
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Fetches a {@link Amity.Channel} object from cache
|
|
45
|
+
*
|
|
46
|
+
* @param channelId the ID of the {@link Amity.Channel} to fetch
|
|
47
|
+
* @returns the associated {@link Amity.Channel} object
|
|
48
|
+
*
|
|
49
|
+
* @category Channel API
|
|
50
|
+
*/
|
|
51
|
+
getChannel.locally = (
|
|
52
|
+
channelId: Amity.Channel['channelId'],
|
|
53
|
+
) => {
|
|
54
|
+
const client = getActiveClient()
|
|
55
|
+
client.log('channel/getChannel.locally', channelId)
|
|
56
|
+
|
|
57
|
+
const [channel] = pullFromCache('channel', channelId) ?? []
|
|
58
|
+
return channel
|
|
59
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache, pullFromCache } from '~/core/cache'
|
|
5
|
+
import { toRecord } from '~/core/model'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ```js
|
|
9
|
+
* import { getChannels } from '@amityco/ts-sdk'
|
|
10
|
+
* const channels = await getChannels(['foo', 'bar'])
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Fetches a collection of {@link Amity.Channel} objects
|
|
14
|
+
*
|
|
15
|
+
* @param channelIds the IDs of the {@link Amity.Channel} to fetch
|
|
16
|
+
* @returns the associated collection of {@link Amity.Channel} objects
|
|
17
|
+
*
|
|
18
|
+
* @category Channel API
|
|
19
|
+
* @async
|
|
20
|
+
*/
|
|
21
|
+
export const getChannels = async (
|
|
22
|
+
channelIds: Amity.Channel['channelId'][],
|
|
23
|
+
) => {
|
|
24
|
+
const client = getActiveClient()
|
|
25
|
+
client.log('channel/getChannels', channelIds)
|
|
26
|
+
|
|
27
|
+
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
28
|
+
const { data } = await client.http.get<Amity.ChannelPayload>(
|
|
29
|
+
`/api/v3/channels/list`,
|
|
30
|
+
{ params: { channelIds } },
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
decoratePayload(data)
|
|
34
|
+
ingestInCache(data)
|
|
35
|
+
|
|
36
|
+
const { channels } = data
|
|
37
|
+
return toRecord(channels)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ```js
|
|
42
|
+
* import { getChannels } from '@amityco/ts-sdk'
|
|
43
|
+
* const channels = getChannels.locally(['foo', 'bar']) ?? []
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Fetches a collection of {@link Amity.Channel} objects from cache
|
|
47
|
+
*
|
|
48
|
+
* @param channelIds the IDs of the {@link Amity.Channel} to fetch
|
|
49
|
+
* @returns the associated collection of {@link Amity.Channel} objects
|
|
50
|
+
*
|
|
51
|
+
* @category Channel API
|
|
52
|
+
*/
|
|
53
|
+
getChannels.locally = (
|
|
54
|
+
channelIds: Amity.Channel['channelId'][],
|
|
55
|
+
) => {
|
|
56
|
+
const client = getActiveClient()
|
|
57
|
+
client.log('channel/getChannels.locally', channelIds)
|
|
58
|
+
|
|
59
|
+
const cached = pullFromCache('channel', ...channelIds) ?? []
|
|
60
|
+
|
|
61
|
+
if (cached?.length === channelIds.length)
|
|
62
|
+
return toRecord(cached!)
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './queryChannels'
|
|
2
|
+
export * from './getChannels'
|
|
3
|
+
export * from './getChannel'
|
|
4
|
+
|
|
5
|
+
export * from './createChannel'
|
|
6
|
+
export * from './updateChannel'
|
|
7
|
+
export * from './deleteChannel'
|
|
8
|
+
|
|
9
|
+
export * from './joinChannel'
|
|
10
|
+
export * from './leaveChannel'
|
|
11
|
+
|
|
12
|
+
export * from './queryChannelMembers'
|
|
13
|
+
|
|
14
|
+
export * from './addChannelMembers'
|
|
15
|
+
export * from './removeChannelMembers'
|
|
16
|
+
|
|
17
|
+
export * from './addChannelMembersRole'
|
|
18
|
+
export * from './removeChannelMembersRole'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { joinChannel } from '@amityco/ts-sdk'
|
|
9
|
+
* const isJoined = await joinChannel('foobar')
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Joins a {@link Amity.Channel} object
|
|
13
|
+
*
|
|
14
|
+
* @param channelId the {@link Amity.Channel} to join
|
|
15
|
+
* @returns A success boolean if the {@link Amity.Channel} was joined
|
|
16
|
+
*
|
|
17
|
+
* @category Channel API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export const joinChannel = async (channelId: Amity.Channel['channelId']) => {
|
|
21
|
+
const client = getActiveClient()
|
|
22
|
+
client.log('channel/joinChannel', channelId)
|
|
23
|
+
|
|
24
|
+
const { data } = await client.http.post<Amity.ChannelMembershipPayload>(
|
|
25
|
+
`/api/v3/channels/${channelId}/join`,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
decoratePayload(data)
|
|
29
|
+
ingestInCache(data)
|
|
30
|
+
// no need for event, fired by server
|
|
31
|
+
|
|
32
|
+
const { channelUsers } = data
|
|
33
|
+
|
|
34
|
+
return !!channelUsers.find(channelUser => (
|
|
35
|
+
channelUser.channelId === channelId
|
|
36
|
+
&& channelUser.membership === 'member'
|
|
37
|
+
))
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ```js
|
|
8
|
+
* import { leaveChannel } from '@amityco/ts-sdk'
|
|
9
|
+
* const isLeft = await leaveChannel('foobar')
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Leave a {@link Amity.Channel} object
|
|
13
|
+
*
|
|
14
|
+
* @param channelId the {@link Amity.Channel} to leave
|
|
15
|
+
* @returns A success boolean if the {@link Amity.Channel} was left
|
|
16
|
+
*
|
|
17
|
+
* @category Channel API
|
|
18
|
+
* @async
|
|
19
|
+
*/
|
|
20
|
+
export const leaveChannel = async (channelId: Amity.Channel['channelId']) => {
|
|
21
|
+
const client = getActiveClient()
|
|
22
|
+
client.log('channel/leaveChannel', channelId)
|
|
23
|
+
|
|
24
|
+
const { data } = await client.http.delete<Amity.ChannelMembershipPayload>(
|
|
25
|
+
`/api/v3/channels/${channelId}/leave`,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
decoratePayload(data)
|
|
29
|
+
ingestInCache(data)
|
|
30
|
+
// no need for event, fired by server
|
|
31
|
+
|
|
32
|
+
const { channelUsers } = data
|
|
33
|
+
|
|
34
|
+
return !!channelUsers.find(channelUser => (
|
|
35
|
+
channelUser.channelId === channelId
|
|
36
|
+
&& channelUser.membership !== 'member'
|
|
37
|
+
))
|
|
38
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api'
|
|
2
|
+
|
|
3
|
+
import { decoratePayload, toPage, toToken } from '~/core/query'
|
|
4
|
+
import { ingestInCache } from '~/core/cache'
|
|
5
|
+
|
|
6
|
+
import { toRecord } from '~/core/model'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ```js
|
|
10
|
+
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
11
|
+
* const channelMembers = await queryChannelMembers({ channelId: 'foo' })
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Queries a paginable list of {@link Amity.ChannelUser} objects
|
|
15
|
+
*
|
|
16
|
+
* @param query The query parameters
|
|
17
|
+
* @returns A page of {@link Amity.ChannelUser} objects
|
|
18
|
+
*
|
|
19
|
+
* @category Channel API
|
|
20
|
+
* @async
|
|
21
|
+
**/
|
|
22
|
+
export const queryChannelMembers = async (query: {
|
|
23
|
+
channelId: string
|
|
24
|
+
membership?: 'all' | 'muted' | 'banned' | 'member&banned'
|
|
25
|
+
roles?: string[]
|
|
26
|
+
sortBy?: 'firstCreated' | 'lastCreated'
|
|
27
|
+
page?: Amity.Page
|
|
28
|
+
}) => {
|
|
29
|
+
const client = getActiveClient()
|
|
30
|
+
client.log('channel/queryChannelMembers', query)
|
|
31
|
+
|
|
32
|
+
const { page, channelId, membership, ...params } = query ?? {}
|
|
33
|
+
|
|
34
|
+
const { data } = await client.http.get<
|
|
35
|
+
Amity.ChannelMembershipPayload & Amity.Pagination
|
|
36
|
+
>(`/api/v3/channels/${channelId}/users`, {
|
|
37
|
+
params: {
|
|
38
|
+
...params,
|
|
39
|
+
filter: membership,
|
|
40
|
+
options: {
|
|
41
|
+
token: toToken(page, 'skiplimit'),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const { paging, ...response } = data
|
|
47
|
+
|
|
48
|
+
decoratePayload(response as unknown as Record<string, Object[]>)
|
|
49
|
+
ingestInCache(response as unknown as Record<string, Object[]>)
|
|
50
|
+
|
|
51
|
+
const { channelUsers } = response
|
|
52
|
+
|
|
53
|
+
const nextPage = toPage(paging.next)
|
|
54
|
+
const prevPage = toPage(paging.previous)
|
|
55
|
+
|
|
56
|
+
return { data: toRecord(channelUsers), nextPage, prevPage }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* ```js
|
|
61
|
+
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
62
|
+
* const channelMembers = await queryChannelMembers(query)
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* Queries a paginable list of {@link Amity.Post} objects from cache
|
|
66
|
+
*
|
|
67
|
+
* @param query The query parameters
|
|
68
|
+
* @returns posts
|
|
69
|
+
*
|
|
70
|
+
* @category Post API
|
|
71
|
+
*/
|
|
72
|
+
queryChannelMembers.locally = (
|
|
73
|
+
query: Parameters<typeof queryChannelMembers>[0]
|
|
74
|
+
) => {
|
|
75
|
+
const client = getActiveClient()
|
|
76
|
+
client.log('channel/queryChannelMembers', query)
|
|
77
|
+
|
|
78
|
+
// TODO
|
|
79
|
+
}
|