mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-17 00:11:24 +00:00
Add JavaDocs
Do using IntelliJ JavaDocs plugin. Better to have something than nothing.
This commit is contained in:
@@ -17,7 +17,7 @@ import static org.kohsuke.github.Previews.*;
|
||||
/**
|
||||
* Builder to configure the branch protection settings.
|
||||
*
|
||||
* @see GHBranch#enableProtection()
|
||||
* @see GHBranch#enableProtection() GHBranch#enableProtection()
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||
"URF_UNREAD_FIELD" }, justification = "JSON API")
|
||||
@@ -33,25 +33,58 @@ public class GHBranchProtectionBuilder {
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required checks gh branch protection builder.
|
||||
*
|
||||
* @param checks
|
||||
* the checks
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder addRequiredChecks(Collection<String> checks) {
|
||||
getStatusChecks().contexts.addAll(checks);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required checks gh branch protection builder.
|
||||
*
|
||||
* @param checks
|
||||
* the checks
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder addRequiredChecks(String... checks) {
|
||||
addRequiredChecks(Arrays.asList(checks));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss stale reviews gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder dismissStaleReviews() {
|
||||
return dismissStaleReviews(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss stale reviews gh branch protection builder.
|
||||
*
|
||||
* @param v
|
||||
* the v
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder dismissStaleReviews(boolean v) {
|
||||
getPrReviews().put("dismiss_stale_reviews", v);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable gh branch protection.
|
||||
*
|
||||
* @return the gh branch protection
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHBranchProtection enable() throws IOException {
|
||||
return requester().method("PUT").withNullable("required_status_checks", statusChecks)
|
||||
.withNullable("required_pull_request_reviews", prReviews).withNullable("restrictions", restrictions)
|
||||
@@ -59,43 +92,96 @@ public class GHBranchProtectionBuilder {
|
||||
.to(branch.getProtectionUrl().toString(), GHBranchProtection.class).wrap(branch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Include admins gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder includeAdmins() {
|
||||
return includeAdmins(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Include admins gh branch protection builder.
|
||||
*
|
||||
* @param v
|
||||
* the v
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder includeAdmins(boolean v) {
|
||||
enforceAdmins = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required reviewers gh branch protection builder.
|
||||
*
|
||||
* @param v
|
||||
* the v
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requiredReviewers(int v) {
|
||||
getPrReviews().put("required_approving_review_count", v);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Require branch is up to date gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requireBranchIsUpToDate() {
|
||||
return requireBranchIsUpToDate(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Require branch is up to date gh branch protection builder.
|
||||
*
|
||||
* @param v
|
||||
* the v
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requireBranchIsUpToDate(boolean v) {
|
||||
getStatusChecks().strict = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Require code own reviews gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requireCodeOwnReviews() {
|
||||
return requireCodeOwnReviews(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Require code own reviews gh branch protection builder.
|
||||
*
|
||||
* @param v
|
||||
* the v
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requireCodeOwnReviews(boolean v) {
|
||||
getPrReviews().put("require_code_owner_reviews", v);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Require reviews gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder requireReviews() {
|
||||
getPrReviews();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict review dismissals gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder restrictReviewDismissals() {
|
||||
getPrReviews();
|
||||
|
||||
@@ -106,11 +192,23 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict push access gh branch protection builder.
|
||||
*
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder restrictPushAccess() {
|
||||
getRestrictions();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Team push access gh branch protection builder.
|
||||
*
|
||||
* @param teams
|
||||
* the teams
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder teamPushAccess(Collection<GHTeam> teams) {
|
||||
for (GHTeam team : teams) {
|
||||
teamPushAccess(team);
|
||||
@@ -118,6 +216,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Team push access gh branch protection builder.
|
||||
*
|
||||
* @param teams
|
||||
* the teams
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder teamPushAccess(GHTeam... teams) {
|
||||
for (GHTeam team : teams) {
|
||||
getRestrictions().teams.add(team.getSlug());
|
||||
@@ -125,6 +230,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Team review dismissals gh branch protection builder.
|
||||
*
|
||||
* @param teams
|
||||
* the teams
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder teamReviewDismissals(Collection<GHTeam> teams) {
|
||||
for (GHTeam team : teams) {
|
||||
teamReviewDismissals(team);
|
||||
@@ -132,6 +244,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Team review dismissals gh branch protection builder.
|
||||
*
|
||||
* @param teams
|
||||
* the teams
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder teamReviewDismissals(GHTeam... teams) {
|
||||
for (GHTeam team : teams) {
|
||||
addReviewRestriction(team.getSlug(), true);
|
||||
@@ -139,6 +258,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* User push access gh branch protection builder.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder userPushAccess(Collection<GHUser> users) {
|
||||
for (GHUser user : users) {
|
||||
userPushAccess(user);
|
||||
@@ -146,6 +272,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* User push access gh branch protection builder.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder userPushAccess(GHUser... users) {
|
||||
for (GHUser user : users) {
|
||||
getRestrictions().users.add(user.getLogin());
|
||||
@@ -153,6 +286,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* User review dismissals gh branch protection builder.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder userReviewDismissals(Collection<GHUser> users) {
|
||||
for (GHUser team : users) {
|
||||
userReviewDismissals(team);
|
||||
@@ -160,6 +300,13 @@ public class GHBranchProtectionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* User review dismissals gh branch protection builder.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @return the gh branch protection builder
|
||||
*/
|
||||
public GHBranchProtectionBuilder userReviewDismissals(GHUser... users) {
|
||||
for (GHUser user : users) {
|
||||
addReviewRestriction(user.getLogin(), false);
|
||||
|
||||
Reference in New Issue
Block a user