diff --git a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs index fd59ec33..3a26a00a 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs @@ -20,7 +20,7 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// /// 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 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// 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 8cf89849..3263ba97 100644 --- a/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs @@ -32,7 +32,7 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// /// 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 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// 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 89b8b63f..d041406a 100644 --- a/Octokit.Tests/Clients/IssueTimelineClientTests.cs +++ b/Octokit.Tests/Clients/IssueTimelineClientTests.cs @@ -31,7 +31,7 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 3e3f46f7..54e99985 100644 --- a/Octokit.Tests/Clients/IssuesEventsClientTests.cs +++ b/Octokit.Tests/Clients/IssuesEventsClientTests.cs @@ -26,8 +26,7 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 @@ namespace Octokit.Tests.Clients 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 85d32e70..f2f7d341 100644 --- a/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs @@ -26,53 +26,53 @@ namespace Octokit.Tests.Reactive [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 @@ namespace Octokit.Tests.Reactive 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 @@ namespace Octokit.Tests.Reactive 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 f153c907..d26fb6c3 100644 --- a/Octokit/Clients/IIssuesEventsClient.cs +++ b/Octokit/Clients/IIssuesEventsClient.cs @@ -21,7 +21,7 @@ namespace Octokit /// 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 @@ namespace Octokit /// /// 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 @@ namespace Octokit /// 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 @@ namespace Octokit /// 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 454125ae..c3fc6556 100644 --- a/Octokit/Clients/IssueTimelineClient.cs +++ b/Octokit/Clients/IssueTimelineClient.cs @@ -48,7 +48,10 @@ namespace Octokit 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 @@ namespace Octokit { 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 6f9f9b18..e5e5f879 100644 --- a/Octokit/Clients/IssuesEventsClient.cs +++ b/Octokit/Clients/IssuesEventsClient.cs @@ -24,7 +24,7 @@ namespace Octokit /// 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 @@ namespace Octokit /// /// 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 @@ namespace Octokit /// 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 @@ namespace Octokit /// 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 @@ namespace Octokit 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 @@ namespace Octokit { 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 @@ namespace Octokit 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 @@ namespace Octokit /// 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 6c9de111..3a857cca 100644 --- a/Octokit/Helpers/AcceptHeaders.cs +++ b/Octokit/Helpers/AcceptHeaders.cs @@ -69,6 +69,8 @@ namespace Octokit 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 bd186b0a..be5b79f7 100644 --- a/Octokit/Models/Response/IssueEvent.cs +++ b/Octokit/Models/Response/IssueEvent.cs @@ -9,7 +9,7 @@ namespace Octokit { 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 @@ namespace Octokit CreatedAt = createdAt; Issue = issue; CommitUrl = commitUrl; + Rename = rename; + ProjectCard = projectCard; } /// @@ -79,6 +81,18 @@ namespace Octokit /// 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 00000000..f2cf797d --- /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 ff3b32ae..f9fb50f3 100644 --- a/Octokit/Models/Response/TimelineEventInfo.cs +++ b/Octokit/Models/Response/TimelineEventInfo.cs @@ -9,7 +9,7 @@ namespace Octokit { 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 @@ namespace Octokit Milestone = milestone; Source = source; Rename = rename; + ProjectCard = projectCard; } public long Id { get; protected set; } @@ -40,9 +41,25 @@ namespace Octokit 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 392dcb58..d15ddb5a 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -40,11 +40,11 @@ - + - +