Interactive/pkg/internal/http/api/index.go

79 lines
2.5 KiB
Go
Raw Normal View History

package api
import (
"github.com/gofiber/fiber/v2"
)
func MapAPIs(app *fiber.App, baseURL string) {
api := app.Group(baseURL).Name("API")
{
2024-10-31 15:06:37 +00:00
publishers := api.Group("/publishers").Name("Publisher API")
{
2024-11-02 02:35:36 +00:00
publishers.Get("/", listOwnedPublisher)
publishers.Post("/personal", createPersonalPublisher)
publishers.Post("/organization", createOrganizationPublisher)
2024-10-31 15:06:37 +00:00
publishers.Get("/:name/pins", listPinnedPost)
publishers.Get("/:name", getPublisher)
2024-11-08 16:47:19 +00:00
publishers.Put("/:name", editPublisher)
publishers.Delete("/:name", deletePublisher)
2024-10-31 15:06:37 +00:00
}
2024-08-18 16:57:20 +00:00
2024-07-23 08:12:19 +00:00
recommendations := api.Group("/recommendations").Name("Recommendations API")
{
2024-07-27 17:49:16 +00:00
recommendations.Get("/", listRecommendationNews)
recommendations.Get("/friends", listRecommendationFriends)
2024-07-23 08:12:19 +00:00
recommendations.Get("/shuffle", listRecommendationShuffle)
}
stories := api.Group("/stories").Name("Story API")
{
stories.Post("/", createStory)
stories.Put("/:postId", editStory)
}
articles := api.Group("/articles").Name("Article API")
{
articles.Post("/", createArticle)
2024-07-23 10:05:54 +00:00
articles.Put("/:postId", editArticle)
}
posts := api.Group("/posts").Name("Posts API")
{
posts.Get("/", listPost)
2024-10-13 13:25:15 +00:00
posts.Get("/search", searchPost)
2024-08-10 13:11:55 +00:00
posts.Get("/minimal", listPostMinimal)
2024-07-22 05:41:35 +00:00
posts.Get("/drafts", listDraftPost)
posts.Get("/:postId", getPost)
posts.Post("/:postId/react", reactPost)
2024-07-25 14:45:31 +00:00
posts.Post("/:postId/pin", pinPost)
posts.Delete("/:postId", deletePost)
posts.Get("/:postId/replies", listPostReplies)
posts.Get("/:postId/replies/featured", listPostFeaturedReply)
}
2024-09-16 16:12:09 +00:00
subscriptions := api.Group("/subscriptions").Name("Subscriptions API")
{
subscriptions.Get("/users/:userId", getSubscriptionOnUser)
subscriptions.Get("/tags/:tagId", getSubscriptionOnTag)
subscriptions.Get("/categories/:categoryId", getSubscriptionOnCategory)
subscriptions.Post("/users/:userId", subscribeToUser)
subscriptions.Post("/tags/:tagId", subscribeToTag)
subscriptions.Post("/categories/:categoryId", subscribeToCategory)
subscriptions.Delete("/users/:userId", unsubscribeFromUser)
subscriptions.Delete("/tags/:tagId", unsubscribeFromTag)
subscriptions.Delete("/categories/:categoryId", unsubscribeFromCategory)
}
api.Get("/categories", listCategories)
api.Get("/categories/:category", getCategory)
api.Post("/categories", newCategory)
api.Put("/categories/:categoryId", editCategory)
api.Delete("/categories/:categoryId", deleteCategory)
api.Get("/tags", listTags)
api.Get("/tags/:tag", getTag)
2024-09-03 12:04:03 +00:00
api.Get("/whats-new", getWhatsNew)
}
}