public async Task<PullRequestMerge> Merge(long repositoryId, int number, MergePullRequest mergePullRequest)
{
Ensure.ArgumentNotNull(mergePullRequest, "mergePullRequest");
try
{
var endpoint = ApiUrls.MergePullRequest(repositoryId, number);
return await ApiConnection.Put<PullRequestMerge>(endpoint, mergePullRequest, null, AcceptHeaders.SquashCommitPreview).ConfigureAwait(false);
}
catch (ApiException ex)
{
if (ex.StatusCode == HttpStatusCode.MethodNotAllowed)
{
throw new PullRequestNotMergeableException(ex.HttpResponse);
}
if (ex.StatusCode == HttpStatusCode.Conflict)
{
throw new PullRequestMismatchException(ex.HttpResponse);
}
throw;
}
}