Commit da6dfbca authored by Greg Messner's avatar Greg Messner
Browse files

Added new search filer parameters (#605)

parent 3f76db3d
package org.gitlab4j.api.models; package org.gitlab4j.api.models;
import java.util.Date;
import org.gitlab4j.api.Constants;
import org.gitlab4j.api.Constants.ProjectOrderBy; import org.gitlab4j.api.Constants.ProjectOrderBy;
import org.gitlab4j.api.Constants.SortOrder; import org.gitlab4j.api.Constants.SortOrder;
import org.gitlab4j.api.Constants;
import org.gitlab4j.api.GitLabApiForm; import org.gitlab4j.api.GitLabApiForm;
/** /**
...@@ -15,6 +17,7 @@ public class ProjectFilter { ...@@ -15,6 +17,7 @@ public class ProjectFilter {
private ProjectOrderBy orderBy; private ProjectOrderBy orderBy;
private SortOrder sort; private SortOrder sort;
private String search; private String search;
private Boolean searchNamespaces;
private Boolean simple; private Boolean simple;
private Boolean owned; private Boolean owned;
private Boolean membership; private Boolean membership;
...@@ -27,6 +30,11 @@ public class ProjectFilter { ...@@ -27,6 +30,11 @@ public class ProjectFilter {
private Boolean wikiChecksumFailed; private Boolean wikiChecksumFailed;
private Boolean repositoryChecksumFailed; private Boolean repositoryChecksumFailed;
private AccessLevel minAccessLevel; private AccessLevel minAccessLevel;
private Integer idAfter;
private Integer idBefore;
private Date lastActivityAfter;
private Date lastActivityBefore;
private String repositoryStorage;
/** /**
* Limit by archived status. * Limit by archived status.
...@@ -83,6 +91,17 @@ public class ProjectFilter { ...@@ -83,6 +91,17 @@ public class ProjectFilter {
return (this); return (this);
} }
/**
* Include ancestor namespaces when matching search criteria. Default is false.
*
* @param searchNamespaces if true, include ancestor namespaces when matching search criteria
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withSearchNamespaces(Boolean searchNamespaces) {
this.searchNamespaces = searchNamespaces;
return (this);
}
/** /**
* Return only limited fields for each project. This is a no-op without * Return only limited fields for each project. This is a no-op without
* authentication as then only simple fields are returned. * authentication as then only simple fields are returned.
...@@ -220,7 +239,7 @@ public class ProjectFilter { ...@@ -220,7 +239,7 @@ public class ProjectFilter {
} }
/** /**
* Limit by current user minimal access level * Limit by current user minimal access level.
* *
* @param minAccessLevel limit by current user minimal access level * @param minAccessLevel limit by current user minimal access level
* @return the reference to this ProjectFilter instance * @return the reference to this ProjectFilter instance
...@@ -230,6 +249,61 @@ public class ProjectFilter { ...@@ -230,6 +249,61 @@ public class ProjectFilter {
return (this); return (this);
} }
/**
* Limit results to projects with IDs greater than the specified projectID.
*
* @param idAfter limit results to projects with IDs greater than the specified project ID
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withIdAfter(Integer idAfter) {
this.idAfter = idAfter;
return (this);
}
/**
* Limit results to projects with IDs less than the specified project ID.
*
* @param idBefore limit results to projects with IDs less than the specified project ID
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withIdBefore(Integer idBefore) {
this.idBefore = idBefore;
return (this);
}
/**
* Limit results to projects with last_activity after specified time.
*
* @param lastActivityAfter limit results to projects with last_activity after specified time
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withLastActivityAfter(Date lastActivityAfter) {
this.lastActivityAfter = lastActivityAfter;
return (this);
}
/**
* Limit results to projects with last_activity before specified time.
*
* @param lastActivityBefore limit results to projects with last_activity before specified time
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withLastActivityBefore(Date lastActivityBefore) {
this.lastActivityBefore = lastActivityBefore;
return (this);
}
/**
* Limit results to projects stored on the specified repository_storage. Available for admins only.
*
* @param repositoryStorage limit results to projects stored on repository_storage
* @return the reference to this ProjectFilter instance
*/
public ProjectFilter withRepositoryStorage(String repositoryStorage) {
this.repositoryStorage = repositoryStorage;
return (this);
}
/** /**
* Get the query params specified by this filter. * Get the query params specified by this filter.
* *
...@@ -255,6 +329,7 @@ public class ProjectFilter { ...@@ -255,6 +329,7 @@ public class ProjectFilter {
.withParam("order_by", orderBy) .withParam("order_by", orderBy)
.withParam("sort", sort) .withParam("sort", sort)
.withParam("search", search) .withParam("search", search)
.withParam("search_namespaces", searchNamespaces)
.withParam("simple", simple) .withParam("simple", simple)
.withParam("owned", owned) .withParam("owned", owned)
.withParam("membership", membership) .withParam("membership", membership)
...@@ -262,11 +337,16 @@ public class ProjectFilter { ...@@ -262,11 +337,16 @@ public class ProjectFilter {
.withParam("statistics", statistics) .withParam("statistics", statistics)
.withParam("with_custom_attributes", withCustomAttributes) .withParam("with_custom_attributes", withCustomAttributes)
.withParam("with_issues_enabled", withIssuesEnabled) .withParam("with_issues_enabled", withIssuesEnabled)
.withParam("with_merge_requests_enabled ", withMergeRequestsEnabled)) .withParam("with_merge_requests_enabled", withMergeRequestsEnabled)
.withParam("with_programming_language", withProgrammingLanguage) .withParam("with_programming_language", withProgrammingLanguage)
.withParam("wiki_checksum_failed", wikiChecksumFailed) .withParam("wiki_checksum_failed", wikiChecksumFailed)
.withParam("repository_checksum_failed", repositoryChecksumFailed) .withParam("repository_checksum_failed", repositoryChecksumFailed)
.withParam("min_access_level", (minAccessLevel != null ? minAccessLevel.toValue() : null) .withParam("min_access_level", (minAccessLevel != null ? minAccessLevel.toValue() : null))
.withParam("id_after", idAfter)
.withParam("id_before", idBefore)
.withParam("last_activity_after", lastActivityAfter)
.withParam("last_activity_before", lastActivityBefore)
.withParam("repository_storage", repositoryStorage)
); );
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment