diff --git a/pom.xml b/pom.xml index 245a85fed4..94e123303f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.kohsuke github-api - 1.322-SNAPSHOT + 1.322-ecwid-8 GitHub API for Java https://github-api.kohsuke.org/ GitHub API for Java diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index 3a88231394..fd5203a699 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -112,6 +112,13 @@ public GHBranchProtection getProtection() throws IOException { .fetch(GHBranchProtection.class); } + public PagedIterable getRules() throws IOException { + return root().createRequest() + .withPreview(Previews.LUKE_CAGE) + .withUrlPath(owner.getApiTailUrl("rules/branches/" + name)) + .toIterable(GHRule[].class, GHRule::wrap); + } + /** * Gets sha 1. * diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java index 250dbe7755..fe6514a3e9 100644 --- a/src/main/java/org/kohsuke/github/GHCommit.java +++ b/src/main/java/org/kohsuke/github/GHCommit.java @@ -335,6 +335,40 @@ public GHRepository getOwner() { return owner; } + /** + * Gets commit verification. + * @return + */ + public GHVerification getVerification() { + return commit.getVerification(); + } + + /** + * Gets commit author. + * @return + */ + public GitUser getCommitAuthor() { + return commit.getAuthor(); + } + + /** + * Gets commit committer. + * @return + */ + public GitUser getCommitCommitter() { + return commit.getCommitter(); + } + + /** + * Gets message. + * + * @return the commit message + * @throws IOException + * the io exception + */ + public String getMessage() throws IOException { + return getCommitShortInfo().getMessage(); + } /** * Gets lines changed. * diff --git a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java index c3faccbfad..c6da7455bb 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java +++ b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java @@ -41,6 +41,8 @@ justification = "JSON API") public class GHPullRequestCommitDetail { private GHPullRequest owner; + private GHCommitDetailAuthor author; + private GHCommitDetailAuthor committer; /** * Wrap up. @@ -52,6 +54,20 @@ void wrapUp(GHPullRequest owner) { this.owner = owner; } + /** + * Type for the GitHub user + */ + public static class GHCommitDetailAuthor { + String login; + + /** + * GitHub user login + */ + public String getLogin() { + return login; + } + } + /** * The type Authorship. * @@ -285,4 +301,20 @@ public CommitPointer[] getParents() { System.arraycopy(parents, 0, newValue, 0, parents.length); return newValue; } + + /** + * Gets the GitHub user - author of the commit. + * + */ + public GHCommitDetailAuthor getAuthor() { + return author; + } + + /** + * Gets the GitHub user - committer of the commit. + * + */ + public GHCommitDetailAuthor getCommitter() { + return committer; + } } diff --git a/src/main/java/org/kohsuke/github/GHRule.java b/src/main/java/org/kohsuke/github/GHRule.java new file mode 100644 index 0000000000..e0440eb569 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHRule.java @@ -0,0 +1,142 @@ +package org.kohsuke.github; + +import java.util.Collection; + +public class GHRule { + private RuleType type; + private Parameters parameters; + + public RuleType getType() { + return type; + } + + public void setType(RuleType type) { + this.type = type; + } + + public Parameters getParameters() { + return parameters; + } + + public void setParameters(Parameters parameters) { + this.parameters = parameters; + } + + + public GHRule wrap() { + return this; + } + + public enum RuleType { + commit_author_email_pattern, + creation, + deletion, + merge_queue, + non_fast_forward, + pull_request, + require_code_scanning, + require_deployments, + require_linear_history, + required_signatures, + required_status_checks, + update, + } + + public static class Parameters { + private Collection required_status_checks; + private MergeMethod merge_method; + private Integer max_entries_to_build; + private Integer min_entries_to_merge; + private Integer max_entries_to_merge; + private Integer min_entries_to_merge_wait_minutes; + private Integer check_response_timeout_minutes; + private GroupingStrategy grouping_strategy; + + public Collection getRequiredStatusChecks() { + return required_status_checks; + } + + public void setRequiredStatusChecks(Collection required_status_checks) { + this.required_status_checks = required_status_checks; + } + + public MergeMethod getMergeMethod() { + return merge_method; + } + + public void setMergeMethod(MergeMethod merge_method) { + this.merge_method = merge_method; + } + + public Integer getMaxEntriesToBuild() { + return max_entries_to_build; + } + + public void setMaxEntriesToBuild(Integer maxEntriesToBuild) { + this.max_entries_to_build = maxEntriesToBuild; + } + + public Integer getMinEntriesToMerge() { + return min_entries_to_merge; + } + + public void setMinEntriesToMerge(Integer minEntriesToMerge) { + this.min_entries_to_merge = minEntriesToMerge; + } + + public Integer getMaxEntriesToMerge() { + return max_entries_to_merge; + } + + public void setMaxEntriesToMerge(Integer maxEntriesToMerge) { + this.max_entries_to_merge = maxEntriesToMerge; + } + + public Integer getMinEntriesToMergeWaitMinutes() { + return min_entries_to_merge_wait_minutes; + } + + public void setMinEntriesToMergeWaitMinutes(Integer minEntriesToMergeWaitMinutes) { + this.min_entries_to_merge_wait_minutes = minEntriesToMergeWaitMinutes; + } + + public Integer getCheckResponseTimeoutMinutes() { + return check_response_timeout_minutes; + } + + public void setCheckResponseTimeoutMinutes(Integer checkResponseTimeoutMinutes) { + this.check_response_timeout_minutes = checkResponseTimeoutMinutes; + } + + public GroupingStrategy getGroupingStrategy() { + return grouping_strategy; + } + + public void setGroupingStrategy(GroupingStrategy groupingStrategy) { + this.grouping_strategy = groupingStrategy; + } + } + + public static class RequiredCheck { + private String context; + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + } + + public enum MergeMethod { + MERGE, + SQUASH, + REBASE + } + + public enum GroupingStrategy { + ALLGREEN, + HEADGREEN + } +}