mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Adding a convention test to detect whether a model has a constructor exposing all properties (#1798)
* Added a convention test to detect a model constructor exposing all properties * add ctors to classes where they are missing * rename ctor parameters that dont match properties * add missing parameters to existing ctors * add specific PunchCard ctor to allow mocking, and update test to resolve call ambiguity * Added base class properties to the convention test Added member exclusion attribute * Updated newly offending classes 2 excludes and 2 ctors * rename exclusion attribute to be a bit shorter
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Octokit.Tests.Conventions
|
||||
{
|
||||
public class MissingPublicConstructorWithAllPropertiesException : Exception
|
||||
{
|
||||
public MissingPublicConstructorWithAllPropertiesException(Type modelType, IEnumerable<PropertyInfo> missingProperties)
|
||||
: base(CreateMessage(modelType, missingProperties))
|
||||
{ }
|
||||
|
||||
private static string CreateMessage(Type modelType, IEnumerable<PropertyInfo> missingProperties)
|
||||
{
|
||||
return string.Format("Model type '{0}' is missing a constructor with all properties. Closest match is missing the following properties: {1}{2}",
|
||||
modelType.FullName,
|
||||
Environment.NewLine,
|
||||
string.Join(Environment.NewLine, missingProperties.Select(prop => prop.Name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,42 @@ namespace Octokit.Tests.Conventions
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(ResponseModelTypes))]
|
||||
public void AllResponseModelsHavePublicCtorWithAllProperties(Type modelType)
|
||||
{
|
||||
var excludedProperties = modelType.GetCustomAttribute<ExcludeFromCtorWithAllPropertiesConventionTestAttribute>()?
|
||||
.Properties ??
|
||||
new string[] { };
|
||||
|
||||
var constructors = modelType.GetConstructors();
|
||||
var properties = modelType.GetProperties()
|
||||
.Where(prop => prop.CanWrite &&
|
||||
!excludedProperties.Contains(prop.Name))
|
||||
.ToList();
|
||||
|
||||
var missingProperties = properties.ToList();
|
||||
foreach (var constructor in constructors)
|
||||
{
|
||||
var parameters = constructor.GetParameters();
|
||||
|
||||
var constructorMissingProperties = properties.Where(property =>
|
||||
!parameters.Any(param =>
|
||||
string.Equals(param.Name, property.Name, StringComparison.InvariantCultureIgnoreCase)))
|
||||
.ToList();
|
||||
|
||||
if (constructorMissingProperties.Count < missingProperties.Count)
|
||||
{
|
||||
missingProperties = constructorMissingProperties;
|
||||
}
|
||||
}
|
||||
|
||||
if (missingProperties.Any())
|
||||
{
|
||||
throw new MissingPublicConstructorWithAllPropertiesException(modelType, missingProperties);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(ResponseModelTypes))]
|
||||
public void ResponseModelsHaveGetterOnlyProperties(Type modelType)
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Octokit.Tests.Clients
|
||||
"secret",
|
||||
Arg.Any<NewAuthorization>(),
|
||||
"two-factor-code")
|
||||
.Returns(Task.Factory.StartNew(() => new ApplicationAuthorization("xyz")));
|
||||
.Returns(Task.Factory.StartNew(() => new ApplicationAuthorization(0, null, null, null, null, null, null, null, DateTimeOffset.Now, DateTimeOffset.Now, null, "xyz")));
|
||||
|
||||
var result = await client.GetOrCreateApplicationAuthentication("clientId",
|
||||
"secret",
|
||||
@@ -204,7 +204,7 @@ namespace Octokit.Tests.Clients
|
||||
"secret",
|
||||
Arg.Any<NewAuthorization>(),
|
||||
"two-factor-code")
|
||||
.Returns(Task.Factory.StartNew(() => new ApplicationAuthorization("OAUTHSECRET")));
|
||||
.Returns(Task.Factory.StartNew(() => new ApplicationAuthorization(0, null, null, null, null, null, null, null, DateTimeOffset.Now, DateTimeOffset.Now, null, "OAUTHSECRET")));
|
||||
|
||||
var result = await client.GetOrCreateApplicationAuthentication("clientId",
|
||||
"secret",
|
||||
|
||||
@@ -11,7 +11,7 @@ public class PunchCardTests
|
||||
[Fact]
|
||||
public void ThrowsExceptionWithNullPunchCardPoints()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new PunchCard(null));
|
||||
Assert.Throws<ArgumentNullException>(() => new PunchCard((IEnumerable<IList<int>>)null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
@@ -16,7 +17,7 @@ namespace Octokit.Tests.Reactive
|
||||
{
|
||||
var firstResponse = new TwoFactorRequiredException(TwoFactorType.AuthenticatorApp);
|
||||
var twoFactorChallengeResult = new TwoFactorChallengeResult("two-factor-code");
|
||||
var secondResponse = new ApplicationAuthorization("OAUTHSECRET");
|
||||
var secondResponse = new ApplicationAuthorization(0, null, null, null, null, null, null, null, DateTimeOffset.Now, DateTimeOffset.Now, null, "OAUTHSECRET");
|
||||
|
||||
var client = Substitute.For<IObservableAuthorizationsClient>();
|
||||
client.GetOrCreateApplicationAuthentication(Args.String, Args.String, Args.NewAuthorization)
|
||||
@@ -51,7 +52,7 @@ namespace Octokit.Tests.Reactive
|
||||
TwoFactorChallengeResult.RequestResendCode,
|
||||
new TwoFactorChallengeResult("two-factor-code")
|
||||
});
|
||||
var secondResponse = new ApplicationAuthorization("OAUTHSECRET");
|
||||
var secondResponse = new ApplicationAuthorization(0, null, null, null, null, null, null, null, DateTimeOffset.Now, DateTimeOffset.Now, null, "OAUTHSECRET");
|
||||
|
||||
var client = Substitute.For<IObservableAuthorizationsClient>();
|
||||
client.GetOrCreateApplicationAuthentication(Args.String, Args.String, Args.NewAuthorization)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public sealed class ExcludeFromCtorWithAllPropertiesConventionTestAttribute : Attribute
|
||||
{
|
||||
public ExcludeFromCtorWithAllPropertiesConventionTestAttribute(params string[] properties)
|
||||
{
|
||||
Properties = properties;
|
||||
}
|
||||
|
||||
public string[] Properties { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -32,15 +32,15 @@ namespace Octokit
|
||||
ResetAsUtcEpochSeconds = GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Reset");
|
||||
}
|
||||
|
||||
public RateLimit(int limit, int remaining, long reset)
|
||||
public RateLimit(int limit, int remaining, long resetAsUtcEpochSeconds)
|
||||
{
|
||||
Ensure.ArgumentNotNull(limit, nameof(limit));
|
||||
Ensure.ArgumentNotNull(remaining, nameof(remaining));
|
||||
Ensure.ArgumentNotNull(reset, nameof(reset));
|
||||
Ensure.ArgumentNotNull(resetAsUtcEpochSeconds, nameof(resetAsUtcEpochSeconds));
|
||||
|
||||
Limit = limit;
|
||||
Remaining = remaining;
|
||||
ResetAsUtcEpochSeconds = reset;
|
||||
ResetAsUtcEpochSeconds = resetAsUtcEpochSeconds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Octokit
|
||||
{
|
||||
public Activity() { }
|
||||
|
||||
public Activity(string type, bool @public, Repository repo, User actor, Organization org, DateTimeOffset createdAt, string id)
|
||||
public Activity(string type, bool @public, Repository repo, User actor, Organization org, DateTimeOffset createdAt, string id, ActivityPayload payload)
|
||||
{
|
||||
Type = type;
|
||||
Public = @public;
|
||||
@@ -22,6 +22,7 @@ namespace Octokit
|
||||
Org = org;
|
||||
CreatedAt = createdAt;
|
||||
Id = id;
|
||||
Payload = payload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,16 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class ActivityPayload
|
||||
{
|
||||
public ActivityPayload() { }
|
||||
|
||||
|
||||
public ActivityPayload(Repository repository, User sender, InstallationId installation)
|
||||
{
|
||||
Repository = repository;
|
||||
Sender = sender;
|
||||
Installation = installation;
|
||||
}
|
||||
|
||||
public Repository Repository { get; protected set; }
|
||||
public User Sender { get; protected set; }
|
||||
public InstallationId Installation { get; protected set; }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Octokit
|
||||
@@ -13,7 +14,8 @@ namespace Octokit
|
||||
{
|
||||
}
|
||||
|
||||
public ApplicationAuthorization(string token)
|
||||
public ApplicationAuthorization(int id, string url, Application application, string tokenLastEight, string hashedToken, string fingerprint, string note, string noteUrl, DateTimeOffset createdAt, DateTimeOffset updateAt, string[] scopes, string token)
|
||||
: base(id, url, application, tokenLastEight, hashedToken, fingerprint, note, noteUrl, createdAt, updateAt, scopes)
|
||||
{
|
||||
Token = token;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Octokit
|
||||
// TODO: I'd love to not need this
|
||||
public Authorization() { }
|
||||
|
||||
public Authorization(int id, string url, Application application, string note, string noteUrl, DateTimeOffset createdAt, DateTimeOffset updateAt, string[] scopes)
|
||||
public Authorization(int id, string url, Application application, string tokenLastEight, string hashedToken, string fingerprint, string note, string noteUrl, DateTimeOffset createdAt, DateTimeOffset updateAt, string[] scopes)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -22,6 +22,9 @@ namespace Octokit
|
||||
|
||||
// TODO: testable ctor for new values
|
||||
//Token = token;
|
||||
TokenLastEight = tokenLastEight;
|
||||
HashedToken = hashedToken;
|
||||
Fingerprint = fingerprint;
|
||||
|
||||
Note = note;
|
||||
NoteUrl = noteUrl;
|
||||
|
||||
@@ -165,6 +165,13 @@ namespace Octokit
|
||||
{
|
||||
public BranchProtectionRequiredReviews() { }
|
||||
|
||||
public BranchProtectionRequiredReviews(BranchProtectionRequiredReviewsDismissalRestrictions dismissalRestrictions, bool dismissStaleReviews, bool requireCodeOwnerReviews)
|
||||
{
|
||||
DismissalRestrictions = dismissalRestrictions;
|
||||
DismissStaleReviews = dismissStaleReviews;
|
||||
RequireCodeOwnerReviews = requireCodeOwnerReviews;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specify which users and teams can dismiss pull request reviews.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,6 +5,14 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class CollaboratorPermission
|
||||
{
|
||||
public CollaboratorPermission() { }
|
||||
|
||||
public CollaboratorPermission(PermissionLevel permission, User user)
|
||||
{
|
||||
Permission = permission;
|
||||
User = user;
|
||||
}
|
||||
|
||||
public StringEnum<PermissionLevel> Permission { get; protected set; }
|
||||
public User User { get; protected set; }
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Octokit
|
||||
{
|
||||
public Commit() { }
|
||||
|
||||
public Commit(string url, string label, string @ref, string sha, User user, Repository repository, string message, Committer author, Committer committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount)
|
||||
public Commit(string url, string label, string @ref, string sha, User user, Repository repository, string message, Committer author, Committer committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount, Verification verification)
|
||||
: base(url, label, @ref, sha, user, repository)
|
||||
{
|
||||
Ensure.ArgumentNotNull(parents, nameof(parents));
|
||||
@@ -21,6 +21,7 @@ namespace Octokit
|
||||
Tree = tree;
|
||||
Parents = new ReadOnlyCollection<GitReference>(parents.ToList());
|
||||
CommentCount = commentCount;
|
||||
Verification = verification;
|
||||
}
|
||||
|
||||
public string Message { get; protected set; }
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Octokit
|
||||
{
|
||||
public CommitComment() { }
|
||||
|
||||
public CommitComment(int id, string url, string htmlUrl, string body, string path, int position, int? line, string commitId, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
|
||||
public CommitComment(int id, string url, string htmlUrl, string body, string path, int position, int? line, string commitId, User user, DateTimeOffset createdAt, DateTimeOffset? updatedAt, ReactionSummary reactions)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -22,6 +22,7 @@ namespace Octokit
|
||||
User = user;
|
||||
CreatedAt = createdAt;
|
||||
UpdatedAt = updatedAt;
|
||||
Reactions = reactions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,6 +80,9 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public DateTimeOffset? UpdatedAt { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The reaction summary for this comment.
|
||||
/// </summary>
|
||||
public ReactionSummary Reactions { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Octokit
|
||||
{
|
||||
public Deployment() { }
|
||||
|
||||
public Deployment(int id, string sha, string url, User creator, IReadOnlyDictionary<string, string> payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl)
|
||||
public Deployment(int id, string sha, string url, User creator, IReadOnlyDictionary<string, string> payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl, bool transientEnvironment, bool productionEnvironment)
|
||||
{
|
||||
Id = id;
|
||||
Sha = sha;
|
||||
@@ -24,6 +24,8 @@ namespace Octokit
|
||||
UpdatedAt = updatedAt;
|
||||
Description = description;
|
||||
StatusesUrl = statusesUrl;
|
||||
TransientEnvironment = transientEnvironment;
|
||||
ProductionEnvironment = productionEnvironment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Octokit
|
||||
{
|
||||
public DeploymentStatus() { }
|
||||
|
||||
public DeploymentStatus(int id, string url, DeploymentState state, User creator, IReadOnlyDictionary<string, string> payload, string targetUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description)
|
||||
public DeploymentStatus(int id, string url, DeploymentState state, User creator, IReadOnlyDictionary<string, string> payload, string targetUrl, string logUrl, string environmentUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -19,6 +19,8 @@ namespace Octokit
|
||||
Creator = creator;
|
||||
Payload = payload;
|
||||
TargetUrl = targetUrl;
|
||||
LogUrl = logUrl;
|
||||
EnvironmentUrl = environmentUrl;
|
||||
CreatedAt = createdAt;
|
||||
UpdatedAt = updatedAt;
|
||||
Description = description;
|
||||
|
||||
@@ -7,13 +7,14 @@ namespace Octokit
|
||||
{
|
||||
public GitTag() { }
|
||||
|
||||
public GitTag(string url, string label, string @ref, string sha, User user, Repository repository, string tag, string message, Committer tagger, TagObject objectVar)
|
||||
public GitTag(string url, string label, string @ref, string sha, User user, Repository repository, string tag, string message, Committer tagger, TagObject @object, Verification verification)
|
||||
: base(url, label, @ref, sha, user, repository)
|
||||
{
|
||||
Tag = tag;
|
||||
Message = message;
|
||||
Tagger = tagger;
|
||||
Object = objectVar;
|
||||
Object = @object;
|
||||
Verification = verification;
|
||||
}
|
||||
|
||||
public string Tag { get; protected set; }
|
||||
|
||||
@@ -10,6 +10,24 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class GpgKey
|
||||
{
|
||||
public GpgKey() { }
|
||||
|
||||
public GpgKey(int id, int? primaryKeyId, string keyId, string publicKey, IReadOnlyList<EmailAddress> emails, IReadOnlyList<GpgKey> subkeys, bool canSign, bool canEncryptCommunications, bool canEncryptStorage, bool canCertify, DateTimeOffset createdAt, DateTimeOffset? expiresAt)
|
||||
{
|
||||
Id = id;
|
||||
PrimaryKeyId = primaryKeyId;
|
||||
KeyId = keyId;
|
||||
PublicKey = publicKey;
|
||||
Emails = emails;
|
||||
Subkeys = subkeys;
|
||||
CanSign = canSign;
|
||||
CanEncryptCommunications = canEncryptCommunications;
|
||||
CanEncryptStorage = canEncryptStorage;
|
||||
CanCertify = canCertify;
|
||||
CreatedAt = createdAt;
|
||||
ExpiresAt = expiresAt;
|
||||
}
|
||||
|
||||
public int Id { get; protected set; }
|
||||
public int? PrimaryKeyId { get; protected set; }
|
||||
public string KeyId { get; protected set; }
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Octokit
|
||||
{
|
||||
public Issue() { }
|
||||
|
||||
public Issue(string url, string htmlUrl, string commentsUrl, string eventsUrl, int number, ItemState state, string title, string body, User closedBy, User user, IReadOnlyList<Label> labels, User assignee, IReadOnlyList<User> assignees, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt, int id, bool locked, Repository repository)
|
||||
public Issue(string url, string htmlUrl, string commentsUrl, string eventsUrl, int number, ItemState state, string title, string body, User closedBy, User user, IReadOnlyList<Label> labels, User assignee, IReadOnlyList<User> assignees, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt, int id, bool locked, Repository repository, ReactionSummary reactions)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -35,6 +35,7 @@ namespace Octokit
|
||||
UpdatedAt = updatedAt;
|
||||
Locked = locked;
|
||||
Repository = repository;
|
||||
Reactions = reactions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -144,6 +145,9 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public Repository Repository { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The reaction summary for this issue.
|
||||
/// </summary>
|
||||
public ReactionSummary Reactions { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Octokit
|
||||
{
|
||||
public IssueComment() { }
|
||||
|
||||
public IssueComment(int id, string url, string htmlUrl, string body, DateTimeOffset createdAt, DateTimeOffset? updatedAt, User user)
|
||||
public IssueComment(int id, string url, string htmlUrl, string body, DateTimeOffset createdAt, DateTimeOffset? updatedAt, User user, ReactionSummary reactions)
|
||||
{
|
||||
Id = id;
|
||||
Url = url;
|
||||
@@ -19,6 +19,7 @@ namespace Octokit
|
||||
CreatedAt = createdAt;
|
||||
UpdatedAt = updatedAt;
|
||||
User = user;
|
||||
Reactions = reactions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -56,6 +57,9 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public User User { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The reaction summary for this comment.
|
||||
/// </summary>
|
||||
public ReactionSummary Reactions { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace Octokit
|
||||
{
|
||||
public Merge() { }
|
||||
|
||||
public Merge(Author author, Author committer, Commit commit, IEnumerable<GitReference> parents, string commentsUrl, int commentCount, string htmlUrl)
|
||||
public Merge(string url, string label, string @ref, string sha, User user, Repository repository, Author author, Author committer, Commit commit, IEnumerable<GitReference> parents, string commentsUrl, int commentCount, string htmlUrl)
|
||||
: base(url, label, @ref, sha, user, repository)
|
||||
{
|
||||
Ensure.ArgumentNotNull(parents, nameof(parents));
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Globalization;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
[ExcludeFromCtorWithAllPropertiesConventionTest(nameof(Type))]
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class Organization : Account
|
||||
{
|
||||
|
||||
@@ -48,9 +48,10 @@ namespace Octokit
|
||||
public Page() { }
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "cname")]
|
||||
public Page(string url, PagesBuildStatus status, string cname, bool custom404)
|
||||
public Page(string url, string htmlUrl, PagesBuildStatus status, string cname, bool custom404)
|
||||
{
|
||||
Url = url;
|
||||
HtmlUrl = htmlUrl;
|
||||
Status = status;
|
||||
CName = cname;
|
||||
Custom404 = custom404;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Octokit
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public PullRequestReviewComment(string url, int id, string diffHunk, string path, int? position, int? originalPosition, string commitId, string originalCommitId, User user, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, string htmlUrl, string pullRequestUrl, int? inReplyToId, int? pullRequestReviewId)
|
||||
public PullRequestReviewComment(string url, int id, 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)
|
||||
{
|
||||
PullRequestReviewId = pullRequestReviewId;
|
||||
Url = url;
|
||||
@@ -32,6 +32,7 @@ namespace Octokit
|
||||
UpdatedAt = updatedAt;
|
||||
HtmlUrl = htmlUrl;
|
||||
PullRequestUrl = pullRequestUrl;
|
||||
Reactions = reactions;
|
||||
InReplyToId = inReplyToId;
|
||||
}
|
||||
|
||||
@@ -105,6 +106,9 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public string PullRequestUrl { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The reaction summary for this comment.
|
||||
/// </summary>
|
||||
public ReactionSummary Reactions { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,6 +19,11 @@ namespace Octokit
|
||||
punchCardData.Select(point => new PunchCardPoint(point)).ToList());
|
||||
}
|
||||
|
||||
public PunchCard(IEnumerable<PunchCardPoint> punchPoints)
|
||||
{
|
||||
PunchPoints = punchPoints?.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The raw punch card points
|
||||
/// </summary>
|
||||
|
||||
@@ -7,6 +7,20 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class ReactionSummary
|
||||
{
|
||||
public ReactionSummary() { }
|
||||
|
||||
public ReactionSummary(int totalCount, int plus1, int minus1, int laugh, int confused, int heart, int hooray, string url)
|
||||
{
|
||||
TotalCount = totalCount;
|
||||
Plus1 = plus1;
|
||||
Minus1 = minus1;
|
||||
Laugh = laugh;
|
||||
Confused = confused;
|
||||
Heart = heart;
|
||||
Hooray = hooray;
|
||||
Url = url;
|
||||
}
|
||||
|
||||
public int TotalCount { get; protected set; }
|
||||
[Parameter(Key = "+1")]
|
||||
public int Plus1 { get; protected set; }
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Octokit
|
||||
{
|
||||
public Reference() { }
|
||||
|
||||
public Reference(string @ref, string url, TagObject objectVar)
|
||||
public Reference(string @ref, string url, TagObject @object)
|
||||
{
|
||||
Ref = @ref;
|
||||
Url = url;
|
||||
Object = objectVar;
|
||||
Object = @object;
|
||||
}
|
||||
|
||||
public string Ref { get; protected set; }
|
||||
|
||||
@@ -6,6 +6,14 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class RenameInfo
|
||||
{
|
||||
public RenameInfo() { }
|
||||
|
||||
public RenameInfo(string from, string to)
|
||||
{
|
||||
From = from;
|
||||
To = to;
|
||||
}
|
||||
|
||||
public string From { get; protected set; }
|
||||
public string To { get; protected set; }
|
||||
|
||||
|
||||
@@ -6,6 +6,16 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SourceInfo
|
||||
{
|
||||
public SourceInfo() { }
|
||||
|
||||
public SourceInfo(User actor, int id, Issue issue, string url)
|
||||
{
|
||||
Actor = actor;
|
||||
Id = id;
|
||||
Issue = issue;
|
||||
Url = url;
|
||||
}
|
||||
|
||||
public User Actor { get; protected set; }
|
||||
public int Id { get; protected set; }
|
||||
public Issue Issue { get; protected set; }
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Octokit
|
||||
{
|
||||
public Team() { }
|
||||
|
||||
public Team(string url, int id, string name, string description, TeamPrivacy privacy, Permission permission, int membersCount, int reposCount, Organization organization, string ldapDistinguishedName)
|
||||
public Team(string url, int id, string name, string description, TeamPrivacy privacy, Permission permission, int membersCount, int reposCount, Organization organization, Team parent, string ldapDistinguishedName)
|
||||
{
|
||||
Url = url;
|
||||
Id = id;
|
||||
@@ -23,6 +23,7 @@ namespace Octokit
|
||||
MembersCount = membersCount;
|
||||
ReposCount = reposCount;
|
||||
Organization = organization;
|
||||
Parent = parent;
|
||||
LdapDistinguishedName = ldapDistinguishedName;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class TeamMembershipDetails
|
||||
{
|
||||
public TeamMembershipDetails() { }
|
||||
|
||||
public TeamMembershipDetails(TeamRole role, MembershipState state)
|
||||
{
|
||||
Role = role;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public StringEnum<TeamRole> Role { get; protected set; }
|
||||
|
||||
public StringEnum<MembershipState> State { get; protected set; }
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Octokit
|
||||
/// <summary>
|
||||
/// Represents a user on GitHub.
|
||||
/// </summary>
|
||||
[ExcludeFromCtorWithAllPropertiesConventionTest(nameof(Type))]
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class User : Account
|
||||
{
|
||||
|
||||
@@ -10,6 +10,16 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class Verification
|
||||
{
|
||||
public Verification() { }
|
||||
|
||||
public Verification(bool verified, VerificationReason reason, string signature, string payload)
|
||||
{
|
||||
Verified = verified;
|
||||
Reason = reason;
|
||||
Signature = signature;
|
||||
Payload = payload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does GitHub consider the signature in this commit to be verified?
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user