org.gitlab.api.http.Query.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.gitlab.api.http.Query.<init>方法的一些代码示例,展示了Query.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>方法的具体详情如下:
包路径:org.gitlab.api.http.Query
类名称:Query
方法名:<init>

Query.<init>介绍

暂无

代码示例

代码示例来源: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 GitlabProjectHook addProjectHook(GitlabProject project, String url) throws IOException {
  Query query = new Query()
      .append("url", url);
  String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabProjectHook.URL + query.toString();
  return dispatch().to(tailUrl, GitlabProjectHook.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

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 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

@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());
}

相关文章