本文整理了Java中org.gitlab.api.http.Query.mergeWith
方法的一些代码示例,展示了Query.mergeWith
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.mergeWith
方法的具体详情如下:
包路径:org.gitlab.api.http.Query
类名称:Query
方法名:mergeWith
暂无
代码示例来源: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 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 List<GitlabCommit> getAllCommits(Serializable projectId, Pagination pagination,
String branchOrTag) throws IOException {
final Query query = new Query();
if (branchOrTag != null) {
query.append("ref_name", branchOrTag);
}
if (pagination != null) {
query.mergeWith(pagination.asQuery());
}
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) +
"/repository" + GitlabCommit.URL + query;
return retrieve().getAll(tailUrl, GitlabCommit[].class);
}
代码示例来源:origin: org.gitlab/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 List<GitlabCommit> getAllCommits(Serializable projectId, Pagination pagination,
String branchOrTag) throws IOException {
final Query query = new Query();
if (branchOrTag != null) {
query.append("ref_name", branchOrTag);
}
if (pagination != null) {
query.mergeWith(pagination.asQuery());
}
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) +
"/repository" + GitlabCommit.URL + query;
return retrieve().getAll(tailUrl, GitlabCommit[].class);
}
代码示例来源:origin: timols/java-gitlab-api
public GitlabCommitComparison compareCommits(Serializable projectId, String commitHash1, String commitHash2, Pagination pagination) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabCommitComparison.URL;
Query query = new Query()
.append("from", commitHash1)
.append("to", commitHash2);
query.mergeWith(pagination.asQuery());
return retrieve().to(tailUrl + query, GitlabCommitComparison.class);
}
代码示例来源:origin: timols/java-gitlab-api
public GitlabCommitComparison compareCommits(Serializable projectId, String commitHash1, String commitHash2, Pagination pagination) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabCommitComparison.URL;
Query query = new Query()
.append("from", commitHash1)
.append("to", commitHash2);
query.mergeWith(pagination.asQuery());
return retrieve().to(tailUrl + query, GitlabCommitComparison.class);
}
代码示例来源:origin: timols/java-gitlab-api
public List<GitlabCommit> getCommits(GitlabMergeRequest mergeRequest, Pagination pagination) throws IOException {
Integer projectId = mergeRequest.getSourceProjectId();
if (projectId == null) {
projectId = mergeRequest.getProjectId();
}
Query query = new Query()
.append("ref_name", mergeRequest.getSourceBranch());
query.mergeWith(pagination.asQuery());
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) +
"/repository" + GitlabCommit.URL + query.toString();
GitlabCommit[] commits = retrieve().to(tailUrl, GitlabCommit[].class);
return Arrays.asList(commits);
}
代码示例来源:origin: org.gitlab/java-gitlab-api
public GitlabCommitComparison compareCommits(Serializable projectId, String commitHash1, String commitHash2, Pagination pagination) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabCommitComparison.URL;
Query query = new Query()
.append("from", commitHash1)
.append("to", commitHash2);
query.mergeWith(pagination.asQuery());
return retrieve().to(tailUrl + query, GitlabCommitComparison.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 starred by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getStarredProjects() throws IOException {
Query query = new Query().append("starred", "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
/**
* 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: org.gitlab/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: org.gitlab/java-gitlab-api
/**
* Get a list of projects starred by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getStarredProjects() throws IOException {
Query query = new Query().append("starred", "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 starred by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getStarredProjects() throws IOException {
Query query = new Query().append("starred", "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: org.gitlab/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 accessible by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException on gitlab api call error
*/
public List<GitlabProject> getProjectsViaSudo(GitlabUser user) throws IOException {
Query query = new Query()
.appendIf(PARAM_SUDO, user.getId());
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 merge() throws UnsupportedEncodingException{
Query sourceQuery= new Query()
.append("p1", "v1")
.append("p2", "v2");
Query targetQuery = new Query()
.append("p3", "v3")
.append("p2", "v22");
boolean mergeResult = targetQuery.mergeWith(sourceQuery);
assertTrue(mergeResult);
assertEquals("?p3=v3&p2=v22&p1=v1&p2=v2", targetQuery.toString());
}
}
内容来源于网络,如有侵权,请联系作者删除!