AT Protocol-powered Twitpic revival
atproto
express
typescript
photo-sharing
1import { AtpAgent } from "@atproto/api";
2
3export async function getActor(agent: AtpAgent, did: string) {
4 const response = await agent.com.atproto.repo.getRecord({
5 repo: did,
6 collection: "app.bsky.actor.profile",
7 rkey: "self"
8 });
9 return response.data;
10}
11
12export async function getActorDid(agent: AtpAgent, handle: string) {
13 if (handle.startsWith("did:")) {
14 return handle;
15 }
16
17 const response = await agent.resolveHandle({
18 handle: handle,
19 });
20 return response.data.did;
21}
22
23export async function getActorFeed(agent: AtpAgent, did: string, limit?: number, cursor?: string) {
24 const response = await agent.com.atproto.repo.listRecords({
25 repo: did,
26 collection: "lol.skittr.skitpic.entry",
27 limit: limit,
28 cursor: cursor
29 });
30 return response.data;
31}