using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
///
/// Used to request and filter a list of repositories.
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class RepositoryRequest : RequestParameters
{
///
/// Gets or sets the repository type.
///
///
/// The type.
///
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public RepositoryType? Type { get; set; }
///
/// Gets or sets the sort property.
///
///
/// The sort.
///
public RepositorySort? Sort { get; set; }
///
/// Gets or sets the sort direction.
///
///
/// The direction.
///
public SortDirection? Direction { get; set; }
///
/// Gets or sets the visibility property.
///
///
/// The visibility.
///
public RepositoryVisibility? Visibility { get; set; }
///
/// Gets or sets the affiliation property.
///
///
/// The affiliation.
///
public RepositoryAffiliation? Affiliation { get; set; }
internal string DebuggerDisplay
{
get
{
var propValues = new List();
if (Type.HasValue)
propValues.Add(string.Format(CultureInfo.InvariantCulture, "Type: {0}", Type));
if (Sort.HasValue)
propValues.Add(string.Format(CultureInfo.InvariantCulture, "Sort: {0}", Sort));
if (Direction.HasValue)
propValues.Add(string.Format(CultureInfo.InvariantCulture, "Direction: {0}", Direction));
if (Visibility.HasValue)
propValues.Add(string.Format(CultureInfo.InvariantCulture, "Visibility: {0}", Visibility));
if (Affiliation.HasValue)
propValues.Add(string.Format(CultureInfo.InvariantCulture, "Affiliation: {0}", Affiliation));
return string.Join(", ", propValues);
}
}
}
///
/// The properties that repositories can be filtered by.
///
public enum RepositoryType
{
///
/// Return all repositories.
///
[Parameter(Value = "all")]
All,
///
/// Return repositories that the current authenticated user owns.
///
[Parameter(Value = "owner")]
Owner,
///
/// Returns public repositories.
///
[Parameter(Value = "public")]
Public,
///
/// The privateReturn private repositories.
///
[Parameter(Value = "private")]
Private,
///
/// Return repositories for which the current authenticated user is a member of the org or team.
///
[Parameter(Value = "member")]
Member
}
///
/// The properties that repositories can be sorted by.
///
public enum RepositorySort
{
///
/// Sort by the date the repository was created.
///
[Parameter(Value = "created")]
Created,
///
/// Sort by the date the repository was last updated.
///
[Parameter(Value = "updated")]
Updated,
///
/// Sort by the date the repository was last pushed.
///
[Parameter(Value = "pushed")]
Pushed,
///
/// Sort by the repository name.
///
[Parameter(Value = "full_name")]
FullName
}
///
/// The properties that repositories can be visible by.
///
public enum RepositoryVisibility
{
///
/// Returns only public repositories
///
[Parameter(Value = "public")]
Public,
///
/// Returns only private repositories
///
[Parameter(Value = "private")]
Private,
///
/// Return both public and private repositories
///
[Parameter(Value = "all")]
All
}
///
/// The properties that repositories can be affiliated by.
///
public enum RepositoryAffiliation
{
///
/// Repositories that are owned by the authenticated user
///
[Parameter(Value = "owner")]
Owner,
///
/// Repositories that the user has been added to as a collaborator.
///
[Parameter(Value = "collaborator")]
Collaborator,
///
/// Repositories that the user has access to through being a member of an organization.
/// This includes every repository on every team that the user is on.
///
[Parameter(Value = "organization_member")]
OrganizationMember,
///
/// Return repositories that are owned by authenticated user and added to as a collaborator.
///
[Parameter(Value = "owner, collaborator")]
OwnerAndCollaborator,
///
/// Return repositories that are owned by authenticated user or user is a organization member.
///
[Parameter(Value = "owner, organization_member")]
OwnerAndOrganizationMember,
///
/// Return repositories that user has been added as collaborator or user is a organization member.
///
[Parameter(Value = "collaborator, organization_member")]
CollaboratorAndOrganizationMember,
///
/// Returns all repositories where user is owner,collaborator or organization member.
///
[Parameter(Value = "owner, collaborator, organization_member")]
All
}
}