@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
|
@@ -9,6 +9,9 @@ import { scheduleTask } from '~/core/microtasks';
|
|
|
9
9
|
|
|
10
10
|
import { getComment } from './getComment';
|
|
11
11
|
|
|
12
|
+
/* begin_public_function
|
|
13
|
+
id: comment.soft_delete, comment.hard_delete
|
|
14
|
+
*/
|
|
12
15
|
/**
|
|
13
16
|
* ```js
|
|
14
17
|
* import { deleteComment } from '@amityco/ts-sdk'
|
|
@@ -75,3 +78,4 @@ export const deleteComment = async (
|
|
|
75
78
|
|
|
76
79
|
return deleted;
|
|
77
80
|
};
|
|
81
|
+
/* end_public_function */
|
|
@@ -6,6 +6,9 @@ import { isInTombstone } from '~/cache/api/isInTombstone';
|
|
|
6
6
|
import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
7
7
|
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
8
8
|
|
|
9
|
+
/* begin_public_function
|
|
10
|
+
id: comment.get
|
|
11
|
+
*/
|
|
9
12
|
/**
|
|
10
13
|
* ```js
|
|
11
14
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -54,6 +57,7 @@ export const getComment = async (
|
|
|
54
57
|
cachedAt,
|
|
55
58
|
};
|
|
56
59
|
};
|
|
60
|
+
/* end_public_function */
|
|
57
61
|
|
|
58
62
|
/**
|
|
59
63
|
* ```js
|
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { pullFromCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: comment.get_by_ids
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -38,6 +41,7 @@ export const getComments = async (
|
|
|
38
41
|
cachedAt,
|
|
39
42
|
};
|
|
40
43
|
};
|
|
44
|
+
/* end_public_function */
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
47
|
* ```js
|
|
@@ -5,6 +5,9 @@ import { pullFromCache, pushToCache } from '~/cache/api';
|
|
|
5
5
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
6
6
|
import { getResolver } from '~/core/model';
|
|
7
7
|
|
|
8
|
+
/* begin_public_function
|
|
9
|
+
id: comment.query
|
|
10
|
+
*/
|
|
8
11
|
/**
|
|
9
12
|
* ```js
|
|
10
13
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -70,6 +73,7 @@ export const queryComments = async (
|
|
|
70
73
|
|
|
71
74
|
return { data: comments, cachedAt, prevPage, nextPage };
|
|
72
75
|
};
|
|
76
|
+
/* end_public_function */
|
|
73
77
|
|
|
74
78
|
/**
|
|
75
79
|
* ```js
|
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: comment.update_comment
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { updateComment } from '@amityco/ts-sdk'
|
|
@@ -43,3 +46,4 @@ export const updateComment = async (
|
|
|
43
46
|
cachedAt,
|
|
44
47
|
};
|
|
45
48
|
};
|
|
49
|
+
/* end_public_function */
|
|
@@ -4,6 +4,9 @@ import { fireEvent } from '~/core/events';
|
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
6
6
|
|
|
7
|
+
/* begin_public_function
|
|
8
|
+
id: community.membership.add_members
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* ```js
|
|
9
12
|
* import { addCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -43,3 +46,4 @@ export const addCommunityMembers = async (
|
|
|
43
46
|
communityUser.communityId === communityId && communityUser.communityMembership === 'member',
|
|
44
47
|
);
|
|
45
48
|
};
|
|
49
|
+
/* end_public_function */
|
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: community.moderation.add_roles
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { addCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -43,3 +46,4 @@ export const addCommunityMembersRoles = async (
|
|
|
43
46
|
roleIds.some(role => communityUser.roles.includes(role)),
|
|
44
47
|
);
|
|
45
48
|
};
|
|
49
|
+
/* end_public_function */
|
|
@@ -5,6 +5,9 @@ import { fireEvent } from '~/core/events';
|
|
|
5
5
|
|
|
6
6
|
import { prepareCommunityRequest, prepareCommunityPayload } from '../utils';
|
|
7
7
|
|
|
8
|
+
/* begin_public_function
|
|
9
|
+
id: community.create
|
|
10
|
+
*/
|
|
8
11
|
/**
|
|
9
12
|
* ```js
|
|
10
13
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
@@ -57,3 +60,4 @@ export const createCommunity = async (
|
|
|
57
60
|
cachedAt,
|
|
58
61
|
};
|
|
59
62
|
};
|
|
63
|
+
/* end_public_function */
|
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { fireEvent } from '~/core/events';
|
|
4
4
|
import { getCommunity } from './getCommunity';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: community.delete
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { deleteCommunity } from '@amityco/ts-sdk'
|
|
@@ -39,3 +42,4 @@ export const deleteCommunity = async (
|
|
|
39
42
|
|
|
40
43
|
return deleted.data;
|
|
41
44
|
};
|
|
45
|
+
/* end_public_function */
|
|
@@ -5,6 +5,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
5
5
|
|
|
6
6
|
import { prepareCommunityPayload } from '../utils';
|
|
7
7
|
|
|
8
|
+
/* begin_public_function
|
|
9
|
+
id: community.get
|
|
10
|
+
*/
|
|
8
11
|
/**
|
|
9
12
|
* ```js
|
|
10
13
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -42,6 +45,7 @@ export const getCommunity = async (
|
|
|
42
45
|
cachedAt,
|
|
43
46
|
};
|
|
44
47
|
};
|
|
48
|
+
/* end_public_function */
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* ```js
|
|
@@ -6,6 +6,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
6
6
|
|
|
7
7
|
import { prepareCommunityPayload } from '../utils';
|
|
8
8
|
|
|
9
|
+
/* begin_public_function
|
|
10
|
+
id: community.query.recommended_communities
|
|
11
|
+
*/
|
|
9
12
|
/**
|
|
10
13
|
* ```js
|
|
11
14
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -49,6 +52,7 @@ export const getRecommendedCommunities = async (
|
|
|
49
52
|
|
|
50
53
|
return { data: communities, cachedAt };
|
|
51
54
|
};
|
|
55
|
+
/* end_public_function */
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* ```js
|
|
@@ -6,6 +6,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
6
6
|
|
|
7
7
|
import { prepareCommunityPayload } from '../utils';
|
|
8
8
|
|
|
9
|
+
/* begin_public_function
|
|
10
|
+
id: community.query.trending_communities
|
|
11
|
+
*/
|
|
9
12
|
/**
|
|
10
13
|
* ```js
|
|
11
14
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -49,6 +52,7 @@ export const getTopTrendingCommunities = async (
|
|
|
49
52
|
|
|
50
53
|
return { data: communities, cachedAt };
|
|
51
54
|
};
|
|
55
|
+
/* end_public_function */
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* ```js
|
|
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
import { prepareCommunityPayload } from '~/community/utils';
|
|
5
5
|
import { fireEvent } from '~/core/events';
|
|
6
6
|
|
|
7
|
+
/* begin_public_function
|
|
8
|
+
id: community.join
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* ```js
|
|
9
12
|
* import { joinCommunity } from '@amityco/ts-sdk'
|
|
@@ -42,3 +45,4 @@ export const joinCommunity = async (
|
|
|
42
45
|
communityUser.communityId === communityId && communityUser.communityMembership === 'member',
|
|
43
46
|
);
|
|
44
47
|
};
|
|
48
|
+
/* end_public_function */
|
|
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
import { prepareCommunityPayload } from '~/community/utils';
|
|
5
5
|
import { fireEvent } from '~/core/events';
|
|
6
6
|
|
|
7
|
+
/* begin_public_function
|
|
8
|
+
id: community.leave
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* ```js
|
|
9
12
|
* import { leaveCommunity } from '@amityco/ts-sdk'
|
|
@@ -42,3 +45,4 @@ export const leaveCommunity = async (
|
|
|
42
45
|
communityUser.communityId === communityId && communityUser.communityMembership !== 'member',
|
|
43
46
|
);
|
|
44
47
|
};
|
|
48
|
+
/* end_public_function */
|
|
@@ -7,6 +7,9 @@ import { getResolver } from '~/core/model';
|
|
|
7
7
|
|
|
8
8
|
import { prepareCommunityPayload } from '../utils';
|
|
9
9
|
|
|
10
|
+
/* begin_public_function
|
|
11
|
+
id: community.query
|
|
12
|
+
*/
|
|
10
13
|
/**
|
|
11
14
|
* ```js
|
|
12
15
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -71,6 +74,7 @@ export const queryCommunities = async (
|
|
|
71
74
|
|
|
72
75
|
return { data: communities, cachedAt, prevPage, nextPage };
|
|
73
76
|
};
|
|
77
|
+
/* end_public_function */
|
|
74
78
|
|
|
75
79
|
/**
|
|
76
80
|
* ```js
|
|
@@ -6,6 +6,9 @@ import { toPage, toToken } from '~/core/query';
|
|
|
6
6
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
7
7
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
8
8
|
|
|
9
|
+
/* begin_public_function
|
|
10
|
+
id: community.membership.query
|
|
11
|
+
*/
|
|
9
12
|
/**
|
|
10
13
|
* ```js
|
|
11
14
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -66,6 +69,7 @@ export const queryCommunityMembers = async (
|
|
|
66
69
|
|
|
67
70
|
return { data: communityUsers, cachedAt, nextPage, prevPage };
|
|
68
71
|
};
|
|
72
|
+
/* end_public_function */
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
75
|
* ```js
|
|
@@ -4,6 +4,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
5
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
6
6
|
|
|
7
|
+
/* begin_public_function
|
|
8
|
+
id: community.membership.remove_member
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* ```js
|
|
9
12
|
* import { removeCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -44,3 +47,4 @@ export const removeCommunityMembers = async (
|
|
|
44
47
|
communityUser.communityId === communityId && communityUser.communityMembership !== 'member',
|
|
45
48
|
);
|
|
46
49
|
};
|
|
50
|
+
/* end_public_function */
|
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: community.moderation.remove_roles
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { removeCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -43,3 +46,4 @@ export const removeCommunityMembersRoles = async (
|
|
|
43
46
|
!roleIds.some(role => communityUser.roles.includes(role)),
|
|
44
47
|
);
|
|
45
48
|
};
|
|
49
|
+
/* end_public_function */
|
|
@@ -5,6 +5,9 @@ import { fireEvent } from '~/core/events';
|
|
|
5
5
|
|
|
6
6
|
import { prepareCommunityRequest, prepareCommunityPayload } from '../utils';
|
|
7
7
|
|
|
8
|
+
/* begin_public_function
|
|
9
|
+
id: community.update
|
|
10
|
+
*/
|
|
8
11
|
/**
|
|
9
12
|
* ```js
|
|
10
13
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
@@ -49,3 +52,4 @@ export const updateCommunity = async (
|
|
|
49
52
|
cachedAt,
|
|
50
53
|
};
|
|
51
54
|
};
|
|
55
|
+
/* end_public_function */
|
|
@@ -38,6 +38,11 @@ export const createHttpTransport = (endpoint: string) => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
instance.interceptors.request.use(config => {
|
|
41
|
+
// do not check expiration for token creation url
|
|
42
|
+
if (config.url === '/api/v4/sessions') {
|
|
43
|
+
return config;
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
// check global.ts for the extension of AxiosRequestConfig
|
|
42
47
|
const tokenExpiry = config.metadata?.tokenExpiry;
|
|
43
48
|
|
|
@@ -3,6 +3,7 @@ import nock from 'nock';
|
|
|
3
3
|
import { ASCApiError, ASCUnknownError } from '~/core/errors';
|
|
4
4
|
import { createFileFormData } from '~/utils/tests';
|
|
5
5
|
|
|
6
|
+
import { getPastDate } from '~/core/model';
|
|
6
7
|
import { createHttpTransport } from '../http';
|
|
7
8
|
|
|
8
9
|
const baseUrl = 'https://non-exist.domain';
|
|
@@ -68,5 +69,16 @@ describe('core/transports', () => {
|
|
|
68
69
|
|
|
69
70
|
await expect(instance.post('/foo', formData)).resolves.not.toThrow();
|
|
70
71
|
});
|
|
72
|
+
|
|
73
|
+
test('should not check token expiration for token creation url', async () => {
|
|
74
|
+
const expectedResolveValue = { foo: 'bar' };
|
|
75
|
+
nock(baseUrl).get('/api/v4/sessions').reply(200, expectedResolveValue);
|
|
76
|
+
|
|
77
|
+
const instance = createHttpTransport(baseUrl);
|
|
78
|
+
instance.defaults.metadata = { tokenExpiry: getPastDate() };
|
|
79
|
+
|
|
80
|
+
const expected = expect.objectContaining({ data: expectedResolveValue });
|
|
81
|
+
await expect(instance.get('/api/v4/sessions')).resolves.toEqual(expected);
|
|
82
|
+
});
|
|
71
83
|
});
|
|
72
84
|
});
|
|
@@ -6,6 +6,9 @@ import { pullFromCache, pushToCache } from '~/cache/api';
|
|
|
6
6
|
import { getResolver } from '~/core/model';
|
|
7
7
|
import { prepareMembershipPayload } from '~/group/utils';
|
|
8
8
|
|
|
9
|
+
/* begin_public_function
|
|
10
|
+
id: feed.query.global_feed
|
|
11
|
+
*/
|
|
9
12
|
/**
|
|
10
13
|
* ```js
|
|
11
14
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -66,6 +69,7 @@ export const queryGlobalFeed = async (query?: {
|
|
|
66
69
|
|
|
67
70
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
68
71
|
};
|
|
72
|
+
/* end_public_function */
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
75
|
* ```js
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: file.upload.file
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { createFile } from '@amityco/ts-sdk'
|
|
@@ -50,5 +53,6 @@ export const createFile = async <T extends Amity.FileType = any>(
|
|
|
50
53
|
cachedAt,
|
|
51
54
|
};
|
|
52
55
|
};
|
|
56
|
+
/* end_public_function */
|
|
53
57
|
|
|
54
58
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: file.upload.image
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { createImage } from '@amityco/ts-sdk'
|
|
@@ -54,5 +57,6 @@ export const createImage = async (
|
|
|
54
57
|
cachedAt,
|
|
55
58
|
};
|
|
56
59
|
};
|
|
60
|
+
/* end_public_function */
|
|
57
61
|
|
|
58
62
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: file.upload.video
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { createVideo } from '@amityco/ts-sdk'
|
|
@@ -60,5 +63,6 @@ export const createVideo = async (
|
|
|
60
63
|
cachedAt,
|
|
61
64
|
};
|
|
62
65
|
};
|
|
66
|
+
/* end_public_function */
|
|
63
67
|
|
|
64
68
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { dropFromCache } from '~/cache/api';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: file.delete
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { deleteFile } from '@amityco/ts-sdk'
|
|
@@ -29,3 +32,4 @@ export const deleteFile = async (
|
|
|
29
32
|
|
|
30
33
|
return { success: true };
|
|
31
34
|
};
|
|
35
|
+
/* end_public_function */
|
package/src/file/api/getFile.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { pullFromCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: file.get
|
|
8
|
+
*/
|
|
6
9
|
/**
|
|
7
10
|
* ```js
|
|
8
11
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -36,6 +39,7 @@ export const getFile = async <T extends Amity.FileType = any>(
|
|
|
36
39
|
cachedAt,
|
|
37
40
|
};
|
|
38
41
|
};
|
|
42
|
+
/* end_public_function */
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* ```js
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
3
|
import { fireEvent } from '~/core/events';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: user.relationship.accept_follow
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { acceptFollower } from '@amityco/ts-sdk'
|
|
@@ -32,3 +35,4 @@ export const acceptFollower = async (userId: Amity.User['userId']): Promise<bool
|
|
|
32
35
|
|
|
33
36
|
return true;
|
|
34
37
|
};
|
|
38
|
+
/* end_public_function */
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
3
|
import { fireEvent } from '~/core/events';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: user.relationship.decline_follow
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { declineFollower } from '@amityco/ts-sdk'
|
|
@@ -32,3 +35,4 @@ export const declineFollower = async (userId: Amity.User['userId']): Promise<boo
|
|
|
32
35
|
|
|
33
36
|
return true;
|
|
34
37
|
};
|
|
38
|
+
/* end_public_function */
|
package/src/follow/api/follow.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
3
|
import { fireEvent } from '~/core/events';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: user.relationship.follow
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { follow } from '@amityco/ts-sdk'
|
|
@@ -39,3 +42,4 @@ export const follow = async (
|
|
|
39
42
|
cachedAt,
|
|
40
43
|
};
|
|
41
44
|
};
|
|
45
|
+
/* end_public_function */
|
|
@@ -7,6 +7,9 @@ const getCacheKey = (userId: Amity.User['userId']) => [
|
|
|
7
7
|
`${getActiveClient().userId}#${userId}`,
|
|
8
8
|
];
|
|
9
9
|
|
|
10
|
+
/* begin_public_function
|
|
11
|
+
id: user.relationship.get_follow_info, user.relationship.get_my_follow_info
|
|
12
|
+
*/
|
|
10
13
|
/**
|
|
11
14
|
* ```js
|
|
12
15
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -49,6 +52,7 @@ export const getFollowInfo = async (
|
|
|
49
52
|
cachedAt,
|
|
50
53
|
};
|
|
51
54
|
};
|
|
55
|
+
/* end_public_function */
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* ```js
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { queryFollows } from './utils';
|
|
2
2
|
|
|
3
|
+
/* begin_public_function
|
|
4
|
+
id: user.relationship.query_my_followers, user.relationship.query_followers
|
|
5
|
+
*/
|
|
3
6
|
/**
|
|
4
7
|
* ```js
|
|
5
8
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -18,6 +21,7 @@ export const queryFollowers = async (
|
|
|
18
21
|
query: Amity.QueryFollowers,
|
|
19
22
|
): Promise<Amity.Cached<Amity.Paged<Amity.FollowStatus, Amity.PageRaw>>> =>
|
|
20
23
|
queryFollows('followers', query);
|
|
24
|
+
/* end_public_function */
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* ```js
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { queryFollows } from './utils';
|
|
2
2
|
|
|
3
|
+
/* begin_public_function
|
|
4
|
+
id: user.relationship.query_my_followings, user.relationship.query_followings
|
|
5
|
+
*/
|
|
3
6
|
/**
|
|
4
7
|
* ```js
|
|
5
8
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -18,6 +21,7 @@ export const queryFollowings = async (
|
|
|
18
21
|
query: Amity.QueryFollowings,
|
|
19
22
|
): Promise<Amity.Cached<Amity.Paged<Amity.FollowStatus, Amity.PageRaw>>> =>
|
|
20
23
|
queryFollows('following', query);
|
|
24
|
+
/* end_public_function */
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* ```js
|
|
@@ -2,6 +2,9 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
3
|
import { fireEvent } from '~/core/events';
|
|
4
4
|
|
|
5
|
+
/* begin_public_function
|
|
6
|
+
id: user.relationship.unfollow
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* ```js
|
|
7
10
|
* import { unfollow } from '@amityco/ts-sdk'
|
|
@@ -32,3 +35,4 @@ export const unfollow = async (userId: Amity.User['userId']): Promise<boolean> =
|
|
|
32
35
|
|
|
33
36
|
return true;
|
|
34
37
|
};
|
|
38
|
+
/* end_public_function */
|
|
@@ -7,9 +7,14 @@ import { upsertInCache, pullFromCache, pushToCache, dropFromCache } from '~/cach
|
|
|
7
7
|
|
|
8
8
|
import { convertParams, prepareMessagePayload } from '../utils';
|
|
9
9
|
|
|
10
|
+
const getLocalId = () => `LOCAL_${uuid()}`;
|
|
11
|
+
|
|
10
12
|
// FIXME: temp solution
|
|
11
13
|
let uniqueId: string | undefined;
|
|
12
14
|
|
|
15
|
+
/* begin_public_function
|
|
16
|
+
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
|
|
17
|
+
*/
|
|
13
18
|
/**
|
|
14
19
|
* ```js
|
|
15
20
|
* import { createMessage, createQuery, runQuery } from '@amityco/ts-sdk'
|
|
@@ -44,7 +49,7 @@ export const createMessage = async <T extends Amity.MessageContentType>(
|
|
|
44
49
|
const client = getActiveClient();
|
|
45
50
|
client.log('message/createMessage', bundle);
|
|
46
51
|
|
|
47
|
-
const referenceId = uniqueId;
|
|
52
|
+
const referenceId = uniqueId || getLocalId();
|
|
48
53
|
uniqueId = undefined;
|
|
49
54
|
|
|
50
55
|
const { data: payload } = await client.http.post<Amity.MessagePayload>('/api/v5/messages', {
|
|
@@ -100,9 +105,8 @@ createMessage.optimistically = (
|
|
|
100
105
|
* Updated to handle client requirement to add messageId while uploading
|
|
101
106
|
* message with image. Temporary!
|
|
102
107
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const bundleWithMessageId = { messageId: localId, uniqueId: localId, ...bundle };
|
|
108
|
+
uniqueId = getLocalId();
|
|
109
|
+
const bundleWithMessageId = { messageId: uniqueId, uniqueId, ...bundle };
|
|
106
110
|
|
|
107
111
|
client.log('message/createMessage.optimistically', bundleWithMessageId);
|
|
108
112
|
|
|
@@ -148,3 +152,4 @@ createMessage.optimistically = (
|
|
|
148
152
|
data: message,
|
|
149
153
|
};
|
|
150
154
|
};
|
|
155
|
+
/* end_public_function */
|
|
@@ -4,6 +4,9 @@ import { fireEvent } from '~/core/events';
|
|
|
4
4
|
|
|
5
5
|
import { getMessage } from './getMessage';
|
|
6
6
|
|
|
7
|
+
/* begin_public_function
|
|
8
|
+
id: message.soft_delete
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* ```js
|
|
9
12
|
* import { deleteMessage } from '@amityco/ts-sdk'
|
|
@@ -74,3 +77,4 @@ deleteMessage.optimistically = (
|
|
|
74
77
|
cachedAt,
|
|
75
78
|
};
|
|
76
79
|
};
|
|
80
|
+
/* end_public_function */
|
|
@@ -9,6 +9,9 @@ import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
|
9
9
|
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
10
10
|
import { convertResponseFromRaw } from '../utils';
|
|
11
11
|
|
|
12
|
+
/* begin_public_function
|
|
13
|
+
id: message.get
|
|
14
|
+
*/
|
|
12
15
|
/**
|
|
13
16
|
* ```js
|
|
14
17
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -67,6 +70,7 @@ export const getMessage = async (
|
|
|
67
70
|
cachedAt,
|
|
68
71
|
};
|
|
69
72
|
};
|
|
73
|
+
/* end_public_function */
|
|
70
74
|
|
|
71
75
|
/**
|
|
72
76
|
* ```js
|
|
@@ -7,6 +7,9 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
7
7
|
import { getResolver } from '~/core/model';
|
|
8
8
|
import { convertQueryParams, convertResponseFromRaw } from '../utils';
|
|
9
9
|
|
|
10
|
+
/* begin_public_function
|
|
11
|
+
id: message.query
|
|
12
|
+
*/
|
|
10
13
|
/**
|
|
11
14
|
* ```js
|
|
12
15
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -58,6 +61,7 @@ export const queryMessages = async (
|
|
|
58
61
|
|
|
59
62
|
return { data: messages, cachedAt, prevPage, nextPage };
|
|
60
63
|
};
|
|
64
|
+
/* end_public_function */
|
|
61
65
|
|
|
62
66
|
/**
|
|
63
67
|
* ```js
|