diff --git a/Octokit.Tests/Clients/ReleasesClientTests.cs b/Octokit.Tests/Clients/ReleasesClientTests.cs index 63684bb7..23478b5f 100644 --- a/Octokit.Tests/Clients/ReleasesClientTests.cs +++ b/Octokit.Tests/Clients/ReleasesClientTests.cs @@ -179,7 +179,7 @@ namespace Octokit.Tests.Clients { var client = Substitute.For(); var releasesClient = new ReleasesClient(client); - var release = new Release { UploadUrl = "https://uploads.test.dev/does/not/matter/releases/1/assets{?name}" }; + var release = new Release("https://uploads.test.dev/does/not/matter/releases/1/assets{?name}"); var rawData = Substitute.For(); var upload = new ReleaseAssetUpload { FileName = "example.zip", ContentType = "application/zip", RawData = rawData }; @@ -197,7 +197,7 @@ namespace Octokit.Tests.Clients { var releasesClient = new ReleasesClient(Substitute.For()); - var release = new Release { UploadUrl = "https://uploads.github.com/anything" }; + var release = new Release("https://uploads.github.com/anything"); var uploadData = new ReleaseAssetUpload { FileName = "good", ContentType = "good/good", RawData = Stream.Null }; await AssertEx.Throws(async () => await releasesClient.UploadAsset(null, uploadData)); await AssertEx.Throws(async () => await releasesClient.UploadAsset(release, null)); @@ -212,7 +212,7 @@ namespace Octokit.Tests.Clients var fixture = new ReleasesClient(apiConnection); - var release = new Release { UploadUrl = "https://uploads.github.com/anything" }; + var release = new Release("https://uploads.github.com/anything"); var uploadData = new ReleaseAssetUpload { FileName = "good", ContentType = "good/good", RawData = Stream.Null, Timeout = newTimeout }; await fixture.UploadAsset(release, uploadData); diff --git a/Octokit.Tests/Models/ModelExtensionsTests.cs b/Octokit.Tests/Models/ModelExtensionsTests.cs index 0b254915..3c78a024 100644 --- a/Octokit.Tests/Models/ModelExtensionsTests.cs +++ b/Octokit.Tests/Models/ModelExtensionsTests.cs @@ -14,7 +14,7 @@ namespace Octokit.Tests.Models [InlineData("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "AAAAB3NzaC1yc2EAAAABIwAA", "")] public void CanParseKeyData(string raw, string data, string name) { - var key = new SshKey { Key = raw }; + var key = new SshKey(raw); SshKeyInfo keyInfo = key.GetKeyDataAndName(); Assert.Equal(data, keyInfo.Data); @@ -27,7 +27,7 @@ namespace Octokit.Tests.Models [InlineData("apsdfoihat")] public void ParsingBadDataReturnsNull(string key) { - Assert.Null(new SshKey { Key = key }.GetKeyDataAndName()); + Assert.Null(new SshKey(key).GetKeyDataAndName()); } } @@ -36,8 +36,8 @@ namespace Octokit.Tests.Models [Fact] public void ReturnsTrueWhenTwoKeysHaveTheSameData() { - var key = new SshKey { Key = "ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", Title = "somekey" }; - var anotherKey = new SshKey { Key = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA", Title = "whatever" }; + var key = new SshKey("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "somekey"); + var anotherKey = new SshKey("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAA", "whatever"); Assert.True(key.HasSameDataAs(anotherKey)); } @@ -45,7 +45,7 @@ namespace Octokit.Tests.Models [Fact] public void ReturnsFalseWhenCompareKeyIsNull() { - var key = new SshKey { Key = "ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", Title = "somekey" }; + var key = new SshKey("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "somekey"); Assert.False(key.HasSameDataAs(null)); } @@ -56,8 +56,8 @@ namespace Octokit.Tests.Models [InlineData("ssh-dsa AAAAB3NzaC1yc2EAAAABIwAA", "ssh-dsa AAAAB3NzaC1yc2EAAAABIwAB")] public void ReturnsFalseWhenTwoKeysHaveDifferentData(string firstKey, string secondKey) { - var key = new SshKey { Key = firstKey, Title = "somekey" }; - var anotherKey = new SshKey { Key = secondKey, Title = "whatever" }; + var key = new SshKey(firstKey, "somekey"); + var anotherKey = new SshKey(secondKey, "whatever"); Assert.False(key.HasSameDataAs(anotherKey)); } diff --git a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs index 62fd5721..e55b6087 100644 --- a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs @@ -49,9 +49,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 1}, - new Milestone {Number = 2}, - new Milestone {Number = 3}, + new Milestone(1), + new Milestone(2), + new Milestone(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -61,9 +61,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 4}, - new Milestone {Number = 5}, - new Milestone {Number = 6}, + new Milestone(4), + new Milestone(5), + new Milestone(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -71,7 +71,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 7}, + new Milestone(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; @@ -102,9 +102,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 1}, - new Milestone {Number = 2}, - new Milestone {Number = 3}, + new Milestone(1), + new Milestone(2), + new Milestone(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -114,9 +114,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 4}, - new Milestone {Number = 5}, - new Milestone {Number = 6}, + new Milestone(4), + new Milestone(5), + new Milestone(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -124,7 +124,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Milestone {Number = 7}, + new Milestone(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs index 83c598e5..7cb99ae8 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs @@ -29,9 +29,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -41,9 +41,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -51,7 +51,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 7} + new PullRequestReviewComment(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; @@ -101,9 +101,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -113,9 +113,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -123,8 +123,8 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 7}, - new PullRequestReviewComment {Id = 8}, + new PullRequestReviewComment(7), + new PullRequestReviewComment(8) }, ApiInfo = CreateApiInfo(new Dictionary()) }; @@ -173,9 +173,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -185,9 +185,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -195,8 +195,8 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequestReviewComment {Id = 7}, - new PullRequestReviewComment {Id = 8}, + new PullRequestReviewComment(7), + new PullRequestReviewComment(8) }, ApiInfo = CreateApiInfo(new Dictionary()) }; diff --git a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs index 36c2b80a..b4c198ca 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs @@ -49,9 +49,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 1}, - new PullRequest {Number = 2}, - new PullRequest {Number = 3}, + new PullRequest(1), + new PullRequest(2), + new PullRequest(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -61,9 +61,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 4}, - new PullRequest {Number = 5}, - new PullRequest {Number = 6}, + new PullRequest(4), + new PullRequest(5), + new PullRequest(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -71,7 +71,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 7}, + new PullRequest(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; @@ -102,9 +102,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 1}, - new PullRequest {Number = 2}, - new PullRequest {Number = 3}, + new PullRequest(1), + new PullRequest(2), + new PullRequest(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -114,9 +114,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 4}, - new PullRequest {Number = 5}, - new PullRequest {Number = 6}, + new PullRequest(4), + new PullRequest(5), + new PullRequest(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -124,7 +124,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new PullRequest {Number = 7}, + new PullRequest(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; diff --git a/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs b/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs index e43f6445..8acd5a0a 100644 --- a/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableReleasesClientTests.cs @@ -180,7 +180,7 @@ namespace Octokit.Tests.Reactive { var gitHubClient = Substitute.For(); var releasesClient = new ObservableReleasesClient(gitHubClient); - var release = new Release { UploadUrl = "https://uploads.test.dev/does/not/matter/releases/1/assets{?name}" }; + var release = new Release("https://uploads.test.dev/does/not/matter/releases/1/assets{?name}"); var rawData = Substitute.For(); var upload = new ReleaseAssetUpload { FileName = "example.zip", ContentType = "application/zip", RawData = rawData }; @@ -194,7 +194,7 @@ namespace Octokit.Tests.Reactive { var releasesClient = new ObservableReleasesClient(Substitute.For()); - var release = new Release { UploadUrl = "https://uploads.github.com/anything" }; + var release = new Release("https://uploads.github.com/anything"); var uploadData = new ReleaseAssetUpload { FileName = "good", ContentType = "good/good", RawData = Stream.Null }; Assert.Throws(() => releasesClient.UploadAsset(null, uploadData)); diff --git a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs index fd2ba49b..4f0ec7d8 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -52,9 +52,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 1}, - new Repository {Id = 2}, - new Repository {Id = 3} + new Repository(1), + new Repository(2), + new Repository(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -64,9 +64,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 4}, - new Repository {Id = 5}, - new Repository {Id = 6} + new Repository(4), + new Repository(5), + new Repository(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -74,7 +74,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 7} + new Repository(7) }, ApiInfo = CreateApiInfo(new Dictionary()) }; @@ -105,9 +105,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 1}, - new Repository {Id = 2}, - new Repository {Id = 3} + new Repository(1), + new Repository(2), + new Repository(3) }, ApiInfo = CreateApiInfo(firstPageLinks) }; @@ -117,9 +117,9 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 4}, - new Repository {Id = 5}, - new Repository {Id = 6} + new Repository(4), + new Repository(5), + new Repository(6) }, ApiInfo = CreateApiInfo(secondPageLinks) }; @@ -129,7 +129,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 7} + new Repository(7) }, ApiInfo = CreateApiInfo(thirdPageLinks) }; @@ -137,7 +137,7 @@ namespace Octokit.Tests.Reactive { BodyAsObject = new List { - new Repository {Id = 8} + new Repository(8) }, ApiInfo = CreateApiInfo(new Dictionary()) }; diff --git a/Octokit/Models/Request/RepositoryUpdate.cs b/Octokit/Models/Request/RepositoryUpdate.cs index ab9ee632..56443e38 100644 --- a/Octokit/Models/Request/RepositoryUpdate.cs +++ b/Octokit/Models/Request/RepositoryUpdate.cs @@ -47,7 +47,7 @@ namespace Octokit public string DefaultBranch { get; set; } [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private string DebuggerDisplay + internal string DebuggerDisplay { get { return String.Format(CultureInfo.CurrentCulture, "RepositoryUpdate: Name: {0}", Name); } } diff --git a/Octokit/Models/Response/Commit.cs b/Octokit/Models/Response/Commit.cs index 0a5f3b5d..00232f91 100644 --- a/Octokit/Models/Response/Commit.cs +++ b/Octokit/Models/Response/Commit.cs @@ -7,10 +7,15 @@ namespace Octokit public class Commit : GitReference { public string Message { get; protected set; } + public SignatureResponse Author { get; protected set; } + public SignatureResponse Committer { get; protected set; } + public GitReference Tree { get; protected set; } + public IEnumerable Parents { get; protected set; } + public int CommentCount { get; protected set; } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/DeploymentStatus.cs b/Octokit/Models/Response/DeploymentStatus.cs index 1a14a094..24fa8a21 100644 --- a/Octokit/Models/Response/DeploymentStatus.cs +++ b/Octokit/Models/Response/DeploymentStatus.cs @@ -53,7 +53,7 @@ namespace Octokit /// /// A short description of the status. /// - public string Description { get; set; } + public string Description { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/EmailAddress.cs b/Octokit/Models/Response/EmailAddress.cs index b053240a..e2ec83b4 100644 --- a/Octokit/Models/Response/EmailAddress.cs +++ b/Octokit/Models/Response/EmailAddress.cs @@ -14,21 +14,21 @@ namespace Octokit /// /// The email address /// - public string Email { get; set; } + public string Email { get; protected set; } /// /// true if the email is verified; otherwise false /// - public bool Verified { get; set; } + public bool Verified { get; protected set; } /// /// true if this is the users primary email; otherwise false /// - public bool Primary { get; set; } + public bool Primary { get; protected set; } [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="Used by DebuggerDisplayAttribute")] - private string DebuggerDisplay + internal string DebuggerDisplay { get { diff --git a/Octokit/Models/Response/EventInfo.cs b/Octokit/Models/Response/EventInfo.cs index ad406a05..33cf64e9 100644 --- a/Octokit/Models/Response/EventInfo.cs +++ b/Octokit/Models/Response/EventInfo.cs @@ -11,42 +11,42 @@ namespace Octokit /// /// The id of the issue/pull request event. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The URL for this event. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// Always the User that generated the event. /// - public User Actor { get; set; } + public User Actor { get; protected set; } /// /// The user that was assigned, if the event was 'Assigned'. /// - public User Assignee { get; set; } + public User Assignee { get; protected set; } /// /// The label that was assigned, if the event was 'Labeled' /// - public Label Label { get; set; } + public Label Label { get; protected set; } /// /// Identifies the actual type of Event that occurred. /// - public EventInfoState Event { get; set; } + public EventInfoState Event { get; protected set; } /// /// The String SHA of a commit that referenced this Issue. /// - public string CommitId { get; set; } + public string CommitId { get; protected set; } /// /// Date the event occurred for the issue/pull request. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/Feed.cs b/Octokit/Models/Response/Feed.cs index 8a517cc2..bbc85f0e 100644 --- a/Octokit/Models/Response/Feed.cs +++ b/Octokit/Models/Response/Feed.cs @@ -16,38 +16,38 @@ namespace Octokit /// /// The GitHub global public timeline /// - public string TimelineUrl { get; set; } + public string TimelineUrl { get; protected set; } /// /// The public timeline for any user, using URI template /// - public string UserUrl { get; set; } + public string UserUrl { get; protected set; } /// /// The public timeline for the authenticated user /// - public string CurrentUserPublicUrl { get; set; } + public string CurrentUserPublicUrl { get; protected set; } /// /// The private timeline for the authenticated user /// - public string CurrentUserUrl { get; set; } + public string CurrentUserUrl { get; protected set; } /// /// The private timeline for activity created by the authenticated user /// - public string CurrentUserActorUrl { get; set; } + public string CurrentUserActorUrl { get; protected set; } /// /// The private timeline for the authenticated user for a given organization, using URI template /// - public string CurrentUserOrganizationUrl { get; set; } + public string CurrentUserOrganizationUrl { get; protected set; } /// /// List of feed urls including feed url and feed type, e.g. application/atom+xml /// [Parameter(Key = "_links")] - public FeedLinks Links { get; set; } + public FeedLinks Links { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/GistComment.cs b/Octokit/Models/Response/GistComment.cs index fa4ecac1..418fd06b 100644 --- a/Octokit/Models/Response/GistComment.cs +++ b/Octokit/Models/Response/GistComment.cs @@ -10,32 +10,32 @@ namespace Octokit /// /// The gist comment id. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The URL for this gist comment. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The body of this gist comment. - /// - public string Body { get; set; } + /// t + public string Body { get; protected set; } /// /// The user that created this gist comment. /// - public User User { get; set; } + public User User { get; protected set; } /// /// The date this comment was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The date this comment was last updated. /// - public DateTimeOffset? UpdatedAt { get; set; } + public DateTimeOffset? UpdatedAt { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/GitHubCommit.cs b/Octokit/Models/Response/GitHubCommit.cs index 9a7c1fd9..428a9ef9 100644 --- a/Octokit/Models/Response/GitHubCommit.cs +++ b/Octokit/Models/Response/GitHubCommit.cs @@ -9,13 +9,20 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitHubCommit : GitReference { - public Author Author { get; set; } - public string CommentsUrl { get; set; } - public Commit Commit { get; set; } - public Author Committer { get; set; } - public string HtmlUrl { get; set; } - public GitHubCommitStats Stats { get; set; } - public IReadOnlyList Parents { get; set; } - public IReadOnlyList Files { get; set; } + public Author Author { get; protected set; } + + public string CommentsUrl { get; protected set; } + + public Commit Commit { get; protected set; } + + public Author Committer { get; protected set; } + + public string HtmlUrl { get; protected set; } + + public GitHubCommitStats Stats { get; protected set; } + + public IReadOnlyList Parents { get; protected set; } + + public IReadOnlyList Files { get; protected set; } } } diff --git a/Octokit/Models/Response/GitReference.cs b/Octokit/Models/Response/GitReference.cs index 4d513145..9346b5ae 100644 --- a/Octokit/Models/Response/GitReference.cs +++ b/Octokit/Models/Response/GitReference.cs @@ -11,33 +11,33 @@ namespace Octokit /// /// The URL associated with this reference. /// - public string Url { get; set; } + public string Url { get; protected set; } /// /// The reference label. /// - public string Label { get; set; } + public string Label { get; protected set; } /// /// The reference identifier. /// - public string Ref { get; set; } + public string Ref { get; protected set; } /// /// The sha value of the reference. /// - public string Sha { get; set; } + public string Sha { get; protected set; } /// /// The user associated with this reference. /// - public User User { get; set; } + public User User { get; protected set; } /// /// The repository associated with this reference. /// [Parameter(Key = "repo")] - public Repository Repository { get; set; } + public Repository Repository { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/GitTag.cs b/Octokit/Models/Response/GitTag.cs index a80250e7..fde145ef 100644 --- a/Octokit/Models/Response/GitTag.cs +++ b/Octokit/Models/Response/GitTag.cs @@ -5,9 +5,12 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitTag : GitReference { - public string Tag { get; set; } - public string Message { get; set; } - public SignatureResponse Tagger { get; set; } - public TagObject Object { get; set; } + public string Tag { get; protected set; } + + public string Message { get; protected set; } + + public SignatureResponse Tagger { get; protected set; } + + public TagObject Object { get; protected set; } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/IssueComment.cs b/Octokit/Models/Response/IssueComment.cs index a30e3691..6397a3ca 100644 --- a/Octokit/Models/Response/IssueComment.cs +++ b/Octokit/Models/Response/IssueComment.cs @@ -10,44 +10,41 @@ namespace Octokit /// /// The issue comment Id. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The URL for this issue comment. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The html URL for this issue comment. /// - public Uri HtmlUrl { get; set; } + public Uri HtmlUrl { get; protected set; } /// /// Details about the issue comment. /// - public string Body { get; set; } + public string Body { get; protected set; } /// /// The date the issue comment was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The date the issue comment was last updated. /// - public DateTimeOffset? UpdatedAt { get; set; } - + public DateTimeOffset? UpdatedAt { get; protected set; } + /// /// The user that created the issue comment. /// - public User User { get; set; } + public User User { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt); - } + get { return String.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt); } } } } diff --git a/Octokit/Models/Response/IssueEvent.cs b/Octokit/Models/Response/IssueEvent.cs index 3c9a3323..5e86e0fc 100644 --- a/Octokit/Models/Response/IssueEvent.cs +++ b/Octokit/Models/Response/IssueEvent.cs @@ -10,54 +10,51 @@ namespace Octokit /// /// The id of the issue/pull request event. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The URL for this issue/pull request event. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// Always the User that generated the event. /// - public User Actor { get; set; } + public User Actor { get; protected set; } /// /// The user that was assigned, if the event was 'Assigned'. /// - public User Assignee { get; set; } + public User Assignee { get; protected set; } /// /// The label that was assigned, if the event was 'Labeled' /// - public Label Label { get; set; } + public Label Label { get; protected set; } /// /// Identifies the actual type of Event that occurred. /// - public EventInfoState Event { get; set; } + public EventInfoState Event { get; protected set; } /// /// The String SHA of a commit that referenced this Issue. /// - public string CommitId { get; set; } + public string CommitId { get; protected set; } /// /// Date the event occurred for the issue/pull request. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The issue associated to this event. /// - public Issue Issue { get; set; } + public Issue Issue { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt); - } + get { return String.Format(CultureInfo.InvariantCulture, "Id: {0} CreatedAt: {1}", Id, CreatedAt); } } } } diff --git a/Octokit/Models/Response/Label.cs b/Octokit/Models/Response/Label.cs index 15446dc0..ad5515c2 100644 --- a/Octokit/Models/Response/Label.cs +++ b/Octokit/Models/Response/Label.cs @@ -10,24 +10,21 @@ namespace Octokit /// /// Url of the label /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// Name of the label /// - public string Name { get; set; } + public string Name { get; protected set; } /// /// Color of the label /// - public string Color { get; set; } + public string Color { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Name: {0} Color: {1}", Name, Color); - } + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} Color: {1}", Name, Color); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/Milestone.cs b/Octokit/Models/Response/Milestone.cs index b387b8e5..b0781c39 100644 --- a/Octokit/Models/Response/Milestone.cs +++ b/Octokit/Models/Response/Milestone.cs @@ -7,62 +7,68 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Milestone { + public Milestone() + { + } + + public Milestone(int number) + { + Number = number; + } + /// /// The URL for this milestone. /// - public Uri Url { get; set; } - + public Uri Url { get; protected set; } + /// /// The milestone number. /// - public int Number { get; set; } + public int Number { get; protected set; } /// /// Whether the milestone is open or closed. /// - public ItemState State { get; set; } + public ItemState State { get; protected set; } /// /// Title of the milestone /// - public string Title { get; set; } + public string Title { get; protected set; } /// /// Optional description for the milestone. /// - public string Description { get; set; } + public string Description { get; protected set; } /// /// The user that created this milestone. /// - public User Creator { get; set; } - + public User Creator { get; protected set; } + /// /// The number of open issues in this milestone. /// - public int OpenIssues { get; set; } + public int OpenIssues { get; protected set; } /// /// The number of closed issues in this milestone. /// - public int ClosedIssues { get; set; } + public int ClosedIssues { get; protected set; } /// /// The date this milestone was created /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The date, if any, when this milestone is due. /// - public DateTimeOffset? DueOn { get; set; } + public DateTimeOffset? DueOn { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Title {0} ", Title); - } + get { return String.Format(CultureInfo.InvariantCulture, "Title {0} ", Title); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/Notification.cs b/Octokit/Models/Response/Notification.cs index d58c010d..e3fb3b0a 100644 --- a/Octokit/Models/Response/Notification.cs +++ b/Octokit/Models/Response/Notification.cs @@ -7,21 +7,25 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Notification { - public string Id { get; set; } // NB: API currently returns this as string which is Weird - public Repository Repository { get; set; } - public NotificationInfo Subject { get; set; } - public string Reason { get; set; } - public bool Unread { get; set; } - public string UpdatedAt { get; set; } - public string LastReadAt { get; set; } - public string Url { get; set; } + public string Id { get; protected set; } // NB: API currently returns this as string which is Weird + + public Repository Repository { get; protected set; } + + public NotificationInfo Subject { get; protected set; } + + public string Reason { get; protected set; } + + public bool Unread { get; protected set; } + + public string UpdatedAt { get; protected set; } + + public string LastReadAt { get; protected set; } + + public string Url { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Repository: {0} UpdatedAt: {1}", Repository, UpdatedAt); - } + get { return String.Format(CultureInfo.InvariantCulture, "Repository: {0} UpdatedAt: {1}", Repository, UpdatedAt); } } } } diff --git a/Octokit/Models/Response/OauthToken.cs b/Octokit/Models/Response/OauthToken.cs index cf9a0635..d243afe9 100644 --- a/Octokit/Models/Response/OauthToken.cs +++ b/Octokit/Models/Response/OauthToken.cs @@ -11,17 +11,17 @@ namespace Octokit /// /// The type of OAuth token /// - public string TokenType { get; set; } + public string TokenType { get; protected set; } /// /// The secret OAuth access token. Use this to authenticate Octokit.net's client. /// - public string AccessToken { get; set; } + public string AccessToken { get; protected set; } /// /// The list of scopes the token includes. /// - public IReadOnlyList Scope { get; set; } + public IReadOnlyList Scope { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/Organization.cs b/Octokit/Models/Response/Organization.cs index a4e6afd6..32004169 100644 --- a/Octokit/Models/Response/Organization.cs +++ b/Octokit/Models/Response/Organization.cs @@ -11,7 +11,7 @@ namespace Octokit /// The billing address for an organization. This is only returned when updating /// an organization. /// - public string BillingAddress { get; set; } + public string BillingAddress { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/Participation.cs b/Octokit/Models/Response/Participation.cs index b7c68ff1..fba5cdc5 100644 --- a/Octokit/Models/Response/Participation.cs +++ b/Octokit/Models/Response/Participation.cs @@ -15,12 +15,12 @@ namespace Octokit /// /// Returns the commit counts made each week, for the last 52 weeks /// - public IEnumerable All { get; set; } + public IEnumerable All { get; protected set; } /// /// Returns the commit counts made by the owner each week, for the last 52 weeks /// - public IEnumerable Owner { get; set; } + public IEnumerable Owner { get; protected set; } /// /// The total number of commits made by the owner in the last 52 weeks. @@ -58,4 +58,4 @@ namespace Octokit } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/PublicKey.cs b/Octokit/Models/Response/PublicKey.cs index fd50c7f8..96e4bbd6 100644 --- a/Octokit/Models/Response/PublicKey.cs +++ b/Octokit/Models/Response/PublicKey.cs @@ -7,25 +7,23 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class PublicKey { - public int Id { get; set; } - public string Key { get; set; } + public int Id { get; protected set; } + + public string Key { get; protected set; } /// /// Only visible for the current user, or with the correct OAuth scope /// - public string Url { get; set; } + public string Url { get; protected set; } /// /// Only visible for the current user, or with the correct OAuth scope /// - public string Title { get; set; } + public string Title { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "ID: {0} Key: {1}", Id, Key); - } + get { return String.Format(CultureInfo.InvariantCulture, "ID: {0} Key: {1}", Id, Key); } } } } diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index e326bd36..106f204d 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -7,142 +7,148 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class PullRequest { + public PullRequest() + { + } + + public PullRequest(int number) + { + Number = number; + } + /// /// The URL for this pull request. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The URL for the pull request page. /// - public Uri HtmlUrl { get; set; } + public Uri HtmlUrl { get; protected set; } /// /// The URL for the pull request's diff (.diff) file. /// - public Uri DiffUrl { get; set; } + public Uri DiffUrl { get; protected set; } /// /// The URL for the pull request's patch (.patch) file. /// - public Uri PatchUrl { get; set; } + public Uri PatchUrl { get; protected set; } /// /// The URL for the specific pull request issue. /// - public Uri IssueUrl { get; set; } + public Uri IssueUrl { get; protected set; } /// /// The URL for the pull request statuses. /// - public Uri StatusesUrl { get; set; } + public Uri StatusesUrl { get; protected set; } /// /// The pull request number. /// - public int Number { get; set; } + public int Number { get; protected set; } /// /// Whether the pull request is open or closed. The default is . /// - public ItemState State { get; set; } + public ItemState State { get; protected set; } /// /// Title of the pull request. /// - public string Title { get; set; } + public string Title { get; protected set; } /// /// The body (content) contained within the pull request. /// - public string Body { get; set; } + public string Body { get; protected set; } /// /// When the pull request was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// When the pull request was last updated. /// - public DateTimeOffset UpdatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; protected set; } /// /// When the pull request was closed. /// - public DateTimeOffset? ClosedAt { get; set; } + public DateTimeOffset? ClosedAt { get; protected set; } /// /// When the pull request was merged. /// - public DateTimeOffset? MergedAt { get; set; } + public DateTimeOffset? MergedAt { get; protected set; } /// /// The HEAD reference for the pull request. /// - public GitReference Head { get; set; } + public GitReference Head { get; protected set; } /// /// The BASE reference for the pull request. /// - public GitReference Base { get; set; } - + public GitReference Base { get; protected set; } + /// /// The user who created the pull request. /// - public User User { get; set; } + public User User { get; protected set; } /// /// The SHA of the merge commit. /// - public string MergeCommitSha { get; set; } + public string MergeCommitSha { get; protected set; } /// /// Whether or not the pull request has been merged. /// - public bool Merged { get; set; } + public bool Merged { get; protected set; } /// /// Whether or not the pull request can be merged. /// - public bool? Mergeable { get; set; } + public bool? Mergeable { get; protected set; } /// /// The user who merged the pull request. /// - public User MergedBy { get; set; } + public User MergedBy { get; protected set; } /// /// Total number of comments contained in the pull request. /// - public int Comments { get; set; } + public int Comments { get; protected set; } /// /// Total number of commits contained in the pull request. /// - public int Commits { get; set; } + public int Commits { get; protected set; } /// /// Total number of additions contained in the pull request. /// - public int Additions { get; set; } + public int Additions { get; protected set; } /// /// Total number of deletions contained in the pull request. /// - public int Deletions { get; set; } + public int Deletions { get; protected set; } /// /// Total number of files changed in the pull request. /// - public int ChangedFiles { get; set; } + public int ChangedFiles { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Number: {0} State: {1}", Number, State); - } + get { return String.Format(CultureInfo.InvariantCulture, "Number: {0} State: {1}", Number, State); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/PullRequestCommit.cs b/Octokit/Models/Response/PullRequestCommit.cs index 9b5942fe..06e5a7cb 100644 --- a/Octokit/Models/Response/PullRequestCommit.cs +++ b/Octokit/Models/Response/PullRequestCommit.cs @@ -8,14 +8,21 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class PullRequestCommit { - public SignatureResponse Author { get; set; } - public Uri CommentsUrl { get; set; } - public Commit Commit { get; set; } - public SignatureResponse Committer { get; set; } - public Uri HtmlUrl { get; set; } - public IEnumerable Parents { get; set; } - public string Sha { get; set; } - public Uri Url { get; set; } + public SignatureResponse Author { get; protected set; } + + public Uri CommentsUrl { get; protected set; } + + public Commit Commit { get; protected set; } + + public SignatureResponse Committer { get; protected set; } + + public Uri HtmlUrl { get; protected set; } + + public IEnumerable Parents { get; protected set; } + + public string Sha { get; protected set; } + + public Uri Url { get; protected set; } internal string DebuggerDisplay { @@ -26,4 +33,4 @@ namespace Octokit } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/PullRequestMerge.cs b/Octokit/Models/Response/PullRequestMerge.cs index e57c8c92..7aa8cd52 100644 --- a/Octokit/Models/Response/PullRequestMerge.cs +++ b/Octokit/Models/Response/PullRequestMerge.cs @@ -10,17 +10,17 @@ namespace Octokit /// /// The sha reference of the commit. /// - public string Sha { get; set; } + public string Sha { get; protected set; } /// /// True if merged successfully, otherwise false. /// - public bool Merged { get; set; } + public bool Merged { get; protected set; } /// /// The message that will be used for the merge commit. /// - public string Message { get; set; } + public string Message { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/PullRequestReviewComment.cs b/Octokit/Models/Response/PullRequestReviewComment.cs index 03e6b418..4db57671 100644 --- a/Octokit/Models/Response/PullRequestReviewComment.cs +++ b/Octokit/Models/Response/PullRequestReviewComment.cs @@ -6,75 +6,84 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class PullRequestReviewComment { + public PullRequestReviewComment() + { + } + + public PullRequestReviewComment(int id) + { + Id = id; + } + /// /// URL of the comment via the API. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The comment Id. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The diff hunk the comment is about. /// - public string DiffHunk { get; set; } + public string DiffHunk { get; protected set; } /// /// The relative path of the file the comment is about. /// - public string Path { get; set; } + public string Path { get; protected set; } /// /// The line index in the diff. /// - public int? Position { get; set; } + public int? Position { get; protected set; } /// /// The comment original position. /// - public int? OriginalPosition { get; set; } + public int? OriginalPosition { get; protected set; } /// /// The commit Id the comment is associated with. /// - public string CommitId { get; set; } + public string CommitId { get; protected set; } /// /// The original commit Id the comment is associated with. /// - public string OriginalCommitId { get; set; } + public string OriginalCommitId { get; protected set; } /// /// The user that created the comment. /// - public User User { get; set; } + public User User { get; protected set; } /// /// The text of the comment. /// - public string Body { get; set; } + public string Body { get; protected set; } /// /// The date the comment was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The date the comment was last updated. /// - public DateTimeOffset UpdatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; protected set; } /// /// The URL for this comment on Github.com /// - public Uri HtmlUrl { get; set; } + public Uri HtmlUrl { get; protected set; } /// /// The URL for the pull request via the API. /// - public Uri PullRequestUrl { get; set; } + public Uri PullRequestUrl { get; protected set; } } public enum PullRequestReviewCommentSort diff --git a/Octokit/Models/Response/Reference.cs b/Octokit/Models/Response/Reference.cs index 1ef54741..181d5b4c 100644 --- a/Octokit/Models/Response/Reference.cs +++ b/Octokit/Models/Response/Reference.cs @@ -7,16 +7,15 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Reference { - public string Ref { get; set; } - public string Url { get; set; } - public TagObject Object { get; set; } + public string Ref { get; protected set; } + + public string Url { get; protected set; } + + public TagObject Object { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Ref: {0}", Ref); - } + get { return String.Format(CultureInfo.InvariantCulture, "Ref: {0}", Ref); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/Release.cs b/Octokit/Models/Response/Release.cs index f737554a..ef79424e 100644 --- a/Octokit/Models/Response/Release.cs +++ b/Octokit/Models/Response/Release.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Octokit @@ -7,26 +8,45 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Release { - public string Url { get; set; } - public string HtmlUrl { get; set; } - public string AssetsUrl { get; set; } - public string UploadUrl { get; set; } - public int Id { get; set; } - public string TagName { get; set; } - public string TargetCommitish { get; set; } - public string Name { get; set; } - public string Body { get; set; } - public bool Draft { get; set; } - public bool Prerelease { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset? PublishedAt { get; set; } + public Release() + { + } + + [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")] + public Release(string uploadUrl) + { + UploadUrl = uploadUrl; + } + + public string Url { get; protected set; } + + public string HtmlUrl { get; protected set; } + + public string AssetsUrl { get; protected set; } + + public string UploadUrl { get; protected set; } + + public int Id { get; protected set; } + + public string TagName { get; protected set; } + + public string TargetCommitish { get; protected set; } + + public string Name { get; protected set; } + + public string Body { get; protected set; } + + public bool Draft { get; protected set; } + + public bool Prerelease { get; protected set; } + + public DateTimeOffset CreatedAt { get; protected set; } + + public DateTimeOffset? PublishedAt { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Name: {0} PublishedAt: {1}", Name, PublishedAt); - } + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} PublishedAt: {1}", Name, PublishedAt); } } public ReleaseUpdate ToUpdate() @@ -42,4 +62,4 @@ namespace Octokit }; } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/ReleaseAsset.cs b/Octokit/Models/Response/ReleaseAsset.cs index 3a7979fe..ca550c5f 100644 --- a/Octokit/Models/Response/ReleaseAsset.cs +++ b/Octokit/Models/Response/ReleaseAsset.cs @@ -7,24 +7,31 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ReleaseAsset { - public string Url { get; set; } - public int Id { get; set; } - public string Name { get; set; } - public string Label { get; set; } - public string State { get; set; } - public string ContentType { get; set; } - public int Size { get; set; } - public int DownloadCount { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset UpdatedAt { get; set; } - public string BrowserDownloadUrl { get; set; } + public string Url { get; protected set; } + + public int Id { get; protected set; } + + public string Name { get; protected set; } + + public string Label { get; protected set; } + + public string State { get; protected set; } + + public string ContentType { get; protected set; } + + public int Size { get; protected set; } + + public int DownloadCount { get; protected set; } + + public DateTimeOffset CreatedAt { get; protected set; } + + public DateTimeOffset UpdatedAt { get; protected set; } + + public string BrowserDownloadUrl { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Name: {0} CreatedAt: {1}", Name, CreatedAt); - } + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} CreatedAt: {1}", Name, CreatedAt); } } public ReleaseAssetUpdate ToUpdate() @@ -35,4 +42,4 @@ namespace Octokit }; } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/Repository.cs b/Octokit/Models/Response/Repository.cs index 335346b2..e19e8975 100644 --- a/Octokit/Models/Response/Repository.cs +++ b/Octokit/Models/Response/Repository.cs @@ -7,39 +7,78 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Repository { - public string Url { get; set; } - public string HtmlUrl { get; set; } - public string CloneUrl { get; set; } - public string GitUrl { get; set; } - public string SshUrl { get; set; } - public string SvnUrl { get; set; } - public string MirrorUrl { get; set; } - public int Id { get; set; } - public User Owner { get; set; } - public string Name { get; set; } - public string FullName { get; set; } - public string Description { get; set; } - public string Homepage { get; set; } - public string Language { get; set; } - public bool Private { get; set; } - public bool Fork { get; set; } - public int ForksCount { get; set; } - public int StargazersCount { get; set; } - public int WatchersCount { get; set; } - public int SubscribersCount { get; set; } - public string DefaultBranch { get; set; } - public int OpenIssuesCount { get; set; } - public DateTimeOffset? PushedAt { get; set; } - public DateTimeOffset CreatedAt { get; set; } - public DateTimeOffset UpdatedAt { get; set; } - public RepositoryPermissions Permissions { get; set; } + public Repository() + { + } - public User Organization { get; set; } - public Repository Parent { get; set; } - public Repository Source { get; set; } - public bool HasIssues { get; set; } - public bool HasWiki { get; set; } - public bool HasDownloads { get; set; } + public Repository(int id) + { + Id = id; + } + + public string Url { get; protected set; } + + public string HtmlUrl { get; protected set; } + + public string CloneUrl { get; protected set; } + + public string GitUrl { get; protected set; } + + public string SshUrl { get; protected set; } + + public string SvnUrl { get; protected set; } + + public string MirrorUrl { get; protected set; } + + public int Id { get; protected set; } + + public User Owner { get; protected set; } + + public string Name { get; protected set; } + + public string FullName { get; protected set; } + + public string Description { get; protected set; } + + public string Homepage { get; protected set; } + + public string Language { get; protected set; } + + public bool Private { get; protected set; } + + public bool Fork { get; protected set; } + + public int ForksCount { get; protected set; } + + public int StargazersCount { get; protected set; } + + public int WatchersCount { get; protected set; } + + public int SubscribersCount { get; protected set; } + + public string DefaultBranch { get; protected set; } + + public int OpenIssuesCount { get; protected set; } + + public DateTimeOffset? PushedAt { get; protected set; } + + public DateTimeOffset CreatedAt { get; protected set; } + + public DateTimeOffset UpdatedAt { get; protected set; } + + public RepositoryPermissions Permissions { get; protected set; } + + public User Organization { get; protected set; } + + public Repository Parent { get; protected set; } + + public Repository Source { get; protected set; } + + public bool HasIssues { get; protected set; } + + public bool HasWiki { get; protected set; } + + public bool HasDownloads { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/RepositoryContent.cs b/Octokit/Models/Response/RepositoryContent.cs index 772495aa..363c4c90 100644 --- a/Octokit/Models/Response/RepositoryContent.cs +++ b/Octokit/Models/Response/RepositoryContent.cs @@ -45,4 +45,4 @@ namespace Octokit /// public Uri SubmoduleGitUrl { get; protected set; } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/RepositoryContentChangeSet.cs b/Octokit/Models/Response/RepositoryContentChangeSet.cs index bedf1865..35a6f921 100644 --- a/Octokit/Models/Response/RepositoryContentChangeSet.cs +++ b/Octokit/Models/Response/RepositoryContentChangeSet.cs @@ -13,12 +13,12 @@ namespace Octokit /// /// The content of the response. /// - public RepositoryContentInfo Content { get; set; } + public RepositoryContentInfo Content { get; protected set; } /// /// The commit information for the content change. /// - public Commit Commit { get; set; } + public Commit Commit { get; protected set; } internal string DebuggerDisplay { diff --git a/Octokit/Models/Response/RepositoryContributor.cs b/Octokit/Models/Response/RepositoryContributor.cs index bee7e7a3..8fdca7cb 100644 --- a/Octokit/Models/Response/RepositoryContributor.cs +++ b/Octokit/Models/Response/RepositoryContributor.cs @@ -10,6 +10,6 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class RepositoryContributor : Author { - public int Contributions { get; set; } + public int Contributions { get; protected set; } } } \ No newline at end of file diff --git a/Octokit/Models/Response/RepositoryLanguage.cs b/Octokit/Models/Response/RepositoryLanguage.cs index 3f8ff8c6..5b36a144 100644 --- a/Octokit/Models/Response/RepositoryLanguage.cs +++ b/Octokit/Models/Response/RepositoryLanguage.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; @@ -11,16 +10,16 @@ namespace Octokit { public RepositoryLanguage(string name, long numberOfBytes) { - this.Name = name; - this.NumberOfBytes = numberOfBytes; + Name = name; + NumberOfBytes = numberOfBytes; } - public string Name { get; set; } - public long NumberOfBytes { get; set; } + public string Name { get; protected set; } + public long NumberOfBytes { get; protected set; } [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private string DebuggerDisplay + internal string DebuggerDisplay { get { diff --git a/Octokit/Models/Response/RepositoryTag.cs b/Octokit/Models/Response/RepositoryTag.cs index 74a416b4..478c3610 100644 --- a/Octokit/Models/Response/RepositoryTag.cs +++ b/Octokit/Models/Response/RepositoryTag.cs @@ -8,15 +8,18 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class RepositoryTag { - public string Name { get; set; } - public GitReference Commit { get; set; } + public string Name { get; protected set; } + + public GitReference Commit { get; protected set; } + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Zipball")] - public string ZipballUrl { get; set; } + public string ZipballUrl { get; protected set; } + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Tarball")] - public string TarballUrl { get; set; } + public string TarballUrl { get; protected set; } [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private string DebuggerDisplay + internal string DebuggerDisplay { get { diff --git a/Octokit/Models/Response/SshKey.cs b/Octokit/Models/Response/SshKey.cs index c22a192a..e77b36c1 100644 --- a/Octokit/Models/Response/SshKey.cs +++ b/Octokit/Models/Response/SshKey.cs @@ -7,32 +7,44 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class SshKey { + public SshKey() + { + } + + public SshKey(string key) + { + Key = key; + } + + public SshKey(string key, string title) + { + Key = key; + Title = title; + } + /// /// The system-wide unique Id for this user. /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// The SSH Key /// - public string Key { get; set; } + public string Key { get; protected set; } /// /// The title of the SSH key /// - public string Title { get; set; } + public string Title { get; protected set; } /// /// The api URL for this organization. /// - public string Url { get; set; } + public string Url { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Title: {0} ", Title); - } + get { return String.Format(CultureInfo.InvariantCulture, "Title: {0} ", Title); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/Subscription.cs b/Octokit/Models/Response/Subscription.cs index 4a00df6e..705925df 100644 --- a/Octokit/Models/Response/Subscription.cs +++ b/Octokit/Models/Response/Subscription.cs @@ -10,39 +10,36 @@ namespace Octokit /// /// Determines if notifications should be received from this repository. /// - public bool Subscribed { get; set; } + public bool Subscribed { get; protected set; } /// /// Determines if all notifications should be blocked from this repository. /// - public bool Ignored { get; set; } + public bool Ignored { get; protected set; } /// /// Url of the label /// - public string Reason { get; set; } + public string Reason { get; protected set; } /// /// The for when this was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The API URL for this . /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The API URL for this . /// - public Uri RepositoryUrl { get; set; } + public Uri RepositoryUrl { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Subscribed: {0}", Subscribed); - } + get { return String.Format(CultureInfo.InvariantCulture, "Subscribed: {0}", Subscribed); } } } } diff --git a/Octokit/Models/Response/Team.cs b/Octokit/Models/Response/Team.cs index e1171065..80454250 100644 --- a/Octokit/Models/Response/Team.cs +++ b/Octokit/Models/Response/Team.cs @@ -13,44 +13,41 @@ namespace Octokit /// /// url for this team /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// team id /// - public int Id { get; set; } + public int Id { get; protected set; } /// /// team name /// - public string Name { get; set; } + public string Name { get; protected set; } /// /// permission attached to this team /// - public Permission Permission { get; set; } + public Permission Permission { get; protected set; } /// /// how many members in this team /// - public int MembersCount { get; set; } + public int MembersCount { get; protected set; } /// /// how many repo this team has access to /// - public int ReposCount { get; set; } + public int ReposCount { get; protected set; } /// /// who this team belongs to /// - public Organization Organization { get; set; } + public Organization Organization { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Name: {0} ", Name); - } + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} ", Name); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/ThreadSubscription.cs b/Octokit/Models/Response/ThreadSubscription.cs index 7379bd31..db433bf2 100644 --- a/Octokit/Models/Response/ThreadSubscription.cs +++ b/Octokit/Models/Response/ThreadSubscription.cs @@ -10,39 +10,36 @@ namespace Octokit /// /// Determines if notifications should be received from this repository. /// - public bool Subscribed { get; set; } + public bool Subscribed { get; protected set; } /// /// Determines if all notifications should be blocked from this repository. /// - public bool Ignored { get; set; } + public bool Ignored { get; protected set; } /// /// Url of the label /// - public string Reason { get; set; } + public string Reason { get; protected set; } /// /// The for when this was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } /// /// The API URL for this . /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// The API URL for this thread. /// - public Uri ThreadUrl { get; set; } + public Uri ThreadUrl { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Subscribed: {0}", Subscribed); - } + get { return String.Format(CultureInfo.InvariantCulture, "Subscribed: {0}", Subscribed); } } } } diff --git a/Octokit/Models/Response/User.cs b/Octokit/Models/Response/User.cs index 5b914407..45c6401b 100644 --- a/Octokit/Models/Response/User.cs +++ b/Octokit/Models/Response/User.cs @@ -17,12 +17,12 @@ namespace Octokit /// For more details: https://developer.github.com/changes/2014-09-05-removing-gravatar-id/ /// [Obsolete("This property is now obsolete, use AvatarUrl instead")] - public string GravatarId { get; set; } + public string GravatarId { get; protected set; } /// /// Whether or not the user is an administrator of the site /// - public bool SiteAdmin { get; set; } + public bool SiteAdmin { get; protected set; } internal string DebuggerDisplay { @@ -33,4 +33,4 @@ namespace Octokit } } } -} \ No newline at end of file +}