diff --git a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs index fd59ec338f..3a26a00a7f 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs @@ -20,7 +20,7 @@ public interface IObservableIssuesEventsClient /// The owner of the repository /// The name of the repository /// The issue number - IObservable GetAllForIssue(string owner, string name, int number); + IObservable GetAllForIssue(string owner, string name, int number); /// /// Gets all events for the issue. @@ -30,7 +30,7 @@ public interface IObservableIssuesEventsClient /// /// The Id of the repository /// The issue number - IObservable GetAllForIssue(long repositoryId, int number); + IObservable GetAllForIssue(long repositoryId, int number); /// /// Gets all events for the issue. @@ -42,7 +42,7 @@ public interface IObservableIssuesEventsClient /// The name of the repository /// The issue number /// Options for changing the API response - IObservable GetAllForIssue(string owner, string name, int number, ApiOptions options); + IObservable GetAllForIssue(string owner, string name, int number, ApiOptions options); /// /// Gets all events for the issue. @@ -53,7 +53,7 @@ public interface IObservableIssuesEventsClient /// The Id of the repository /// The issue number /// Options for changing the API response - IObservable GetAllForIssue(long repositoryId, int number, ApiOptions options); + IObservable GetAllForIssue(long repositoryId, int number, ApiOptions options); /// /// Gets all events for the repository. diff --git a/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs index 8cf89849cc..3263ba9758 100644 --- a/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs @@ -32,7 +32,7 @@ public ObservableIssuesEventsClient(IGitHubClient client) /// The owner of the repository /// The name of the repository /// The issue number - public IObservable GetAllForIssue(string owner, string name, int number) + public IObservable GetAllForIssue(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); @@ -48,7 +48,7 @@ public IObservable GetAllForIssue(string owner, string name, int numb /// /// The Id of the repository /// The issue number - public IObservable GetAllForIssue(long repositoryId, int number) + public IObservable GetAllForIssue(long repositoryId, int number) { return GetAllForIssue(repositoryId, number, ApiOptions.None); } @@ -63,13 +63,13 @@ public IObservable GetAllForIssue(long repositoryId, int number) /// The name of the repository /// The issue number /// Options for changing the API response - public IObservable GetAllForIssue(string owner, string name, int number, ApiOptions options) + public IObservable GetAllForIssue(string owner, string name, int number, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); - return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name, number), options); + return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name, number), options); } /// @@ -81,11 +81,11 @@ public IObservable GetAllForIssue(string owner, string name, int numb /// The Id of the repository /// The issue number /// Options for changing the API response - public IObservable GetAllForIssue(long repositoryId, int number, ApiOptions options) + public IObservable GetAllForIssue(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(repositoryId, number), options); + return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(repositoryId, number), options); } /// diff --git a/Octokit.Tests/Clients/IssueTimelineClientTests.cs b/Octokit.Tests/Clients/IssueTimelineClientTests.cs index 89b8b63f20..d041406a01 100644 --- a/Octokit.Tests/Clients/IssueTimelineClientTests.cs +++ b/Octokit.Tests/Clients/IssueTimelineClientTests.cs @@ -31,7 +31,7 @@ public async Task RequestsTheCorrectUrl() connection.Received().GetAll( Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), Arg.Any>(), - "application/vnd.github.mockingbird-preview", + "application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview", Arg.Any()); } @@ -46,7 +46,7 @@ public async Task RequestsTheCorrectUrlWithApiOptions() connection.Received().GetAll( Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), Arg.Any>(), - "application/vnd.github.mockingbird-preview", + "application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview", Arg.Is(ao => ao.PageSize == 30)); } @@ -61,7 +61,7 @@ public async Task RequestsTheCorrectUrlWithRepositoryId() connection.Received().GetAll( Arg.Is(u => u.ToString() == "repositories/1/issues/42/timeline"), Arg.Any>(), - "application/vnd.github.mockingbird-preview", + "application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview", Arg.Any()); } @@ -76,7 +76,7 @@ public async Task RequestsTheCorrectUrlWithRepositoryIdAndApiOptions() connection.Received().GetAll( Arg.Is(u => u.ToString() == "repositories/1/issues/42/timeline"), Arg.Any>(), - "application/vnd.github.mockingbird-preview", + "application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview", Arg.Is(ao => ao.PageSize == 30)); } diff --git a/Octokit.Tests/Clients/IssuesEventsClientTests.cs b/Octokit.Tests/Clients/IssuesEventsClientTests.cs index 3e3f46f7bb..54e9998548 100644 --- a/Octokit.Tests/Clients/IssuesEventsClientTests.cs +++ b/Octokit.Tests/Clients/IssuesEventsClientTests.cs @@ -26,8 +26,7 @@ public async Task RequestsCorrectUrl() var client = new IssuesEventsClient(connection); await client.GetAllForIssue("fake", "repo", 42); - - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), Args.ApiOptions); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), null, "application/vnd.github.starfox-preview", Args.ApiOptions); } [Fact] @@ -38,7 +37,7 @@ public async Task RequestsCorrectUrlWithRepositoryId() await client.GetAllForIssue(1, 42); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), Args.ApiOptions); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), null, "application/vnd.github.starfox-preview", Args.ApiOptions); } [Fact] @@ -56,7 +55,7 @@ public async Task RequestsCorrectUrlWithApiOptions() await client.GetAllForIssue("fake", "repo", 42, options); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), options); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), null, "application/vnd.github.starfox-preview", options); } [Fact] @@ -74,7 +73,7 @@ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() await client.GetAllForIssue(1, 42, options); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), options); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), null, "application/vnd.github.starfox-preview", options); } [Fact] @@ -107,7 +106,7 @@ public async Task RequestsCorrectUrl() await client.GetAllForRepository("fake", "repo"); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), null, "application/vnd.github.starfox-preview", Args.ApiOptions); } [Fact] @@ -118,7 +117,7 @@ public async Task RequestsCorrectUrlWithRepositoryId() await client.GetAllForRepository(1); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), Args.ApiOptions); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), null, "application/vnd.github.starfox-preview", Args.ApiOptions); } [Fact] @@ -136,7 +135,7 @@ public async Task RequestsCorrectUrlWithApiOptions() await client.GetAllForRepository("fake", "repo", options); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), options); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), null, "application/vnd.github.starfox-preview", options); } [Fact] @@ -154,7 +153,7 @@ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() await client.GetAllForRepository(1, options); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), options); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), null, "application/vnd.github.starfox-preview", options); } [Fact] @@ -187,7 +186,7 @@ public void RequestsCorrectUrl() client.Get("fake", "repo", 42); - connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events/42")); + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events/42"), null, "application/vnd.github.starfox-preview"); } [Fact] @@ -198,7 +197,7 @@ public void RequestsCorrectUrlWithRepositoryId() client.Get(1, 42); - connection.Received().Get(Arg.Is(u => u.ToString() == "repositories/1/issues/events/42")); + connection.Received().Get(Arg.Is(u => u.ToString() == "repositories/1/issues/events/42"), null, "application/vnd.github.starfox-preview"); } [Fact] diff --git a/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs index 85d32e7074..f2f7d341ac 100644 --- a/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs @@ -26,53 +26,53 @@ public class TheGetForIssueMethod [Fact] public async Task RequestsCorrectUrl() { - var result = new List { new EventInfo() }; + var result = new List { new IssueEvent() }; var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesEventsClient(gitHubClient); - IApiResponse> response = new ApiResponse>( + IApiResponse> response = new ApiResponse>( new Response { ApiInfo = new ApiInfo(new Dictionary(), new List(), new List(), "etag", new RateLimit()), }, result); - gitHubClient.Connection.Get>(Args.Uri, Args.EmptyDictionary, null) + gitHubClient.Connection.Get>(Args.Uri, Args.EmptyDictionary, null) .Returns(Task.FromResult(response)); var eventInfos = await client.GetAllForIssue("fake", "repo", 42).ToList(); - connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), Args.EmptyDictionary, null); + connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), Args.EmptyDictionary, null); Assert.Equal(1, eventInfos.Count); } [Fact] public async Task RequestsCorrectUrlWithRepositoryId() { - var result = new List { new EventInfo() }; + var result = new List { new IssueEvent() }; var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesEventsClient(gitHubClient); - IApiResponse> response = new ApiResponse>( + IApiResponse> response = new ApiResponse>( new Response { ApiInfo = new ApiInfo(new Dictionary(), new List(), new List(), "etag", new RateLimit()), }, result); - gitHubClient.Connection.Get>(Args.Uri, Args.EmptyDictionary, null) + gitHubClient.Connection.Get>(Args.Uri, Args.EmptyDictionary, null) .Returns(Task.FromResult(response)); var eventInfos = await client.GetAllForIssue(1, 42).ToList(); - connection.Received().Get>(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), Args.EmptyDictionary, null); + connection.Received().Get>(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), Args.EmptyDictionary, null); Assert.Equal(1, eventInfos.Count); } [Fact] public async Task RequestsCorrectUrlWithApiOptions() { - var result = new List { new EventInfo() }; + var result = new List { new IssueEvent() }; var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); @@ -85,24 +85,24 @@ public async Task RequestsCorrectUrlWithApiOptions() PageSize = 1 }; - IApiResponse> response = new ApiResponse>( + IApiResponse> response = new ApiResponse>( new Response { ApiInfo = new ApiInfo(new Dictionary(), new List(), new List(), "etag", new RateLimit()), }, result); - gitHubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 2), null) + gitHubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 2), null) .Returns(Task.FromResult(response)); var eventInfos = await client.GetAllForIssue("fake", "repo", 42, options).ToList(); - connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is>(d => d.Count == 2), null); + connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is>(d => d.Count == 2), null); Assert.Equal(1, eventInfos.Count); } [Fact] public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() { - var result = new List { new EventInfo() }; + var result = new List { new IssueEvent() }; var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); @@ -115,17 +115,17 @@ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() PageSize = 1 }; - IApiResponse> response = new ApiResponse>( + IApiResponse> response = new ApiResponse>( new Response { ApiInfo = new ApiInfo(new Dictionary(), new List(), new List(), "etag", new RateLimit()), }, result); - gitHubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 2), null) + gitHubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 2), null) .Returns(Task.FromResult(response)); var eventInfos = await client.GetAllForIssue(1, 42, options).ToList(); - connection.Received().Get>(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), Arg.Is>(d => d.Count == 2), null); + connection.Received().Get>(Arg.Is(u => u.ToString() == "repositories/1/issues/42/events"), Arg.Is>(d => d.Count == 2), null); Assert.Equal(1, eventInfos.Count); } diff --git a/Octokit/Clients/IIssuesEventsClient.cs b/Octokit/Clients/IIssuesEventsClient.cs index f153c90772..d26fb6c314 100644 --- a/Octokit/Clients/IIssuesEventsClient.cs +++ b/Octokit/Clients/IIssuesEventsClient.cs @@ -21,7 +21,7 @@ public interface IIssuesEventsClient /// The owner of the repository /// The name of the repository /// The issue number - Task> GetAllForIssue(string owner, string name, int number); + Task> GetAllForIssue(string owner, string name, int number); /// /// Gets all events for the issue. @@ -31,7 +31,7 @@ public interface IIssuesEventsClient /// /// The Id of the repository /// The issue number - Task> GetAllForIssue(long repositoryId, int number); + Task> GetAllForIssue(long repositoryId, int number); /// /// Gets all events for the issue. @@ -43,7 +43,7 @@ public interface IIssuesEventsClient /// The name of the repository /// The issue number /// Options for changing the API response - Task> GetAllForIssue(string owner, string name, int number, ApiOptions options); + Task> GetAllForIssue(string owner, string name, int number, ApiOptions options); /// /// Gets all events for the issue. @@ -54,7 +54,7 @@ public interface IIssuesEventsClient /// The Id of the repository /// The issue number /// Options for changing the API response - Task> GetAllForIssue(long repositoryId, int number, ApiOptions options); + Task> GetAllForIssue(long repositoryId, int number, ApiOptions options); /// /// Gets all events for the repository. diff --git a/Octokit/Clients/IssueTimelineClient.cs b/Octokit/Clients/IssueTimelineClient.cs index 454125aed9..c3fc6556cd 100644 --- a/Octokit/Clients/IssueTimelineClient.cs +++ b/Octokit/Clients/IssueTimelineClient.cs @@ -48,7 +48,10 @@ public Task> GetAllForIssue(string owner, strin Ensure.ArgumentNotNullOrEmptyString(repo, nameof(repo)); Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssueTimeline(owner, repo, number), null, AcceptHeaders.IssueTimelineApiPreview, options); + return ApiConnection.GetAll(ApiUrls.IssueTimeline(owner, repo, number), + null, + AcceptHeaders.Concat(AcceptHeaders.IssueTimelineApiPreview, AcceptHeaders.IssueEventsApiPreview), + options); } /// @@ -77,7 +80,10 @@ public Task> GetAllForIssue(long repositoryId, { Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssueTimeline(repositoryId, number), null, AcceptHeaders.IssueTimelineApiPreview, options); + return ApiConnection.GetAll(ApiUrls.IssueTimeline(repositoryId, number), + null, + AcceptHeaders.Concat(AcceptHeaders.IssueTimelineApiPreview, AcceptHeaders.IssueEventsApiPreview), + options); } } } diff --git a/Octokit/Clients/IssuesEventsClient.cs b/Octokit/Clients/IssuesEventsClient.cs index 6f9f9b188f..e5e5f879df 100644 --- a/Octokit/Clients/IssuesEventsClient.cs +++ b/Octokit/Clients/IssuesEventsClient.cs @@ -24,7 +24,7 @@ public IssuesEventsClient(IApiConnection apiConnection) : base(apiConnection) /// The owner of the repository /// The name of the repository /// The issue number - public Task> GetAllForIssue(string owner, string name, int number) + public Task> GetAllForIssue(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); @@ -40,7 +40,7 @@ public Task> GetAllForIssue(string owner, string name, /// /// The Id of the repository /// The issue number - public Task> GetAllForIssue(long repositoryId, int number) + public Task> GetAllForIssue(long repositoryId, int number) { return GetAllForIssue(repositoryId, number, ApiOptions.None); } @@ -55,13 +55,16 @@ public Task> GetAllForIssue(long repositoryId, int numb /// The name of the repository /// The issue number /// Options for changing the API response - public Task> GetAllForIssue(string owner, string name, int number, ApiOptions options) + public Task> GetAllForIssue(string owner, string name, int number, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name, number), options); + return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name, number), + null, + AcceptHeaders.IssueEventsApiPreview, + options); } /// @@ -73,11 +76,14 @@ public Task> GetAllForIssue(string owner, string name, /// The Id of the repository /// The issue number /// Options for changing the API response - public Task> GetAllForIssue(long repositoryId, int number, ApiOptions options) + public Task> GetAllForIssue(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssuesEvents(repositoryId, number), options); + return ApiConnection.GetAll(ApiUrls.IssuesEvents(repositoryId, number), + null, + AcceptHeaders.IssueEventsApiPreview, + options); } /// @@ -123,7 +129,10 @@ public Task> GetAllForRepository(string owner, string Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name), options); + return ApiConnection.GetAll(ApiUrls.IssuesEvents(owner, name), + null, + AcceptHeaders.IssueEventsApiPreview, + options); } /// @@ -138,7 +147,10 @@ public Task> GetAllForRepository(long repositoryId, Ap { Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.IssuesEvents(repositoryId), options); + return ApiConnection.GetAll(ApiUrls.IssuesEvents(repositoryId), + null, + AcceptHeaders.IssueEventsApiPreview, + options); } /// @@ -155,7 +167,9 @@ public Task Get(string owner, string name, long eventId) Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); - return ApiConnection.Get(ApiUrls.IssuesEvent(owner, name, eventId)); + return ApiConnection.Get(ApiUrls.IssuesEvent(owner, name, eventId), + null, + AcceptHeaders.IssueEventsApiPreview); } /// @@ -168,7 +182,9 @@ public Task Get(string owner, string name, long eventId) /// The event id public Task Get(long repositoryId, long eventId) { - return ApiConnection.Get(ApiUrls.IssuesEvent(repositoryId, eventId)); + return ApiConnection.Get(ApiUrls.IssuesEvent(repositoryId, eventId), + null, + AcceptHeaders.IssueEventsApiPreview); } } } \ No newline at end of file diff --git a/Octokit/Helpers/AcceptHeaders.cs b/Octokit/Helpers/AcceptHeaders.cs index 6c9de111ea..3a857cca3f 100644 --- a/Octokit/Helpers/AcceptHeaders.cs +++ b/Octokit/Helpers/AcceptHeaders.cs @@ -69,6 +69,8 @@ public static class AcceptHeaders public const string ProtectedBranchesRequiredApprovingApiPreview = "application/vnd.github.luke-cage-preview+json"; + public const string IssueEventsApiPreview = "application/vnd.github.starfox-preview"; + /// /// Combines multiple preview headers. GitHub API supports Accept header with multiple /// values separated by comma. diff --git a/Octokit/Models/Response/IssueEvent.cs b/Octokit/Models/Response/IssueEvent.cs index bd186b0aca..be5b79f7ba 100644 --- a/Octokit/Models/Response/IssueEvent.cs +++ b/Octokit/Models/Response/IssueEvent.cs @@ -9,7 +9,7 @@ public class IssueEvent { public IssueEvent() { } - public IssueEvent(long id, string nodeId, string url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt, Issue issue, string commitUrl) + public IssueEvent(long id, string nodeId, string url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt, Issue issue, string commitUrl, RenameInfo rename, IssueEventProjectCard projectCard) { Id = id; NodeId = nodeId; @@ -22,6 +22,8 @@ public IssueEvent(long id, string nodeId, string url, User actor, User assignee, CreatedAt = createdAt; Issue = issue; CommitUrl = commitUrl; + Rename = rename; + ProjectCard = projectCard; } /// @@ -79,6 +81,18 @@ public IssueEvent(long id, string nodeId, string url, User actor, User assignee, /// public Issue Issue { get; protected set; } + /// + /// An object containing rename details + /// Only provided for renamed events + /// + public RenameInfo Rename { get; protected set; } + + /// + /// Information about the project card that triggered the event. + /// The project_card attribute is not returned if someone deletes the project board, or if you do not have permission to view it. + /// + public IssueEventProjectCard ProjectCard { get; protected set; } + internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt); } diff --git a/Octokit/Models/Response/IssueEventProjectCard.cs b/Octokit/Models/Response/IssueEventProjectCard.cs new file mode 100644 index 0000000000..f2cf797d1b --- /dev/null +++ b/Octokit/Models/Response/IssueEventProjectCard.cs @@ -0,0 +1,58 @@ +using System.Diagnostics; +using System.Globalization; + +namespace Octokit +{ + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class IssueEventProjectCard + { + public IssueEventProjectCard() { } + + public IssueEventProjectCard(long id, string url, long projectId, string projectUrl, string columnName, string previousColumnName) + { + Id = id; + Url = url; + ProjectId = projectId; + ProjectUrl = projectUrl; + ColumnName = columnName; + PreviousColumnName = previousColumnName; + } + + /// + /// The identification number of the project card. + /// + public long Id { get; protected set; } + + /// + /// The API URL of the project card, if the card still exists. + /// Not included for removed_from_project events. + /// + public string Url { get; protected set; } + + /// + /// The identification number of the project. + /// + public long ProjectId { get; protected set; } + + /// + /// The API URL of the project. + /// + public string ProjectUrl { get; protected set; } + + /// + /// The name of the column that the card is listed in. + /// + public string ColumnName { get; protected set; } + + /// + /// The name of the column that the card was listed in prior to column_name + /// Only returned for moved_columns_in_project events. + /// + public string PreviousColumnName { get; protected set; } + + internal string DebuggerDisplay + { + get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}", Id); } + } + } +} diff --git a/Octokit/Models/Response/TimelineEventInfo.cs b/Octokit/Models/Response/TimelineEventInfo.cs index ff3b32aed0..f9fb50f328 100644 --- a/Octokit/Models/Response/TimelineEventInfo.cs +++ b/Octokit/Models/Response/TimelineEventInfo.cs @@ -9,7 +9,7 @@ public class TimelineEventInfo { public TimelineEventInfo() { } - public TimelineEventInfo(long id, string nodeId, string url, User actor, string commitId, EventInfoState @event, DateTimeOffset createdAt, Label label, User assignee, Milestone milestone, SourceInfo source, RenameInfo rename) + public TimelineEventInfo(long id, string nodeId, string url, User actor, string commitId, EventInfoState @event, DateTimeOffset createdAt, Label label, User assignee, Milestone milestone, SourceInfo source, RenameInfo rename, IssueEventProjectCard projectCard) { Id = id; NodeId = nodeId; @@ -23,6 +23,7 @@ public TimelineEventInfo(long id, string nodeId, string url, User actor, string Milestone = milestone; Source = source; Rename = rename; + ProjectCard = projectCard; } public long Id { get; protected set; } @@ -40,9 +41,25 @@ public TimelineEventInfo(long id, string nodeId, string url, User actor, string public Label Label { get; protected set; } public User Assignee { get; protected set; } public Milestone Milestone { get; protected set; } + + /// + /// The source of reference from another issue + /// Only provided for cross-referenced events + /// public SourceInfo Source { get; protected set; } + + /// + /// An object containing rename details + /// Only provided for renamed events + /// public RenameInfo Rename { get; protected set; } + /// + /// The name of the column that the card was listed in prior to column_name. + /// Only returned for moved_columns_in_project events + /// + public IssueEventProjectCard ProjectCard { get; protected set; } + internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1} Event: {2}", Id, CreatedAt, Event); } diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 392dcb5834..d15ddb5ab5 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -40,11 +40,11 @@ - + - +