This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / webapp / features / feeds / lib / dal.ts
1.6 kB 57 lines
1import { createSembleClient } from '@/services/client.apiClient'; 2import { UrlType, ActivitySource, ActivityType } from '@semble/types'; 3import { cache } from 'react'; 4import { verifySessionOnClient } from '@/lib/auth/dal'; 5 6interface PageParams { 7 page?: number; 8 limit?: number; 9 urlType?: UrlType; 10 source?: ActivitySource; 11 activityTypes?: ActivityType[]; 12 includeKnownBots?: boolean; 13} 14 15export const getGlobalFeed = cache(async (params?: PageParams) => { 16 const client = createSembleClient(); 17 const response = await client.getGlobalFeed({ 18 page: params?.page, 19 limit: params?.limit, 20 urlType: params?.urlType, 21 source: params?.source, 22 activityTypes: params?.activityTypes, 23 includeKnownBots: params?.includeKnownBots, 24 }); 25 26 return response; 27}); 28 29export const getGemsActivityFeed = cache(async (params?: PageParams) => { 30 const client = createSembleClient(); 31 const response = await client.getGemsActivityFeed({ 32 page: params?.page, 33 limit: params?.limit, 34 urlType: params?.urlType, 35 source: params?.source, 36 activityTypes: params?.activityTypes, 37 }); 38 39 return response; 40}); 41 42export const getFollowingFeed = cache(async (params?: PageParams) => { 43 const session = await verifySessionOnClient({ redirectOnFail: true }); 44 if (!session) throw new Error('No session found'); 45 46 const client = createSembleClient(); 47 const response = await client.getFollowingFeed({ 48 page: params?.page, 49 limit: params?.limit, 50 urlType: params?.urlType, 51 source: params?.source, 52 activityTypes: params?.activityTypes, 53 includeKnownBots: params?.includeKnownBots, 54 }); 55 56 return response; 57});