-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The current implementation of GenreService is decent using the service-client pattern and proper context handling. However, to ensure full API condition and improve developer experience, we should add some missing stuff.
-
Restore Pagination: The Anime/Manga endpoints support
pageandlimitparameters. These should be added to the method signatures. -
Introduce Type Safety for Filters: Instead of using raw strings literally just stringing everything so now for
filter, we should implement aGenreFiltertype with constants (GenresFilterThemes) to prevent runtime errors and improve IDE autocompletion.
// Current
func (s *GenreService) Anime(ctx context.Context, filter string) ([]Genre, error)
// New
func (s *GenreService) Anime(ctx context.Context, page, limit int, filter GenreFilter) ([]Genre, error)The current version is clean enough, but adding it will make the library way better and user friendly for prod environments where pagination is needed.