Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Repository to include WatchersCount #2182

Merged
merged 3 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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