80 lines
2.7 KiB
Go
Raw Normal View History

package apiroutes
import (
"strings"
"github.com/aerogo/aero"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/pages/animeimport"
2019-08-29 05:08:32 +00:00
"github.com/animenotifier/notify.moe/pages/animelist"
2019-11-18 05:55:12 +00:00
"github.com/animenotifier/notify.moe/pages/api"
"github.com/animenotifier/notify.moe/pages/api/apitype"
2018-10-27 02:01:21 +00:00
"github.com/animenotifier/notify.moe/pages/character"
2019-08-27 09:51:58 +00:00
"github.com/animenotifier/notify.moe/pages/database"
2018-04-28 19:17:44 +00:00
"github.com/animenotifier/notify.moe/pages/editor/jobs"
"github.com/animenotifier/notify.moe/pages/me"
"github.com/animenotifier/notify.moe/pages/notifications"
"github.com/animenotifier/notify.moe/pages/popular"
2019-06-03 03:20:17 +00:00
"github.com/animenotifier/notify.moe/pages/post"
"github.com/animenotifier/notify.moe/pages/soundtrack"
2019-06-03 03:20:17 +00:00
"github.com/animenotifier/notify.moe/pages/sse"
"github.com/animenotifier/notify.moe/pages/thread"
"github.com/animenotifier/notify.moe/pages/upload"
2019-06-03 03:20:17 +00:00
"github.com/animenotifier/notify.moe/utils/page"
)
// Register registers the page routes.
2019-06-03 03:20:17 +00:00
func Register(app *aero.Application) {
// API pages
2019-11-18 05:55:12 +00:00
page.Get(app, "/api", api.Get)
for name := range arn.DB.Types() {
2019-11-18 05:55:12 +00:00
page.Get(app, "/api/"+strings.ToLower(name), apitype.ByType(name))
}
// API
app.Get("/api/me", me.Get)
app.Get("/api/popular/anime/titles/:count", popular.AnimeTitles)
app.Get("/api/test/notification", notifications.Test)
app.Get("/api/count/notifications/unseen", notifications.CountUnseen)
app.Get("/api/mark/notifications/seen", notifications.MarkNotificationsAsSeen)
2018-10-17 00:31:15 +00:00
app.Get("/api/user/:id/notifications/latest", notifications.Latest)
app.Get("/api/random/soundtrack", soundtrack.Random)
app.Get("/api/next/soundtrack", soundtrack.Next)
2018-10-27 02:01:21 +00:00
app.Get("/api/character/:id/ranking", character.Ranking)
2018-11-06 20:40:03 +00:00
// Live updates
app.Get("/api/sse/events", sse.Events)
2018-11-05 11:57:37 +00:00
// Thread
app.Get("/api/thread/:id/reply/ui", thread.ReplyUI)
// Post
app.Get("/api/post/:id/reply/ui", post.ReplyUI)
2019-09-01 23:19:10 +00:00
// Types
2019-08-27 09:51:58 +00:00
app.Get("/api/types", database.Types)
app.Get("/api/types/:type/download", database.Download)
2019-08-27 09:51:58 +00:00
// SoundTrack
app.Post("/api/soundtrack/:id/download", soundtrack.Download)
2019-08-29 05:08:32 +00:00
// AnimeList
app.Post("/api/delete/animelist", animelist.Delete)
// Upload
app.Post("/api/upload/user/image", upload.UserImage)
app.Post("/api/upload/user/cover", upload.UserCover)
app.Post("/api/upload/anime/:id/image", upload.AnimeImage)
app.Post("/api/upload/character/:id/image", upload.CharacterImage)
2018-11-22 01:27:53 +00:00
app.Post("/api/upload/group/:id/image", upload.GroupImage)
app.Post("/api/upload/amv/:id/file", upload.AMVFile)
// Import anime
app.Post("/api/import/kitsu/anime/:id", animeimport.Kitsu)
app.Post("/api/delete/kitsu/anime/:id", animeimport.DeleteKitsu)
2018-04-28 19:17:44 +00:00
// Jobs
app.Post("/api/job/:job/start", jobs.Start)
}