Closed tiago-mateus closed 5 years ago
You should do that using a query filter and a sort instruction on the ListPullRequests(ListParameters parameters) method
you can refer to the Bitbucket documentation about filtering and sorting to build your filter and sort strings: https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering
It should looks like that:
var branchName = "master";
var parameters = new ListParameters
{
Filter = $"destination.branch.name = \"{branchName}\"",
Sort = "-updated_on", /* or "-created_on" in function of what you mean by last */
Max = 1 /* since you are not interested to get all */
};
var lastPullRequest = pullRequestsResource.ListPullRequests(parameters).FirstOrDefault();
Obrigadoo!
How do I get the last pull request from the master? to avoid the problem I'm having slow. method used: .GetPullRequestLog ()