use of org.gitlab4j.api.models.Namespace in project choerodon-starters by open-hand.
the class NamespaceApi method findNamespaces.
/**
* Get all namespaces that match a string in their name or path in the specified page range.
* <p>
* GET /namespaces?search=:query
*
* @param query the search string
* @param page the page to get
* @param perPage the number of Namespace instances per page
* @return the Namespace List with the matching namespaces
* @throws GitLabApiException if any exception occurs
*/
public List<Namespace> findNamespaces(String query, int page, int perPage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("search", query, true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage);
Response response = get(Response.Status.OK, formData.asMap(), "namespaces");
return (response.readEntity(new GenericType<List<Namespace>>() {
}));
}
use of org.gitlab4j.api.models.Namespace in project catma by forTEXT.
the class GitlabManagerRestricted method createRepository.
@Override
public CreateRepositoryResponse createRepository(String name, String path, String groupPath) throws IOException {
GroupApi groupApi = restrictedGitLabApi.getGroupApi();
ProjectApi projectApi = restrictedGitLabApi.getProjectApi();
try {
Group group = groupApi.getGroup(groupPath);
Namespace namespace = new Namespace();
namespace.setId(group.getId());
Project project = new Project();
project.setName(name);
project.setNamespace(namespace);
if (StringUtils.isNotEmpty(path)) {
project.setPath(path);
}
project = projectApi.createProject(project);
return new CreateRepositoryResponse(groupPath, project.getId(), GitlabUtils.rewriteGitLabServerUrl(project.getHttpUrlToRepo()));
} catch (GitLabApiException e) {
throw new IOException("Failed to create remote Git repository", e);
}
}
use of org.gitlab4j.api.models.Namespace in project choerodon-starters by open-hand.
the class NamespaceApi method findNamespaces.
/**
* Get all namespaces that match a string in their name or path.
* <p>
* GET /namespaces?search=:query
*
* @param query the search string
* @return the Namespace List with the matching namespaces
* @throws GitLabApiException if any exception occurs
*/
public List<Namespace> findNamespaces(String query) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("search", query, true).withParam(PER_PAGE_PARAM, getDefaultPerPage());
Response response = get(Response.Status.OK, formData.asMap(), "namespaces");
return (response.readEntity(new GenericType<List<Namespace>>() {
}));
}
Aggregations