コード例 #1
0
        /// <summary>
        /// Get the restrictions for the specified branch (applies only to Organization owned repositories)
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#get-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 <BranchProtectionPushRestrictions> GetProtectedBranchRestrictions(string owner, string name, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(_client.GetProtectedBranchRestrictions(owner, name, branch).ToObservable());
        }
コード例 #2
0
        public async Task GetsRequirProtectedBranchRestrictionsForOrgRepo()
        {
            var repoOwner    = _orgRepoContext.RepositoryContext.RepositoryOwner;
            var repoName     = _orgRepoContext.RepositoryContext.RepositoryName;
            var restrictions = await _client.GetProtectedBranchRestrictions(repoOwner, repoName, "master");

            Assert.Equal(1, restrictions.Teams.Count);
            Assert.Equal(0, restrictions.Users.Count);
        }