feat: typed anime and playback payloads
This commit is contained in:
@@ -17,8 +17,8 @@ type ThemesData = jikan.ThemesData
|
||||
type ReviewEntry = jikan.ReviewEntry
|
||||
|
||||
type AnimeService interface {
|
||||
GetCatalogSection(ctx context.Context, userID string, section string) (map[string]any, error)
|
||||
GetDiscoverSection(ctx context.Context, userID string, section string) (map[string]any, error)
|
||||
GetCatalogSection(ctx context.Context, userID string, section string) (CatalogSectionData, error)
|
||||
GetDiscoverSection(ctx context.Context, userID string, section string) (DiscoverSectionData, error)
|
||||
GetAnimeByID(ctx context.Context, id int) (Anime, error)
|
||||
SearchAdvanced(ctx context.Context, q, animeType, status, orderBy, sort string, genres []int, sfw bool, page, limit int) (jikan.SearchResult, error)
|
||||
GetGenres(ctx context.Context) ([]Genre, error)
|
||||
@@ -34,6 +34,29 @@ type AnimeService interface {
|
||||
GetReviews(ctx context.Context, id int, page int) ([]ReviewEntry, bool, error)
|
||||
}
|
||||
|
||||
type CatalogSectionData struct {
|
||||
Animes []Anime
|
||||
ContinueWatching []db.GetContinueWatchingEntriesRow
|
||||
Section string
|
||||
WatchlistMap map[int64]bool
|
||||
Fragment string
|
||||
}
|
||||
|
||||
func (d CatalogSectionData) TemplateFragment() string {
|
||||
return d.Fragment
|
||||
}
|
||||
|
||||
type DiscoverSectionData struct {
|
||||
Animes []Anime
|
||||
Section string
|
||||
WatchlistMap map[int64]bool
|
||||
Fragment string
|
||||
}
|
||||
|
||||
func (d DiscoverSectionData) TemplateFragment() string {
|
||||
return d.Fragment
|
||||
}
|
||||
|
||||
type AnimeRepository interface {
|
||||
GetUserWatchList(ctx context.Context, userID string) ([]db.GetUserWatchListRow, error)
|
||||
GetWatchListEntry(ctx context.Context, params db.GetWatchListEntryParams) (db.WatchListEntry, error)
|
||||
|
||||
Reference in New Issue
Block a user