Skip to content
Open
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
29 changes: 29 additions & 0 deletions src/main/java/org/gitlab/api/GitlabAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,21 @@ public List<GitlabNamespace> getNamespaces() {
return retrieve().getAll(tailUrl, GitlabNamespace[].class);
}

/**
* Get a list of the namespaces of the authenticated user based on the search criteria.
* If the user is an administrator, a list of all namespaces in the GitLab instance is shown.
*
* @param search param to search
* @return A list of gitlab namespace
* @throws IOException on gitlab api call error
*/
public List<GitlabNamespace> getNamespaces(String search) throws IOException {
Query query = new Query()
.appendIf("search", search);
String tailUrl = GitlabNamespace.URL + query.toString();
return retrieve().getAll(tailUrl, GitlabNamespace[].class);
}

/**
* Uploads a file to a project
*
Expand Down Expand Up @@ -4252,4 +4267,18 @@ public List<GitlabEvent> getProjectEvents(Serializable projectId,

return Arrays.asList(retrieve().method(GET).to(tailUrl.toString(), GitlabEvent[].class));
}

/**
* Judge a group is exist or not
*
* @param path path of a group
*/
public boolean isGroupNotExists(String path) throws IOException {
String tailUrl = GitlabGroup.URL;
Query query = new Query()
.append("search", path);
List<GitlabGroup> gitlabGroupList = retrieve().getAll(tailUrl + query.toString(), GitlabGroup[].class);
return gitlabGroupList.isEmpty();
}

}