From 769be5bcbce1be028d26476d97c671406210e98d Mon Sep 17 00:00:00 2001 From: Kyle Nunery Date: Sat, 2 Nov 2013 10:56:12 -0500 Subject: [PATCH] Added Issue Events client interface and corresponding types --- Octokit/Clients/IIssuesEventsClient.cs | 46 +++++++++++++++++ Octokit/Models/Response/Actor.cs | 13 +++++ Octokit/Models/Response/EventInfo.cs | 69 ++++++++++++++++++++++++++ Octokit/Models/Response/IssueEvent.cs | 9 ++++ Octokit/Octokit.csproj | 6 ++- 5 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 Octokit/Clients/IIssuesEventsClient.cs create mode 100644 Octokit/Models/Response/Actor.cs create mode 100644 Octokit/Models/Response/EventInfo.cs create mode 100644 Octokit/Models/Response/IssueEvent.cs diff --git a/Octokit/Clients/IIssuesEventsClient.cs b/Octokit/Clients/IIssuesEventsClient.cs new file mode 100644 index 00000000..d0170e0c --- /dev/null +++ b/Octokit/Clients/IIssuesEventsClient.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Threading.Tasks; + +namespace Octokit +{ + public interface IIssuesEventsClient + { + /// + /// Gets all events for the issue. + /// + /// + /// http://developer.github.com/v3/issues/events/#list-events-for-an-issue + /// + /// The owner of the repository + /// The name of the repository + /// The issue number + /// + Task> GetForIssue(string owner, string name, int number); + + /// + /// Gets all events for the repository. + /// + /// + /// http://developer.github.com/v3/issues/events/#list-events-for-a-repository + /// + /// The owner of the repository + /// The name of the repository + /// + Task> GetForRepository(string owner, string name); + + /// + /// Gets a single event + /// + /// + /// http://developer.github.com/v3/issues/events/#get-a-single-event + /// + /// The owner of the repository + /// The name of the repository + /// The issue number + /// + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", + Justification = "Method makes a network request")] + Task Get(string owner, string name, int number); + } +} diff --git a/Octokit/Models/Response/Actor.cs b/Octokit/Models/Response/Actor.cs new file mode 100644 index 00000000..76de111d --- /dev/null +++ b/Octokit/Models/Response/Actor.cs @@ -0,0 +1,13 @@ +using System; + +namespace Octokit +{ + public class Actor + { + public string Login { get; set; } + public int Id { get; set; } + public Uri AvatarUrl { get; set; } + public string GravatarId { get; set; } + public Uri Url { get; set; } + } +} diff --git a/Octokit/Models/Response/EventInfo.cs b/Octokit/Models/Response/EventInfo.cs new file mode 100644 index 00000000..a3aaa913 --- /dev/null +++ b/Octokit/Models/Response/EventInfo.cs @@ -0,0 +1,69 @@ +using System; + +namespace Octokit +{ + public class EventInfo + { + public Uri Url { get; set; } + + /// + /// Always the User that generated the event + /// + public Actor Actor { get; set; } + + /// + /// Identifies the actual type of Event that occurred + /// + public EventInfoState InfoState { get; set; } + + /// + /// The String SHA of a commit that referenced this Issue + /// + public string CommitId { get; set; } + + /// + /// Date the event occurred for the issue/pull request. + /// + public DateTimeOffset CreatedAt { get; set; } + } + + public enum EventInfoState + { + /// + /// The issue was closed by the actor. When the commit_id is present, it identifies the commit that + /// closed the issue using “closes / fixes #NN” syntax. + /// + Closed, + + /// + /// The issue was reopened by the actor. + /// + Reopened, + + /// + /// The actor subscribed to receive notifications for an issue. + /// + Subscribed, + + /// + /// The issue was merged by the actor. The commit_id attribute is the SHA1 of the HEAD commit that was merged. + /// + Merged, + + /// + /// The issue was referenced from a commit message. The commit_id attribute is the commit SHA1 of where + /// that happened. + /// + Referenced, + + /// + /// The actor was @mentioned in an issue body. + /// + Mentioned, + + /// + /// The issue was assigned to the actor. + /// + Assigned + } +} \ No newline at end of file diff --git a/Octokit/Models/Response/IssueEvent.cs b/Octokit/Models/Response/IssueEvent.cs new file mode 100644 index 00000000..65441361 --- /dev/null +++ b/Octokit/Models/Response/IssueEvent.cs @@ -0,0 +1,9 @@ +namespace Octokit +{ + public class IssueEvent + { + public EventInfo EventInfo { get; set; } + + public Issue Issue { get; set; } + } +} diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 27dcf08c..4356b87b 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -52,6 +52,7 @@ + @@ -65,10 +66,13 @@ + + + @@ -198,4 +202,4 @@ --> - + \ No newline at end of file