update files

This commit is contained in:
Astra 2025-07-13 19:24:37 +01:00
parent 218189c35a
commit 1c701e9151
2 changed files with 22 additions and 104 deletions

View file

@ -166,10 +166,8 @@ func (bluesky *Bluesky) DeleteRecord(args []string) *CommitResponse {
return resp return resp
} }
func (bluesky *Bluesky) FetchPost(did string, rkey string) Post { func (bluesky *Bluesky) FetchPost(did string, rkey string) FetchedPost {
resp := &struct { resp := FetchedPost{}
Posts []Post `json:"posts"`
}{}
params := struct { params := struct {
URIs string `url:"uris"` URIs string `url:"uris"`
}{ }{
@ -177,5 +175,5 @@ func (bluesky *Bluesky) FetchPost(did string, rkey string) Post {
} }
bluesky.sling.New().Base("https://public.api.bsky.app"). bluesky.sling.New().Base("https://public.api.bsky.app").
Get("/xrpc/app.bsky.feed.getPosts").QueryStruct(&params).Receive(resp, resp) Get("/xrpc/app.bsky.feed.getPosts").QueryStruct(&params).Receive(resp, resp)
return resp.Posts[0] return resp
} }

112
parse.go
View file

@ -185,106 +185,26 @@ type ParsedEmbeds struct {
Height int64 Height int64
} }
type Author struct {
Did string `json:"did"`
Handle string `json:"handle"`
DisplayName string `json:"displayName"`
Avatar string `json:"avatar"`
Associated struct {
Chat struct {
AllowIncoming string `json:"allowIncoming"`
} `json:"chat"`
} `json:"associated"`
Labels []interface{} `json:"labels"`
CreatedAt time.Time `json:"createdAt"`
}
type FetchedPost struct { type FetchedPost struct {
URI string `json:"uri"` URI string `json:"uri"`
Cid string `json:"cid"` Cid string `json:"cid"`
Author struct { Author *Author `json:"author"`
Did string `json:"did"`
Handle string `json:"handle"`
DisplayName string `json:"displayName"`
Avatar string `json:"avatar"`
Associated struct {
Chat struct {
AllowIncoming string `json:"allowIncoming"`
} `json:"chat"`
} `json:"associated"`
Labels []interface{} `json:"labels"`
CreatedAt time.Time `json:"createdAt"`
} `json:"author"`
Record *Post `json:"record"` Record *Post `json:"record"`
Embed struct { Embed *Embed `json:"embed,omitempty"`
Type string `json:"$type"`
Media struct {
Type string `json:"$type"`
Images []struct {
Thumb string `json:"thumb"`
Fullsize string `json:"fullsize"`
Alt string `json:"alt"`
AspectRatio struct {
Height int `json:"height"`
Width int `json:"width"`
} `json:"aspectRatio"`
} `json:"images"`
} `json:"media"`
Record struct {
Record struct {
Type string `json:"$type"`
URI string `json:"uri"`
Cid string `json:"cid"`
Author struct {
Did string `json:"did"`
Handle string `json:"handle"`
DisplayName string `json:"displayName"`
Avatar string `json:"avatar"`
Associated struct {
Chat struct {
AllowIncoming string `json:"allowIncoming"`
} `json:"chat"`
} `json:"associated"`
Labels []interface{} `json:"labels"`
CreatedAt time.Time `json:"createdAt"`
} `json:"author"`
Value struct {
Type string `json:"$type"`
CreatedAt time.Time `json:"createdAt"`
Embed struct {
Type string `json:"$type"`
AspectRatio struct {
Height int `json:"height"`
Width int `json:"width"`
} `json:"aspectRatio"`
Video struct {
Type string `json:"$type"`
Ref struct {
Link string `json:"$link"`
} `json:"ref"`
MimeType string `json:"mimeType"`
Size int `json:"size"`
} `json:"video"`
} `json:"embed"`
Facets []struct {
Type string `json:"$type"`
Features []struct {
Type string `json:"$type"`
Did string `json:"did"`
} `json:"features"`
Index struct {
ByteEnd int `json:"byteEnd"`
ByteStart int `json:"byteStart"`
} `json:"index"`
} `json:"facets"`
Langs []string `json:"langs"`
Text string `json:"text"`
} `json:"value"`
Labels []interface{} `json:"labels"`
LikeCount int `json:"likeCount"`
ReplyCount int `json:"replyCount"`
RepostCount int `json:"repostCount"`
QuoteCount int `json:"quoteCount"`
IndexedAt time.Time `json:"indexedAt"`
Embeds []struct {
Type string `json:"$type"`
Cid string `json:"cid"`
Playlist string `json:"playlist"`
Thumbnail string `json:"thumbnail"`
AspectRatio struct {
Height int `json:"height"`
Width int `json:"width"`
} `json:"aspectRatio"`
} `json:"embeds"`
} `json:"record"`
} `json:"record"`
} `json:"embed"`
ReplyCount int `json:"replyCount"` ReplyCount int `json:"replyCount"`
RepostCount int `json:"repostCount"` RepostCount int `json:"repostCount"`
LikeCount int `json:"likeCount"` LikeCount int `json:"likeCount"`