Skip to content

Commit

Permalink
Add Author Association for comments related models (#1877)
Browse files Browse the repository at this point in the history
* Add Author Association for comments related models

* remove optional AuthorAssociation from constructors

* tidy up whitespace/formatting
  • Loading branch information
mirsaeedi authored and ryangribble committed Nov 7, 2018
1 parent d34aa80 commit eb9c112
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
52 changes: 52 additions & 0 deletions Octokit/Models/Common/AuthorAssociation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Octokit.Internal;

namespace Octokit
{
/// <summary>
/// States of a Team/Organization Membership
/// </summary>
public enum AuthorAssociation
{
/// <summary>
/// Author has been invited to collaborate on the repository.
/// </summary>
[Parameter(Value = "COLLABORATOR")]
Collaborator,

/// <summary>
/// Author has previously committed to the repository.
/// </summary>
[Parameter(Value = "CONTRIBUTOR")]
Contributor,

/// <summary>
/// Author has not previously committed to GitHub.
/// </summary>
[Parameter(Value = "FIRST_TIMER")]
FirstTimer,

/// <summary>
/// Author has not previously committed to the repository.
/// </summary>
[Parameter(Value = "FIRST_TIME_CONTRIBUTOR")]
FirstTimeContributor,

/// <summary>
/// Author is a member of the organization that owns the repository.
/// </summary>
[Parameter(Value = "MEMBER")]
Member,

/// <summary>
/// Author is the owner of the repository.
/// </summary>
[Parameter(Value = "OWNER")]
Owner,

/// <summary>
/// Author has no association with the repository.
/// </summary>
[Parameter(Value = "NONE")]
None
}
}
8 changes: 7 additions & 1 deletion Octokit/Models/Response/IssueComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class IssueComment
{
public IssueComment() { }

public IssueComment(int id, string nodeId, string url, string htmlUrl, string body, DateTimeOffset createdAt, DateTimeOffset? updatedAt, User user, ReactionSummary reactions)
public IssueComment(int id, string nodeId, string url, string htmlUrl, string body, DateTimeOffset createdAt, DateTimeOffset? updatedAt, User user, ReactionSummary reactions, AuthorAssociation authorAssociation)
{
Id = id;
NodeId = nodeId;
Expand All @@ -21,6 +21,7 @@ public IssueComment(int id, string nodeId, string url, string htmlUrl, string bo
UpdatedAt = updatedAt;
User = user;
Reactions = reactions;
AuthorAssociation = authorAssociation;
}

/// <summary>
Expand Down Expand Up @@ -63,6 +64,11 @@ public IssueComment(int id, string nodeId, string url, string htmlUrl, string bo
/// </summary>
public User User { get; protected set; }

/// <summary>
/// The comment author association with repository.
/// </summary>
public StringEnum<AuthorAssociation> AuthorAssociation { get; protected set; }

/// <summary>
/// The reaction summary for this comment.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/PullRequestReview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public PullRequestReview(long id)
Id = id;
}

public PullRequestReview(long id, string nodeId, string commitId, User user, string body, string htmlUrl, string pullRequestUrl, PullRequestReviewState state)
public PullRequestReview(long id, string nodeId, string commitId, User user, string body, string htmlUrl, string pullRequestUrl, PullRequestReviewState state, AuthorAssociation authorAssociation)
{
Id = id;
NodeId = nodeId;
Expand All @@ -25,6 +25,7 @@ public PullRequestReview(long id, string nodeId, string commitId, User user, str
HtmlUrl = htmlUrl;
PullRequestUrl = pullRequestUrl;
State = state;
AuthorAssociation = authorAssociation;
}

/// <summary>
Expand Down Expand Up @@ -67,6 +68,11 @@ public PullRequestReview(long id, string nodeId, string commitId, User user, str
/// </summary>
public string PullRequestUrl { get; protected set; }

/// <summary>
/// The comment author association with repository.
/// </summary>
public StringEnum<AuthorAssociation> AuthorAssociation { get; protected set; }

internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}, State: {1}, User: {2}", Id, State.DebuggerDisplay, User.DebuggerDisplay); }
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/PullRequestReviewComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public PullRequestReviewComment(int id)
Id = id;
}

public PullRequestReviewComment(string url, int id, string nodeId, string diffHunk, string path, int? position, int? originalPosition, string commitId, string originalCommitId, User user, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, string htmlUrl, string pullRequestUrl, ReactionSummary reactions, int? inReplyToId, int? pullRequestReviewId)
public PullRequestReviewComment(string url, int id, string nodeId, string diffHunk, string path, int? position, int? originalPosition, string commitId, string originalCommitId, User user, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, string htmlUrl, string pullRequestUrl, ReactionSummary reactions, int? inReplyToId, int? pullRequestReviewId, AuthorAssociation authorAssociation)
{
PullRequestReviewId = pullRequestReviewId;
Url = url;
Expand All @@ -35,6 +35,7 @@ public PullRequestReviewComment(string url, int id, string nodeId, string diffHu
PullRequestUrl = pullRequestUrl;
Reactions = reactions;
InReplyToId = inReplyToId;
AuthorAssociation = authorAssociation;
}

/// <summary>
Expand Down Expand Up @@ -127,6 +128,11 @@ public PullRequestReviewComment(string url, int id, string nodeId, string diffHu
/// </summary>
public int? PullRequestReviewId { get; protected set; }

/// <summary>
/// The comment author association with repository.
/// </summary>
public StringEnum<AuthorAssociation> AuthorAssociation { get; protected set; }

internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}, Path: {1}, User: {2}, Url: {3}", Id, Path, User.DebuggerDisplay, Url); }
Expand Down

0 comments on commit eb9c112

Please sign in to comment.