Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
5a7f99c5
Commit
5a7f99c5
authored
Feb 18, 2019
by
Greg Messner
Browse files
Initial commit (#302).
parent
ad4b0f4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/models/GroupFilter.java
0 → 100644
View file @
5a7f99c5
package
org.gitlab4j.api.models
;
import
java.util.List
;
import
org.gitlab4j.api.Constants.GroupOrderBy
;
import
org.gitlab4j.api.Constants.SortOrder
;
import
org.gitlab4j.api.GitLabApiForm
;
/**
* This class is used to filter Projects when getting lists of projects for a specified group.
*/
public
class
GroupFilter
{
private
List
<
Integer
>
skipGroups
;
private
Boolean
allAvailable
;
private
String
search
;
private
GroupOrderBy
orderBy
;
private
SortOrder
sort
;
private
Boolean
statistics
;
private
Boolean
withCustomAttributes
;
private
Boolean
owned
;
private
AccessLevel
accessLevel
;
/**
* Do not include the provided groups IDs.
*
* @param skipGroups List of group IDs to not include in the search
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withSkipGroups
(
List
<
Integer
>
skipGroups
)
{
this
.
skipGroups
=
skipGroups
;
return
(
this
);
}
/**
* Show all the groups you have access to (defaults to false for authenticated users, true for admin).
* Attributes owned and min_access_level have precedence
*
* @param allAvailable if true show all avauilable groups
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withAllAvailabley
(
Boolean
allAvailable
)
{
this
.
allAvailable
=
allAvailable
;
return
(
this
);
}
/**
* Return list of groups matching the search criteria.
*
* @param search the search criteria
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withSearch
(
String
search
)
{
this
.
search
=
search
;
return
(
this
);
}
/**
* Return groups ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at.
*
* @param orderBy specifies what field to order by
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withOrderBy
(
GroupOrderBy
orderBy
)
{
this
.
orderBy
=
orderBy
;
return
(
this
);
}
/**
* Return groups sorted in asc or desc order. Default is desc.
*
* @param sort sort direction, ASC or DESC
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withSortOder
(
SortOrder
sort
)
{
this
.
sort
=
sort
;
return
(
this
);
}
/**
* Include group statistics (admins only).
*
* @param statistics if true, return statistics with the results
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withStatistics
(
Boolean
statistics
)
{
this
.
statistics
=
statistics
;
return
(
this
);
}
/**
* Include custom attributes in response (admins only).
*
* @param withCustomAttributes if true, include custom attributes in the response
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withCustomAttributes
(
Boolean
withCustomAttributes
)
{
this
.
withCustomAttributes
=
withCustomAttributes
;
return
(
this
);
}
/**
* Limit by groups explicitly owned by the current user
*
* @param owned if true, limit to groups explicitly owned by the current user
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withOwned
(
Boolean
owned
)
{
this
.
owned
=
owned
;
return
(
this
);
}
/**
* Limit to groups where current user has at least this access level.
*
* @param accessLevel limit to groups where current user has at least this access level
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withMinAccessLevel
(
AccessLevel
accessLevel
)
{
this
.
accessLevel
=
accessLevel
;
return
(
this
);
}
/**
* Get the query params specified by this filter.
*
* @return a GitLabApiForm instance holding the query parameters for this GroupFilter instance
*/
public
GitLabApiForm
getQueryParams
()
{
return
(
new
GitLabApiForm
()
.
withParam
(
"skip_groups"
,
skipGroups
)
.
withParam
(
"all_available"
,
allAvailable
)
.
withParam
(
"search"
,
search
)
.
withParam
(
"order_by"
,
orderBy
)
.
withParam
(
"sort"
,
sort
)
.
withParam
(
"statistics"
,
statistics
)
.
withParam
(
"with_custom_attributes"
,
withCustomAttributes
)
.
withParam
(
"owned"
,
owned
)
.
withParam
(
"min_access_level "
,
accessLevel
)
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment