Skip to content

Commit ec740d4

Browse files
authored
Add source to PipelineFilter (#1159)
1 parent 7a224e3 commit ec740d4

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

Diff for: src/main/java/org/gitlab4j/api/Constants.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,29 @@ public String toString() {
357357
}
358358
}
359359

360+
/** Enum to use for specifying the source when calling getPipelines(). */
361+
public enum PipelineSource {
362+
363+
PUSH, WEB, TRIGGER, SCHEDULE, API, EXTERNAL, PIPELINE, CHAT, WEBIDE, MERGE_REQUEST_EVENT, EXTERNAL_PULL_REQUEST_EVENT;
364+
365+
private static JacksonJsonEnumHelper<PipelineSource> enumHelper = new JacksonJsonEnumHelper<>(PipelineSource.class);
366+
367+
@JsonCreator
368+
public static PipelineSource forValue(String value) {
369+
return enumHelper.forValue(value);
370+
}
371+
372+
@JsonValue
373+
public String toValue() {
374+
return (enumHelper.toString(this));
375+
}
376+
377+
@Override
378+
public String toString() {
379+
return (enumHelper.toString(this));
380+
}
381+
}
382+
360383
/** Enum to use for specifying the scope when calling getJobs(). */
361384
public enum JobScope {
362385

@@ -1098,4 +1121,3 @@ public String toString() {
10981121
}
10991122
}
11001123
}
1101-

Diff for: src/main/java/org/gitlab4j/api/models/PipelineFilter.java

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonIgnore;
44
import org.gitlab4j.api.Constants.PipelineOrderBy;
55
import org.gitlab4j.api.Constants.PipelineScope;
6+
import org.gitlab4j.api.Constants.PipelineSource;
67
import org.gitlab4j.api.Constants.SortOrder;
78
import org.gitlab4j.api.GitLabApiForm;
89
import org.gitlab4j.api.utils.JacksonJson;
@@ -22,6 +23,9 @@ public class PipelineFilter implements Serializable {
2223
/** {@link org.gitlab4j.api.Constants.PipelineScope} The status of pipelines, one of: running, pending, success, failed, canceled, skipped, created */
2324
private PipelineStatus status;
2425

26+
/** {@link org.gitlab4j.api.Constants.PipelineSource} The source of pipelines */
27+
private PipelineSource source;
28+
2529
/** The ref of pipelines. */
2630
private String ref;
2731

@@ -62,6 +66,10 @@ public void setStatus(PipelineStatus status) {
6266
this.status = status;
6367
}
6468

69+
public void setSource(PipelineSource source) {
70+
this.source = source;
71+
}
72+
6573
public void setRef(String ref) {
6674
this.ref = ref;
6775
}
@@ -108,6 +116,11 @@ public PipelineFilter withStatus(PipelineStatus status) {
108116
return this;
109117
}
110118

119+
public PipelineFilter withSource(PipelineSource source) {
120+
this.source = source;
121+
return this;
122+
}
123+
111124
public PipelineFilter withRef(String ref) {
112125
this.ref = ref;
113126
return this;
@@ -158,6 +171,7 @@ public GitLabApiForm getQueryParams() {
158171
return (new GitLabApiForm()
159172
.withParam("scope", scope)
160173
.withParam("status", status)
174+
.withParam("source", source)
161175
.withParam("ref", ref)
162176
.withParam("sha", sha)
163177
.withParam("yaml_errors", yamlErrors)

0 commit comments

Comments
 (0)