using System; using System.Collections.Generic; using System.Threading.Tasks; using Octokit.Internal; namespace Octokit { /// /// Client for accessing contents of files within a repository as base64 encoded content. /// /// /// See the Repository Contents API documentation for more information. /// public interface IRepositoryContentsClient { /// /// Returns the contents of a file or directory in a repository. /// /// /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository /// The content path Task> GetAllContents(string owner, string name, string path); /// /// Returns the contents of a file or directory in a repository. /// /// /// See the API documentation for more information. /// /// The ID of the repository /// The content path Task> GetAllContents(int repositoryId, string path); /// /// Returns the contents of the root directory in a repository. /// /// /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository Task> GetAllContents(string owner, string name); /// /// Returns the contents of the root directory in a repository. /// /// /// See the API documentation for more information. /// /// The ID of the repository Task> GetAllContents(int repositoryId); /// /// Returns the contents of a file or directory in a repository. /// /// /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository /// The content path /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) Task> GetAllContentsByRef(string owner, string name, string path, string reference); /// /// Returns the contents of a file or directory in a repository. /// /// /// See the API documentation for more information. /// /// The ID of the repository /// The content path /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) Task> GetAllContentsByRef(int repositoryId, string path, string reference); /// /// Returns the contents of the root directory in a repository. /// /// /// If given a path to a single file, this method returns a collection containing only that file. /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) Task> GetAllContentsByRef(string owner, string name, string reference); /// /// Returns the contents of the root directory in a repository. /// /// /// If given a path to a single file, this method returns a collection containing only that file. /// See the API documentation for more information. /// /// The ID of the repository /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) Task> GetAllContentsByRef(int repositoryId, string reference); /// /// Gets the preferred README for the specified repository. /// /// /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository /// Thrown when a general API error occurs. Task GetReadme(string owner, string name); /// /// Gets the preferred README for the specified repository. /// /// /// See the API documentation for more information. /// /// The ID of the repository /// Thrown when a general API error occurs. Task GetReadme(int repositoryId); /// /// Gets the preferred README's HTML for the specified repository. /// /// /// See the API documentation for more information. /// /// The owner of the repository /// The name of the repository /// Thrown when a general API error occurs. Task GetReadmeHtml(string owner, string name); /// /// Gets the preferred README's HTML for the specified repository. /// /// /// See the API documentation for more information. /// /// The ID of the repository /// Thrown when a general API error occurs. Task GetReadmeHtml(int repositoryId); /// /// Get an archive of a given repository's contents /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository Task GetArchive(string owner, string name); /// /// Get an archive of a given repository's contents /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The ID of the repository Task GetArchive(int repositoryId); /// /// Get an archive of a given repository's contents, in a specific format /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball Task GetArchive(string owner, string name, ArchiveFormat archiveFormat); /// /// Get an archive of a given repository's contents, in a specific format /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The ID of the repository /// The format of the archive. Can be either tarball or zipball Task GetArchive(int repositoryId, ArchiveFormat archiveFormat); /// /// Get an archive of a given repository's contents, using a specific format and reference /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference); /// /// Get an archive of a given repository's contents, using a specific format and reference /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The ID of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. Task GetArchive(int repositoryId, ArchiveFormat archiveFormat, string reference); /// /// Get an archive of a given repository's contents, in a specific format /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The owner of the repository /// The name of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. /// Time span until timeout Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference, TimeSpan timeout); /// /// Get an archive of a given repository's contents, in a specific format /// /// https://developer.github.com/v3/repos/contents/#get-archive-link /// The ID of the repository /// The format of the archive. Can be either tarball or zipball /// A valid Git reference. /// Time span until timeout Task GetArchive(int repositoryId, ArchiveFormat archiveFormat, string reference, TimeSpan timeout); /// /// Creates a commit that creates a new file in a repository. /// /// The owner of the repository /// The name of the repository /// The path to the file /// Information about the file to create Task CreateFile(string owner, string name, string path, CreateFileRequest request); /// /// Creates a commit that creates a new file in a repository. /// /// The ID of the repository /// The path to the file /// Information about the file to create Task CreateFile(int repositoryId, string path, CreateFileRequest request); /// /// Creates a commit that updates the contents of a file in a repository. /// /// The owner of the repository /// The name of the repository /// The path to the file /// Information about the file to update Task UpdateFile(string owner, string name, string path, UpdateFileRequest request); /// /// Creates a commit that updates the contents of a file in a repository. /// /// The ID of the repository /// The path to the file /// Information about the file to update Task UpdateFile(int repositoryId, string path, UpdateFileRequest request); /// /// Creates a commit that deletes a file in a repository. /// /// The owner of the repository /// The name of the repository /// The path to the file /// Information about the file to delete Task DeleteFile(string owner, string name, string path, DeleteFileRequest request); /// /// Creates a commit that deletes a file in a repository. /// /// The ID of the repository /// The path to the file /// Information about the file to delete Task DeleteFile(int repositoryId, string path, DeleteFileRequest request); } /// /// The archive format to return from the server /// public enum ArchiveFormat { /// /// The TAR archive format /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Tarball")] [Parameter(Value = "tarball")] Tarball, /// /// The ZIP archive format /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Zipball")] [Parameter(Value = "zipball")] Zipball } }