using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit { /// /// A client for GitHub's Repository Pages API. /// /// /// See the Repository Pages API documentation for more information. /// public class RepositoryPagesClient : ApiClient, IRepositoryPagesClient { /// /// Initializes a new GitHub Repository Pages API client. /// /// An API connection. public RepositoryPagesClient(IApiConnection apiConnection) : base(apiConnection) { } /// /// Gets the page metadata for a given repository /// /// The owner of the repository /// The name of the repository /// /// See the API documentation for more information. /// /// public Task Get(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); return ApiConnection.Get(ApiUrls.RepositoryPage(owner, repositoryName)); } /// /// Gets all build metadata for a given repository /// /// The owner of the repository /// The name of the repository /// /// See the API documentation for more information. /// /// public Task> GetAll(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); return GetAll(owner, repositoryName, ApiOptions.None); } /// /// Gets all build metadata for a given repository /// /// The owner of the repository /// The name of the repository /// Options to change the API response /// /// See the API documentation for more information. /// /// public Task> GetAll(string owner, string repositoryName, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); Ensure.ArgumentNotNull(options, "options"); var endpoint = ApiUrls.RepositoryPageBuilds(owner, repositoryName); return ApiConnection.GetAll(endpoint, null, AcceptHeaders.StableVersion, options); } /// /// Gets the build metadata for the last build for a given repository /// /// The owner of the repository /// The name of the repository /// /// See the API documentation for more information. /// /// public Task GetLatest(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); return ApiConnection.Get(ApiUrls.RepositoryPageBuildsLatest(owner, repositoryName)); } } }