diff --git a/Git.hub/PullRequest.cs b/Git.hub/PullRequest.cs index 90d1368..e7dd219 100644 --- a/Git.hub/PullRequest.cs +++ b/Git.hub/PullRequest.cs @@ -1,6 +1,7 @@ using System; using RestSharp; using System.Collections.Generic; +using System.Threading.Tasks; namespace Git.hub { @@ -89,6 +90,23 @@ public List GetCommits() return _client.GetList(request); } + /// + /// Retrieves diff data for all Commits associated with this pull request. + /// + /// URL for diff data to retrieve + /// that contains diff data + public async Task GetDiffData(string diffUrl) + { + if (string.IsNullOrEmpty(diffUrl)) + { + throw new ArgumentException("Empty diff URL: ", nameof(diffUrl)); + } + + var request = new RestRequest(diffUrl); + var diffData = await _client.ExecuteGetAsync(request); + return diffData.Content; + } + public Issue ToIssue() { return new Issue { _client = _client, Repository = Repository, Number = Number };