Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source to PipelineFilter #1159

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/main/java/org/gitlab4j/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<PipelineSource> 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 {

Expand Down Expand Up @@ -1098,4 +1121,3 @@ public String toString() {
}
}
}

14 changes: 14 additions & 0 deletions src/main/java/org/gitlab4j/api/models/PipelineFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Loading