this repo has no description

feat(feedweb): use appbsky to construct output

+7 -14
+1
.gitignore
··· 1 1 bin/ 2 + data/
+6 -14
cmd/feedweb/main.go
··· 3 3 import ( 4 4 "net/http" 5 5 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 - } 16 - 17 - type SkeletonResponse struct { 18 - Cursor string `json:"cursor,omitempty"` 19 - Feed []Post `json:"feed"` 20 - } 21 - 22 - type Post struct { 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 - var posts []Post 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 - posts = append(posts, Post{uri}) 39 + posts = append(posts, &appbsky.FeedDefs_SkeletonFeedPost{Post: uri}) 48 40 } 49 - response := SkeletonResponse{ 41 + 42 + return c.JSON(http.StatusOK, appbsky.FeedGetFeedSkeleton_Output{ 50 43 Feed: posts, 51 - } 52 - return c.JSON(http.StatusOK, response) 44 + }) 53 45 } 54 46 55 47 func main() {