Skip to content

Commit

Permalink
Update Repository to include WatchersCount (#2182)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolGrzesiak authored Jun 7, 2020
1 parent 1c026db commit 62c0b1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,11 @@ public async Task ReturnsSpecifiedRepository()

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]
Expand All @@ -668,10 +669,11 @@ public async Task ReturnsSpecifiedRepositoryWithRepositoryId()

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]
Expand Down
6 changes: 5 additions & 1 deletion Octokit/Models/Response/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Repository(long id)
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;
Expand Down Expand Up @@ -55,6 +55,7 @@ public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, st
AllowSquashMerge = allowSquashMerge;
AllowMergeCommit = allowMergeCommit;
Archived = archived;
WatchersCount = watchersCount;
}

public string Url { get; protected set; }
Expand Down Expand Up @@ -100,6 +101,8 @@ public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, st

public int StargazersCount { get; protected set; }

public int WatchersCount { get; protected set; }

public string DefaultBranch { get; protected set; }

public int OpenIssuesCount { get; protected set; }
Expand Down Expand Up @@ -132,6 +135,7 @@ public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, st

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; }
Expand Down

0 comments on commit 62c0b1f

Please sign in to comment.