/// <summary>
 /// Create a BranchProtection update request
 /// </summary>
 /// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param>
 /// <param name="requiredPullRequestReviews">Specifies if reviews are required to merge the pull request. Pass null to disable required reviews</param>
 /// <param name="restrictions">Specifies the requested push access restrictions (applies only to Organization owned repositories). Pass null to disable push access restrictions</param>
 /// <param name="enforceAdmins">Specifies whether the protections applied to this branch also apply to repository admins</param>
 public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks, BranchProtectionRequiredReviewsUpdate requiredPullRequestReviews, BranchProtectionPushRestrictionsUpdate restrictions, bool enforceAdmins)
 {
     RequiredStatusChecks       = requiredStatusChecks;
     RequiredPullRequestReviews = requiredPullRequestReviews;
     Restrictions  = restrictions;
     EnforceAdmins = enforceAdmins;
 }
 /// <summary>
 /// Create a BranchProtection update request
 /// </summary>
 /// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param>
 public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks)
 {
     RequiredStatusChecks       = requiredStatusChecks;
     RequiredPullRequestReviews = null;
     Restrictions  = null;
     EnforceAdmins = false;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a BranchProtection update request
 /// </summary>
 /// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param>
 /// <param name="restrictions">Specifies the requested push access restrictions (applies only to Organization owned repositories). Pass null to disable push access restrictions</param>
 public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks, BranchProtectionPushRestrictionsUpdate restrictions)
 {
     RequiredStatusChecks = requiredStatusChecks;
     Restrictions         = restrictions;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a BranchProtection update request
 /// </summary>
 /// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param>
 public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks)
 {
     RequiredStatusChecks = requiredStatusChecks;
     Restrictions         = null;
 }
        /// <summary>
        /// Replace required status checks for the specified branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch">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>
        /// <param name="update">Required status checks</param>
        public Task <BranchProtectionRequiredStatusChecks> UpdateRequiredStatusChecks(long repositoryId, string branch, BranchProtectionRequiredStatusChecksUpdate update)
        {
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
            Ensure.ArgumentNotNull(update, "update");

            return(ApiConnection.Patch <BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(repositoryId, branch), update, AcceptHeaders.ProtectedBranchesApiPreview));
        }
        /// <summary>
        /// Replace required status checks for the specified branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#update-required-status-checks-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>
        /// <param name="update">Required status checks</param>
        public Task <BranchProtectionRequiredStatusChecks> UpdateRequiredStatusChecks(string owner, string name, string branch, BranchProtectionRequiredStatusChecksUpdate update)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
            Ensure.ArgumentNotNull(update, "update");

            return(ApiConnection.Patch <BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), update, AcceptHeaders.ProtectedBranchesApiPreview));
        }