From 6cf36a2e55414a2555e7cd44ced920bd21270d14 Mon Sep 17 00:00:00 2001 From: milarin Date: Wed, 18 Jan 2023 10:06:16 +0100 Subject: [PATCH] accept statuses on media list queries --- anilist.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anilist.go b/anilist.go index 09b1d9f..2aca37e 100644 --- a/anilist.go +++ b/anilist.go @@ -18,17 +18,17 @@ func GetAnimeListByAnimeID() (map[anilist.MediaID]*anilist.MediaList, error) { return channel.ToMap(watchingAnimesChannel, toMapFunc), nil } -func GetCurrentlyWatchingAnimes() (<-chan *anilist.MediaList, error) { - return GetCurrentlyWatchingAnimesContext(context.Background()) +func GetCurrentlyWatchingAnimes(statuses ...anilist.MediaListStatus) (<-chan *anilist.MediaList, error) { + return GetCurrentlyWatchingAnimesContext(context.Background(), statuses...) } -func GetCurrentlyWatchingAnimesContext(ctx context.Context) (<-chan *anilist.MediaList, error) { +func GetCurrentlyWatchingAnimesContext(ctx context.Context, statuses ...anilist.MediaListStatus) (<-chan *anilist.MediaList, error) { token, err := GetAnilistAccessToken() if err != nil { return nil, ErrAnimeListNotObtainable.Wrap(err, "access token acquisition failed") } - media := channel.Map(channel.Of(AnimeStatuses...), func(status anilist.MediaListStatus) <-chan *anilist.MediaList { + media := channel.Map(channel.Of(statuses...), func(status anilist.MediaListStatus) <-chan *anilist.MediaList { return anilist.NewApi(token).GetMediaList(ctx, anilist.MediaListQuery{ UserName: AnilistUsername, Type: anilist.MediaTypeAnime,