Files
octokit.net/Octokit/Models/Response/GpgKey.cs
tasadar2 3345f76fc9 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
2018-04-25 21:03:13 +10:00

51 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpg")]
[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; }
public string PublicKey { get; protected set; }
public IReadOnlyList<EmailAddress> Emails { get; protected set; }
public IReadOnlyList<GpgKey> Subkeys { get; protected set; }
public bool CanSign { get; protected set; }
[Parameter(Key = "can_encrypt_comms")]
public bool CanEncryptCommunications { get; protected set; }
public bool CanEncryptStorage { get; protected set; }
public bool CanCertify { get; protected set; }
public DateTimeOffset CreatedAt { get; protected set; }
public DateTimeOffset? ExpiresAt { get; protected set; }
internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} Key: {1}", Id, PublicKey); }
}
}
}