Skip to content

Add all parameters to get project of group api #269

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

Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 22 additions & 0 deletions src/main/java/org/gitlab4j/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,28 @@ public String toString() {
}
}

/** Enum to use for ordering the results of getProjects() of GroupsApi. */
public enum GroupProjectOrderBy {

ID, NAME, PATH, CREATED_AT, UPDATED_AT, LAST_ACTIVITY_AT;
private static JacksonJsonEnumHelper<GroupProjectOrderBy> enumHelper = new JacksonJsonEnumHelper<>(GroupProjectOrderBy.class);

@JsonCreator
public static GroupProjectOrderBy 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 getPipelines(). */
public enum PipelineScope {

Expand Down
40 changes: 40 additions & 0 deletions src/main/java/org/gitlab4j/api/GroupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,46 @@ public Pager<Group> getSubGroups(Integer groupId, List<Integer> skipGroups, Bool
return (new Pager<Group>(this, Group.class, itemsPerPage, formData.asMap(), "groups", groupId, "subgroups"));
}

/**
* Get a list of projects belonging to the specified group ID.
*
* GET /groups/:id/projects
*
* @param groupId the group ID to list the projects for
* @param archived Limit by archived status
* @param visibility Limit by visibility public, internal, or private
* @param orderBy Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. Default is created_at
* @param sortOrder Return projects sorted in asc or desc order. Default is desc
* @param search Return list of authorized projects matching the search criteria
* @param simple Return only the ID, URL, name, and path of each project
* @param owned Limit by projects owned by the current user
* @param starred Limit by projects starred by the current user
* @param withIssuesEnabled Limit by enabled issues feature
* @param withMergeRequestsEnabled Limit by enabled merge requests feature
* @param withCustomAttributes Include custom attributes in response (admins only)
* @return a list of projects belonging to the specified group ID
* @throws GitLabApiException if any exception occurs
*/
public List<Project> getProjects(int groupId, Boolean archived, Visibility visibility, GroupProjectOrderBy orderBy,
SortOrder sortOrder, String search, Boolean simple, Boolean owned, Boolean starred, Boolean withIssuesEnabled,
Boolean withMergeRequestsEnabled, Boolean withCustomAttributes) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("archived", archived)
.withParam("visibility", visibility)
.withParam("order_by", orderBy)
.withParam("order_by", orderBy)
.withParam("sort", sortOrder)
.withParam("search", search)
.withParam("simple", simple)
.withParam("owned", owned)
.withParam("starred", starred)
.withParam("with_issues_enabled", withIssuesEnabled)
.withParam("with_merge_requests_enabled", withMergeRequestsEnabled)
.withParam("with_custom_attributes", withCustomAttributes);
Response response = get(Response.Status.OK, formData.asMap(), "groups", groupId, "projects");
return (response.readEntity(new GenericType<List<Project>>() {}));
}

/**
* Get a list of projects belonging to the specified group ID.
*
Expand Down