/// <summary> /// Get all deploy keys for a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/keys/#list"> API documentation</a> for more information. /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> public Task <IReadOnlyList <DeployKey> > GetAll(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); return(ApiConnection.GetAll <DeployKey>(ApiUrls.RepositoryDeployKeys(owner, name))); }
public Task <IReadOnlyList <DeployKey> > GetAll(string owner, string name, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); return(ApiConnection.GetAll <DeployKey>(ApiUrls.RepositoryDeployKeys(owner, name), options)); }
/// <summary> /// Creates a new deploy key for a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/keys/#create"> API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The Id of the repository.</param> /// <param name="newDeployKey">The deploy key to create for the repository.</param> public Task <DeployKey> Create(int repositoryId, NewDeployKey newDeployKey) { Ensure.ArgumentNotNull(newDeployKey, "newDeployKey"); if (string.IsNullOrWhiteSpace(newDeployKey.Title)) { throw new ArgumentException("The new deploy key's title must not be null."); } if (string.IsNullOrWhiteSpace(newDeployKey.Key)) { throw new ArgumentException("The new deploy key's key must not be null."); } return(ApiConnection.Post <DeployKey>(ApiUrls.RepositoryDeployKeys(repositoryId), newDeployKey)); }
/// <summary> /// Creates a new deploy key for a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/keys/#create"> API documentation</a> for more information. /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="newDeployKey">The deploy key to create for the repository.</param> public Task <DeployKey> Create(string owner, string name, NewDeployKey newDeployKey) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(newDeployKey, "newDeployKey"); if (string.IsNullOrWhiteSpace(newDeployKey.Title)) { throw new ArgumentException("The new deploy key's title must not be null."); } if (string.IsNullOrWhiteSpace(newDeployKey.Key)) { throw new ArgumentException("The new deploy key's key must not be null."); } return(ApiConnection.Post <DeployKey>(ApiUrls.RepositoryDeployKeys(owner, name), newDeployKey)); }
/// <summary> /// Get all deploy keys for a repository. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/keys/#list"> API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The Id of the repository.</param> /// <param name="options">Options for changing the API response</param> public Task <IReadOnlyList <DeployKey> > GetAll(int repositoryId, ApiOptions options) { Ensure.ArgumentNotNull(options, "options"); return(ApiConnection.GetAll <DeployKey>(ApiUrls.RepositoryDeployKeys(repositoryId), options)); }