[READ-ONLY] Mirror of https://github.com/flo-bit/skywatched-backend. backend/jetstream consumer for skywatched.app skywatched.app
0

Configure Feed

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

skywatched-backend / src / atp.ts
836 B 32 lines
1import { AtpBaseClient } from "@atproto/api"; 2 3export async function getProfile({ did, agent }: { did: string, agent?: AtpBaseClient }) { 4 if (!agent) { 5 agent = new AtpBaseClient({ service: 'https://api.bsky.app' }); 6 } 7 8 const { data } = await agent.app.bsky.actor.getProfile({ actor: did }); 9 return data; 10} 11 12export async function getAllRated({ did, agent }: { did: string, agent?: AtpBaseClient }) { 13 if (!agent) { 14 agent = new AtpBaseClient({ service: 'https://bsky.social' }); 15 } 16 17 let cursor: string | undefined = undefined; 18 let items: any[] = []; 19 do { 20 const item = await agent.com.atproto.repo.listRecords({ 21 repo: did, 22 collection: "my.skylights.rel", 23 limit: 100, 24 cursor 25 }); 26 items = items.concat(item.data.records); 27 cursor = item.data.cursor; 28 } while (cursor && items.length < 10000); 29 30 return items; 31} 32