mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-09 13:01:36 +00:00
Implement Get Update and Delete BranchProtection methods in ObservableRepositoryBranchesClient
Add unit tests for Observable methods
This commit is contained in:
@@ -147,5 +147,107 @@ namespace Octokit.Reactive
|
||||
|
||||
return _client.Edit(repositoryId, branch, update).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branch">The name of the branch</param>
|
||||
public IObservable<BranchProtectionSettings> GetBranchProtection(string owner, string name, string branch)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
|
||||
return _client.GetBranchProtection(owner, name, branch).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branch">The name of the branch</param>
|
||||
public IObservable<BranchProtectionSettings> GetBranchProtection(int repositoryId, string branch)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
|
||||
return _client.GetBranchProtection(repositoryId, branch).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#update-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branch">The name of the branch</param>
|
||||
/// <param name="update">Branch protection settings</param>
|
||||
public IObservable<BranchProtectionSettings> UpdateBranchProtection(string owner, string name, string branch, BranchProtectionSettingsUpdate update)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
Ensure.ArgumentNotNull(update, "update");
|
||||
|
||||
return _client.UpdateBranchProtection(owner, name, branch, update).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#update-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="update">Branch protection settings</param>
|
||||
public IObservable<BranchProtectionSettings> UpdateBranchProtection(int repositoryId, string branch, BranchProtectionSettingsUpdate update)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
Ensure.ArgumentNotNull(update, "update");
|
||||
|
||||
return _client.UpdateBranchProtection(repositoryId, branch, update).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#remove-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branch">The name of the branch</param>
|
||||
public IObservable<bool> DeleteBranchProtection(string owner, string name, string branch)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
|
||||
return _client.DeleteBranchProtection(owner, name, branch).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the branch protection settings for the specified branch />
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#remove-branch-protection">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branch">The name of the branch</param>
|
||||
public IObservable<bool> DeleteBranchProtection(int repositoryId, string branch)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
|
||||
|
||||
return _client.DeleteBranchProtection(repositoryId, branch).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user