diff --git a/packages/pds/src/app-view/api/app/bsky/graph/getListBlocks.ts b/packages/pds/src/app-view/api/app/bsky/graph/getListBlocks.ts new file mode 100644 index 00000000000..98c55e14bc9 --- /dev/null +++ b/packages/pds/src/app-view/api/app/bsky/graph/getListBlocks.ts @@ -0,0 +1,19 @@ +import { Server } from '../../../../../lexicon' +import AppContext from '../../../../../context' + +export default function (server: Server, ctx: AppContext) { + server.app.bsky.graph.getListBlocks({ + auth: ctx.accessVerifier, + handler: async ({ auth, params }) => { + const requester = auth.credentials.did + const res = await ctx.appviewAgent.api.app.bsky.graph.getListBlocks( + params, + await ctx.serviceAuthHeaders(requester), + ) + return { + encoding: 'application/json', + body: res.data, + } + }, + }) +} diff --git a/packages/pds/src/app-view/api/app/bsky/index.ts b/packages/pds/src/app-view/api/app/bsky/index.ts index fc8c6baeace..7f9c458ae70 100644 --- a/packages/pds/src/app-view/api/app/bsky/index.ts +++ b/packages/pds/src/app-view/api/app/bsky/index.ts @@ -19,6 +19,7 @@ import getBlocks from './graph/getBlocks' import getFollowers from './graph/getFollowers' import getFollows from './graph/getFollows' import getList from './graph/getList' +import getListBlocks from './graph/getListBlocks' import getListMutes from './graph/getListMutes' import getLists from './graph/getLists' import getMutes from './graph/getMutes' @@ -55,6 +56,7 @@ export default function (server: Server, ctx: AppContext) { getFollowers(server, ctx) getFollows(server, ctx) getList(server, ctx) + getListBlocks(server, ctx) getListMutes(server, ctx) getLists(server, ctx) getMutes(server, ctx) diff --git a/packages/pds/tests/proxied/__snapshots__/views.test.ts.snap b/packages/pds/tests/proxied/__snapshots__/views.test.ts.snap index f1276469126..1e7b75c9cc8 100644 --- a/packages/pds/tests/proxied/__snapshots__/views.test.ts.snap +++ b/packages/pds/tests/proxied/__snapshots__/views.test.ts.snap @@ -2485,6 +2485,56 @@ Object { } `; +exports[`proxies view requests graph.getListBlocks 1`] = ` +Object { + "cursor": "0000000000000::bafycid", + "lists": Array [ + Object { + "cid": "cids(0)", + "creator": Object { + "avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg", + "description": "hi im bob label_me", + "did": "user(0)", + "displayName": "bobby", + "handle": "bob.test", + "indexedAt": "1970-01-01T00:00:00.000Z", + "labels": Array [ + Object { + "cid": "cids(2)", + "cts": "1970-01-01T00:00:00.000Z", + "neg": false, + "src": "user(0)", + "uri": "record(2)", + "val": "self-label-a", + }, + Object { + "cid": "cids(2)", + "cts": "1970-01-01T00:00:00.000Z", + "neg": false, + "src": "user(0)", + "uri": "record(2)", + "val": "self-label-b", + }, + ], + "viewer": Object { + "blockedBy": false, + "muted": false, + }, + }, + "description": "bob's list of mutes", + "indexedAt": "1970-01-01T00:00:00.000Z", + "name": "bob mutes", + "purpose": "app.bsky.graph.defs#modlist", + "uri": "record(0)", + "viewer": Object { + "blocked": "record(1)", + "muted": false, + }, + }, + ], +} +`; + exports[`proxies view requests graph.getLists 1`] = ` Object { "cursor": "0000000000000::bafycid", diff --git a/packages/pds/tests/proxied/views.test.ts b/packages/pds/tests/proxied/views.test.ts index 066cc780059..84079af1c44 100644 --- a/packages/pds/tests/proxied/views.test.ts +++ b/packages/pds/tests/proxied/views.test.ts @@ -524,4 +524,27 @@ describe('proxies view requests', () => { ) expect([...pt1.data.lists, ...pt2.data.lists]).toEqual(res.data.lists) }) + + it('graph.getListBlocks', async () => { + await agent.api.app.bsky.graph.listblock.create( + { repo: bob }, + { + subject: listUri, + createdAt: new Date().toISOString(), + }, + sc.getHeaders(bob), + ) + await network.processAll() + const pt1 = await agent.api.app.bsky.graph.getListBlocks( + {}, + { headers: sc.getHeaders(bob) }, + ) + expect(forSnapshot(pt1.data)).toMatchSnapshot() + const pt2 = await agent.api.app.bsky.graph.getListBlocks( + { cursor: pt1.data.cursor }, + { headers: sc.getHeaders(bob) }, + ) + expect(pt2.data.lists).toEqual([]) + expect(pt2.data.cursor).not.toBeDefined() + }) })