Skip to content

Commit

Permalink
[feat]: Add archive url to repository info
Browse files Browse the repository at this point in the history
* Add archive url to repository info

* Add test

---------

Co-authored-by: Perry <perry@perry.dev.br>
  • Loading branch information
perrylets and Perry authored Oct 9, 2023
1 parent 12e29ab commit 5dd3cfe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
Expand Down Expand Up @@ -1043,6 +1044,25 @@ public async Task ReturnsRepositoryDeleteBranchOnMergeOptionsWithRepositoryId()
Assert.NotNull(repository.DeleteBranchOnMerge);
}
}

[IntegrationTest]
public async Task ReceivesCorrectArchiveUrl()
{
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"),
new ObservableCredentialProvider());

var repo = await github.Repository.Get("octokit", "octokit.net");

Assert.Equal("https://api.github.com/repos/octokit/octokit.net/{archive_format}{/ref}", repo.ArchiveUrl);
}

class ObservableCredentialProvider : ICredentialStore
{
public async Task<Credentials> GetCredentials()
{
return await Observable.Return(Helper.Credentials);
}
}
}

public class TheGetAllPublicMethod
Expand Down
4 changes: 3 additions & 1 deletion Octokit/Models/Response/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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 hasDiscussions, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived, int watchersCount, bool? deleteBranchOnMerge, RepositoryVisibility visibility, IEnumerable<string> topics, bool? allowAutoMerge, bool? allowUpdateBranch, bool? webCommitSignoffRequired)
public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, string sshUrl, string svnUrl, string mirrorUrl, string archiveUrl, 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 hasDiscussions, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived, int watchersCount, bool? deleteBranchOnMerge, RepositoryVisibility visibility, IEnumerable<string> topics, bool? allowAutoMerge, bool? allowUpdateBranch, bool? webCommitSignoffRequired)
{
Url = url;
HtmlUrl = htmlUrl;
Expand All @@ -26,6 +26,7 @@ public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, st
SshUrl = sshUrl;
SvnUrl = svnUrl;
MirrorUrl = mirrorUrl;
ArchiveUrl = archiveUrl;
Id = id;
NodeId = nodeId;
Owner = owner;
Expand Down Expand Up @@ -83,6 +84,7 @@ public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, st
public string SvnUrl { get; private set; }

public string MirrorUrl { get; private set; }
public string ArchiveUrl { get; private set; }

public long Id { get; private set; }

Expand Down

0 comments on commit 5dd3cfe

Please sign in to comment.