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 page and limit parameters. 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 a GenreFilter type 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.
The current implementation of
GenreServiceis 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.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.