示例#1
0
        public async Task <List <PixivWork> > GetBookmarks(int page = 1, Publicity publicity = Publicity.Public)
        {
            MainWindow.ShowingError = false;
            if (AuthDetails.IsExpired)
            {
                throw new Exception("Expired session! Please login again!");
            }

            try
            {
                var result = await tokens.GetMyFavoriteWorksAsync(page : page, publicity : publicity.ToString().ToLower(), perPage : MainViewModel.DefaultPerPage);

                if (result == null)
                {
                    return(new List <PixivWork>());
                }
                return(result.ToPixivWork());
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
                return(new List <PixivWork>());
            }
        }
示例#2
0
        public async Task <List <PixivWork> > GetFollowing(int page = 1, Publicity publicity = Publicity.Public)
        {
            var result = await GetData(() => tokens.GetMyFollowingWorksAsync(page: page, publicity: publicity.ToString().ToLower(), perPage: MainViewModel.DefaultPerPage));

            if (result == null || result.Item1 == null)
            {
                return(new List <PixivWork>());
            }
            return(result.Item1.ToPixivWork());
        }