using System; using System.Diagnostics; using Octokit.Internal; namespace Octokit { /// /// Represents a piece of content in the repository. This could be a submodule, a symlink, a directory, or a file. /// Look at the Type property to figure out which one it is. /// [DebuggerDisplay("{DebuggerDisplay,nq}")] public class RepositoryContent : RepositoryContentInfo { public RepositoryContent() { } public RepositoryContent(string name, string path, string sha, int size, ContentType type, Uri downloadUrl, Uri url, Uri gitUrl, Uri htmlUrl, string encoding, string encodedContent, string target, Uri submoduleGitUrl) : base(name, path, sha, size, type, downloadUrl, url, gitUrl, htmlUrl) { Encoding = encoding; EncodedContent = encodedContent; Target = target; SubmoduleGitUrl = submoduleGitUrl; } /// /// The encoding of the content if this is a file. Typically "base64". Otherwise it's null. /// public string Encoding { get; protected set; } /// /// The Base64 encoded content if this is a file. Otherwise it's null. /// [Parameter(Key = "content")] public string EncodedContent { get; private set; } /// /// The unencoded content. Only access this if the content is expected to be text and not binary content. /// public string Content { get { return EncodedContent != null ? EncodedContent.FromBase64String() : null; } } /// /// Path to the target file in the repository if this is a symlink. Otherwise it's null. /// public string Target { get; protected set; } /// /// The location of the submodule repository if this is a submodule. Otherwise it's null. /// public Uri SubmoduleGitUrl { get; protected set; } } }