Files
octokit.net/Octokit/Models/Request/SearchLabelsRequest.cs
Ryan Gribble 3b2be81486 Release v0.30 - Where Have You Been All My Life? (#1816)
* run FormatCode build task to fix whitespace/formatting

* correctly flag some GitHub Enterprise tests

* Add Release Notes

* tweak appveyor to not build branch in the repo, when a PR exists already

* travis to only build master branch and PRs

* output actual "dotnet run" command being executed for cake.frosting builds

* update latest Cake.Frosting

* use normal verbosity at the moment due to apparent conflict with "verbose" and latest SDK on appveyor

* try using double dash so dotnet executable doesnt look at --verbosity argument

* travis OSX couldn't download SDK 2.0.3 anymore, lets try the latest 2.1.300
2018-06-18 08:34:14 +10:00

83 lines
2.3 KiB
C#

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Octokit.Internal;
namespace Octokit
{
/// <summary>
/// Search labels
/// https://developer.github.com/v3/search/#search-labels
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class SearchLabelsRequest : BaseSearchRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="SearchLabelsRequest"/> class.
/// </summary>
public SearchLabelsRequest() : base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SearchLabelsRequest"/> class.
/// </summary>
/// <param name="term">The search term.</param>
/// <param name="repositoryId">The repository to search in</param>
public SearchLabelsRequest(string term, long repositoryId) : base(term)
{
RepositoryId = repositoryId;
}
/// <summary>
/// Optional Sort field. One of created or updated.
/// If not provided, results are sorted by best match.
/// </summary>
public LabelSearchSort? SortField { get; set; }
public override string Sort
{
get { return SortField.ToParameter(); }
}
/// <summary>
/// The repository to search in
/// </summary>
public long RepositoryId { get; set; }
public override IDictionary<string, string> AdditionalParameters()
{
return new Dictionary<string, string>
{
{ "repository_id", RepositoryId.ToString() }
};
}
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Term: {0} Sort: {1} RepositoryId: {2}", Term, Sort, RepositoryId);
}
}
}
public enum LabelSearchSort
{
/// <summary>
/// search by created
/// </summary>
[Parameter(Value = "created")]
Created,
/// <summary>
/// search by last updated
/// </summary>
[Parameter(Value = "updated")]
Updated
}
}