From ec740d4ce7cde3cb4a0c2c3829bb3b81927f0d67 Mon Sep 17 00:00:00 2001 From: Alishan Ladhani <8869764+aladh@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:43:54 -0400 Subject: [PATCH] Add source to PipelineFilter (#1159) --- src/main/java/org/gitlab4j/api/Constants.java | 24 ++++++++++++++++++- .../gitlab4j/api/models/PipelineFilter.java | 14 +++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab4j/api/Constants.java b/src/main/java/org/gitlab4j/api/Constants.java index f51047ef..117b7dae 100644 --- a/src/main/java/org/gitlab4j/api/Constants.java +++ b/src/main/java/org/gitlab4j/api/Constants.java @@ -357,6 +357,29 @@ public String toString() { } } + /** Enum to use for specifying the source when calling getPipelines(). */ + public enum PipelineSource { + + PUSH, WEB, TRIGGER, SCHEDULE, API, EXTERNAL, PIPELINE, CHAT, WEBIDE, MERGE_REQUEST_EVENT, EXTERNAL_PULL_REQUEST_EVENT; + + private static JacksonJsonEnumHelper enumHelper = new JacksonJsonEnumHelper<>(PipelineSource.class); + + @JsonCreator + public static PipelineSource forValue(String value) { + return enumHelper.forValue(value); + } + + @JsonValue + public String toValue() { + return (enumHelper.toString(this)); + } + + @Override + public String toString() { + return (enumHelper.toString(this)); + } + } + /** Enum to use for specifying the scope when calling getJobs(). */ public enum JobScope { @@ -1098,4 +1121,3 @@ public String toString() { } } } - diff --git a/src/main/java/org/gitlab4j/api/models/PipelineFilter.java b/src/main/java/org/gitlab4j/api/models/PipelineFilter.java index 3ec389b6..710c5f42 100644 --- a/src/main/java/org/gitlab4j/api/models/PipelineFilter.java +++ b/src/main/java/org/gitlab4j/api/models/PipelineFilter.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import org.gitlab4j.api.Constants.PipelineOrderBy; import org.gitlab4j.api.Constants.PipelineScope; +import org.gitlab4j.api.Constants.PipelineSource; import org.gitlab4j.api.Constants.SortOrder; import org.gitlab4j.api.GitLabApiForm; import org.gitlab4j.api.utils.JacksonJson; @@ -22,6 +23,9 @@ public class PipelineFilter implements Serializable { /** {@link org.gitlab4j.api.Constants.PipelineScope} The status of pipelines, one of: running, pending, success, failed, canceled, skipped, created */ private PipelineStatus status; + /** {@link org.gitlab4j.api.Constants.PipelineSource} The source of pipelines */ + private PipelineSource source; + /** The ref of pipelines. */ private String ref; @@ -62,6 +66,10 @@ public void setStatus(PipelineStatus status) { this.status = status; } + public void setSource(PipelineSource source) { + this.source = source; + } + public void setRef(String ref) { this.ref = ref; } @@ -108,6 +116,11 @@ public PipelineFilter withStatus(PipelineStatus status) { return this; } + public PipelineFilter withSource(PipelineSource source) { + this.source = source; + return this; + } + public PipelineFilter withRef(String ref) { this.ref = ref; return this; @@ -158,6 +171,7 @@ public GitLabApiForm getQueryParams() { return (new GitLabApiForm() .withParam("scope", scope) .withParam("status", status) + .withParam("source", source) .withParam("ref", ref) .withParam("sha", sha) .withParam("yaml_errors", yamlErrors)