public async Task <IteratorBasedPage <PullRequest> > GetPullRequestsPage(string repositoryName, string ownerName, int page, int limit = 50, IPullRequestQueryBuilder builder = null) { var url = EnterpriseApiUrls.PullRequests(ownerName, repositoryName); var request = new YouTrackRestRequest(url, Method.GET); if (builder != null) { foreach (var param in builder.GetQueryParameters()) { request.AddQueryParameter(param.Key, param.Value); } } request.AddQueryParameter("limit", limit.ToString()).AddQueryParameter("start", ((page - 1) * limit).ToString()); var res = (await RestClient.ExecuteTaskAsync <EnterpriseIteratorBasedPage <EnterprisePullRequest> >(request)).Data; return(new IteratorBasedPage <PullRequest>() { Values = res.Values.MapTo <List <PullRequest> >(), Size = res.Size, Next = res.NextPageStart.ToString(), }); }
public async Task <IEnumerable <PullRequest> > GetPullRequests(string repositoryName, string ownerName, int limit = 50, IPullRequestQueryBuilder queryBuilder = null) { var url = ApiUrls.PullRequests(ownerName, repositoryName); var queryString = new QueryString(); if (queryBuilder != null) { foreach (var param in queryBuilder.GetQueryParameters()) { queryString.Add(param.Key, param.Value); } } return(await RestClient.GetAllPages <PullRequest>(url, limit, queryString)); }
public async Task <IteratorBasedPage <PullRequest> > GetPullRequestsPage(string repositoryName, string ownerName, int page, int limit = 50, IPullRequestQueryBuilder builder = null) { var url = ApiUrls.PullRequests(ownerName, repositoryName); var request = new BitbucketRestRequest(url, Method.GET); if (builder != null) { foreach (var param in builder.GetQueryParameters()) { request.AddQueryParameter(param.Key, param.Value); } } request.AddQueryParameter("pagelen", limit.ToString()).AddQueryParameter("page", page.ToString()); var response = await RestClient.ExecuteTaskAsync <IteratorBasedPage <PullRequest> >(request); return(response.Data); }