Skip to content

Commit da6dfbc

Browse files
committed
Added new search filer parameters (#605)
1 parent 3f76db3 commit da6dfbc

File tree

1 file changed

+84
-4
lines changed

1 file changed

+84
-4
lines changed

src/main/java/org/gitlab4j/api/models/ProjectFilter.java

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package org.gitlab4j.api.models;
22

3+
import java.util.Date;
4+
5+
import org.gitlab4j.api.Constants;
36
import org.gitlab4j.api.Constants.ProjectOrderBy;
47
import org.gitlab4j.api.Constants.SortOrder;
5-
import org.gitlab4j.api.Constants;
68
import org.gitlab4j.api.GitLabApiForm;
79

810
/**
@@ -15,6 +17,7 @@ public class ProjectFilter {
1517
private ProjectOrderBy orderBy;
1618
private SortOrder sort;
1719
private String search;
20+
private Boolean searchNamespaces;
1821
private Boolean simple;
1922
private Boolean owned;
2023
private Boolean membership;
@@ -27,6 +30,11 @@ public class ProjectFilter {
2730
private Boolean wikiChecksumFailed;
2831
private Boolean repositoryChecksumFailed;
2932
private AccessLevel minAccessLevel;
33+
private Integer idAfter;
34+
private Integer idBefore;
35+
private Date lastActivityAfter;
36+
private Date lastActivityBefore;
37+
private String repositoryStorage;
3038

3139
/**
3240
* Limit by archived status.
@@ -83,6 +91,17 @@ public ProjectFilter withSearch(String search) {
8391
return (this);
8492
}
8593

94+
/**
95+
* Include ancestor namespaces when matching search criteria. Default is false.
96+
*
97+
* @param searchNamespaces if true, include ancestor namespaces when matching search criteria
98+
* @return the reference to this ProjectFilter instance
99+
*/
100+
public ProjectFilter withSearchNamespaces(Boolean searchNamespaces) {
101+
this.searchNamespaces = searchNamespaces;
102+
return (this);
103+
}
104+
86105
/**
87106
* Return only limited fields for each project. This is a no-op without
88107
* authentication as then only simple fields are returned.
@@ -220,7 +239,7 @@ public ProjectFilter minAccessLevel(AccessLevel minAccessLevel) {
220239
}
221240

222241
/**
223-
* Limit by current user minimal access level
242+
* Limit by current user minimal access level.
224243
*
225244
* @param minAccessLevel limit by current user minimal access level
226245
* @return the reference to this ProjectFilter instance
@@ -230,6 +249,61 @@ public ProjectFilter withMinAccessLevel(AccessLevel minAccessLevel) {
230249
return (this);
231250
}
232251

252+
/**
253+
* Limit results to projects with IDs greater than the specified projectID.
254+
*
255+
* @param idAfter limit results to projects with IDs greater than the specified project ID
256+
* @return the reference to this ProjectFilter instance
257+
*/
258+
public ProjectFilter withIdAfter(Integer idAfter) {
259+
this.idAfter = idAfter;
260+
return (this);
261+
}
262+
263+
/**
264+
* Limit results to projects with IDs less than the specified project ID.
265+
*
266+
* @param idBefore limit results to projects with IDs less than the specified project ID
267+
* @return the reference to this ProjectFilter instance
268+
*/
269+
public ProjectFilter withIdBefore(Integer idBefore) {
270+
this.idBefore = idBefore;
271+
return (this);
272+
}
273+
274+
/**
275+
* Limit results to projects with last_activity after specified time.
276+
*
277+
* @param lastActivityAfter limit results to projects with last_activity after specified time
278+
* @return the reference to this ProjectFilter instance
279+
*/
280+
public ProjectFilter withLastActivityAfter(Date lastActivityAfter) {
281+
this.lastActivityAfter = lastActivityAfter;
282+
return (this);
283+
}
284+
285+
/**
286+
* Limit results to projects with last_activity before specified time.
287+
*
288+
* @param lastActivityBefore limit results to projects with last_activity before specified time
289+
* @return the reference to this ProjectFilter instance
290+
*/
291+
public ProjectFilter withLastActivityBefore(Date lastActivityBefore) {
292+
this.lastActivityBefore = lastActivityBefore;
293+
return (this);
294+
}
295+
296+
/**
297+
* Limit results to projects stored on the specified repository_storage. Available for admins only.
298+
*
299+
* @param repositoryStorage limit results to projects stored on repository_storage
300+
* @return the reference to this ProjectFilter instance
301+
*/
302+
public ProjectFilter withRepositoryStorage(String repositoryStorage) {
303+
this.repositoryStorage = repositoryStorage;
304+
return (this);
305+
}
306+
233307
/**
234308
* Get the query params specified by this filter.
235309
*
@@ -255,18 +329,24 @@ public GitLabApiForm getQueryParams() {
255329
.withParam("order_by", orderBy)
256330
.withParam("sort", sort)
257331
.withParam("search", search)
332+
.withParam("search_namespaces", searchNamespaces)
258333
.withParam("simple", simple)
259334
.withParam("owned", owned)
260335
.withParam("membership", membership)
261336
.withParam("starred", starred)
262337
.withParam("statistics", statistics)
263338
.withParam("with_custom_attributes", withCustomAttributes)
264339
.withParam("with_issues_enabled", withIssuesEnabled)
265-
.withParam("with_merge_requests_enabled ", withMergeRequestsEnabled))
340+
.withParam("with_merge_requests_enabled", withMergeRequestsEnabled)
266341
.withParam("with_programming_language", withProgrammingLanguage)
267342
.withParam("wiki_checksum_failed", wikiChecksumFailed)
268343
.withParam("repository_checksum_failed", repositoryChecksumFailed)
269-
.withParam("min_access_level", (minAccessLevel != null ? minAccessLevel.toValue() : null)
344+
.withParam("min_access_level", (minAccessLevel != null ? minAccessLevel.toValue() : null))
345+
.withParam("id_after", idAfter)
346+
.withParam("id_before", idBefore)
347+
.withParam("last_activity_after", lastActivityAfter)
348+
.withParam("last_activity_before", lastActivityBefore)
349+
.withParam("repository_storage", repositoryStorage)
270350
);
271351
}
272352
}

0 commit comments

Comments
 (0)