本文整理了Java中org.gitlab.api.http.Query.toString
方法的一些代码示例,展示了Query.toString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.toString
方法的具体详情如下:
包路径:org.gitlab.api.http.Query
类名称:Query
方法名:toString
[英]Returns a Query suitable for appending to a URI
[中]返回适合附加到URI的查询
代码示例来源:origin: timols/java-gitlab-api
@Override
public String toString() {
return paginationQuery.toString();
}
}
代码示例来源:origin: org.gitlab/java-gitlab-api
@Override
public String toString() {
return paginationQuery.toString();
}
}
代码示例来源:origin: org.gitlab/java-gitlab-api
/**
* Create a new user. This may succeed only if the requester is an administrator.
*
* @param request An object that represents the parameters for the request.
* @return {@link GitlabUser}
* @throws IOException on gitlab api call error
*/
public GitlabUser createUser(CreateUserRequest request) throws IOException {
String tailUrl = GitlabUser.USERS_URL + request.toQuery().toString();
return dispatch().to(tailUrl, GitlabUser.class);
}
代码示例来源:origin: timols/java-gitlab-api
/**
* @param namespace The namespace of the fork
* @param projectId ProjectId of the project forked
* @return The new Gitlab Project
* @throws IOException on gitlab api call error
*/
public GitlabProject createFork(String namespace, Integer projectId) throws IOException {
Query query = new Query()
.appendIf("namespace", namespace);
String tailUrl = GitlabProject.URL + "/" + projectId + "/fork" + query.toString();
return dispatch().to(tailUrl, GitlabProject.class);
}
代码示例来源:origin: timols/java-gitlab-api
/**
* @param namespace The namespace of the fork
* @param projectId ProjectId of the project forked
* @return The new Gitlab Project
* @throws IOException on gitlab api call error
*/
public GitlabProject createFork(String namespace, Integer projectId) throws IOException {
Query query = new Query()
.appendIf("namespace", namespace);
String tailUrl = GitlabProject.URL + "/" + projectId + "/fork" + query.toString();
return dispatch().to(tailUrl, GitlabProject.class);
}
代码示例来源:origin: org.gitlab/java-gitlab-api
/**
* @param namespace The namespace of the fork
* @param projectId ProjectId of the project forked
* @return The new Gitlab Project
* @throws IOException on gitlab api call error
*/
public GitlabProject createFork(String namespace, Integer projectId) throws IOException {
Query query = new Query()
.appendIf("namespace", namespace);
String tailUrl = GitlabProject.URL + "/" + projectId + "/fork" + query.toString();
return dispatch().to(tailUrl, GitlabProject.class);
}
代码示例来源:origin: timols/java-gitlab-api
private GitlabSSHKey createDeployKey(Integer targetProjectId, String title, String key, boolean canPush) throws IOException {
Query query = new Query()
.append("title", title)
.append("key", key)
.append("can_push", Boolean.toString(canPush));
String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.DEPLOY_KEYS_URL + query.toString();
return dispatch().to(tailUrl, GitlabSSHKey.class);
}
代码示例来源:origin: org.gitlab/java-gitlab-api
private GitlabSSHKey createDeployKey(Integer targetProjectId, String title, String key, boolean canPush) throws IOException {
Query query = new Query()
.append("title", title)
.append("key", key)
.append("can_push", Boolean.toString(canPush));
String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.DEPLOY_KEYS_URL + query.toString();
return dispatch().to(tailUrl, GitlabSSHKey.class);
}
代码示例来源:origin: timols/java-gitlab-api
public void protectBranchWithDeveloperOptions(GitlabProject project, String branchName, boolean developers_can_push, boolean developers_can_merge) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizePath(branchName) + "/protect";
final Query query = new Query()
.append("developers_can_push", Boolean.toString(developers_can_push))
.append("developers_can_merge", Boolean.toString(developers_can_merge));
retrieve().method(PUT).to(tailUrl + query.toString(), Void.class);
}
代码示例来源:origin: timols/java-gitlab-api
public void protectBranchWithDeveloperOptions(GitlabProject project, String branchName, boolean developers_can_push, boolean developers_can_merge) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizePath(branchName) + "/protect";
final Query query = new Query()
.append("developers_can_push", Boolean.toString(developers_can_push))
.append("developers_can_merge", Boolean.toString(developers_can_merge));
retrieve().method(PUT).to(tailUrl + query.toString(), Void.class);
}
代码示例来源:origin: org.gitlab/java-gitlab-api
public void protectBranchWithDeveloperOptions(GitlabProject project, String branchName, boolean developers_can_push, boolean developers_can_merge) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizePath(branchName) + "/protect";
final Query query = new Query()
.append("developers_can_push", Boolean.toString(developers_can_push))
.append("developers_can_merge", Boolean.toString(developers_can_merge));
retrieve().method(PUT).to(tailUrl + query.toString(), Void.class);
}
代码示例来源:origin: timols/java-gitlab-api
public List<GitlabGroup> getGroupsViaSudo(String username, Pagination pagination) throws IOException {
String tailUrl = GitlabGroup.URL;
Query query = new Query()
.appendIf(PARAM_SUDO, username);
if (pagination != null) {
query.mergeWith(pagination.asQuery());
}
return retrieve().getAll(tailUrl + query.toString(), GitlabGroup[].class);
}
代码示例来源:origin: timols/java-gitlab-api
public GitlabRepositoryFile getRepositoryFile(GitlabProject project, String path, String ref) throws IOException {
Query query = new Query()
.append("ref", ref);
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/files/" + sanitizePath(path) + query.toString();
return retrieve().to(tailUrl, GitlabRepositoryFile.class);
}
代码示例来源:origin: timols/java-gitlab-api
public List<GitlabGroup> getGroupsViaSudo(String username, Pagination pagination) throws IOException {
String tailUrl = GitlabGroup.URL;
Query query = new Query()
.appendIf(PARAM_SUDO, username);
if (pagination != null) {
query.mergeWith(pagination.asQuery());
}
return retrieve().getAll(tailUrl + query.toString(), GitlabGroup[].class);
}
代码示例来源:origin: timols/java-gitlab-api
/**
* Get a list of projects that the authenticated user is a member of.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getMembershipProjects() throws IOException {
Query query = new Query().append("membership", "true");
query.mergeWith(new Pagination().withPerPage(Pagination.MAX_ITEMS_PER_PAGE).asQuery());
String tailUrl = GitlabProject.URL + query.toString();
return retrieve().getAll(tailUrl, GitlabProject[].class);
}
代码示例来源:origin: timols/java-gitlab-api
/**
* Get a list of projects owned by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getOwnedProjects() throws IOException {
Query query = new Query().append("owned", "true");
query.mergeWith(new Pagination().withPerPage(Pagination.MAX_ITEMS_PER_PAGE).asQuery());
String tailUrl = GitlabProject.URL + query.toString();
return retrieve().getAll(tailUrl, GitlabProject[].class);
}
代码示例来源:origin: timols/java-gitlab-api
/**
* Get a list of projects that the authenticated user is a member of.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getMembershipProjects() throws IOException {
Query query = new Query().append("membership", "true");
query.mergeWith(new Pagination().withPerPage(Pagination.MAX_ITEMS_PER_PAGE).asQuery());
String tailUrl = GitlabProject.URL + query.toString();
return retrieve().getAll(tailUrl, GitlabProject[].class);
}
代码示例来源:origin: timols/java-gitlab-api
@Test
public void conditionalAppend_null_notNull() throws UnsupportedEncodingException {
Query query = new Query()
.appendIf("p1", (String) null)
.appendIf("p2", "v2");
assertEquals("?p2=v2", query.toString());
}
代码示例来源:origin: timols/java-gitlab-api
@Test
public void append_encodes_values() throws UnsupportedEncodingException {
Query query = new Query()
.append("p1", "v 1")
.append("p2", "v 2");
assertEquals("?p1=v+1&p2=v+2", query.toString());
}
代码示例来源:origin: timols/java-gitlab-api
@Test
public void mixedStyle_append() throws UnsupportedEncodingException {
Query query = new Query()
.append("p1", "v1");
query.append("p2", "v2");
query = query.append("p3", "v3");
assertEquals("?p1=v1&p2=v2&p3=v3", query.toString());
}
内容来源于网络,如有侵权,请联系作者删除!