using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class EventInfo
{
public EventInfo() { }
public EventInfo(int id, Uri url, User actor, User assignee, Label label, EventInfoState @event, string commitId, DateTimeOffset createdAt)
{
Id = id;
Url = url;
Actor = actor;
Assignee = assignee;
Label = label;
Event = @event;
CommitId = commitId;
CreatedAt = createdAt;
}
///
/// The id of the issue/pull request event.
///
public int Id { get; protected set; }
///
/// The URL for this event.
///
public Uri Url { get; protected set; }
///
/// Always the User that generated the event.
///
public User Actor { get; protected set; }
///
/// The user that was assigned, if the event was 'Assigned'.
///
public User Assignee { get; protected set; }
///
/// The label that was assigned, if the event was 'Labeled'
///
public Label Label { get; protected set; }
///
/// Identifies the actual type of Event that occurred.
///
public EventInfoState Event { get; protected set; }
///
/// The String SHA of a commit that referenced this Issue.
///
public string CommitId { get; protected set; }
///
/// Date the event occurred for the issue/pull request.
///
public DateTimeOffset CreatedAt { get; protected set; }
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt);
}
}
}
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,
///
/// The issue was unassigned to the actor.
///
Unassigned,
///
/// A label was added to the issue.
///
Labeled,
///
/// A label was removed from the issue.
///
Unlabeled,
///
/// The issue was added to a milestone.
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Milestoned")]
Milestoned,
///
/// The issue was removed from a milestone.
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Demilestoned")]
Demilestoned,
///
/// The issue title was changed.
///
Renamed,
///
/// The issue was locked by the actor.
///
Locked,
///
/// The issue was unlocked by the actor.
///
Unlocked,
///
/// The pull request’s branch was deleted.
///
HeadRefDeleted,
///
/// The pull request’s branch was restored.
///
HeadRefRestored,
///
/// The actor unsubscribed from notifications for an issue.
///
Unsubscribed
}
}