Added 'Archived' flag to Repository response. (#1845)

* Added 'Archived' flag to Repository response.

* add Archived support to repository update
add Archived support to search repo and search issues

* add archived field to ctor
This commit is contained in:
Jeysson Jose Guevara Mendivil
2018-07-17 05:21:48 +03:00
committed by Ryan Gribble
parent 4df21a61de
commit 8407369485
4 changed files with 30 additions and 1 deletions
@@ -78,6 +78,11 @@ namespace Octokit
/// </summary>
public bool? AllowMergeCommit { get; set; }
/// <summary>
/// Optional. True to archive this repository. Note: you cannot unarchive repositories through the API.
/// </summary>
public bool? Archived { get; set; }
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal string DebuggerDisplay
{
@@ -264,6 +264,11 @@ namespace Octokit
/// </summary>
public string Milestone { get; set; }
/// <summary>
/// Filters issues or pull requests based on whether they are in an archived repository.
/// </summary>
public bool? Archived { get; set; }
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public RepositoryCollection Repos { get; set; }
@@ -402,6 +407,11 @@ namespace Octokit
parameters.Add(string.Format(CultureInfo.InvariantCulture, "milestone:\"{0}\"", Milestone.EscapeDoubleQuotes()));
}
if (Archived != null)
{
parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower()));
}
// Add any exclusion parameters
if (Exclusions != null)
{
@@ -112,6 +112,11 @@ namespace Octokit
/// </summary>
public DateRange Updated { get; set; }
/// <summary>
/// Filters whether archived repositories should be included (true) or not (false).
/// </summary>
public bool? Archived { get; set; }
public override IReadOnlyList<string> MergedQualifiers()
{
var parameters = new List<string>();
@@ -160,6 +165,12 @@ namespace Octokit
{
parameters.Add(string.Format(CultureInfo.InvariantCulture, "pushed:{0}", Updated));
}
if (Archived != null)
{
parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower()));
}
return parameters;
}
+4 -1
View File
@@ -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, 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)
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, 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)
{
Url = url;
HtmlUrl = htmlUrl;
@@ -53,6 +53,7 @@ namespace Octokit
AllowRebaseMerge = allowRebaseMerge;
AllowSquashMerge = allowSquashMerge;
AllowMergeCommit = allowMergeCommit;
Archived = archived;
}
public string Url { get; protected set; }
@@ -132,6 +133,8 @@ namespace Octokit
public long Size { get; protected set; }
public bool Archived { get; protected set; }
internal string DebuggerDisplay
{
get