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 = ItemStateFilter.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 ItemStateFilter 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) /// [Parameter(Value = "assigned")] Assigned, /// /// Issues created by the authenticated user. /// [Parameter(Value = "created")] Created, /// /// Issues mentioning the authenticated user. /// [Parameter(Value = "mentioned")] Mentioned, /// /// Issues the authenticated user is subscribed to for updates. /// [Parameter(Value = "subscribed")] Subscribed, /// /// All issues the authenticated user can see, regardless of participation or creation. /// [Parameter(Value = "all")] All } /// /// Range of states for Issues, Milestones and PullRequest API. /// public enum ItemStateFilter { /// /// Items that are open. /// [Parameter(Value = "open")] Open, /// /// Items that are closed. /// [Parameter(Value = "closed")] Closed, /// /// All the items. /// [Parameter(Value = "all")] All } /// /// Items that are open OR closed /// public enum ItemState { /// /// Items that are open /// [Parameter(Value = "open")] Open, /// /// Items that are closed /// [Parameter(Value = "closed")] Closed } /// /// The available properties to sort issues by. /// public enum IssueSort { /// /// Sort by create date (default) /// [Parameter(Value = "created")] Created, /// /// Sort by the date of the last update /// [Parameter(Value = "updated")] Updated, /// /// Sort by the number of comments /// [Parameter(Value = "comments")] Comments } /// /// The two possible sort directions. /// public enum SortDirection { /// /// Sort ascending /// [Parameter(Value = "asc")] Ascending, /// /// Sort descending /// [Parameter(Value = "desc")] Descending } }