Skip to content

Commit ecdc8cf

Browse files
authored
Merge pull request #4 from fatfingers23/feat/profile-page
likes endpoint
2 parents 3bf1cde + 09c99c1 commit ecdc8cf

11 files changed

Lines changed: 448 additions & 14 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"id": "blue.microcosm.identity.resolveMiniDoc",
3+
"defs": {
4+
"main": {
5+
"type": "query",
6+
"description": "Slingshot: like com.atproto.identity.resolveIdentity but instead of the full didDoc it returns an atproto-relevant subset",
7+
"parameters": {
8+
"type": "params",
9+
"required": ["identifier"],
10+
"properties": {
11+
"identifier": {
12+
"type": "string",
13+
"format": "at-identifier",
14+
"description": "handle or DID to resolve"
15+
}
16+
}
17+
},
18+
"output": {
19+
"encoding": "application/json",
20+
"schema": {
21+
"type": "object",
22+
"required": ["did", "handle", "pds", "signing_key"],
23+
"properties": {
24+
"did": {
25+
"type": "string",
26+
"format": "did",
27+
"description": "DID, bi-directionally verified if a handle was provided in the query"
28+
},
29+
"handle": {
30+
"type": "string",
31+
"format": "handle",
32+
"description": "the validated handle of the account or 'handle.invalid' if the handle did not bi-directionally match the DID document"
33+
},
34+
"pds": {
35+
"type": "string",
36+
"format": "uri",
37+
"description": "the identity's PDS URL"
38+
},
39+
"signing_key": {
40+
"type": "string",
41+
"description": "the atproto signing key publicKeyMultibase"
42+
}
43+
}
44+
}
45+
}
46+
}
47+
},
48+
"$type": "com.atproto.lexicon.schema",
49+
"lexicon": 1
50+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"id": "blue.microcosm.links.getBacklinks",
3+
"defs": {
4+
"main": {
5+
"type": "query",
6+
"description": "Constellation: list records linking to any record, identity, or uri",
7+
"parameters": {
8+
"type": "params",
9+
"required": ["subject", "source"],
10+
"properties": {
11+
"subject": {
12+
"type": "string",
13+
"format": "uri",
14+
"description": "the target being linked to (at-uri, did, or uri)"
15+
},
16+
"source": {
17+
"type": "string",
18+
"description": "collection and path specification (e.g., 'app.bsky.feed.like:subject.uri')"
19+
},
20+
"did": {
21+
"type": "array",
22+
"description": "filter links to those from specific users",
23+
"items": {
24+
"type": "string",
25+
"format": "did"
26+
}
27+
},
28+
"limit": {
29+
"type": "integer",
30+
"minimum": 1,
31+
"maximum": 100,
32+
"default": 16,
33+
"description": "number of results to return"
34+
}
35+
}
36+
},
37+
"output": {
38+
"encoding": "application/json",
39+
"schema": {
40+
"type": "object",
41+
"required": ["total", "records"],
42+
"properties": {
43+
"total": {
44+
"type": "integer",
45+
"description": "total number of matching links"
46+
},
47+
"records": {
48+
"type": "array",
49+
"items": {
50+
"type": "ref",
51+
"ref": "#linkRecord"
52+
}
53+
},
54+
"cursor": {
55+
"type": "string",
56+
"description": "pagination cursor"
57+
}
58+
}
59+
}
60+
}
61+
},
62+
"linkRecord": {
63+
"type": "object",
64+
"description": "a record linking to the subject",
65+
"required": ["did", "collection", "rkey"],
66+
"properties": {
67+
"did": {
68+
"type": "string",
69+
"format": "did",
70+
"description": "the DID of the linking record's repository"
71+
},
72+
"collection": {
73+
"type": "string",
74+
"format": "nsid",
75+
"description": "the collection of the linking record"
76+
},
77+
"rkey": {
78+
"type": "string",
79+
"format": "record-key",
80+
"description": "the record key of the linking record"
81+
}
82+
}
83+
}
84+
},
85+
"$type": "com.atproto.lexicon.schema",
86+
"lexicon": 1
87+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": "blue.microcosm.links.getBacklinksCount",
3+
"defs": {
4+
"main": {
5+
"type": "query",
6+
"description": "Constellation: count records that link to another record",
7+
"parameters": {
8+
"type": "params",
9+
"required": ["subject", "source"],
10+
"properties": {
11+
"subject": {
12+
"type": "string",
13+
"format": "at-uri",
14+
"description": "the target being linked to (at-uri, did, or uri)"
15+
},
16+
"source": {
17+
"type": "string",
18+
"description": "collection and path specification for the primary link"
19+
}
20+
}
21+
},
22+
"output": {
23+
"encoding": "application/json",
24+
"schema": {
25+
"type": "object",
26+
"required": ["total"],
27+
"properties": {
28+
"total": {
29+
"type": "integer",
30+
"description": "total number of matching links"
31+
}
32+
}
33+
}
34+
}
35+
}
36+
},
37+
"$type": "com.atproto.lexicon.schema",
38+
"lexicon": 1
39+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"id": "blue.microcosm.links.getManyToManyCounts",
3+
"defs": {
4+
"main": {
5+
"type": "query",
6+
"description": "Constellation: count many-to-many relationships with secondary link paths",
7+
"parameters": {
8+
"type": "params",
9+
"required": ["subject", "source", "pathToOther"],
10+
"properties": {
11+
"subject": {
12+
"type": "string",
13+
"format": "uri",
14+
"description": "the primary target being linked to (at-uri, did, or uri)"
15+
},
16+
"source": {
17+
"type": "string",
18+
"description": "collection and path specification for the primary link"
19+
},
20+
"pathToOther": {
21+
"type": "string",
22+
"description": "path to the secondary link in the many-to-many record (e.g., 'otherThing.uri')"
23+
},
24+
"did": {
25+
"type": "array",
26+
"description": "filter links to those from specific users",
27+
"items": {
28+
"type": "string",
29+
"format": "did"
30+
}
31+
},
32+
"otherSubject": {
33+
"type": "array",
34+
"description": "filter secondary links to specific subjects",
35+
"items": {
36+
"type": "string"
37+
}
38+
},
39+
"limit": {
40+
"type": "integer",
41+
"minimum": 1,
42+
"maximum": 100,
43+
"default": 16,
44+
"description": "number of results to return"
45+
}
46+
}
47+
},
48+
"output": {
49+
"encoding": "application/json",
50+
"schema": {
51+
"type": "object",
52+
"required": ["counts_by_other_subject"],
53+
"properties": {
54+
"counts_by_other_subject": {
55+
"type": "array",
56+
"items": {
57+
"type": "ref",
58+
"ref": "#countBySubject"
59+
}
60+
},
61+
"cursor": {
62+
"type": "string",
63+
"description": "pagination cursor"
64+
}
65+
}
66+
}
67+
}
68+
},
69+
"countBySubject": {
70+
"type": "object",
71+
"description": "count of links to a secondary subject",
72+
"required": ["subject", "total", "distinct"],
73+
"properties": {
74+
"subject": {
75+
"type": "string",
76+
"description": "the secondary subject being counted"
77+
},
78+
"total": {
79+
"type": "integer",
80+
"description": "total number of links to this subject"
81+
},
82+
"distinct": {
83+
"type": "integer",
84+
"description": "number of distinct DIDs linking to this subject"
85+
}
86+
}
87+
}
88+
},
89+
"$type": "com.atproto.lexicon.schema",
90+
"lexicon": 1
91+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {
2+
document,
3+
object,
4+
params,
5+
query,
6+
required,
7+
string,
8+
unknown,
9+
} from '@atcute/lexicon-doc/builder'
10+
11+
export default document({
12+
id: 'blue.microcosm.repo.getRecordByUri',
13+
defs: {
14+
main: query({
15+
description:
16+
'Slingshot: ergonomic complement to com.atproto.repo.getRecord which accepts an at-uri instead of individual repo/collection/rkey params',
17+
parameters: params({
18+
properties: {
19+
at_uri: required(
20+
string({
21+
format: 'at-uri',
22+
description: 'the at-uri of the record (identifier can be a DID or handle)',
23+
}),
24+
),
25+
cid: string({
26+
format: 'cid',
27+
description:
28+
'optional CID of the version of the record. if not specified, return the most recent version. if specified and a newer version exists, returns 404.',
29+
}),
30+
},
31+
}),
32+
output: {
33+
encoding: 'application/json',
34+
schema: object({
35+
properties: {
36+
uri: required(string({ format: 'at-uri', description: 'at-uri for this record' })),
37+
cid: string({ format: 'cid', description: 'CID for this exact version of the record' }),
38+
value: required(unknown({ description: 'the record itself' })),
39+
},
40+
}),
41+
},
42+
}),
43+
},
44+
})
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"id": "blue.microcosm.repo.getRecordByUri",
3+
"defs": {
4+
"main": {
5+
"type": "query",
6+
"description": "Slingshot: ergonomic complement to com.atproto.repo.getRecord which accepts an at-uri instead of individual repo/collection/rkey params",
7+
"parameters": {
8+
"type": "params",
9+
"required": ["at_uri"],
10+
"properties": {
11+
"at_uri": {
12+
"type": "string",
13+
"format": "at-uri",
14+
"description": "the at-uri of the record (identifier can be a DID or handle)"
15+
},
16+
"cid": {
17+
"type": "string",
18+
"format": "cid",
19+
"description": "optional CID of the version of the record. if not specified, return the most recent version. if specified and a newer version exists, returns 404."
20+
}
21+
}
22+
},
23+
"output": {
24+
"encoding": "application/json",
25+
"schema": {
26+
"type": "object",
27+
"required": ["uri", "value"],
28+
"properties": {
29+
"uri": {
30+
"type": "string",
31+
"format": "at-uri",
32+
"description": "at-uri for this record"
33+
},
34+
"cid": {
35+
"type": "string",
36+
"format": "cid",
37+
"description": "CID for this exact version of the record"
38+
},
39+
"value": {
40+
"type": "unknown",
41+
"description": "the record itself"
42+
}
43+
}
44+
}
45+
}
46+
}
47+
},
48+
"$type": "com.atproto.lexicon.schema",
49+
"lexicon": 1
50+
}

server/api/social/profile/[...handle].get.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default defineEventHandler(async event => {
2+
const identifier = getRouterParam(event, 'identifier')
3+
if (!identifier) {
4+
throw createError({
5+
status: 400,
6+
message: 'identifier not provided',
7+
})
8+
}
9+
10+
const profileUtil = new ProfileUtils()
11+
const profile = await profileUtil.getProfile(identifier)
12+
console.log('ENDPOINT', { identifier, profile })
13+
return profile
14+
})

0 commit comments

Comments
 (0)