From ca0011546b90674d079f03b6f9bcb317c059ef34 Mon Sep 17 00:00:00 2001 From: Brandon Everett Date: Mon, 19 Dec 2016 12:39:59 -0500 Subject: [PATCH 1/4] obsolete comment and add ReviewComment --- Octokit/Clients/IPullRequestsClient.cs | 8 +++++++- Octokit/Clients/PullRequestsClient.cs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index 04b5418b1b..6635d42c34 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; @@ -15,7 +16,12 @@ public interface IPullRequestsClient /// /// Client for managing comments. /// + [Obsolete("Use ReviewComment")] IPullRequestReviewCommentsClient Comment { get; } + /// + /// Client for managing comments. + /// + IPullRequestReviewCommentsClient ReviewComment { get; } /// /// Get a pull request by number. diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index dad64321b6..0b23b6ed79 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -21,7 +21,7 @@ public PullRequestsClient(IApiConnection apiConnection) : base(apiConnection) /// Client for managing comments. /// public IPullRequestReviewCommentsClient Comment { get; private set; } - + public IPullRequestReviewCommentsClient ReviewComment { get; set; } /// /// Get a pull request by number. /// From 096433f5b2171bdf76f53349c039ff5ec77c0fcd Mon Sep 17 00:00:00 2001 From: Brandon Everett Date: Wed, 21 Dec 2016 09:45:59 -0500 Subject: [PATCH 2/4] obsolete PullRequest.Comment and change to ReviewComment --- ...servablePullRequestReviewCommentsClient.cs | 2 +- ...equestReviewCommentReactionsClientTests.cs | 2 +- .../PullRequestReviewCommentsClientTests.cs | 2 +- ...blePullRequestReviewCommentsClientTests.cs | 44 +++++++++---------- Octokit/Clients/IPullRequestsClient.cs | 2 +- Octokit/Clients/PullRequestsClient.cs | 11 +++-- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs index 89bb8ea0c8..4caefcd4f4 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs @@ -20,7 +20,7 @@ public ObservablePullRequestReviewCommentsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); - _client = client.PullRequest.Comment; + _client = client.PullRequest.ReviewComment; _connection = client.Connection; } diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs index 92f21dc963..4044adde88 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs @@ -20,7 +20,7 @@ public PullRequestReviewCommentReactionsClientTests() { _github = Helper.GetAuthenticatedClient(); - _client = _github.PullRequest.Comment; + _client = _github.PullRequest.ReviewComment; // We'll create a pull request that can be used by most tests _context = _github.CreateRepositoryContext("test-repo").Result; diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs index 86c9c14ad7..ac9ab891bd 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs @@ -20,7 +20,7 @@ public PullRequestReviewCommentsClientTests() { _github = Helper.GetAuthenticatedClient(); - _client = _github.PullRequest.Comment; + _client = _github.PullRequest.ReviewComment; // We'll create a pull request that can be used by most tests _context = _github.CreateRepositoryContext("test-repo").Result; diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs index 7e637dbdec..4afdee43b4 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs @@ -38,7 +38,7 @@ public void RequestsCorrectUrl() client.GetAll("fake", "repo", 1); - gitHubClient.Received().PullRequest.Comment.GetAll("fake", "repo", 1); + gitHubClient.Received().PullRequest.ReviewComment.GetAll("fake", "repo", 1); } [Fact] @@ -49,7 +49,7 @@ public void RequestsCorrectUrlWithRepositoryId() client.GetAll(1, 1); - gitHubClient.Received().PullRequest.Comment.GetAll(1, 1); + gitHubClient.Received().PullRequest.ReviewComment.GetAll(1, 1); } [Fact] @@ -67,7 +67,7 @@ public void RequestsCorrectUrlWithApiOptions() client.GetAll("fake", "repo", 1, options); - gitHubClient.Received().PullRequest.Comment.GetAll("fake", "repo", 1, options); + gitHubClient.Received().PullRequest.ReviewComment.GetAll("fake", "repo", 1, options); } [Fact] @@ -85,7 +85,7 @@ public void RequestsCorrectUrlWithApiOptionsWithRepositoryId() client.GetAll(1, 1, options); - gitHubClient.Received().PullRequest.Comment.GetAll(1, 1, options); + gitHubClient.Received().PullRequest.ReviewComment.GetAll(1, 1, options); } [Fact] @@ -237,7 +237,7 @@ public void RequestsCorrectUrl() client.GetAllForRepository("fake", "repo", request); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", request); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", request); } [Fact] @@ -255,7 +255,7 @@ public void RequestsCorrectUrlWithRepositoryId() client.GetAllForRepository(1, request); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, request); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, request); } [Fact] @@ -280,7 +280,7 @@ public void RequestsCorrectUrlWithApiOptions() client.GetAllForRepository("fake", "repo", request, options); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", request, options); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", request, options); } [Fact] @@ -305,7 +305,7 @@ public void RequestsCorrectUrlWithApiOptionsWithRepositoryId() client.GetAllForRepository(1, request, options); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, request, options); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, request, options); } [Fact] @@ -483,7 +483,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArguments() client.GetAllForRepository("fake", "repo"); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo"); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo"); } [Fact] @@ -494,7 +494,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithRepositoryId() client.GetAllForRepository(1); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1); } [Fact] @@ -512,7 +512,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithApiOptions() client.GetAllForRepository("fake", "repo", options); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", options); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", options); } [Fact] @@ -530,7 +530,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithApiOptionsWithR client.GetAllForRepository(1, options); - gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, options); + gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, options); } [Fact] @@ -721,7 +721,7 @@ public void GetsFromClientPullRequestComment() client.GetComment("owner", "name", 53); - gitHubClient.PullRequest.Comment.Received().GetComment("owner", "name", 53); + gitHubClient.PullRequest.ReviewComment.Received().GetComment("owner", "name", 53); } [Fact] @@ -732,7 +732,7 @@ public void GetsFromClientPullRequestCommentWithRepositoryId() client.GetComment(1, 53); - gitHubClient.PullRequest.Comment.Received().GetComment(1, 53); + gitHubClient.PullRequest.ReviewComment.Received().GetComment(1, 53); } [Fact] @@ -760,7 +760,7 @@ public void PostsToCorrectUrl() client.Create("owner", "name", 13, comment); - gitHubClient.PullRequest.Comment.Received().Create("owner", "name", 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().Create("owner", "name", 13, comment); } [Fact] @@ -773,7 +773,7 @@ public void PostsToCorrectUrlWithRepositoryId() client.Create(1, 13, comment); - gitHubClient.PullRequest.Comment.Received().Create(1, 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().Create(1, 13, comment); } [Fact] @@ -812,7 +812,7 @@ public void PostsToCorrectUrl() client.CreateReply("owner", "name", 13, comment); - gitHubClient.PullRequest.Comment.Received().CreateReply("owner", "name", 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().CreateReply("owner", "name", 13, comment); } [Fact] @@ -825,7 +825,7 @@ public void PostsToCorrectUrlWithRepositoryId() client.CreateReply(1, 13, comment); - gitHubClient.PullRequest.Comment.Received().CreateReply(1, 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().CreateReply(1, 13, comment); } [Fact] @@ -862,7 +862,7 @@ public void PostsToCorrectUrl() client.Edit("owner", "name", 13, comment); - gitHubClient.PullRequest.Comment.Received().Edit("owner", "name", 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().Edit("owner", "name", 13, comment); } [Fact] @@ -875,7 +875,7 @@ public void PostsToCorrectUrlWithRepositoryId() client.Edit(1, 13, comment); - gitHubClient.PullRequest.Comment.Received().Edit(1, 13, comment); + gitHubClient.PullRequest.ReviewComment.Received().Edit(1, 13, comment); } [Fact] @@ -909,7 +909,7 @@ public void PostsToCorrectUrl() client.Delete("owner", "name", 13); - gitHubClient.PullRequest.Comment.Received().Delete("owner", "name", 13); + gitHubClient.PullRequest.ReviewComment.Received().Delete("owner", "name", 13); } [Fact] @@ -920,7 +920,7 @@ public void PostsToCorrectUrlWithRepositoryId() client.Delete(1, 13); - gitHubClient.PullRequest.Comment.Received().Delete(1, 13); + gitHubClient.PullRequest.ReviewComment.Received().Delete(1, 13); } [Fact] diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index 6635d42c34..6902fe30fa 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -16,7 +16,7 @@ public interface IPullRequestsClient /// /// Client for managing comments. /// - [Obsolete("Use ReviewComment")] + [Obsolete("Please use IPullRequestsClient.ReviewComment instead. This method will be removed in a future version")] IPullRequestReviewCommentsClient Comment { get; } /// /// Client for managing comments. diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 0b23b6ed79..47c833e270 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Net; using System.Threading.Tasks; @@ -14,13 +15,17 @@ public class PullRequestsClient : ApiClient, IPullRequestsClient { public PullRequestsClient(IApiConnection apiConnection) : base(apiConnection) { - Comment = new PullRequestReviewCommentsClient(apiConnection); + ReviewComment = new PullRequestReviewCommentsClient(apiConnection); } /// /// Client for managing comments. /// - public IPullRequestReviewCommentsClient Comment { get; private set; } + [Obsolete("Please use PullRequestsClient.ReviewComment instead. This method will be removed in a future version")] + public IPullRequestReviewCommentsClient Comment { get; set; } + /// + /// Client for managing comments. + /// public IPullRequestReviewCommentsClient ReviewComment { get; set; } /// /// Get a pull request by number. From 6c1c4be0c6fa4fd40151d69eb88458fefde4e559 Mon Sep 17 00:00:00 2001 From: Brandon Everett Date: Wed, 21 Dec 2016 12:03:07 -0500 Subject: [PATCH 3/4] update ObservablePullRequestClient and interface to use ReviewComment --- Octokit.Reactive/Clients/IObservablePullRequestsClient.cs | 2 ++ Octokit.Reactive/Clients/ObservablePullRequestsClient.cs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs index 752024be3f..1c99aa6853 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs @@ -14,7 +14,9 @@ public interface IObservablePullRequestsClient /// /// Client for managing comments. /// + [Obsolete("Please use IObservablePullRequestsClient.ReviewComment. This will be removed in a future version")] IObservablePullRequestReviewCommentsClient Comment { get; } + IObservablePullRequestReviewCommentsClient ReviewComment { get; } /// /// Gets a single Pull Request by number. diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs index be36824697..fbb546a837 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs @@ -18,7 +18,9 @@ public class ObservablePullRequestsClient : IObservablePullRequestsClient /// /// Client for managing comments. /// - public IObservablePullRequestReviewCommentsClient Comment { get; private set; } + [Obsolete("Please use ObservablePullRequestsClient.ReviewComment. This will be removed in a future version")] + public IObservablePullRequestReviewCommentsClient Comment { get; set; } + public IObservablePullRequestReviewCommentsClient ReviewComment { get; private set; } public ObservablePullRequestsClient(IGitHubClient client) { @@ -26,7 +28,7 @@ public ObservablePullRequestsClient(IGitHubClient client) _client = client.Repository.PullRequest; _connection = client.Connection; - Comment = new ObservablePullRequestReviewCommentsClient(client); + ReviewComment = new ObservablePullRequestReviewCommentsClient(client); } /// From 653712e3a5c6aaeadd847684667ecea392a4853e Mon Sep 17 00:00:00 2001 From: Brandon Everett Date: Thu, 22 Dec 2016 08:01:14 -0500 Subject: [PATCH 4/4] fixed formatting issues have Comment return new ReviewComment --- Octokit.Reactive/Clients/IObservablePullRequestsClient.cs | 6 +++++- Octokit.Reactive/Clients/ObservablePullRequestsClient.cs | 8 ++++++-- Octokit/Clients/IPullRequestsClient.cs | 5 +++-- Octokit/Clients/PullRequestsClient.cs | 8 +++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs index 1c99aa6853..ad5dd7c97a 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs @@ -12,10 +12,14 @@ namespace Octokit.Reactive public interface IObservablePullRequestsClient { /// - /// Client for managing comments. + /// Client for managing review comments. /// [Obsolete("Please use IObservablePullRequestsClient.ReviewComment. This will be removed in a future version")] IObservablePullRequestReviewCommentsClient Comment { get; } + + /// + /// Client for managing review comments. + /// IObservablePullRequestReviewCommentsClient ReviewComment { get; } /// diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs index fbb546a837..912d0fe293 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs @@ -16,10 +16,14 @@ public class ObservablePullRequestsClient : IObservablePullRequestsClient readonly IConnection _connection; /// - /// Client for managing comments. + /// Client for managing review comments. /// [Obsolete("Please use ObservablePullRequestsClient.ReviewComment. This will be removed in a future version")] - public IObservablePullRequestReviewCommentsClient Comment { get; set; } + public IObservablePullRequestReviewCommentsClient Comment { get { return this.ReviewComment; } } + + /// + /// Client for managing review comments. + /// public IObservablePullRequestReviewCommentsClient ReviewComment { get; private set; } public ObservablePullRequestsClient(IGitHubClient client) diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index 6902fe30fa..ccb1315856 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -14,12 +14,13 @@ namespace Octokit public interface IPullRequestsClient { /// - /// Client for managing comments. + /// Client for managing review comments. /// [Obsolete("Please use IPullRequestsClient.ReviewComment instead. This method will be removed in a future version")] IPullRequestReviewCommentsClient Comment { get; } + /// - /// Client for managing comments. + /// Client for managing review comments. /// IPullRequestReviewCommentsClient ReviewComment { get; } diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 47c833e270..81ea33ffed 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -19,14 +19,16 @@ public PullRequestsClient(IApiConnection apiConnection) : base(apiConnection) } /// - /// Client for managing comments. + /// Client for managing review comments. /// [Obsolete("Please use PullRequestsClient.ReviewComment instead. This method will be removed in a future version")] - public IPullRequestReviewCommentsClient Comment { get; set; } + public IPullRequestReviewCommentsClient Comment { get { return this.ReviewComment; } } + /// - /// Client for managing comments. + /// Client for managing review comments. /// public IPullRequestReviewCommentsClient ReviewComment { get; set; } + /// /// Get a pull request by number. ///