From a2955d85850d05e6fcb4893a8697bc0ffcf0676f Mon Sep 17 00:00:00 2001 From: Yun Li Date: Wed, 11 Jan 2017 18:23:48 -0800 Subject: [PATCH 1/5] add Id for PullRequest.cs added the Id property for PullRequest model --- .../Clients/PullRequestsClientTests.cs | 1 + Octokit/Models/Response/PullRequest.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 96e947c6b4..916b8a2d9a 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -59,6 +59,7 @@ public async Task CanGetForRepository() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); + Assert.NotNull(pullRequests[0].Id); } [IntegrationTest] diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index e5fdc3bafa..6b11d35f7c 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -15,8 +15,9 @@ public PullRequest(int number) Number = number; } - public PullRequest(Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked) + public PullRequest(int id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked) { + Id = id; Url = url; HtmlUrl = htmlUrl; DiffUrl = diffUrl; @@ -47,6 +48,11 @@ public PullRequest(Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl Locked = locked; } + /// + /// The universal Id (different from the pull request number) this pull request. + /// + public int Id { get; protected set; } + /// /// The URL for this pull request. /// From dbe3ebcf1f3c37fbb2f883e1e938787eaa6702eb Mon Sep 17 00:00:00 2001 From: Yun Li Date: Thu, 12 Jan 2017 10:20:06 -0800 Subject: [PATCH 2/5] use long for pull request id --- Octokit/Models/Response/PullRequest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index 6b11d35f7c..c31001d3e1 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -15,7 +15,7 @@ public PullRequest(int number) Number = number; } - public PullRequest(int id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked) + public PullRequest(long id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked) { Id = id; Url = url; @@ -51,7 +51,7 @@ public PullRequest(int id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri /// /// The universal Id (different from the pull request number) this pull request. /// - public int Id { get; protected set; } + public long Id { get; protected set; } /// /// The URL for this pull request. From a90b9d290eb4a98921c594ae3a46d6892a80763e Mon Sep 17 00:00:00 2001 From: Yun Li Date: Thu, 12 Jan 2017 16:30:49 -0800 Subject: [PATCH 3/5] update comments for PullRequest.Id and Issue.Id make it more intuitive... a question, issue.Id and comment.Id are int type. do we have any concern on it? --- Octokit/Models/Response/Issue.cs | 2 +- Octokit/Models/Response/PullRequest.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Octokit/Models/Response/Issue.cs b/Octokit/Models/Response/Issue.cs index bc7da88b15..7bcb8df22d 100644 --- a/Octokit/Models/Response/Issue.cs +++ b/Octokit/Models/Response/Issue.cs @@ -38,7 +38,7 @@ public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, I } /// - /// The Id for this issue + /// The internal Id for this issue (not the issue number) /// public int Id { get; protected set; } diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index c31001d3e1..e2be58196a 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -49,7 +49,6 @@ public PullRequest(long id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri } /// - /// The universal Id (different from the pull request number) this pull request. /// public long Id { get; protected set; } From f46db330af090d2eb994f40782caf5ec37b94e4c Mon Sep 17 00:00:00 2001 From: Yun Li Date: Thu, 12 Jan 2017 16:31:21 -0800 Subject: [PATCH 4/5] plus the one for pullrequest forgot to check this change. --- Octokit/Models/Response/PullRequest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index e2be58196a..5644a0b3eb 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -49,6 +49,7 @@ public PullRequest(long id, Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri } /// + /// The internal Id for this pull request (not the pull request number) /// public long Id { get; protected set; } From 51d1f43d3ad80c8f4e27a06a7641de4f645c6ae9 Mon Sep 17 00:00:00 2001 From: Yun Li Date: Thu, 12 Jan 2017 17:00:58 -0800 Subject: [PATCH 5/5] update the integration test for Id Property long will never be null --- Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 916b8a2d9a..80afe81b67 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -59,7 +59,7 @@ public async Task CanGetForRepository() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); - Assert.NotNull(pullRequests[0].Id); + Assert.True(pullRequests[0].Id > 0); } [IntegrationTest]