Added Issue Events client interface and corresponding types

This commit is contained in:
Kyle Nunery
2013-11-02 10:56:12 -05:00
parent 1e96fde67b
commit 769be5bcbc
5 changed files with 142 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit
{
public interface IIssuesEventsClient
{
/// <summary>
/// Gets all events for the issue.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/events/#list-events-for-an-issue
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
Task<IReadOnlyList<IssueEvent>> GetForIssue(string owner, string name, int number);
/// <summary>
/// Gets all events for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/events/#list-events-for-a-repository
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <returns></returns>
Task<IReadOnlyList<IssueEvent>> GetForRepository(string owner, string name);
/// <summary>
/// Gets a single event
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/events/#get-a-single-event
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<IssueEvent> Get(string owner, string name, int number);
}
}
+13
View File
@@ -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; }
}
}
+69
View File
@@ -0,0 +1,69 @@
using System;
namespace Octokit
{
public class EventInfo
{
public Uri Url { get; set; }
/// <summary>
/// Always the User that generated the event
/// </summary>
public Actor Actor { get; set; }
/// <summary>
/// Identifies the actual type of Event that occurred
/// </summary>
public EventInfoState InfoState { get; set; }
/// <summary>
/// The String SHA of a commit that referenced this Issue
/// </summary>
public string CommitId { get; set; }
/// <summary>
/// Date the event occurred for the issue/pull request.
/// </summary>
public DateTimeOffset CreatedAt { get; set; }
}
public enum EventInfoState
{
/// <summary>
/// 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.
/// </summary>
Closed,
/// <summary>
/// The issue was reopened by the actor.
/// </summary>
Reopened,
/// <summary>
/// The actor subscribed to receive notifications for an issue.
/// </summary>
Subscribed,
/// <summary>
/// The issue was merged by the actor. The commit_id attribute is the SHA1 of the HEAD commit that was merged.
/// </summary>
Merged,
/// <summary>
/// The issue was referenced from a commit message. The commit_id attribute is the commit SHA1 of where
/// that happened.
/// </summary>
Referenced,
/// <summary>
/// The actor was @mentioned in an issue body.
/// </summary>
Mentioned,
/// <summary>
/// The issue was assigned to the actor.
/// </summary>
Assigned
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace Octokit
{
public class IssueEvent
{
public EventInfo EventInfo { get; set; }
public Issue Issue { get; set; }
}
}
+5 -1
View File
@@ -52,6 +52,7 @@
</Compile>
<Compile Include="Clients\AssigneesClient.cs" />
<Compile Include="Clients\CommitStatusClient.cs" />
<Compile Include="Clients\IIssuesEventsClient.cs" />
<Compile Include="Clients\ICommitStatusClient.cs" />
<Compile Include="Clients\IssuesClient.cs" />
<Compile Include="Clients\MilestonesClient.cs" />
@@ -65,10 +66,13 @@
<Compile Include="Models\Request\NewCommitStatus.cs" />
<Compile Include="Models\Request\NewMilestone.cs" />
<Compile Include="Models\Request\RequestParameters.cs" />
<Compile Include="Models\Response\Actor.cs" />
<Compile Include="Models\Response\CommitStatus.cs" />
<Compile Include="Models\Response\EventInfo.cs" />
<Compile Include="Models\Response\Issue.cs" />
<Compile Include="Models\Request\IssueRequest.cs" />
<Compile Include="Models\Request\IssueUpdate.cs" />
<Compile Include="Models\Response\IssueEvent.cs" />
<Compile Include="Models\Response\Label.cs" />
<Compile Include="Models\Response\Milestone.cs" />
<Compile Include="Models\Request\NewIssue.cs" />
@@ -198,4 +202,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>