@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.esm.js
CHANGED
|
@@ -81,8 +81,8 @@ const PostContentType = Object.freeze({
|
|
|
81
81
|
|
|
82
82
|
function getVersion() {
|
|
83
83
|
try {
|
|
84
|
-
// the string ''v0.0.1-beta.
|
|
85
|
-
return 'v0.0.1-beta.
|
|
84
|
+
// the string ''v0.0.1-beta.41.1-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
85
|
+
return 'v0.0.1-beta.41.1-esm';
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
return '__dev__';
|
|
@@ -1459,6 +1459,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
1459
1459
|
});
|
|
1460
1460
|
instance.interceptors.request.use(config => {
|
|
1461
1461
|
var _a;
|
|
1462
|
+
// do not check expiration for token creation url
|
|
1463
|
+
if (config.url === '/api/v4/sessions') {
|
|
1464
|
+
return config;
|
|
1465
|
+
}
|
|
1462
1466
|
// check global.ts for the extension of AxiosRequestConfig
|
|
1463
1467
|
const tokenExpiry = (_a = config.metadata) === null || _a === void 0 ? void 0 : _a.tokenExpiry;
|
|
1464
1468
|
if (tokenExpiry) {
|
|
@@ -20464,7 +20468,7 @@ const getToken = async (params) => {
|
|
|
20464
20468
|
const client = getActiveClient();
|
|
20465
20469
|
client.log('client/api/getToken', params);
|
|
20466
20470
|
const deviceInfo = getDeviceInfo();
|
|
20467
|
-
const { data } = await client.http.post('/api/
|
|
20471
|
+
const { data } = await client.http.post('/api/v4/sessions', Object.assign(Object.assign({}, params), { deviceInfo }), {
|
|
20468
20472
|
// @ts-ignore
|
|
20469
20473
|
headers: { 'X-API-Key': client.apiKey },
|
|
20470
20474
|
});
|
|
@@ -20500,6 +20504,9 @@ const setClientToken = async (params) => {
|
|
|
20500
20504
|
return { accessToken, users, refreshToken };
|
|
20501
20505
|
};
|
|
20502
20506
|
|
|
20507
|
+
/* begin_public_function
|
|
20508
|
+
id: client.logout
|
|
20509
|
+
*/
|
|
20503
20510
|
/**
|
|
20504
20511
|
* ```js
|
|
20505
20512
|
* import { disconnectClient } from '@amityco/ts-sdk'
|
|
@@ -20548,7 +20555,8 @@ const disconnectClient = async () => {
|
|
|
20548
20555
|
client.cache = { data: {} };
|
|
20549
20556
|
}
|
|
20550
20557
|
return !client.ws.connected;
|
|
20551
|
-
};
|
|
20558
|
+
};
|
|
20559
|
+
/* end_public_function */
|
|
20552
20560
|
|
|
20553
20561
|
/**
|
|
20554
20562
|
* Ingest a payload (v3) into the cache
|
|
@@ -20752,6 +20760,9 @@ const onTokenTerminated = (callback) => {
|
|
|
20752
20760
|
* to be cleared
|
|
20753
20761
|
*/
|
|
20754
20762
|
const subscriptions = [];
|
|
20763
|
+
/* begin_public_function
|
|
20764
|
+
id: client.login
|
|
20765
|
+
*/
|
|
20755
20766
|
/**
|
|
20756
20767
|
* ```js
|
|
20757
20768
|
* import { connectClient } from '@amityco/ts-sdk/client/api'
|
|
@@ -20846,8 +20857,12 @@ const connectClient = async (params, sessionHandler, config) => {
|
|
|
20846
20857
|
subscriptions.forEach(fn => fn());
|
|
20847
20858
|
}));
|
|
20848
20859
|
return client.ws.connected;
|
|
20849
|
-
};
|
|
20860
|
+
};
|
|
20861
|
+
/* end_public_function */
|
|
20850
20862
|
|
|
20863
|
+
/* begin_public_function
|
|
20864
|
+
id: client.renew_access_token
|
|
20865
|
+
*/
|
|
20851
20866
|
/*
|
|
20852
20867
|
* Renewal defintion accepted by SessionHandler interface
|
|
20853
20868
|
*
|
|
@@ -20906,7 +20921,8 @@ const renewal = () => {
|
|
|
20906
20921
|
}, ACCESS_TOKEN_WATCHER_INTERVAL);
|
|
20907
20922
|
},
|
|
20908
20923
|
};
|
|
20909
|
-
};
|
|
20924
|
+
};
|
|
20925
|
+
/* end_public_function */
|
|
20910
20926
|
|
|
20911
20927
|
const ABOUT_TO_EXPIRE_THRESHOLD = 80 / 100;
|
|
20912
20928
|
const COMPENSATED_DELAY = 5 * MINUTE;
|
|
@@ -21101,6 +21117,9 @@ const pushToTombstone = (model, modelId) => {
|
|
|
21101
21117
|
pushToCache(cacheKey, data);
|
|
21102
21118
|
};
|
|
21103
21119
|
|
|
21120
|
+
/* begin_public_function
|
|
21121
|
+
id: user.get
|
|
21122
|
+
*/
|
|
21104
21123
|
/**
|
|
21105
21124
|
* ```js
|
|
21106
21125
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21143,6 +21162,7 @@ const getUser = async (userId, isLive = false) => {
|
|
|
21143
21162
|
cachedAt,
|
|
21144
21163
|
};
|
|
21145
21164
|
};
|
|
21165
|
+
/* end_public_function */
|
|
21146
21166
|
/**
|
|
21147
21167
|
* ```js
|
|
21148
21168
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21162,6 +21182,9 @@ getUser.locally = (userId) => {
|
|
|
21162
21182
|
return client.cache && pullFromCache(['user', 'get', userId]);
|
|
21163
21183
|
};
|
|
21164
21184
|
|
|
21185
|
+
/* begin_public_function
|
|
21186
|
+
id: user.get_by_ids
|
|
21187
|
+
*/
|
|
21165
21188
|
/**
|
|
21166
21189
|
* ```js
|
|
21167
21190
|
* import { getUsers } from '@amityco/ts-sdk'
|
|
@@ -21252,6 +21275,9 @@ function __rest(s, e) {
|
|
|
21252
21275
|
return t;
|
|
21253
21276
|
}
|
|
21254
21277
|
|
|
21278
|
+
/* begin_public_function
|
|
21279
|
+
id: user.query, user.search
|
|
21280
|
+
*/
|
|
21255
21281
|
/**
|
|
21256
21282
|
* ```js
|
|
21257
21283
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21295,6 +21321,7 @@ const queryUsers = async (query = {}) => {
|
|
|
21295
21321
|
const nextPage = toPage(paging.next);
|
|
21296
21322
|
return { data: users, cachedAt, prevPage, nextPage };
|
|
21297
21323
|
};
|
|
21324
|
+
/* end_public_function */
|
|
21298
21325
|
/**
|
|
21299
21326
|
* ```js
|
|
21300
21327
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21330,6 +21357,9 @@ queryUsers.locally = (query = {}) => {
|
|
|
21330
21357
|
: undefined;
|
|
21331
21358
|
};
|
|
21332
21359
|
|
|
21360
|
+
/* begin_public_function
|
|
21361
|
+
id: client.update_user
|
|
21362
|
+
*/
|
|
21333
21363
|
/**
|
|
21334
21364
|
* ```js
|
|
21335
21365
|
* import { updateUser } from '@amityco/ts-sdk'
|
|
@@ -21364,7 +21394,8 @@ const updateUser = async (userId, patch) => {
|
|
|
21364
21394
|
data: users.find(user => user.userId === userId),
|
|
21365
21395
|
cachedAt,
|
|
21366
21396
|
};
|
|
21367
|
-
};
|
|
21397
|
+
};
|
|
21398
|
+
/* end_public_function */
|
|
21368
21399
|
|
|
21369
21400
|
/**
|
|
21370
21401
|
* ```js
|
|
@@ -21669,6 +21700,9 @@ const observeUser = (userId, callback) => {
|
|
|
21669
21700
|
};
|
|
21670
21701
|
};
|
|
21671
21702
|
|
|
21703
|
+
/* begin_public_function
|
|
21704
|
+
id: file.get
|
|
21705
|
+
*/
|
|
21672
21706
|
/**
|
|
21673
21707
|
* ```js
|
|
21674
21708
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21697,6 +21731,7 @@ const getFile = async (fileId) => {
|
|
|
21697
21731
|
cachedAt,
|
|
21698
21732
|
};
|
|
21699
21733
|
};
|
|
21734
|
+
/* end_public_function */
|
|
21700
21735
|
/**
|
|
21701
21736
|
* ```js
|
|
21702
21737
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21724,6 +21759,9 @@ getFile.locally = (fileId) => {
|
|
|
21724
21759
|
};
|
|
21725
21760
|
};
|
|
21726
21761
|
|
|
21762
|
+
/* begin_public_function
|
|
21763
|
+
id: file.upload.file
|
|
21764
|
+
*/
|
|
21727
21765
|
/**
|
|
21728
21766
|
* ```js
|
|
21729
21767
|
* import { createFile } from '@amityco/ts-sdk'
|
|
@@ -21763,8 +21801,12 @@ const createFile = async (formData, onProgress) => {
|
|
|
21763
21801
|
cachedAt,
|
|
21764
21802
|
};
|
|
21765
21803
|
};
|
|
21804
|
+
/* end_public_function */
|
|
21766
21805
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21767
21806
|
|
|
21807
|
+
/* begin_public_function
|
|
21808
|
+
id: file.delete
|
|
21809
|
+
*/
|
|
21768
21810
|
/**
|
|
21769
21811
|
* ```js
|
|
21770
21812
|
* import { deleteFile } from '@amityco/ts-sdk'
|
|
@@ -21786,7 +21828,8 @@ const deleteFile = async (fileId) => {
|
|
|
21786
21828
|
await client.http.delete(`/api/v3/files/${fileId}`);
|
|
21787
21829
|
dropFromCache(['file', 'get', fileId], true);
|
|
21788
21830
|
return { success: true };
|
|
21789
|
-
};
|
|
21831
|
+
};
|
|
21832
|
+
/* end_public_function */
|
|
21790
21833
|
|
|
21791
21834
|
/**
|
|
21792
21835
|
* Allow to query a file url with a selected size
|
|
@@ -21799,6 +21842,9 @@ const fileUrlWithSize = (fileUrl, size) => {
|
|
|
21799
21842
|
return `${fileUrl}?size=${size}`;
|
|
21800
21843
|
};
|
|
21801
21844
|
|
|
21845
|
+
/* begin_public_function
|
|
21846
|
+
id: file.upload.video
|
|
21847
|
+
*/
|
|
21802
21848
|
/**
|
|
21803
21849
|
* ```js
|
|
21804
21850
|
* import { createVideo } from '@amityco/ts-sdk'
|
|
@@ -21842,8 +21888,12 @@ const createVideo = async (formData, feedType, onProgress) => {
|
|
|
21842
21888
|
cachedAt,
|
|
21843
21889
|
};
|
|
21844
21890
|
};
|
|
21891
|
+
/* end_public_function */
|
|
21845
21892
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21846
21893
|
|
|
21894
|
+
/* begin_public_function
|
|
21895
|
+
id: file.upload.image
|
|
21896
|
+
*/
|
|
21847
21897
|
/**
|
|
21848
21898
|
* ```js
|
|
21849
21899
|
* import { createImage } from '@amityco/ts-sdk'
|
|
@@ -21883,6 +21933,7 @@ const createImage = async (formData, onProgress) => {
|
|
|
21883
21933
|
cachedAt,
|
|
21884
21934
|
};
|
|
21885
21935
|
};
|
|
21936
|
+
/* end_public_function */
|
|
21886
21937
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21887
21938
|
|
|
21888
21939
|
/**
|
|
@@ -22137,6 +22188,9 @@ function convertQueryParams$1(_a) {
|
|
|
22137
22188
|
return out;
|
|
22138
22189
|
}
|
|
22139
22190
|
|
|
22191
|
+
/* begin_public_function
|
|
22192
|
+
id: message.get
|
|
22193
|
+
*/
|
|
22140
22194
|
/**
|
|
22141
22195
|
* ```js
|
|
22142
22196
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22182,6 +22236,7 @@ const getMessage = async (messageId, isLive = false) => {
|
|
|
22182
22236
|
cachedAt,
|
|
22183
22237
|
};
|
|
22184
22238
|
};
|
|
22239
|
+
/* end_public_function */
|
|
22185
22240
|
/**
|
|
22186
22241
|
* ```js
|
|
22187
22242
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22273,6 +22328,9 @@ getMessages.locally = (messageIds) => {
|
|
|
22273
22328
|
};
|
|
22274
22329
|
};
|
|
22275
22330
|
|
|
22331
|
+
/* begin_public_function
|
|
22332
|
+
id: message.query
|
|
22333
|
+
*/
|
|
22276
22334
|
/**
|
|
22277
22335
|
* ```js
|
|
22278
22336
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22313,6 +22371,7 @@ const queryMessages = async (query) => {
|
|
|
22313
22371
|
const prevPage = toPageRaw(paging.previous);
|
|
22314
22372
|
return { data: messages, cachedAt, prevPage, nextPage };
|
|
22315
22373
|
};
|
|
22374
|
+
/* end_public_function */
|
|
22316
22375
|
/**
|
|
22317
22376
|
* ```js
|
|
22318
22377
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22350,8 +22409,12 @@ queryMessages.locally = (query) => {
|
|
|
22350
22409
|
|
|
22351
22410
|
const uuid = () => nativeIdGenerator.v4().toString();
|
|
22352
22411
|
|
|
22412
|
+
const getLocalId = () => `LOCAL_${uuid()}`;
|
|
22353
22413
|
// FIXME: temp solution
|
|
22354
22414
|
let uniqueId;
|
|
22415
|
+
/* begin_public_function
|
|
22416
|
+
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
|
|
22417
|
+
*/
|
|
22355
22418
|
/**
|
|
22356
22419
|
* ```js
|
|
22357
22420
|
* import { createMessage, createQuery, runQuery } from '@amityco/ts-sdk'
|
|
@@ -22377,7 +22440,7 @@ let uniqueId;
|
|
|
22377
22440
|
const createMessage = async (bundle) => {
|
|
22378
22441
|
const client = getActiveClient();
|
|
22379
22442
|
client.log('message/createMessage', bundle);
|
|
22380
|
-
const referenceId = uniqueId;
|
|
22443
|
+
const referenceId = uniqueId || getLocalId();
|
|
22381
22444
|
uniqueId = undefined;
|
|
22382
22445
|
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22383
22446
|
const data = prepareMessagePayload(payload);
|
|
@@ -22422,9 +22485,8 @@ createMessage.optimistically = (bundle) => {
|
|
|
22422
22485
|
* Updated to handle client requirement to add messageId while uploading
|
|
22423
22486
|
* message with image. Temporary!
|
|
22424
22487
|
*/
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
const bundleWithMessageId = Object.assign({ messageId: localId, uniqueId: localId }, bundle);
|
|
22488
|
+
uniqueId = getLocalId();
|
|
22489
|
+
const bundleWithMessageId = Object.assign({ messageId: uniqueId, uniqueId }, bundle);
|
|
22428
22490
|
client.log('message/createMessage.optimistically', bundleWithMessageId);
|
|
22429
22491
|
const subChannel = pullFromCache(['subChannel', 'get', bundle.subChannelId]);
|
|
22430
22492
|
if (subChannel) {
|
|
@@ -22446,8 +22508,12 @@ createMessage.optimistically = (bundle) => {
|
|
|
22446
22508
|
cachedAt,
|
|
22447
22509
|
data: message,
|
|
22448
22510
|
};
|
|
22449
|
-
};
|
|
22511
|
+
};
|
|
22512
|
+
/* end_public_function */
|
|
22450
22513
|
|
|
22514
|
+
/* begin_public_function
|
|
22515
|
+
id: message.edit
|
|
22516
|
+
*/
|
|
22451
22517
|
/**
|
|
22452
22518
|
* ```js
|
|
22453
22519
|
* import { updateMessage } from '@amityco/ts-sdk'
|
|
@@ -22513,8 +22579,12 @@ updateMessage.optimistically = (messageId, patch) => {
|
|
|
22513
22579
|
data: updated,
|
|
22514
22580
|
cachedAt,
|
|
22515
22581
|
};
|
|
22516
|
-
};
|
|
22582
|
+
};
|
|
22583
|
+
/* end_public_function */
|
|
22517
22584
|
|
|
22585
|
+
/* begin_public_function
|
|
22586
|
+
id: message.soft_delete
|
|
22587
|
+
*/
|
|
22518
22588
|
/**
|
|
22519
22589
|
* ```js
|
|
22520
22590
|
* import { deleteMessage } from '@amityco/ts-sdk'
|
|
@@ -22565,7 +22635,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22565
22635
|
data: deleted,
|
|
22566
22636
|
cachedAt,
|
|
22567
22637
|
};
|
|
22568
|
-
};
|
|
22638
|
+
};
|
|
22639
|
+
/* end_public_function */
|
|
22569
22640
|
|
|
22570
22641
|
/**
|
|
22571
22642
|
* Attach user object to membership model
|
|
@@ -22627,6 +22698,9 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22627
22698
|
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22628
22699
|
};
|
|
22629
22700
|
|
|
22701
|
+
/* begin_public_function
|
|
22702
|
+
id: post.query, feed.query.community_feed, feed.query.user_feed
|
|
22703
|
+
*/
|
|
22630
22704
|
/**
|
|
22631
22705
|
* ```js
|
|
22632
22706
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22678,6 +22752,7 @@ const queryPosts = async (query) => {
|
|
|
22678
22752
|
const prevPage = toPageRaw(paging.previous);
|
|
22679
22753
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
22680
22754
|
};
|
|
22755
|
+
/* end_public_function */
|
|
22681
22756
|
/**
|
|
22682
22757
|
* ```js
|
|
22683
22758
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22713,6 +22788,9 @@ queryPosts.locally = (query) => {
|
|
|
22713
22788
|
: undefined;
|
|
22714
22789
|
};
|
|
22715
22790
|
|
|
22791
|
+
/* begin_public_function
|
|
22792
|
+
id: post.get_by_ids
|
|
22793
|
+
*/
|
|
22716
22794
|
/**
|
|
22717
22795
|
* ```js
|
|
22718
22796
|
* import { getPosts } from '@amityco/ts-sdk'
|
|
@@ -22776,6 +22854,9 @@ getPosts.locally = (postIds) => {
|
|
|
22776
22854
|
};
|
|
22777
22855
|
};
|
|
22778
22856
|
|
|
22857
|
+
/* begin_public_function
|
|
22858
|
+
id: post.get
|
|
22859
|
+
*/
|
|
22779
22860
|
/**
|
|
22780
22861
|
* ```js
|
|
22781
22862
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22816,6 +22897,7 @@ const getPost = async (postId) => {
|
|
|
22816
22897
|
cachedAt,
|
|
22817
22898
|
};
|
|
22818
22899
|
};
|
|
22900
|
+
/* end_public_function */
|
|
22819
22901
|
/**
|
|
22820
22902
|
* ```js
|
|
22821
22903
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22843,6 +22925,9 @@ getPost.locally = (postId) => {
|
|
|
22843
22925
|
};
|
|
22844
22926
|
};
|
|
22845
22927
|
|
|
22928
|
+
/* begin_public_function
|
|
22929
|
+
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
|
|
22930
|
+
*/
|
|
22846
22931
|
/**
|
|
22847
22932
|
* ```js
|
|
22848
22933
|
* import { createPost } from '@amityco/ts-sdk'
|
|
@@ -22880,8 +22965,12 @@ const createPost = async (bundle) => {
|
|
|
22880
22965
|
data: posts[0],
|
|
22881
22966
|
cachedAt,
|
|
22882
22967
|
};
|
|
22883
|
-
};
|
|
22968
|
+
};
|
|
22969
|
+
/* end_public_function */
|
|
22884
22970
|
|
|
22971
|
+
/* begin_public_function
|
|
22972
|
+
id: post.edit
|
|
22973
|
+
*/
|
|
22885
22974
|
/**
|
|
22886
22975
|
* ```js
|
|
22887
22976
|
* import { updatePost } from '@amityco/ts-sdk'
|
|
@@ -22913,7 +23002,8 @@ const updatePost = async (postId, patch) => {
|
|
|
22913
23002
|
data: posts.find(post => post.postId === postId),
|
|
22914
23003
|
cachedAt,
|
|
22915
23004
|
};
|
|
22916
|
-
};
|
|
23005
|
+
};
|
|
23006
|
+
/* end_public_function */
|
|
22917
23007
|
|
|
22918
23008
|
const getMatchPostSetting = (value) => {
|
|
22919
23009
|
var _a;
|
|
@@ -22939,6 +23029,9 @@ const prepareCommunityRequest = (params) => {
|
|
|
22939
23029
|
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22940
23030
|
};
|
|
22941
23031
|
|
|
23032
|
+
/* begin_public_function
|
|
23033
|
+
id: community.query
|
|
23034
|
+
*/
|
|
22942
23035
|
/**
|
|
22943
23036
|
* ```js
|
|
22944
23037
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -22985,6 +23078,7 @@ const queryCommunities = async (query) => {
|
|
|
22985
23078
|
const prevPage = toPage(paging.previous);
|
|
22986
23079
|
return { data: communities, cachedAt, prevPage, nextPage };
|
|
22987
23080
|
};
|
|
23081
|
+
/* end_public_function */
|
|
22988
23082
|
/**
|
|
22989
23083
|
* ```js
|
|
22990
23084
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -23066,6 +23160,9 @@ getCommunities.locally = (communityIds) => {
|
|
|
23066
23160
|
};
|
|
23067
23161
|
};
|
|
23068
23162
|
|
|
23163
|
+
/* begin_public_function
|
|
23164
|
+
id: community.get
|
|
23165
|
+
*/
|
|
23069
23166
|
/**
|
|
23070
23167
|
* ```js
|
|
23071
23168
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23095,6 +23192,7 @@ const getCommunity = async (communityId) => {
|
|
|
23095
23192
|
cachedAt,
|
|
23096
23193
|
};
|
|
23097
23194
|
};
|
|
23195
|
+
/* end_public_function */
|
|
23098
23196
|
/**
|
|
23099
23197
|
* ```js
|
|
23100
23198
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23122,6 +23220,9 @@ getCommunity.locally = (communityId) => {
|
|
|
23122
23220
|
};
|
|
23123
23221
|
};
|
|
23124
23222
|
|
|
23223
|
+
/* begin_public_function
|
|
23224
|
+
id: community.create
|
|
23225
|
+
*/
|
|
23125
23226
|
/**
|
|
23126
23227
|
* ```js
|
|
23127
23228
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
@@ -23150,8 +23251,12 @@ const createCommunity = async (bundle) => {
|
|
|
23150
23251
|
data: communities[0],
|
|
23151
23252
|
cachedAt,
|
|
23152
23253
|
};
|
|
23153
|
-
};
|
|
23254
|
+
};
|
|
23255
|
+
/* end_public_function */
|
|
23154
23256
|
|
|
23257
|
+
/* begin_public_function
|
|
23258
|
+
id: community.update
|
|
23259
|
+
*/
|
|
23155
23260
|
/**
|
|
23156
23261
|
* ```js
|
|
23157
23262
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
@@ -23181,8 +23286,12 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
23181
23286
|
data: communities.find(community => community.communityId === communityId),
|
|
23182
23287
|
cachedAt,
|
|
23183
23288
|
};
|
|
23184
|
-
};
|
|
23289
|
+
};
|
|
23290
|
+
/* end_public_function */
|
|
23185
23291
|
|
|
23292
|
+
/* begin_public_function
|
|
23293
|
+
id: community.delete
|
|
23294
|
+
*/
|
|
23186
23295
|
/**
|
|
23187
23296
|
* ```js
|
|
23188
23297
|
* import { deleteCommunity } from '@amityco/ts-sdk'
|
|
@@ -23212,8 +23321,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23212
23321
|
users: [],
|
|
23213
23322
|
});
|
|
23214
23323
|
return deleted.data;
|
|
23215
|
-
};
|
|
23324
|
+
};
|
|
23325
|
+
/* end_public_function */
|
|
23216
23326
|
|
|
23327
|
+
/* begin_public_function
|
|
23328
|
+
id: community.join
|
|
23329
|
+
*/
|
|
23217
23330
|
/**
|
|
23218
23331
|
* ```js
|
|
23219
23332
|
* import { joinCommunity } from '@amityco/ts-sdk'
|
|
@@ -23239,8 +23352,12 @@ const joinCommunity = async (communityId) => {
|
|
|
23239
23352
|
ingestInCache(data, { cachedAt });
|
|
23240
23353
|
const { communityUsers } = data;
|
|
23241
23354
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23242
|
-
};
|
|
23355
|
+
};
|
|
23356
|
+
/* end_public_function */
|
|
23243
23357
|
|
|
23358
|
+
/* begin_public_function
|
|
23359
|
+
id: community.leave
|
|
23360
|
+
*/
|
|
23244
23361
|
/**
|
|
23245
23362
|
* ```js
|
|
23246
23363
|
* import { leaveCommunity } from '@amityco/ts-sdk'
|
|
@@ -23266,8 +23383,12 @@ const leaveCommunity = async (communityId) => {
|
|
|
23266
23383
|
ingestInCache(data, { cachedAt });
|
|
23267
23384
|
const { communityUsers } = data;
|
|
23268
23385
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23269
|
-
};
|
|
23386
|
+
};
|
|
23387
|
+
/* end_public_function */
|
|
23270
23388
|
|
|
23389
|
+
/* begin_public_function
|
|
23390
|
+
id: community.membership.query
|
|
23391
|
+
*/
|
|
23271
23392
|
/**
|
|
23272
23393
|
* ```js
|
|
23273
23394
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23311,6 +23432,7 @@ const queryCommunityMembers = async (query) => {
|
|
|
23311
23432
|
const prevPage = toPage(paging.previous);
|
|
23312
23433
|
return { data: communityUsers, cachedAt, nextPage, prevPage };
|
|
23313
23434
|
};
|
|
23435
|
+
/* end_public_function */
|
|
23314
23436
|
/**
|
|
23315
23437
|
* ```js
|
|
23316
23438
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23350,6 +23472,9 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23350
23472
|
: undefined;
|
|
23351
23473
|
};
|
|
23352
23474
|
|
|
23475
|
+
/* begin_public_function
|
|
23476
|
+
id: community.membership.add_members
|
|
23477
|
+
*/
|
|
23353
23478
|
/**
|
|
23354
23479
|
* ```js
|
|
23355
23480
|
* import { addCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23375,8 +23500,12 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23375
23500
|
ingestInCache(data);
|
|
23376
23501
|
const { communityUsers } = data;
|
|
23377
23502
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23378
|
-
};
|
|
23503
|
+
};
|
|
23504
|
+
/* end_public_function */
|
|
23379
23505
|
|
|
23506
|
+
/* begin_public_function
|
|
23507
|
+
id: community.membership.remove_member
|
|
23508
|
+
*/
|
|
23380
23509
|
/**
|
|
23381
23510
|
* ```js
|
|
23382
23511
|
* import { removeCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23402,8 +23531,12 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23402
23531
|
ingestInCache(data);
|
|
23403
23532
|
const { communityUsers } = data;
|
|
23404
23533
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23405
|
-
};
|
|
23534
|
+
};
|
|
23535
|
+
/* end_public_function */
|
|
23406
23536
|
|
|
23537
|
+
/* begin_public_function
|
|
23538
|
+
id: community.moderation.add_roles
|
|
23539
|
+
*/
|
|
23407
23540
|
/**
|
|
23408
23541
|
* ```js
|
|
23409
23542
|
* import { addCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23430,8 +23563,12 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23430
23563
|
const { communityUsers } = data;
|
|
23431
23564
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23432
23565
|
roleIds.some(role => communityUser.roles.includes(role)));
|
|
23433
|
-
};
|
|
23566
|
+
};
|
|
23567
|
+
/* end_public_function */
|
|
23434
23568
|
|
|
23569
|
+
/* begin_public_function
|
|
23570
|
+
id: community.moderation.remove_roles
|
|
23571
|
+
*/
|
|
23435
23572
|
/**
|
|
23436
23573
|
* ```js
|
|
23437
23574
|
* import { removeCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23458,8 +23595,12 @@ const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23458
23595
|
const { communityUsers } = data;
|
|
23459
23596
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23460
23597
|
!roleIds.some(role => communityUser.roles.includes(role)));
|
|
23461
|
-
};
|
|
23598
|
+
};
|
|
23599
|
+
/* end_public_function */
|
|
23462
23600
|
|
|
23601
|
+
/* begin_public_function
|
|
23602
|
+
id: community.query.trending_communities
|
|
23603
|
+
*/
|
|
23463
23604
|
/**
|
|
23464
23605
|
* ```js
|
|
23465
23606
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23491,6 +23632,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23491
23632
|
}
|
|
23492
23633
|
return { data: communities, cachedAt };
|
|
23493
23634
|
};
|
|
23635
|
+
/* end_public_function */
|
|
23494
23636
|
/**
|
|
23495
23637
|
* ```js
|
|
23496
23638
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23524,6 +23666,9 @@ getTopTrendingCommunities.locally = (query) => {
|
|
|
23524
23666
|
: undefined;
|
|
23525
23667
|
};
|
|
23526
23668
|
|
|
23669
|
+
/* begin_public_function
|
|
23670
|
+
id: community.query.recommended_communities
|
|
23671
|
+
*/
|
|
23527
23672
|
/**
|
|
23528
23673
|
* ```js
|
|
23529
23674
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23555,6 +23700,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23555
23700
|
}
|
|
23556
23701
|
return { data: communities, cachedAt };
|
|
23557
23702
|
};
|
|
23703
|
+
/* end_public_function */
|
|
23558
23704
|
/**
|
|
23559
23705
|
* ```js
|
|
23560
23706
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23588,6 +23734,9 @@ getRecommendedCommunities.locally = (query) => {
|
|
|
23588
23734
|
: undefined;
|
|
23589
23735
|
};
|
|
23590
23736
|
|
|
23737
|
+
/* begin_public_function
|
|
23738
|
+
id: post.soft_delete, post.hard_delete
|
|
23739
|
+
*/
|
|
23591
23740
|
/**
|
|
23592
23741
|
* ```js
|
|
23593
23742
|
* import { deletePost } from '@amityco/ts-sdk'
|
|
@@ -23650,8 +23799,12 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23650
23799
|
upsertInCache(['post', 'get', postId], { isDeleted: true });
|
|
23651
23800
|
}
|
|
23652
23801
|
return deleted;
|
|
23653
|
-
};
|
|
23802
|
+
};
|
|
23803
|
+
/* end_public_function */
|
|
23654
23804
|
|
|
23805
|
+
/* begin_public_function
|
|
23806
|
+
id: post.approve
|
|
23807
|
+
*/
|
|
23655
23808
|
/**
|
|
23656
23809
|
* ```js
|
|
23657
23810
|
* import { approvePost } from '@amityco/ts-sdk'
|
|
@@ -23684,8 +23837,12 @@ const approvePost = async (postId) => {
|
|
|
23684
23837
|
data: data.posts.find(post => post.postId === postId),
|
|
23685
23838
|
cachedAt,
|
|
23686
23839
|
};
|
|
23687
|
-
};
|
|
23840
|
+
};
|
|
23841
|
+
/* end_public_function */
|
|
23688
23842
|
|
|
23843
|
+
/* begin_public_function
|
|
23844
|
+
id: post.decline
|
|
23845
|
+
*/
|
|
23689
23846
|
/**
|
|
23690
23847
|
* ```js
|
|
23691
23848
|
* import { declinePost } from '@amityco/ts-sdk'
|
|
@@ -23718,8 +23875,12 @@ const declinePost = async (postId) => {
|
|
|
23718
23875
|
data: payload.posts.find(post => post.postId === postId),
|
|
23719
23876
|
cachedAt,
|
|
23720
23877
|
};
|
|
23721
|
-
};
|
|
23878
|
+
};
|
|
23879
|
+
/* end_public_function */
|
|
23722
23880
|
|
|
23881
|
+
/* begin_public_function
|
|
23882
|
+
id: comment.query
|
|
23883
|
+
*/
|
|
23723
23884
|
/**
|
|
23724
23885
|
* ```js
|
|
23725
23886
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23769,6 +23930,7 @@ const queryComments = async (query) => {
|
|
|
23769
23930
|
const prevPage = toPage(paging.previous);
|
|
23770
23931
|
return { data: comments, cachedAt, prevPage, nextPage };
|
|
23771
23932
|
};
|
|
23933
|
+
/* end_public_function */
|
|
23772
23934
|
/**
|
|
23773
23935
|
* ```js
|
|
23774
23936
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23804,6 +23966,9 @@ queryComments.locally = (query) => {
|
|
|
23804
23966
|
: undefined;
|
|
23805
23967
|
};
|
|
23806
23968
|
|
|
23969
|
+
/* begin_public_function
|
|
23970
|
+
id: comment.get_by_ids
|
|
23971
|
+
*/
|
|
23807
23972
|
/**
|
|
23808
23973
|
* ```js
|
|
23809
23974
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23834,6 +23999,7 @@ const getComments = async (commentIds) => {
|
|
|
23834
23999
|
cachedAt,
|
|
23835
24000
|
};
|
|
23836
24001
|
};
|
|
24002
|
+
/* end_public_function */
|
|
23837
24003
|
/**
|
|
23838
24004
|
* ```js
|
|
23839
24005
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23866,6 +24032,9 @@ getComments.locally = (commentIds) => {
|
|
|
23866
24032
|
};
|
|
23867
24033
|
};
|
|
23868
24034
|
|
|
24035
|
+
/* begin_public_function
|
|
24036
|
+
id: comment.get
|
|
24037
|
+
*/
|
|
23869
24038
|
/**
|
|
23870
24039
|
* ```js
|
|
23871
24040
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23905,6 +24074,7 @@ const getComment = async (commentId) => {
|
|
|
23905
24074
|
cachedAt,
|
|
23906
24075
|
};
|
|
23907
24076
|
};
|
|
24077
|
+
/* end_public_function */
|
|
23908
24078
|
/**
|
|
23909
24079
|
* ```js
|
|
23910
24080
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23932,6 +24102,9 @@ getComment.locally = (commentId) => {
|
|
|
23932
24102
|
};
|
|
23933
24103
|
};
|
|
23934
24104
|
|
|
24105
|
+
/* begin_public_function
|
|
24106
|
+
id: comment.create
|
|
24107
|
+
*/
|
|
23935
24108
|
/**
|
|
23936
24109
|
* ```js
|
|
23937
24110
|
* import { createComment } from '@amityco/ts-sdk'
|
|
@@ -23971,8 +24144,12 @@ const createComment = async (bundle) => {
|
|
|
23971
24144
|
data: comments[0],
|
|
23972
24145
|
cachedAt,
|
|
23973
24146
|
};
|
|
23974
|
-
};
|
|
24147
|
+
};
|
|
24148
|
+
/* end_public_function */
|
|
23975
24149
|
|
|
24150
|
+
/* begin_public_function
|
|
24151
|
+
id: comment.update_comment
|
|
24152
|
+
*/
|
|
23976
24153
|
/**
|
|
23977
24154
|
* ```js
|
|
23978
24155
|
* import { updateComment } from '@amityco/ts-sdk'
|
|
@@ -24003,8 +24180,12 @@ const updateComment = async (commentId, patch) => {
|
|
|
24003
24180
|
data: comments.find(comment => comment.commentId === commentId),
|
|
24004
24181
|
cachedAt,
|
|
24005
24182
|
};
|
|
24006
|
-
};
|
|
24183
|
+
};
|
|
24184
|
+
/* end_public_function */
|
|
24007
24185
|
|
|
24186
|
+
/* begin_public_function
|
|
24187
|
+
id: comment.soft_delete, comment.hard_delete
|
|
24188
|
+
*/
|
|
24008
24189
|
/**
|
|
24009
24190
|
* ```js
|
|
24010
24191
|
* import { deleteComment } from '@amityco/ts-sdk'
|
|
@@ -24057,7 +24238,8 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
24057
24238
|
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
24058
24239
|
}
|
|
24059
24240
|
return deleted;
|
|
24060
|
-
};
|
|
24241
|
+
};
|
|
24242
|
+
/* end_public_function */
|
|
24061
24243
|
|
|
24062
24244
|
/** @hidden */
|
|
24063
24245
|
const preparePayloadForCache = (event, payload) => {
|
|
@@ -24097,6 +24279,9 @@ const preparePayloadForCache = (event, payload) => {
|
|
|
24097
24279
|
}
|
|
24098
24280
|
};
|
|
24099
24281
|
|
|
24282
|
+
/* begin_public_function
|
|
24283
|
+
id: reaction.add
|
|
24284
|
+
*/
|
|
24100
24285
|
/**
|
|
24101
24286
|
* ```js
|
|
24102
24287
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24137,6 +24322,7 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24137
24322
|
}
|
|
24138
24323
|
return true;
|
|
24139
24324
|
};
|
|
24325
|
+
/* end_public_function */
|
|
24140
24326
|
/**
|
|
24141
24327
|
* ```js
|
|
24142
24328
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24177,6 +24363,9 @@ addReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24177
24363
|
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;
|
|
24178
24364
|
};
|
|
24179
24365
|
|
|
24366
|
+
/* begin_public_function
|
|
24367
|
+
id: reaction.remove
|
|
24368
|
+
*/
|
|
24180
24369
|
/**
|
|
24181
24370
|
* ```js
|
|
24182
24371
|
* import { deleteReaction } from '@amityco/ts-sdk'
|
|
@@ -24219,6 +24408,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24219
24408
|
}
|
|
24220
24409
|
return true;
|
|
24221
24410
|
};
|
|
24411
|
+
/* end_public_function */
|
|
24222
24412
|
/**
|
|
24223
24413
|
* ```js
|
|
24224
24414
|
* import { removeReaction } from '@amityco/ts-sdk'
|
|
@@ -24259,6 +24449,9 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24259
24449
|
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;
|
|
24260
24450
|
};
|
|
24261
24451
|
|
|
24452
|
+
/* begin_public_function
|
|
24453
|
+
id: reaction.query
|
|
24454
|
+
*/
|
|
24262
24455
|
/**
|
|
24263
24456
|
* ```js
|
|
24264
24457
|
* import { queryReactions } from '@amityco/ts-sdk'
|
|
@@ -24293,7 +24486,8 @@ const queryReactions = async (query) => {
|
|
|
24293
24486
|
const nextPage = toPageRaw(paging.next);
|
|
24294
24487
|
const prevPage = toPageRaw(paging.previous);
|
|
24295
24488
|
return { data: reactions, prevPage, nextPage };
|
|
24296
|
-
};
|
|
24489
|
+
};
|
|
24490
|
+
/* end_public_function */
|
|
24297
24491
|
|
|
24298
24492
|
const createPostEventSubscriber = (event, callback) => {
|
|
24299
24493
|
const client = getActiveClient();
|
|
@@ -25040,6 +25234,9 @@ var REFERENCE_TYPES = {
|
|
|
25040
25234
|
},
|
|
25041
25235
|
};
|
|
25042
25236
|
|
|
25237
|
+
/* begin_public_function
|
|
25238
|
+
id: user.flag, message.flag, post.flag, comment.flag
|
|
25239
|
+
*/
|
|
25043
25240
|
/**
|
|
25044
25241
|
* ```js
|
|
25045
25242
|
* import { createReport } from '@amityco/ts-sdk'
|
|
@@ -25080,8 +25277,12 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
25080
25277
|
}
|
|
25081
25278
|
fireEvent(`${referenceType}.flagged`, payload);
|
|
25082
25279
|
return !!payload;
|
|
25083
|
-
};
|
|
25280
|
+
};
|
|
25281
|
+
/* end_public_function */
|
|
25084
25282
|
|
|
25283
|
+
/* begin_public_function
|
|
25284
|
+
id: user.unflag, message.unflag, post.unflag, comment.unflag
|
|
25285
|
+
*/
|
|
25085
25286
|
/**
|
|
25086
25287
|
* ```js
|
|
25087
25288
|
* import { deleteReport } from '@amityco/ts-sdk'
|
|
@@ -25123,8 +25324,12 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25123
25324
|
// @ts-ignore
|
|
25124
25325
|
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25125
25326
|
return !!payload;
|
|
25126
|
-
};
|
|
25327
|
+
};
|
|
25328
|
+
/* end_public_function */
|
|
25127
25329
|
|
|
25330
|
+
/* begin_public_function
|
|
25331
|
+
id: user.check_flag_by_me, message.check_flag_by_me, post.check_flag_by_me, comment.check_flag_by_me
|
|
25332
|
+
*/
|
|
25128
25333
|
/**
|
|
25129
25334
|
* ```js
|
|
25130
25335
|
* import { isReportedByMe } from '@amityco/ts-sdk'
|
|
@@ -25151,7 +25356,8 @@ const isReportedByMe = async (referenceType, referenceId) => {
|
|
|
25151
25356
|
[primaryKey]: referenceId,
|
|
25152
25357
|
}))) !== null && _a !== void 0 ? _a : {};
|
|
25153
25358
|
return (_b = result !== null && result !== void 0 ? result : isFlagByMe) !== null && _b !== void 0 ? _b : false;
|
|
25154
|
-
};
|
|
25359
|
+
};
|
|
25360
|
+
/* end_public_function */
|
|
25155
25361
|
|
|
25156
25362
|
function convertFromRaw$1(_a, params) {
|
|
25157
25363
|
var { _id } = _a, rest = __rest(_a, ["_id"]);
|
|
@@ -25186,6 +25392,9 @@ const prepareChannelPayload = (rawPayload) => {
|
|
|
25186
25392
|
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25187
25393
|
};
|
|
25188
25394
|
|
|
25395
|
+
/* begin_public_function
|
|
25396
|
+
id: channel.query
|
|
25397
|
+
*/
|
|
25189
25398
|
/**
|
|
25190
25399
|
* ```js
|
|
25191
25400
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25231,6 +25440,7 @@ const queryChannels = async (query) => {
|
|
|
25231
25440
|
const prevPage = toPage(paging.previous);
|
|
25232
25441
|
return { data: channels, cachedAt, prevPage, nextPage };
|
|
25233
25442
|
};
|
|
25443
|
+
/* end_public_function */
|
|
25234
25444
|
/**
|
|
25235
25445
|
* ```js
|
|
25236
25446
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25328,6 +25538,9 @@ getChannels.locally = (channelIds) => {
|
|
|
25328
25538
|
};
|
|
25329
25539
|
};
|
|
25330
25540
|
|
|
25541
|
+
/* begin_public_function
|
|
25542
|
+
id: channel.get
|
|
25543
|
+
*/
|
|
25331
25544
|
/**
|
|
25332
25545
|
* ```js
|
|
25333
25546
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25366,6 +25579,7 @@ const getChannel = async (channelId) => {
|
|
|
25366
25579
|
cachedAt,
|
|
25367
25580
|
};
|
|
25368
25581
|
};
|
|
25582
|
+
/* end_public_function */
|
|
25369
25583
|
/**
|
|
25370
25584
|
* ```js
|
|
25371
25585
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25393,6 +25607,9 @@ getChannel.locally = (channelId) => {
|
|
|
25393
25607
|
};
|
|
25394
25608
|
};
|
|
25395
25609
|
|
|
25610
|
+
/* begin_public_function
|
|
25611
|
+
id: channel.create
|
|
25612
|
+
*/
|
|
25396
25613
|
/**
|
|
25397
25614
|
* ```js
|
|
25398
25615
|
* import { createChannel } from '@amityco/ts-sdk'
|
|
@@ -25426,8 +25643,12 @@ const createChannel = async (bundle) => {
|
|
|
25426
25643
|
data: channels[0],
|
|
25427
25644
|
cachedAt,
|
|
25428
25645
|
};
|
|
25429
|
-
};
|
|
25646
|
+
};
|
|
25647
|
+
/* end_public_function */
|
|
25430
25648
|
|
|
25649
|
+
/* begin_public_function
|
|
25650
|
+
id: channel.update
|
|
25651
|
+
*/
|
|
25431
25652
|
/**
|
|
25432
25653
|
* ```js
|
|
25433
25654
|
* import { updateChannel } from '@amityco/ts-sdk'
|
|
@@ -25456,7 +25677,8 @@ const updateChannel = async (channelId, patch) => {
|
|
|
25456
25677
|
data: channels.find(channel => channel.channelId === channelId),
|
|
25457
25678
|
cachedAt,
|
|
25458
25679
|
};
|
|
25459
|
-
};
|
|
25680
|
+
};
|
|
25681
|
+
/* end_public_function */
|
|
25460
25682
|
|
|
25461
25683
|
/**
|
|
25462
25684
|
* ```js
|
|
@@ -25481,6 +25703,9 @@ const deleteChannel = async (channelId) => {
|
|
|
25481
25703
|
return deleted.data;
|
|
25482
25704
|
};
|
|
25483
25705
|
|
|
25706
|
+
/* begin_public_function
|
|
25707
|
+
id: channel.join
|
|
25708
|
+
*/
|
|
25484
25709
|
/**
|
|
25485
25710
|
* ```js
|
|
25486
25711
|
* import { joinChannel } from '@amityco/ts-sdk'
|
|
@@ -25504,8 +25729,12 @@ const joinChannel = async (channelId) => {
|
|
|
25504
25729
|
ingestInCache(data);
|
|
25505
25730
|
const { channelUsers } = data;
|
|
25506
25731
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25507
|
-
};
|
|
25732
|
+
};
|
|
25733
|
+
/* end_public_function */
|
|
25508
25734
|
|
|
25735
|
+
/* begin_public_function
|
|
25736
|
+
id: channel.leave
|
|
25737
|
+
*/
|
|
25509
25738
|
/**
|
|
25510
25739
|
* ```js
|
|
25511
25740
|
* import { leaveChannel } from '@amityco/ts-sdk'
|
|
@@ -25529,8 +25758,12 @@ const leaveChannel = async (channelId) => {
|
|
|
25529
25758
|
ingestInCache(data);
|
|
25530
25759
|
const { channelUsers } = data;
|
|
25531
25760
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25532
|
-
};
|
|
25761
|
+
};
|
|
25762
|
+
/* end_public_function */
|
|
25533
25763
|
|
|
25764
|
+
/* begin_public_function
|
|
25765
|
+
id: channel.member.query, channel.member.search
|
|
25766
|
+
*/
|
|
25534
25767
|
/**
|
|
25535
25768
|
* ```js
|
|
25536
25769
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25579,6 +25812,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25579
25812
|
prevPage,
|
|
25580
25813
|
};
|
|
25581
25814
|
};
|
|
25815
|
+
/* end_public_function */
|
|
25582
25816
|
/**
|
|
25583
25817
|
* ```js
|
|
25584
25818
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25619,6 +25853,9 @@ queryChannelMembers.locally = (query) => {
|
|
|
25619
25853
|
: undefined;
|
|
25620
25854
|
};
|
|
25621
25855
|
|
|
25856
|
+
/* begin_public_function
|
|
25857
|
+
id: channel.member.add
|
|
25858
|
+
*/
|
|
25622
25859
|
/**
|
|
25623
25860
|
* ```js
|
|
25624
25861
|
* import { addChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25647,8 +25884,12 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25647
25884
|
ingestInCache(data);
|
|
25648
25885
|
const { channelUsers } = data;
|
|
25649
25886
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25650
|
-
};
|
|
25887
|
+
};
|
|
25888
|
+
/* end_public_function */
|
|
25651
25889
|
|
|
25890
|
+
/* begin_public_function
|
|
25891
|
+
id: channel.member.remove
|
|
25892
|
+
*/
|
|
25652
25893
|
/**
|
|
25653
25894
|
* ```js
|
|
25654
25895
|
* import { removeChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25677,8 +25918,12 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25677
25918
|
ingestInCache(data);
|
|
25678
25919
|
const { channelUsers } = data;
|
|
25679
25920
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25680
|
-
};
|
|
25921
|
+
};
|
|
25922
|
+
/* end_public_function */
|
|
25681
25923
|
|
|
25924
|
+
/* begin_public_function
|
|
25925
|
+
id: channel.moderation.add_roles
|
|
25926
|
+
*/
|
|
25682
25927
|
/**
|
|
25683
25928
|
* ```js
|
|
25684
25929
|
* import { addChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25704,8 +25949,12 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25704
25949
|
ingestInCache(data);
|
|
25705
25950
|
const { channelUsers } = data;
|
|
25706
25951
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.roles.includes(roleId));
|
|
25707
|
-
};
|
|
25952
|
+
};
|
|
25953
|
+
/* end_public_function */
|
|
25708
25954
|
|
|
25955
|
+
/* begin_public_function
|
|
25956
|
+
id: channel.moderation.remove_roles
|
|
25957
|
+
*/
|
|
25709
25958
|
/**
|
|
25710
25959
|
* ```js
|
|
25711
25960
|
* import { removeChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25716,7 +25965,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25716
25965
|
*
|
|
25717
25966
|
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
25718
25967
|
* @param roleId The ID of the {@link Amity.Role} to apply
|
|
25719
|
-
* @param
|
|
25968
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
25720
25969
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
|
|
25721
25970
|
*
|
|
25722
25971
|
* @category Channel API
|
|
@@ -25731,8 +25980,12 @@ const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25731
25980
|
ingestInCache(data);
|
|
25732
25981
|
const { channelUsers } = data;
|
|
25733
25982
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && !channelUser.roles.includes(roleId));
|
|
25734
|
-
};
|
|
25983
|
+
};
|
|
25984
|
+
/* end_public_function */
|
|
25735
25985
|
|
|
25986
|
+
/* begin_public_function
|
|
25987
|
+
id: channel.moderation.ban_members
|
|
25988
|
+
*/
|
|
25736
25989
|
/**
|
|
25737
25990
|
* ```js
|
|
25738
25991
|
* import { banChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25762,8 +26015,12 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25762
26015
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'banned'),
|
|
25763
26016
|
cachedAt,
|
|
25764
26017
|
};
|
|
25765
|
-
};
|
|
26018
|
+
};
|
|
26019
|
+
/* end_public_function */
|
|
25766
26020
|
|
|
26021
|
+
/* begin_public_function
|
|
26022
|
+
id: channel.moderation.unban_members
|
|
26023
|
+
*/
|
|
25767
26024
|
/**
|
|
25768
26025
|
* ```js
|
|
25769
26026
|
* import { unbanChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25793,8 +26050,12 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25793
26050
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'member'),
|
|
25794
26051
|
cachedAt,
|
|
25795
26052
|
};
|
|
25796
|
-
};
|
|
26053
|
+
};
|
|
26054
|
+
/* end_public_function */
|
|
25797
26055
|
|
|
26056
|
+
/* begin_public_function
|
|
26057
|
+
id: channel.start_reading
|
|
26058
|
+
*/
|
|
25798
26059
|
/**
|
|
25799
26060
|
* ```js
|
|
25800
26061
|
* import { startReading } from '@amityco/ts-sdk'
|
|
@@ -25803,9 +26064,9 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25803
26064
|
*
|
|
25804
26065
|
* Mark all messages as read and start reading message inside channel
|
|
25805
26066
|
*
|
|
25806
|
-
* @param
|
|
25807
|
-
* @param
|
|
25808
|
-
* @return
|
|
26067
|
+
* @param subChannelId - The channel ID to start reading.
|
|
26068
|
+
* @param userId - The user ID of channel member.
|
|
26069
|
+
* @return A success boolean if the channel reading of the sub channel had begun.
|
|
25809
26070
|
*
|
|
25810
26071
|
* @category Message API
|
|
25811
26072
|
* @async
|
|
@@ -25831,8 +26092,12 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25831
26092
|
channelId,
|
|
25832
26093
|
});
|
|
25833
26094
|
return !!result;
|
|
25834
|
-
};
|
|
26095
|
+
};
|
|
26096
|
+
/* end_public_function */
|
|
25835
26097
|
|
|
26098
|
+
/* begin_public_function
|
|
26099
|
+
id: channel.stop_reading
|
|
26100
|
+
*/
|
|
25836
26101
|
/**
|
|
25837
26102
|
* ```js
|
|
25838
26103
|
* import { stopReading } from '@amityco/ts-sdk'
|
|
@@ -25841,8 +26106,8 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25841
26106
|
*
|
|
25842
26107
|
* Stop reading message inside channel
|
|
25843
26108
|
*
|
|
25844
|
-
* @param
|
|
25845
|
-
* @return
|
|
26109
|
+
* @param subChannelId - The channel ID to stop reading.
|
|
26110
|
+
* @return A success boolean if the sub channel reading was halted.
|
|
25846
26111
|
*
|
|
25847
26112
|
* @category Message API
|
|
25848
26113
|
* @async
|
|
@@ -25867,7 +26132,8 @@ const stopReading = async (subChannelId) => {
|
|
|
25867
26132
|
channelId,
|
|
25868
26133
|
});
|
|
25869
26134
|
return !!result;
|
|
25870
|
-
};
|
|
26135
|
+
};
|
|
26136
|
+
/* end_public_function */
|
|
25871
26137
|
|
|
25872
26138
|
/**
|
|
25873
26139
|
* ```js
|
|
@@ -26759,6 +27025,9 @@ function convertQueryParams(_a) {
|
|
|
26759
27025
|
return out;
|
|
26760
27026
|
}
|
|
26761
27027
|
|
|
27028
|
+
/* begin_public_function
|
|
27029
|
+
id: subchannel.query
|
|
27030
|
+
*/
|
|
26762
27031
|
/**
|
|
26763
27032
|
* ```js
|
|
26764
27033
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26800,6 +27069,7 @@ const querySubChannels = async (query) => {
|
|
|
26800
27069
|
const prevPage = toPage(paging.previous);
|
|
26801
27070
|
return { data: subChannels, cachedAt, prevPage, nextPage };
|
|
26802
27071
|
};
|
|
27072
|
+
/* end_public_function */
|
|
26803
27073
|
/**
|
|
26804
27074
|
* ```js
|
|
26805
27075
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26900,6 +27170,9 @@ getSubChannels.locally = (subChannelIds) => {
|
|
|
26900
27170
|
};
|
|
26901
27171
|
};
|
|
26902
27172
|
|
|
27173
|
+
/* begin_public_function
|
|
27174
|
+
id: subchannel.get
|
|
27175
|
+
*/
|
|
26903
27176
|
/**
|
|
26904
27177
|
* ```js
|
|
26905
27178
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26937,6 +27210,7 @@ const getSubChannel = async (subChannelId) => {
|
|
|
26937
27210
|
throw error;
|
|
26938
27211
|
}
|
|
26939
27212
|
};
|
|
27213
|
+
/* end_public_function */
|
|
26940
27214
|
/**
|
|
26941
27215
|
* ```js
|
|
26942
27216
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26964,6 +27238,9 @@ getSubChannel.locally = (subChannelId) => {
|
|
|
26964
27238
|
};
|
|
26965
27239
|
};
|
|
26966
27240
|
|
|
27241
|
+
/* begin_public_function
|
|
27242
|
+
id: subchannel.create
|
|
27243
|
+
*/
|
|
26967
27244
|
/**
|
|
26968
27245
|
* ```js
|
|
26969
27246
|
* import { createSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26994,8 +27271,12 @@ const createSubChannel = async (bundle) => {
|
|
|
26994
27271
|
data: data.messageFeeds[0],
|
|
26995
27272
|
cachedAt,
|
|
26996
27273
|
};
|
|
26997
|
-
};
|
|
27274
|
+
};
|
|
27275
|
+
/* end_public_function */
|
|
26998
27276
|
|
|
27277
|
+
/* begin_public_function
|
|
27278
|
+
id: subchannel.update
|
|
27279
|
+
*/
|
|
26999
27280
|
/**
|
|
27000
27281
|
* ```js
|
|
27001
27282
|
* import { updateSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27024,8 +27305,12 @@ const updateSubChannel = async (subChannelId, patch) => {
|
|
|
27024
27305
|
data: data.messageFeeds[0],
|
|
27025
27306
|
cachedAt,
|
|
27026
27307
|
};
|
|
27027
|
-
};
|
|
27308
|
+
};
|
|
27309
|
+
/* end_public_function */
|
|
27028
27310
|
|
|
27311
|
+
/* begin_public_function
|
|
27312
|
+
id: subchannel.soft_delete, subchannel.hard_delete
|
|
27313
|
+
*/
|
|
27029
27314
|
/**
|
|
27030
27315
|
* ```js
|
|
27031
27316
|
* import { deleteSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27056,7 +27341,8 @@ const deleteSubChannel = async (subChannelId, permanent = false) => {
|
|
|
27056
27341
|
}
|
|
27057
27342
|
fireEvent('local.message-feed.deleted', { messageFeeds: [deleted] });
|
|
27058
27343
|
return deleted;
|
|
27059
|
-
};
|
|
27344
|
+
};
|
|
27345
|
+
/* end_public_function */
|
|
27060
27346
|
|
|
27061
27347
|
/**
|
|
27062
27348
|
* ```js
|
|
@@ -27382,7 +27668,7 @@ const liveMessages = (params, callback, config) => {
|
|
|
27382
27668
|
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
27383
27669
|
return;
|
|
27384
27670
|
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 } }));
|
|
27385
|
-
runQuery(query, ({ data: result, error, loading,
|
|
27671
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27386
27672
|
const data = {
|
|
27387
27673
|
loading,
|
|
27388
27674
|
error,
|
|
@@ -28099,6 +28385,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28099
28385
|
};
|
|
28100
28386
|
};
|
|
28101
28387
|
|
|
28388
|
+
/* begin_public_function
|
|
28389
|
+
id: community.category.query
|
|
28390
|
+
*/
|
|
28102
28391
|
/**
|
|
28103
28392
|
* ```js
|
|
28104
28393
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28317,6 +28606,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28317
28606
|
};
|
|
28318
28607
|
};
|
|
28319
28608
|
|
|
28609
|
+
/* begin_public_function
|
|
28610
|
+
id: feed.query.global_feed
|
|
28611
|
+
*/
|
|
28320
28612
|
/**
|
|
28321
28613
|
* ```js
|
|
28322
28614
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28357,6 +28649,7 @@ const queryGlobalFeed = async (query) => {
|
|
|
28357
28649
|
const prevPage = toPage(paging.previous);
|
|
28358
28650
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
28359
28651
|
};
|
|
28652
|
+
/* end_public_function */
|
|
28360
28653
|
/**
|
|
28361
28654
|
* ```js
|
|
28362
28655
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28447,6 +28740,9 @@ queryFollows.locally = (key, query) => {
|
|
|
28447
28740
|
: undefined;
|
|
28448
28741
|
};
|
|
28449
28742
|
|
|
28743
|
+
/* begin_public_function
|
|
28744
|
+
id: user.relationship.query_my_followers, user.relationship.query_followers
|
|
28745
|
+
*/
|
|
28450
28746
|
/**
|
|
28451
28747
|
* ```js
|
|
28452
28748
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28462,6 +28758,7 @@ queryFollows.locally = (key, query) => {
|
|
|
28462
28758
|
* @async
|
|
28463
28759
|
*/
|
|
28464
28760
|
const queryFollowers = async (query) => queryFollows('followers', query);
|
|
28761
|
+
/* end_public_function */
|
|
28465
28762
|
/**
|
|
28466
28763
|
* ```js
|
|
28467
28764
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28477,6 +28774,9 @@ const queryFollowers = async (query) => queryFollows('followers', query);
|
|
|
28477
28774
|
*/
|
|
28478
28775
|
queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
28479
28776
|
|
|
28777
|
+
/* begin_public_function
|
|
28778
|
+
id: user.relationship.query_my_followings, user.relationship.query_followings
|
|
28779
|
+
*/
|
|
28480
28780
|
/**
|
|
28481
28781
|
* ```js
|
|
28482
28782
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28492,6 +28792,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
|
28492
28792
|
* @async
|
|
28493
28793
|
*/
|
|
28494
28794
|
const queryFollowings = async (query) => queryFollows('following', query);
|
|
28795
|
+
/* end_public_function */
|
|
28495
28796
|
/**
|
|
28496
28797
|
* ```js
|
|
28497
28798
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28512,6 +28813,9 @@ const getCacheKey = (userId) => [
|
|
|
28512
28813
|
'get',
|
|
28513
28814
|
`${getActiveClient().userId}#${userId}`,
|
|
28514
28815
|
];
|
|
28816
|
+
/* begin_public_function
|
|
28817
|
+
id: user.relationship.get_follow_info, user.relationship.get_my_follow_info
|
|
28818
|
+
*/
|
|
28515
28819
|
/**
|
|
28516
28820
|
* ```js
|
|
28517
28821
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28542,6 +28846,7 @@ const getFollowInfo = async (userId) => {
|
|
|
28542
28846
|
cachedAt,
|
|
28543
28847
|
};
|
|
28544
28848
|
};
|
|
28849
|
+
/* end_public_function */
|
|
28545
28850
|
/**
|
|
28546
28851
|
* ```js
|
|
28547
28852
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28571,6 +28876,9 @@ getFollowInfo.locally = (userId) => {
|
|
|
28571
28876
|
};
|
|
28572
28877
|
};
|
|
28573
28878
|
|
|
28879
|
+
/* begin_public_function
|
|
28880
|
+
id: user.relationship.follow
|
|
28881
|
+
*/
|
|
28574
28882
|
/**
|
|
28575
28883
|
* ```js
|
|
28576
28884
|
* import { follow } from '@amityco/ts-sdk'
|
|
@@ -28598,8 +28906,12 @@ const follow = async (userId) => {
|
|
|
28598
28906
|
data: data.follows[0],
|
|
28599
28907
|
cachedAt,
|
|
28600
28908
|
};
|
|
28601
|
-
};
|
|
28909
|
+
};
|
|
28910
|
+
/* end_public_function */
|
|
28602
28911
|
|
|
28912
|
+
/* begin_public_function
|
|
28913
|
+
id: user.relationship.unfollow
|
|
28914
|
+
*/
|
|
28603
28915
|
/**
|
|
28604
28916
|
* ```js
|
|
28605
28917
|
* import { unfollow } from '@amityco/ts-sdk'
|
|
@@ -28623,8 +28935,12 @@ const unfollow = async (userId) => {
|
|
|
28623
28935
|
}
|
|
28624
28936
|
fireEvent('follow.unfollowed', data);
|
|
28625
28937
|
return true;
|
|
28626
|
-
};
|
|
28938
|
+
};
|
|
28939
|
+
/* end_public_function */
|
|
28627
28940
|
|
|
28941
|
+
/* begin_public_function
|
|
28942
|
+
id: user.relationship.accept_follow
|
|
28943
|
+
*/
|
|
28628
28944
|
/**
|
|
28629
28945
|
* ```js
|
|
28630
28946
|
* import { acceptFollower } from '@amityco/ts-sdk'
|
|
@@ -28648,8 +28964,12 @@ const acceptFollower = async (userId) => {
|
|
|
28648
28964
|
}
|
|
28649
28965
|
fireEvent('follow.accepted', data);
|
|
28650
28966
|
return true;
|
|
28651
|
-
};
|
|
28967
|
+
};
|
|
28968
|
+
/* end_public_function */
|
|
28652
28969
|
|
|
28970
|
+
/* begin_public_function
|
|
28971
|
+
id: user.relationship.decline_follow
|
|
28972
|
+
*/
|
|
28653
28973
|
/**
|
|
28654
28974
|
* ```js
|
|
28655
28975
|
* import { declineFollower } from '@amityco/ts-sdk'
|
|
@@ -28673,7 +28993,8 @@ const declineFollower = async (userId) => {
|
|
|
28673
28993
|
}
|
|
28674
28994
|
fireEvent('follow.requestDeclined', data);
|
|
28675
28995
|
return true;
|
|
28676
|
-
};
|
|
28996
|
+
};
|
|
28997
|
+
/* end_public_function */
|
|
28677
28998
|
|
|
28678
28999
|
const createFollowEventSubscriber = (event, callback) => {
|
|
28679
29000
|
const client = getActiveClient();
|
|
@@ -29591,6 +29912,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29591
29912
|
};
|
|
29592
29913
|
};
|
|
29593
29914
|
|
|
29915
|
+
/* begin_public_function
|
|
29916
|
+
id: poll.get
|
|
29917
|
+
*/
|
|
29594
29918
|
/**
|
|
29595
29919
|
* ```js
|
|
29596
29920
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29618,6 +29942,7 @@ const getPoll = async (pollId) => {
|
|
|
29618
29942
|
cachedAt,
|
|
29619
29943
|
};
|
|
29620
29944
|
};
|
|
29945
|
+
/* end_public_function */
|
|
29621
29946
|
/**
|
|
29622
29947
|
* ```js
|
|
29623
29948
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29645,6 +29970,9 @@ getPoll.locally = (pollId) => {
|
|
|
29645
29970
|
};
|
|
29646
29971
|
};
|
|
29647
29972
|
|
|
29973
|
+
/* begin_public_function
|
|
29974
|
+
id: poll.create
|
|
29975
|
+
*/
|
|
29648
29976
|
/**
|
|
29649
29977
|
* ```js
|
|
29650
29978
|
* import { createPoll } from '@amityco/ts-sdk'
|
|
@@ -29678,8 +30006,12 @@ const createPoll = async (bundle) => {
|
|
|
29678
30006
|
data: polls[0],
|
|
29679
30007
|
cachedAt,
|
|
29680
30008
|
};
|
|
29681
|
-
};
|
|
30009
|
+
};
|
|
30010
|
+
/* end_public_function */
|
|
29682
30011
|
|
|
30012
|
+
/* begin_public_function
|
|
30013
|
+
id: poll.close
|
|
30014
|
+
*/
|
|
29683
30015
|
/**
|
|
29684
30016
|
* ```js
|
|
29685
30017
|
* import { closePoll } from '@amityco/ts-sdk'
|
|
@@ -29707,8 +30039,12 @@ const closePoll = async (pollId) => {
|
|
|
29707
30039
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29708
30040
|
cachedAt,
|
|
29709
30041
|
};
|
|
29710
|
-
};
|
|
30042
|
+
};
|
|
30043
|
+
/* end_public_function */
|
|
29711
30044
|
|
|
30045
|
+
/* begin_public_function
|
|
30046
|
+
id: poll.delete
|
|
30047
|
+
*/
|
|
29712
30048
|
/**
|
|
29713
30049
|
* ```js
|
|
29714
30050
|
* import { deletePoll } from '@amityco/ts-sdk'
|
|
@@ -29734,8 +30070,12 @@ const deletePoll = async (pollId) => {
|
|
|
29734
30070
|
upsertInCache(['poll', 'get', pollId], deleted);
|
|
29735
30071
|
fireEvent('poll.deleted', { polls: [deleted], users: [] });
|
|
29736
30072
|
return success;
|
|
29737
|
-
};
|
|
30073
|
+
};
|
|
30074
|
+
/* end_public_function */
|
|
29738
30075
|
|
|
30076
|
+
/* begin_public_function
|
|
30077
|
+
id: poll.vote
|
|
30078
|
+
*/
|
|
29739
30079
|
/**
|
|
29740
30080
|
* ```js
|
|
29741
30081
|
* import { votePoll } from '@amityco/ts-sdk'
|
|
@@ -29764,7 +30104,8 @@ const votePoll = async (pollId, answerIds) => {
|
|
|
29764
30104
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29765
30105
|
cachedAt,
|
|
29766
30106
|
};
|
|
29767
|
-
};
|
|
30107
|
+
};
|
|
30108
|
+
/* end_public_function */
|
|
29768
30109
|
|
|
29769
30110
|
/**
|
|
29770
30111
|
* ```js
|
|
@@ -29860,6 +30201,9 @@ const observePoll = (pollId, callback, policy = 'cache_then_server') => {
|
|
|
29860
30201
|
};
|
|
29861
30202
|
};
|
|
29862
30203
|
|
|
30204
|
+
/* begin_public_function
|
|
30205
|
+
id: stream.get
|
|
30206
|
+
*/
|
|
29863
30207
|
/**
|
|
29864
30208
|
* ```js
|
|
29865
30209
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29887,6 +30231,7 @@ const getStream = async (streamId) => {
|
|
|
29887
30231
|
cachedAt,
|
|
29888
30232
|
};
|
|
29889
30233
|
};
|
|
30234
|
+
/* end_public_function */
|
|
29890
30235
|
/**
|
|
29891
30236
|
* ```js
|
|
29892
30237
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29914,6 +30259,9 @@ getStream.locally = (streamId) => {
|
|
|
29914
30259
|
};
|
|
29915
30260
|
};
|
|
29916
30261
|
|
|
30262
|
+
/* begin_public_function
|
|
30263
|
+
id: stream.query
|
|
30264
|
+
*/
|
|
29917
30265
|
/**
|
|
29918
30266
|
* ```js
|
|
29919
30267
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29948,6 +30296,7 @@ const queryStreams = async (query) => {
|
|
|
29948
30296
|
const prevPage = toPage(paging.previous);
|
|
29949
30297
|
return { data: videoStreamings, cachedAt, prevPage, nextPage };
|
|
29950
30298
|
};
|
|
30299
|
+
/* end_public_function */
|
|
29951
30300
|
/**
|
|
29952
30301
|
* ```js
|
|
29953
30302
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29967,6 +30316,9 @@ queryStreams.locally = (query) => {
|
|
|
29967
30316
|
// TODO
|
|
29968
30317
|
};
|
|
29969
30318
|
|
|
30319
|
+
/* begin_public_function
|
|
30320
|
+
id: stream.create
|
|
30321
|
+
*/
|
|
29970
30322
|
/**
|
|
29971
30323
|
* ```js
|
|
29972
30324
|
* import { createStream } from '@amityco/ts-sdk'
|
|
@@ -29993,8 +30345,12 @@ const createStream = async (bundle) => {
|
|
|
29993
30345
|
data: videoStreamings[0],
|
|
29994
30346
|
cachedAt,
|
|
29995
30347
|
};
|
|
29996
|
-
};
|
|
30348
|
+
};
|
|
30349
|
+
/* end_public_function */
|
|
29997
30350
|
|
|
30351
|
+
/* begin_public_function
|
|
30352
|
+
id: stream.update
|
|
30353
|
+
*/
|
|
29998
30354
|
/**
|
|
29999
30355
|
* ```js
|
|
30000
30356
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
@@ -30025,6 +30381,9 @@ const updateStream = async (streamId, patch) => {
|
|
|
30025
30381
|
};
|
|
30026
30382
|
|
|
30027
30383
|
// import { unwrapPayload } from '~/core/transports'
|
|
30384
|
+
/* begin_public_function
|
|
30385
|
+
id: stream.delete
|
|
30386
|
+
*/
|
|
30028
30387
|
/**
|
|
30029
30388
|
* ```js
|
|
30030
30389
|
* import { deleteStream } from '@amityco/ts-sdk'
|