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 name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return ApiConnection.Get(ApiUrls.RepositoryPage(owner, name)); } /// /// Gets the page metadata for a given repository /// /// The ID of the repository /// /// See the API documentation for more information. /// /// public Task Get(int repositoryId) { return ApiConnection.Get(ApiUrls.RepositoryPage(repositoryId)); } /// /// 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 name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return GetAll(owner, name, ApiOptions.None); } /// /// Gets all build metadata for a given repository /// /// The ID of the repository /// /// See the API documentation for more information. /// /// public Task> GetAll(int repositoryId) { return GetAll(repositoryId, 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 name, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(options, "options"); var endpoint = ApiUrls.RepositoryPageBuilds(owner, name); return ApiConnection.GetAll(endpoint, options); } /// /// Gets all build metadata for a given repository /// /// The ID of the repository /// Options to change the API response /// /// See the API documentation for more information. /// /// public Task> GetAll(int repositoryId, ApiOptions options) { Ensure.ArgumentNotNull(options, "options"); var endpoint = ApiUrls.RepositoryPageBuilds(repositoryId); return ApiConnection.GetAll(endpoint, 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 name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return ApiConnection.Get(ApiUrls.RepositoryPageBuildsLatest(owner, name)); } /// /// Gets the build metadata for the last build for a given repository /// /// The ID of the repository /// /// See the API documentation for more information. /// /// public Task GetLatest(int repositoryId) { return ApiConnection.Get(ApiUrls.RepositoryPageBuildsLatest(repositoryId)); } } }