Skip to content

Commit 68f5c3a

Browse files
committed
added PullRequest.GetIssueCommits()
1 parent c63164c commit 68f5c3a

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Git.hub/Git.hub.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<Compile Include="Branch.cs" />
4242
<Compile Include="Client.cs" />
4343
<Compile Include="Commit.cs" />
44+
<Compile Include="Issue.cs" />
4445
<Compile Include="OAuth2Helper.cs" />
4546
<Compile Include="Organization.cs" />
4647
<Compile Include="Properties\AssemblyInfo.cs" />

Git.hub/Issue.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace Git.hub
7+
{
8+
public class IssueComment
9+
{
10+
public int Id { get; private set; }
11+
public string Body { get; private set; }
12+
public DateTime CreatedAt { get; private set; }
13+
public DateTime UpdatedAt { get; private set; }
14+
public User User { get; private set; }
15+
16+
/// <summary>
17+
/// api.github.com/repos/{user}/{repo}/issues/{issue}/comments/{id}
18+
/// </summary>
19+
public string Url { get; private set; }
20+
}
21+
}

Git.hub/PullRequest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public class PullRequest
7575

7676
internal RestClient _client;
7777

78+
/// <summary>
79+
/// Retrieves all Commits associated with this pull request.
80+
/// </summary>
81+
/// <returns></returns>
7882
public List<PullRequestCommit> GetCommits()
7983
{
8084
var request = new RestRequest("/repos/{user}/{repo}/pulls/{pull}/commits");
@@ -84,5 +88,15 @@ public List<PullRequestCommit> GetCommits()
8488

8589
return _client.Get<List<PullRequestCommit>>(request).Data;
8690
}
91+
92+
public List<IssueComment> GetIssueComments()
93+
{
94+
var request = new RestRequest("/repos/{user}/{repo}/issues/{pull}/comments");
95+
request.AddUrlSegment("user", Repository.Owner.Login);
96+
request.AddUrlSegment("repo", Repository.Name);
97+
request.AddUrlSegment("pull", Number.ToString());
98+
99+
return _client.Get<List<IssueComment>>(request).Data;
100+
}
87101
}
88102
}

0 commit comments

Comments
 (0)