add support for links as posts

This commit is contained in:
Astra 2025-07-01 07:08:46 +01:00
parent 2bb3946237
commit bfa829d8c7
4 changed files with 240 additions and 33 deletions

View file

@ -263,3 +263,17 @@ type Records struct {
Cid string `json:"cid"`
Value Value `json:"value"`
}
func (bluesky *Bluesky) FetchPost(did string, rkey string) FetchedPost {
resp := &struct {
Posts []FetchedPost `json:"posts"`
}{}
params := struct {
URIs string `url:"uris"`
}{
URIs: fmt.Sprintf("at://%s/app.bsky.feed.post/%s", did, rkey),
}
bluesky.sling.New().Base("https://public.api.bsky.app").
Get("/xrpc/app.bsky.feed.getPosts").QueryStruct(&params).Receive(resp, resp)
return resp.Posts[0]
}