Exemplo n.º 1
0
        /// <summary>
        /// Get user restrictions for the specified branch (applies only to Organization owned repositories)
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#list-user-restrictions-of-protected-branch">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 <User> GetProtectedBranchUserRestrictions(string owner, string name, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(_client.GetProtectedBranchUserRestrictions(owner, name, branch).ToObservable().SelectMany(x => x));
        }
        public async Task GetsProtectedBranchUserRestrictionsForOrgRepo()
        {
            var repoOwner    = _orgRepoContext.RepositoryContext.RepositoryOwner;
            var repoName     = _orgRepoContext.RepositoryContext.RepositoryName;
            var restrictions = await _client.GetProtectedBranchUserRestrictions(repoOwner, repoName, "master");

            Assert.NotNull(restrictions);
            Assert.Equal(0, restrictions.Count);
        }