UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

31 lines (26 loc) 1.05 kB
import { PaginationController } from '~/core/liveCollection/PaginationController'; import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants'; /** * TODO: handle cache receive cache option, and cache policy * TODO: check if querybyIds is supported */ export class JoinRequestListPaginationController extends PaginationController< 'joinRequest', Amity.JoinRequestListLiveCollection > { async getRequest(queryParams: Amity.JoinRequestListLiveCollection, token: string | undefined) { const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityIds, ...params } = queryParams; const options = token ? { token } : { limit }; const encodedChannelIds = communityIds.map(communityId => encodeURIComponent(communityId)); const { data: queryResponse } = await this.http.get< Amity.CommunityJoinRequestPayload & Amity.Pagination >(`/api/v4/communities/join/requests`, { params: { ...params, options, communityIds: encodedChannelIds, }, }); return queryResponse; } }