lvermeulen / Bitbucket.Net

C# client for Atlassian Bitbucket Server
MIT License
32 stars 18 forks source link

DeclinePullRequest is throwing 405 error #7

Closed nikitha789 closed 5 years ago

nikitha789 commented 5 years ago

While using DeclinePullrequest Method,it is failing with status code 405.

FlurlHttpException: DELETE http://bitbucket.org/rest/api/1.0/projects/{projectkey}/repos/{slug}/pull-requests/1898/decline?version=2 failed with status code 405 ().

This is the method I have defined using the bitbucket package

`public bool DeclineUnapprovedBuildMasterPullRequests() { var openBuildMasterUnapprovedPullRequests = GetOpenBuildMasterPullRequests().Where(pr=> pr.Reviewers.Count(rev => rev.Approved) <PULL_APPROVAL_THRESHOLD).ToList();

        if (openBuildMasterUnapprovedPullRequests.Count > 0)
        {
            foreach (var pullRequest in openBuildMasterUnapprovedPullRequests)
            {

                var declinePullRequest = bitbucketClient.DeclinePullRequestAsync(settings.ProjectKey, settings.RepositorySlug, pullRequest.Id, pullRequest.Version).Result;
                if (!declinePullRequest)
                    return false;
            }
        }

        return true;
    }

`

lvermeulen commented 5 years ago

I'm using the wrong verb there, fixed in release 2.1.3