Beispiel #1
0
        // get current anime season data
        public async Task <bool> GetCurrentSeasonList(int requestRetryDelayInMs)
        {
            SeasonData = null;

            // get current season
            // if there is no response from API wait for a specified time and retry
            while (SeasonData == null)
            {
                try
                {
                    SeasonData = await JikanWrapper.GetSeason();
                }
                catch (System.Net.Http.HttpRequestException)
                {
                    return(false);
                }
                catch (JikanDotNet.Exceptions.JikanRequestException)
                {
                    await TimerService.DelayTask(requestRetryDelayInMs);
                }
                finally
                {
                    await TimerService.DelayTask(requestRetryDelayInMs);
                }
            }
            return(true);
        }
Beispiel #2
0
        // get user's watching status anime list
        public async Task <(bool Success, string ErrorMessage)> GetCurrentUserAnimeList(string malUsername)
        {
            try
            {
                // get user's watching status anime list
                UserAnimeListData = await JikanWrapper.GetUserAnimeList(malUsername, UserAnimeListExtension.Watching);
            }
            catch (System.Net.Http.HttpRequestException)
            {
                return(false, "Problems with internet connection!");
            }
            catch (JikanDotNet.Exceptions.JikanRequestException)
            {
                return(false, $"Could not find the user \"{ malUsername }\". Please make sure you typed in the name correctly.");
            }

            return(true, string.Empty);
        }