using System; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using Octokit.Internal; namespace Octokit { /// /// Used to filter a request to list issues. /// [DebuggerDisplay("{DebuggerDisplay,nq}")] public class IssueRequest : RequestParameters { /// /// Initializes a new instance of the class. /// public IssueRequest() { Filter = IssueFilter.Assigned; State = ItemState.Open; Labels = new Collection(); SortProperty = IssueSort.Created; SortDirection = SortDirection.Descending; } /// /// Gets or sets the which indicates which sorts of issues to return. /// /// /// The filter. /// public IssueFilter Filter { get; set; } /// /// Gets or sets the for the issues to return. /// /// /// The state. /// public ItemState State { get; set; } /// /// Gets the labels to filter by. Add labels to the collection to only request issues with those labels. /// /// Sent as a comma separated list /// /// The labels. /// public Collection Labels { get; private set; } /// /// Gets or sets the property to sort the returned issues by. /// Combine this with to specify sort direction. /// /// /// The sort property. /// [Parameter(Key = "sort")] public IssueSort SortProperty { get; set; } /// /// Gets or sets the sort direction. /// /// /// The sort direction. /// [Parameter(Key = "direction")] public SortDirection SortDirection { get; set; } /// /// Gets or sets the date for which only issues updated at or after this time are returned. /// /// /// This is sent as a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. /// /// /// The since. /// public DateTimeOffset? Since { get; set; } internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Filter: {0} State: {1}", Filter, State); } } } /// /// The range of filters available for issues. /// /// http://developer.github.com/v3/issues/#list-issues public enum IssueFilter { /// /// Issues assigned to the authenticated user. (Default) /// Assigned, /// /// Issues created by the authenticated user. /// Created, /// /// Issues mentioning the authenticated user. /// Mentioned, /// /// Issues the authenticated user is subscribed to for updates. /// Subscribed, /// /// All issues the authenticated user can see, regardless of participation or creation. /// All } /// /// The range of states that an issue can be in. /// public enum ItemState { /// /// Isuses that are open (default). /// Open, /// /// Isuses that are closed. /// Closed, /// /// All the issues. /// All } /// /// The available properties to sort issues by. /// public enum IssueSort { /// /// Sort by create date (default) /// Created, /// /// Sort by the date of the last update /// Updated, /// /// Sort by the number of comments /// Comments } /// /// The two possible sort directions. /// public enum SortDirection { /// /// Sort ascending /// [Parameter(Value = "asc")] Ascending, /// /// Sort descending /// [Parameter(Value = "desc")] Descending } }