using System;
using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
///
/// Used to filter requests for lists of pull requests.
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class PullRequestRequest : RequestParameters
{
public PullRequestRequest()
{
State = ItemState.Open;
SortProperty = PullRequestSort.Created;
SortDirection = SortDirection.Descending;
}
///
/// "open" or "closed" to filter by state. Default is "open".
///
public ItemState State { get; set; }
///
/// Filter pulls by head user and branch name in the format of "user:ref-name".
///
public string Head { get; set; }
///
/// Filter pulls by base branch name.
///
public string Base { get; set; }
///
/// What property to sort pull requests by.
///
[Parameter(Key = "sort")]
public PullRequestSort SortProperty { get; set; }
///
/// What direction to sort the pull requests.
///
[Parameter(Key = "direction")]
public SortDirection SortDirection { get; set; }
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Base: {0} ", Base);
}
}
}
public enum PullRequestSort
{
///
/// Sort by created date (default)
///
Created,
///
/// Sort by last updated date
///
Updated,
///
/// Sort by popularity (comment count)
///
Popularity,
///
/// Sort by age (filtering by pulls updated in the last month)
///
[Parameter(Value = "long-running")]
LongRunning
}
}