Compare commits

...

5 commits
v1.0.0 ... main

Author SHA1 Message Date
bafb502147 update files 2025-07-13 19:28:12 +01:00
6f17ff93ac update files 2025-07-13 19:25:59 +01:00
1c701e9151 update files 2025-07-13 19:24:37 +01:00
218189c35a remove DID 2025-07-13 18:15:43 +01:00
b94da1c4db Change go.mod 2025-07-13 18:13:28 +01:00
4 changed files with 23 additions and 104 deletions

View file

@ -166,9 +166,9 @@ 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 := &struct {
Posts []Post `json:"posts"` Posts []FetchedPost `json:"posts"`
}{} }{}
params := struct { params := struct {
URIs string `url:"uris"` URIs string `url:"uris"`
@ -177,5 +177,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.Posts
} }

View file

@ -15,7 +15,6 @@ import (
type BSky struct { type BSky struct {
Bluesky *Bluesky Bluesky *Bluesky
DID string
} }
func NewBSky() *BSky { func NewBSky() *BSky {

2
go.mod
View file

@ -1,4 +1,4 @@
module git.zio.sh/astra/go-bluesky-client/v1 module git.zio.sh/astra/go-bluesky-client
go 1.24.3 go 1.24.3

118
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"` Record *Post `json:"record"`
Handle string `json:"handle"` Embed *Embed `json:"embed,omitempty"`
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"`
Embed struct {
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"`