/// <summary> /// /// </summary> /// <param name="projectId"></param> /// <returns></returns> public async Task <List <IssueDto> > GetIssues(int projectId, string bookmark = null) { var resDto = new IssueListDto(); try { resDto = JsonConvert.DeserializeObject <IssueListDto>(IssuessRes); } catch (Exception e) { resDto = null; } return(resDto?.IssueList); }
/// <summary> /// /// </summary> /// <param name="projectId"></param> /// <returns></returns> public async Task <List <IssueDto> > GetIssues(int projectId, string bookmark = null) { var resDto = new IssueListDto(); if (string.IsNullOrEmpty(AppConfig.Urls.IssuessUrl)) { _logger.LogError("AppConfig.Urls.IssuessUrl is not configured"); return(null); } var url = string.Format(AppConfig.Urls.IssuessUrl, projectId); // add bookmark if exist if (!string.IsNullOrWhiteSpace(bookmark)) { url += $"&bookmark={bookmark}"; } try { var result = await GetResponseByUrl(url); resDto = JsonConvert.DeserializeObject <IssueListDto>(result); } catch (Exception e) { _logger.LogError(e, "API repository can't get Issues by projectId: {0}", projectId); return(null); } // if item list is not null get next bookmark if (resDto?.IssueList.Count > 0) { resDto.IssueList.AddRange(await GetIssues(projectId, resDto.NextBookmark)); } return(resDto?.IssueList); }