this repo has no description

feat(feedweb): use appbsky to construct output

Changed files
+7 -14
cmd
feedweb
+1
.gitignore
···
bin/
+
data/
+6 -14
cmd/feedweb/main.go
···
import (
"net/http"
+
appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/edavis/bsky-feeds/pkg/mostliked"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
···
Feed string `query:"feed"`
Limit int64 `query:"limit"`
Offset string `query:"offset"`
-
}
-
-
type SkeletonResponse struct {
-
Cursor string `json:"cursor,omitempty"`
-
Feed []Post `json:"feed"`
-
}
-
-
type Post struct {
-
Uri string `json:"post"`
}
type SkeletonHeader struct {
···
return c.String(http.StatusBadRequest, "bad request")
}
-
var posts []Post
+
var posts []*appbsky.FeedDefs_SkeletonFeedPost
uris := mostliked.Feed(mostliked.FeedViewParams{
Limit: req.Limit,
Offset: req.Offset,
Langs: hdr.Langs,
})
for _, uri := range uris {
-
posts = append(posts, Post{uri})
+
posts = append(posts, &appbsky.FeedDefs_SkeletonFeedPost{Post: uri})
}
-
response := SkeletonResponse{
+
+
return c.JSON(http.StatusOK, appbsky.FeedGetFeedSkeleton_Output{
Feed: posts,
-
}
-
return c.JSON(http.StatusOK, response)
+
})
}
func main() {