tangled
alpha
login
or
join now
edavis.dev
/
bsky-feeds
1
fork
atom
this repo has no description
1
fork
atom
overview
issues
pulls
pipelines
feat(feedweb): use appbsky to construct output
Eric Davis
1 year ago
a488809a
2bb7805b
+7
-14
2 changed files
expand all
collapse all
unified
split
.gitignore
cmd
feedweb
main.go
+1
.gitignore
···
1
1
bin/
2
2
+
data/
+6
-14
cmd/feedweb/main.go
···
3
3
import (
4
4
"net/http"
5
5
6
6
+
appbsky "github.com/bluesky-social/indigo/api/bsky"
6
7
"github.com/edavis/bsky-feeds/pkg/mostliked"
7
8
"github.com/labstack/echo/v4"
8
9
"github.com/labstack/echo/v4/middleware"
···
12
13
Feed string `query:"feed"`
13
14
Limit int64 `query:"limit"`
14
15
Offset string `query:"offset"`
15
15
-
}
16
16
-
17
17
-
type SkeletonResponse struct {
18
18
-
Cursor string `json:"cursor,omitempty"`
19
19
-
Feed []Post `json:"feed"`
20
20
-
}
21
21
-
22
22
-
type Post struct {
23
23
-
Uri string `json:"post"`
24
16
}
25
17
26
18
type SkeletonHeader struct {
···
37
29
return c.String(http.StatusBadRequest, "bad request")
38
30
}
39
31
40
40
-
var posts []Post
32
32
+
var posts []*appbsky.FeedDefs_SkeletonFeedPost
41
33
uris := mostliked.Feed(mostliked.FeedViewParams{
42
34
Limit: req.Limit,
43
35
Offset: req.Offset,
44
36
Langs: hdr.Langs,
45
37
})
46
38
for _, uri := range uris {
47
47
-
posts = append(posts, Post{uri})
39
39
+
posts = append(posts, &appbsky.FeedDefs_SkeletonFeedPost{Post: uri})
48
40
}
49
49
-
response := SkeletonResponse{
41
41
+
42
42
+
return c.JSON(http.StatusOK, appbsky.FeedGetFeedSkeleton_Output{
50
43
Feed: posts,
51
51
-
}
52
52
-
return c.JSON(http.StatusOK, response)
44
44
+
})
53
45
}
54
46
55
47
func main() {