From 62c0b1fe080750eea4c54eea670234d596cd473a Mon Sep 17 00:00:00 2001 From: KarolGrzesiak Date: Sun, 7 Jun 2020 19:11:56 +0200 Subject: [PATCH] Update Repository to include WatchersCount (#2182) --- .../Clients/RepositoriesClientTests.cs | 6 ++++-- Octokit/Models/Response/Repository.cs | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs index 820b56ca..a3257649 100644 --- a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs @@ -655,10 +655,11 @@ public class RepositoriesClientTests var repository = await github.Repository.Get("haacked", "seegit"); - Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl); + Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl, ignoreCase: true); Assert.False(repository.Private); Assert.False(repository.Fork); Assert.Equal(AccountType.User, repository.Owner.Type); + Assert.True(repository.WatchersCount > 0); } [IntegrationTest] @@ -668,10 +669,11 @@ public class RepositoriesClientTests var repository = await github.Repository.Get(3622414); - Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl); + Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl, ignoreCase: true); Assert.False(repository.Private); Assert.False(repository.Fork); Assert.Equal(AccountType.User, repository.Owner.Type); + Assert.True(repository.WatchersCount > 0); } [IntegrationTest] diff --git a/Octokit/Models/Response/Repository.cs b/Octokit/Models/Response/Repository.cs index d768e581..7b6836c9 100644 --- a/Octokit/Models/Response/Repository.cs +++ b/Octokit/Models/Response/Repository.cs @@ -14,7 +14,7 @@ namespace Octokit Id = id; } - public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, string sshUrl, string svnUrl, string mirrorUrl, long id, string nodeId, User owner, string name, string fullName, bool isTemplate, string description, string homepage, string language, bool @private, bool fork, int forksCount, int stargazersCount, string defaultBranch, int openIssuesCount, DateTimeOffset? pushedAt, DateTimeOffset createdAt, DateTimeOffset updatedAt, RepositoryPermissions permissions, Repository parent, Repository source, LicenseMetadata license, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived) + public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, string sshUrl, string svnUrl, string mirrorUrl, long id, string nodeId, User owner, string name, string fullName, bool isTemplate, string description, string homepage, string language, bool @private, bool fork, int forksCount, int stargazersCount, string defaultBranch, int openIssuesCount, DateTimeOffset? pushedAt, DateTimeOffset createdAt, DateTimeOffset updatedAt, RepositoryPermissions permissions, Repository parent, Repository source, LicenseMetadata license, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived, int watchersCount) { Url = url; HtmlUrl = htmlUrl; @@ -55,6 +55,7 @@ namespace Octokit AllowSquashMerge = allowSquashMerge; AllowMergeCommit = allowMergeCommit; Archived = archived; + WatchersCount = watchersCount; } public string Url { get; protected set; } @@ -100,6 +101,8 @@ namespace Octokit public int StargazersCount { get; protected set; } + public int WatchersCount { get; protected set; } + public string DefaultBranch { get; protected set; } public int OpenIssuesCount { get; protected set; } @@ -132,6 +135,7 @@ namespace Octokit public bool HasPages { get; protected set; } + [Obsolete("Update your code to use WatchersCount as this field will stop containing data in the future")] public int SubscribersCount { get; protected set; } public long Size { get; protected set; }