using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
///
/// Represents an application installation.
///
///
/// For more information see https://developer.github.com/v3/apps/#find-installations
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Installation : InstallationId
{
public Installation() { }
public Installation(long id, User account, string accessTokenUrl, string repositoriesUrl, string htmlUrl, long appId, long targetId, AccountType targetType, InstallationPermissions permissions, IReadOnlyList events, string singleFileName, string repositorySelection) : base(id)
{
Account = account;
HtmlUrl = htmlUrl;
AppId = appId;
TargetId = targetId;
TargetType = targetType;
Permissions = permissions;
Events = events;
SingleFileName = singleFileName;
RepositorySelection = repositorySelection;
}
///
/// The user who owns the Installation.
///
public User Account { get; protected set; }
///
/// The URL to view the Installation on GitHub.
///
public string HtmlUrl { get; protected set; }
///
/// The Id of the associated GitHub App.
///
public long AppId { get; protected set; }
///
/// The Id of the User/Organization the Installation is installed in
///
public long TargetId { get; protected set; }
///
/// The type of the target (User or Organization)
///
public StringEnum TargetType { get; protected set; }
///
/// The Permissions granted to the Installation
///
public InstallationPermissions Permissions { get; private set; }
///
/// The Events subscribed to by the Installation
///
public IReadOnlyList Events { get; private set; }
///
/// The single file the GitHub App can manage (when Permissions.SingleFile is set to read or write)
///
public string SingleFileName { get; protected set; }
///
/// The choice of repositories the installation is on. Can be either "selected" or "all".
///
public StringEnum RepositorySelection { get; protected set; }
internal new string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} AppId: {1}", Id, AppId); }
}
}
public enum InstallationRepositorySelection
{
[Parameter(Value = "all")]
All,
[Parameter(Value = "selected")]
Selected
}
}