From 086750a1b451ce8252f67f58889077c759aab64a Mon Sep 17 00:00:00 2001 From: Iain Adams Date: Sun, 23 Apr 2017 20:11:13 +0100 Subject: [PATCH] #201 initial support for v3 -> v4 api changes. --- src/main/java/org/gitlab/api/GitlabAPI.java | 155 ++++++++---------- .../api/models/GitlabBuildVariable.java | 2 +- .../{GitlabBuild.java => GitlabJob.java} | 4 +- .../org/gitlab/api/models/GitlabProject.java | 24 +-- .../org/gitlab/api/models/GitlabSSHKey.java | 1 + .../java/org/gitlab/api/GitlabAPITest.java | 2 +- 6 files changed, 86 insertions(+), 102 deletions(-) rename src/main/java/org/gitlab/api/models/{GitlabBuild.java => GitlabJob.java} (97%) diff --git a/src/main/java/org/gitlab/api/GitlabAPI.java b/src/main/java/org/gitlab/api/GitlabAPI.java index 16a13c3b..1b3276e9 100644 --- a/src/main/java/org/gitlab/api/GitlabAPI.java +++ b/src/main/java/org/gitlab/api/GitlabAPI.java @@ -27,7 +27,7 @@ public class GitlabAPI { public static final ObjectMapper MAPPER = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - private static final String API_NAMESPACE = "/api/v3"; + private static final String API_NAMESPACE = "/api/v4"; private static final String PARAM_SUDO = "sudo"; private static final String PARAM_MAX_ITEMS_PER_PAGE = new Pagination().withPerPage(Pagination.MAX_ITEMS_PER_PAGE).toString(); @@ -609,34 +609,36 @@ public List getProjects() throws IOException { * @throws IOException */ public List getOwnedProjects() throws IOException { - String tailUrl = GitlabProject.URL + "/owned" + PARAM_MAX_ITEMS_PER_PAGE; + Query query = new Query().append("owner", "true"); + String tailUrl = GitlabProject.URL + query.toString() + PARAM_MAX_ITEMS_PER_PAGE; return retrieve().getAll(tailUrl, GitlabProject[].class); } /** * - * Get a list of projects accessible by the authenticated user. + * Get a list of projects starred by the authenticated user. * * @return A list of gitlab projects * @throws IOException */ - public List 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(); + public List getStarredProjects() throws IOException { + Query query = new Query().append("starred", "true"); + String tailUrl = GitlabProject.URL + query.toString() + PARAM_MAX_ITEMS_PER_PAGE; return retrieve().getAll(tailUrl, GitlabProject[].class); } /** * - * Get's all projects in Gitlab, requires sudo user + * Get a list of projects accessible by the authenticated user. * * @return A list of gitlab projects * @throws IOException */ - public List getAllProjects() throws IOException { - String tailUrl = GitlabProject.URL + "/all" + PARAM_MAX_ITEMS_PER_PAGE; + public List 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); } @@ -655,27 +657,27 @@ public GitlabUpload uploadFile(GitlabProject project, File file) throws IOExcept /** * - * Gets a list of a project's builds in Gitlab + * Gets a list of a project's jobs in Gitlab * * @param project the project - * @return A list of project builds + * @return A list of project jobs * @throws IOException */ - public List getProjectBuilds(GitlabProject project) throws IOException { - return getProjectBuilds(project.getId()); + public List getProjectJobs(GitlabProject project) throws IOException { + return getProjectJobs(project.getId()); } /** * - * Gets a list of a project's builds in Gitlab + * Gets a list of a project's jobs in Gitlab * * @param projectId the project id - * @return A list of project builds + * @return A list of project jobs * @throws IOException */ - public List getProjectBuilds(Integer projectId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBuild.URL + PARAM_MAX_ITEMS_PER_PAGE; - return retrieve().getAll(tailUrl, GitlabBuild[].class); + public List getProjectJobs(Integer projectId) throws IOException { + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + PARAM_MAX_ITEMS_PER_PAGE; + return retrieve().getAll(tailUrl, GitlabJob[].class); } /** @@ -683,35 +685,35 @@ public List getProjectBuilds(Integer projectId) throws IOException * Gets a build for a project * * @param projectId the project id - * @param buildId the build id - * @return A list of project builds + * @param jobId the build id + * @return A list of project jobs * @throws IOException */ - public GitlabBuild getProjectBuild(Integer projectId, Integer buildId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBuild.URL + "/" + buildId; - return retrieve().to(tailUrl, GitlabBuild.class); + public GitlabJob getProjectJob(Integer projectId, Integer jobId) throws IOException { + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + jobId; + return retrieve().to(tailUrl, GitlabJob.class); } /** * Get build artifacts of a project build * * @param project The Project - * @param build The build + * @param job The build * @throws IOException on gitlab api call error */ - public byte[] getBuildArtifact(GitlabProject project, GitlabBuild build) throws IOException { - return getBuildArtifact(project.getId(), build.getId()); + public byte[] getJobArtifact(GitlabProject project, GitlabJob job) throws IOException { + return getJobArtifact(project.getId(), job.getId()); } /** * Get build artifacts of a project build * * @param projectId The Project's Id - * @param buildId The build's Id + * @param jobId The build's Id * @throws IOException on gitlab api call error */ - public byte[] getBuildArtifact(Integer projectId, Integer buildId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBuild.URL + "/" + buildId + "/artifacts"; + public byte[] getJobArtifact(Integer projectId, Integer jobId) throws IOException { + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + jobId + "/artifacts"; return retrieve().to(tailUrl, byte[].class); } @@ -757,12 +759,12 @@ public GitlabProject createProjectForGroup(String name, GitlabGroup group, Strin * @param name The name of the project * @param group The group for which the project should be crated * @param description The project description - * @param visibilityLevel The project visibility level (private: 0, internal: 10, public: 20) + * @param visibility The project visibility level (private: 0, internal: 10, public: 20) * @return The GitLab Project * @throws IOException on gitlab api call error */ - public GitlabProject createProjectForGroup(String name, GitlabGroup group, String description, Integer visibilityLevel) throws IOException { - return createProject(name, group.getId(), description, null, null, null, null, null, null, visibilityLevel, null); + public GitlabProject createProjectForGroup(String name, GitlabGroup group, String description, String visibility) throws IOException { + return createProject(name, group.getId(), description, null, null, null, null, null, null, visibility, null); } /** @@ -776,14 +778,13 @@ public GitlabProject createProjectForGroup(String name, GitlabGroup group, Strin * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default - * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default + * @param visibility The visibility level of the project, otherwise null indicates to use GitLab default * @param importUrl The Import URL for the project, otherwise null * @return the Gitlab Project * @throws IOException on gitlab api call error */ @Deprecated - public GitlabProject createProject(String name, Integer namespaceId, String description, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, Boolean publik, Integer visibilityLevel, String importUrl) throws IOException { + public GitlabProject createProject(String name, Integer namespaceId, String description, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, Boolean publik, String visibility, String importUrl) throws IOException { Query query = new Query() .append("name", name) .appendIf("namespace_id", namespaceId) @@ -793,8 +794,7 @@ public GitlabProject createProject(String name, Integer namespaceId, String desc .appendIf("merge_requests_enabled", mergeRequestsEnabled) .appendIf("wiki_enabled", wikiEnabled) .appendIf("snippets_enabled", snippetsEnabled) - .appendIf("public", publik) - .appendIf("visibility_level", visibilityLevel) + .appendIf("visibility", visibility) .appendIf("import_url", importUrl); String tailUrl = GitlabProject.URL + query.toString(); @@ -811,7 +811,7 @@ public GitlabProject createProject(String name, Integer namespaceId, String desc * @throws IOException on gitlab api call error */ public GitlabProject createUserProject(Integer userId, String name) throws IOException { - return createUserProject(userId, name, null, null, null, null, null, null, null, null, null, null); + return createUserProject(userId, name, null, null, null, null, null, null, null, null, null); } /** @@ -826,14 +826,13 @@ public GitlabProject createUserProject(Integer userId, String name) throws IOExc * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default - * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default + * @param visibility The visibility level of the project, otherwise null indicates to use GitLab default * @param importUrl The Import URL for the project, otherwise null * @return The GitLab Project * @throws IOException on gitlab api call error */ @Deprecated - public GitlabProject createUserProject(Integer userId, String name, String description, String defaultBranch, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, Boolean publik, Integer visibilityLevel, String importUrl) throws IOException { + public GitlabProject createUserProject(Integer userId, String name, String description, String defaultBranch, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, String visibility, String importUrl) throws IOException { Query query = new Query() .append("name", name) .appendIf("description", description) @@ -843,8 +842,7 @@ public GitlabProject createUserProject(Integer userId, String name, String descr .appendIf("merge_requests_enabled", mergeRequestsEnabled) .appendIf("wiki_enabled", wikiEnabled) .appendIf("snippets_enabled", snippetsEnabled) - .appendIf("public", publik) - .appendIf("visibility_level", visibilityLevel) + .appendIf("visibility", visibility) .appendIf("import_url", importUrl); String tailUrl = GitlabProject.URL + "/user/" + userId + query.toString(); @@ -864,7 +862,6 @@ public GitlabProject createUserProject(Integer userId, String name, String descr * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default - * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default * @return the Gitlab Project * @throws IOException on gitlab api call error @@ -880,8 +877,7 @@ public GitlabProject updateProject( Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, - Boolean publik, - Integer visibilityLevel) + String visibility) throws IOException { Query query = new Query() @@ -893,8 +889,7 @@ public GitlabProject updateProject( .appendIf("merge_requests_enabled", mergeRequestsEnabled) .appendIf("wiki_enabled", wikiEnabled) .appendIf("snippets_enabled", snippetsEnabled) - .appendIf("public", publik) - .appendIf("visibility_level", visibilityLevel); + .appendIf("visibility", visibility); String tailUrl = GitlabProject.URL + "/" + projectId + query.toString(); @@ -970,12 +965,12 @@ public GitlabMergeRequest getMergeRequestByIid(Serializable projectId, Integer m * @throws IOException on gitlab api call error */ public GitlabMergeRequest getMergeRequestChanges(Serializable projectId, Integer mergeRequestId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/merge_request/" + mergeRequestId + "/changes"; + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/merge_requests/" + mergeRequestId + "/changes"; return retrieve().to(tailUrl, GitlabMergeRequest.class); } public GitlabMergeRequest getMergeRequest(GitlabProject project, Integer mergeRequestId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + project.getId() + "/merge_request/" + mergeRequestId; + String tailUrl = GitlabProject.URL + "/" + project.getId() + "/merge_requests/" + mergeRequestId; return retrieve().to(tailUrl, GitlabMergeRequest.class); } @@ -1094,17 +1089,6 @@ public GitlabCommit getCommit(Serializable projectId, String commitHash) throws return retrieve().to(tailUrl, GitlabCommit.class); } - - public List getCommitBuilds(GitlabProject projectId, String commitHash) throws IOException { - return getCommitBuilds(projectId.getId(), commitHash); - } - - public List getCommitBuilds(Serializable projectId, String commitHash) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/repository/commits/" + commitHash + GitlabBuild.URL + PARAM_MAX_ITEMS_PER_PAGE; - return retrieve().getAll(tailUrl, GitlabBuild[].class); - } - - public List getCommits(GitlabMergeRequest mergeRequest) throws IOException { return getCommits(mergeRequest, new Pagination()); } @@ -1310,10 +1294,9 @@ public List getRepositoryTree(GitlabProject project, Strin public GitlabRepositoryFile getRepositoryFile(GitlabProject project, String path, String ref) throws IOException { Query query = new Query() - .append("file_path", path) .append("ref", ref); - String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/files" + query.toString(); + String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/files/" + sanitizePath(path) + query.toString(); return retrieve().to(tailUrl, GitlabRepositoryFile.class); } @@ -1397,7 +1380,7 @@ public void createBranch(GitlabProject project, String branchName, String ref) t */ public void createBranch(Serializable projectId, String branchName, String ref) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL; - dispatch().with("branch_name", branchName).with("ref", ref).to(tailUrl, Void.class); + dispatch().with("branch", branchName).with("ref", ref).to(tailUrl, Void.class); } /** @@ -1408,12 +1391,12 @@ public void createBranch(Serializable projectId, String branchName, String ref) * @throws IOException on gitlab api call error */ public void deleteBranch(Serializable projectId, String branchName) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL + '/' + sanitizeBranch(branchName); + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL + '/' + sanitizePath(branchName); retrieve().method("DELETE").to(tailUrl, Void.class); } public GitlabBranch getBranch(Serializable projectId, String branchName) throws IOException { - String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL + '/' + sanitizeBranch(branchName); + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL + '/' + sanitizePath(branchName); return retrieve().to(tailUrl, GitlabBranch.class); } @@ -1422,12 +1405,12 @@ public GitlabBranch getBranch(GitlabProject project, String branchName) throws I } public void protectBranch(GitlabProject project, String branchName) throws IOException { - String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizeBranch(branchName) + "/protect"; + String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizePath(branchName) + "/protect"; retrieve().method("PUT").to(tailUrl, Void.class); } public void unprotectBranch(GitlabProject project, String branchName) throws IOException { - String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizeBranch(branchName) + "/unprotect"; + String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabBranch.URL + '/' + sanitizePath(branchName) + "/unprotect"; retrieve().method("PUT").to(tailUrl, Void.class); } @@ -1966,7 +1949,7 @@ public GitlabSSHKey createDeployKey(Integer targetProjectId, String title, Strin * @throws IOException on gitlab api call error */ public void deleteDeployKey(Integer targetProjectId, Integer targetKeyId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.KEYS_URL + "/" + targetKeyId; + String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.DEPLOY_KEYS_URL + "/" + targetKeyId; retrieve().method("DELETE").to(tailUrl, Void.class); } @@ -1978,7 +1961,7 @@ public void deleteDeployKey(Integer targetProjectId, Integer targetKeyId) throws * @throws IOException on gitlab api call error */ public List getDeployKeys(Integer targetProjectId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.KEYS_URL; + String tailUrl = GitlabProject.URL + "/" + targetProjectId + GitlabSSHKey.DEPLOY_KEYS_URL; return Arrays.asList(retrieve().to(tailUrl, GitlabSSHKey[].class)); } @@ -2041,7 +2024,7 @@ private String sanitizeProjectId(Serializable projectId) { } } - private String sanitizeBranch(String branch){ + private String sanitizePath(String branch){ try { return URLEncoder.encode(branch, "UTF-8"); } catch (UnsupportedEncodingException e) { @@ -2390,7 +2373,7 @@ public GitlabBuildVariable getBuildVariable(Integer projectId, String key) throws IOException { String tailUrl = GitlabProject.URL + "/" + projectId + - GitlabBuildVariable.URL + + GitlabBuildVariable.URL + "/" + key; return retrieve().to(tailUrl, GitlabBuildVariable.class); } @@ -2447,7 +2430,7 @@ public void deleteBuildVariable(Integer projectId, String key) throws IOException { String tailUrl = GitlabProject.URL + "/" + projectId + - GitlabBuildVariable.URL + + GitlabBuildVariable.URL + "/" + key; retrieve().method("DELETE").to(tailUrl, Void.class); } @@ -2476,7 +2459,7 @@ public GitlabBuildVariable updateBuildVariable(Integer projectId, String newValue) throws IOException { String tailUrl = GitlabProject.URL + "/" + projectId + - GitlabBuildVariable.URL + + GitlabBuildVariable.URL + "/" + key; GitlabHTTPRequestor requestor = retrieve().method("PUT"); if (newValue != null) { @@ -2490,14 +2473,14 @@ public GitlabBuildVariable updateBuildVariable(Integer projectId, * * @param project the project * @return list of build triggers - * @throws IllegalStateException if builds are not enabled for the project + * @throws IllegalStateException if jobs are not enabled for the project * @throws IOException */ - public List getBuildTriggers(GitlabProject project) throws IOException { - if (!project.isBuildsEnabled()) { - // if the project has not allowed builds, you will only get a 403 forbidden message which is + public List getPipelineTriggers(GitlabProject project) throws IOException { + if (!project.isJobsEnabled()) { + // if the project has not allowed jobs, you will only get a 403 forbidden message which is // not helpful. - throw new IllegalStateException("Builds are not enabled for " + project.getNameWithNamespace() ); + throw new IllegalStateException("Jobs are not enabled for " + project.getNameWithNamespace() ); } else { return retrieve().getAll(GitlabProject.URL + "/" + project.getId() + GitlabTrigger.URL + PARAM_MAX_ITEMS_PER_PAGE, GitlabTrigger[].class); } @@ -2550,12 +2533,12 @@ public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws * @return A list of gitlab projects * @throws IOException */ - public List searchProjects(String query) throws IOException { - List projects = new ArrayList(); - String tailUrl = GitlabProject.URL + "/search/" + query; + public List searchProjects(String search) throws IOException { + Query query = new Query() + .append("search", search); + String tailUrl = GitlabProject.URL + query.toString(); GitlabProject[] response = retrieve().to(tailUrl, GitlabProject[].class); - projects = Arrays.asList(response); - return projects; + return Arrays.asList(response); } /** diff --git a/src/main/java/org/gitlab/api/models/GitlabBuildVariable.java b/src/main/java/org/gitlab/api/models/GitlabBuildVariable.java index 605499de..e7e202f6 100644 --- a/src/main/java/org/gitlab/api/models/GitlabBuildVariable.java +++ b/src/main/java/org/gitlab/api/models/GitlabBuildVariable.java @@ -6,7 +6,7 @@ * @author Vitezslav Zak */ public class GitlabBuildVariable { - public final static String URL = "/variables/"; + public final static String URL = "/variables"; public GitlabBuildVariable() { } diff --git a/src/main/java/org/gitlab/api/models/GitlabBuild.java b/src/main/java/org/gitlab/api/models/GitlabJob.java similarity index 97% rename from src/main/java/org/gitlab/api/models/GitlabBuild.java rename to src/main/java/org/gitlab/api/models/GitlabJob.java index d1805138..4027c544 100644 --- a/src/main/java/org/gitlab/api/models/GitlabBuild.java +++ b/src/main/java/org/gitlab/api/models/GitlabJob.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; -public class GitlabBuild { +public class GitlabJob { - public final static String URL = "/builds"; + public final static String URL = "/jobs"; private GitlabCommit commit; private Float coverage; diff --git a/src/main/java/org/gitlab/api/models/GitlabProject.java b/src/main/java/org/gitlab/api/models/GitlabProject.java index 9de2a1b6..5fc9d857 100644 --- a/src/main/java/org/gitlab/api/models/GitlabProject.java +++ b/src/main/java/org/gitlab/api/models/GitlabProject.java @@ -45,14 +45,14 @@ public class GitlabProject { @JsonProperty("wiki_enabled") private boolean wikiEnabled; - @JsonProperty("builds_enabled") - private boolean buildsEnabled; + @JsonProperty("jobs_enabled") + private boolean jobsEnabled; @JsonProperty("shared_runners_enabled") private boolean sharedRunnersEnabled; - @JsonProperty("public_builds") - private boolean publicBuilds; + @JsonProperty("public_jobs") + private boolean publicJobs; @JsonProperty("runners_token") private String runnersToken; @@ -210,12 +210,12 @@ public void setWikiEnabled(boolean wikiEnabled) { this.wikiEnabled = wikiEnabled; } - public boolean isBuildsEnabled() { - return buildsEnabled; + public boolean isJobsEnabled() { + return jobsEnabled; } - public void setBuildsEnabled(boolean buildsEnabled) { - this.buildsEnabled = buildsEnabled; + public void setJobsEnabled(boolean jobsEnabled) { + this.jobsEnabled = jobsEnabled; } public boolean isSharedRunnersEnabled() { @@ -226,12 +226,12 @@ public void setSharedRunnersEnabled(boolean sharedRunnersEnabled) { this.sharedRunnersEnabled = sharedRunnersEnabled; } - public boolean hasPublicBuilds() { - return publicBuilds; + public boolean hasPublicJobs() { + return publicJobs; } - public void setPublicBuilds(boolean publicBuilds) { - this.publicBuilds = publicBuilds; + public void setPublicJobs(boolean publicJobs) { + this.publicJobs = publicJobs; } public String getRunnersToken() { diff --git a/src/main/java/org/gitlab/api/models/GitlabSSHKey.java b/src/main/java/org/gitlab/api/models/GitlabSSHKey.java index 4635ae5a..f9e29e6e 100644 --- a/src/main/java/org/gitlab/api/models/GitlabSSHKey.java +++ b/src/main/java/org/gitlab/api/models/GitlabSSHKey.java @@ -3,6 +3,7 @@ public class GitlabSSHKey { public static String KEYS_URL = "/keys"; + public static String DEPLOY_KEYS_URL = "/deploy_keys"; private Integer _id; private String _title; diff --git a/src/test/java/org/gitlab/api/GitlabAPITest.java b/src/test/java/org/gitlab/api/GitlabAPITest.java index f2f636e5..ce03b3ce 100644 --- a/src/test/java/org/gitlab/api/GitlabAPITest.java +++ b/src/test/java/org/gitlab/api/GitlabAPITest.java @@ -47,7 +47,7 @@ public void setup() throws IOException { @Test public void testAllProjects() throws IOException { - api.getAllProjects(); + api.getProjects(); } @Test