mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
Add license to repository search (#2258)
This commit is contained in:
committed by
GitHub
parent
bd85dd9a4e
commit
df77be29b1
@@ -33,5 +33,13 @@ public class SearchRepositoryRequestTests
|
||||
var result = request.MergedQualifiers();
|
||||
Assert.Contains(result, x => string.Equals(x, "language:\"cpp\""));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LicenseUsesParameterTranslation()
|
||||
{
|
||||
var request = new SearchRepositoriesRequest() { License = RepoSearchLicense.Apache_2_0 };
|
||||
var result = request.MergedQualifiers();
|
||||
Assert.Contains(result, x => string.Equals(x, "license:apache-2.0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,12 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public DateRange Updated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filters repositories based on license
|
||||
/// https://help.github.com/articles/searching-repositories#search-by-license
|
||||
/// </summary>
|
||||
public RepoSearchLicense? License { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filters whether archived repositories should be included (true) or not (false).
|
||||
/// </summary>
|
||||
@@ -171,6 +177,11 @@ namespace Octokit
|
||||
parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower()));
|
||||
}
|
||||
|
||||
if (License != null)
|
||||
{
|
||||
parameters.Add(string.Format(CultureInfo.InvariantCulture, "license:{0}", License.ToParameter()));
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@@ -501,7 +512,7 @@ namespace Octokit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// lanuages that can be searched on in github
|
||||
/// Languages that can be searched on in GitHub
|
||||
/// https://help.github.com/articles/searching-repositories#languages
|
||||
/// </summary>
|
||||
public enum Language
|
||||
@@ -863,6 +874,98 @@ namespace Octokit
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Licenses than can be searched on GitHub
|
||||
/// https://help.github.com/articles/searching-repositories#search-by-license
|
||||
/// </summary>
|
||||
public enum RepoSearchLicense
|
||||
{
|
||||
[Parameter(Value = "afl-3.0")]
|
||||
AcademicFree_3_0,
|
||||
[Parameter(Value = "apache-2.0")]
|
||||
Apache_2_0,
|
||||
[Parameter(Value = "artistic-2.0")]
|
||||
Artistic_2_0,
|
||||
[Parameter(Value = "bsl-1.0")]
|
||||
BoostSoftware_1_0,
|
||||
[Parameter(Value = "0bsd")]
|
||||
BSD0Clause,
|
||||
[Parameter(Value = "bsd-2-clause")]
|
||||
BSD2Clause,
|
||||
[Parameter(Value = "bsd-3-clause")]
|
||||
BSD3Clause,
|
||||
[Parameter(Value = "bsd-3-clause-clear")]
|
||||
BSD3ClauseClear,
|
||||
[Parameter(Value = "bsd-4-clause")]
|
||||
BSD4Clause,
|
||||
[Parameter(Value = "cc")]
|
||||
CreativeCommons,
|
||||
[Parameter(Value = "cc0-1.0")]
|
||||
CreativeCommonsZero_1_0,
|
||||
[Parameter(Value = "cc-by-4.0")]
|
||||
CreativeCommonsAtrribution_4_0,
|
||||
[Parameter(Value = "cc-by-sa-4.0")]
|
||||
CreativeCommonsAttributionShareAlike_4_0,
|
||||
[Parameter(Value = "cecill-2.1")]
|
||||
CeCILL_2_1,
|
||||
[Parameter(Value = "wtfpl")]
|
||||
DoWhatTheFYouWant,
|
||||
[Parameter(Value = "ecl-2.0")]
|
||||
EducationalCommunity_2_0,
|
||||
[Parameter(Value = "epl-1.0")]
|
||||
EclipsePublic_1_0,
|
||||
[Parameter(Value = "epl-2.0")]
|
||||
EclipsePublic_2_0,
|
||||
[Parameter(Value = "eupl-1.1")]
|
||||
EuropeanUnionPublic_1_1,
|
||||
[Parameter(Value = "eupl-1.2")]
|
||||
EuropeanUnionPublic_1_2,
|
||||
[Parameter(Value = "agpl-3.0")]
|
||||
GNUAfferoGeneralPublic_3_0,
|
||||
[Parameter(Value = "gpl")]
|
||||
GNUGeneralPublic,
|
||||
[Parameter(Value = "gpl-2.0")]
|
||||
GNUGeneralPublic_2_0,
|
||||
[Parameter(Value = "gpl-3.0")]
|
||||
GNUGeneralPublic_3_0,
|
||||
[Parameter(Value = "lgpl")]
|
||||
GNULesserGeneralPublic,
|
||||
[Parameter(Value = "lgpl-2.1")]
|
||||
GNULesserGeneralPublic_2_1,
|
||||
[Parameter(Value = "lgpl-3.0")]
|
||||
GNULesserGeneralPublic_3_0,
|
||||
[Parameter(Value = "isc")]
|
||||
ISC,
|
||||
[Parameter(Value = "lppl-1.3c")]
|
||||
LatexProjectPublic,
|
||||
[Parameter(Value = "ms-pl")]
|
||||
MicrosoftPublic,
|
||||
[Parameter(Value = "ms-rl")]
|
||||
MicrosoftReciprocal,
|
||||
[Parameter(Value = "mit")]
|
||||
MIT,
|
||||
[Parameter(Value = "mpl-2.0")]
|
||||
MozillaPublic_2_0,
|
||||
[Parameter(Value = "odbl-1.0")]
|
||||
ODCOpenDatabase,
|
||||
[Parameter(Value = "osl-3.0")]
|
||||
OpenSoftware_3_0,
|
||||
[Parameter(Value = "postgresql")]
|
||||
PostgreseSQL,
|
||||
[Parameter(Value = "ofl-1.1")]
|
||||
SILOpenFont,
|
||||
[Parameter(Value = "upl-1.0")]
|
||||
UniversalPermissive,
|
||||
[Parameter(Value = "ncsa")]
|
||||
NSCAOpenSource,
|
||||
[Parameter(Value = "unlicense")]
|
||||
TheUnlicense,
|
||||
[Parameter(Value = "vim")]
|
||||
Vim,
|
||||
[Parameter(Value = "zlib")]
|
||||
ZLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sorting repositories by any of below
|
||||
/// https://help.github.com/articles/searching-repositories#sorting
|
||||
|
||||
Reference in New Issue
Block a user