@amityco/ts-sdk 0.0.1-beta.40 → 0.0.1-beta.41.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.
- package/README.md +3 -1
- package/dist/category/api/queryCategories.d.ts.map +1 -1
- package/dist/channel/api/addChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/addChannelMembersRole.d.ts.map +1 -1
- package/dist/channel/api/banChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/createChannel.d.ts.map +1 -1
- package/dist/channel/api/getChannel.d.ts.map +1 -1
- package/dist/channel/api/joinChannel.d.ts.map +1 -1
- package/dist/channel/api/leaveChannel.d.ts.map +1 -1
- package/dist/channel/api/queryChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/queryChannels.d.ts.map +1 -1
- package/dist/channel/api/removeChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/removeChannelMembersRole.d.ts +1 -1
- package/dist/channel/api/removeChannelMembersRole.d.ts.map +1 -1
- package/dist/channel/api/startReading.d.ts +3 -3
- package/dist/channel/api/startReading.d.ts.map +1 -1
- package/dist/channel/api/stopReading.d.ts +2 -2
- package/dist/channel/api/stopReading.d.ts.map +1 -1
- package/dist/channel/api/unbanChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/updateChannel.d.ts.map +1 -1
- package/dist/client/api/connectClient.d.ts.map +1 -1
- package/dist/client/api/disconnectClient.d.ts.map +1 -1
- package/dist/client/api/renewal.d.ts.map +1 -1
- package/dist/comment/api/createComment.d.ts.map +1 -1
- package/dist/comment/api/deleteComment.d.ts.map +1 -1
- package/dist/comment/api/getComment.d.ts.map +1 -1
- package/dist/comment/api/getComments.d.ts.map +1 -1
- package/dist/comment/api/queryComments.d.ts.map +1 -1
- package/dist/comment/api/updateComment.d.ts.map +1 -1
- package/dist/community/api/addCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/addCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/api/createCommunity.d.ts.map +1 -1
- package/dist/community/api/deleteCommunity.d.ts.map +1 -1
- package/dist/community/api/getCommunity.d.ts.map +1 -1
- package/dist/community/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/community/api/getTopTrendingCommunities.d.ts.map +1 -1
- package/dist/community/api/joinCommunity.d.ts.map +1 -1
- package/dist/community/api/leaveCommunity.d.ts.map +1 -1
- package/dist/community/api/queryCommunities.d.ts.map +1 -1
- package/dist/community/api/queryCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/removeCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/removeCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/api/updateCommunity.d.ts.map +1 -1
- package/dist/core/transports/http.d.ts.map +1 -1
- package/dist/feed/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/file/api/createFile.d.ts.map +1 -1
- package/dist/file/api/createImage.d.ts.map +1 -1
- package/dist/file/api/createVideo.d.ts.map +1 -1
- package/dist/file/api/deleteFile.d.ts.map +1 -1
- package/dist/file/api/getFile.d.ts.map +1 -1
- package/dist/follow/api/acceptFollower.d.ts.map +1 -1
- package/dist/follow/api/declineFollower.d.ts.map +1 -1
- package/dist/follow/api/follow.d.ts.map +1 -1
- package/dist/follow/api/getFollowInfo.d.ts.map +1 -1
- package/dist/follow/api/queryFollowers.d.ts.map +1 -1
- package/dist/follow/api/queryFollowings.d.ts.map +1 -1
- package/dist/follow/api/unfollow.d.ts.map +1 -1
- package/dist/index.cjs.js +426 -67
- package/dist/index.esm.js +426 -67
- package/dist/index.umd.js +2 -2
- package/dist/message/api/createMessage.d.ts.map +1 -1
- package/dist/message/api/deleteMessage.d.ts.map +1 -1
- package/dist/message/api/getMessage.d.ts.map +1 -1
- package/dist/message/api/queryMessages.d.ts.map +1 -1
- package/dist/message/api/updateMessage.d.ts.map +1 -1
- package/dist/poll/api/closePoll.d.ts.map +1 -1
- package/dist/poll/api/createPoll.d.ts.map +1 -1
- package/dist/poll/api/deletePoll.d.ts.map +1 -1
- package/dist/poll/api/getPoll.d.ts.map +1 -1
- package/dist/poll/api/votePoll.d.ts.map +1 -1
- package/dist/post/api/approvePost.d.ts.map +1 -1
- package/dist/post/api/createPost.d.ts.map +1 -1
- package/dist/post/api/declinePost.d.ts.map +1 -1
- package/dist/post/api/deletePost.d.ts.map +1 -1
- package/dist/post/api/getPost.d.ts.map +1 -1
- package/dist/post/api/getPosts.d.ts.map +1 -1
- package/dist/post/api/queryPosts.d.ts.map +1 -1
- package/dist/post/api/updatePost.d.ts.map +1 -1
- package/dist/reaction/api/addReaction.d.ts.map +1 -1
- package/dist/reaction/api/queryReactions.d.ts.map +1 -1
- package/dist/reaction/api/removeReaction.d.ts.map +1 -1
- package/dist/report/api/createReport.d.ts.map +1 -1
- package/dist/report/api/deleteReport.d.ts.map +1 -1
- package/dist/report/api/isReportedByMe.d.ts.map +1 -1
- package/dist/stream/api/createStream.d.ts.map +1 -1
- package/dist/stream/api/deleteStream.d.ts.map +1 -1
- package/dist/stream/api/getStream.d.ts.map +1 -1
- package/dist/stream/api/queryStreams.d.ts.map +1 -1
- package/dist/stream/api/updateStream.d.ts.map +1 -1
- package/dist/subChannel/api/createSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/deleteSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/getSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/querySubChannels.d.ts.map +1 -1
- package/dist/subChannel/api/updateSubChannel.d.ts.map +1 -1
- package/dist/user/api/getUser.d.ts.map +1 -1
- package/dist/user/api/getUsers.d.ts.map +1 -1
- package/dist/user/api/queryUsers.d.ts.map +1 -1
- package/dist/user/api/updateUser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/category/api/queryCategories.ts +3 -0
- package/src/channel/api/addChannelMembers.ts +4 -0
- package/src/channel/api/addChannelMembersRole.ts +4 -0
- package/src/channel/api/banChannelMembers.ts +4 -0
- package/src/channel/api/createChannel.ts +4 -0
- package/src/channel/api/getChannel.ts +4 -0
- package/src/channel/api/joinChannel.ts +4 -0
- package/src/channel/api/leaveChannel.ts +4 -0
- package/src/channel/api/queryChannelMembers.ts +4 -0
- package/src/channel/api/queryChannels.ts +4 -0
- package/src/channel/api/removeChannelMembers.ts +4 -0
- package/src/channel/api/removeChannelMembersRole.ts +5 -1
- package/src/channel/api/startReading.ts +7 -3
- package/src/channel/api/stopReading.ts +6 -2
- package/src/channel/api/unbanChannelMembers.ts +4 -0
- package/src/channel/api/updateChannel.ts +4 -0
- package/src/client/api/connectClient.ts +4 -0
- package/src/client/api/disconnectClient.ts +4 -0
- package/src/client/api/getToken.ts +1 -1
- package/src/client/api/renewal.ts +4 -0
- package/src/client/api/tests/getToken.test.ts +2 -2
- package/src/comment/api/createComment.ts +4 -0
- package/src/comment/api/deleteComment.ts +4 -0
- package/src/comment/api/getComment.ts +4 -0
- package/src/comment/api/getComments.ts +4 -0
- package/src/comment/api/queryComments.ts +4 -0
- package/src/comment/api/updateComment.ts +4 -0
- package/src/community/api/addCommunityMembers.ts +4 -0
- package/src/community/api/addCommunityMembersRoles.ts +4 -0
- package/src/community/api/createCommunity.ts +4 -0
- package/src/community/api/deleteCommunity.ts +4 -0
- package/src/community/api/getCommunity.ts +4 -0
- package/src/community/api/getRecommendedCommunities.ts +4 -0
- package/src/community/api/getTopTrendingCommunities.ts +4 -0
- package/src/community/api/joinCommunity.ts +4 -0
- package/src/community/api/leaveCommunity.ts +4 -0
- package/src/community/api/queryCommunities.ts +4 -0
- package/src/community/api/queryCommunityMembers.ts +4 -0
- package/src/community/api/removeCommunityMembers.ts +4 -0
- package/src/community/api/removeCommunityMembersRoles.ts +4 -0
- package/src/community/api/updateCommunity.ts +4 -0
- package/src/core/transports/http.ts +5 -0
- package/src/core/transports/test/http.test.ts +12 -0
- package/src/feed/api/queryGlobalFeed.ts +4 -0
- package/src/file/api/createFile.ts +4 -0
- package/src/file/api/createImage.ts +4 -0
- package/src/file/api/createVideo.ts +4 -0
- package/src/file/api/deleteFile.ts +4 -0
- package/src/file/api/getFile.ts +4 -0
- package/src/follow/api/acceptFollower.ts +4 -0
- package/src/follow/api/declineFollower.ts +4 -0
- package/src/follow/api/follow.ts +4 -0
- package/src/follow/api/getFollowInfo.ts +4 -0
- package/src/follow/api/queryFollowers.ts +4 -0
- package/src/follow/api/queryFollowings.ts +4 -0
- package/src/follow/api/unfollow.ts +4 -0
- package/src/message/api/createMessage.ts +9 -4
- package/src/message/api/deleteMessage.ts +4 -0
- package/src/message/api/getMessage.ts +4 -0
- package/src/message/api/queryMessages.ts +4 -0
- package/src/message/api/tests/createMessage.test.ts +16 -0
- package/src/message/api/updateMessage.ts +4 -0
- package/src/message/observers/liveMessages.ts +1 -1
- package/src/poll/api/closePoll.ts +4 -0
- package/src/poll/api/createPoll.ts +4 -0
- package/src/poll/api/deletePoll.ts +4 -0
- package/src/poll/api/getPoll.ts +4 -0
- package/src/poll/api/votePoll.ts +4 -0
- package/src/post/api/approvePost.ts +4 -0
- package/src/post/api/createPost.ts +4 -0
- package/src/post/api/declinePost.ts +4 -0
- package/src/post/api/deletePost.ts +4 -0
- package/src/post/api/getPost.ts +4 -0
- package/src/post/api/getPosts.ts +3 -0
- package/src/post/api/queryPosts.ts +4 -0
- package/src/post/api/updatePost.ts +4 -0
- package/src/reaction/api/addReaction.ts +4 -0
- package/src/reaction/api/queryReactions.ts +4 -0
- package/src/reaction/api/removeReaction.ts +4 -0
- package/src/report/api/createReport.ts +4 -0
- package/src/report/api/deleteReport.ts +4 -0
- package/src/report/api/isReportedByMe.ts +4 -0
- package/src/stream/api/createStream.ts +4 -0
- package/src/stream/api/deleteStream.ts +3 -0
- package/src/stream/api/getStream.ts +4 -0
- package/src/stream/api/queryStreams.ts +4 -0
- package/src/stream/api/updateStream.ts +3 -0
- package/src/subChannel/api/createSubChannel.ts +4 -0
- package/src/subChannel/api/deleteSubChannel.ts +4 -0
- package/src/subChannel/api/getSubChannel.ts +4 -0
- package/src/subChannel/api/querySubChannels.ts +4 -0
- package/src/subChannel/api/updateSubChannel.ts +4 -0
- package/src/user/api/getUser.ts +4 -0
- package/src/user/api/getUsers.ts +3 -0
- package/src/user/api/queryUsers.ts +4 -0
- package/src/user/api/updateUser.ts +4 -0
package/dist/index.cjs.js
CHANGED
|
@@ -95,8 +95,8 @@ const PostContentType = Object.freeze({
|
|
|
95
95
|
|
|
96
96
|
function getVersion() {
|
|
97
97
|
try {
|
|
98
|
-
// the string ''v0.0.1-beta.
|
|
99
|
-
return 'v0.0.1-beta.
|
|
98
|
+
// the string ''v0.0.1-beta.41.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
99
|
+
return 'v0.0.1-beta.41.1-cjs';
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
return '__dev__';
|
|
@@ -1473,6 +1473,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
1473
1473
|
});
|
|
1474
1474
|
instance.interceptors.request.use(config => {
|
|
1475
1475
|
var _a;
|
|
1476
|
+
// do not check expiration for token creation url
|
|
1477
|
+
if (config.url === '/api/v4/sessions') {
|
|
1478
|
+
return config;
|
|
1479
|
+
}
|
|
1476
1480
|
// check global.ts for the extension of AxiosRequestConfig
|
|
1477
1481
|
const tokenExpiry = (_a = config.metadata) === null || _a === void 0 ? void 0 : _a.tokenExpiry;
|
|
1478
1482
|
if (tokenExpiry) {
|
|
@@ -20478,7 +20482,7 @@ const getToken = async (params) => {
|
|
|
20478
20482
|
const client = getActiveClient();
|
|
20479
20483
|
client.log('client/api/getToken', params);
|
|
20480
20484
|
const deviceInfo = getDeviceInfo();
|
|
20481
|
-
const { data } = await client.http.post('/api/
|
|
20485
|
+
const { data } = await client.http.post('/api/v4/sessions', Object.assign(Object.assign({}, params), { deviceInfo }), {
|
|
20482
20486
|
// @ts-ignore
|
|
20483
20487
|
headers: { 'X-API-Key': client.apiKey },
|
|
20484
20488
|
});
|
|
@@ -20514,6 +20518,9 @@ const setClientToken = async (params) => {
|
|
|
20514
20518
|
return { accessToken, users, refreshToken };
|
|
20515
20519
|
};
|
|
20516
20520
|
|
|
20521
|
+
/* begin_public_function
|
|
20522
|
+
id: client.logout
|
|
20523
|
+
*/
|
|
20517
20524
|
/**
|
|
20518
20525
|
* ```js
|
|
20519
20526
|
* import { disconnectClient } from '@amityco/ts-sdk'
|
|
@@ -20562,7 +20569,8 @@ const disconnectClient = async () => {
|
|
|
20562
20569
|
client.cache = { data: {} };
|
|
20563
20570
|
}
|
|
20564
20571
|
return !client.ws.connected;
|
|
20565
|
-
};
|
|
20572
|
+
};
|
|
20573
|
+
/* end_public_function */
|
|
20566
20574
|
|
|
20567
20575
|
/**
|
|
20568
20576
|
* Ingest a payload (v3) into the cache
|
|
@@ -20766,6 +20774,9 @@ const onTokenTerminated = (callback) => {
|
|
|
20766
20774
|
* to be cleared
|
|
20767
20775
|
*/
|
|
20768
20776
|
const subscriptions = [];
|
|
20777
|
+
/* begin_public_function
|
|
20778
|
+
id: client.login
|
|
20779
|
+
*/
|
|
20769
20780
|
/**
|
|
20770
20781
|
* ```js
|
|
20771
20782
|
* import { connectClient } from '@amityco/ts-sdk/client/api'
|
|
@@ -20860,8 +20871,12 @@ const connectClient = async (params, sessionHandler, config) => {
|
|
|
20860
20871
|
subscriptions.forEach(fn => fn());
|
|
20861
20872
|
}));
|
|
20862
20873
|
return client.ws.connected;
|
|
20863
|
-
};
|
|
20874
|
+
};
|
|
20875
|
+
/* end_public_function */
|
|
20864
20876
|
|
|
20877
|
+
/* begin_public_function
|
|
20878
|
+
id: client.renew_access_token
|
|
20879
|
+
*/
|
|
20865
20880
|
/*
|
|
20866
20881
|
* Renewal defintion accepted by SessionHandler interface
|
|
20867
20882
|
*
|
|
@@ -20920,7 +20935,8 @@ const renewal = () => {
|
|
|
20920
20935
|
}, ACCESS_TOKEN_WATCHER_INTERVAL);
|
|
20921
20936
|
},
|
|
20922
20937
|
};
|
|
20923
|
-
};
|
|
20938
|
+
};
|
|
20939
|
+
/* end_public_function */
|
|
20924
20940
|
|
|
20925
20941
|
const ABOUT_TO_EXPIRE_THRESHOLD = 80 / 100;
|
|
20926
20942
|
const COMPENSATED_DELAY = 5 * MINUTE;
|
|
@@ -21115,6 +21131,9 @@ const pushToTombstone = (model, modelId) => {
|
|
|
21115
21131
|
pushToCache(cacheKey, data);
|
|
21116
21132
|
};
|
|
21117
21133
|
|
|
21134
|
+
/* begin_public_function
|
|
21135
|
+
id: user.get
|
|
21136
|
+
*/
|
|
21118
21137
|
/**
|
|
21119
21138
|
* ```js
|
|
21120
21139
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21157,6 +21176,7 @@ const getUser = async (userId, isLive = false) => {
|
|
|
21157
21176
|
cachedAt,
|
|
21158
21177
|
};
|
|
21159
21178
|
};
|
|
21179
|
+
/* end_public_function */
|
|
21160
21180
|
/**
|
|
21161
21181
|
* ```js
|
|
21162
21182
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21176,6 +21196,9 @@ getUser.locally = (userId) => {
|
|
|
21176
21196
|
return client.cache && pullFromCache(['user', 'get', userId]);
|
|
21177
21197
|
};
|
|
21178
21198
|
|
|
21199
|
+
/* begin_public_function
|
|
21200
|
+
id: user.get_by_ids
|
|
21201
|
+
*/
|
|
21179
21202
|
/**
|
|
21180
21203
|
* ```js
|
|
21181
21204
|
* import { getUsers } from '@amityco/ts-sdk'
|
|
@@ -21266,6 +21289,9 @@ function __rest(s, e) {
|
|
|
21266
21289
|
return t;
|
|
21267
21290
|
}
|
|
21268
21291
|
|
|
21292
|
+
/* begin_public_function
|
|
21293
|
+
id: user.query, user.search
|
|
21294
|
+
*/
|
|
21269
21295
|
/**
|
|
21270
21296
|
* ```js
|
|
21271
21297
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21309,6 +21335,7 @@ const queryUsers = async (query = {}) => {
|
|
|
21309
21335
|
const nextPage = toPage(paging.next);
|
|
21310
21336
|
return { data: users, cachedAt, prevPage, nextPage };
|
|
21311
21337
|
};
|
|
21338
|
+
/* end_public_function */
|
|
21312
21339
|
/**
|
|
21313
21340
|
* ```js
|
|
21314
21341
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21344,6 +21371,9 @@ queryUsers.locally = (query = {}) => {
|
|
|
21344
21371
|
: undefined;
|
|
21345
21372
|
};
|
|
21346
21373
|
|
|
21374
|
+
/* begin_public_function
|
|
21375
|
+
id: client.update_user
|
|
21376
|
+
*/
|
|
21347
21377
|
/**
|
|
21348
21378
|
* ```js
|
|
21349
21379
|
* import { updateUser } from '@amityco/ts-sdk'
|
|
@@ -21378,7 +21408,8 @@ const updateUser = async (userId, patch) => {
|
|
|
21378
21408
|
data: users.find(user => user.userId === userId),
|
|
21379
21409
|
cachedAt,
|
|
21380
21410
|
};
|
|
21381
|
-
};
|
|
21411
|
+
};
|
|
21412
|
+
/* end_public_function */
|
|
21382
21413
|
|
|
21383
21414
|
/**
|
|
21384
21415
|
* ```js
|
|
@@ -21683,6 +21714,9 @@ const observeUser = (userId, callback) => {
|
|
|
21683
21714
|
};
|
|
21684
21715
|
};
|
|
21685
21716
|
|
|
21717
|
+
/* begin_public_function
|
|
21718
|
+
id: file.get
|
|
21719
|
+
*/
|
|
21686
21720
|
/**
|
|
21687
21721
|
* ```js
|
|
21688
21722
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21711,6 +21745,7 @@ const getFile = async (fileId) => {
|
|
|
21711
21745
|
cachedAt,
|
|
21712
21746
|
};
|
|
21713
21747
|
};
|
|
21748
|
+
/* end_public_function */
|
|
21714
21749
|
/**
|
|
21715
21750
|
* ```js
|
|
21716
21751
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21738,6 +21773,9 @@ getFile.locally = (fileId) => {
|
|
|
21738
21773
|
};
|
|
21739
21774
|
};
|
|
21740
21775
|
|
|
21776
|
+
/* begin_public_function
|
|
21777
|
+
id: file.upload.file
|
|
21778
|
+
*/
|
|
21741
21779
|
/**
|
|
21742
21780
|
* ```js
|
|
21743
21781
|
* import { createFile } from '@amityco/ts-sdk'
|
|
@@ -21777,8 +21815,12 @@ const createFile = async (formData, onProgress) => {
|
|
|
21777
21815
|
cachedAt,
|
|
21778
21816
|
};
|
|
21779
21817
|
};
|
|
21818
|
+
/* end_public_function */
|
|
21780
21819
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21781
21820
|
|
|
21821
|
+
/* begin_public_function
|
|
21822
|
+
id: file.delete
|
|
21823
|
+
*/
|
|
21782
21824
|
/**
|
|
21783
21825
|
* ```js
|
|
21784
21826
|
* import { deleteFile } from '@amityco/ts-sdk'
|
|
@@ -21800,7 +21842,8 @@ const deleteFile = async (fileId) => {
|
|
|
21800
21842
|
await client.http.delete(`/api/v3/files/${fileId}`);
|
|
21801
21843
|
dropFromCache(['file', 'get', fileId], true);
|
|
21802
21844
|
return { success: true };
|
|
21803
|
-
};
|
|
21845
|
+
};
|
|
21846
|
+
/* end_public_function */
|
|
21804
21847
|
|
|
21805
21848
|
/**
|
|
21806
21849
|
* Allow to query a file url with a selected size
|
|
@@ -21813,6 +21856,9 @@ const fileUrlWithSize = (fileUrl, size) => {
|
|
|
21813
21856
|
return `${fileUrl}?size=${size}`;
|
|
21814
21857
|
};
|
|
21815
21858
|
|
|
21859
|
+
/* begin_public_function
|
|
21860
|
+
id: file.upload.video
|
|
21861
|
+
*/
|
|
21816
21862
|
/**
|
|
21817
21863
|
* ```js
|
|
21818
21864
|
* import { createVideo } from '@amityco/ts-sdk'
|
|
@@ -21856,8 +21902,12 @@ const createVideo = async (formData, feedType, onProgress) => {
|
|
|
21856
21902
|
cachedAt,
|
|
21857
21903
|
};
|
|
21858
21904
|
};
|
|
21905
|
+
/* end_public_function */
|
|
21859
21906
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21860
21907
|
|
|
21908
|
+
/* begin_public_function
|
|
21909
|
+
id: file.upload.image
|
|
21910
|
+
*/
|
|
21861
21911
|
/**
|
|
21862
21912
|
* ```js
|
|
21863
21913
|
* import { createImage } from '@amityco/ts-sdk'
|
|
@@ -21897,6 +21947,7 @@ const createImage = async (formData, onProgress) => {
|
|
|
21897
21947
|
cachedAt,
|
|
21898
21948
|
};
|
|
21899
21949
|
};
|
|
21950
|
+
/* end_public_function */
|
|
21900
21951
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21901
21952
|
|
|
21902
21953
|
/**
|
|
@@ -22151,6 +22202,9 @@ function convertQueryParams$1(_a) {
|
|
|
22151
22202
|
return out;
|
|
22152
22203
|
}
|
|
22153
22204
|
|
|
22205
|
+
/* begin_public_function
|
|
22206
|
+
id: message.get
|
|
22207
|
+
*/
|
|
22154
22208
|
/**
|
|
22155
22209
|
* ```js
|
|
22156
22210
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22196,6 +22250,7 @@ const getMessage = async (messageId, isLive = false) => {
|
|
|
22196
22250
|
cachedAt,
|
|
22197
22251
|
};
|
|
22198
22252
|
};
|
|
22253
|
+
/* end_public_function */
|
|
22199
22254
|
/**
|
|
22200
22255
|
* ```js
|
|
22201
22256
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22287,6 +22342,9 @@ getMessages.locally = (messageIds) => {
|
|
|
22287
22342
|
};
|
|
22288
22343
|
};
|
|
22289
22344
|
|
|
22345
|
+
/* begin_public_function
|
|
22346
|
+
id: message.query
|
|
22347
|
+
*/
|
|
22290
22348
|
/**
|
|
22291
22349
|
* ```js
|
|
22292
22350
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22327,6 +22385,7 @@ const queryMessages = async (query) => {
|
|
|
22327
22385
|
const prevPage = toPageRaw(paging.previous);
|
|
22328
22386
|
return { data: messages, cachedAt, prevPage, nextPage };
|
|
22329
22387
|
};
|
|
22388
|
+
/* end_public_function */
|
|
22330
22389
|
/**
|
|
22331
22390
|
* ```js
|
|
22332
22391
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22364,8 +22423,12 @@ queryMessages.locally = (query) => {
|
|
|
22364
22423
|
|
|
22365
22424
|
const uuid = () => nativeIdGenerator__default["default"].v4().toString();
|
|
22366
22425
|
|
|
22426
|
+
const getLocalId = () => `LOCAL_${uuid()}`;
|
|
22367
22427
|
// FIXME: temp solution
|
|
22368
22428
|
let uniqueId;
|
|
22429
|
+
/* begin_public_function
|
|
22430
|
+
id: message.create.text_message, message.create.image_message, message.create.file_message, message.create.video_message, message.create.audio_message, message.create.custom_message
|
|
22431
|
+
*/
|
|
22369
22432
|
/**
|
|
22370
22433
|
* ```js
|
|
22371
22434
|
* import { createMessage, createQuery, runQuery } from '@amityco/ts-sdk'
|
|
@@ -22391,7 +22454,7 @@ let uniqueId;
|
|
|
22391
22454
|
const createMessage = async (bundle) => {
|
|
22392
22455
|
const client = getActiveClient();
|
|
22393
22456
|
client.log('message/createMessage', bundle);
|
|
22394
|
-
const referenceId = uniqueId;
|
|
22457
|
+
const referenceId = uniqueId || getLocalId();
|
|
22395
22458
|
uniqueId = undefined;
|
|
22396
22459
|
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22397
22460
|
const data = prepareMessagePayload(payload);
|
|
@@ -22436,9 +22499,8 @@ createMessage.optimistically = (bundle) => {
|
|
|
22436
22499
|
* Updated to handle client requirement to add messageId while uploading
|
|
22437
22500
|
* message with image. Temporary!
|
|
22438
22501
|
*/
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
const bundleWithMessageId = Object.assign({ messageId: localId, uniqueId: localId }, bundle);
|
|
22502
|
+
uniqueId = getLocalId();
|
|
22503
|
+
const bundleWithMessageId = Object.assign({ messageId: uniqueId, uniqueId }, bundle);
|
|
22442
22504
|
client.log('message/createMessage.optimistically', bundleWithMessageId);
|
|
22443
22505
|
const subChannel = pullFromCache(['subChannel', 'get', bundle.subChannelId]);
|
|
22444
22506
|
if (subChannel) {
|
|
@@ -22460,8 +22522,12 @@ createMessage.optimistically = (bundle) => {
|
|
|
22460
22522
|
cachedAt,
|
|
22461
22523
|
data: message,
|
|
22462
22524
|
};
|
|
22463
|
-
};
|
|
22525
|
+
};
|
|
22526
|
+
/* end_public_function */
|
|
22464
22527
|
|
|
22528
|
+
/* begin_public_function
|
|
22529
|
+
id: message.edit
|
|
22530
|
+
*/
|
|
22465
22531
|
/**
|
|
22466
22532
|
* ```js
|
|
22467
22533
|
* import { updateMessage } from '@amityco/ts-sdk'
|
|
@@ -22527,8 +22593,12 @@ updateMessage.optimistically = (messageId, patch) => {
|
|
|
22527
22593
|
data: updated,
|
|
22528
22594
|
cachedAt,
|
|
22529
22595
|
};
|
|
22530
|
-
};
|
|
22596
|
+
};
|
|
22597
|
+
/* end_public_function */
|
|
22531
22598
|
|
|
22599
|
+
/* begin_public_function
|
|
22600
|
+
id: message.soft_delete
|
|
22601
|
+
*/
|
|
22532
22602
|
/**
|
|
22533
22603
|
* ```js
|
|
22534
22604
|
* import { deleteMessage } from '@amityco/ts-sdk'
|
|
@@ -22579,7 +22649,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22579
22649
|
data: deleted,
|
|
22580
22650
|
cachedAt,
|
|
22581
22651
|
};
|
|
22582
|
-
};
|
|
22652
|
+
};
|
|
22653
|
+
/* end_public_function */
|
|
22583
22654
|
|
|
22584
22655
|
/**
|
|
22585
22656
|
* Attach user object to membership model
|
|
@@ -22641,6 +22712,9 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22641
22712
|
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22642
22713
|
};
|
|
22643
22714
|
|
|
22715
|
+
/* begin_public_function
|
|
22716
|
+
id: post.query, feed.query.community_feed, feed.query.user_feed
|
|
22717
|
+
*/
|
|
22644
22718
|
/**
|
|
22645
22719
|
* ```js
|
|
22646
22720
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22692,6 +22766,7 @@ const queryPosts = async (query) => {
|
|
|
22692
22766
|
const prevPage = toPageRaw(paging.previous);
|
|
22693
22767
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
22694
22768
|
};
|
|
22769
|
+
/* end_public_function */
|
|
22695
22770
|
/**
|
|
22696
22771
|
* ```js
|
|
22697
22772
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22727,6 +22802,9 @@ queryPosts.locally = (query) => {
|
|
|
22727
22802
|
: undefined;
|
|
22728
22803
|
};
|
|
22729
22804
|
|
|
22805
|
+
/* begin_public_function
|
|
22806
|
+
id: post.get_by_ids
|
|
22807
|
+
*/
|
|
22730
22808
|
/**
|
|
22731
22809
|
* ```js
|
|
22732
22810
|
* import { getPosts } from '@amityco/ts-sdk'
|
|
@@ -22790,6 +22868,9 @@ getPosts.locally = (postIds) => {
|
|
|
22790
22868
|
};
|
|
22791
22869
|
};
|
|
22792
22870
|
|
|
22871
|
+
/* begin_public_function
|
|
22872
|
+
id: post.get
|
|
22873
|
+
*/
|
|
22793
22874
|
/**
|
|
22794
22875
|
* ```js
|
|
22795
22876
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22830,6 +22911,7 @@ const getPost = async (postId) => {
|
|
|
22830
22911
|
cachedAt,
|
|
22831
22912
|
};
|
|
22832
22913
|
};
|
|
22914
|
+
/* end_public_function */
|
|
22833
22915
|
/**
|
|
22834
22916
|
* ```js
|
|
22835
22917
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22857,6 +22939,9 @@ getPost.locally = (postId) => {
|
|
|
22857
22939
|
};
|
|
22858
22940
|
};
|
|
22859
22941
|
|
|
22942
|
+
/* begin_public_function
|
|
22943
|
+
id: post.create.text_post, post.create.image_post, post.create.file_post, post.create.video_post, post.create.poll_post, post.create.livestream_post, post.create.custom_post
|
|
22944
|
+
*/
|
|
22860
22945
|
/**
|
|
22861
22946
|
* ```js
|
|
22862
22947
|
* import { createPost } from '@amityco/ts-sdk'
|
|
@@ -22894,8 +22979,12 @@ const createPost = async (bundle) => {
|
|
|
22894
22979
|
data: posts[0],
|
|
22895
22980
|
cachedAt,
|
|
22896
22981
|
};
|
|
22897
|
-
};
|
|
22982
|
+
};
|
|
22983
|
+
/* end_public_function */
|
|
22898
22984
|
|
|
22985
|
+
/* begin_public_function
|
|
22986
|
+
id: post.edit
|
|
22987
|
+
*/
|
|
22899
22988
|
/**
|
|
22900
22989
|
* ```js
|
|
22901
22990
|
* import { updatePost } from '@amityco/ts-sdk'
|
|
@@ -22927,7 +23016,8 @@ const updatePost = async (postId, patch) => {
|
|
|
22927
23016
|
data: posts.find(post => post.postId === postId),
|
|
22928
23017
|
cachedAt,
|
|
22929
23018
|
};
|
|
22930
|
-
};
|
|
23019
|
+
};
|
|
23020
|
+
/* end_public_function */
|
|
22931
23021
|
|
|
22932
23022
|
const getMatchPostSetting = (value) => {
|
|
22933
23023
|
var _a;
|
|
@@ -22953,6 +23043,9 @@ const prepareCommunityRequest = (params) => {
|
|
|
22953
23043
|
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22954
23044
|
};
|
|
22955
23045
|
|
|
23046
|
+
/* begin_public_function
|
|
23047
|
+
id: community.query
|
|
23048
|
+
*/
|
|
22956
23049
|
/**
|
|
22957
23050
|
* ```js
|
|
22958
23051
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -22999,6 +23092,7 @@ const queryCommunities = async (query) => {
|
|
|
22999
23092
|
const prevPage = toPage(paging.previous);
|
|
23000
23093
|
return { data: communities, cachedAt, prevPage, nextPage };
|
|
23001
23094
|
};
|
|
23095
|
+
/* end_public_function */
|
|
23002
23096
|
/**
|
|
23003
23097
|
* ```js
|
|
23004
23098
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -23080,6 +23174,9 @@ getCommunities.locally = (communityIds) => {
|
|
|
23080
23174
|
};
|
|
23081
23175
|
};
|
|
23082
23176
|
|
|
23177
|
+
/* begin_public_function
|
|
23178
|
+
id: community.get
|
|
23179
|
+
*/
|
|
23083
23180
|
/**
|
|
23084
23181
|
* ```js
|
|
23085
23182
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23109,6 +23206,7 @@ const getCommunity = async (communityId) => {
|
|
|
23109
23206
|
cachedAt,
|
|
23110
23207
|
};
|
|
23111
23208
|
};
|
|
23209
|
+
/* end_public_function */
|
|
23112
23210
|
/**
|
|
23113
23211
|
* ```js
|
|
23114
23212
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23136,6 +23234,9 @@ getCommunity.locally = (communityId) => {
|
|
|
23136
23234
|
};
|
|
23137
23235
|
};
|
|
23138
23236
|
|
|
23237
|
+
/* begin_public_function
|
|
23238
|
+
id: community.create
|
|
23239
|
+
*/
|
|
23139
23240
|
/**
|
|
23140
23241
|
* ```js
|
|
23141
23242
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
@@ -23164,8 +23265,12 @@ const createCommunity = async (bundle) => {
|
|
|
23164
23265
|
data: communities[0],
|
|
23165
23266
|
cachedAt,
|
|
23166
23267
|
};
|
|
23167
|
-
};
|
|
23268
|
+
};
|
|
23269
|
+
/* end_public_function */
|
|
23168
23270
|
|
|
23271
|
+
/* begin_public_function
|
|
23272
|
+
id: community.update
|
|
23273
|
+
*/
|
|
23169
23274
|
/**
|
|
23170
23275
|
* ```js
|
|
23171
23276
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
@@ -23195,8 +23300,12 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
23195
23300
|
data: communities.find(community => community.communityId === communityId),
|
|
23196
23301
|
cachedAt,
|
|
23197
23302
|
};
|
|
23198
|
-
};
|
|
23303
|
+
};
|
|
23304
|
+
/* end_public_function */
|
|
23199
23305
|
|
|
23306
|
+
/* begin_public_function
|
|
23307
|
+
id: community.delete
|
|
23308
|
+
*/
|
|
23200
23309
|
/**
|
|
23201
23310
|
* ```js
|
|
23202
23311
|
* import { deleteCommunity } from '@amityco/ts-sdk'
|
|
@@ -23226,8 +23335,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23226
23335
|
users: [],
|
|
23227
23336
|
});
|
|
23228
23337
|
return deleted.data;
|
|
23229
|
-
};
|
|
23338
|
+
};
|
|
23339
|
+
/* end_public_function */
|
|
23230
23340
|
|
|
23341
|
+
/* begin_public_function
|
|
23342
|
+
id: community.join
|
|
23343
|
+
*/
|
|
23231
23344
|
/**
|
|
23232
23345
|
* ```js
|
|
23233
23346
|
* import { joinCommunity } from '@amityco/ts-sdk'
|
|
@@ -23253,8 +23366,12 @@ const joinCommunity = async (communityId) => {
|
|
|
23253
23366
|
ingestInCache(data, { cachedAt });
|
|
23254
23367
|
const { communityUsers } = data;
|
|
23255
23368
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23256
|
-
};
|
|
23369
|
+
};
|
|
23370
|
+
/* end_public_function */
|
|
23257
23371
|
|
|
23372
|
+
/* begin_public_function
|
|
23373
|
+
id: community.leave
|
|
23374
|
+
*/
|
|
23258
23375
|
/**
|
|
23259
23376
|
* ```js
|
|
23260
23377
|
* import { leaveCommunity } from '@amityco/ts-sdk'
|
|
@@ -23280,8 +23397,12 @@ const leaveCommunity = async (communityId) => {
|
|
|
23280
23397
|
ingestInCache(data, { cachedAt });
|
|
23281
23398
|
const { communityUsers } = data;
|
|
23282
23399
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23283
|
-
};
|
|
23400
|
+
};
|
|
23401
|
+
/* end_public_function */
|
|
23284
23402
|
|
|
23403
|
+
/* begin_public_function
|
|
23404
|
+
id: community.membership.query
|
|
23405
|
+
*/
|
|
23285
23406
|
/**
|
|
23286
23407
|
* ```js
|
|
23287
23408
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23325,6 +23446,7 @@ const queryCommunityMembers = async (query) => {
|
|
|
23325
23446
|
const prevPage = toPage(paging.previous);
|
|
23326
23447
|
return { data: communityUsers, cachedAt, nextPage, prevPage };
|
|
23327
23448
|
};
|
|
23449
|
+
/* end_public_function */
|
|
23328
23450
|
/**
|
|
23329
23451
|
* ```js
|
|
23330
23452
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23364,6 +23486,9 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23364
23486
|
: undefined;
|
|
23365
23487
|
};
|
|
23366
23488
|
|
|
23489
|
+
/* begin_public_function
|
|
23490
|
+
id: community.membership.add_members
|
|
23491
|
+
*/
|
|
23367
23492
|
/**
|
|
23368
23493
|
* ```js
|
|
23369
23494
|
* import { addCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23389,8 +23514,12 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23389
23514
|
ingestInCache(data);
|
|
23390
23515
|
const { communityUsers } = data;
|
|
23391
23516
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23392
|
-
};
|
|
23517
|
+
};
|
|
23518
|
+
/* end_public_function */
|
|
23393
23519
|
|
|
23520
|
+
/* begin_public_function
|
|
23521
|
+
id: community.membership.remove_member
|
|
23522
|
+
*/
|
|
23394
23523
|
/**
|
|
23395
23524
|
* ```js
|
|
23396
23525
|
* import { removeCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23416,8 +23545,12 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23416
23545
|
ingestInCache(data);
|
|
23417
23546
|
const { communityUsers } = data;
|
|
23418
23547
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23419
|
-
};
|
|
23548
|
+
};
|
|
23549
|
+
/* end_public_function */
|
|
23420
23550
|
|
|
23551
|
+
/* begin_public_function
|
|
23552
|
+
id: community.moderation.add_roles
|
|
23553
|
+
*/
|
|
23421
23554
|
/**
|
|
23422
23555
|
* ```js
|
|
23423
23556
|
* import { addCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23444,8 +23577,12 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23444
23577
|
const { communityUsers } = data;
|
|
23445
23578
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23446
23579
|
roleIds.some(role => communityUser.roles.includes(role)));
|
|
23447
|
-
};
|
|
23580
|
+
};
|
|
23581
|
+
/* end_public_function */
|
|
23448
23582
|
|
|
23583
|
+
/* begin_public_function
|
|
23584
|
+
id: community.moderation.remove_roles
|
|
23585
|
+
*/
|
|
23449
23586
|
/**
|
|
23450
23587
|
* ```js
|
|
23451
23588
|
* import { removeCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23472,8 +23609,12 @@ const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23472
23609
|
const { communityUsers } = data;
|
|
23473
23610
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23474
23611
|
!roleIds.some(role => communityUser.roles.includes(role)));
|
|
23475
|
-
};
|
|
23612
|
+
};
|
|
23613
|
+
/* end_public_function */
|
|
23476
23614
|
|
|
23615
|
+
/* begin_public_function
|
|
23616
|
+
id: community.query.trending_communities
|
|
23617
|
+
*/
|
|
23477
23618
|
/**
|
|
23478
23619
|
* ```js
|
|
23479
23620
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23505,6 +23646,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23505
23646
|
}
|
|
23506
23647
|
return { data: communities, cachedAt };
|
|
23507
23648
|
};
|
|
23649
|
+
/* end_public_function */
|
|
23508
23650
|
/**
|
|
23509
23651
|
* ```js
|
|
23510
23652
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23538,6 +23680,9 @@ getTopTrendingCommunities.locally = (query) => {
|
|
|
23538
23680
|
: undefined;
|
|
23539
23681
|
};
|
|
23540
23682
|
|
|
23683
|
+
/* begin_public_function
|
|
23684
|
+
id: community.query.recommended_communities
|
|
23685
|
+
*/
|
|
23541
23686
|
/**
|
|
23542
23687
|
* ```js
|
|
23543
23688
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23569,6 +23714,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23569
23714
|
}
|
|
23570
23715
|
return { data: communities, cachedAt };
|
|
23571
23716
|
};
|
|
23717
|
+
/* end_public_function */
|
|
23572
23718
|
/**
|
|
23573
23719
|
* ```js
|
|
23574
23720
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23602,6 +23748,9 @@ getRecommendedCommunities.locally = (query) => {
|
|
|
23602
23748
|
: undefined;
|
|
23603
23749
|
};
|
|
23604
23750
|
|
|
23751
|
+
/* begin_public_function
|
|
23752
|
+
id: post.soft_delete, post.hard_delete
|
|
23753
|
+
*/
|
|
23605
23754
|
/**
|
|
23606
23755
|
* ```js
|
|
23607
23756
|
* import { deletePost } from '@amityco/ts-sdk'
|
|
@@ -23664,8 +23813,12 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23664
23813
|
upsertInCache(['post', 'get', postId], { isDeleted: true });
|
|
23665
23814
|
}
|
|
23666
23815
|
return deleted;
|
|
23667
|
-
};
|
|
23816
|
+
};
|
|
23817
|
+
/* end_public_function */
|
|
23668
23818
|
|
|
23819
|
+
/* begin_public_function
|
|
23820
|
+
id: post.approve
|
|
23821
|
+
*/
|
|
23669
23822
|
/**
|
|
23670
23823
|
* ```js
|
|
23671
23824
|
* import { approvePost } from '@amityco/ts-sdk'
|
|
@@ -23698,8 +23851,12 @@ const approvePost = async (postId) => {
|
|
|
23698
23851
|
data: data.posts.find(post => post.postId === postId),
|
|
23699
23852
|
cachedAt,
|
|
23700
23853
|
};
|
|
23701
|
-
};
|
|
23854
|
+
};
|
|
23855
|
+
/* end_public_function */
|
|
23702
23856
|
|
|
23857
|
+
/* begin_public_function
|
|
23858
|
+
id: post.decline
|
|
23859
|
+
*/
|
|
23703
23860
|
/**
|
|
23704
23861
|
* ```js
|
|
23705
23862
|
* import { declinePost } from '@amityco/ts-sdk'
|
|
@@ -23732,8 +23889,12 @@ const declinePost = async (postId) => {
|
|
|
23732
23889
|
data: payload.posts.find(post => post.postId === postId),
|
|
23733
23890
|
cachedAt,
|
|
23734
23891
|
};
|
|
23735
|
-
};
|
|
23892
|
+
};
|
|
23893
|
+
/* end_public_function */
|
|
23736
23894
|
|
|
23895
|
+
/* begin_public_function
|
|
23896
|
+
id: comment.query
|
|
23897
|
+
*/
|
|
23737
23898
|
/**
|
|
23738
23899
|
* ```js
|
|
23739
23900
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23783,6 +23944,7 @@ const queryComments = async (query) => {
|
|
|
23783
23944
|
const prevPage = toPage(paging.previous);
|
|
23784
23945
|
return { data: comments, cachedAt, prevPage, nextPage };
|
|
23785
23946
|
};
|
|
23947
|
+
/* end_public_function */
|
|
23786
23948
|
/**
|
|
23787
23949
|
* ```js
|
|
23788
23950
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23818,6 +23980,9 @@ queryComments.locally = (query) => {
|
|
|
23818
23980
|
: undefined;
|
|
23819
23981
|
};
|
|
23820
23982
|
|
|
23983
|
+
/* begin_public_function
|
|
23984
|
+
id: comment.get_by_ids
|
|
23985
|
+
*/
|
|
23821
23986
|
/**
|
|
23822
23987
|
* ```js
|
|
23823
23988
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23848,6 +24013,7 @@ const getComments = async (commentIds) => {
|
|
|
23848
24013
|
cachedAt,
|
|
23849
24014
|
};
|
|
23850
24015
|
};
|
|
24016
|
+
/* end_public_function */
|
|
23851
24017
|
/**
|
|
23852
24018
|
* ```js
|
|
23853
24019
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23880,6 +24046,9 @@ getComments.locally = (commentIds) => {
|
|
|
23880
24046
|
};
|
|
23881
24047
|
};
|
|
23882
24048
|
|
|
24049
|
+
/* begin_public_function
|
|
24050
|
+
id: comment.get
|
|
24051
|
+
*/
|
|
23883
24052
|
/**
|
|
23884
24053
|
* ```js
|
|
23885
24054
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23919,6 +24088,7 @@ const getComment = async (commentId) => {
|
|
|
23919
24088
|
cachedAt,
|
|
23920
24089
|
};
|
|
23921
24090
|
};
|
|
24091
|
+
/* end_public_function */
|
|
23922
24092
|
/**
|
|
23923
24093
|
* ```js
|
|
23924
24094
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23946,6 +24116,9 @@ getComment.locally = (commentId) => {
|
|
|
23946
24116
|
};
|
|
23947
24117
|
};
|
|
23948
24118
|
|
|
24119
|
+
/* begin_public_function
|
|
24120
|
+
id: comment.create
|
|
24121
|
+
*/
|
|
23949
24122
|
/**
|
|
23950
24123
|
* ```js
|
|
23951
24124
|
* import { createComment } from '@amityco/ts-sdk'
|
|
@@ -23985,8 +24158,12 @@ const createComment = async (bundle) => {
|
|
|
23985
24158
|
data: comments[0],
|
|
23986
24159
|
cachedAt,
|
|
23987
24160
|
};
|
|
23988
|
-
};
|
|
24161
|
+
};
|
|
24162
|
+
/* end_public_function */
|
|
23989
24163
|
|
|
24164
|
+
/* begin_public_function
|
|
24165
|
+
id: comment.update_comment
|
|
24166
|
+
*/
|
|
23990
24167
|
/**
|
|
23991
24168
|
* ```js
|
|
23992
24169
|
* import { updateComment } from '@amityco/ts-sdk'
|
|
@@ -24017,8 +24194,12 @@ const updateComment = async (commentId, patch) => {
|
|
|
24017
24194
|
data: comments.find(comment => comment.commentId === commentId),
|
|
24018
24195
|
cachedAt,
|
|
24019
24196
|
};
|
|
24020
|
-
};
|
|
24197
|
+
};
|
|
24198
|
+
/* end_public_function */
|
|
24021
24199
|
|
|
24200
|
+
/* begin_public_function
|
|
24201
|
+
id: comment.soft_delete, comment.hard_delete
|
|
24202
|
+
*/
|
|
24022
24203
|
/**
|
|
24023
24204
|
* ```js
|
|
24024
24205
|
* import { deleteComment } from '@amityco/ts-sdk'
|
|
@@ -24071,7 +24252,8 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
24071
24252
|
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
24072
24253
|
}
|
|
24073
24254
|
return deleted;
|
|
24074
|
-
};
|
|
24255
|
+
};
|
|
24256
|
+
/* end_public_function */
|
|
24075
24257
|
|
|
24076
24258
|
/** @hidden */
|
|
24077
24259
|
const preparePayloadForCache = (event, payload) => {
|
|
@@ -24111,6 +24293,9 @@ const preparePayloadForCache = (event, payload) => {
|
|
|
24111
24293
|
}
|
|
24112
24294
|
};
|
|
24113
24295
|
|
|
24296
|
+
/* begin_public_function
|
|
24297
|
+
id: reaction.add
|
|
24298
|
+
*/
|
|
24114
24299
|
/**
|
|
24115
24300
|
* ```js
|
|
24116
24301
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24151,6 +24336,7 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24151
24336
|
}
|
|
24152
24337
|
return true;
|
|
24153
24338
|
};
|
|
24339
|
+
/* end_public_function */
|
|
24154
24340
|
/**
|
|
24155
24341
|
* ```js
|
|
24156
24342
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24191,6 +24377,9 @@ addReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24191
24377
|
return (_e = (_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName)) !== null && _e !== void 0 ? _e : false;
|
|
24192
24378
|
};
|
|
24193
24379
|
|
|
24380
|
+
/* begin_public_function
|
|
24381
|
+
id: reaction.remove
|
|
24382
|
+
*/
|
|
24194
24383
|
/**
|
|
24195
24384
|
* ```js
|
|
24196
24385
|
* import { deleteReaction } from '@amityco/ts-sdk'
|
|
@@ -24233,6 +24422,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24233
24422
|
}
|
|
24234
24423
|
return true;
|
|
24235
24424
|
};
|
|
24425
|
+
/* end_public_function */
|
|
24236
24426
|
/**
|
|
24237
24427
|
* ```js
|
|
24238
24428
|
* import { removeReaction } from '@amityco/ts-sdk'
|
|
@@ -24273,6 +24463,9 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24273
24463
|
return (_e = !((_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName))) !== null && _e !== void 0 ? _e : false;
|
|
24274
24464
|
};
|
|
24275
24465
|
|
|
24466
|
+
/* begin_public_function
|
|
24467
|
+
id: reaction.query
|
|
24468
|
+
*/
|
|
24276
24469
|
/**
|
|
24277
24470
|
* ```js
|
|
24278
24471
|
* import { queryReactions } from '@amityco/ts-sdk'
|
|
@@ -24307,7 +24500,8 @@ const queryReactions = async (query) => {
|
|
|
24307
24500
|
const nextPage = toPageRaw(paging.next);
|
|
24308
24501
|
const prevPage = toPageRaw(paging.previous);
|
|
24309
24502
|
return { data: reactions, prevPage, nextPage };
|
|
24310
|
-
};
|
|
24503
|
+
};
|
|
24504
|
+
/* end_public_function */
|
|
24311
24505
|
|
|
24312
24506
|
const createPostEventSubscriber = (event, callback) => {
|
|
24313
24507
|
const client = getActiveClient();
|
|
@@ -25054,6 +25248,9 @@ var REFERENCE_TYPES = {
|
|
|
25054
25248
|
},
|
|
25055
25249
|
};
|
|
25056
25250
|
|
|
25251
|
+
/* begin_public_function
|
|
25252
|
+
id: user.flag, message.flag, post.flag, comment.flag
|
|
25253
|
+
*/
|
|
25057
25254
|
/**
|
|
25058
25255
|
* ```js
|
|
25059
25256
|
* import { createReport } from '@amityco/ts-sdk'
|
|
@@ -25094,8 +25291,12 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
25094
25291
|
}
|
|
25095
25292
|
fireEvent(`${referenceType}.flagged`, payload);
|
|
25096
25293
|
return !!payload;
|
|
25097
|
-
};
|
|
25294
|
+
};
|
|
25295
|
+
/* end_public_function */
|
|
25098
25296
|
|
|
25297
|
+
/* begin_public_function
|
|
25298
|
+
id: user.unflag, message.unflag, post.unflag, comment.unflag
|
|
25299
|
+
*/
|
|
25099
25300
|
/**
|
|
25100
25301
|
* ```js
|
|
25101
25302
|
* import { deleteReport } from '@amityco/ts-sdk'
|
|
@@ -25137,8 +25338,12 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25137
25338
|
// @ts-ignore
|
|
25138
25339
|
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25139
25340
|
return !!payload;
|
|
25140
|
-
};
|
|
25341
|
+
};
|
|
25342
|
+
/* end_public_function */
|
|
25141
25343
|
|
|
25344
|
+
/* begin_public_function
|
|
25345
|
+
id: user.check_flag_by_me, message.check_flag_by_me, post.check_flag_by_me, comment.check_flag_by_me
|
|
25346
|
+
*/
|
|
25142
25347
|
/**
|
|
25143
25348
|
* ```js
|
|
25144
25349
|
* import { isReportedByMe } from '@amityco/ts-sdk'
|
|
@@ -25165,7 +25370,8 @@ const isReportedByMe = async (referenceType, referenceId) => {
|
|
|
25165
25370
|
[primaryKey]: referenceId,
|
|
25166
25371
|
}))) !== null && _a !== void 0 ? _a : {};
|
|
25167
25372
|
return (_b = result !== null && result !== void 0 ? result : isFlagByMe) !== null && _b !== void 0 ? _b : false;
|
|
25168
|
-
};
|
|
25373
|
+
};
|
|
25374
|
+
/* end_public_function */
|
|
25169
25375
|
|
|
25170
25376
|
function convertFromRaw$1(_a, params) {
|
|
25171
25377
|
var { _id } = _a, rest = __rest(_a, ["_id"]);
|
|
@@ -25200,6 +25406,9 @@ const prepareChannelPayload = (rawPayload) => {
|
|
|
25200
25406
|
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25201
25407
|
};
|
|
25202
25408
|
|
|
25409
|
+
/* begin_public_function
|
|
25410
|
+
id: channel.query
|
|
25411
|
+
*/
|
|
25203
25412
|
/**
|
|
25204
25413
|
* ```js
|
|
25205
25414
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25245,6 +25454,7 @@ const queryChannels = async (query) => {
|
|
|
25245
25454
|
const prevPage = toPage(paging.previous);
|
|
25246
25455
|
return { data: channels, cachedAt, prevPage, nextPage };
|
|
25247
25456
|
};
|
|
25457
|
+
/* end_public_function */
|
|
25248
25458
|
/**
|
|
25249
25459
|
* ```js
|
|
25250
25460
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25342,6 +25552,9 @@ getChannels.locally = (channelIds) => {
|
|
|
25342
25552
|
};
|
|
25343
25553
|
};
|
|
25344
25554
|
|
|
25555
|
+
/* begin_public_function
|
|
25556
|
+
id: channel.get
|
|
25557
|
+
*/
|
|
25345
25558
|
/**
|
|
25346
25559
|
* ```js
|
|
25347
25560
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25380,6 +25593,7 @@ const getChannel = async (channelId) => {
|
|
|
25380
25593
|
cachedAt,
|
|
25381
25594
|
};
|
|
25382
25595
|
};
|
|
25596
|
+
/* end_public_function */
|
|
25383
25597
|
/**
|
|
25384
25598
|
* ```js
|
|
25385
25599
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25407,6 +25621,9 @@ getChannel.locally = (channelId) => {
|
|
|
25407
25621
|
};
|
|
25408
25622
|
};
|
|
25409
25623
|
|
|
25624
|
+
/* begin_public_function
|
|
25625
|
+
id: channel.create
|
|
25626
|
+
*/
|
|
25410
25627
|
/**
|
|
25411
25628
|
* ```js
|
|
25412
25629
|
* import { createChannel } from '@amityco/ts-sdk'
|
|
@@ -25440,8 +25657,12 @@ const createChannel = async (bundle) => {
|
|
|
25440
25657
|
data: channels[0],
|
|
25441
25658
|
cachedAt,
|
|
25442
25659
|
};
|
|
25443
|
-
};
|
|
25660
|
+
};
|
|
25661
|
+
/* end_public_function */
|
|
25444
25662
|
|
|
25663
|
+
/* begin_public_function
|
|
25664
|
+
id: channel.update
|
|
25665
|
+
*/
|
|
25445
25666
|
/**
|
|
25446
25667
|
* ```js
|
|
25447
25668
|
* import { updateChannel } from '@amityco/ts-sdk'
|
|
@@ -25470,7 +25691,8 @@ const updateChannel = async (channelId, patch) => {
|
|
|
25470
25691
|
data: channels.find(channel => channel.channelId === channelId),
|
|
25471
25692
|
cachedAt,
|
|
25472
25693
|
};
|
|
25473
|
-
};
|
|
25694
|
+
};
|
|
25695
|
+
/* end_public_function */
|
|
25474
25696
|
|
|
25475
25697
|
/**
|
|
25476
25698
|
* ```js
|
|
@@ -25495,6 +25717,9 @@ const deleteChannel = async (channelId) => {
|
|
|
25495
25717
|
return deleted.data;
|
|
25496
25718
|
};
|
|
25497
25719
|
|
|
25720
|
+
/* begin_public_function
|
|
25721
|
+
id: channel.join
|
|
25722
|
+
*/
|
|
25498
25723
|
/**
|
|
25499
25724
|
* ```js
|
|
25500
25725
|
* import { joinChannel } from '@amityco/ts-sdk'
|
|
@@ -25518,8 +25743,12 @@ const joinChannel = async (channelId) => {
|
|
|
25518
25743
|
ingestInCache(data);
|
|
25519
25744
|
const { channelUsers } = data;
|
|
25520
25745
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25521
|
-
};
|
|
25746
|
+
};
|
|
25747
|
+
/* end_public_function */
|
|
25522
25748
|
|
|
25749
|
+
/* begin_public_function
|
|
25750
|
+
id: channel.leave
|
|
25751
|
+
*/
|
|
25523
25752
|
/**
|
|
25524
25753
|
* ```js
|
|
25525
25754
|
* import { leaveChannel } from '@amityco/ts-sdk'
|
|
@@ -25543,8 +25772,12 @@ const leaveChannel = async (channelId) => {
|
|
|
25543
25772
|
ingestInCache(data);
|
|
25544
25773
|
const { channelUsers } = data;
|
|
25545
25774
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25546
|
-
};
|
|
25775
|
+
};
|
|
25776
|
+
/* end_public_function */
|
|
25547
25777
|
|
|
25778
|
+
/* begin_public_function
|
|
25779
|
+
id: channel.member.query, channel.member.search
|
|
25780
|
+
*/
|
|
25548
25781
|
/**
|
|
25549
25782
|
* ```js
|
|
25550
25783
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25593,6 +25826,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25593
25826
|
prevPage,
|
|
25594
25827
|
};
|
|
25595
25828
|
};
|
|
25829
|
+
/* end_public_function */
|
|
25596
25830
|
/**
|
|
25597
25831
|
* ```js
|
|
25598
25832
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25633,6 +25867,9 @@ queryChannelMembers.locally = (query) => {
|
|
|
25633
25867
|
: undefined;
|
|
25634
25868
|
};
|
|
25635
25869
|
|
|
25870
|
+
/* begin_public_function
|
|
25871
|
+
id: channel.member.add
|
|
25872
|
+
*/
|
|
25636
25873
|
/**
|
|
25637
25874
|
* ```js
|
|
25638
25875
|
* import { addChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25661,8 +25898,12 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25661
25898
|
ingestInCache(data);
|
|
25662
25899
|
const { channelUsers } = data;
|
|
25663
25900
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25664
|
-
};
|
|
25901
|
+
};
|
|
25902
|
+
/* end_public_function */
|
|
25665
25903
|
|
|
25904
|
+
/* begin_public_function
|
|
25905
|
+
id: channel.member.remove
|
|
25906
|
+
*/
|
|
25666
25907
|
/**
|
|
25667
25908
|
* ```js
|
|
25668
25909
|
* import { removeChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25691,8 +25932,12 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25691
25932
|
ingestInCache(data);
|
|
25692
25933
|
const { channelUsers } = data;
|
|
25693
25934
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25694
|
-
};
|
|
25935
|
+
};
|
|
25936
|
+
/* end_public_function */
|
|
25695
25937
|
|
|
25938
|
+
/* begin_public_function
|
|
25939
|
+
id: channel.moderation.add_roles
|
|
25940
|
+
*/
|
|
25696
25941
|
/**
|
|
25697
25942
|
* ```js
|
|
25698
25943
|
* import { addChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25718,8 +25963,12 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25718
25963
|
ingestInCache(data);
|
|
25719
25964
|
const { channelUsers } = data;
|
|
25720
25965
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.roles.includes(roleId));
|
|
25721
|
-
};
|
|
25966
|
+
};
|
|
25967
|
+
/* end_public_function */
|
|
25722
25968
|
|
|
25969
|
+
/* begin_public_function
|
|
25970
|
+
id: channel.moderation.remove_roles
|
|
25971
|
+
*/
|
|
25723
25972
|
/**
|
|
25724
25973
|
* ```js
|
|
25725
25974
|
* import { removeChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25730,7 +25979,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25730
25979
|
*
|
|
25731
25980
|
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
25732
25981
|
* @param roleId The ID of the {@link Amity.Role} to apply
|
|
25733
|
-
* @param
|
|
25982
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
25734
25983
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
|
|
25735
25984
|
*
|
|
25736
25985
|
* @category Channel API
|
|
@@ -25745,8 +25994,12 @@ const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25745
25994
|
ingestInCache(data);
|
|
25746
25995
|
const { channelUsers } = data;
|
|
25747
25996
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && !channelUser.roles.includes(roleId));
|
|
25748
|
-
};
|
|
25997
|
+
};
|
|
25998
|
+
/* end_public_function */
|
|
25749
25999
|
|
|
26000
|
+
/* begin_public_function
|
|
26001
|
+
id: channel.moderation.ban_members
|
|
26002
|
+
*/
|
|
25750
26003
|
/**
|
|
25751
26004
|
* ```js
|
|
25752
26005
|
* import { banChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25776,8 +26029,12 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25776
26029
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'banned'),
|
|
25777
26030
|
cachedAt,
|
|
25778
26031
|
};
|
|
25779
|
-
};
|
|
26032
|
+
};
|
|
26033
|
+
/* end_public_function */
|
|
25780
26034
|
|
|
26035
|
+
/* begin_public_function
|
|
26036
|
+
id: channel.moderation.unban_members
|
|
26037
|
+
*/
|
|
25781
26038
|
/**
|
|
25782
26039
|
* ```js
|
|
25783
26040
|
* import { unbanChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25807,8 +26064,12 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25807
26064
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'member'),
|
|
25808
26065
|
cachedAt,
|
|
25809
26066
|
};
|
|
25810
|
-
};
|
|
26067
|
+
};
|
|
26068
|
+
/* end_public_function */
|
|
25811
26069
|
|
|
26070
|
+
/* begin_public_function
|
|
26071
|
+
id: channel.start_reading
|
|
26072
|
+
*/
|
|
25812
26073
|
/**
|
|
25813
26074
|
* ```js
|
|
25814
26075
|
* import { startReading } from '@amityco/ts-sdk'
|
|
@@ -25817,9 +26078,9 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25817
26078
|
*
|
|
25818
26079
|
* Mark all messages as read and start reading message inside channel
|
|
25819
26080
|
*
|
|
25820
|
-
* @param
|
|
25821
|
-
* @param
|
|
25822
|
-
* @return
|
|
26081
|
+
* @param subChannelId - The channel ID to start reading.
|
|
26082
|
+
* @param userId - The user ID of channel member.
|
|
26083
|
+
* @return A success boolean if the channel reading of the sub channel had begun.
|
|
25823
26084
|
*
|
|
25824
26085
|
* @category Message API
|
|
25825
26086
|
* @async
|
|
@@ -25845,8 +26106,12 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25845
26106
|
channelId,
|
|
25846
26107
|
});
|
|
25847
26108
|
return !!result;
|
|
25848
|
-
};
|
|
26109
|
+
};
|
|
26110
|
+
/* end_public_function */
|
|
25849
26111
|
|
|
26112
|
+
/* begin_public_function
|
|
26113
|
+
id: channel.stop_reading
|
|
26114
|
+
*/
|
|
25850
26115
|
/**
|
|
25851
26116
|
* ```js
|
|
25852
26117
|
* import { stopReading } from '@amityco/ts-sdk'
|
|
@@ -25855,8 +26120,8 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25855
26120
|
*
|
|
25856
26121
|
* Stop reading message inside channel
|
|
25857
26122
|
*
|
|
25858
|
-
* @param
|
|
25859
|
-
* @return
|
|
26123
|
+
* @param subChannelId - The channel ID to stop reading.
|
|
26124
|
+
* @return A success boolean if the sub channel reading was halted.
|
|
25860
26125
|
*
|
|
25861
26126
|
* @category Message API
|
|
25862
26127
|
* @async
|
|
@@ -25881,7 +26146,8 @@ const stopReading = async (subChannelId) => {
|
|
|
25881
26146
|
channelId,
|
|
25882
26147
|
});
|
|
25883
26148
|
return !!result;
|
|
25884
|
-
};
|
|
26149
|
+
};
|
|
26150
|
+
/* end_public_function */
|
|
25885
26151
|
|
|
25886
26152
|
/**
|
|
25887
26153
|
* ```js
|
|
@@ -26773,6 +27039,9 @@ function convertQueryParams(_a) {
|
|
|
26773
27039
|
return out;
|
|
26774
27040
|
}
|
|
26775
27041
|
|
|
27042
|
+
/* begin_public_function
|
|
27043
|
+
id: subchannel.query
|
|
27044
|
+
*/
|
|
26776
27045
|
/**
|
|
26777
27046
|
* ```js
|
|
26778
27047
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26814,6 +27083,7 @@ const querySubChannels = async (query) => {
|
|
|
26814
27083
|
const prevPage = toPage(paging.previous);
|
|
26815
27084
|
return { data: subChannels, cachedAt, prevPage, nextPage };
|
|
26816
27085
|
};
|
|
27086
|
+
/* end_public_function */
|
|
26817
27087
|
/**
|
|
26818
27088
|
* ```js
|
|
26819
27089
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26914,6 +27184,9 @@ getSubChannels.locally = (subChannelIds) => {
|
|
|
26914
27184
|
};
|
|
26915
27185
|
};
|
|
26916
27186
|
|
|
27187
|
+
/* begin_public_function
|
|
27188
|
+
id: subchannel.get
|
|
27189
|
+
*/
|
|
26917
27190
|
/**
|
|
26918
27191
|
* ```js
|
|
26919
27192
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26951,6 +27224,7 @@ const getSubChannel = async (subChannelId) => {
|
|
|
26951
27224
|
throw error;
|
|
26952
27225
|
}
|
|
26953
27226
|
};
|
|
27227
|
+
/* end_public_function */
|
|
26954
27228
|
/**
|
|
26955
27229
|
* ```js
|
|
26956
27230
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26978,6 +27252,9 @@ getSubChannel.locally = (subChannelId) => {
|
|
|
26978
27252
|
};
|
|
26979
27253
|
};
|
|
26980
27254
|
|
|
27255
|
+
/* begin_public_function
|
|
27256
|
+
id: subchannel.create
|
|
27257
|
+
*/
|
|
26981
27258
|
/**
|
|
26982
27259
|
* ```js
|
|
26983
27260
|
* import { createSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27008,8 +27285,12 @@ const createSubChannel = async (bundle) => {
|
|
|
27008
27285
|
data: data.messageFeeds[0],
|
|
27009
27286
|
cachedAt,
|
|
27010
27287
|
};
|
|
27011
|
-
};
|
|
27288
|
+
};
|
|
27289
|
+
/* end_public_function */
|
|
27012
27290
|
|
|
27291
|
+
/* begin_public_function
|
|
27292
|
+
id: subchannel.update
|
|
27293
|
+
*/
|
|
27013
27294
|
/**
|
|
27014
27295
|
* ```js
|
|
27015
27296
|
* import { updateSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27038,8 +27319,12 @@ const updateSubChannel = async (subChannelId, patch) => {
|
|
|
27038
27319
|
data: data.messageFeeds[0],
|
|
27039
27320
|
cachedAt,
|
|
27040
27321
|
};
|
|
27041
|
-
};
|
|
27322
|
+
};
|
|
27323
|
+
/* end_public_function */
|
|
27042
27324
|
|
|
27325
|
+
/* begin_public_function
|
|
27326
|
+
id: subchannel.soft_delete, subchannel.hard_delete
|
|
27327
|
+
*/
|
|
27043
27328
|
/**
|
|
27044
27329
|
* ```js
|
|
27045
27330
|
* import { deleteSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27070,7 +27355,8 @@ const deleteSubChannel = async (subChannelId, permanent = false) => {
|
|
|
27070
27355
|
}
|
|
27071
27356
|
fireEvent('local.message-feed.deleted', { messageFeeds: [deleted] });
|
|
27072
27357
|
return deleted;
|
|
27073
|
-
};
|
|
27358
|
+
};
|
|
27359
|
+
/* end_public_function */
|
|
27074
27360
|
|
|
27075
27361
|
/**
|
|
27076
27362
|
* ```js
|
|
@@ -27396,7 +27682,7 @@ const liveMessages = (params, callback, config) => {
|
|
|
27396
27682
|
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
27397
27683
|
return;
|
|
27398
27684
|
const query = createQuery(queryMessages, Object.assign(Object.assign({}, queryParams), { page: (_e = (_d = collection === null || collection === void 0 ? void 0 : collection.params) === null || _d === void 0 ? void 0 : _d.page) !== null && _e !== void 0 ? _e : { limit } }));
|
|
27399
|
-
runQuery(query, ({ data: result, error, loading,
|
|
27685
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27400
27686
|
const data = {
|
|
27401
27687
|
loading,
|
|
27402
27688
|
error,
|
|
@@ -28113,6 +28399,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28113
28399
|
};
|
|
28114
28400
|
};
|
|
28115
28401
|
|
|
28402
|
+
/* begin_public_function
|
|
28403
|
+
id: community.category.query
|
|
28404
|
+
*/
|
|
28116
28405
|
/**
|
|
28117
28406
|
* ```js
|
|
28118
28407
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28331,6 +28620,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28331
28620
|
};
|
|
28332
28621
|
};
|
|
28333
28622
|
|
|
28623
|
+
/* begin_public_function
|
|
28624
|
+
id: feed.query.global_feed
|
|
28625
|
+
*/
|
|
28334
28626
|
/**
|
|
28335
28627
|
* ```js
|
|
28336
28628
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28371,6 +28663,7 @@ const queryGlobalFeed = async (query) => {
|
|
|
28371
28663
|
const prevPage = toPage(paging.previous);
|
|
28372
28664
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
28373
28665
|
};
|
|
28666
|
+
/* end_public_function */
|
|
28374
28667
|
/**
|
|
28375
28668
|
* ```js
|
|
28376
28669
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28461,6 +28754,9 @@ queryFollows.locally = (key, query) => {
|
|
|
28461
28754
|
: undefined;
|
|
28462
28755
|
};
|
|
28463
28756
|
|
|
28757
|
+
/* begin_public_function
|
|
28758
|
+
id: user.relationship.query_my_followers, user.relationship.query_followers
|
|
28759
|
+
*/
|
|
28464
28760
|
/**
|
|
28465
28761
|
* ```js
|
|
28466
28762
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28476,6 +28772,7 @@ queryFollows.locally = (key, query) => {
|
|
|
28476
28772
|
* @async
|
|
28477
28773
|
*/
|
|
28478
28774
|
const queryFollowers = async (query) => queryFollows('followers', query);
|
|
28775
|
+
/* end_public_function */
|
|
28479
28776
|
/**
|
|
28480
28777
|
* ```js
|
|
28481
28778
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28491,6 +28788,9 @@ const queryFollowers = async (query) => queryFollows('followers', query);
|
|
|
28491
28788
|
*/
|
|
28492
28789
|
queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
28493
28790
|
|
|
28791
|
+
/* begin_public_function
|
|
28792
|
+
id: user.relationship.query_my_followings, user.relationship.query_followings
|
|
28793
|
+
*/
|
|
28494
28794
|
/**
|
|
28495
28795
|
* ```js
|
|
28496
28796
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28506,6 +28806,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
|
28506
28806
|
* @async
|
|
28507
28807
|
*/
|
|
28508
28808
|
const queryFollowings = async (query) => queryFollows('following', query);
|
|
28809
|
+
/* end_public_function */
|
|
28509
28810
|
/**
|
|
28510
28811
|
* ```js
|
|
28511
28812
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28526,6 +28827,9 @@ const getCacheKey = (userId) => [
|
|
|
28526
28827
|
'get',
|
|
28527
28828
|
`${getActiveClient().userId}#${userId}`,
|
|
28528
28829
|
];
|
|
28830
|
+
/* begin_public_function
|
|
28831
|
+
id: user.relationship.get_follow_info, user.relationship.get_my_follow_info
|
|
28832
|
+
*/
|
|
28529
28833
|
/**
|
|
28530
28834
|
* ```js
|
|
28531
28835
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28556,6 +28860,7 @@ const getFollowInfo = async (userId) => {
|
|
|
28556
28860
|
cachedAt,
|
|
28557
28861
|
};
|
|
28558
28862
|
};
|
|
28863
|
+
/* end_public_function */
|
|
28559
28864
|
/**
|
|
28560
28865
|
* ```js
|
|
28561
28866
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28585,6 +28890,9 @@ getFollowInfo.locally = (userId) => {
|
|
|
28585
28890
|
};
|
|
28586
28891
|
};
|
|
28587
28892
|
|
|
28893
|
+
/* begin_public_function
|
|
28894
|
+
id: user.relationship.follow
|
|
28895
|
+
*/
|
|
28588
28896
|
/**
|
|
28589
28897
|
* ```js
|
|
28590
28898
|
* import { follow } from '@amityco/ts-sdk'
|
|
@@ -28612,8 +28920,12 @@ const follow = async (userId) => {
|
|
|
28612
28920
|
data: data.follows[0],
|
|
28613
28921
|
cachedAt,
|
|
28614
28922
|
};
|
|
28615
|
-
};
|
|
28923
|
+
};
|
|
28924
|
+
/* end_public_function */
|
|
28616
28925
|
|
|
28926
|
+
/* begin_public_function
|
|
28927
|
+
id: user.relationship.unfollow
|
|
28928
|
+
*/
|
|
28617
28929
|
/**
|
|
28618
28930
|
* ```js
|
|
28619
28931
|
* import { unfollow } from '@amityco/ts-sdk'
|
|
@@ -28637,8 +28949,12 @@ const unfollow = async (userId) => {
|
|
|
28637
28949
|
}
|
|
28638
28950
|
fireEvent('follow.unfollowed', data);
|
|
28639
28951
|
return true;
|
|
28640
|
-
};
|
|
28952
|
+
};
|
|
28953
|
+
/* end_public_function */
|
|
28641
28954
|
|
|
28955
|
+
/* begin_public_function
|
|
28956
|
+
id: user.relationship.accept_follow
|
|
28957
|
+
*/
|
|
28642
28958
|
/**
|
|
28643
28959
|
* ```js
|
|
28644
28960
|
* import { acceptFollower } from '@amityco/ts-sdk'
|
|
@@ -28662,8 +28978,12 @@ const acceptFollower = async (userId) => {
|
|
|
28662
28978
|
}
|
|
28663
28979
|
fireEvent('follow.accepted', data);
|
|
28664
28980
|
return true;
|
|
28665
|
-
};
|
|
28981
|
+
};
|
|
28982
|
+
/* end_public_function */
|
|
28666
28983
|
|
|
28984
|
+
/* begin_public_function
|
|
28985
|
+
id: user.relationship.decline_follow
|
|
28986
|
+
*/
|
|
28667
28987
|
/**
|
|
28668
28988
|
* ```js
|
|
28669
28989
|
* import { declineFollower } from '@amityco/ts-sdk'
|
|
@@ -28687,7 +29007,8 @@ const declineFollower = async (userId) => {
|
|
|
28687
29007
|
}
|
|
28688
29008
|
fireEvent('follow.requestDeclined', data);
|
|
28689
29009
|
return true;
|
|
28690
|
-
};
|
|
29010
|
+
};
|
|
29011
|
+
/* end_public_function */
|
|
28691
29012
|
|
|
28692
29013
|
const createFollowEventSubscriber = (event, callback) => {
|
|
28693
29014
|
const client = getActiveClient();
|
|
@@ -29605,6 +29926,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29605
29926
|
};
|
|
29606
29927
|
};
|
|
29607
29928
|
|
|
29929
|
+
/* begin_public_function
|
|
29930
|
+
id: poll.get
|
|
29931
|
+
*/
|
|
29608
29932
|
/**
|
|
29609
29933
|
* ```js
|
|
29610
29934
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29632,6 +29956,7 @@ const getPoll = async (pollId) => {
|
|
|
29632
29956
|
cachedAt,
|
|
29633
29957
|
};
|
|
29634
29958
|
};
|
|
29959
|
+
/* end_public_function */
|
|
29635
29960
|
/**
|
|
29636
29961
|
* ```js
|
|
29637
29962
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29659,6 +29984,9 @@ getPoll.locally = (pollId) => {
|
|
|
29659
29984
|
};
|
|
29660
29985
|
};
|
|
29661
29986
|
|
|
29987
|
+
/* begin_public_function
|
|
29988
|
+
id: poll.create
|
|
29989
|
+
*/
|
|
29662
29990
|
/**
|
|
29663
29991
|
* ```js
|
|
29664
29992
|
* import { createPoll } from '@amityco/ts-sdk'
|
|
@@ -29692,8 +30020,12 @@ const createPoll = async (bundle) => {
|
|
|
29692
30020
|
data: polls[0],
|
|
29693
30021
|
cachedAt,
|
|
29694
30022
|
};
|
|
29695
|
-
};
|
|
30023
|
+
};
|
|
30024
|
+
/* end_public_function */
|
|
29696
30025
|
|
|
30026
|
+
/* begin_public_function
|
|
30027
|
+
id: poll.close
|
|
30028
|
+
*/
|
|
29697
30029
|
/**
|
|
29698
30030
|
* ```js
|
|
29699
30031
|
* import { closePoll } from '@amityco/ts-sdk'
|
|
@@ -29721,8 +30053,12 @@ const closePoll = async (pollId) => {
|
|
|
29721
30053
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29722
30054
|
cachedAt,
|
|
29723
30055
|
};
|
|
29724
|
-
};
|
|
30056
|
+
};
|
|
30057
|
+
/* end_public_function */
|
|
29725
30058
|
|
|
30059
|
+
/* begin_public_function
|
|
30060
|
+
id: poll.delete
|
|
30061
|
+
*/
|
|
29726
30062
|
/**
|
|
29727
30063
|
* ```js
|
|
29728
30064
|
* import { deletePoll } from '@amityco/ts-sdk'
|
|
@@ -29748,8 +30084,12 @@ const deletePoll = async (pollId) => {
|
|
|
29748
30084
|
upsertInCache(['poll', 'get', pollId], deleted);
|
|
29749
30085
|
fireEvent('poll.deleted', { polls: [deleted], users: [] });
|
|
29750
30086
|
return success;
|
|
29751
|
-
};
|
|
30087
|
+
};
|
|
30088
|
+
/* end_public_function */
|
|
29752
30089
|
|
|
30090
|
+
/* begin_public_function
|
|
30091
|
+
id: poll.vote
|
|
30092
|
+
*/
|
|
29753
30093
|
/**
|
|
29754
30094
|
* ```js
|
|
29755
30095
|
* import { votePoll } from '@amityco/ts-sdk'
|
|
@@ -29778,7 +30118,8 @@ const votePoll = async (pollId, answerIds) => {
|
|
|
29778
30118
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29779
30119
|
cachedAt,
|
|
29780
30120
|
};
|
|
29781
|
-
};
|
|
30121
|
+
};
|
|
30122
|
+
/* end_public_function */
|
|
29782
30123
|
|
|
29783
30124
|
/**
|
|
29784
30125
|
* ```js
|
|
@@ -29874,6 +30215,9 @@ const observePoll = (pollId, callback, policy = 'cache_then_server') => {
|
|
|
29874
30215
|
};
|
|
29875
30216
|
};
|
|
29876
30217
|
|
|
30218
|
+
/* begin_public_function
|
|
30219
|
+
id: stream.get
|
|
30220
|
+
*/
|
|
29877
30221
|
/**
|
|
29878
30222
|
* ```js
|
|
29879
30223
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29901,6 +30245,7 @@ const getStream = async (streamId) => {
|
|
|
29901
30245
|
cachedAt,
|
|
29902
30246
|
};
|
|
29903
30247
|
};
|
|
30248
|
+
/* end_public_function */
|
|
29904
30249
|
/**
|
|
29905
30250
|
* ```js
|
|
29906
30251
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29928,6 +30273,9 @@ getStream.locally = (streamId) => {
|
|
|
29928
30273
|
};
|
|
29929
30274
|
};
|
|
29930
30275
|
|
|
30276
|
+
/* begin_public_function
|
|
30277
|
+
id: stream.query
|
|
30278
|
+
*/
|
|
29931
30279
|
/**
|
|
29932
30280
|
* ```js
|
|
29933
30281
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29962,6 +30310,7 @@ const queryStreams = async (query) => {
|
|
|
29962
30310
|
const prevPage = toPage(paging.previous);
|
|
29963
30311
|
return { data: videoStreamings, cachedAt, prevPage, nextPage };
|
|
29964
30312
|
};
|
|
30313
|
+
/* end_public_function */
|
|
29965
30314
|
/**
|
|
29966
30315
|
* ```js
|
|
29967
30316
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29981,6 +30330,9 @@ queryStreams.locally = (query) => {
|
|
|
29981
30330
|
// TODO
|
|
29982
30331
|
};
|
|
29983
30332
|
|
|
30333
|
+
/* begin_public_function
|
|
30334
|
+
id: stream.create
|
|
30335
|
+
*/
|
|
29984
30336
|
/**
|
|
29985
30337
|
* ```js
|
|
29986
30338
|
* import { createStream } from '@amityco/ts-sdk'
|
|
@@ -30007,8 +30359,12 @@ const createStream = async (bundle) => {
|
|
|
30007
30359
|
data: videoStreamings[0],
|
|
30008
30360
|
cachedAt,
|
|
30009
30361
|
};
|
|
30010
|
-
};
|
|
30362
|
+
};
|
|
30363
|
+
/* end_public_function */
|
|
30011
30364
|
|
|
30365
|
+
/* begin_public_function
|
|
30366
|
+
id: stream.update
|
|
30367
|
+
*/
|
|
30012
30368
|
/**
|
|
30013
30369
|
* ```js
|
|
30014
30370
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
@@ -30039,6 +30395,9 @@ const updateStream = async (streamId, patch) => {
|
|
|
30039
30395
|
};
|
|
30040
30396
|
|
|
30041
30397
|
// import { unwrapPayload } from '~/core/transports'
|
|
30398
|
+
/* begin_public_function
|
|
30399
|
+
id: stream.delete
|
|
30400
|
+
*/
|
|
30042
30401
|
/**
|
|
30043
30402
|
* ```js
|
|
30044
30403
|
* import { deleteStream } from '@amityco/ts-sdk'
|