@amityco/ts-sdk-react-native 6.30.4-48268a5.0 → 6.30.4
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/.env +26 -26
- package/dist/@types/core/events.d.ts +2 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +2 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +8 -0
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +2 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/index.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/index.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts +13 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +16 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts +5 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities.d.ts +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts +13 -0
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +16 -0
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getTrendingCommunities/enums.d.ts +5 -0
- package/dist/communityRepository/observers/getTrendingCommunities/enums.d.ts.map +1 -0
- package/dist/communityRepository/observers/getTrendingCommunities.d.ts +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/index.cjs.js +335 -222
- package/dist/index.esm.js +335 -222
- package/dist/index.umd.js +3 -3
- package/dist/report/api/isReportedByMe.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +2 -0
- package/src/@types/core/payload.ts +3 -0
- package/src/@types/domains/community.ts +6 -0
- package/src/client/api/index.ts +3 -0
- package/src/communityRepository/api/joinCommunity.ts +1 -1
- package/src/communityRepository/api/leaveCommunity.ts +1 -1
- package/src/communityRepository/communityMembership/events/index.ts +2 -0
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +5 -0
- package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +5 -0
- package/src/communityRepository/communityMembership/events/utils.ts +0 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.ts +4 -0
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersLiveCollectionController.ts +4 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +7 -2
- package/src/communityRepository/observers/getCommunity.ts +4 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +109 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.ts +31 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +88 -0
- package/src/communityRepository/observers/getRecommendedCommunities/enums.ts +4 -0
- package/src/communityRepository/observers/getRecommendedCommunities.ts +9 -81
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +109 -0
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.ts +28 -0
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +86 -0
- package/src/communityRepository/observers/getTrendingCommunities/enums.ts +4 -0
- package/src/communityRepository/observers/getTrendingCommunities.ts +10 -82
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.ts +7 -2
- package/src/communityRepository/utils/communityWithMembership.ts +7 -4
- package/src/report/api/createReport.ts +2 -2
- package/src/report/api/deleteReport.ts +2 -2
- package/src/report/api/isReportedByMe.ts +5 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
2
|
+
import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
3
|
+
import { inferIsDeleted } from '~/utils/inferIsDeleted';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TODO: handle cache receive cache option, and cache policy
|
|
7
|
+
* TODO: check if querybyIds is supported
|
|
8
|
+
*/
|
|
9
|
+
export class TrendingCommunitiesPaginationController extends PaginationController<
|
|
10
|
+
'community',
|
|
11
|
+
Amity.TrendingCommunityLiveCollection
|
|
12
|
+
> {
|
|
13
|
+
async getRequest(queryParams: Amity.TrendingCommunityLiveCollection, token: string | undefined) {
|
|
14
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, ...params } = queryParams;
|
|
15
|
+
const options = token ? { token } : { limit };
|
|
16
|
+
|
|
17
|
+
const { data: queryResponse } = await this.http.get<Amity.CommunityPayload & Amity.Pagination>(
|
|
18
|
+
`/api/v3/communities/top-trending`,
|
|
19
|
+
{
|
|
20
|
+
params: {
|
|
21
|
+
...params,
|
|
22
|
+
options,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
return queryResponse;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
|
|
2
|
+
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
3
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
+
import { getResolver } from '~/core/model';
|
|
5
|
+
import { getActiveClient } from '~/client';
|
|
6
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
7
|
+
import { EnumCommunityActions } from './enums';
|
|
8
|
+
import { EnumCommunityMemberActions } from '~/communityRepository/communityMembership/observers/getMembers/enums';
|
|
9
|
+
|
|
10
|
+
export class TrendingCommunitiesQueryStreamController extends QueryStreamController<
|
|
11
|
+
Amity.TrendingCommunityPayload,
|
|
12
|
+
Amity.TrendingCommunityLiveCollection
|
|
13
|
+
> {
|
|
14
|
+
private notifyChange: (params: Amity.LiveCollectionNotifyParams) => void;
|
|
15
|
+
|
|
16
|
+
private preparePayload: (
|
|
17
|
+
response: Amity.TrendingCommunityPayload,
|
|
18
|
+
) => Amity.ProcessedCommunityPayload;
|
|
19
|
+
|
|
20
|
+
constructor(
|
|
21
|
+
query: Amity.TrendingCommunityLiveCollection,
|
|
22
|
+
cacheKey: string[],
|
|
23
|
+
notifyChange: (params: Amity.LiveCollectionNotifyParams) => void,
|
|
24
|
+
preparePayload: (response: Amity.TrendingCommunityPayload) => Amity.ProcessedCommunityPayload,
|
|
25
|
+
) {
|
|
26
|
+
super(query, cacheKey);
|
|
27
|
+
this.notifyChange = notifyChange;
|
|
28
|
+
this.preparePayload = preparePayload;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async saveToMainDB(response: Amity.TrendingCommunityPayload) {
|
|
32
|
+
const processedPayload = await this.preparePayload(response);
|
|
33
|
+
|
|
34
|
+
const client = getActiveClient();
|
|
35
|
+
const cachedAt = client.cache && Date.now();
|
|
36
|
+
|
|
37
|
+
if (client.cache) {
|
|
38
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
39
|
+
saveCommunityUsers(response.communities, response.communityUsers);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
appendToQueryStream(
|
|
44
|
+
response: Amity.TrendingCommunityPayload & Partial<Amity.Pagination>,
|
|
45
|
+
direction: Amity.LiveCollectionPageDirection,
|
|
46
|
+
refresh = false,
|
|
47
|
+
) {
|
|
48
|
+
if (refresh) {
|
|
49
|
+
pushToCache(this.cacheKey, {
|
|
50
|
+
data: response.communities.map(getResolver('community')),
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
const collection = pullFromCache<Amity.TrendingCommunityLiveCollectionCache>(
|
|
54
|
+
this.cacheKey,
|
|
55
|
+
)?.data;
|
|
56
|
+
|
|
57
|
+
const communities = collection?.data ?? [];
|
|
58
|
+
|
|
59
|
+
pushToCache(this.cacheKey, {
|
|
60
|
+
...collection,
|
|
61
|
+
data: [...new Set([...communities, ...response.communities.map(getResolver('community'))])],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
reactor(action: EnumCommunityActions | EnumCommunityMemberActions) {
|
|
67
|
+
return (community: Amity.Community) => {
|
|
68
|
+
const collection = pullFromCache<Amity.TrendingCommunityLiveCollectionCache>(
|
|
69
|
+
this.cacheKey,
|
|
70
|
+
)?.data;
|
|
71
|
+
if (!collection) return;
|
|
72
|
+
|
|
73
|
+
pushToCache(this.cacheKey, collection);
|
|
74
|
+
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
subscribeRTE(
|
|
79
|
+
createSubscriber: {
|
|
80
|
+
fn: (reactor: (channel: Amity.Community) => void) => Amity.Unsubscriber;
|
|
81
|
+
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
82
|
+
}[],
|
|
83
|
+
) {
|
|
84
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { getResolver } from '~/core/model';
|
|
3
|
-
import { dropFromCache, pullFromCache, pushToCache } from '~/cache/api';
|
|
1
|
+
import { dropFromCache } from '~/cache/api';
|
|
4
2
|
import { getActiveClient } from '~/client/api';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
COLLECTION_DEFAULT_CACHING_POLICY,
|
|
8
|
-
COLLECTION_DEFAULT_PAGINATION_LIMIT,
|
|
9
|
-
ENABLE_CACHE_MESSAGE,
|
|
10
|
-
} from '~/utils/constants';
|
|
3
|
+
import { ENABLE_CACHE_MESSAGE } from '~/utils/constants';
|
|
11
4
|
|
|
12
|
-
import { onCommunityUserChanged } from '../communityMembership/events';
|
|
13
5
|
import { getTrendingCommunities as _getTrendingCommunities } from '../api/getTrendingCommunities';
|
|
14
|
-
import {
|
|
15
|
-
import { communityQueryFilter } from '../utils/communityQueryFilter';
|
|
6
|
+
import { TrendingCommunityLiveCollectionController } from './getTrendingCommunities/TrendingCommunitiesLiveCollectionController';
|
|
16
7
|
|
|
17
8
|
/* begin_public_function
|
|
18
9
|
id: community.query.trending_communities
|
|
@@ -36,7 +27,7 @@ import { communityQueryFilter } from '../utils/communityQueryFilter';
|
|
|
36
27
|
* @category Community Live Collection
|
|
37
28
|
*/
|
|
38
29
|
export const getTrendingCommunities = (
|
|
39
|
-
params: Amity.
|
|
30
|
+
params: Amity.TrendingCommunityLiveCollection,
|
|
40
31
|
callback: Amity.LiveCollectionCallback<Amity.Community>,
|
|
41
32
|
config?: Amity.LiveCollectionConfig,
|
|
42
33
|
) => {
|
|
@@ -49,77 +40,14 @@ export const getTrendingCommunities = (
|
|
|
49
40
|
const timestamp = Date.now();
|
|
50
41
|
log(`getTrendingCommunities(tmpid: ${timestamp}) > listen`);
|
|
51
42
|
|
|
52
|
-
const
|
|
43
|
+
const trendingCommunitiesLiveCollection = new TrendingCommunityLiveCollectionController(
|
|
44
|
+
params,
|
|
45
|
+
callback,
|
|
46
|
+
);
|
|
47
|
+
const disposers = trendingCommunitiesLiveCollection.startSubscription();
|
|
53
48
|
|
|
54
|
-
const
|
|
55
|
-
const { policy = COLLECTION_DEFAULT_CACHING_POLICY } = config ?? {};
|
|
49
|
+
const cacheKey = trendingCommunitiesLiveCollection.getCacheKey();
|
|
56
50
|
|
|
57
|
-
const disposers: Amity.Unsubscriber[] = [];
|
|
58
|
-
const cacheKey = ['community', 'top-trending', { params: { options: { limit } } }];
|
|
59
|
-
|
|
60
|
-
const responder = (data: Amity.CommunityLiveCollectionCache, isEventModel = false) => {
|
|
61
|
-
const communities: Amity.Community[] =
|
|
62
|
-
data.data
|
|
63
|
-
.map(communityId => pullFromCache<Amity.Community>(['community', 'get', communityId])!)
|
|
64
|
-
.filter(Boolean)
|
|
65
|
-
.map(({ data }) => data) ?? [];
|
|
66
|
-
|
|
67
|
-
callback({
|
|
68
|
-
onNextPage: onFetch,
|
|
69
|
-
data: isEventModel ? communityQueryFilter(communities, params, userId!) : communities,
|
|
70
|
-
hasNextPage: !!data.params?.page,
|
|
71
|
-
loading: data.loading,
|
|
72
|
-
error: data.error,
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const realtimeRouter = (_: Amity.CommunityActionType) => (community: Amity.Community) => {
|
|
77
|
-
const collection = pullFromCache<Amity.CommunityLiveCollectionCache>(cacheKey)?.data;
|
|
78
|
-
if (!collection) return;
|
|
79
|
-
|
|
80
|
-
/*
|
|
81
|
-
* Simply update collection and let responder decide what to do with data
|
|
82
|
-
*/
|
|
83
|
-
collection.data = [...new Set([community.communityId, ...collection.data])];
|
|
84
|
-
|
|
85
|
-
pushToCache(cacheKey, collection);
|
|
86
|
-
responder(collection);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const onFetch = (initial = false) => {
|
|
90
|
-
const collection = pullFromCache<Amity.CommunityLiveCollectionCache>(cacheKey)?.data;
|
|
91
|
-
|
|
92
|
-
const communities = collection?.data ?? [];
|
|
93
|
-
|
|
94
|
-
if (!initial && communities.length > 0 && !collection?.params.page) return;
|
|
95
|
-
|
|
96
|
-
const query = createQuery(_getTrendingCommunities, params);
|
|
97
|
-
|
|
98
|
-
runQuery(
|
|
99
|
-
query,
|
|
100
|
-
({ data: result, error, loading }) => {
|
|
101
|
-
const data = {
|
|
102
|
-
loading,
|
|
103
|
-
error,
|
|
104
|
-
params,
|
|
105
|
-
data: communities,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
if (result) {
|
|
109
|
-
data.data = [...new Set([...communities, ...result.map(getResolver('community'))])];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
pushToCache(cacheKey, data);
|
|
113
|
-
|
|
114
|
-
responder(data);
|
|
115
|
-
},
|
|
116
|
-
queryOptions(policy, CACHE_SHORTEN_LIFESPAN),
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
disposers.push(onCommunityUserChanged(realtimeRouter('onMemberCountChanged')));
|
|
121
|
-
|
|
122
|
-
onFetch(true);
|
|
123
51
|
disposers.push(() => dropFromCache(cacheKey));
|
|
124
52
|
|
|
125
53
|
return () => {
|
|
@@ -11,9 +11,12 @@ import { EnumCommunityActions } from './enums';
|
|
|
11
11
|
import { EnumCommunityMemberActions } from '~/communityRepository/communityMembership/observers/getMembers/enums';
|
|
12
12
|
import {
|
|
13
13
|
onCommunityJoined,
|
|
14
|
+
onLocalCommunityJoined,
|
|
14
15
|
onCommunityLeft,
|
|
16
|
+
onLocalCommunityLeft,
|
|
15
17
|
onCommunityUserChanged,
|
|
16
18
|
} from '~/communityRepository/communityMembership';
|
|
19
|
+
import { isNonNullable } from '~/utils';
|
|
17
20
|
|
|
18
21
|
export class SearchCommunityLiveCollectionController extends LiveCollectionController<
|
|
19
22
|
'community',
|
|
@@ -76,6 +79,8 @@ export class SearchCommunityLiveCollectionController extends LiveCollectionContr
|
|
|
76
79
|
{ fn: onCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
77
80
|
{ fn: onCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
78
81
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
82
|
+
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
83
|
+
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
79
84
|
]);
|
|
80
85
|
}
|
|
81
86
|
|
|
@@ -85,8 +90,8 @@ export class SearchCommunityLiveCollectionController extends LiveCollectionContr
|
|
|
85
90
|
|
|
86
91
|
const data = this.applyFilter(
|
|
87
92
|
collection.data
|
|
88
|
-
.map(id => pullFromCache<Amity.Community>(['community', 'get', id])
|
|
89
|
-
.filter(
|
|
93
|
+
.map(id => pullFromCache<Amity.Community>(['community', 'get', id]))
|
|
94
|
+
.filter(isNonNullable)
|
|
90
95
|
.map(({ data }) => data) ?? [],
|
|
91
96
|
);
|
|
92
97
|
|
|
@@ -29,10 +29,13 @@ export function updateMembershipStatus(
|
|
|
29
29
|
communityUsers: Amity.Membership<'community'>[],
|
|
30
30
|
): Amity.Community[] {
|
|
31
31
|
return communities.map(c => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (c.isJoined == null) {
|
|
33
|
+
const isJoined = communityUsers.some(
|
|
34
|
+
m => isCurrentUserPartOfCommunity(c, m) && isMember(m.communityMembership),
|
|
35
|
+
);
|
|
36
|
+
return { ...c, isJoined };
|
|
37
|
+
}
|
|
35
38
|
|
|
36
|
-
return
|
|
39
|
+
return c;
|
|
37
40
|
});
|
|
38
41
|
}
|
|
@@ -36,7 +36,7 @@ const createPostReport = async ({
|
|
|
36
36
|
referenceId: string;
|
|
37
37
|
}) => {
|
|
38
38
|
const { data: payload } = await client.http.post<Amity.PostPayload>(
|
|
39
|
-
`/api/v3/
|
|
39
|
+
`/api/v3/posts/${encodeURIComponent(referenceId)}/flag`,
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
if (client.cache) {
|
|
@@ -78,7 +78,7 @@ const createCommentReport = async ({
|
|
|
78
78
|
referenceId: string;
|
|
79
79
|
}) => {
|
|
80
80
|
const { data: payload } = await client.http.post<Amity.CommentPayload>(
|
|
81
|
-
`/api/v3/
|
|
81
|
+
`/api/v3/comments/${encodeURIComponent(referenceId)}/flag`,
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
if (client.cache) {
|
|
@@ -37,7 +37,7 @@ const deletePostReport = async ({
|
|
|
37
37
|
referenceId: string;
|
|
38
38
|
}) => {
|
|
39
39
|
const { data: payload } = await client.http.delete<Amity.PostPayload>(
|
|
40
|
-
`/api/v3/
|
|
40
|
+
`/api/v3/posts/${encodeURIComponent(referenceId)}/unflag`,
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
if (client.cache) {
|
|
@@ -79,7 +79,7 @@ const deleteCommentReport = async ({
|
|
|
79
79
|
referenceId: string;
|
|
80
80
|
}) => {
|
|
81
81
|
const { data: payload } = await client.http.delete<Amity.CommentPayload>(
|
|
82
|
-
`/api/v3/
|
|
82
|
+
`/api/v3/comments/${encodeURIComponent(referenceId)}/unflag`,
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
if (client.cache) {
|
|
@@ -25,7 +25,7 @@ const getPostReport = async ({
|
|
|
25
25
|
client: Amity.Client;
|
|
26
26
|
referenceId: string;
|
|
27
27
|
}) => {
|
|
28
|
-
const { data } = await client.http.get<ResponseData>(`/api/v3/
|
|
28
|
+
const { data } = await client.http.get<ResponseData>(`/api/v3/posts/${referenceId}/isflagbyme`);
|
|
29
29
|
|
|
30
30
|
const { result, isFlagByMe } = data ?? {};
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ const getUserReport = async ({
|
|
|
39
39
|
client: Amity.Client;
|
|
40
40
|
referenceId: string;
|
|
41
41
|
}) => {
|
|
42
|
-
const { data } = await client.http.get<ResponseData>(`/api/v3/
|
|
42
|
+
const { data } = await client.http.get<ResponseData>(`/api/v3/users/${referenceId}/isflagbyme`);
|
|
43
43
|
|
|
44
44
|
const { result, isFlagByMe } = data ?? {};
|
|
45
45
|
|
|
@@ -53,7 +53,9 @@ const getCommentReport = async ({
|
|
|
53
53
|
client: Amity.Client;
|
|
54
54
|
referenceId: string;
|
|
55
55
|
}) => {
|
|
56
|
-
const { data } = await client.http.get<ResponseData>(
|
|
56
|
+
const { data } = await client.http.get<ResponseData>(
|
|
57
|
+
`/api/v3/comments/${referenceId}/isflagbyme`,
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
const { result, isFlagByMe } = data ?? {};
|
|
59
61
|
|