using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using Octokit.Reactive.Internal;
namespace Octokit.Reactive
{
public class ObservableRepositoryBranchesClient : IObservableRepositoryBranchesClient
{
readonly IRepositoryBranchesClient _client;
readonly IConnection _connection;
public ObservableRepositoryBranchesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, nameof(client));
_client = client.Repository.Branch;
_connection = client.Connection;
}
///
/// Gets all the branches for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
public IObservable GetAll(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAll(owner, name, ApiOptions.None);
}
///
/// Gets all the branches for the specified repository.
///
///
/// See the API documentation for more details
///
/// The ID of the repository
public IObservable GetAll(long repositoryId)
{
return GetAll(repositoryId, ApiOptions.None);
}
///
/// Gets all the branches for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
public IObservable GetAll(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepoBranches(owner, name), options);
}
///
/// Gets all the branches for the specified repository.
///
///
/// See the API documentation for more details
///
/// The ID of the repository
/// Options for changing the API response
public IObservable GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepoBranches(repositoryId), options);
}
///
/// Gets the specified branch.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
public IObservable Get(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.Get(owner, name, branch).ToObservable();
}
///
/// Gets the specified branch.
///
///
/// See the API documentation for more details
///
/// The ID of the repository
/// The name of the branch
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
public IObservable Get(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.Get(repositoryId, branch).ToObservable();
}
///
/// Get the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetBranchProtection(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetBranchProtection(owner, name, branch).ToObservable();
}
///
/// Get the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetBranchProtection(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetBranchProtection(repositoryId, branch).ToObservable();
}
///
/// Update the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// Branch protection settings
public IObservable UpdateBranchProtection(string owner, string name, string branch, BranchProtectionSettingsUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateBranchProtection(owner, name, branch, update).ToObservable();
}
///
/// Update the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// Branch protection settings
public IObservable UpdateBranchProtection(long repositoryId, string branch, BranchProtectionSettingsUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateBranchProtection(repositoryId, branch, update).ToObservable();
}
///
/// Remove the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable DeleteBranchProtection(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteBranchProtection(owner, name, branch).ToObservable();
}
///
/// Remove the branch protection settings for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable DeleteBranchProtection(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteBranchProtection(repositoryId, branch).ToObservable();
}
///
/// Get the required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetRequiredStatusChecks(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetRequiredStatusChecks(owner, name, branch).ToObservable();
}
///
/// Get the required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetRequiredStatusChecks(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetRequiredStatusChecks(repositoryId, branch).ToObservable();
}
///
/// Replace required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// Required status checks
public IObservable UpdateRequiredStatusChecks(string owner, string name, string branch, BranchProtectionRequiredStatusChecksUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateRequiredStatusChecks(owner, name, branch, update).ToObservable();
}
///
/// Replace required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// Required status checks
public IObservable UpdateRequiredStatusChecks(long repositoryId, string branch, BranchProtectionRequiredStatusChecksUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateRequiredStatusChecks(repositoryId, branch, update).ToObservable();
}
///
/// Remove required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable DeleteRequiredStatusChecks(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteRequiredStatusChecks(owner, name, branch).ToObservable();
}
///
/// Remove required status checks for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable DeleteRequiredStatusChecks(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteRequiredStatusChecks(repositoryId, branch).ToObservable();
}
///
/// Get the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetAllRequiredStatusChecksContexts(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllRequiredStatusChecksContexts(owner, name, branch).ToObservable().SelectMany(x => x);
}
///
/// Get the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetAllRequiredStatusChecksContexts(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllRequiredStatusChecksContexts(repositoryId, branch).ToObservable().SelectMany(x => x);
}
///
/// Replace the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// The contexts to replace
public IObservable UpdateRequiredStatusChecksContexts(string owner, string name, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.UpdateRequiredStatusChecksContexts(owner, name, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Replace the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// The contexts to replace
public IObservable UpdateRequiredStatusChecksContexts(long repositoryId, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.UpdateRequiredStatusChecksContexts(repositoryId, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Add the required status checks context for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// The contexts to add
public IObservable AddRequiredStatusChecksContexts(string owner, string name, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.AddRequiredStatusChecksContexts(owner, name, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Add the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// The contexts to add
public IObservable AddRequiredStatusChecksContexts(long repositoryId, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.AddRequiredStatusChecksContexts(repositoryId, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Remove the required status checks context for the specified branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// The contexts to remove
public IObservable DeleteRequiredStatusChecksContexts(string owner, string name, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.DeleteRequiredStatusChecksContexts(owner, name, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Remove the required status checks contexts for the specified branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// The contexts to remove
public IObservable DeleteRequiredStatusChecksContexts(long repositoryId, string branch, IReadOnlyList contexts)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(contexts, nameof(contexts));
return _client.DeleteRequiredStatusChecksContexts(repositoryId, branch, contexts).ToObservable().SelectMany(x => x);
}
///
/// Get required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetReviewEnforcement(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetReviewEnforcement(owner, name, branch).ToObservable();
}
///
/// Get required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetReviewEnforcement(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetReviewEnforcement(repositoryId, branch).ToObservable();
}
///
/// Update required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// The required pull request review settings
public IObservable UpdateReviewEnforcement(string owner, string name, string branch, BranchProtectionRequiredReviewsUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateReviewEnforcement(owner, name, branch, update).ToObservable();
}
///
/// Update required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// The required pull request review settings
public IObservable UpdateReviewEnforcement(long repositoryId, string branch, BranchProtectionRequiredReviewsUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.UpdateReviewEnforcement(repositoryId, branch, update).ToObservable();
}
///
/// Remove required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable RemoveReviewEnforcement(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.RemoveReviewEnforcement(owner, name, branch).ToObservable();
}
///
/// Remove required pull request review enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable RemoveReviewEnforcement(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.RemoveReviewEnforcement(repositoryId, branch).ToObservable();
}
///
/// Get admin enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetAdminEnforcement(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAdminEnforcement(owner, name, branch).ToObservable();
}
///
/// Get admin enforcement of protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetAdminEnforcement(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAdminEnforcement(repositoryId, branch).ToObservable();
}
///
/// Add admin enforcement to protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable AddAdminEnforcement(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.AddAdminEnforcement(owner, name, branch).ToObservable();
}
///
/// Add admin enforcement to protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable AddAdminEnforcement(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.AddAdminEnforcement(repositoryId, branch).ToObservable();
}
///
/// Remove admin enforcement on protected branch
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable RemoveAdminEnforcement(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.RemoveAdminEnforcement(owner, name, branch).ToObservable();
}
///
/// Remove admin enforcement on protected branch
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable RemoveAdminEnforcement(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.RemoveAdminEnforcement(repositoryId, branch).ToObservable();
}
///
/// Get the restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetProtectedBranchRestrictions(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetProtectedBranchRestrictions(owner, name, branch).ToObservable();
}
///
/// Get the restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetProtectedBranchRestrictions(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetProtectedBranchRestrictions(repositoryId, branch).ToObservable();
}
///
/// Remove restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable DeleteProtectedBranchRestrictions(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteProtectedBranchRestrictions(owner, name, branch).ToObservable();
}
///
/// Remove restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable DeleteProtectedBranchRestrictions(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.DeleteProtectedBranchRestrictions(repositoryId, branch).ToObservable();
}
///
/// Get team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetAllProtectedBranchTeamRestrictions(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllProtectedBranchTeamRestrictions(owner, name, branch).ToObservable().SelectMany(x => x);
}
///
/// Get team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetAllProtectedBranchTeamRestrictions(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllProtectedBranchTeamRestrictions(repositoryId, branch).ToObservable().SelectMany(x => x);
}
///
/// Replace team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of teams with push access
public IObservable UpdateProtectedBranchTeamRestrictions(string owner, string name, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.UpdateProtectedBranchTeamRestrictions(owner, name, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Replace team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of teams with push access
public IObservable UpdateProtectedBranchTeamRestrictions(long repositoryId, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.UpdateProtectedBranchTeamRestrictions(repositoryId, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Add team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of teams with push access
public IObservable AddProtectedBranchTeamRestrictions(string owner, string name, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.AddProtectedBranchTeamRestrictions(owner, name, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Add team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of teams with push access
public IObservable AddProtectedBranchTeamRestrictions(long repositoryId, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.AddProtectedBranchTeamRestrictions(repositoryId, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Remove team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of teams to remove
public IObservable DeleteProtectedBranchTeamRestrictions(string owner, string name, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.DeleteProtectedBranchTeamRestrictions(owner, name, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Remove team restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of teams to remove
public IObservable DeleteProtectedBranchTeamRestrictions(long repositoryId, string branch, BranchProtectionTeamCollection teams)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(teams, nameof(teams));
return _client.DeleteProtectedBranchTeamRestrictions(repositoryId, branch, teams).ToObservable().SelectMany(x => x);
}
///
/// Get user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
public IObservable GetAllProtectedBranchUserRestrictions(string owner, string name, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllProtectedBranchUserRestrictions(owner, name, branch).ToObservable().SelectMany(x => x);
}
///
/// Get user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
public IObservable GetAllProtectedBranchUserRestrictions(long repositoryId, string branch)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
return _client.GetAllProtectedBranchUserRestrictions(repositoryId, branch).ToObservable().SelectMany(x => x);
}
///
/// Replace user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of users with push access
public IObservable UpdateProtectedBranchUserRestrictions(string owner, string name, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.UpdateProtectedBranchUserRestrictions(owner, name, branch, users).ToObservable().SelectMany(x => x);
}
///
/// Replace user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of users with push access
public IObservable UpdateProtectedBranchUserRestrictions(long repositoryId, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.UpdateProtectedBranchUserRestrictions(repositoryId, branch, users).ToObservable().SelectMany(x => x);
}
///
/// Add user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of users with push access to add
public IObservable AddProtectedBranchUserRestrictions(string owner, string name, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.AddProtectedBranchUserRestrictions(owner, name, branch, users).ToObservable().SelectMany(x => x);
}
///
/// Add user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of users with push access to add
public IObservable AddProtectedBranchUserRestrictions(long repositoryId, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.AddProtectedBranchUserRestrictions(repositoryId, branch, users).ToObservable().SelectMany(x => x);
}
///
/// Remove user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// The name of the branch
/// List of users with push access to remove
public IObservable DeleteProtectedBranchUserRestrictions(string owner, string name, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.DeleteProtectedBranchUserRestrictions(owner, name, branch, users).ToObservable().SelectMany(x => x);
}
///
/// Remove user restrictions for the specified branch (applies only to Organization owned repositories)
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// The name of the branch
/// List of users with push access to remove
public IObservable DeleteProtectedBranchUserRestrictions(long repositoryId, string branch, BranchProtectionUserCollection users)
{
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
Ensure.ArgumentNotNull(users, nameof(users));
return _client.DeleteProtectedBranchUserRestrictions(repositoryId, branch, users).ToObservable().SelectMany(x => x);
}
}
}