Add sort and direction to PullRequestRequest

This commit is contained in:
Henrik Andersson
2015-03-16 18:28:29 +10:00
parent f730846713
commit edb2a9362e
3 changed files with 47 additions and 11 deletions

View File

@@ -167,7 +167,7 @@ namespace Octokit
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The pull request number</param>
/// <returns>A <see cref="IReadOnlyList{PullRequestFile}"/> of <see cref="Files"/>s which are part of this pull request</returns>
/// <returns>A <see cref="IReadOnlyList{PullRequestFile}"/> which are part of this pull request</returns>
public Task<IReadOnlyList<PullRequestFile>> Files(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");

View File

@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
@@ -10,6 +11,8 @@ namespace Octokit
public PullRequestRequest()
{
State = ItemState.Open;
SortProperty = PullRequestSort.Created;
SortDirection = SortDirection.Descending;
}
/// <summary>
@@ -27,6 +30,18 @@ namespace Octokit
/// </summary>
public string Base { get; set; }
/// <summary>
/// What property to sort pull requests by.
/// </summary>
[Parameter(Key="sort")]
public PullRequestSort SortProperty { get; set; }
/// <summary>
/// What direction to sort the pull requests.
/// </summary>
[Parameter(Key="direction")]
public SortDirection SortDirection { get; set; }
internal string DebuggerDisplay
{
get
@@ -35,4 +50,25 @@ namespace Octokit
}
}
}
public enum PullRequestSort
{
/// <summary>
/// Sort by created date (default)
/// </summary>
Created,
/// <summary>
/// Sort by last updated date
/// </summary>
Updated,
/// <summary>
/// Sort by popularity (comment count)
/// </summary>
Popularity,
/// <summary>
/// Sort by age (filtering by pulls updated in the last month)
/// </summary>
[Parameter(Key="long-running")]
LongRunning
}
}

View File

@@ -27,16 +27,16 @@ namespace Octokit
Patch = patch;
}
public string Sha { get; set; }
public string FileName { get; set; }
public string Status { get; set; }
public int Additions { get; set; }
public int Deletions { get; set; }
public int Changes { get; set; }
public Uri BlobUri { get; set; }
public Uri RawUri { get; set; }
public Uri ContentsUri { get; set; }
public string Patch { get; set; }
public string Sha { get; protected set; }
public string FileName { get; protected set; }
public string Status { get; protected set; }
public int Additions { get; protected set; }
public int Deletions { get; protected set; }
public int Changes { get; protected set; }
public Uri BlobUri { get; protected set; }
public Uri RawUri { get; protected set; }
public Uri ContentsUri { get; protected set; }
public string Patch { get; protected set; }
internal string DebuggerDisplay
{