diff --git a/.gitignore b/.gitignore index 66a87bd1..bf294290 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ bin/**/*.pdb *.vspscc .builds +# Roslyn cache directories +*.ide/ + # Visual C++ cache files ipch/ *.aps @@ -72,6 +75,7 @@ tools/FAKE.Core tools/SourceLink.Fake tools/xunit.runners *.ncrunch* +*.GhostDoc.xml # New VS Test Runner creates arbitrary folders with PDBs *.pdb diff --git a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs index e952d6aa..d2168f80 100644 --- a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs +++ b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs @@ -15,6 +15,17 @@ namespace Octokit.Reactive /// IObservable GetAll(string owner, string name, string reference); + /// + /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or + /// a tag name. + /// + /// Only users with pull access can see this. + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + IObservable GetCombined(string owner, string name, string reference); + /// /// Creates a commit status for the specified ref. /// diff --git a/Octokit.Reactive/Clients/IObservableTreesClient.cs b/Octokit.Reactive/Clients/IObservableTreesClient.cs index e2c52e06..ac10689a 100644 --- a/Octokit.Reactive/Clients/IObservableTreesClient.cs +++ b/Octokit.Reactive/Clients/IObservableTreesClient.cs @@ -17,6 +17,18 @@ namespace Octokit.Reactive [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] IObservable Get(string owner, string name, string reference); + /// + /// Gets a Tree Response for a given SHA. + /// + /// + /// https://developer.github.com/v3/git/trees/#get-a-tree-recursively + /// + /// The owner of the repository + /// The name of the repository + /// The SHA that references the tree + /// The for the specified Tree. + IObservable GetRecursive(string owner, string name, string reference); + /// /// Creates a new Tree in the specified repo /// diff --git a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs index f2e669e3..43922e5d 100644 --- a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs +++ b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs @@ -28,7 +28,21 @@ namespace Octokit.Reactive /// public IObservable GetAll(string owner, string name, string reference) { - return _connection.GetAndFlattenAllPages(ApiUrls.CommitStatus(owner, name, reference)); + return _connection.GetAndFlattenAllPages(ApiUrls.CommitStatuses(owner, name, reference)); + } + + /// + /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or + /// a tag name. + /// + /// Only users with pull access can see this. + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + public IObservable GetCombined(string owner, string name, string reference) + { + return _client.GetCombined(owner, name, reference).ToObservable(); } /// diff --git a/Octokit.Reactive/Clients/ObservableTreesClient.cs b/Octokit.Reactive/Clients/ObservableTreesClient.cs index 47d24578..e3c45d85 100644 --- a/Octokit.Reactive/Clients/ObservableTreesClient.cs +++ b/Octokit.Reactive/Clients/ObservableTreesClient.cs @@ -34,6 +34,25 @@ namespace Octokit.Reactive return _client.Get(owner, name, reference).ToObservable(); } + /// + /// Gets a Tree Response for a given SHA. + /// + /// + /// https://developer.github.com/v3/git/trees/#get-a-tree-recursively + /// + /// The owner of the repository + /// The name of the repository + /// The SHA that references the tree + /// The for the specified Tree. + public IObservable GetRecursive(string owner, string name, string reference) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); + + return _client.GetRecursive(owner, name, reference).ToObservable(); + } + /// /// Creates a new Tree in the specified repo /// diff --git a/Octokit.Tests.Conventions/DebuggerDisplayOnModels.cs b/Octokit.Tests.Conventions/DebuggerDisplayOnModels.cs deleted file mode 100644 index 9d92c159..00000000 --- a/Octokit.Tests.Conventions/DebuggerDisplayOnModels.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Diagnostics; -using System.Linq; -using Octokit.Tests.Helpers; -using Xunit; -using Xunit.Extensions; -using System.Collections.Generic; - -namespace Octokit.Tests.Conventions -{ - public class DebuggerDisplayOnModels - { - [Fact] - public void CheckModelsForDebuggerDisplayAttributeExample() - { - CheckModelsForDebuggerDisplayAttribute(typeof(IAuthorizationsClient)); - } - - [Theory] - [MemberData("GetClientInterfaces")] - public void CheckModelsForDebuggerDisplayAttribute(Type clientInterface) - { - var methods = clientInterface.GetMethods(); - var modelTypes = - from modelType in - (from type in ( - from method in methods from parameter in method.GetParameters() select parameter.ParameterType - ).Union( - from method in methods select method.ReturnType) - select type.GetTypeInfo().Type) - where TypeExtensions.IsModel(modelType) - select modelType; - foreach(var modelType in modelTypes.Distinct()) - { - AssertEx.HasAttribute(modelType); - } - } - - public static IEnumerable GetClientInterfaces() - { - return typeof(IEventsClient).Assembly.ExportedTypes.Where(TypeExtensions.IsClientInterface).Select(type => new[] { type }); - } - } -} \ No newline at end of file diff --git a/Octokit.Tests.Conventions/ModelTests.cs b/Octokit.Tests.Conventions/ModelTests.cs new file mode 100644 index 00000000..30c5d5e3 --- /dev/null +++ b/Octokit.Tests.Conventions/ModelTests.cs @@ -0,0 +1,138 @@ +using System; +using System.Diagnostics; +using System.Linq; +using Octokit.Tests.Helpers; +using Xunit; +using System.Collections.Generic; +using System.Reflection; + +namespace Octokit.Tests.Conventions +{ + public class ModelTests + { + [Theory] + [MemberData("ModelTypes")] + public void AllModelsHaveDebuggerDisplayAttribute(Type modelType) + { + var attribute = AssertEx.HasAttribute(modelType); + + Assert.Equal("{DebuggerDisplay,nq}", attribute.Value); + + var property = modelType.GetProperty("DebuggerDisplay", BindingFlags.Instance | BindingFlags.NonPublic); + + Assert.NotNull(property); + Assert.Equal(typeof(string), property.PropertyType); + } + + [Theory] + [MemberData("ResponseModelTypes")] + public void ResponseModelsHaveGetterOnlyProperties(Type modelType) + { + foreach (var property in modelType.GetProperties()) + { + var setter = property.GetSetMethod(nonPublic: true); + + Assert.True(setter == null || !setter.IsPublic); + } + } + + public static IEnumerable ModelTypes + { + get { return GetModelTypes(includeRequestModels: true).Select(type => new[] { type }); } + } + + public static IEnumerable ResponseModelTypes + { + get { return GetModelTypes(includeRequestModels: false).Select(type => new[] { type }); } + } + + private static IEnumerable GetModelTypes(bool includeRequestModels) + { + var allModelTypes = new HashSet(); + + var clientInterfaces = typeof(IEventsClient).Assembly.ExportedTypes + .Where(type => type.IsClientInterface()); + + foreach (var exportedType in clientInterfaces) + { + var methods = exportedType.GetMethods(); + + var modelTypes = methods.SelectMany(method => UnwrapGenericArguments(method.ReturnType)); + + if (includeRequestModels) + { + var requestModels = methods.SelectMany(method => method.GetParameters(), + (method, parameter) => parameter.ParameterType); + + modelTypes = modelTypes.Union(requestModels); + } + + foreach (var modelType in modelTypes.Where(type => type.IsModel())) + { + allModelTypes.Add(modelType); + } + } + + return GetAllModelTypes(allModelTypes); + } + + static IEnumerable GetAllModelTypes(ISet allModelTypes) + { + foreach (var modelType in allModelTypes.ToList()) + { + GetPropertyModelTypes(modelType, allModelTypes); + } + + return allModelTypes; + } + + static void GetPropertyModelTypes(Type modelType, ISet allModelTypes) + { + var properties = modelType.GetProperties(); + + foreach (var propertyType in properties.SelectMany(x => UnwrapGenericArguments(x.PropertyType))) + { + if (allModelTypes.Contains(propertyType)) + { + continue; + } + + if (!propertyType.IsModel()) + { + continue; + } + + allModelTypes.Add(propertyType); + + GetPropertyModelTypes(propertyType, allModelTypes); + } + } + + private static IEnumerable UnwrapGenericArguments(Type returnType) + { + if (returnType.IsGenericType) + { + var arguments = returnType.GetGenericArguments(); + + foreach (var argument in arguments) + { + if (argument.IsModel()) + { + yield return argument; + } + else + { + foreach (var unwrappedTypes in UnwrapGenericArguments(argument)) + { + yield return unwrappedTypes; + } + } + } + } + else + { + yield return returnType; + } + } + } +} diff --git a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj index 3a9ca23a..796e9fa0 100644 --- a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj +++ b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj @@ -55,7 +55,7 @@ - + diff --git a/Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs b/Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs index 74c68d2e..33f15728 100644 --- a/Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitStatusClientTests.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration; @@ -25,6 +26,25 @@ public class CommitStatusClientTests } } + public class TheGetCombinedMethod + { + [IntegrationTest] + public async Task CanRetrieveCombinedStatus() + { + var githubClient = Helper.GetAuthenticatedClient(); + var status = await githubClient.Repository.CommitStatus.GetCombined( + "libgit2", + "libgit2sharp", + "f54529997b6ad841be524654d9e9074ab8e7d41d"); + Assert.Equal(CommitState.Success, status.State); + Assert.Equal("f54529997b6ad841be524654d9e9074ab8e7d41d", status.Sha); + Assert.Equal(2, status.TotalCount); + Assert.Equal(2, status.Statuses.Count); + Assert.True(status.Statuses.All(x => x.State == CommitState.Success)); + Assert.Equal("The Travis CI build passed", status.Statuses[0].Description); + } + } + public class TheCreateMethod : IDisposable { readonly IGitHubClient _client; diff --git a/Octokit.Tests.Integration/Properties/AssemblyInfo.cs b/Octokit.Tests.Integration/Properties/AssemblyInfo.cs index 7d2624d8..82e4ff91 100644 --- a/Octokit.Tests.Integration/Properties/AssemblyInfo.cs +++ b/Octokit.Tests.Integration/Properties/AssemblyInfo.cs @@ -1,5 +1,6 @@ using System.Reflection; using System.Runtime.InteropServices; +using Xunit; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -37,3 +38,6 @@ using System.Runtime.InteropServices; [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] + +// Prevent the default behaviour of running each test class in parallel for now. +[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] \ No newline at end of file diff --git a/Octokit.Tests/Clients/CommitStatusClientTests.cs b/Octokit.Tests/Clients/CommitStatusClientTests.cs index 05f2f9e3..f00374e1 100644 --- a/Octokit.Tests/Clients/CommitStatusClientTests.cs +++ b/Octokit.Tests/Clients/CommitStatusClientTests.cs @@ -1,4 +1,5 @@ using System; +using System.Security.Policy; using System.Threading.Tasks; using NSubstitute; using Octokit.Tests.Helpers; @@ -19,7 +20,7 @@ namespace Octokit.Tests.Clients client.GetAll("fake", "repo", "sha"); connection.Received() - .GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/statuses/sha"), null); + .GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/commits/sha/statuses")); } [Fact] @@ -42,6 +43,40 @@ namespace Octokit.Tests.Clients } } + public class TheGetCombinedMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new CommitStatusClient(connection); + + client.GetCombined("fake", "repo", "sha"); + + connection.Received() + .Get(Arg.Is(u => u.ToString() == "repos/fake/repo/commits/sha/status"), null); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var client = new CommitStatusClient(Substitute.For()); + + await AssertEx.Throws(async () => + await client.GetCombined("", "name", "sha")); + await AssertEx.Throws(async () => + await client.GetCombined("owner", "", "sha")); + await AssertEx.Throws(async () => + await client.GetCombined("owner", "name", "")); + await AssertEx.Throws(async () => + await client.GetCombined(null, "name", "sha")); + await AssertEx.Throws(async () => + await client.GetCombined("owner", null, "sha")); + await AssertEx.Throws(async () => + await client.GetCombined("owner", "name", null)); + } + } + public class TheCreateMethodForUser { [Fact] 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/Clients/TagsClientTests.cs b/Octokit.Tests/Clients/TagsClientTests.cs index 7d693d36..acd13242 100644 --- a/Octokit.Tests/Clients/TagsClientTests.cs +++ b/Octokit.Tests/Clients/TagsClientTests.cs @@ -83,12 +83,7 @@ public class TagsClientTests Tag = "tag-name", Object = "tag-object", Type = TaggedType.Tree, - Tagger = new SignatureResponse - { - Name = "tagger-name", - Email = "tagger-email", - Date = DateTimeOffset.Parse("2013-09-03T13:42:52Z") - } + Tagger = new SignatureResponse("tagger-name", "tagger-email", DateTimeOffset.Parse("2013-09-03T13:42:52Z")) }; var json = new SimpleJsonSerializer().Serialize(tag); diff --git a/Octokit.Tests/Clients/TreesClientTests.cs b/Octokit.Tests/Clients/TreesClientTests.cs index 0f7aa1eb..88123121 100644 --- a/Octokit.Tests/Clients/TreesClientTests.cs +++ b/Octokit.Tests/Clients/TreesClientTests.cs @@ -39,6 +39,34 @@ namespace Octokit.Tests } } + public class TheGetRecursiveMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new TreesClient(connection); + + client.GetRecursive("fake", "repo", "123456ABCD"); + + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/git/trees/123456ABCD?recursive=1"), + null); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var client = new TreesClient(Substitute.For()); + + await AssertEx.Throws(async () => await client.GetRecursive(null, "name", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("", "name", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", null, "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "name", null)); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "name", "")); + } + } + public class TheCreateMethod { [Fact] diff --git a/Octokit.Tests/Helpers/AssertEx.cs b/Octokit.Tests/Helpers/AssertEx.cs index 5796f7c5..0f663ddf 100644 --- a/Octokit.Tests/Helpers/AssertEx.cs +++ b/Octokit.Tests/Helpers/AssertEx.cs @@ -14,9 +14,13 @@ namespace Octokit.Tests.Helpers assert(); } - public static void HasAttribute(MemberInfo memberInfo, bool inherit = false) where TAttribute : Attribute + public static TAttribute HasAttribute(MemberInfo memberInfo, bool inherit = false) where TAttribute : Attribute { - Assert.True(memberInfo.IsDefined(typeof(TAttribute), inherit), memberInfo.ToString() + Environment.NewLine); + var attribute = memberInfo.GetCustomAttribute(inherit); + + Assert.NotNull(attribute); + + return attribute; } public async static Task Throws(Func testCode) where T : Exception 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 2a6fc711..53ae3a6b 100644 --- a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs @@ -50,9 +50,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new Milestone {Number = 1}, - new Milestone {Number = 2}, - new Milestone {Number = 3}, + new Milestone(1), + new Milestone(2), + new Milestone(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -62,9 +62,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new Milestone {Number = 4}, - new Milestone {Number = 5}, - new Milestone {Number = 6}, + new Milestone(4), + new Milestone(5), + new Milestone(6) } ); var lastPageResponse = new ApiResponse> @@ -72,7 +72,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new Milestone {Number = 7}, + new Milestone(7) } ); var gitHubClient = Substitute.For(); @@ -103,9 +103,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new Milestone {Number = 1}, - new Milestone {Number = 2}, - new Milestone {Number = 3}, + new Milestone(1), + new Milestone(2), + new Milestone(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -115,9 +115,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new Milestone {Number = 4}, - new Milestone {Number = 5}, - new Milestone {Number = 6}, + new Milestone(4), + new Milestone(5), + new Milestone(6) } ); var lastPageResponse = new ApiResponse> @@ -125,7 +125,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new Milestone {Number = 7}, + new Milestone(7) } ); var gitHubClient = Substitute.For(); diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs index 10b0343d..2d15a63e 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs @@ -32,9 +32,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) }); var thirdPageUrl = new Uri("https://example.com/page/3"); var secondPageLinks = new Dictionary { { "next", thirdPageUrl } }; @@ -43,9 +43,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) } ); var lastPageResponse = new ApiResponse> @@ -53,7 +53,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new PullRequestReviewComment {Id = 7} + new PullRequestReviewComment(7) } ); @@ -103,9 +103,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -115,17 +115,17 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) }); var lastPageResponse = new ApiResponse> ( new Response(), new List { - new PullRequestReviewComment {Id = 7}, - new PullRequestReviewComment {Id = 8}, + new PullRequestReviewComment(7), + new PullRequestReviewComment(8) } ); @@ -174,9 +174,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new PullRequestReviewComment {Id = 1}, - new PullRequestReviewComment {Id = 2}, - new PullRequestReviewComment {Id = 3} + new PullRequestReviewComment(1), + new PullRequestReviewComment(2), + new PullRequestReviewComment(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -186,17 +186,17 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new PullRequestReviewComment {Id = 4}, - new PullRequestReviewComment {Id = 5}, - new PullRequestReviewComment {Id = 6} + new PullRequestReviewComment(4), + new PullRequestReviewComment(5), + new PullRequestReviewComment(6) }); var lastPageResponse = new ApiResponse> ( new Response(), new List { - new PullRequestReviewComment {Id = 7}, - new PullRequestReviewComment {Id = 8}, + new PullRequestReviewComment(7), + new PullRequestReviewComment(8) } ); diff --git a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs index 054a2ffd..977533a6 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs @@ -50,9 +50,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new PullRequest {Number = 1}, - new PullRequest {Number = 2}, - new PullRequest {Number = 3}, + new PullRequest(1), + new PullRequest(2), + new PullRequest(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -62,9 +62,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new PullRequest {Number = 4}, - new PullRequest {Number = 5}, - new PullRequest {Number = 6}, + new PullRequest(4), + new PullRequest(5), + new PullRequest(6) } ); var lastPageResponse = new ApiResponse> @@ -72,7 +72,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new PullRequest {Number = 7}, + new PullRequest(7) } ); var gitHubClient = Substitute.For(); @@ -103,9 +103,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new PullRequest {Number = 1}, - new PullRequest {Number = 2}, - new PullRequest {Number = 3}, + new PullRequest(1), + new PullRequest(2), + new PullRequest(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -115,9 +115,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new PullRequest {Number = 4}, - new PullRequest {Number = 5}, - new PullRequest {Number = 6}, + new PullRequest(4), + new PullRequest(5), + new PullRequest(6) } ); var lastPageResponse = new ApiResponse> @@ -125,7 +125,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new PullRequest {Number = 7}, + new PullRequest(7) } ); var gitHubClient = Substitute.For(); 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 21349be3..044a74d7 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -52,9 +52,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new Repository { Id = 1 }, - new Repository { Id = 2 }, - new Repository { Id = 3 } + new Repository(1), + new Repository(2), + new Repository(3) }); var thirdPageUrl = new Uri("https://example.com/page/3"); var secondPageLinks = new Dictionary {{"next", thirdPageUrl}}; @@ -63,15 +63,15 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new Repository {Id = 4}, - new Repository {Id = 5}, - new Repository {Id = 6} + new Repository(4), + new Repository(5), + new Repository(6) }); var lastPageResponse = new ApiResponse>( new Response(), new List { - new Repository { Id = 7 } + new Repository(7) }); var gitHubClient = Substitute.For(); gitHubClient.Connection.GetResponse>(firstPageUrl) @@ -101,9 +101,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(firstPageLinks), new List { - new Repository {Id = 1}, - new Repository {Id = 2}, - new Repository {Id = 3} + new Repository(1), + new Repository(2), + new Repository(3) } ); var thirdPageUrl = new Uri("https://example.com/page/3"); @@ -113,9 +113,9 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(secondPageLinks), new List { - new Repository {Id = 4}, - new Repository {Id = 5}, - new Repository {Id = 6} + new Repository(4), + new Repository(5), + new Repository(6) } ); var fourthPageUrl = new Uri("https://example.com/page/4"); @@ -126,7 +126,7 @@ namespace Octokit.Tests.Reactive CreateResponseWithApiInfo(thirdPageLinks), new List { - new Repository {Id = 7} + new Repository(7) } ); var lastPageResponse = new ApiResponse> @@ -134,7 +134,7 @@ namespace Octokit.Tests.Reactive new Response(), new List { - new Repository {Id = 8} + new Repository(8) } ); var gitHubClient = Substitute.For(); diff --git a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs index 2f8d6956..206ebf6c 100644 --- a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs @@ -37,6 +37,33 @@ namespace Octokit.Tests } } + public class TheGetRecursiveMethod + { + [Fact] + public void GetsFromClientIssueIssue() + { + var gitHubClient = Substitute.For(); + var client = new ObservableTreesClient(gitHubClient); + + client.GetRecursive("fake", "repo", "123456ABCD"); + + gitHubClient.GitDatabase.Tree.Received().GetRecursive("fake", "repo", "123456ABCD"); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var client = new ObservableTreesClient(Substitute.For()); + + await AssertEx.Throws(async () => await client.GetRecursive(null, "name", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("", "name", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", null, "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "", "123456ABCD")); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "name", null)); + await AssertEx.Throws(async () => await client.GetRecursive("owner", "name", "")); + } + } + public class TheCreateMethod { [Fact] diff --git a/Octokit.Tests/SimpleJsonSerializerTests.cs b/Octokit.Tests/SimpleJsonSerializerTests.cs index 2677211a..ddfe21dd 100644 --- a/Octokit.Tests/SimpleJsonSerializerTests.cs +++ b/Octokit.Tests/SimpleJsonSerializerTests.cs @@ -203,6 +203,19 @@ namespace Octokit.Tests Assert.Equal("blah", result.Links); } + + [Fact] + public void DefaultsMissingParameters() + { + const string json = @"{""private"":true}"; + + var sample = new SimpleJsonSerializer().Deserialize(json); + + Assert.Equal(0, sample.Id); + Assert.Equal(null, sample.FirstName); + Assert.False(sample.IsSomething); + Assert.True(sample.Private); + } } public class Sample diff --git a/Octokit/Clients/CommitStatusClient.cs b/Octokit/Clients/CommitStatusClient.cs index 8c580b62..6a42091e 100644 --- a/Octokit/Clients/CommitStatusClient.cs +++ b/Octokit/Clients/CommitStatusClient.cs @@ -23,7 +23,9 @@ namespace Octokit /// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -34,16 +36,35 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - // This is currently a preview feature of the API and is subject to change - // https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref - return ApiConnection.GetAll( - ApiUrls.CommitStatus(owner, name, reference), - null); + return ApiConnection.GetAll(ApiUrls.CommitStatuses(owner, name, reference)); + } + + /// + /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or + /// a tag name. + /// + /// + /// https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + /// + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + public Task GetCombined(string owner, string name, string reference) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); + + return ApiConnection.Get(ApiUrls.CombinedCommitStatus(owner, name, reference)); } /// /// Creates a commit status for the specified ref. /// + /// + /// https://developer.github.com/v3/repos/statuses/#create-a-status + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -56,11 +77,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); Ensure.ArgumentNotNull(commitStatus, "commitStatus"); - // This is currently a preview feature of the API and is subject to change - // https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref - return ApiConnection.Post( - ApiUrls.CommitStatus(owner, name, reference), - commitStatus); + return ApiConnection.Post(ApiUrls.CreateCommitStatus(owner, name, reference), commitStatus); } } } diff --git a/Octokit/Clients/ICommitStatusClient.cs b/Octokit/Clients/ICommitStatusClient.cs index 61065400..e9743ea7 100644 --- a/Octokit/Clients/ICommitStatusClient.cs +++ b/Octokit/Clients/ICommitStatusClient.cs @@ -15,16 +15,34 @@ namespace Octokit /// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for /// Task> GetAll(string owner, string name, string reference); + /// + /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or + /// a tag name. + /// + /// + /// https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + /// + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + Task GetCombined(string owner, string name, string reference); + /// /// Creates a commit status for the specified ref. /// + /// + /// https://developer.github.com/v3/repos/statuses/#create-a-status + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for diff --git a/Octokit/Clients/ITreesClient.cs b/Octokit/Clients/ITreesClient.cs index aad5234d..549621a4 100644 --- a/Octokit/Clients/ITreesClient.cs +++ b/Octokit/Clients/ITreesClient.cs @@ -23,6 +23,18 @@ namespace Octokit [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] Task Get(string owner, string name, string reference); + /// + /// Gets a Tree Response for a given SHA. + /// + /// + /// https://developer.github.com/v3/git/trees/#get-a-tree-recursively + /// + /// The owner of the repository + /// The name of the repository + /// The SHA that references the tree + /// The for the specified Tree. + Task GetRecursive(string owner, string name, string reference); + /// /// Creates a new Tree in the specified repo /// diff --git a/Octokit/Clients/TreesClient.cs b/Octokit/Clients/TreesClient.cs index 736e37da..59bef030 100644 --- a/Octokit/Clients/TreesClient.cs +++ b/Octokit/Clients/TreesClient.cs @@ -40,6 +40,25 @@ namespace Octokit return ApiConnection.Get(ApiUrls.Tree(owner, name, reference)); } + /// + /// Gets a Tree Response for a given SHA. + /// + /// + /// https://developer.github.com/v3/git/trees/#get-a-tree-recursively + /// + /// The owner of the repository + /// The name of the repository + /// The SHA that references the tree + /// The for the specified Tree. + public Task GetRecursive(string owner, string name, string reference) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); + + return ApiConnection.Get(ApiUrls.TreeRecursive(owner, name, reference)); + } + /// /// Creates a new Tree in the specified repo /// diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 84400bbf..1e8fbf0e 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -543,6 +543,18 @@ namespace Octokit return "repos/{0}/{1}/milestones/{2}/labels".FormatUri(owner, repo, number); } + /// + /// Returns the to use when creating a commit status for the specified reference. + /// + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + public static Uri CreateCommitStatus(string owner, string name, string reference) + { + return "repos/{0}/{1}/statuses/{2}".FormatUri(owner, name, reference); + } + /// /// Returns the that lists the commit statuses for the specified reference. /// @@ -550,9 +562,21 @@ namespace Octokit /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for /// - public static Uri CommitStatus(string owner, string name, string reference) + public static Uri CommitStatuses(string owner, string name, string reference) { - return "repos/{0}/{1}/statuses/{2}".FormatUri(owner, name, reference); + return "repos/{0}/{1}/commits/{2}/statuses".FormatUri(owner, name, reference); + } + + /// + /// Returns the that returns a combined view of commit statuses for the specified reference. + /// + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + public static Uri CombinedCommitStatus(string owner, string name, string reference) + { + return "repos/{0}/{1}/commits/{2}/status".FormatUri(owner, name, reference); } /// @@ -1009,6 +1033,18 @@ namespace Octokit return "repos/{0}/{1}/git/trees/{2}".FormatUri(owner, name, reference); } + /// + /// Returns the for the specified tree. + /// + /// The owner of the repository + /// The name of the repository + /// The tree reference (SHA) + /// + public static Uri TreeRecursive(string owner, string name, string reference) + { + return "repos/{0}/{1}/git/trees/{2}?recursive=1".FormatUri(owner, name, reference); + } + /// /// returns the for org teams /// use for both Get and Create methods diff --git a/Octokit/Models/Request/GistFileUpdate.cs b/Octokit/Models/Request/GistFileUpdate.cs new file mode 100644 index 00000000..2c338fbb --- /dev/null +++ b/Octokit/Models/Request/GistFileUpdate.cs @@ -0,0 +1,19 @@ +using System; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit +{ + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class GistFileUpdate + { + public string NewFileName { get; set; } + + public string Content { get; set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "NewFileName: {0}", NewFileName); } + } + } +} \ No newline at end of file diff --git a/Octokit/Models/Request/GistUpdate.cs b/Octokit/Models/Request/GistUpdate.cs index 3462f26a..2ccf21ab 100644 --- a/Octokit/Models/Request/GistUpdate.cs +++ b/Octokit/Models/Request/GistUpdate.cs @@ -26,16 +26,7 @@ namespace Octokit internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Description: {0}", Description); - } + get { return String.Format(CultureInfo.InvariantCulture, "Description: {0}", Description); } } } - - public class GistFileUpdate - { - public string NewFileName { get; set; } - public string Content { get; set; } - } } diff --git a/Octokit/Models/Request/MarkAsReadRequest.cs b/Octokit/Models/Request/MarkAsReadRequest.cs index cedf4808..e62074cb 100644 --- a/Octokit/Models/Request/MarkAsReadRequest.cs +++ b/Octokit/Models/Request/MarkAsReadRequest.cs @@ -1,6 +1,6 @@ using System; using System.Diagnostics; -using Octokit.Internal; +using System.Globalization; namespace Octokit { @@ -16,5 +16,10 @@ namespace Octokit /// Describes the last point that notifications were checked. Anything updated since this time will not be updated. /// public DateTimeOffset? LastReadAt { get; set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "LastReadAt: {0}", LastReadAt); } + } } } diff --git a/Octokit/Models/Request/NewDeployKey.cs b/Octokit/Models/Request/NewDeployKey.cs index f48c1683..44571159 100644 --- a/Octokit/Models/Request/NewDeployKey.cs +++ b/Octokit/Models/Request/NewDeployKey.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Globalization; namespace Octokit { @@ -14,6 +11,12 @@ namespace Octokit public class NewDeployKey { public string Title { get; set; } + public string Key { get; set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Key: {0}, Title: {1}", Key, Title); } + } } } diff --git a/Octokit/Models/Request/NewRepository.cs b/Octokit/Models/Request/NewRepository.cs index 60d846bf..9794d0c5 100644 --- a/Octokit/Models/Request/NewRepository.cs +++ b/Octokit/Models/Request/NewRepository.cs @@ -21,17 +21,17 @@ namespace Octokit /// public string Description { get; set; } - /// s + /// /// Optional. Gets or sets whether to enable downloads for the new repository. The default is true. /// public bool? HasDownloads { get; set; } - /// s + /// /// Optional. Gets or sets whether to enable issues for the new repository. The default is true. /// public bool? HasIssues { get; set; } - /// s + /// /// Optional. Gets or sets whether to enable the wiki for the new repository. The default is true. /// public bool? HasWiki { get; set; } diff --git a/Octokit/Models/Request/NewTreeItem.cs b/Octokit/Models/Request/NewTreeItem.cs index 41087e67..4a3bd5e4 100644 --- a/Octokit/Models/Request/NewTreeItem.cs +++ b/Octokit/Models/Request/NewTreeItem.cs @@ -1,5 +1,10 @@ -namespace Octokit +using System; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class NewTreeItem { /// @@ -25,5 +30,10 @@ /// The SHA for this Tree item. /// public string Sha { get; set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "SHA: {0}, Path: {1}, Type: {2}", Sha, Path, Type); } + } } } \ No newline at end of file diff --git a/Octokit/Models/Request/PullRequestReviewCommentCreate.cs b/Octokit/Models/Request/PullRequestReviewCommentCreate.cs index d9ae04b8..54bc8050 100644 --- a/Octokit/Models/Request/PullRequestReviewCommentCreate.cs +++ b/Octokit/Models/Request/PullRequestReviewCommentCreate.cs @@ -1,5 +1,6 @@ -using System.Diagnostics; -using Octokit.Internal; +using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -44,5 +45,10 @@ namespace Octokit /// The line index in the diff to comment on. /// public int Position { get; private set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "CommitId: {0}, Path: {1}, Position: {2}", CommitId, Path, Position); } + } } } diff --git a/Octokit/Models/Request/PullRequestReviewCommentEdit.cs b/Octokit/Models/Request/PullRequestReviewCommentEdit.cs index f8cc7ba1..527f4593 100644 --- a/Octokit/Models/Request/PullRequestReviewCommentEdit.cs +++ b/Octokit/Models/Request/PullRequestReviewCommentEdit.cs @@ -1,4 +1,6 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -20,5 +22,10 @@ namespace Octokit /// The text of the comment. /// public string Body { get; private set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Body: {0}", Body); } + } } } diff --git a/Octokit/Models/Request/PullRequestReviewCommentReplyCreate.cs b/Octokit/Models/Request/PullRequestReviewCommentReplyCreate.cs index 221ea677..8a17544b 100644 --- a/Octokit/Models/Request/PullRequestReviewCommentReplyCreate.cs +++ b/Octokit/Models/Request/PullRequestReviewCommentReplyCreate.cs @@ -1,5 +1,6 @@ -using System.Diagnostics; -using Octokit.Internal; +using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -28,5 +29,10 @@ namespace Octokit /// The comment Id to reply to. /// public int InReplyTo { get; private set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "InReplyTo: {0}, Body: {1}", InReplyTo, Body); } + } } } diff --git a/Octokit/Models/Request/PullRequestReviewCommentRequest.cs b/Octokit/Models/Request/PullRequestReviewCommentRequest.cs index 4bd22d0f..5d923854 100644 --- a/Octokit/Models/Request/PullRequestReviewCommentRequest.cs +++ b/Octokit/Models/Request/PullRequestReviewCommentRequest.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -28,5 +29,10 @@ namespace Octokit /// Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. /// public DateTimeOffset? Since { get; set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Sort: {0}, Direction: {1}, Since: {2}", Sort, Direction, Since); } + } } } 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/Request/RequestParameters.cs b/Octokit/Models/Request/RequestParameters.cs index 2cf5f06f..b6857e75 100644 --- a/Octokit/Models/Request/RequestParameters.cs +++ b/Octokit/Models/Request/RequestParameters.cs @@ -3,7 +3,6 @@ using System.Collections.Concurrent; #endif using System.Collections.Generic; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; @@ -15,7 +14,6 @@ namespace Octokit /// /// Base class for classes which represent query string parameters to certain API endpoints. /// - [DebuggerDisplay("{DebuggerDisplay,nq}")] public abstract class RequestParameters { #if PORTABLE diff --git a/Octokit/Models/Request/SearchRepositoriesRequest.cs b/Octokit/Models/Request/SearchRepositoriesRequest.cs index 560c2b81..3b9a63fc 100644 --- a/Octokit/Models/Request/SearchRepositoriesRequest.cs +++ b/Octokit/Models/Request/SearchRepositoriesRequest.cs @@ -176,6 +176,7 @@ namespace Octokit /// /// Helper class in generating the range values for a qualifer e.g. In or Size qualifiers /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Range { private string query = string.Empty; @@ -220,6 +221,11 @@ namespace Octokit } } + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Query: {0}", query); } + } + /// /// Helper class that build a with a LessThan comparator used for filtering results /// @@ -262,6 +268,7 @@ namespace Octokit /// helper class in generating the date range values for the date qualifier e.g. /// https://help.github.com/articles/searching-repositories#created-and-last-updated /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class DateRange { private readonly string query = string.Empty; @@ -289,6 +296,11 @@ namespace Octokit } } + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Query: {0}", query); } + } + /// /// helper method to create a LessThan Date Comparision /// e.g. < 2011 diff --git a/Octokit/Models/Response/Application.cs b/Octokit/Models/Response/Application.cs index 0d7312c5..0f75a0a4 100644 --- a/Octokit/Models/Response/Application.cs +++ b/Octokit/Models/Response/Application.cs @@ -1,8 +1,13 @@ -namespace Octokit +using System; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit { /// /// Represents an oauth application. /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Application { /// @@ -14,5 +19,10 @@ /// The Url of this . /// public string Url { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0}", Name); } + } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/CombinedCommitStatus.cs b/Octokit/Models/Response/CombinedCommitStatus.cs new file mode 100644 index 00000000..1c178558 --- /dev/null +++ b/Octokit/Models/Response/CombinedCommitStatus.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit +{ + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class CombinedCommitStatus + { + /// + /// The combined state of the commits. + /// + public CommitState State { get; protected set; } + + /// + /// The SHA of the reference. + /// + public string Sha { get; protected set; } + + /// + /// The total number of statuses. + /// + public int TotalCount { get; protected set; } + + /// + /// The statuses. + /// + public IReadOnlyList Statuses { get; protected set; } + + /// + /// The repository of the reference. + /// + public Repository Repository { get; protected set; } + + internal string DebuggerDisplay + { + get + { + return string.Format(CultureInfo.InvariantCulture, "SHA: {0}, State: {1}, TotalCount: {2}", Sha, State, TotalCount); + } + } + } +} \ No newline at end of file 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/FeedLink.cs b/Octokit/Models/Response/FeedLink.cs index bb1668fb..899c1c28 100644 --- a/Octokit/Models/Response/FeedLink.cs +++ b/Octokit/Models/Response/FeedLink.cs @@ -1,58 +1,71 @@ using System; using System.Diagnostics; +using System.Globalization; namespace Octokit { /// /// Collection of feeds including both url and type /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class FeedLinks { /// /// The GitHub global public timeline /// - public FeedLink Timeline { get; set; } + public FeedLink Timeline { get; protected set; } /// /// The public timeline for any user, using URI template /// - public FeedLink User { get; set; } + public FeedLink User { get; protected set; } /// /// The public timeline for the authenticated user /// - public FeedLink CurrentUserPublic { get; set; } + public FeedLink CurrentUserPublic { get; protected set; } /// /// The private timeline for the authenticated user /// - public FeedLink CurrentUser { get; set; } + public FeedLink CurrentUser { get; protected set; } /// /// The private timeline for activity created by the authenticated user /// - public FeedLink CurrentUserActor { get; set; } + public FeedLink CurrentUserActor { get; protected set; } /// /// The private timeline for the authenticated user for a given organization, using URI template - /// - public FeedLink CurrentUserOrganization { get; set; } + /// + public FeedLink CurrentUserOrganization { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Timeline: {0}, User: {1}, CurrentUser: {2}", Timeline, User, CurrentUser); } + } } /// /// Feed information including feed url and feed type /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class FeedLink { /// /// Link to feed /// - public string Href { get; set; } + public string Href { get; protected set; } /// /// Feed type, e.g. application/atom+xml /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public string Type { get; set; } + public string Type { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Type: {0}, Href: {1}", Type, Href); } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/GistChangeStatus.cs b/Octokit/Models/Response/GistChangeStatus.cs index 4b790347..1f9ca062 100644 --- a/Octokit/Models/Response/GistChangeStatus.cs +++ b/Octokit/Models/Response/GistChangeStatus.cs @@ -1,23 +1,33 @@ -namespace Octokit +using System; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit { /// /// User by to indicate the level of change. /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GistChangeStatus { /// /// The number of deletions that occurred as part of this change. /// - public int Deletions { get; set; } + public int Deletions { get; protected set; } /// /// The number of additions that occurred as part of this change. /// - public int Additions { get; set; } + public int Additions { get; protected set; } /// /// The total number of changes. /// - public int Total { get; set; } + public int Total { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Deletions: {0}, Additions: {1}, Total: {2}", Deletions, Additions, Total); } + } } } \ No newline at end of file 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/GistFile.cs b/Octokit/Models/Response/GistFile.cs index 64aad8b0..8ffac091 100644 --- a/Octokit/Models/Response/GistFile.cs +++ b/Octokit/Models/Response/GistFile.cs @@ -1,39 +1,48 @@ -using System.Diagnostics.CodeAnalysis; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GistFile { /// /// The size in bytes of the file. /// - public int Size { get; set; } + public int Size { get; protected set; } /// /// The name of the file /// [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] - public string Filename { get; set; } + public string Filename { get; protected set; } /// /// The mime type of the file /// [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public string Type { get; set; } + public string Type { get; protected set; } /// /// The programming language of the file, if any. /// - public string Language { get; set; } + public string Language { get; protected set; } /// /// The text content of the file. /// - public string Content { get; set; } + public string Content { get; protected set; } /// /// The url to download the file. /// - public string RawUrl { get; set; } + public string RawUrl { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Filename: {0}, Size: {1}, Type: {2}, Language: {3}", Filename, Size, Type, Language); } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/GistFork.cs b/Octokit/Models/Response/GistFork.cs index b6c3662c..26c9b79d 100644 --- a/Octokit/Models/Response/GistFork.cs +++ b/Octokit/Models/Response/GistFork.cs @@ -1,22 +1,30 @@ using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GistFork { /// /// The that created this /// - public User User { get; set; } + public User User { get; protected set; } /// /// The API URL for this . /// - public string Url { get; set; } + public string Url { get; protected set; } /// /// The for when this was created. /// - public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset CreatedAt { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "User: {0}, Url: {1}", User.DebuggerDisplay, Url); } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/GistHistory.cs b/Octokit/Models/Response/GistHistory.cs index 0ea5fe32..679659b8 100644 --- a/Octokit/Models/Response/GistHistory.cs +++ b/Octokit/Models/Response/GistHistory.cs @@ -1,35 +1,43 @@ using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { /// /// A historical version of a /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GistHistory { /// /// The url that can be used by the API to retrieve this version of the . /// - public string Url { get; set; } + public string Url { get; protected set; } /// /// A git sha representing the version. /// - public string Version { get; set; } + public string Version { get; protected set; } /// /// The who create this version. /// - public User User { get; set; } + public User User { get; protected set; } /// /// A that represents the level of change for this . /// - public GistChangeStatus ChangeStatus { get; set; } + public GistChangeStatus ChangeStatus { get; protected set; } /// /// The the version was created. /// - public DateTimeOffset CommittedAt { get; set; } + public DateTimeOffset CommittedAt { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "User: {0}, Url: {1}, Version: {2}, ChangeStatus: {3}", User.DebuggerDisplay, Url, Version, ChangeStatus); } + } } } \ No newline at end of file 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/GitHubCommitFile.cs b/Octokit/Models/Response/GitHubCommitFile.cs index daadf0f3..c8d2b571 100644 --- a/Octokit/Models/Response/GitHubCommitFile.cs +++ b/Octokit/Models/Response/GitHubCommitFile.cs @@ -15,59 +15,56 @@ namespace Octokit /// The name of the file /// [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] - public string Filename { get; set; } + public string Filename { get; protected set; } /// /// Number of additions performed on the file. /// - public int Additions { get; set; } + public int Additions { get; protected set; } /// /// Number of deletions performed on the file. /// - public int Deletions { get; set; } + public int Deletions { get; protected set; } /// /// Number of changes performed on the file. /// - public int Changes { get; set; } + public int Changes { get; protected set; } /// /// File status, like modified, added, deleted. /// - public string Status { get; set; } + public string Status { get; protected set; } /// /// The url to the file blob. /// - public string BlobUrl { get; set; } + public string BlobUrl { get; protected set; } /// /// The url to file contents API. /// - public string ContentsUrl { get; set; } + public string ContentsUrl { get; protected set; } /// /// The raw url to download the file. /// - public string RawUrl { get; set; } + public string RawUrl { get; protected set; } /// /// The SHA of the file. /// - public string Sha { get; set; } + public string Sha { get; protected set; } /// /// The patch associated with the commit /// - public string Patch { get; set; } + public string Patch { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Filename: {0} ({1})", Filename, Status); - } + get { return String.Format(CultureInfo.InvariantCulture, "Filename: {0} ({1})", Filename, Status); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/GitHubCommitStats.cs b/Octokit/Models/Response/GitHubCommitStats.cs index 940d3550..91caca3d 100644 --- a/Octokit/Models/Response/GitHubCommitStats.cs +++ b/Octokit/Models/Response/GitHubCommitStats.cs @@ -13,24 +13,21 @@ namespace Octokit /// /// The number of additions made within the commit /// - public int Additions { get; set; } + public int Additions { get; protected set; } /// /// The number of deletions made within the commit /// - public int Deletions { get; set; } + public int Deletions { get; protected set; } /// /// The total number of modifications within the commit /// - public int Total { get; set; } + public int Total { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Stats: +{0} -{1} ={2}", Additions, Deletions, Total); - } + get { return String.Format(CultureInfo.InvariantCulture, "Stats: +{0} -{1} ={2}", Additions, Deletions, Total); } } } } 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/NotificationInfo.cs b/Octokit/Models/Response/NotificationInfo.cs index db1670cc..814946ca 100644 --- a/Octokit/Models/Response/NotificationInfo.cs +++ b/Octokit/Models/Response/NotificationInfo.cs @@ -1,14 +1,26 @@ -using System.Diagnostics.CodeAnalysis; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class NotificationInfo { - public string Title { get; set; } - public string Url { get; set; } - public string LatestCommentUrl { get; set; } + public string Title { get; protected set; } + + public string Url { get; protected set; } + + public string LatestCommentUrl { get; protected set; } + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Matches the property name used by the API")] - public string Type { get; set; } + public string Type { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Type: {0}, Title: {1}", Type, Title); } + } } } 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/Plan.cs b/Octokit/Models/Response/Plan.cs index a7740656..9fe2974e 100644 --- a/Octokit/Models/Response/Plan.cs +++ b/Octokit/Models/Response/Plan.cs @@ -1,36 +1,46 @@ +using System; +using System.Diagnostics; +using System.Globalization; + namespace Octokit { /// /// A plan (either paid or free) for a particular user /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Plan { /// /// The number of collaborators allowed with this plan. /// /// This returns because GitHub Enterprise uses a sentinel value of 999999999999 to denote an "unlimited" number of collaborators. - public long Collaborators { get; set; } + public long Collaborators { get; protected set; } /// /// The name of the plan. /// - public string Name { get; set; } + public string Name { get; protected set; } /// /// The number of private repositories allowed with this plan. /// /// This returns because GitHub Enterprise uses a sentinel value of 999999999999 to denote an "unlimited" number of plans. - public long PrivateRepos { get; set; } + public long PrivateRepos { get; protected set; } /// /// The amount of disk space allowed with this plan. /// /// This returns because GitHub Enterprise uses a sentinel value of 999999999999 to denote an "unlimited" amount of disk space. - public long Space { get; set; } + public long Space { get; protected set; } /// /// The billing email for the organization. Only has a value in response to editing an organization. /// - public string BillingEmail { get; set; } + public string BillingEmail { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0}, Space: {1}, Private Repos: {2}, Collaborators: {3}", Name, Space, PrivateRepos, Collaborators); } + } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Request/PublicKey.cs b/Octokit/Models/Response/PublicKey.cs similarity index 59% rename from Octokit/Models/Request/PublicKey.cs rename to Octokit/Models/Response/PublicKey.cs index 925fd2a3..96e4bbd6 100644 --- a/Octokit/Models/Request/PublicKey.cs +++ b/Octokit/Models/Response/PublicKey.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Globalization; @@ -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..462888c0 100644 --- a/Octokit/Models/Response/PullRequestReviewComment.cs +++ b/Octokit/Models/Response/PullRequestReviewComment.cs @@ -1,80 +1,95 @@ using System; using System.Diagnostics; +using System.Globalization; 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; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Id: {0}, Path: {1}, User: {2}, Url: {3}", Id, Path, User.DebuggerDisplay, Url); } + } } 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/RepositoryPermissions.cs b/Octokit/Models/Response/RepositoryPermissions.cs index 1997dffb..62c3c413 100644 --- a/Octokit/Models/Response/RepositoryPermissions.cs +++ b/Octokit/Models/Response/RepositoryPermissions.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Octokit @@ -11,25 +10,21 @@ namespace Octokit /// /// Whether the current user has administrative permissions /// - public bool Admin { get; set; } + public bool Admin { get; protected set; } /// /// Whether the current user has push permissions /// - public bool Push { get; set; } + public bool Push { get; protected set; } /// /// Whether the current user has pull permissions /// - public bool Pull { get; set; } - + public bool Pull { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Admin: {0}, Push: {1}, Pull: {2}", Admin, Push, Pull); - } + get { return String.Format(CultureInfo.InvariantCulture, "Admin: {0}, Push: {1}, Pull: {2}", Admin, Push, Pull); } } } -} \ No newline at end of file +} 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/SearchCode.cs b/Octokit/Models/Response/SearchCode.cs index c91d607d..7acd53d1 100644 --- a/Octokit/Models/Response/SearchCode.cs +++ b/Octokit/Models/Response/SearchCode.cs @@ -10,44 +10,41 @@ namespace Octokit /// /// file name /// - public string Name { get; set; } + public string Name { get; protected set; } /// /// path to file /// - public string Path { get; set; } + public string Path { get; protected set; } /// /// Sha for file /// - public string Sha { get; set; } + public string Sha { get; protected set; } /// /// api-url to file /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } /// /// git-url to file /// - public Uri GitUrl { get; set; } + public Uri GitUrl { get; protected set; } /// /// html-url to file /// - public Uri HtmlUrl { get; set; } + public Uri HtmlUrl { get; protected set; } /// /// Repo where this file belongs to /// - public Repository Repository { get; set; } + public Repository Repository { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Sha: {0} Name: {1}", Sha, Name); - } + get { return String.Format(CultureInfo.InvariantCulture, "Sha: {0} Name: {1}", Sha, Name); } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/SignatureResponse.cs b/Octokit/Models/Response/SignatureResponse.cs index 517d5b3b..854cc2e0 100644 --- a/Octokit/Models/Response/SignatureResponse.cs +++ b/Octokit/Models/Response/SignatureResponse.cs @@ -7,16 +7,26 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class SignatureResponse { - public string Name { get; set; } - public string Email { get; set; } - public DateTimeOffset Date { get; set; } + public SignatureResponse() + { + } + + public SignatureResponse(string name, string email, DateTimeOffset date) + { + Name = name; + Email = email; + Date = date; + } + + public string Name { get; protected set; } + + public string Email { get; protected set; } + + public DateTimeOffset Date { get; protected set; } internal string DebuggerDisplay { - get - { - return String.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Date: {2}", Name, Email, Date); - } + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0} Email: {1} Date: {2}", Name, Email, Date); } } } -} \ No newline at end of file +} 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/TagObject.cs b/Octokit/Models/Response/TagObject.cs index 183f754f..b08fc5b3 100644 --- a/Octokit/Models/Response/TagObject.cs +++ b/Octokit/Models/Response/TagObject.cs @@ -1,10 +1,14 @@ -namespace Octokit +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TagObject : GitReference { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Name defined by web api and required for deserialisation")] - public TaggedType Type { get; set; } + public TaggedType Type { get; protected set; } } /// 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/TreeItem.cs b/Octokit/Models/Response/TreeItem.cs index 0fff7f60..9ac97d42 100644 --- a/Octokit/Models/Response/TreeItem.cs +++ b/Octokit/Models/Response/TreeItem.cs @@ -1,40 +1,48 @@ using System; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Globalization; namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TreeItem { /// /// The path for this Tree Item. /// - public string Path { get; set; } + public string Path { get; protected set; } /// /// The mode of this Tree Item. /// - public string Mode { get; set; } + public string Mode { get; protected set; } /// /// The type of this Tree Item. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public TreeType Type { get; set; } + public TreeType Type { get; protected set; } /// /// The size of this Tree Item. /// - public int Size { get; set; } + public int Size { get; protected set; } /// /// The SHA of this Tree Item. /// - public string Sha { get; set; } + public string Sha { get; protected set; } /// /// The URL of this Tree Item. /// - public Uri Url { get; set; } + public Uri Url { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Sha: {0}, Path: {1}, Type: {2}, Size: {3}", Sha, Path, Type, Size); } + } } public enum TreeType diff --git a/Octokit/Models/Response/TreeResponse.cs b/Octokit/Models/Response/TreeResponse.cs index 19414a04..1f985920 100644 --- a/Octokit/Models/Response/TreeResponse.cs +++ b/Octokit/Models/Response/TreeResponse.cs @@ -24,6 +24,11 @@ namespace Octokit /// public IReadOnlyList Tree { get; protected set; } + /// + /// Whether the response was truncated due to GitHub API limits. + /// + public bool Truncated { get; protected set; } + internal string DebuggerDisplay { get 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 +} diff --git a/Octokit/Models/Response/WeeklyCommitActivity.cs b/Octokit/Models/Response/WeeklyCommitActivity.cs index b10009f5..00f3ceb2 100644 --- a/Octokit/Models/Response/WeeklyCommitActivity.cs +++ b/Octokit/Models/Response/WeeklyCommitActivity.cs @@ -13,17 +13,17 @@ namespace Octokit /// /// The days array is a group of commits per day, starting on Sunday. /// - public IEnumerable Days { get; set; } + public IEnumerable Days { get; protected set; } /// /// Totally number of commits made this week. /// - public int Total { get; set; } + public int Total { get; protected set; } /// /// The week of commits /// - public long Week { get; set; } + public long Week { get; protected set; } public DateTimeOffset WeekTimestamp { @@ -49,4 +49,4 @@ namespace Octokit } } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/WeeklyHash.cs b/Octokit/Models/Response/WeeklyHash.cs index a8a9775f..3549dfea 100644 --- a/Octokit/Models/Response/WeeklyHash.cs +++ b/Octokit/Models/Response/WeeklyHash.cs @@ -10,16 +10,16 @@ namespace Octokit public class WeeklyHash { [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "W")] - public long W { get; set; } + public long W { get; protected set; } [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "A")] - public int A { get; set; } + public int A { get; protected set; } [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D")] - public int D { get; set; } + public int D { get; protected set; } [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "C")] - public int C { get; set; } + public int C { get; protected set; } public DateTimeOffset Week { @@ -50,4 +50,4 @@ namespace Octokit } } } -} \ No newline at end of file +} diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index b0013d32..6d7df606 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -89,6 +89,7 @@ + @@ -336,11 +337,11 @@ - + @@ -359,6 +360,7 @@ + \ No newline at end of file diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index 940a6be4..1b821073 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -347,11 +347,11 @@ - + @@ -371,6 +371,8 @@ + + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index 7e9742cb..6c10f91b 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -342,11 +342,11 @@ - + @@ -366,6 +366,8 @@ + + diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj index 10765c88..c5e24d81 100644 --- a/Octokit/Octokit-Portable.csproj +++ b/Octokit/Octokit-Portable.csproj @@ -335,12 +335,12 @@ - + @@ -357,6 +357,8 @@ + + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 55cd9bbe..51f922e0 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -338,11 +338,11 @@ - + @@ -361,6 +361,8 @@ + + diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index d7cbe304..390cd99d 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -78,6 +78,7 @@ + @@ -85,11 +86,12 @@ - + +