From f170545f046a4e4e2c3080c4288877053506838a Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Thu, 27 Jul 2023 15:52:00 +0200 Subject: [PATCH 1/9] Removed JavaDoc Error --- src/main/java/org/gitlab4j/api/GitLabApiClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab4j/api/GitLabApiClient.java b/src/main/java/org/gitlab4j/api/GitLabApiClient.java index 169e185ce..791c2e63a 100755 --- a/src/main/java/org/gitlab4j/api/GitLabApiClient.java +++ b/src/main/java/org/gitlab4j/api/GitLabApiClient.java @@ -264,7 +264,7 @@ public void close() { * * @param logger the Logger instance to log to * @param level the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST) - * @param maxEntitySize maximum number of entity bytes to be logged. When logging if the maxEntitySize + * @param maxEntityLength maximum number of entity bytes to be logged. When logging if the maxEntitySize * is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at * the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabled * @param maskedHeaderNames a list of header names that should have the values masked From 553277896e3efe7b13deba9f4caa58541a8be297 Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Thu, 27 Jul 2023 15:52:14 +0200 Subject: [PATCH 2/9] Added topics --- .../java/org/gitlab4j/api/ProjectApi.java | 1161 +++++++++-------- src/main/java/org/gitlab4j/api/TopicApi.java | 166 +++ .../java/org/gitlab4j/api/models/Project.java | 29 +- .../java/org/gitlab4j/api/models/Topic.java | 71 + .../org/gitlab4j/api/models/TopicParams.java | 55 + .../java/org/gitlab4j/api/TestProjectApi.java | 10 +- 6 files changed, 919 insertions(+), 573 deletions(-) create mode 100644 src/main/java/org/gitlab4j/api/TopicApi.java create mode 100644 src/main/java/org/gitlab4j/api/models/Topic.java create mode 100644 src/main/java/org/gitlab4j/api/models/TopicParams.java diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 848f6bdca..068abed65 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -37,6 +37,7 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; + import org.gitlab4j.api.GitLabApi.ApiVersion; import org.gitlab4j.api.models.AccessLevel; import org.gitlab4j.api.models.AccessRequest; @@ -131,13 +132,13 @@ public Optional getOptionalProjectStatistics(Object projectIdOrP */ public List getProjects() throws GitLabApiException { - String url = this.gitLabApi.getGitLabServerUrl(); - if (url.startsWith("https://gitlab.com")) { - GitLabApi.getLogger().warning("Fetching all projects from " + url + - " may take many hours to complete, use Pager getProjects(int) instead."); - } + String url = this.gitLabApi.getGitLabServerUrl(); + if (url.startsWith("https://gitlab.com")) { + GitLabApi.getLogger().warning("Fetching all projects from " + url + + " may take many hours to complete, use Pager getProjects(int) instead."); + } - return (getProjects(getDefaultPerPage()).all()); + return (getProjects(getDefaultPerPage()).all()); } /** @@ -145,14 +146,15 @@ public List getProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user * @throws GitLabApiException if any exception occurs */ public List getProjects(int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects"); - return (response.readEntity(new GenericType>() { })); + return (response.readEntity(new GenericType>() { + })); } /** @@ -177,7 +179,7 @@ public Pager getProjects(int itemsPerPage) throws GitLabApiException { * @throws GitLabApiException if any exception occurs */ public Stream getProjectsStream() throws GitLabApiException { - return (getProjects(getDefaultPerPage()).stream()); + return (getProjects(getDefaultPerPage()).stream()); } /** @@ -186,30 +188,30 @@ public Stream getProjectsStream() throws GitLabApiException { * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields, default is created_at - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields, default is created_at + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link #getProjects(Boolean, Visibility, - * Constants.ProjectOrderBy, Constants.SortOrder, String, Boolean, Boolean, Boolean, Boolean, Boolean)} + * @deprecated Will be removed in version 6.0, replaced by {@link #getProjects(Boolean, Visibility, + * Constants.ProjectOrderBy, Constants.SortOrder, String, Boolean, Boolean, Boolean, Boolean, Boolean,String,Integer)} */ @Deprecated public List getProjects(Boolean archived, Visibility visibility, String orderBy, - String sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics) throws GitLabApiException { + String sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, String topic, Integer topicId) throws GitLabApiException { ProjectOrderBy projectOrderBy = ProjectOrderBy.valueOf(orderBy); SortOrder sortOrder = SortOrder.valueOf(sort); return (getProjects(archived, visibility, projectOrderBy, sortOrder, search, simple, - owned, membership, starred, statistics, getDefaultPerPage()).all()); + owned, membership, starred, statistics,topic,topicId, getDefaultPerPage()).all()); } /** @@ -218,26 +220,26 @@ public List getProjects(Boolean archived, Visibility visibility, String * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public List getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, String topic, Integer topicId) throws GitLabApiException { return (getProjects(archived, visibility, orderBy, sort, search, simple, - owned, membership, starred, statistics, getDefaultPerPage()).all()); + owned, membership, starred, statistics,topic, topicId, getDefaultPerPage()).all()); } /** @@ -246,42 +248,45 @@ public List getProjects(Boolean archived, Visibility visibility, Projec * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics - * @param page the page to get - * @param perPage the number of projects per page + * @param page the page to get + * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public List getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, int page, int perPage) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, String topic, Integer topicId, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("archived", archived) - .withParam("visibility", visibility) - .withParam("order_by", orderBy) - .withParam("sort", sort) - .withParam("search", search) - .withParam("simple", simple) - .withParam("owned", owned) - .withParam("membership", membership) - .withParam("starred", starred) - .withParam("statistics", statistics) - .withParam(PAGE_PARAM, page) - .withParam(PER_PAGE_PARAM, perPage); + .withParam("archived", archived) + .withParam("visibility", visibility) + .withParam("order_by", orderBy) + .withParam("sort", sort) + .withParam("search", search) + .withParam("simple", simple) + .withParam("owned", owned) + .withParam("membership", membership) + .withParam("starred", starred) + .withParam("statistics", statistics) + .withParam("topic", topic) + .withParam("topic_id", topicId) + .withParam(PAGE_PARAM, page) + .withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -290,36 +295,38 @@ public List getProjects(Boolean archived, Visibility visibility, Projec * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status - * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user - * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user - * @param statistics include project statistics + * @param archived limit by archived status + * @param visibility limit by visibility public, internal, or private + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user + * @param membership limit by projects that the current user is a member of + * @param starred limit by projects starred by the current user + * @param statistics include project statistics * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public Pager getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, int itemsPerPage) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, String topic, Integer topicId, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("archived", archived) - .withParam("visibility", visibility) - .withParam("order_by", orderBy) - .withParam("sort", sort) - .withParam("search", search) - .withParam("simple", simple) - .withParam("owned", owned) - .withParam("membership", membership) - .withParam("starred", starred) - .withParam("statistics", statistics); + .withParam("archived", archived) + .withParam("visibility", visibility) + .withParam("order_by", orderBy) + .withParam("sort", sort) + .withParam("search", search) + .withParam("simple", simple) + .withParam("owned", owned) + .withParam("membership", membership) + .withParam("starred", starred) + .withParam("statistics", statistics) + .withParam("topic", topic) + .withParam("topic_id", topicId); return (new Pager(this, Project.class, itemsPerPage, formData.asMap(), "projects")); } @@ -342,16 +349,17 @@ public List getProjects(String search) throws GitLabApiException { * *
GitLab Endpoint: GET /projects?search=search
* - * @param search the project name search criteria - * @param page the page to get + * @param search the project name search criteria + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user that match the provided search string * @throws GitLabApiException if any exception occurs */ public List getProjects(String search, int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("search", search).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("search", search).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -359,7 +367,7 @@ public List getProjects(String search, int page, int perPage) throws Gi * *
GitLab Endpoint: GET /projects?search=search
* - * @param search the project name search criteria + * @param search the project name search criteria * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects accessible by the authenticated user that match the provided search string * @throws GitLabApiException if any exception occurs @@ -399,15 +407,16 @@ public List getMemberProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?membership=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects that the authenticated user is a member of * @throws GitLabApiException if any exception occurs */ public List getMemberProjects(int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("membership", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("membership", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -453,15 +462,16 @@ public List getOwnedProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?owned=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects owned by the authenticated user * @throws GitLabApiException if any exception occurs */ public List getOwnedProjects(int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("owned", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("owned", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -507,7 +517,7 @@ public List getStarredProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?starred=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects starred by the authenticated user * @throws GitLabApiException if any exception occurs @@ -515,7 +525,8 @@ public List getStarredProjects() throws GitLabApiException { public List getStarredProjects(int page, int perPage) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("starred", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -563,8 +574,8 @@ public List getProjects(ProjectFilter filter) throws GitLabApiException * *
GitLab Endpoint: GET /projects
* - * @param filter the ProjectFilter instance holding the filter values for the query - * @param page the page to get + * @param filter the ProjectFilter instance holding the filter values for the query + * @param page the page to get * @param perPage the number of projects per page * @return a list of all visible projects across GitLab for the authenticated use * @throws GitLabApiException if any exception occurs @@ -572,7 +583,8 @@ public List getProjects(ProjectFilter filter) throws GitLabApiException public List getProjects(ProjectFilter filter, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(page, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -580,7 +592,7 @@ public List getProjects(ProjectFilter filter, int page, int perPage) th * *
GitLab Endpoint: GET /projects
* - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of all visible projects across GitLab for the authenticated use * @throws GitLabApiException if any exception occurs @@ -609,7 +621,7 @@ public Stream getProjectsStream(ProjectFilter filter) throws GitLabApiE *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @return a list of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ @@ -623,17 +635,18 @@ public List getUserProjects(Object userIdOrUsername, ProjectFilter filt *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query - * @param page the page to get - * @param perPage the number of projects per page + * @param filter the ProjectFilter instance holding the filter values for the query + * @param page the page to get + * @param perPage the number of projects per page * @return a list of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ public List getUserProjects(Object userIdOrUsername, ProjectFilter filter, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(page, perPage); Response response = get(Response.Status.OK, formData.asMap(), - "users", getUserIdOrUsername(userIdOrUsername), "projects"); - return (response.readEntity(new GenericType>() {})); + "users", getUserIdOrUsername(userIdOrUsername), "projects"); + return (response.readEntity(new GenericType>() { + })); } /** @@ -642,15 +655,15 @@ public List getUserProjects(Object userIdOrUsername, ProjectFilter filt *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param filter the ProjectFilter instance holding the filter values for the query + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ public Pager getUserProjects(Object userIdOrUsername, ProjectFilter filter, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(); return (new Pager(this, Project.class, itemsPerPage, formData.asMap(), - "users", getUserIdOrUsername(userIdOrUsername), "projects")); + "users", getUserIdOrUsername(userIdOrUsername), "projects")); } /** @@ -659,7 +672,7 @@ public Pager getUserProjects(Object userIdOrUsername, ProjectFilter fil *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @return a Stream of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ @@ -677,7 +690,7 @@ public Stream getUserProjectsStream(Object userIdOrUsername, ProjectFil * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath) throws GitLabApiException { - return (getProject(projectIdOrPath, null, null, null)); + return (getProject(projectIdOrPath, null, null, null)); } /** @@ -701,13 +714,13 @@ public Optional getOptionalProject(Object projectIdOrPath) { * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param includeStatistics include project statistics * @return the specified project * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath, Boolean includeStatistics) throws GitLabApiException { - return (getProject(projectIdOrPath, includeStatistics, null, null)); + return (getProject(projectIdOrPath, includeStatistics, null, null)); } /** @@ -715,7 +728,7 @@ public Project getProject(Object projectIdOrPath, Boolean includeStatistics) thr * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param includeStatistics include project statistics * @return an Optional instance with the specified project as a value */ @@ -732,21 +745,21 @@ public Optional getOptionalProject(Object projectIdOrPath, Boolean incl * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param includeStatistics include project statistics - * @param includeLicense include project license data + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param includeStatistics include project statistics + * @param includeLicense include project license data * @param withCustomAttributes include custom attributes in response (admins only) * @return the specified project * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath, Boolean includeStatistics, - Boolean includeLicense, Boolean withCustomAttributes) throws GitLabApiException { + Boolean includeLicense, Boolean withCustomAttributes) throws GitLabApiException { Form formData = new GitLabApiForm() - .withParam("statistics", includeStatistics) - .withParam("license", includeLicense) - .withParam("with_custom_attributes", withCustomAttributes); + .withParam("statistics", includeStatistics) + .withParam("license", includeLicense) + .withParam("with_custom_attributes", withCustomAttributes); Response response = get(Response.Status.OK, formData.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath)); + "projects", getProjectIdOrPath(projectIdOrPath)); return (response.readEntity(Project.class)); } @@ -755,17 +768,17 @@ public Project getProject(Object projectIdOrPath, Boolean includeStatistics, * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param includeStatistics include project statistics - * @param includeLicense include project license data + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param includeStatistics include project statistics + * @param includeLicense include project license data * @param withCustomAttributes include custom attributes in response (admins only) * @return an Optional instance with the specified project as a value */ public Optional getOptionalProject(Object projectIdOrPath, Boolean includeStatistics, - Boolean includeLicense, Boolean withCustomAttributes) { + Boolean includeLicense, Boolean withCustomAttributes) { try { return (Optional.ofNullable(getProject(projectIdOrPath, - includeStatistics, includeLicense, withCustomAttributes))); + includeStatistics, includeLicense, withCustomAttributes))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } @@ -777,7 +790,7 @@ public Optional getOptionalProject(Object projectIdOrPath, Boolean incl *
GitLab Endpoint: GET /projects/:id
* * @param namespace the name of the project namespace or group - * @param project the name of the project to get + * @param project the name of the project to get * @return the specified project * @throws GitLabApiException if any exception occurs */ @@ -808,7 +821,7 @@ public Project getProject(String namespace, String project) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id
* * @param namespace the name of the project namespace or group - * @param project the name of the project + * @param project the name of the project * @return an Optional instance with the specified project as a value */ public Optional getOptionalProject(String namespace, String project) { @@ -824,8 +837,8 @@ public Optional getOptionalProject(String namespace, String project) { * *
GitLab Endpoint: GET /projects/:id
* - * @param namespace the name of the project namespace or group - * @param project the name of the project to get + * @param namespace the name of the project namespace or group + * @param project the name of the project to get * @param includeStatistics include project statistics * @return the specified project * @throws GitLabApiException if any exception occurs @@ -857,8 +870,8 @@ public Project getProject(String namespace, String project, Boolean includeStati * *
GitLab Endpoint: GET /projects/:id
* - * @param namespace the name of the project namespace or group - * @param project the name of the project + * @param namespace the name of the project namespace or group + * @param project the name of the project * @param includeStatistics include project statistics * @return an Optional instance with the specified project as a value */ @@ -888,7 +901,7 @@ public Project createProject(Long namespaceId, String projectName) throws GitLab * Create a new project belonging to the namespace ID and project configuration. A namespace ID is either a user or group ID. * * @param namespaceId the namespace ID to create the project under - * @param project the Project instance holding the new project configuration + * @param project the Project instance holding the new project configuration * @return the created project * @throws GitLabApiException if any exception occurs */ @@ -926,9 +939,9 @@ public Project createProject(String projectName) throws GitLabApiException { */ public Project createProject(String name, String path) throws GitLabApiException { - if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) { - throw new RuntimeException("Either name or path must be specified."); - } + if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) { + throw new RuntimeException("Either name or path must be specified."); + } GitLabApiForm formData = new GitLabApiForm().withParam("name", name).withParam("path", path); Response response = post(Response.Status.CREATED, formData, "projects"); @@ -949,7 +962,7 @@ public Project createProject(Project project) throws GitLabApiException { /** * Creates new project owned by the current user. The following properties on the Project instance * are utilized in the creation of the project: - * + *

* name (name or path are required) - new project name * path (name or path are required) - new project path * defaultBranch (optional) - master by default @@ -980,7 +993,7 @@ public Project createProject(Project project) throws GitLabApiException { * ciConfigPath (optional) - Set path to CI configuration file * squashOption (optional) - set squash option for merge requests * - * @param project the Project instance with the configuration for the new project + * @param project the Project instance with the configuration for the new project * @param importUrl the URL to import the repository from * @return a Project instance with the newly created project info * @throws GitLabApiException if any exception occurs @@ -1004,7 +1017,7 @@ public Project createProject(Project project, String importUrl) throws GitLabApi .withParam("default_branch", project.getDefaultBranch()) .withParam("description", project.getDescription()) .withParam("issues_enabled", project.getIssuesEnabled()) - .withParam("merge_method", project.getMergeMethod()) + .withParam("merge_method", project.getMergeMethod()) .withParam("merge_requests_enabled", project.getMergeRequestsEnabled()) .withParam("jobs_enabled", project.getJobsEnabled()) .withParam("wiki_enabled", project.getWikiEnabled()) @@ -1051,6 +1064,12 @@ public Project createProject(Project project, String importUrl) throws GitLabApi if (project.getTagList() != null && !project.getTagList().isEmpty()) { formData.withParam("tag_list", String.join(",", project.getTagList())); } + + if(project.getTopics() !=null && !project.getTopics().isEmpty()){ + + formData.withParam("topics",String.join(",", project.getTopics())); + + } } Response response = post(Response.Status.CREATED, formData, "projects"); @@ -1060,26 +1079,26 @@ public Project createProject(Project project, String importUrl) throws GitLabApi /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default - * @param importUrl The Import URL for the project, otherwise null + * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default + * @param visibilityLevel 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 GitLabApiException if any exception occurs */ public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, String importUrl) throws GitLabApiException { if (isApiVersion(ApiVersion.V3)) { Boolean isPublic = Visibility.PUBLIC == visibility; return (createProject(name, namespaceId, description, issuesEnabled, mergeRequestsEnabled, - wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); + wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); } if (name == null || name.trim().length() == 0) { @@ -1087,16 +1106,16 @@ public Project createProject(String name, Long namespaceId, String description, } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("visibility", visibility) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("visibility", visibility) + .withParam("import_url", importUrl); Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); @@ -1105,28 +1124,28 @@ public Project createProject(String name, Long namespaceId, String description, /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default - * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default + * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default * @param printingMergeRequestLinkEnabled Show link to create/view merge request when pushing from the command line - * @param importUrl The Import URL for the project, otherwise null + * @param importUrl The Import URL for the project, otherwise null * @return the GitLab Project * @throws GitLabApiException if any exception occurs */ public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, - Boolean printingMergeRequestLinkEnabled, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, + Boolean printingMergeRequestLinkEnabled, String importUrl) throws GitLabApiException { if (isApiVersion(ApiVersion.V3)) { Boolean isPublic = Visibility.PUBLIC == visibility; return (createProject(name, namespaceId, description, issuesEnabled, mergeRequestsEnabled, - wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); + wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); } if (name == null || name.trim().length() == 0) { @@ -1134,17 +1153,17 @@ public Project createProject(String name, Long namespaceId, String description, } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("visibility", visibility) - .withParam("printing_merge_request_link_enabled", printingMergeRequestLinkEnabled) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("visibility", visibility) + .withParam("printing_merge_request_link_enabled", printingMergeRequestLinkEnabled) + .withParam("import_url", importUrl); Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); @@ -1153,39 +1172,39 @@ public Project createProject(String name, Long namespaceId, String description, /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default * @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 isPublic 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 importUrl The Import URL for the project, otherwise null + * @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 isPublic 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 importUrl The Import URL for the project, otherwise null * @return the GitLab Project * @throws GitLabApiException if any exception occurs * @deprecated As of release 4.2.0, replaced by {@link #createProject(String, Long, String, Boolean, Boolean, - * Boolean, Boolean, Visibility, Integer, String)} + * Boolean, Boolean, Visibility, Integer, String)} */ @Deprecated public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Boolean isPublic, Integer visibilityLevel, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Boolean isPublic, Integer visibilityLevel, String importUrl) throws GitLabApiException { if (name == null || name.trim().length() == 0) { return (null); } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("import_url", importUrl); if (isApiVersion(ApiVersion.V3)) { formData.withParam("public", isPublic); @@ -1200,11 +1219,11 @@ public Project createProject(String name, Long namespaceId, String description, /** * Create a new project from a template, belonging to the namespace ID. A namespace ID is either a user or group ID. * - * @param namespaceId the namespace ID to create the project under - * @param projectName the name of the project top create + * @param namespaceId the namespace ID to create the project under + * @param projectName the name of the project top create * @param groupWithProjectTemplatesId Id of the Gitlab Group, which contains the relevant templates. - * @param templateName name of the template to use - * @param visibility Visibility of the new create project + * @param templateName name of the template to use + * @param visibility Visibility of the new create project * @return the created project * @throws GitLabApiException if any exception occurs */ @@ -1215,8 +1234,7 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName .withParam("use_custom_template", true) .withParam("group_with_project_templates_id", groupWithProjectTemplatesId, true) .withParam("template_name", templateName, true) - .withParam("visibility", visibility) - ; + .withParam("visibility", visibility); Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); } @@ -1224,7 +1242,7 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName /** * Updates a project. The following properties on the Project instance * are utilized in the edit of the project, null values are not updated: - * + *

* id (required) - existing project id, either id or path must be provided * name (optional) - project name * path (optional) - project path, either id or path must be provided @@ -1254,12 +1272,12 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName * ciConfigPath (optional) - Set path to CI configuration file * ciForwardDeploymentEnabled (optional) - When a new deployment job starts, skip older deployment jobs that are still pending * squashOption (optional) - set squash option for merge requests - * + *

* NOTE: The following parameters specified by the GitLab API edit project are not supported: - * import_url - * tag_list array - * avatar - * initialize_with_readme + * import_url + * tag_list array + * avatar + * initialize_with_readme * * @param project the Project instance with the configuration for the new project * @return a Project instance with the newly updated project info @@ -1280,7 +1298,7 @@ public Project updateProject(Project project) throws GitLabApiException { .withParam("default_branch", project.getDefaultBranch()) .withParam("description", project.getDescription()) .withParam("issues_enabled", project.getIssuesEnabled()) - .withParam("merge_method", project.getMergeMethod()) + .withParam("merge_method", project.getMergeMethod()) .withParam("merge_requests_enabled", project.getMergeRequestsEnabled()) .withParam("jobs_enabled", project.getJobsEnabled()) .withParam("wiki_enabled", project.getWikiEnabled()) @@ -1389,9 +1407,9 @@ public Project forkProject(Object projectIdOrPath, Long namespaceId) throws GitL */ public Project forkProject(Object projectIdOrPath, String namespace, String path, String name) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("namespace", namespace, true) - .withParam("path", path) - .withParam("name", name); + .withParam("namespace", namespace, true) + .withParam("path", path) + .withParam("name", name); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.CREATED); Response response = post(expectedStatus, formData, "projects", getProjectIdOrPath(projectIdOrPath), "fork"); return (response.readEntity(Project.class)); @@ -1402,15 +1420,14 @@ public Project forkProject(Object projectIdOrPath, String namespace, String path * *

GitLab Endpoint: POST /projects/:id/fork/:forkFromId
* - * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param forkedFromId the ID of the project that was forked from + * @param forkedFromId the ID of the project that was forked from * @return the updated Project instance * @throws GitLabApiException if any exception occurs */ public Project createForkedFromRelationship(Object projectIdOrPath, Long forkedFromId) throws GitLabApiException { Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.CREATED); - Response response = post(expectedStatus, (Form)null, "projects", this.getProjectIdOrPath(projectIdOrPath), "fork", forkedFromId); + Response response = post(expectedStatus, (Form) null, "projects", this.getProjectIdOrPath(projectIdOrPath), "fork", forkedFromId); return (response.readEntity(Project.class)); } @@ -1446,14 +1463,15 @@ public List getMembers(Object projectIdOrPath) throws GitLabApiException *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param page the page to get - * @param perPage the number of Member instances per page + * @param page the page to get + * @param perPage the number of Member instances per page * @return the members belonging to the specified project * @throws GitLabApiException if any exception occurs */ public List getMembers(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "members"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -1462,7 +1480,7 @@ public List getMembers(Object projectIdOrPath, int page, int perPage) th *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return the members belonging to the specified project * @throws GitLabApiException if any exception occurs */ @@ -1508,17 +1526,18 @@ public List getAllMembers(Object projectIdOrPath) throws GitLabApiExcept *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param page the page to get - * @param perPage the number of Member instances per page + * @param page the page to get + * @param perPage the number of Member instances per page * @return the project members viewable by the authenticated user, including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0 + * @deprecated Will be removed in version 6.0 */ @Deprecated public List getAllMembers(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), - "projects", getProjectIdOrPath(projectIdOrPath), "members", "all"); - return (response.readEntity(new GenericType>() {})); + "projects", getProjectIdOrPath(projectIdOrPath), "members", "all"); + return (response.readEntity(new GenericType>() { + })); } /** @@ -1530,7 +1549,7 @@ public List getAllMembers(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/members/all
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1565,8 +1584,8 @@ public Stream getAllMembersStream(Object projectIdOrPath) throws GitLabA *
GitLab Endpoint: GET /projects/:id/members/all
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs * @return the project members viewable by the authenticated user, including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs */ @@ -1583,9 +1602,9 @@ public List getAllMembers(Object projectIdOrPath, String query, ListGitLab Endpoint: GET /projects/:id/members/all * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1593,7 +1612,7 @@ public List getAllMembers(Object projectIdOrPath, String query, List getAllMembers(Object projectIdOrPath, String query, List userIds, int itemsPerPage) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("query", query).withParam("user_ids", userIds); return (new Pager(this, Member.class, itemsPerPage, form.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath), "members", "all")); + "projects", getProjectIdOrPath(projectIdOrPath), "members", "all")); } /** @@ -1605,8 +1624,8 @@ public Pager getAllMembers(Object projectIdOrPath, String query, ListGitLab Endpoint: GET /projects/:id/members/all * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs * @return a Stream of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1621,7 +1640,7 @@ public Stream getAllMembersStream(Object projectIdOrPath, String query, *
GitLab Endpoint: GET /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param userId the user ID of the member * @return the member specified by the project ID/user ID pair * @throws GitLabApiException if any exception occurs */ @@ -1635,10 +1654,10 @@ public Member getMember(Object projectIdOrPath, Long userId) throws GitLabApiExc *
GitLab Endpoint: GET /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param userId the user ID of the member * @return the member specified by the project ID/user ID pair */ - public Optional getOptionalMember(Object projectIdOrPath, Long userId) { + public Optional getOptionalMember(Object projectIdOrPath, Long userId) { try { return (Optional.ofNullable(getMember(projectIdOrPath, userId, false))); } catch (GitLabApiException glae) { @@ -1651,8 +1670,8 @@ public Optional getOptionalMember(Object projectIdOrPath, Long userId) * *
GitLab Endpoint: GET /projects/:id/members/all/:user_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param userId the user ID of the member * @param includeInherited if true will the member even if inherited thru an ancestor group * @return the member specified by the project ID/user ID pair * @throws GitLabApiException if any exception occurs @@ -1672,12 +1691,12 @@ public Member getMember(Object projectIdOrPath, Long userId, Boolean includeInhe * *
GitLab Endpoint: GET /projects/:id/members/all/:user_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param userId the user ID of the member * @param includeInherited if true will the member even if inherited thru an ancestor group * @return the member specified by the project ID/user ID pair as the value of an Optional */ - public Optional getOptionalMember(Object projectIdOrPath, Long userId, Boolean includeInherited) { + public Optional getOptionalMember(Object projectIdOrPath, Long userId, Boolean includeInherited) { try { return (Optional.ofNullable(getMember(projectIdOrPath, userId, includeInherited))); } catch (GitLabApiException glae) { @@ -1693,8 +1712,8 @@ public Optional getOptionalMember(Object projectIdOrPath, Long userId, B *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add, required - * @param accessLevel the access level for the new member, required + * @param userId the user ID of the member to add, required + * @param accessLevel the access level for the new member, required * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1710,8 +1729,8 @@ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add, required - * @param accessLevel the access level for the new member, required + * @param userId the user ID of the member to add, required + * @param accessLevel the access level for the new member, required * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1727,9 +1746,9 @@ public Member addMember(Object projectIdOrPath, Long userId, AccessLevel accessL *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add - * @param accessLevel the access level for the new member - * @param expiresAt the date the membership in the group will expire + * @param userId the user ID of the member to add + * @param accessLevel the access level for the new member + * @param expiresAt the date the membership in the group will expire * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1745,17 +1764,17 @@ public Member addMember(Object projectIdOrPath, Long userId, AccessLevel accessL *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add - * @param accessLevel the access level for the new member - * @param expiresAt the date the membership in the group will expire + * @param userId the user ID of the member to add + * @param accessLevel the access level for the new member + * @param expiresAt the date the membership in the group will expire * @return the added member * @throws GitLabApiException if any exception occurs */ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("user_id", userId, true) - .withParam("access_level", accessLevel, true) - .withParam("expires_at", expiresAt, false); + .withParam("user_id", userId, true) + .withParam("access_level", accessLevel, true) + .withParam("expires_at", expiresAt, false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "members"); return (response.readEntity(Member.class)); } @@ -1766,8 +1785,8 @@ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1781,8 +1800,8 @@ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLe *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1796,9 +1815,9 @@ public Member updateMember(Object projectIdOrPath, Long userId, AccessLevel acce *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required - * @param expiresAt the date the membership in the group will expire, optional + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required + * @param expiresAt the date the membership in the group will expire, optional * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1812,16 +1831,16 @@ public Member updateMember(Object projectIdOrPath, Long userId, AccessLevel acce *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required - * @param expiresAt the date the membership in the group will expire, optional + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required + * @param expiresAt the date the membership in the group will expire, optional * @return the updated member * @throws GitLabApiException if any exception occurs */ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("access_level", accessLevel, true) - .withParam("expires_at", expiresAt, false); + .withParam("access_level", accessLevel, true) + .withParam("expires_at", expiresAt, false); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "members", userId); return (response.readEntity(Member.class)); } @@ -1832,7 +1851,7 @@ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLe *
GitLab Endpoint: DELETE /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param userId the user ID of the member to remove + * @param userId the user ID of the member to remove * @throws GitLabApiException if any exception occurs */ public void removeMember(Object projectIdOrPath, Long userId) throws GitLabApiException { @@ -1859,7 +1878,7 @@ public List getProjectUsers(Object projectIdOrPath) throws GitLabAp *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1887,7 +1906,7 @@ public Stream getProjectUsersStream(Object projectIdOrPath) throws *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param search the string to match specific users + * @param search the string to match specific users * @return the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1902,15 +1921,15 @@ public List getProjectUsers(Object projectIdOrPath, String search) *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param search the string to match specific users - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param search the string to match specific users + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ public Pager getProjectUsers(Object projectIdOrPath, String search, int itemsPerPage) throws GitLabApiException { MultivaluedMap params = (search != null ? new GitLabApiForm().withParam("search", search).asMap() : null); return (new Pager(this, ProjectUser.class, itemsPerPage, params, - "projects", getProjectIdOrPath(projectIdOrPath), "users")); + "projects", getProjectIdOrPath(projectIdOrPath), "users")); } /** @@ -1920,7 +1939,7 @@ public Pager getProjectUsers(Object projectIdOrPath, String search, *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param search the string to match specific users + * @param search the string to match specific users * @return a Stream of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1947,7 +1966,7 @@ public List getProjectGroups(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -1974,7 +1993,7 @@ public Stream getProjectGroupsStream(Object projectIdOrPath) throw *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param filter the ProjectGroupsFilter to match against + * @param filter the ProjectGroupsFilter to match against * @return the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -1988,8 +2007,8 @@ public List getProjectGroups(Object projectIdOrPath, ProjectGroups *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param filter the ProjectGroupsFilter to match against - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param filter the ProjectGroupsFilter to match against + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -2004,7 +2023,7 @@ public Pager getProjectGroups(Object projectIdOrPath, ProjectGroup *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param filter the ProjectGroupsFilter to match against + * @param filter the ProjectGroupsFilter to match against * @return a Stream of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -2031,14 +2050,15 @@ public List getProjectEvents(Object projectIdOrPath) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id/events
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of Event instances per page + * @param page the page to get + * @param perPage the number of Event instances per page * @return the project events for the specified project * @throws GitLabApiException if any exception occurs */ public List getProjectEvents(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "events"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2047,7 +2067,7 @@ public List getProjectEvents(Object projectIdOrPath, int page, int perPag *
GitLab Endpoint: GET /projects/:id/events
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of project events for the specified project * @throws GitLabApiException if any exception occurs */ @@ -2087,14 +2107,15 @@ public List getHooks(Object projectIdOrPath) throws GitLabApiExcept *
GitLab Endpoint: GET /projects/:id/hooks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of ProjectHook instances per page + * @param page the page to get + * @param perPage the number of ProjectHook instances per page * @return a list of project hooks for the specified project in the specified page range * @throws GitLabApiException if any exception occurs */ public List getHooks(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2103,7 +2124,7 @@ public List getHooks(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/hooks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of project hooks for the specified project * @throws GitLabApiException if any exception occurs */ @@ -2130,7 +2151,7 @@ public Stream getHooksStream(Object projectIdOrPath) throws GitLabA *
GitLab Endpoint: GET /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the ID of the hook to get + * @param hookId the ID of the hook to get * @return the project hook for the specified project ID/hook ID pair * @throws GitLabApiException if any exception occurs */ @@ -2145,7 +2166,7 @@ public ProjectHook getHook(Object projectIdOrPath, Long hookId) throws GitLabApi *
GitLab Endpoint: GET /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the ID of the hook to get + * @param hookId the ID of the hook to get * @return the project hook for the specified project ID/hook ID pair as an Optional instance */ public Optional getOptionalHook(Object projectIdOrPath, Long hookId) { @@ -2161,36 +2182,36 @@ public Optional getOptionalHook(Object projectIdOrPath, Long hookId * *
GitLab Endpoint: POST /projects/:id/hooks
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param url the callback URL for the hook - * @param enabledHooks a ProjectHook instance specifying which hooks to enable + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param url the callback URL for the hook + * @param enabledHooks a ProjectHook instance specifying which hooks to enable * @param enableSslVerification enable SSL verification - * @param secretToken the secret token to pass back to the hook + * @param secretToken the secret token to pass back to the hook * @return the added ProjectHook instance * @throws GitLabApiException if any exception occurs */ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabledHooks, - boolean enableSslVerification, String secretToken) throws GitLabApiException { + boolean enableSslVerification, String secretToken) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url, true) - .withParam("push_events", enabledHooks.getPushEvents(), false) - .withParam("push_events_branch_filter", enabledHooks.getPushEventsBranchFilter(), false) - .withParam("issues_events", enabledHooks.getIssuesEvents(), false) - .withParam("confidential_issues_events", enabledHooks.getConfidentialIssuesEvents(), false) - .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) - .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) - .withParam("note_events", enabledHooks.getNoteEvents(), false) - .withParam("confidential_note_events", enabledHooks.getConfidentialNoteEvents(), false) - .withParam("job_events", enabledHooks.getJobEvents(), false) - .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) - .withParam("wiki_page_events", enabledHooks.getWikiPageEvents(), false) - .withParam("enable_ssl_verification", enableSslVerification, false) - .withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false) - .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) - .withParam("releases_events", enabledHooks.getReleasesEvents(), false) - .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) - .withParam("token", secretToken, false); + .withParam("url", url, true) + .withParam("push_events", enabledHooks.getPushEvents(), false) + .withParam("push_events_branch_filter", enabledHooks.getPushEventsBranchFilter(), false) + .withParam("issues_events", enabledHooks.getIssuesEvents(), false) + .withParam("confidential_issues_events", enabledHooks.getConfidentialIssuesEvents(), false) + .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) + .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) + .withParam("note_events", enabledHooks.getNoteEvents(), false) + .withParam("confidential_note_events", enabledHooks.getConfidentialNoteEvents(), false) + .withParam("job_events", enabledHooks.getJobEvents(), false) + .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) + .withParam("wiki_page_events", enabledHooks.getWikiPageEvents(), false) + .withParam("enable_ssl_verification", enableSslVerification, false) + .withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false) + .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) + .withParam("releases_events", enabledHooks.getReleasesEvents(), false) + .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) + .withParam("token", secretToken, false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); return (response.readEntity(ProjectHook.class)); } @@ -2200,22 +2221,22 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl * *
GitLab Endpoint: POST /projects/:id/hooks
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param url the callback URL for the hook - * @param doPushEvents flag specifying whether to do push events - * @param doIssuesEvents flag specifying whether to do issues events + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param url the callback URL for the hook + * @param doPushEvents flag specifying whether to do push events + * @param doIssuesEvents flag specifying whether to do issues events * @param doMergeRequestsEvents flag specifying whether to do merge requests events * @return the added ProjectHook instance * @throws GitLabApiException if any exception occurs */ public ProjectHook addHook(Object projectIdOrPath, String url, boolean doPushEvents, - boolean doIssuesEvents, boolean doMergeRequestsEvents) throws GitLabApiException { + boolean doIssuesEvents, boolean doMergeRequestsEvents) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url) - .withParam("push_events", doPushEvents) - .withParam("issues_events", doIssuesEvents) - .withParam("merge_requests_events", doMergeRequestsEvents); + .withParam("url", url) + .withParam("push_events", doPushEvents) + .withParam("issues_events", doIssuesEvents) + .withParam("merge_requests_events", doMergeRequestsEvents); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); return (response.readEntity(ProjectHook.class)); @@ -2227,7 +2248,7 @@ public ProjectHook addHook(Object projectIdOrPath, String url, boolean doPushEve *
GitLab Endpoint: DELETE /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the project hook ID to delete + * @param hookId the project hook ID to delete * @throws GitLabApiException if any exception occurs */ public void deleteHook(Object projectIdOrPath, Long hookId) throws GitLabApiException { @@ -2302,8 +2323,8 @@ public List getIssues(Object projectIdOrPath) throws GitLabApiException { *
GitLab Endpoint: GET /projects/:id/issues
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of issues per page + * @param page the page to get + * @param perPage the number of issues per page * @return the list of issues in the specified range * @throws GitLabApiException if any exception occurs * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssues(Object, int, int)} @@ -2311,7 +2332,8 @@ public List getIssues(Object projectIdOrPath) throws GitLabApiException { @Deprecated public List getIssues(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "issues"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2320,7 +2342,7 @@ public List getIssues(Object projectIdOrPath, int page, int perPage) thro *
GitLab Endpoint: GET /projects/:id/issues
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of issues per page + * @param itemsPerPage the number of issues per page * @return the list of issues in the specified range * @throws GitLabApiException if any exception occurs * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssues(Object, int)} @@ -2351,10 +2373,10 @@ public Stream getIssuesStream(Object projectIdOrPath) throws GitLabApiExc *
GitLab Endpoint: GET /projects/:id/issues/:issue_iid
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param issueId the internal ID of a project's issue + * @param issueId the internal ID of a project's issue * @return the specified Issue instance * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssue(Object, Long)} + * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssue(Object, Long)} */ @Deprecated public Issue getIssue(Object projectIdOrPath, Long issueId) throws GitLabApiException { @@ -2368,9 +2390,9 @@ public Issue getIssue(Object projectIdOrPath, Long issueId) throws GitLabApiExce *
GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param issueId the internal ID of a project's issue + * @param issueId the internal ID of a project's issue * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#deleteIssue(Object, Long)} + * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#deleteIssue(Object, Long)} */ @Deprecated public void deleteIssue(Object projectIdOrPath, Long issueId) throws GitLabApiException { @@ -2397,14 +2419,15 @@ public List getSnippets(Object projectIdOrPath) throws GitLabApiExcepti *
GitLab Endpoint: GET /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of snippets per page + * @param page the page to get + * @param perPage the number of snippets per page * @return a list of project's snippets for the specified range * @throws GitLabApiException if any exception occurs */ public List getSnippets(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2413,7 +2436,7 @@ public List getSnippets(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of snippets per page + * @param itemsPerPage the number of snippets per page * @return the Pager of snippets * @throws GitLabApiException if any exception occurs */ @@ -2440,7 +2463,7 @@ public Stream getSnippetsStream(Object projectIdOrPath) throws GitLabAp *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the specified project Snippet * @throws GitLabApiException if any exception occurs */ @@ -2455,7 +2478,7 @@ public Snippet getSnippet(Object projectIdOrPath, Long snippetId) throws GitLabA *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the specified project Snippet as an Optional instance */ public Optional getOptionalSnippet(Object projectIdOrPath, Long snippetId) { @@ -2472,25 +2495,25 @@ public Optional getOptionalSnippet(Object projectIdOrPath, Long snippet *
GitLab Endpoint: POST /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param title the title of a snippet, required - * @param filename the name of a snippet file, required - * @param description the description of a snippet, optional - * @param content the content of a snippet, required - * @param visibility the snippet's visibility, required + * @param title the title of a snippet, required + * @param filename the name of a snippet file, required + * @param description the description of a snippet, optional + * @param content the content of a snippet, required + * @param visibility the snippet's visibility, required * @return a Snippet instance with info on the created snippet * @throws GitLabApiException if any exception occurs */ public Snippet createSnippet(Object projectIdOrPath, String title, String filename, String description, - String content, Visibility visibility) throws GitLabApiException { + String content, Visibility visibility) throws GitLabApiException { try { GitLabApiForm form = new GitLabApiForm() - .withParam("title", title, true) - .withParam("file_name", filename, true) - .withParam("description", description) - .withParam("content", content, true) - .withParam("visibility", visibility, true); + .withParam("title", title, true) + .withParam("file_name", filename, true) + .withParam("description", description) + .withParam("content", content, true) + .withParam("visibility", visibility, true); Response response = post(Response.Status.CREATED, form, "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); return (response.readEntity(Snippet.class)); @@ -2503,11 +2526,11 @@ public Snippet createSnippet(Object projectIdOrPath, String title, String filena } GitLabApiForm form = new GitLabApiForm() - .withParam("title", title, true) - .withParam("file_name", filename, true) - .withParam("description", description) - .withParam("code", content, true) - .withParam("visibility", visibility, true); + .withParam("title", title, true) + .withParam("file_name", filename, true) + .withParam("description", description) + .withParam("code", content, true) + .withParam("visibility", visibility, true); Response response = post(Response.Status.CREATED, form, "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); return (response.readEntity(Snippet.class)); @@ -2520,24 +2543,24 @@ public Snippet createSnippet(Object projectIdOrPath, String title, String filena *
GitLab Endpoint: PUT /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of a project's snippet, required - * @param title the title of a snippet, optional - * @param filename the name of a snippet file, optional - * @param description the description of a snippet, optioptionalonal - * @param code the content of a snippet, optional - * @param visibility the snippet's visibility, reqoptionaluired + * @param snippetId the ID of a project's snippet, required + * @param title the title of a snippet, optional + * @param filename the name of a snippet file, optional + * @param description the description of a snippet, optioptionalonal + * @param code the content of a snippet, optional + * @param visibility the snippet's visibility, reqoptionaluired * @return a Snippet instance with info on the updated snippet * @throws GitLabApiException if any exception occurs */ public Snippet updateSnippet(Object projectIdOrPath, Long snippetId, String title, String filename, String description, - String code, Visibility visibility) throws GitLabApiException { + String code, Visibility visibility) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("title", title) - .withParam("file_name", filename) - .withParam("description", description) - .withParam("code", code) - .withParam("visibility", visibility); + .withParam("title", title) + .withParam("file_name", filename) + .withParam("description", description) + .withParam("code", code) + .withParam("visibility", visibility); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); return (response.readEntity(Snippet.class)); @@ -2563,7 +2586,7 @@ public void deleteSnippet(Object projectIdOrPath, Long snippetId) throws GitLabA *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/raw
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the raw project snippet plain text as an Optional instance * @throws GitLabApiException if any exception occurs */ @@ -2578,7 +2601,7 @@ public String getRawSnippetContent(Object projectIdOrPath, Long snippetId) throw *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/raw
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the raw project snippet plain text as an Optional instance */ public Optional getOptionalRawSnippetContent(Object projectIdOrPath, Long snippetId) { @@ -2595,13 +2618,13 @@ public Optional getOptionalRawSnippetContent(Object projectIdOrPath, Lon *
GitLab Endpoint: POST /projects/:id/share
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param groupId the ID of the group to share with, required - * @param accessLevel the permissions level to grant the group, required - * @param expiresAt the share expiration date, optional + * @param groupId the ID of the group to share with, required + * @param accessLevel the permissions level to grant the group, required + * @param expiresAt the share expiration date, optional * @throws GitLabApiException if any exception occurs */ public void shareProject(Object projectIdOrPath, Long groupId, AccessLevel accessLevel, Date expiresAt) - throws GitLabApiException { + throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("group_id", groupId, true) .withParam("group_access", accessLevel, true) @@ -2615,7 +2638,7 @@ public void shareProject(Object projectIdOrPath, Long groupId, AccessLevel acces *
GitLab Endpoint: DELETE /projects/:id/share/:group_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param groupId the ID of the group to unshare, required + * @param groupId the ID of the group to unshare, required * @throws GitLabApiException if any exception occurs */ public void unshareProject(Object projectIdOrPath, Long groupId) throws GitLabApiException { @@ -2633,7 +2656,7 @@ public void unshareProject(Object projectIdOrPath, Long groupId) throws GitLabAp * @throws GitLabApiException if any exception occurs */ public Project archiveProject(Object projectIdOrPath) - throws GitLabApiException { + throws GitLabApiException { Response response = post(Response.Status.CREATED, (new GitLabApiForm()), "projects", getProjectIdOrPath(projectIdOrPath), "archive"); return (response.readEntity(Project.class)); } @@ -2648,7 +2671,7 @@ public Project archiveProject(Object projectIdOrPath) * @throws GitLabApiException if any exception occurs */ public Project unarchiveProject(Object projectIdOrPath) - throws GitLabApiException { + throws GitLabApiException { Response response = post(Response.Status.CREATED, (new GitLabApiForm()), "projects", getProjectIdOrPath(projectIdOrPath), "unarchive"); return (response.readEntity(Project.class)); } @@ -2659,7 +2682,7 @@ public Project unarchiveProject(Object projectIdOrPath) *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param fileToUpload the File instance of the file to upload, required + * @param fileToUpload the File instance of the file to upload, required * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2673,8 +2696,8 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload) throws G *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param fileToUpload the File instance of the file to upload, required - * @param mediaType unused; will be removed in the next major version + * @param fileToUpload the File instance of the file to upload, required + * @param mediaType unused; will be removed in the next major version * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2690,9 +2713,9 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String m *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required - * @param inputStream the data to upload, required - * @param filename The filename of the file to upload - * @param mediaType unused; will be removed in the next major version + * @param inputStream the data to upload, required + * @param filename The filename of the file to upload + * @param mediaType unused; will be removed in the next major version * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2719,10 +2742,10 @@ public PushRules getPushRules(Object projectIdOrPath) throws GitLabApiException * Adds a push rule to a specified project. * *
GitLab Endpoint: POST /projects/:id/push_rule
- * + *

* The following properties on the PushRules instance are utilized in the creation of the push rule: * - * + * * denyDeleteTag (optional) - Deny deleting a tag * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets @@ -2734,10 +2757,10 @@ public PushRules getPushRules(Object projectIdOrPath) throws GitLabApiException * maxFileSize (optional) - Maximum file size (MB) * commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails. * rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG - * + * * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param pushRule the PushRule instance containing the push rule configuration to add + * @param pushRule the PushRule instance containing the push rule configuration to add * @return a PushRules instance with the newly created push rule info * @throws GitLabApiException if any exception occurs */ @@ -2763,10 +2786,10 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr * Updates a push rule for the specified project. * *

GitLab Endpoint: PUT /projects/:id/push_rule/:push_rule_id
- * + *

* The following properties on the PushRules instance are utilized when updating the push rule: * - * + * * denyDeleteTag (optional) - Deny deleting a tag * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets @@ -2778,10 +2801,10 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr * maxFileSize (optional) - Maximum file size (MB) * commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails. * rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG - * + * * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param pushRule the PushRules instance containing the push rule configuration to update + * @param pushRule the PushRules instance containing the push rule configuration to update * @return a PushRules instance with the newly created push rule info * @throws GitLabApiException if any exception occurs */ @@ -2835,14 +2858,15 @@ public List getForks(Object projectIdOrPath) throws GitLabApiException *

GitLab Endpoint: GET /projects/:id/forks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of projects per page + * @param page the page to get + * @param perPage the number of projects per page * @return a List of forked projects * @throws GitLabApiException if any exception occurs */ public List getForks(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { - Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", getProjectIdOrPath(projectIdOrPath), "forks"); - return (response.readEntity(new GenericType>() { })); + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "forks"); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2851,7 +2875,7 @@ public List getForks(Object projectIdOrPath, int page, int perPage) thr *
GitLab Endpoint: GET /projects/:id/forks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects * @throws GitLabApiException if any exception occurs */ @@ -2914,7 +2938,8 @@ public Project unstarProject(Object projectIdOrPath) throws GitLabApiException { */ public Map getProjectLanguages(Object projectIdOrPath) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "languages"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -2923,7 +2948,7 @@ public Map getProjectLanguages(Object projectIdOrPath) throws Git *
GitLab Endpoint: PUT /projects/:id/transfer.
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param namespace the namespace to transfer the project to + * @param namespace the namespace to transfer the project to * @return the updated Project * @throws GitLabApiException if any exception occurs */ @@ -2939,13 +2964,13 @@ public Project transferProject(Object projectIdOrPath, String namespace) throws *
GitLab Endpoint: PUT /projects/:id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param avatarFile the File instance of the avatar file to upload + * @param avatarFile the File instance of the avatar file to upload * @return the updated Project instance * @throws GitLabApiException if any exception occurs */ public Project setProjectAvatar(Object projectIdOrPath, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, - "avatar", avatarFile, "projects", getProjectIdOrPath(projectIdOrPath)); + "avatar", avatarFile, "projects", getProjectIdOrPath(projectIdOrPath)); return (response.readEntity(Project.class)); } @@ -2955,8 +2980,8 @@ public Project setProjectAvatar(Object projectIdOrPath, File avatarFile) throws *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. * @return a List of project Audit events * @throws GitLabApiException if any exception occurs */ @@ -2970,18 +2995,18 @@ public List getAuditEvents(Object projectIdOrPath, Date created_afte *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. - * @param itemsPerPage the number of Audit Event instances that will be fetched per page + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. + * @param itemsPerPage the number of Audit Event instances that will be fetched per page * @return a Pager of project Audit events * @throws GitLabApiException if any exception occurs */ public Pager getAuditEvents(Object projectIdOrPath, Date created_after, Date created_before, int itemsPerPage) throws GitLabApiException { Form form = new GitLabApiForm() - .withParam("created_before", ISO8601.toString(created_before, false)) - .withParam("created_after", ISO8601.toString(created_after, false)); + .withParam("created_before", ISO8601.toString(created_before, false)) + .withParam("created_after", ISO8601.toString(created_after, false)); return (new Pager(this, AuditEvent.class, itemsPerPage, form.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath), "audit_events")); + "projects", getProjectIdOrPath(projectIdOrPath), "audit_events")); } /** @@ -2990,8 +3015,8 @@ public Pager getAuditEvents(Object projectIdOrPath, Date created_aft *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. * @return a Stream of project Audit events * @throws GitLabApiException if any exception occurs */ @@ -3005,7 +3030,7 @@ public Stream getAuditEventsStream(Object projectIdOrPath, Date crea *
GitLab Endpoint: GET /projects/:id/audit_events/:id_audit_event
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param auditEventId the auditEventId, required + * @param auditEventId the auditEventId, required * @return the project Audit event * @throws GitLabApiException if any exception occurs */ @@ -3033,14 +3058,15 @@ public List getVariables(Object projectIdOrPath) throws GitLabApiExcep *
GitLab Endpoint: GET /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of Variable instances per page + * @param page the page to get + * @param perPage the number of Variable instances per page * @return a list of variables belonging to the specified project in the specified page range * @throws GitLabApiException if any exception occurs */ public List getVariables(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "variables"); - return (response.readEntity(new GenericType>() {})); + return (response.readEntity(new GenericType>() { + })); } /** @@ -3049,7 +3075,7 @@ public List getVariables(Object projectIdOrPath, int page, int perPage *
GitLab Endpoint: GET /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Variable instances that will be fetched per page + * @param itemsPerPage the number of Variable instances that will be fetched per page * @return a Pager of variables belonging to the specified project * @throws GitLabApiException if any exception occurs */ @@ -3076,13 +3102,13 @@ public Stream getVariablesStream(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @return the Variable instance for the specified variable * @throws GitLabApiException if any exception occurs */ public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApiException { - Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); - return (response.readEntity(Variable.class)); + Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); + return (response.readEntity(Variable.class)); } /** @@ -3091,7 +3117,7 @@ public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApi *
GitLab Endpoint: GET /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @return the Variable for the specified variable as an Optional instance */ public Optional getOptionalVariable(Object projectIdOrPath, String key) { @@ -3108,9 +3134,9 @@ public Optional getOptionalVariable(Object projectIdOrPath, String key *
GitLab Endpoint: POST /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ @@ -3125,10 +3151,10 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: POST /projects/:id/variables
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @param environmentScope the environment_scope of the variable, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution @@ -3145,16 +3171,16 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: POST /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param isMasked whether the variable is masked, optional + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param isMasked whether the variable is masked, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ public Variable createVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean isMasked) throws GitLabApiException { + Boolean isProtected, Boolean isMasked) throws GitLabApiException { return createVariable(projectIdOrPath, key, value, variableType, isProtected, isMasked, null); } @@ -3165,26 +3191,26 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: POST /projects/:id/variables
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param isMasked whether the variable is masked, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param isMasked whether the variable is masked, optional * @param environmentScope the environment_scope of the variable, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ public Variable createVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean isMasked, String environmentScope) throws GitLabApiException { + Boolean isProtected, Boolean isMasked, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("key", key, true) - .withParam("value", value, true) - .withParam("variable_type", variableType) - .withParam("protected", isProtected) - .withParam("masked", isMasked) - .withParam("environment_scope", environmentScope); + .withParam("key", key, true) + .withParam("value", value, true) + .withParam("variable_type", variableType) + .withParam("protected", isProtected) + .withParam("masked", isMasked) + .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); } @@ -3195,9 +3221,9 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: PUT /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ @@ -3212,10 +3238,10 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: PUT /projects/:id/variables/:key
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @param environmentScope the environment_scope of the variable, optional. * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution @@ -3232,16 +3258,16 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: PUT /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param masked whether the variable is masked, optional + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param masked whether the variable is masked, optional * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ public Variable updateVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean masked) throws GitLabApiException { + Boolean isProtected, Boolean masked) throws GitLabApiException { return updateVariable(projectIdOrPath, key, value, variableType, isProtected, masked, null); } @@ -3252,25 +3278,25 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: PUT /projects/:id/variables/:key
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param masked whether the variable is masked, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param masked whether the variable is masked, optional * @param environmentScope the environment_scope of the variable, optional. * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ public Variable updateVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean masked, String environmentScope) throws GitLabApiException { + Boolean isProtected, Boolean masked, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("value", value, true) - .withParam("variable_type", variableType) - .withParam("protected", isProtected) - .withParam("masked", masked) - .withParam("environment_scope", environmentScope); + .withParam("value", value, true) + .withParam("variable_type", variableType) + .withParam("protected", isProtected) + .withParam("masked", masked) + .withParam("environment_scope", environmentScope); Response response = putWithFormData(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); return (response.readEntity(Variable.class)); } @@ -3281,7 +3307,7 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: DELETE /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @throws GitLabApiException if any exception occurs */ public void deleteVariable(Object projectIdOrPath, String key) throws GitLabApiException { @@ -3307,7 +3333,7 @@ public List getAccessRequests(Object projectIdOrPath) throws GitL *
GitLab Endpoint: GET /projects/:id/access_requests
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of AccessRequest instances that will be fetched per page + * @param itemsPerPage the number of AccessRequest instances that will be fetched per page * @return a Pager of project AccessRequest instances accessible by the authenticated user * @throws GitLabApiException if any exception occurs */ @@ -3325,7 +3351,7 @@ public Pager getAccessRequests(Object projectIdOrPath, int itemsP * @throws GitLabApiException if any exception occurs */ public Stream getAccessRequestsStream(Object projectIdOrPath) throws GitLabApiException { - return (getAccessRequests(projectIdOrPath, getDefaultPerPage()).stream()); + return (getAccessRequests(projectIdOrPath, getDefaultPerPage()).stream()); } /** @@ -3338,7 +3364,7 @@ public Stream getAccessRequestsStream(Object projectIdOrPath) thr * @throws GitLabApiException if any exception occurs */ public AccessRequest requestAccess(Object projectIdOrPath) throws GitLabApiException { - Response response = post(Response.Status.CREATED, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "access_requests"); + Response response = post(Response.Status.CREATED, (Form) null, "projects", getProjectIdOrPath(projectIdOrPath), "access_requests"); return (response.readEntity(AccessRequest.class)); } @@ -3348,15 +3374,15 @@ public AccessRequest requestAccess(Object projectIdOrPath) throws GitLabApiExcep *
GitLab Endpoint: PUT /projects/:id/access_requests/:user_id/approve
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID to approve access for - * @param accessLevel the access level the user is approved for, if null will be developer (30) + * @param userId the user ID to approve access for + * @param accessLevel the access level the user is approved for, if null will be developer (30) * @return the approved AccessRequest instance * @throws GitLabApiException if any exception occurs */ public AccessRequest approveAccessRequest(Object projectIdOrPath, Long userId, AccessLevel accessLevel) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("access_level", accessLevel); Response response = this.putWithFormData(Response.Status.CREATED, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId, "approve"); + "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId, "approve"); return (response.readEntity(AccessRequest.class)); } @@ -3366,12 +3392,12 @@ public AccessRequest approveAccessRequest(Object projectIdOrPath, Long userId, A *
GitLab Endpoint: DELETE /projects/:id/access_requests/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID to deny access for + * @param userId the user ID to deny access for * @throws GitLabApiException if any exception occurs */ public void denyAccessRequest(Object projectIdOrPath, Long userId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, - "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId); + "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId); } /** @@ -3396,7 +3422,7 @@ public void triggerHousekeeping(Object projectIdOrPath) throws GitLabApiExceptio * @throws GitLabApiException if any exception occurs */ public List getBadges(Object projectIdOrPath) throws GitLabApiException { - return getBadges(projectIdOrPath, null); + return getBadges(projectIdOrPath, null); } /** @@ -3405,14 +3431,15 @@ public List getBadges(Object projectIdOrPath) throws GitLabApiException { *
GitLab Endpoint: GET /projects/:id/badges?name=:name
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param bagdeName The name to filter on (case-sensitive), ignored if null. + * @param bagdeName The name to filter on (case-sensitive), ignored if null. * @return All badges of the GitLab item, case insensitively filtered on name. * @throws GitLabApiException If any problem is encountered */ public List getBadges(Object projectIdOrPath, String bagdeName) throws GitLabApiException { - Form queryParam = new GitLabApiForm().withParam("name", bagdeName); - Response response = get(Response.Status.OK, queryParam.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges"); - return (response.readEntity(new GenericType>() {})); + Form queryParam = new GitLabApiForm().withParam("name", bagdeName); + Response response = get(Response.Status.OK, queryParam.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges"); + return (response.readEntity(new GenericType>() { + })); } /** @@ -3421,13 +3448,13 @@ public List getBadges(Object projectIdOrPath, String bagdeName) throws Gi *
GitLab Endpoint: GET /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get + * @param badgeId the ID of the badge to get * @return a Badge instance for the specified project/badge ID pair * @throws GitLabApiException if any exception occurs */ public Badge getBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiException { - Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); - return (response.readEntity(Badge.class)); + Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); + return (response.readEntity(Badge.class)); } /** @@ -3436,15 +3463,15 @@ public Badge getBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get + * @param badgeId the ID of the badge to get * @return an Optional instance with the specified badge as the value */ public Optional getOptionalBadge(Object projectIdOrPath, Long badgeId) { - try { - return (Optional.ofNullable(getBadge(projectIdOrPath, badgeId))); - } catch (GitLabApiException glae) { - return (GitLabApi.createOptionalFromException(glae)); - } + try { + return (Optional.ofNullable(getBadge(projectIdOrPath, badgeId))); + } catch (GitLabApiException glae) { + return (GitLabApi.createOptionalFromException(glae)); + } } /** @@ -3453,13 +3480,13 @@ public Optional getOptionalBadge(Object projectIdOrPath, Long badgeId) { *
GitLab Endpoint: POST /projects/:id/badges
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the added badge * @throws GitLabApiException if any exception occurs */ public Badge addBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { - return addBadge(projectIdOrPath, null, linkUrl, imageUrl); + return addBadge(projectIdOrPath, null, linkUrl, imageUrl); } /** @@ -3468,19 +3495,19 @@ public Badge addBadge(Object projectIdOrPath, String linkUrl, String imageUrl) t *
GitLab Endpoint: POST /projects/:id/badges
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param name The name to give the badge (may be null) - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param name The name to give the badge (may be null) + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return A Badge instance for the added badge * @throws GitLabApiException if any exception occurs */ public Badge addBadge(Object projectIdOrPath, String name, String linkUrl, String imageUrl) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, false) - .withParam("link_url", linkUrl, true) - .withParam("image_url", imageUrl, true); - Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "badges"); - return (response.readEntity(Badge.class)); + GitLabApiForm formData = new GitLabApiForm() + .withParam("name", name, false) + .withParam("link_url", linkUrl, true) + .withParam("image_url", imageUrl, true); + Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "badges"); + return (response.readEntity(Badge.class)); } /** @@ -3489,14 +3516,14 @@ public Badge addBadge(Object projectIdOrPath, String name, String linkUrl, Strin *
GitLab Endpoint: PUT /projects/:id/badges
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param badgeId the ID of the badge to get + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the editted badge * @throws GitLabApiException if any exception occurs */ public Badge editBadge(Object projectIdOrPath, Long badgeId, String linkUrl, String imageUrl) throws GitLabApiException { - return (editBadge(projectIdOrPath, badgeId, null, linkUrl, imageUrl)); + return (editBadge(projectIdOrPath, badgeId, null, linkUrl, imageUrl)); } /** @@ -3505,10 +3532,10 @@ public Badge editBadge(Object projectIdOrPath, Long badgeId, String linkUrl, Str *
GitLab Endpoint: PUT /projects/:id/badges
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to edit - * @param name The name of the badge to edit (may be null) - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param badgeId the ID of the badge to edit + * @param name The name of the badge to edit (may be null) + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the editted badge * @throws GitLabApiException if any exception occurs */ @@ -3527,11 +3554,11 @@ public Badge editBadge(Object projectIdOrPath, Long badgeId, String name, String *
GitLab Endpoint: DELETE /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to remove + * @param badgeId the ID of the badge to remove * @throws GitLabApiException if any exception occurs */ public void removeBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiException { - delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); + delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); } /** @@ -3540,17 +3567,17 @@ public void removeBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiEx *
GitLab Endpoint: GET /projects/:id/badges/render
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the rendered badge * @throws GitLabApiException if any exception occurs */ - public Badge previewBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("link_url", linkUrl, true) - .withParam("image_url", imageUrl, true); - Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges", "render"); - return (response.readEntity(Badge.class)); + public Badge previewBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { + GitLabApiForm formData = new GitLabApiForm() + .withParam("link_url", linkUrl, true) + .withParam("image_url", imageUrl, true); + Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges", "render"); + return (response.readEntity(Badge.class)); } /** @@ -3575,12 +3602,12 @@ public ProjectApprovalsConfig getApprovalsConfiguration(Object projectIdOrPath) *
GitLab Endpoint: POST /projects/:id/approvals
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param config a ProjectApprovalsConfig instance with the approval configuration + * @param config a ProjectApprovalsConfig instance with the approval configuration * @return a ProjectApprovalsConfig instance with the project's approvals configuration * @throws GitLabApiException if any exception occurs */ public ProjectApprovalsConfig setApprovalsConfiguration(Object projectIdOrPath, ProjectApprovalsConfig config) throws GitLabApiException { - GitLabApiForm formData = config.getForm(); + GitLabApiForm formData = config.getForm(); Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "approvals"); return (response.readEntity(ProjectApprovalsConfig.class)); } @@ -3606,14 +3633,14 @@ public List getApprovalRules(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/approval_rules
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of ApprovalRule instances that will be fetched per page + * @param itemsPerPage the number of ApprovalRule instances that will be fetched per page * @return a Pager of ApprovalRuke instances for the specified project. * @throws GitLabApiException if any exception occurs */ public Pager getApprovalRules(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { - return (new Pager(this, ApprovalRule.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules")); + return (new Pager(this, ApprovalRule.class, itemsPerPage, null, + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules")); } /** @@ -3637,14 +3664,14 @@ public Stream getApprovalRulesStream(Object projectIdOrPath) throw *
GitLab Endpoint: POST /projects/:id/approval_rules
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param params the ApprovalRuleParams instance holding the parameters for the approval rule + * @param params the ApprovalRuleParams instance holding the parameters for the approval rule * @return a ApprovalRule instance with approval configuration * @throws GitLabApiException if any exception occurs */ public ApprovalRule createApprovalRule(Object projectIdOrPath, ApprovalRuleParams params) throws GitLabApiException { GitLabApiForm formData = params.getForm(); Response response = post(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules"); + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules"); return (response.readEntity(ApprovalRule.class)); } @@ -3655,8 +3682,8 @@ public ApprovalRule createApprovalRule(Object projectIdOrPath, ApprovalRuleParam *
GitLab Endpoint: PUT /projects/:id/approval_rules/:approval_rule_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param approvalRuleId the ID of the approval rule - * @param params the ApprovalRuleParams instance holding the parameters for the approval rule update + * @param approvalRuleId the ID of the approval rule + * @param params the ApprovalRuleParams instance holding the parameters for the approval rule update * @return a ApprovalRule instance with approval configuration * @throws GitLabApiException if any exception occurs */ @@ -3668,7 +3695,7 @@ public ApprovalRule updateApprovalRule(Object projectIdOrPath, Long approvalRule GitLabApiForm formData = params.getForm(); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules", approvalRuleId); + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules", approvalRuleId); return (response.readEntity(ApprovalRule.class)); } @@ -3679,7 +3706,7 @@ public ApprovalRule updateApprovalRule(Object projectIdOrPath, Long approvalRule *
GitLab Endpoint: DELETE /projects/:id/approval_rules/:approval_rule_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param approvalRuleId the ID of the approval rule + * @param approvalRuleId the ID of the approval rule * @throws GitLabApiException if any exception occurs */ public void deleteApprovalRule(Object projectIdOrPath, Long approvalRuleId) throws GitLabApiException { @@ -3710,13 +3737,13 @@ public List getCustomAttributes(final Object projectIdOrPath) t *
GitLab Endpoint: GET /projects/:id/custom_attributes
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of items per page + * @param itemsPerPage the number of items per page * @return a Pager of project's custom attributes * @throws GitLabApiException if any exception occurs */ public Pager getCustomAttributes(final Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager(this, CustomAttribute.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes")); + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes")); } /** @@ -3738,13 +3765,13 @@ public Stream getCustomAttributesStream(final Object projectIdO *
GitLab Endpoint: GET /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key for the custom attribute + * @param key the key for the custom attribute * @return a CustomAttribute instance for the specified key * @throws GitLabApiException if any exception occurs */ public CustomAttribute getCustomAttribute(final Object projectIdOrPath, final String key) throws GitLabApiException { - Response response = get(Response.Status.OK, null, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); + Response response = get(Response.Status.OK, null, + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); } @@ -3754,7 +3781,7 @@ public CustomAttribute getCustomAttribute(final Object projectIdOrPath, final St *
GitLab Endpoint: GET /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key for the custom attribute, required + * @param key the key for the custom attribute, required * @return an Optional instance with the value for a single custom attribute for the specified project */ public Optional geOptionalCustomAttribute(final Object projectIdOrPath, final String key) { @@ -3772,8 +3799,8 @@ public Optional geOptionalCustomAttribute(final Object projectI *
GitLab Endpoint: PUT /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key for the custom attribute - * @param value the value for the customAttribute + * @param key the key for the custom attribute + * @param value the value for the customAttribute * @return a CustomAttribute instance for the updated or created custom attribute * @throws GitLabApiException if any exception occurs */ @@ -3788,7 +3815,7 @@ public CustomAttribute setCustomAttribute(final Object projectIdOrPath, final St GitLabApiForm formData = new GitLabApiForm().withParam("value", value); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); } @@ -3798,7 +3825,7 @@ public CustomAttribute setCustomAttribute(final Object projectIdOrPath, final St *
GitLab Endpoint: DELETE /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key of the custom attribute to delete + * @param key the key of the custom attribute to delete * @throws GitLabApiException if any exception occurs */ public void deleteCustomAttribute(final Object projectIdOrPath, final String key) throws GitLabApiException { @@ -3829,13 +3856,13 @@ public List getRemoteMirrors(final Object projectIdOrPath) throws *
GitLab Endpoint: GET /projects/:id/remote_mirrors
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of items per page + * @param itemsPerPage the number of items per page * @return a Pager of project's remote mirrors * @throws GitLabApiException if any exception occurs */ public Pager getRemoteMirrors(final Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager(this, RemoteMirror.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors")); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors")); } /** @@ -3857,23 +3884,23 @@ public Stream getRemoteMirrorsStream(final Object projectIdOrPath) * *
GitLab Endpoint: POST /projects/:id/remote_mirrors
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param url the URL of the remote repository to be mirrored - * @param enabled determines if the mirror is enabled + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param url the URL of the remote repository to be mirrored + * @param enabled determines if the mirror is enabled * @param onlyProtectedBranches determines if only protected branches are mirrored - * @param keepDivergentRefs determines if divergent refs are skipped + * @param keepDivergentRefs determines if divergent refs are skipped * @return a RemoteMirror instance with remote mirror configuration * @throws GitLabApiException if any exception occurs */ public RemoteMirror createRemoteMirror(Object projectIdOrPath, String url, Boolean enabled, - Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { + Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url, true) - .withParam("enabled", enabled) - .withParam("only_protected_branches", onlyProtectedBranches) - .withParam("keep_divergent_refs", keepDivergentRefs); + .withParam("url", url, true) + .withParam("enabled", enabled) + .withParam("only_protected_branches", onlyProtectedBranches) + .withParam("keep_divergent_refs", keepDivergentRefs); Response response = post(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors"); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors"); return (response.readEntity(RemoteMirror.class)); } @@ -3882,23 +3909,23 @@ public RemoteMirror createRemoteMirror(Object projectIdOrPath, String url, Boole * *
GitLab Endpoint: PUT /projects/:id/remote_mirrors/:mirror_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param mirrorId the ID of the remote mirror - * @param enabled determines if the mirror is enabled + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param mirrorId the ID of the remote mirror + * @param enabled determines if the mirror is enabled * @param onlyProtectedBranches determines if only protected branches are mirrored - * @param keepDivergentRefs determines if divergent refs are skipped + * @param keepDivergentRefs determines if divergent refs are skipped * @return a RemoteMirror instance with the updated remote mirror configuration * @throws GitLabApiException if any exception occurs */ public RemoteMirror updateRemoteMirror(Object projectIdOrPath, Long mirrorId, Boolean enabled, - Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { + Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("enabled", enabled) - .withParam("only_protected_branches", onlyProtectedBranches) - .withParam("keep_divergent_refs", keepDivergentRefs); + GitLabApiForm formData = new GitLabApiForm() + .withParam("enabled", enabled) + .withParam("only_protected_branches", onlyProtectedBranches) + .withParam("keep_divergent_refs", keepDivergentRefs); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors", mirrorId); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors", mirrorId); return (response.readEntity(RemoteMirror.class)); } } diff --git a/src/main/java/org/gitlab4j/api/TopicApi.java b/src/main/java/org/gitlab4j/api/TopicApi.java new file mode 100644 index 000000000..c6f884c45 --- /dev/null +++ b/src/main/java/org/gitlab4j/api/TopicApi.java @@ -0,0 +1,166 @@ +package org.gitlab4j.api; + +import org.gitlab4j.api.models.Topic; +import org.gitlab4j.api.models.TopicParams; +import org.gitlab4j.api.models.User; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.File; +import java.util.List; +import java.util.Optional; +import java.util.stream.Stream; + +public class TopicApi extends AbstractApi{ + + public TopicApi(GitLabApi gitLabApi) { + super(gitLabApi); + } + + /** + *

Get a list of Topics.

+ * + * WARNING: Do not use this method to fetch Topics from https://gitlab.com, + * gitlab.com has many 1,000's of public topics and it will a long time to fetch all of them. + * Instead use {@link #getTopics(int itemsPerPage)} which will return a Pager of Topic instances. + * + *
GitLab Endpoint: GET /topics
+ * + * @return the list of topics viewable by the authenticated user + * @throws GitLabApiException if any exception occurs + */ + public List getTopics() throws GitLabApiException { + + return (getTopics(getDefaultPerPage()).all()); + } + + /** + * Get a list of topics (As user: my , as admin: all groups) and in the specified page range. + * + *
GitLab Endpoint: GET /topics
+ * + * @param page the page to get + * @param perPage the number of Group instances per page + * @return the list of groups viewable by the authenticated userin the specified page range + * @throws GitLabApiException if any exception occurs + */ + public List getTopics(int page, int perPage) throws GitLabApiException { + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "topics"); + return (response.readEntity(new GenericType>() {})); + } + + /** + * Get a Pager of groups. (As user: my groups, as admin: all groups) + * + *
GitLab Endpoint: GET /topics
+ * + * @param itemsPerPage the number of Group instances that will be fetched per page + * @return the list of groups viewable by the authenticated user + * @throws GitLabApiException if any exception occurs + */ + public Pager getTopics(int itemsPerPage) throws GitLabApiException { + return (new Pager(this, Topic.class, itemsPerPage, null, "topics")); + } + + /** + * Get a Stream of groups. (As user: my groups, as admin: all groups) + * + *
GitLab Endpoint: GET /topics
+ * + * @return a Stream of groups viewable by the authenticated user + * @throws GitLabApiException if any exception occurs + */ + public Stream getGroupsStream() throws GitLabApiException { + return (getTopics(getDefaultPerPage()).stream()); + } + + /** + * Get all details of a group. + * + *
GitLab Endpoint: GET /topics/:id
+ * + * @param id the group ID, path of the group, or a Group instance holding the group ID or path + * @return the Group instance for the specified group path + * @throws GitLabApiException if any exception occurs + */ + public Topic getTopic(Integer id) throws GitLabApiException { + Response response = get(Response.Status.OK, null, "topics", id); + return (response.readEntity(Topic.class)); + } + + /** + * Get all details of a group as an Optional instance. + * + *
GitLab Endpoint: GET /topics/:id
+ * + * @param id the topic ID + * @return the Topic for the specified topic id as an Optional instance + */ + public Optional getOptionalGroup(Integer id) { + try { + return (Optional.ofNullable(getTopic(id))); + } catch (GitLabApiException glae) { + return (GitLabApi.createOptionalFromException(glae)); + } + } + + /** + * Creates a new Topic. Available only for users who can create topics. + * + *
GitLab Endpoint: POST /topics
+ * + * @param params a TopicParams instance holding the parameters for the topic creation + * @return the created Group instance + * @throws GitLabApiException if any exception occurs + */ + public Topic createTopic(TopicParams params) throws GitLabApiException { + Response response = post(Response.Status.CREATED, params.getForm(true), "topics"); + return (response.readEntity(Topic.class)); + } + + /** + * Updates the project group. Only available to group owners and administrators. + * + *
GitLab Endpoint: PUT /groups
+ * + * @param id the topic I + * @param params a TopicParams instance holding the properties to Update + * @return updated Group instance + * @throws GitLabApiException at any exception + */ + public Topic updateTopic(Integer id, TopicParams params) throws GitLabApiException { + Response response = putWithFormData(Response.Status.OK, + params.getForm(false), "topics", id); + return (response.readEntity(Topic.class)); + } + /** + * Uploads and sets the topic's avatar for the specified topic. + * + *
PUT /topics/:id
+ * + * @param id the topic in the form of an Integer + * @param avatarFile the File instance of the avatar file to upload + * @return the updated Topic instance + * @throws GitLabApiException if any exception occurs + */ + public Topic setTopicAvatar(final Integer id, File avatarFile) throws GitLabApiException { + Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "topics", id); + return (response.readEntity(Topic.class)); + } + + public void deleteTopic(Integer id) throws GitLabApiException { + if(isApiVersion(GitLabApi.ApiVersion.V3)){ + throw new GitLabApiException("Topics need api v4+"); + } + delete(Response.Status.NO_CONTENT,null, "topics", id); + } + + + + public Topic mergeTopics(Integer sourceTopicId, Integer targetTopicId) throws GitLabApiException { + Response response = post(Response.Status.OK,new GitLabApiForm().withParam("source_topic_id",sourceTopicId).withParam("target_topic_id",targetTopicId),"topics/merge"); + return (response.readEntity(Topic.class)); + } + + +} diff --git a/src/main/java/org/gitlab4j/api/models/Project.java b/src/main/java/org/gitlab4j/api/models/Project.java index 4533ca9c1..55c9f5748 100644 --- a/src/main/java/org/gitlab4j/api/models/Project.java +++ b/src/main/java/org/gitlab4j/api/models/Project.java @@ -80,7 +80,9 @@ public String toString() { private Boolean snippetsEnabled; private String sshUrlToRepo; private Integer starCount; + private List tagList; + private List topics; private Integer visibilityLevel; private Visibility visibility; private Boolean wallEnabled; @@ -542,19 +544,44 @@ public void setStarCount(Integer starCount) { this.starCount = starCount; } + /** + * Tags will be removed in API v5 + */ + @Deprecated public List getTagList() { return tagList; } + /** + * Tags will be removed in API v5 + */ + @Deprecated public void setTagList(List tagList) { this.tagList = tagList; } + /** + * Tags will be removed in API v5 + */ + @Deprecated public Project withTagList(List tagList) { this.tagList = tagList; return (this); } + public List getTopics() { + return topics; + } + + public void setTopics(List topics) { + this.topics = topics; + } + + public Project withTopics(List topics) { + this.topics = topics; + return (this); + } + public Visibility getVisibility() { return visibility; } @@ -733,7 +760,7 @@ public String toString() { * Formats a fully qualified project path based on the provided namespace and project path. * * @param namespace the namespace, either a user name or group name - * @param path the project path + * @param path the project path * @return a fully qualified project path based on the provided namespace and project path */ public static final String getPathWithNammespace(String namespace, String path) { diff --git a/src/main/java/org/gitlab4j/api/models/Topic.java b/src/main/java/org/gitlab4j/api/models/Topic.java new file mode 100644 index 000000000..d0d686c9f --- /dev/null +++ b/src/main/java/org/gitlab4j/api/models/Topic.java @@ -0,0 +1,71 @@ +package org.gitlab4j.api.models; + +import org.gitlab4j.api.utils.JacksonJson; + +public class Topic { + + private Integer id; + + private String name; + + private String title; + + private String description; + + private int total_projects_count; + + private String avatar_url; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getTotal_projects_count() { + return total_projects_count; + } + + public void setTotal_projects_count(int total_projects_count) { + this.total_projects_count = total_projects_count; + } + + public String getAvatar_url() { + return avatar_url; + } + + public void setAvatar_url(String avatar_url) { + this.avatar_url = avatar_url; + } + + @Override + public String toString() { + return (JacksonJson.toJsonString(this)); + } +} diff --git a/src/main/java/org/gitlab4j/api/models/TopicParams.java b/src/main/java/org/gitlab4j/api/models/TopicParams.java new file mode 100644 index 000000000..2c086a3cd --- /dev/null +++ b/src/main/java/org/gitlab4j/api/models/TopicParams.java @@ -0,0 +1,55 @@ +package org.gitlab4j.api.models; + +import org.gitlab4j.api.GitLabApiForm; + +import java.io.File; + +/** + * This class is utilized by the {@link org.gitlab4j.api.TopicApi#createTopic(TopicParams)} + * and {@link org.gitlab4j.api.TopicApi#updateTopic(Integer, TopicParams)} methods to set + * the parameters for the call to the GitLab API. + * + * Avatar Upload has its own Upload in {@link org.gitlab4j.api.TopicApi#setTopicAvatar(Integer,File)} + */ +public class TopicParams { + + private String name; + private String title; + private String description; + + + + public TopicParams withName(String name) { + this.name = name; + return (this); + } + + public TopicParams withTitle(String title) { + this.title = title; + return (this); + } + + public TopicParams withDescription(String description) { + this.description = description; + return (this); + } + + + + /** + * Get the form params for a group create oir update call. + * + * @param isCreate set to true for a create group call, false for update + * @return a GitLabApiForm instance holding the parameters for the group create or update operation + * @throws RuntimeException if required parameters are missing + */ + public GitLabApiForm getForm(boolean isCreate) { + + GitLabApiForm form = new GitLabApiForm() + .withParam("name", name, isCreate) + .withParam("title", title, isCreate) + .withParam("description", description); + + return (form); + } +} diff --git a/src/test/java/org/gitlab4j/api/TestProjectApi.java b/src/test/java/org/gitlab4j/api/TestProjectApi.java index 43dfcc3a5..feadd5e4d 100644 --- a/src/test/java/org/gitlab4j/api/TestProjectApi.java +++ b/src/test/java/org/gitlab4j/api/TestProjectApi.java @@ -310,7 +310,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithParams() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true,null,null); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -336,7 +336,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithStatistics() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, null, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, false, false, false, false, true); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, false, false, false, false, true,null,null); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -353,7 +353,7 @@ public void testListProjectsWithStatistics() throws GitLabApiException { public void testListProjectsWithParamsViaPager() throws GitLabApiException { Pager pager = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, 10); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, null,null,10); assertNotNull(pager); assertTrue(pager.getTotalItems() >= 2); @@ -379,7 +379,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithParamByPage() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, 1, 10); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true,null,null, 1, 10); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -434,7 +434,7 @@ public void testListStarredProjectsWithParams() throws GitLabApiException { } List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, TEST_PROJECT_NAME, true, true, true, true, true); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, TEST_PROJECT_NAME, true, true, true, true, true,null,null); try { gitLabApi.getProjectApi().unstarProject(testProject); From a844abde427528c9834932593a9ce88806808ebd Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Mon, 31 Jul 2023 14:02:34 +0200 Subject: [PATCH 3/9] Minor Changes for the TopicsApi --- src/main/java/org/gitlab4j/api/GitLabApi.java | 22 ++++++++++++++++++- .../api/{TopicApi.java => TopicsApi.java} | 5 ++--- .../org/gitlab4j/api/models/TopicParams.java | 7 +++--- 3 files changed, 27 insertions(+), 7 deletions(-) rename src/main/java/org/gitlab4j/api/{TopicApi.java => TopicsApi.java} (98%) diff --git a/src/main/java/org/gitlab4j/api/GitLabApi.java b/src/main/java/org/gitlab4j/api/GitLabApi.java index c03defb7b..17ffc22c3 100644 --- a/src/main/java/org/gitlab4j/api/GitLabApi.java +++ b/src/main/java/org/gitlab4j/api/GitLabApi.java @@ -96,6 +96,7 @@ public String getApiNamespace() { private SystemHooksApi systemHooksApi; private TagsApi tagsApi; private TodosApi todosApi; + private TopicsApi topicsApi; private UserApi userApi; private WikisApi wikisApi; private KeysApi keysApi; @@ -1463,7 +1464,7 @@ public ReleaseLinksApi getReleaseLinksApi() { return releaseLinksApi; } - + /** * Gets the ReleasesApi instance owned by this GitLabApi instance. The ReleasesApi is used * to perform all release related API calls. @@ -1654,6 +1655,25 @@ public TagsApi getTagsApi() { return (tagsApi); } + /** + * Gets the TagsApi instance owned by this GitLabApi instance. The TagsApi is used + * to perform all tag and release related API calls. + * + * @return the TagsApi instance owned by this GitLabApi instance + */ + public TopicsApi getTopicsApi() { + + if (topicsApi == null) { + synchronized (this) { + if (topicsApi == null) { + topicsApi = new TopicsApi(this); + } + } + } + + return (topicsApi); + } + /** * Gets the SnippetsApi instance owned by this GitLabApi instance. The SnippetsApi is used * to perform all snippet related API calls. diff --git a/src/main/java/org/gitlab4j/api/TopicApi.java b/src/main/java/org/gitlab4j/api/TopicsApi.java similarity index 98% rename from src/main/java/org/gitlab4j/api/TopicApi.java rename to src/main/java/org/gitlab4j/api/TopicsApi.java index c6f884c45..721dcadb6 100644 --- a/src/main/java/org/gitlab4j/api/TopicApi.java +++ b/src/main/java/org/gitlab4j/api/TopicsApi.java @@ -2,7 +2,6 @@ import org.gitlab4j.api.models.Topic; import org.gitlab4j.api.models.TopicParams; -import org.gitlab4j.api.models.User; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; @@ -11,9 +10,9 @@ import java.util.Optional; import java.util.stream.Stream; -public class TopicApi extends AbstractApi{ +public class TopicsApi extends AbstractApi{ - public TopicApi(GitLabApi gitLabApi) { + public TopicsApi(GitLabApi gitLabApi) { super(gitLabApi); } diff --git a/src/main/java/org/gitlab4j/api/models/TopicParams.java b/src/main/java/org/gitlab4j/api/models/TopicParams.java index 2c086a3cd..2045c2804 100644 --- a/src/main/java/org/gitlab4j/api/models/TopicParams.java +++ b/src/main/java/org/gitlab4j/api/models/TopicParams.java @@ -1,15 +1,16 @@ package org.gitlab4j.api.models; import org.gitlab4j.api.GitLabApiForm; +import org.gitlab4j.api.TopicsApi; import java.io.File; /** - * This class is utilized by the {@link org.gitlab4j.api.TopicApi#createTopic(TopicParams)} - * and {@link org.gitlab4j.api.TopicApi#updateTopic(Integer, TopicParams)} methods to set + * This class is utilized by the {@link TopicsApi#createTopic(TopicParams)} + * and {@link TopicsApi#updateTopic(Integer, TopicParams)} methods to set * the parameters for the call to the GitLab API. * - * Avatar Upload has its own Upload in {@link org.gitlab4j.api.TopicApi#setTopicAvatar(Integer,File)} + * Avatar Upload has its own Upload in {@link TopicsApi#setTopicAvatar(Integer,File)} */ public class TopicParams { From 90cc9144e878f2f499e76558c65b55d4d2ffbd2a Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Mon, 31 Jul 2023 15:32:08 +0200 Subject: [PATCH 4/9] Renamed TopicsApi.setTopicAvatar to TopicsApi.updateTopicAvatar. --- src/main/java/org/gitlab4j/api/TopicsApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab4j/api/TopicsApi.java b/src/main/java/org/gitlab4j/api/TopicsApi.java index 721dcadb6..e85448291 100644 --- a/src/main/java/org/gitlab4j/api/TopicsApi.java +++ b/src/main/java/org/gitlab4j/api/TopicsApi.java @@ -142,7 +142,7 @@ public Topic updateTopic(Integer id, TopicParams params) throws GitLabApiExcepti * @return the updated Topic instance * @throws GitLabApiException if any exception occurs */ - public Topic setTopicAvatar(final Integer id, File avatarFile) throws GitLabApiException { + public Topic updateTopicAvatar(final Integer id, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "topics", id); return (response.readEntity(Topic.class)); } From f63fef97ee31305359bfa945de0e7e3f80ae660a Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Wed, 2 Aug 2023 15:40:20 +0200 Subject: [PATCH 5/9] Removed Topic and TopicID from existing Methods to mantain backwards compatibility. Added 'topic', 'topic_id' and 'imported'(Missing) to ProjectFilter instead. --- .../java/org/gitlab4j/api/ProjectApi.java | 1161 ++++++++--------- .../gitlab4j/api/models/ProjectFilter.java | 39 + .../java/org/gitlab4j/api/TestProjectApi.java | 10 +- 3 files changed, 611 insertions(+), 599 deletions(-) diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 068abed65..848f6bdca 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -37,7 +37,6 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; - import org.gitlab4j.api.GitLabApi.ApiVersion; import org.gitlab4j.api.models.AccessLevel; import org.gitlab4j.api.models.AccessRequest; @@ -132,13 +131,13 @@ public Optional getOptionalProjectStatistics(Object projectIdOrP */ public List getProjects() throws GitLabApiException { - String url = this.gitLabApi.getGitLabServerUrl(); - if (url.startsWith("https://gitlab.com")) { - GitLabApi.getLogger().warning("Fetching all projects from " + url + - " may take many hours to complete, use Pager getProjects(int) instead."); - } + String url = this.gitLabApi.getGitLabServerUrl(); + if (url.startsWith("https://gitlab.com")) { + GitLabApi.getLogger().warning("Fetching all projects from " + url + + " may take many hours to complete, use Pager getProjects(int) instead."); + } - return (getProjects(getDefaultPerPage()).all()); + return (getProjects(getDefaultPerPage()).all()); } /** @@ -146,15 +145,14 @@ public List getProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user * @throws GitLabApiException if any exception occurs */ public List getProjects(int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() { })); } /** @@ -179,7 +177,7 @@ public Pager getProjects(int itemsPerPage) throws GitLabApiException { * @throws GitLabApiException if any exception occurs */ public Stream getProjectsStream() throws GitLabApiException { - return (getProjects(getDefaultPerPage()).stream()); + return (getProjects(getDefaultPerPage()).stream()); } /** @@ -188,30 +186,30 @@ public Stream getProjectsStream() throws GitLabApiException { * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields, default is created_at - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields, default is created_at + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link #getProjects(Boolean, Visibility, - * Constants.ProjectOrderBy, Constants.SortOrder, String, Boolean, Boolean, Boolean, Boolean, Boolean,String,Integer)} + * @deprecated Will be removed in version 6.0, replaced by {@link #getProjects(Boolean, Visibility, + * Constants.ProjectOrderBy, Constants.SortOrder, String, Boolean, Boolean, Boolean, Boolean, Boolean)} */ @Deprecated public List getProjects(Boolean archived, Visibility visibility, String orderBy, - String sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, String topic, Integer topicId) throws GitLabApiException { + String sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics) throws GitLabApiException { ProjectOrderBy projectOrderBy = ProjectOrderBy.valueOf(orderBy); SortOrder sortOrder = SortOrder.valueOf(sort); return (getProjects(archived, visibility, projectOrderBy, sortOrder, search, simple, - owned, membership, starred, statistics,topic,topicId, getDefaultPerPage()).all()); + owned, membership, starred, statistics, getDefaultPerPage()).all()); } /** @@ -220,26 +218,26 @@ public List getProjects(Boolean archived, Visibility visibility, String * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public List getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, String topic, Integer topicId) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics) throws GitLabApiException { return (getProjects(archived, visibility, orderBy, sort, search, simple, - owned, membership, starred, statistics,topic, topicId, getDefaultPerPage()).all()); + owned, membership, starred, statistics, getDefaultPerPage()).all()); } /** @@ -248,45 +246,42 @@ public List getProjects(Boolean archived, Visibility visibility, Projec * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status + * @param archived limit by archived status * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user + * @param starred limit by projects starred by the current user * @param statistics include project statistics - * @param page the page to get - * @param perPage the number of projects per page + * @param page the page to get + * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public List getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, String topic, Integer topicId, int page, int perPage) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("archived", archived) - .withParam("visibility", visibility) - .withParam("order_by", orderBy) - .withParam("sort", sort) - .withParam("search", search) - .withParam("simple", simple) - .withParam("owned", owned) - .withParam("membership", membership) - .withParam("starred", starred) - .withParam("statistics", statistics) - .withParam("topic", topic) - .withParam("topic_id", topicId) - .withParam(PAGE_PARAM, page) - .withParam(PER_PAGE_PARAM, perPage); + .withParam("archived", archived) + .withParam("visibility", visibility) + .withParam("order_by", orderBy) + .withParam("sort", sort) + .withParam("search", search) + .withParam("simple", simple) + .withParam("owned", owned) + .withParam("membership", membership) + .withParam("starred", starred) + .withParam("statistics", statistics) + .withParam(PAGE_PARAM, page) + .withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -295,38 +290,36 @@ public List getProjects(Boolean archived, Visibility visibility, Projec * *
GitLab Endpoint: GET /projects
* - * @param archived limit by archived status - * @param visibility limit by visibility public, internal, or private - * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or - * LAST_ACTIVITY_AT fields, default is CREATED_AT - * @param sort return projects sorted in asc or desc order. Default is desc - * @param search return list of projects matching the search criteria - * @param simple return only the ID, URL, name, and path of each project - * @param owned limit by projects owned by the current user - * @param membership limit by projects that the current user is a member of - * @param starred limit by projects starred by the current user - * @param statistics include project statistics + * @param archived limit by archived status + * @param visibility limit by visibility public, internal, or private + * @param orderBy return projects ordered by ID, NAME, PATH, CREATED_AT, UPDATED_AT, or + * LAST_ACTIVITY_AT fields, default is CREATED_AT + * @param sort return projects sorted in asc or desc order. Default is desc + * @param search return list of projects matching the search criteria + * @param simple return only the ID, URL, name, and path of each project + * @param owned limit by projects owned by the current user + * @param membership limit by projects that the current user is a member of + * @param starred limit by projects starred by the current user + * @param statistics include project statistics * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects accessible by the authenticated user and matching the supplied parameters * @throws GitLabApiException if any exception occurs */ public Pager getProjects(Boolean archived, Visibility visibility, ProjectOrderBy orderBy, - SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, - Boolean starred, Boolean statistics, String topic, Integer topicId, int itemsPerPage) throws GitLabApiException { + SortOrder sort, String search, Boolean simple, Boolean owned, Boolean membership, + Boolean starred, Boolean statistics, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("archived", archived) - .withParam("visibility", visibility) - .withParam("order_by", orderBy) - .withParam("sort", sort) - .withParam("search", search) - .withParam("simple", simple) - .withParam("owned", owned) - .withParam("membership", membership) - .withParam("starred", starred) - .withParam("statistics", statistics) - .withParam("topic", topic) - .withParam("topic_id", topicId); + .withParam("archived", archived) + .withParam("visibility", visibility) + .withParam("order_by", orderBy) + .withParam("sort", sort) + .withParam("search", search) + .withParam("simple", simple) + .withParam("owned", owned) + .withParam("membership", membership) + .withParam("starred", starred) + .withParam("statistics", statistics); return (new Pager(this, Project.class, itemsPerPage, formData.asMap(), "projects")); } @@ -349,17 +342,16 @@ public List getProjects(String search) throws GitLabApiException { * *
GitLab Endpoint: GET /projects?search=search
* - * @param search the project name search criteria - * @param page the page to get + * @param search the project name search criteria + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects accessible by the authenticated user that match the provided search string * @throws GitLabApiException if any exception occurs */ public List getProjects(String search, int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("search", search).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("search", search).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -367,7 +359,7 @@ public List getProjects(String search, int page, int perPage) throws Gi * *
GitLab Endpoint: GET /projects?search=search
* - * @param search the project name search criteria + * @param search the project name search criteria * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects accessible by the authenticated user that match the provided search string * @throws GitLabApiException if any exception occurs @@ -407,16 +399,15 @@ public List getMemberProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?membership=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects that the authenticated user is a member of * @throws GitLabApiException if any exception occurs */ public List getMemberProjects(int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("membership", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("membership", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -462,16 +453,15 @@ public List getOwnedProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?owned=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects owned by the authenticated user * @throws GitLabApiException if any exception occurs */ public List getOwnedProjects(int page, int perPage) throws GitLabApiException { - Form formData = new GitLabApiForm().withParam("owned", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); + Form formData = new GitLabApiForm().withParam("owned", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -517,7 +507,7 @@ public List getStarredProjects() throws GitLabApiException { * *
GitLab Endpoint: GET /projects?starred=true
* - * @param page the page to get + * @param page the page to get * @param perPage the number of projects per page * @return a list of projects starred by the authenticated user * @throws GitLabApiException if any exception occurs @@ -525,8 +515,7 @@ public List getStarredProjects() throws GitLabApiException { public List getStarredProjects(int page, int perPage) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("starred", true).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -574,8 +563,8 @@ public List getProjects(ProjectFilter filter) throws GitLabApiException * *
GitLab Endpoint: GET /projects
* - * @param filter the ProjectFilter instance holding the filter values for the query - * @param page the page to get + * @param filter the ProjectFilter instance holding the filter values for the query + * @param page the page to get * @param perPage the number of projects per page * @return a list of all visible projects across GitLab for the authenticated use * @throws GitLabApiException if any exception occurs @@ -583,8 +572,7 @@ public List getProjects(ProjectFilter filter) throws GitLabApiException public List getProjects(ProjectFilter filter, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(page, perPage); Response response = get(Response.Status.OK, formData.asMap(), "projects"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -592,7 +580,7 @@ public List getProjects(ProjectFilter filter, int page, int perPage) th * *
GitLab Endpoint: GET /projects
* - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of all visible projects across GitLab for the authenticated use * @throws GitLabApiException if any exception occurs @@ -621,7 +609,7 @@ public Stream getProjectsStream(ProjectFilter filter) throws GitLabApiE *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @return a list of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ @@ -635,18 +623,17 @@ public List getUserProjects(Object userIdOrUsername, ProjectFilter filt *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query - * @param page the page to get - * @param perPage the number of projects per page + * @param filter the ProjectFilter instance holding the filter values for the query + * @param page the page to get + * @param perPage the number of projects per page * @return a list of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ public List getUserProjects(Object userIdOrUsername, ProjectFilter filter, int page, int perPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(page, perPage); Response response = get(Response.Status.OK, formData.asMap(), - "users", getUserIdOrUsername(userIdOrUsername), "projects"); - return (response.readEntity(new GenericType>() { - })); + "users", getUserIdOrUsername(userIdOrUsername), "projects"); + return (response.readEntity(new GenericType>() {})); } /** @@ -655,15 +642,15 @@ public List getUserProjects(Object userIdOrUsername, ProjectFilter filt *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param filter the ProjectFilter instance holding the filter values for the query + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ public Pager getUserProjects(Object userIdOrUsername, ProjectFilter filter, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = filter.getQueryParams(); return (new Pager(this, Project.class, itemsPerPage, formData.asMap(), - "users", getUserIdOrUsername(userIdOrUsername), "projects")); + "users", getUserIdOrUsername(userIdOrUsername), "projects")); } /** @@ -672,7 +659,7 @@ public Pager getUserProjects(Object userIdOrUsername, ProjectFilter fil *
GitLab Endpoint: GET /users/:user_id/projects
* * @param userIdOrUsername the user ID, username of the user, or a User instance holding the user ID or username - * @param filter the ProjectFilter instance holding the filter values for the query + * @param filter the ProjectFilter instance holding the filter values for the query * @return a Stream of visible projects owned by the given user * @throws GitLabApiException if any exception occurs */ @@ -690,7 +677,7 @@ public Stream getUserProjectsStream(Object userIdOrUsername, ProjectFil * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath) throws GitLabApiException { - return (getProject(projectIdOrPath, null, null, null)); + return (getProject(projectIdOrPath, null, null, null)); } /** @@ -714,13 +701,13 @@ public Optional getOptionalProject(Object projectIdOrPath) { * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param includeStatistics include project statistics * @return the specified project * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath, Boolean includeStatistics) throws GitLabApiException { - return (getProject(projectIdOrPath, includeStatistics, null, null)); + return (getProject(projectIdOrPath, includeStatistics, null, null)); } /** @@ -728,7 +715,7 @@ public Project getProject(Object projectIdOrPath, Boolean includeStatistics) thr * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param includeStatistics include project statistics * @return an Optional instance with the specified project as a value */ @@ -745,21 +732,21 @@ public Optional getOptionalProject(Object projectIdOrPath, Boolean incl * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param includeStatistics include project statistics - * @param includeLicense include project license data + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param includeStatistics include project statistics + * @param includeLicense include project license data * @param withCustomAttributes include custom attributes in response (admins only) * @return the specified project * @throws GitLabApiException if any exception occurs */ public Project getProject(Object projectIdOrPath, Boolean includeStatistics, - Boolean includeLicense, Boolean withCustomAttributes) throws GitLabApiException { + Boolean includeLicense, Boolean withCustomAttributes) throws GitLabApiException { Form formData = new GitLabApiForm() - .withParam("statistics", includeStatistics) - .withParam("license", includeLicense) - .withParam("with_custom_attributes", withCustomAttributes); + .withParam("statistics", includeStatistics) + .withParam("license", includeLicense) + .withParam("with_custom_attributes", withCustomAttributes); Response response = get(Response.Status.OK, formData.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath)); + "projects", getProjectIdOrPath(projectIdOrPath)); return (response.readEntity(Project.class)); } @@ -768,17 +755,17 @@ public Project getProject(Object projectIdOrPath, Boolean includeStatistics, * *
GitLab Endpoint: GET /projects/:id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param includeStatistics include project statistics - * @param includeLicense include project license data + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param includeStatistics include project statistics + * @param includeLicense include project license data * @param withCustomAttributes include custom attributes in response (admins only) * @return an Optional instance with the specified project as a value */ public Optional getOptionalProject(Object projectIdOrPath, Boolean includeStatistics, - Boolean includeLicense, Boolean withCustomAttributes) { + Boolean includeLicense, Boolean withCustomAttributes) { try { return (Optional.ofNullable(getProject(projectIdOrPath, - includeStatistics, includeLicense, withCustomAttributes))); + includeStatistics, includeLicense, withCustomAttributes))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } @@ -790,7 +777,7 @@ public Optional getOptionalProject(Object projectIdOrPath, Boolean incl *
GitLab Endpoint: GET /projects/:id
* * @param namespace the name of the project namespace or group - * @param project the name of the project to get + * @param project the name of the project to get * @return the specified project * @throws GitLabApiException if any exception occurs */ @@ -821,7 +808,7 @@ public Project getProject(String namespace, String project) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id
* * @param namespace the name of the project namespace or group - * @param project the name of the project + * @param project the name of the project * @return an Optional instance with the specified project as a value */ public Optional getOptionalProject(String namespace, String project) { @@ -837,8 +824,8 @@ public Optional getOptionalProject(String namespace, String project) { * *
GitLab Endpoint: GET /projects/:id
* - * @param namespace the name of the project namespace or group - * @param project the name of the project to get + * @param namespace the name of the project namespace or group + * @param project the name of the project to get * @param includeStatistics include project statistics * @return the specified project * @throws GitLabApiException if any exception occurs @@ -870,8 +857,8 @@ public Project getProject(String namespace, String project, Boolean includeStati * *
GitLab Endpoint: GET /projects/:id
* - * @param namespace the name of the project namespace or group - * @param project the name of the project + * @param namespace the name of the project namespace or group + * @param project the name of the project * @param includeStatistics include project statistics * @return an Optional instance with the specified project as a value */ @@ -901,7 +888,7 @@ public Project createProject(Long namespaceId, String projectName) throws GitLab * Create a new project belonging to the namespace ID and project configuration. A namespace ID is either a user or group ID. * * @param namespaceId the namespace ID to create the project under - * @param project the Project instance holding the new project configuration + * @param project the Project instance holding the new project configuration * @return the created project * @throws GitLabApiException if any exception occurs */ @@ -939,9 +926,9 @@ public Project createProject(String projectName) throws GitLabApiException { */ public Project createProject(String name, String path) throws GitLabApiException { - if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) { - throw new RuntimeException("Either name or path must be specified."); - } + if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) { + throw new RuntimeException("Either name or path must be specified."); + } GitLabApiForm formData = new GitLabApiForm().withParam("name", name).withParam("path", path); Response response = post(Response.Status.CREATED, formData, "projects"); @@ -962,7 +949,7 @@ public Project createProject(Project project) throws GitLabApiException { /** * Creates new project owned by the current user. The following properties on the Project instance * are utilized in the creation of the project: - *

+ * * name (name or path are required) - new project name * path (name or path are required) - new project path * defaultBranch (optional) - master by default @@ -993,7 +980,7 @@ public Project createProject(Project project) throws GitLabApiException { * ciConfigPath (optional) - Set path to CI configuration file * squashOption (optional) - set squash option for merge requests * - * @param project the Project instance with the configuration for the new project + * @param project the Project instance with the configuration for the new project * @param importUrl the URL to import the repository from * @return a Project instance with the newly created project info * @throws GitLabApiException if any exception occurs @@ -1017,7 +1004,7 @@ public Project createProject(Project project, String importUrl) throws GitLabApi .withParam("default_branch", project.getDefaultBranch()) .withParam("description", project.getDescription()) .withParam("issues_enabled", project.getIssuesEnabled()) - .withParam("merge_method", project.getMergeMethod()) + .withParam("merge_method", project.getMergeMethod()) .withParam("merge_requests_enabled", project.getMergeRequestsEnabled()) .withParam("jobs_enabled", project.getJobsEnabled()) .withParam("wiki_enabled", project.getWikiEnabled()) @@ -1064,12 +1051,6 @@ public Project createProject(Project project, String importUrl) throws GitLabApi if (project.getTagList() != null && !project.getTagList().isEmpty()) { formData.withParam("tag_list", String.join(",", project.getTagList())); } - - if(project.getTopics() !=null && !project.getTopics().isEmpty()){ - - formData.withParam("topics",String.join(",", project.getTopics())); - - } } Response response = post(Response.Status.CREATED, formData, "projects"); @@ -1079,26 +1060,26 @@ public Project createProject(Project project, String importUrl) throws GitLabApi /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default - * @param importUrl The Import URL for the project, otherwise null + * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default + * @param visibilityLevel 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 GitLabApiException if any exception occurs */ public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, String importUrl) throws GitLabApiException { if (isApiVersion(ApiVersion.V3)) { Boolean isPublic = Visibility.PUBLIC == visibility; return (createProject(name, namespaceId, description, issuesEnabled, mergeRequestsEnabled, - wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); + wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); } if (name == null || name.trim().length() == 0) { @@ -1106,16 +1087,16 @@ public Project createProject(String name, Long namespaceId, String description, } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("visibility", visibility) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("visibility", visibility) + .withParam("import_url", importUrl); Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); @@ -1124,28 +1105,28 @@ public Project createProject(String name, Long namespaceId, String description, /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default - * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default - * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @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 visibility The visibility of the project, otherwise null indicates to use GitLab default + * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default * @param printingMergeRequestLinkEnabled Show link to create/view merge request when pushing from the command line - * @param importUrl The Import URL for the project, otherwise null + * @param importUrl The Import URL for the project, otherwise null * @return the GitLab Project * @throws GitLabApiException if any exception occurs */ public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, - Boolean printingMergeRequestLinkEnabled, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Visibility visibility, Integer visibilityLevel, + Boolean printingMergeRequestLinkEnabled, String importUrl) throws GitLabApiException { if (isApiVersion(ApiVersion.V3)) { Boolean isPublic = Visibility.PUBLIC == visibility; return (createProject(name, namespaceId, description, issuesEnabled, mergeRequestsEnabled, - wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); + wikiEnabled, snippetsEnabled, isPublic, visibilityLevel, importUrl)); } if (name == null || name.trim().length() == 0) { @@ -1153,17 +1134,17 @@ public Project createProject(String name, Long namespaceId, String description, } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("visibility", visibility) - .withParam("printing_merge_request_link_enabled", printingMergeRequestLinkEnabled) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("visibility", visibility) + .withParam("printing_merge_request_link_enabled", printingMergeRequestLinkEnabled) + .withParam("import_url", importUrl); Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); @@ -1172,39 +1153,39 @@ public Project createProject(String name, Long namespaceId, String description, /** * Creates a Project * - * @param name The name of the project - * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) - * @param description A description for the project, null otherwise - * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default + * @param name The name of the project + * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user) + * @param description A description for the project, null otherwise + * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default * @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 isPublic 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 importUrl The Import URL for the project, otherwise null + * @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 isPublic 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 importUrl The Import URL for the project, otherwise null * @return the GitLab Project * @throws GitLabApiException if any exception occurs * @deprecated As of release 4.2.0, replaced by {@link #createProject(String, Long, String, Boolean, Boolean, - * Boolean, Boolean, Visibility, Integer, String)} + * Boolean, Boolean, Visibility, Integer, String)} */ @Deprecated public Project createProject(String name, Long namespaceId, String description, Boolean issuesEnabled, Boolean mergeRequestsEnabled, - Boolean wikiEnabled, Boolean snippetsEnabled, Boolean isPublic, Integer visibilityLevel, String importUrl) throws GitLabApiException { + Boolean wikiEnabled, Boolean snippetsEnabled, Boolean isPublic, Integer visibilityLevel, String importUrl) throws GitLabApiException { if (name == null || name.trim().length() == 0) { return (null); } GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, true) - .withParam("namespace_id", namespaceId) - .withParam("description", description) - .withParam("issues_enabled", issuesEnabled) - .withParam("merge_requests_enabled", mergeRequestsEnabled) - .withParam("wiki_enabled", wikiEnabled) - .withParam("snippets_enabled", snippetsEnabled) - .withParam("visibility_level", visibilityLevel) - .withParam("import_url", importUrl); + .withParam("name", name, true) + .withParam("namespace_id", namespaceId) + .withParam("description", description) + .withParam("issues_enabled", issuesEnabled) + .withParam("merge_requests_enabled", mergeRequestsEnabled) + .withParam("wiki_enabled", wikiEnabled) + .withParam("snippets_enabled", snippetsEnabled) + .withParam("visibility_level", visibilityLevel) + .withParam("import_url", importUrl); if (isApiVersion(ApiVersion.V3)) { formData.withParam("public", isPublic); @@ -1219,11 +1200,11 @@ public Project createProject(String name, Long namespaceId, String description, /** * Create a new project from a template, belonging to the namespace ID. A namespace ID is either a user or group ID. * - * @param namespaceId the namespace ID to create the project under - * @param projectName the name of the project top create + * @param namespaceId the namespace ID to create the project under + * @param projectName the name of the project top create * @param groupWithProjectTemplatesId Id of the Gitlab Group, which contains the relevant templates. - * @param templateName name of the template to use - * @param visibility Visibility of the new create project + * @param templateName name of the template to use + * @param visibility Visibility of the new create project * @return the created project * @throws GitLabApiException if any exception occurs */ @@ -1234,7 +1215,8 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName .withParam("use_custom_template", true) .withParam("group_with_project_templates_id", groupWithProjectTemplatesId, true) .withParam("template_name", templateName, true) - .withParam("visibility", visibility); + .withParam("visibility", visibility) + ; Response response = post(Response.Status.CREATED, formData, "projects"); return (response.readEntity(Project.class)); } @@ -1242,7 +1224,7 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName /** * Updates a project. The following properties on the Project instance * are utilized in the edit of the project, null values are not updated: - *

+ * * id (required) - existing project id, either id or path must be provided * name (optional) - project name * path (optional) - project path, either id or path must be provided @@ -1272,12 +1254,12 @@ public Project createProjectFromTemplate(Integer namespaceId, String projectName * ciConfigPath (optional) - Set path to CI configuration file * ciForwardDeploymentEnabled (optional) - When a new deployment job starts, skip older deployment jobs that are still pending * squashOption (optional) - set squash option for merge requests - *

+ * * NOTE: The following parameters specified by the GitLab API edit project are not supported: - * import_url - * tag_list array - * avatar - * initialize_with_readme + * import_url + * tag_list array + * avatar + * initialize_with_readme * * @param project the Project instance with the configuration for the new project * @return a Project instance with the newly updated project info @@ -1298,7 +1280,7 @@ public Project updateProject(Project project) throws GitLabApiException { .withParam("default_branch", project.getDefaultBranch()) .withParam("description", project.getDescription()) .withParam("issues_enabled", project.getIssuesEnabled()) - .withParam("merge_method", project.getMergeMethod()) + .withParam("merge_method", project.getMergeMethod()) .withParam("merge_requests_enabled", project.getMergeRequestsEnabled()) .withParam("jobs_enabled", project.getJobsEnabled()) .withParam("wiki_enabled", project.getWikiEnabled()) @@ -1407,9 +1389,9 @@ public Project forkProject(Object projectIdOrPath, Long namespaceId) throws GitL */ public Project forkProject(Object projectIdOrPath, String namespace, String path, String name) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("namespace", namespace, true) - .withParam("path", path) - .withParam("name", name); + .withParam("namespace", namespace, true) + .withParam("path", path) + .withParam("name", name); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.CREATED); Response response = post(expectedStatus, formData, "projects", getProjectIdOrPath(projectIdOrPath), "fork"); return (response.readEntity(Project.class)); @@ -1420,14 +1402,15 @@ public Project forkProject(Object projectIdOrPath, String namespace, String path * *

GitLab Endpoint: POST /projects/:id/fork/:forkFromId
* + * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param forkedFromId the ID of the project that was forked from + * @param forkedFromId the ID of the project that was forked from * @return the updated Project instance * @throws GitLabApiException if any exception occurs */ public Project createForkedFromRelationship(Object projectIdOrPath, Long forkedFromId) throws GitLabApiException { Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.CREATED); - Response response = post(expectedStatus, (Form) null, "projects", this.getProjectIdOrPath(projectIdOrPath), "fork", forkedFromId); + Response response = post(expectedStatus, (Form)null, "projects", this.getProjectIdOrPath(projectIdOrPath), "fork", forkedFromId); return (response.readEntity(Project.class)); } @@ -1463,15 +1446,14 @@ public List getMembers(Object projectIdOrPath) throws GitLabApiException *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param page the page to get - * @param perPage the number of Member instances per page + * @param page the page to get + * @param perPage the number of Member instances per page * @return the members belonging to the specified project * @throws GitLabApiException if any exception occurs */ public List getMembers(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "members"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -1480,7 +1462,7 @@ public List getMembers(Object projectIdOrPath, int page, int perPage) th *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return the members belonging to the specified project * @throws GitLabApiException if any exception occurs */ @@ -1526,18 +1508,17 @@ public List getAllMembers(Object projectIdOrPath) throws GitLabApiExcept *
GitLab Endpoint: GET /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param page the page to get - * @param perPage the number of Member instances per page + * @param page the page to get + * @param perPage the number of Member instances per page * @return the project members viewable by the authenticated user, including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0 + * @deprecated Will be removed in version 6.0 */ @Deprecated public List getAllMembers(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), - "projects", getProjectIdOrPath(projectIdOrPath), "members", "all"); - return (response.readEntity(new GenericType>() { - })); + "projects", getProjectIdOrPath(projectIdOrPath), "members", "all"); + return (response.readEntity(new GenericType>() {})); } /** @@ -1549,7 +1530,7 @@ public List getAllMembers(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/members/all
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1584,8 +1565,8 @@ public Stream getAllMembersStream(Object projectIdOrPath) throws GitLabA *
GitLab Endpoint: GET /projects/:id/members/all
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs * @return the project members viewable by the authenticated user, including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs */ @@ -1602,9 +1583,9 @@ public List getAllMembers(Object projectIdOrPath, String query, ListGitLab Endpoint: GET /projects/:id/members/all * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1612,7 +1593,7 @@ public List getAllMembers(Object projectIdOrPath, String query, List getAllMembers(Object projectIdOrPath, String query, List userIds, int itemsPerPage) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("query", query).withParam("user_ids", userIds); return (new Pager(this, Member.class, itemsPerPage, form.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath), "members", "all")); + "projects", getProjectIdOrPath(projectIdOrPath), "members", "all")); } /** @@ -1624,8 +1605,8 @@ public Pager getAllMembers(Object projectIdOrPath, String query, ListGitLab Endpoint: GET /projects/:id/members/all * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param query a query string to search for members - * @param userIds filter the results on the given user IDs + * @param query a query string to search for members + * @param userIds filter the results on the given user IDs * @return a Stream of the project members viewable by the authenticated user, * including inherited members through ancestor groups * @throws GitLabApiException if any exception occurs @@ -1640,7 +1621,7 @@ public Stream getAllMembersStream(Object projectIdOrPath, String query, *
GitLab Endpoint: GET /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param userId the user ID of the member * @return the member specified by the project ID/user ID pair * @throws GitLabApiException if any exception occurs */ @@ -1654,10 +1635,10 @@ public Member getMember(Object projectIdOrPath, Long userId) throws GitLabApiExc *
GitLab Endpoint: GET /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param userId the user ID of the member * @return the member specified by the project ID/user ID pair */ - public Optional getOptionalMember(Object projectIdOrPath, Long userId) { + public Optional getOptionalMember(Object projectIdOrPath, Long userId) { try { return (Optional.ofNullable(getMember(projectIdOrPath, userId, false))); } catch (GitLabApiException glae) { @@ -1670,8 +1651,8 @@ public Optional getOptionalMember(Object projectIdOrPath, Long userId) { * *
GitLab Endpoint: GET /projects/:id/members/all/:user_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param userId the user ID of the member * @param includeInherited if true will the member even if inherited thru an ancestor group * @return the member specified by the project ID/user ID pair * @throws GitLabApiException if any exception occurs @@ -1691,12 +1672,12 @@ public Member getMember(Object projectIdOrPath, Long userId, Boolean includeInhe * *
GitLab Endpoint: GET /projects/:id/members/all/:user_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param userId the user ID of the member * @param includeInherited if true will the member even if inherited thru an ancestor group * @return the member specified by the project ID/user ID pair as the value of an Optional */ - public Optional getOptionalMember(Object projectIdOrPath, Long userId, Boolean includeInherited) { + public Optional getOptionalMember(Object projectIdOrPath, Long userId, Boolean includeInherited) { try { return (Optional.ofNullable(getMember(projectIdOrPath, userId, includeInherited))); } catch (GitLabApiException glae) { @@ -1712,8 +1693,8 @@ public Optional getOptionalMember(Object projectIdOrPath, Long userId, B *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add, required - * @param accessLevel the access level for the new member, required + * @param userId the user ID of the member to add, required + * @param accessLevel the access level for the new member, required * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1729,8 +1710,8 @@ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add, required - * @param accessLevel the access level for the new member, required + * @param userId the user ID of the member to add, required + * @param accessLevel the access level for the new member, required * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1746,9 +1727,9 @@ public Member addMember(Object projectIdOrPath, Long userId, AccessLevel accessL *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add - * @param accessLevel the access level for the new member - * @param expiresAt the date the membership in the group will expire + * @param userId the user ID of the member to add + * @param accessLevel the access level for the new member + * @param expiresAt the date the membership in the group will expire * @return the added member * @throws GitLabApiException if any exception occurs */ @@ -1764,17 +1745,17 @@ public Member addMember(Object projectIdOrPath, Long userId, AccessLevel accessL *
GitLab Endpoint: POST /projects/:id/members
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to add - * @param accessLevel the access level for the new member - * @param expiresAt the date the membership in the group will expire + * @param userId the user ID of the member to add + * @param accessLevel the access level for the new member + * @param expiresAt the date the membership in the group will expire * @return the added member * @throws GitLabApiException if any exception occurs */ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("user_id", userId, true) - .withParam("access_level", accessLevel, true) - .withParam("expires_at", expiresAt, false); + .withParam("user_id", userId, true) + .withParam("access_level", accessLevel, true) + .withParam("expires_at", expiresAt, false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "members"); return (response.readEntity(Member.class)); } @@ -1785,8 +1766,8 @@ public Member addMember(Object projectIdOrPath, Long userId, Integer accessLevel *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1800,8 +1781,8 @@ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLe *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1815,9 +1796,9 @@ public Member updateMember(Object projectIdOrPath, Long userId, AccessLevel acce *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required - * @param expiresAt the date the membership in the group will expire, optional + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required + * @param expiresAt the date the membership in the group will expire, optional * @return the updated member * @throws GitLabApiException if any exception occurs */ @@ -1831,16 +1812,16 @@ public Member updateMember(Object projectIdOrPath, Long userId, AccessLevel acce *
GitLab Endpoint: PUT /projects/:projectId/members/:userId
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param userId the user ID of the member to update, required - * @param accessLevel the new access level for the member, required - * @param expiresAt the date the membership in the group will expire, optional + * @param userId the user ID of the member to update, required + * @param accessLevel the new access level for the member, required + * @param expiresAt the date the membership in the group will expire, optional * @return the updated member * @throws GitLabApiException if any exception occurs */ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("access_level", accessLevel, true) - .withParam("expires_at", expiresAt, false); + .withParam("access_level", accessLevel, true) + .withParam("expires_at", expiresAt, false); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "members", userId); return (response.readEntity(Member.class)); } @@ -1851,7 +1832,7 @@ public Member updateMember(Object projectIdOrPath, Long userId, Integer accessLe *
GitLab Endpoint: DELETE /projects/:id/members/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param userId the user ID of the member to remove + * @param userId the user ID of the member to remove * @throws GitLabApiException if any exception occurs */ public void removeMember(Object projectIdOrPath, Long userId) throws GitLabApiException { @@ -1878,7 +1859,7 @@ public List getProjectUsers(Object projectIdOrPath) throws GitLabAp *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1906,7 +1887,7 @@ public Stream getProjectUsersStream(Object projectIdOrPath) throws *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param search the string to match specific users + * @param search the string to match specific users * @return the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1921,15 +1902,15 @@ public List getProjectUsers(Object projectIdOrPath, String search) *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param search the string to match specific users - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param search the string to match specific users + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ public Pager getProjectUsers(Object projectIdOrPath, String search, int itemsPerPage) throws GitLabApiException { MultivaluedMap params = (search != null ? new GitLabApiForm().withParam("search", search).asMap() : null); return (new Pager(this, ProjectUser.class, itemsPerPage, params, - "projects", getProjectIdOrPath(projectIdOrPath), "users")); + "projects", getProjectIdOrPath(projectIdOrPath), "users")); } /** @@ -1939,7 +1920,7 @@ public Pager getProjectUsers(Object projectIdOrPath, String search, *
GitLab Endpoint: GET /projects/:id/users
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param search the string to match specific users + * @param search the string to match specific users * @return a Stream of the users matching the search string and belonging to the specified project and its parent groups * @throws GitLabApiException if any exception occurs */ @@ -1966,7 +1947,7 @@ public List getProjectGroups(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -1993,7 +1974,7 @@ public Stream getProjectGroupsStream(Object projectIdOrPath) throw *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param filter the ProjectGroupsFilter to match against + * @param filter the ProjectGroupsFilter to match against * @return the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -2007,8 +1988,8 @@ public List getProjectGroups(Object projectIdOrPath, ProjectGroups *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param filter the ProjectGroupsFilter to match against - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param filter the ProjectGroupsFilter to match against + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -2023,7 +2004,7 @@ public Pager getProjectGroups(Object projectIdOrPath, ProjectGroup *
GitLab Endpoint: GET /projects/:id/groups
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param filter the ProjectGroupsFilter to match against + * @param filter the ProjectGroupsFilter to match against * @return a Stream of the ancestor groups for a given project * @throws GitLabApiException if any exception occurs */ @@ -2050,15 +2031,14 @@ public List getProjectEvents(Object projectIdOrPath) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id/events
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of Event instances per page + * @param page the page to get + * @param perPage the number of Event instances per page * @return the project events for the specified project * @throws GitLabApiException if any exception occurs */ public List getProjectEvents(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "events"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -2067,7 +2047,7 @@ public List getProjectEvents(Object projectIdOrPath, int page, int perPag *
GitLab Endpoint: GET /projects/:id/events
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of project events for the specified project * @throws GitLabApiException if any exception occurs */ @@ -2107,15 +2087,14 @@ public List getHooks(Object projectIdOrPath) throws GitLabApiExcept *
GitLab Endpoint: GET /projects/:id/hooks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of ProjectHook instances per page + * @param page the page to get + * @param perPage the number of ProjectHook instances per page * @return a list of project hooks for the specified project in the specified page range * @throws GitLabApiException if any exception occurs */ public List getHooks(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -2124,7 +2103,7 @@ public List getHooks(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/hooks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of project hooks for the specified project * @throws GitLabApiException if any exception occurs */ @@ -2151,7 +2130,7 @@ public Stream getHooksStream(Object projectIdOrPath) throws GitLabA *
GitLab Endpoint: GET /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the ID of the hook to get + * @param hookId the ID of the hook to get * @return the project hook for the specified project ID/hook ID pair * @throws GitLabApiException if any exception occurs */ @@ -2166,7 +2145,7 @@ public ProjectHook getHook(Object projectIdOrPath, Long hookId) throws GitLabApi *
GitLab Endpoint: GET /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the ID of the hook to get + * @param hookId the ID of the hook to get * @return the project hook for the specified project ID/hook ID pair as an Optional instance */ public Optional getOptionalHook(Object projectIdOrPath, Long hookId) { @@ -2182,36 +2161,36 @@ public Optional getOptionalHook(Object projectIdOrPath, Long hookId * *
GitLab Endpoint: POST /projects/:id/hooks
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param url the callback URL for the hook - * @param enabledHooks a ProjectHook instance specifying which hooks to enable + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param url the callback URL for the hook + * @param enabledHooks a ProjectHook instance specifying which hooks to enable * @param enableSslVerification enable SSL verification - * @param secretToken the secret token to pass back to the hook + * @param secretToken the secret token to pass back to the hook * @return the added ProjectHook instance * @throws GitLabApiException if any exception occurs */ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabledHooks, - boolean enableSslVerification, String secretToken) throws GitLabApiException { + boolean enableSslVerification, String secretToken) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url, true) - .withParam("push_events", enabledHooks.getPushEvents(), false) - .withParam("push_events_branch_filter", enabledHooks.getPushEventsBranchFilter(), false) - .withParam("issues_events", enabledHooks.getIssuesEvents(), false) - .withParam("confidential_issues_events", enabledHooks.getConfidentialIssuesEvents(), false) - .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) - .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) - .withParam("note_events", enabledHooks.getNoteEvents(), false) - .withParam("confidential_note_events", enabledHooks.getConfidentialNoteEvents(), false) - .withParam("job_events", enabledHooks.getJobEvents(), false) - .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) - .withParam("wiki_page_events", enabledHooks.getWikiPageEvents(), false) - .withParam("enable_ssl_verification", enableSslVerification, false) - .withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false) - .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) - .withParam("releases_events", enabledHooks.getReleasesEvents(), false) - .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) - .withParam("token", secretToken, false); + .withParam("url", url, true) + .withParam("push_events", enabledHooks.getPushEvents(), false) + .withParam("push_events_branch_filter", enabledHooks.getPushEventsBranchFilter(), false) + .withParam("issues_events", enabledHooks.getIssuesEvents(), false) + .withParam("confidential_issues_events", enabledHooks.getConfidentialIssuesEvents(), false) + .withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false) + .withParam("tag_push_events", enabledHooks.getTagPushEvents(), false) + .withParam("note_events", enabledHooks.getNoteEvents(), false) + .withParam("confidential_note_events", enabledHooks.getConfidentialNoteEvents(), false) + .withParam("job_events", enabledHooks.getJobEvents(), false) + .withParam("pipeline_events", enabledHooks.getPipelineEvents(), false) + .withParam("wiki_page_events", enabledHooks.getWikiPageEvents(), false) + .withParam("enable_ssl_verification", enableSslVerification, false) + .withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false) + .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) + .withParam("releases_events", enabledHooks.getReleasesEvents(), false) + .withParam("deployment_events", enabledHooks.getDeploymentEvents(), false) + .withParam("token", secretToken, false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); return (response.readEntity(ProjectHook.class)); } @@ -2221,22 +2200,22 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl * *
GitLab Endpoint: POST /projects/:id/hooks
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param url the callback URL for the hook - * @param doPushEvents flag specifying whether to do push events - * @param doIssuesEvents flag specifying whether to do issues events + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param url the callback URL for the hook + * @param doPushEvents flag specifying whether to do push events + * @param doIssuesEvents flag specifying whether to do issues events * @param doMergeRequestsEvents flag specifying whether to do merge requests events * @return the added ProjectHook instance * @throws GitLabApiException if any exception occurs */ public ProjectHook addHook(Object projectIdOrPath, String url, boolean doPushEvents, - boolean doIssuesEvents, boolean doMergeRequestsEvents) throws GitLabApiException { + boolean doIssuesEvents, boolean doMergeRequestsEvents) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url) - .withParam("push_events", doPushEvents) - .withParam("issues_events", doIssuesEvents) - .withParam("merge_requests_events", doMergeRequestsEvents); + .withParam("url", url) + .withParam("push_events", doPushEvents) + .withParam("issues_events", doIssuesEvents) + .withParam("merge_requests_events", doMergeRequestsEvents); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks"); return (response.readEntity(ProjectHook.class)); @@ -2248,7 +2227,7 @@ public ProjectHook addHook(Object projectIdOrPath, String url, boolean doPushEve *
GitLab Endpoint: DELETE /projects/:id/hooks/:hook_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param hookId the project hook ID to delete + * @param hookId the project hook ID to delete * @throws GitLabApiException if any exception occurs */ public void deleteHook(Object projectIdOrPath, Long hookId) throws GitLabApiException { @@ -2323,8 +2302,8 @@ public List getIssues(Object projectIdOrPath) throws GitLabApiException { *
GitLab Endpoint: GET /projects/:id/issues
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of issues per page + * @param page the page to get + * @param perPage the number of issues per page * @return the list of issues in the specified range * @throws GitLabApiException if any exception occurs * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssues(Object, int, int)} @@ -2332,8 +2311,7 @@ public List getIssues(Object projectIdOrPath) throws GitLabApiException { @Deprecated public List getIssues(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "issues"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -2342,7 +2320,7 @@ public List getIssues(Object projectIdOrPath, int page, int perPage) thro *
GitLab Endpoint: GET /projects/:id/issues
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of issues per page + * @param itemsPerPage the number of issues per page * @return the list of issues in the specified range * @throws GitLabApiException if any exception occurs * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssues(Object, int)} @@ -2373,10 +2351,10 @@ public Stream getIssuesStream(Object projectIdOrPath) throws GitLabApiExc *
GitLab Endpoint: GET /projects/:id/issues/:issue_iid
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param issueId the internal ID of a project's issue + * @param issueId the internal ID of a project's issue * @return the specified Issue instance * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssue(Object, Long)} + * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#getIssue(Object, Long)} */ @Deprecated public Issue getIssue(Object projectIdOrPath, Long issueId) throws GitLabApiException { @@ -2390,9 +2368,9 @@ public Issue getIssue(Object projectIdOrPath, Long issueId) throws GitLabApiExce *
GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param issueId the internal ID of a project's issue + * @param issueId the internal ID of a project's issue * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#deleteIssue(Object, Long)} + * @deprecated Will be removed in version 6.0, replaced by {@link IssuesApi#deleteIssue(Object, Long)} */ @Deprecated public void deleteIssue(Object projectIdOrPath, Long issueId) throws GitLabApiException { @@ -2419,15 +2397,14 @@ public List getSnippets(Object projectIdOrPath) throws GitLabApiExcepti *
GitLab Endpoint: GET /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of snippets per page + * @param page the page to get + * @param perPage the number of snippets per page * @return a list of project's snippets for the specified range * @throws GitLabApiException if any exception occurs */ public List getSnippets(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -2436,7 +2413,7 @@ public List getSnippets(Object projectIdOrPath, int page, int perPage) *
GitLab Endpoint: GET /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of snippets per page + * @param itemsPerPage the number of snippets per page * @return the Pager of snippets * @throws GitLabApiException if any exception occurs */ @@ -2463,7 +2440,7 @@ public Stream getSnippetsStream(Object projectIdOrPath) throws GitLabAp *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the specified project Snippet * @throws GitLabApiException if any exception occurs */ @@ -2478,7 +2455,7 @@ public Snippet getSnippet(Object projectIdOrPath, Long snippetId) throws GitLabA *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the specified project Snippet as an Optional instance */ public Optional getOptionalSnippet(Object projectIdOrPath, Long snippetId) { @@ -2495,25 +2472,25 @@ public Optional getOptionalSnippet(Object projectIdOrPath, Long snippet *
GitLab Endpoint: POST /projects/:id/snippets
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param title the title of a snippet, required - * @param filename the name of a snippet file, required - * @param description the description of a snippet, optional - * @param content the content of a snippet, required - * @param visibility the snippet's visibility, required + * @param title the title of a snippet, required + * @param filename the name of a snippet file, required + * @param description the description of a snippet, optional + * @param content the content of a snippet, required + * @param visibility the snippet's visibility, required * @return a Snippet instance with info on the created snippet * @throws GitLabApiException if any exception occurs */ public Snippet createSnippet(Object projectIdOrPath, String title, String filename, String description, - String content, Visibility visibility) throws GitLabApiException { + String content, Visibility visibility) throws GitLabApiException { try { GitLabApiForm form = new GitLabApiForm() - .withParam("title", title, true) - .withParam("file_name", filename, true) - .withParam("description", description) - .withParam("content", content, true) - .withParam("visibility", visibility, true); + .withParam("title", title, true) + .withParam("file_name", filename, true) + .withParam("description", description) + .withParam("content", content, true) + .withParam("visibility", visibility, true); Response response = post(Response.Status.CREATED, form, "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); return (response.readEntity(Snippet.class)); @@ -2526,11 +2503,11 @@ public Snippet createSnippet(Object projectIdOrPath, String title, String filena } GitLabApiForm form = new GitLabApiForm() - .withParam("title", title, true) - .withParam("file_name", filename, true) - .withParam("description", description) - .withParam("code", content, true) - .withParam("visibility", visibility, true); + .withParam("title", title, true) + .withParam("file_name", filename, true) + .withParam("description", description) + .withParam("code", content, true) + .withParam("visibility", visibility, true); Response response = post(Response.Status.CREATED, form, "projects", getProjectIdOrPath(projectIdOrPath), "snippets"); return (response.readEntity(Snippet.class)); @@ -2543,24 +2520,24 @@ public Snippet createSnippet(Object projectIdOrPath, String title, String filena *
GitLab Endpoint: PUT /projects/:id/snippets/:snippet_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of a project's snippet, required - * @param title the title of a snippet, optional - * @param filename the name of a snippet file, optional - * @param description the description of a snippet, optioptionalonal - * @param code the content of a snippet, optional - * @param visibility the snippet's visibility, reqoptionaluired + * @param snippetId the ID of a project's snippet, required + * @param title the title of a snippet, optional + * @param filename the name of a snippet file, optional + * @param description the description of a snippet, optioptionalonal + * @param code the content of a snippet, optional + * @param visibility the snippet's visibility, reqoptionaluired * @return a Snippet instance with info on the updated snippet * @throws GitLabApiException if any exception occurs */ public Snippet updateSnippet(Object projectIdOrPath, Long snippetId, String title, String filename, String description, - String code, Visibility visibility) throws GitLabApiException { + String code, Visibility visibility) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("title", title) - .withParam("file_name", filename) - .withParam("description", description) - .withParam("code", code) - .withParam("visibility", visibility); + .withParam("title", title) + .withParam("file_name", filename) + .withParam("description", description) + .withParam("code", code) + .withParam("visibility", visibility); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); return (response.readEntity(Snippet.class)); @@ -2586,7 +2563,7 @@ public void deleteSnippet(Object projectIdOrPath, Long snippetId) throws GitLabA *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/raw
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the raw project snippet plain text as an Optional instance * @throws GitLabApiException if any exception occurs */ @@ -2601,7 +2578,7 @@ public String getRawSnippetContent(Object projectIdOrPath, Long snippetId) throw *
GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/raw
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param snippetId the ID of the project's snippet + * @param snippetId the ID of the project's snippet * @return the raw project snippet plain text as an Optional instance */ public Optional getOptionalRawSnippetContent(Object projectIdOrPath, Long snippetId) { @@ -2618,13 +2595,13 @@ public Optional getOptionalRawSnippetContent(Object projectIdOrPath, Lon *
GitLab Endpoint: POST /projects/:id/share
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param groupId the ID of the group to share with, required - * @param accessLevel the permissions level to grant the group, required - * @param expiresAt the share expiration date, optional + * @param groupId the ID of the group to share with, required + * @param accessLevel the permissions level to grant the group, required + * @param expiresAt the share expiration date, optional * @throws GitLabApiException if any exception occurs */ public void shareProject(Object projectIdOrPath, Long groupId, AccessLevel accessLevel, Date expiresAt) - throws GitLabApiException { + throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("group_id", groupId, true) .withParam("group_access", accessLevel, true) @@ -2638,7 +2615,7 @@ public void shareProject(Object projectIdOrPath, Long groupId, AccessLevel acces *
GitLab Endpoint: DELETE /projects/:id/share/:group_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param groupId the ID of the group to unshare, required + * @param groupId the ID of the group to unshare, required * @throws GitLabApiException if any exception occurs */ public void unshareProject(Object projectIdOrPath, Long groupId) throws GitLabApiException { @@ -2656,7 +2633,7 @@ public void unshareProject(Object projectIdOrPath, Long groupId) throws GitLabAp * @throws GitLabApiException if any exception occurs */ public Project archiveProject(Object projectIdOrPath) - throws GitLabApiException { + throws GitLabApiException { Response response = post(Response.Status.CREATED, (new GitLabApiForm()), "projects", getProjectIdOrPath(projectIdOrPath), "archive"); return (response.readEntity(Project.class)); } @@ -2671,7 +2648,7 @@ public Project archiveProject(Object projectIdOrPath) * @throws GitLabApiException if any exception occurs */ public Project unarchiveProject(Object projectIdOrPath) - throws GitLabApiException { + throws GitLabApiException { Response response = post(Response.Status.CREATED, (new GitLabApiForm()), "projects", getProjectIdOrPath(projectIdOrPath), "unarchive"); return (response.readEntity(Project.class)); } @@ -2682,7 +2659,7 @@ public Project unarchiveProject(Object projectIdOrPath) *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param fileToUpload the File instance of the file to upload, required + * @param fileToUpload the File instance of the file to upload, required * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2696,8 +2673,8 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload) throws G *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param fileToUpload the File instance of the file to upload, required - * @param mediaType unused; will be removed in the next major version + * @param fileToUpload the File instance of the file to upload, required + * @param mediaType unused; will be removed in the next major version * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2713,9 +2690,9 @@ public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String m *
GitLab Endpoint: POST /projects/:id/uploads
* * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required - * @param inputStream the data to upload, required - * @param filename The filename of the file to upload - * @param mediaType unused; will be removed in the next major version + * @param inputStream the data to upload, required + * @param filename The filename of the file to upload + * @param mediaType unused; will be removed in the next major version * @return a FileUpload instance with information on the just uploaded file * @throws GitLabApiException if any exception occurs */ @@ -2742,10 +2719,10 @@ public PushRules getPushRules(Object projectIdOrPath) throws GitLabApiException * Adds a push rule to a specified project. * *
GitLab Endpoint: POST /projects/:id/push_rule
- *

+ * * The following properties on the PushRules instance are utilized in the creation of the push rule: * - * + * * denyDeleteTag (optional) - Deny deleting a tag * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets @@ -2757,10 +2734,10 @@ public PushRules getPushRules(Object projectIdOrPath) throws GitLabApiException * maxFileSize (optional) - Maximum file size (MB) * commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails. * rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG - * + * * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param pushRule the PushRule instance containing the push rule configuration to add + * @param pushRule the PushRule instance containing the push rule configuration to add * @return a PushRules instance with the newly created push rule info * @throws GitLabApiException if any exception occurs */ @@ -2786,10 +2763,10 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr * Updates a push rule for the specified project. * *

GitLab Endpoint: PUT /projects/:id/push_rule/:push_rule_id
- *

+ * * The following properties on the PushRules instance are utilized when updating the push rule: * - * + * * denyDeleteTag (optional) - Deny deleting a tag * memberCheck (optional) - Restrict commits by author (email) to existing GitLab users * preventSecrets (optional) - GitLab will reject any files that are likely to contain secrets @@ -2801,10 +2778,10 @@ public PushRules createPushRules(Object projectIdOrPath, PushRules pushRule) thr * maxFileSize (optional) - Maximum file size (MB) * commitCommitterCheck (optional) - Users can only push commits to this repository that were committed with one of their own verified emails. * rejectUnsignedCommits (optional) - Reject commit when it is not signed through GPG - * + * * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param pushRule the PushRules instance containing the push rule configuration to update + * @param pushRule the PushRules instance containing the push rule configuration to update * @return a PushRules instance with the newly created push rule info * @throws GitLabApiException if any exception occurs */ @@ -2858,15 +2835,14 @@ public List getForks(Object projectIdOrPath) throws GitLabApiException *

GitLab Endpoint: GET /projects/:id/forks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of projects per page + * @param page the page to get + * @param perPage the number of projects per page * @return a List of forked projects * @throws GitLabApiException if any exception occurs */ public List getForks(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { - Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "forks"); - return (response.readEntity(new GenericType>() { - })); + Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", getProjectIdOrPath(projectIdOrPath), "forks"); + return (response.readEntity(new GenericType>() { })); } /** @@ -2875,7 +2851,7 @@ public List getForks(Object projectIdOrPath, int page, int perPage) thr *
GitLab Endpoint: GET /projects/:id/forks
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Project instances that will be fetched per page + * @param itemsPerPage the number of Project instances that will be fetched per page * @return a Pager of projects * @throws GitLabApiException if any exception occurs */ @@ -2938,8 +2914,7 @@ public Project unstarProject(Object projectIdOrPath) throws GitLabApiException { */ public Map getProjectLanguages(Object projectIdOrPath) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "languages"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -2948,7 +2923,7 @@ public Map getProjectLanguages(Object projectIdOrPath) throws Git *
GitLab Endpoint: PUT /projects/:id/transfer.
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param namespace the namespace to transfer the project to + * @param namespace the namespace to transfer the project to * @return the updated Project * @throws GitLabApiException if any exception occurs */ @@ -2964,13 +2939,13 @@ public Project transferProject(Object projectIdOrPath, String namespace) throws *
GitLab Endpoint: PUT /projects/:id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param avatarFile the File instance of the avatar file to upload + * @param avatarFile the File instance of the avatar file to upload * @return the updated Project instance * @throws GitLabApiException if any exception occurs */ public Project setProjectAvatar(Object projectIdOrPath, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, - "avatar", avatarFile, "projects", getProjectIdOrPath(projectIdOrPath)); + "avatar", avatarFile, "projects", getProjectIdOrPath(projectIdOrPath)); return (response.readEntity(Project.class)); } @@ -2980,8 +2955,8 @@ public Project setProjectAvatar(Object projectIdOrPath, File avatarFile) throws *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. * @return a List of project Audit events * @throws GitLabApiException if any exception occurs */ @@ -2995,18 +2970,18 @@ public List getAuditEvents(Object projectIdOrPath, Date created_afte *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. - * @param itemsPerPage the number of Audit Event instances that will be fetched per page + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. + * @param itemsPerPage the number of Audit Event instances that will be fetched per page * @return a Pager of project Audit events * @throws GitLabApiException if any exception occurs */ public Pager getAuditEvents(Object projectIdOrPath, Date created_after, Date created_before, int itemsPerPage) throws GitLabApiException { Form form = new GitLabApiForm() - .withParam("created_before", ISO8601.toString(created_before, false)) - .withParam("created_after", ISO8601.toString(created_after, false)); + .withParam("created_before", ISO8601.toString(created_before, false)) + .withParam("created_after", ISO8601.toString(created_after, false)); return (new Pager(this, AuditEvent.class, itemsPerPage, form.asMap(), - "projects", getProjectIdOrPath(projectIdOrPath), "audit_events")); + "projects", getProjectIdOrPath(projectIdOrPath), "audit_events")); } /** @@ -3015,8 +2990,8 @@ public Pager getAuditEvents(Object projectIdOrPath, Date created_aft *
GET /projects/:id/audit_events
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param created_after Project audit events created on or after the given time. - * @param created_before Project audit events created on or before the given time. + * @param created_after Project audit events created on or after the given time. + * @param created_before Project audit events created on or before the given time. * @return a Stream of project Audit events * @throws GitLabApiException if any exception occurs */ @@ -3030,7 +3005,7 @@ public Stream getAuditEventsStream(Object projectIdOrPath, Date crea *
GitLab Endpoint: GET /projects/:id/audit_events/:id_audit_event
* * @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path - * @param auditEventId the auditEventId, required + * @param auditEventId the auditEventId, required * @return the project Audit event * @throws GitLabApiException if any exception occurs */ @@ -3058,15 +3033,14 @@ public List getVariables(Object projectIdOrPath) throws GitLabApiExcep *
GitLab Endpoint: GET /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param page the page to get - * @param perPage the number of Variable instances per page + * @param page the page to get + * @param perPage the number of Variable instances per page * @return a list of variables belonging to the specified project in the specified page range * @throws GitLabApiException if any exception occurs */ public List getVariables(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "variables"); - return (response.readEntity(new GenericType>() { - })); + return (response.readEntity(new GenericType>() {})); } /** @@ -3075,7 +3049,7 @@ public List getVariables(Object projectIdOrPath, int page, int perPage *
GitLab Endpoint: GET /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param itemsPerPage the number of Variable instances that will be fetched per page + * @param itemsPerPage the number of Variable instances that will be fetched per page * @return a Pager of variables belonging to the specified project * @throws GitLabApiException if any exception occurs */ @@ -3102,13 +3076,13 @@ public Stream getVariablesStream(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @return the Variable instance for the specified variable * @throws GitLabApiException if any exception occurs */ public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApiException { - Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); - return (response.readEntity(Variable.class)); + Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); + return (response.readEntity(Variable.class)); } /** @@ -3117,7 +3091,7 @@ public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApi *
GitLab Endpoint: GET /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @return the Variable for the specified variable as an Optional instance */ public Optional getOptionalVariable(Object projectIdOrPath, String key) { @@ -3134,9 +3108,9 @@ public Optional getOptionalVariable(Object projectIdOrPath, String key *
GitLab Endpoint: POST /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ @@ -3151,10 +3125,10 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: POST /projects/:id/variables
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @param environmentScope the environment_scope of the variable, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution @@ -3171,16 +3145,16 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: POST /projects/:id/variables
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param isMasked whether the variable is masked, optional + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param isMasked whether the variable is masked, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ public Variable createVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean isMasked) throws GitLabApiException { + Boolean isProtected, Boolean isMasked) throws GitLabApiException { return createVariable(projectIdOrPath, key, value, variableType, isProtected, isMasked, null); } @@ -3191,26 +3165,26 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: POST /projects/:id/variables
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param isMasked whether the variable is masked, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param isMasked whether the variable is masked, optional * @param environmentScope the environment_scope of the variable, optional * @return a Variable instance with the newly created variable * @throws GitLabApiException if any exception occurs during execution */ public Variable createVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean isMasked, String environmentScope) throws GitLabApiException { + Boolean isProtected, Boolean isMasked, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("key", key, true) - .withParam("value", value, true) - .withParam("variable_type", variableType) - .withParam("protected", isProtected) - .withParam("masked", isMasked) - .withParam("environment_scope", environmentScope); + .withParam("key", key, true) + .withParam("value", value, true) + .withParam("variable_type", variableType) + .withParam("protected", isProtected) + .withParam("masked", isMasked) + .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); } @@ -3221,9 +3195,9 @@ public Variable createVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: PUT /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ @@ -3238,10 +3212,10 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: PUT /projects/:id/variables/:key
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param isProtected whether the variable is protected, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param isProtected whether the variable is protected, optional * @param environmentScope the environment_scope of the variable, optional. * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution @@ -3258,16 +3232,16 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: PUT /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param masked whether the variable is masked, optional + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param masked whether the variable is masked, optional * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ public Variable updateVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean masked) throws GitLabApiException { + Boolean isProtected, Boolean masked) throws GitLabApiException { return updateVariable(projectIdOrPath, key, value, variableType, isProtected, masked, null); } @@ -3278,25 +3252,25 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, * *
GitLab Endpoint: PUT /projects/:id/variables/:key
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required - * @param value the value for the variable, required - * @param variableType the type of variable. Available types are: env_var (default) and file - * @param isProtected whether the variable is protected, optional - * @param masked whether the variable is masked, optional + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required + * @param key the key of an existing variable, required + * @param value the value for the variable, required + * @param variableType the type of variable. Available types are: env_var (default) and file + * @param isProtected whether the variable is protected, optional + * @param masked whether the variable is masked, optional * @param environmentScope the environment_scope of the variable, optional. * @return a Variable instance with the updated variable * @throws GitLabApiException if any exception occurs during execution */ public Variable updateVariable(Object projectIdOrPath, String key, String value, Variable.Type variableType, - Boolean isProtected, Boolean masked, String environmentScope) throws GitLabApiException { + Boolean isProtected, Boolean masked, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("value", value, true) - .withParam("variable_type", variableType) - .withParam("protected", isProtected) - .withParam("masked", masked) - .withParam("environment_scope", environmentScope); + .withParam("value", value, true) + .withParam("variable_type", variableType) + .withParam("protected", isProtected) + .withParam("masked", masked) + .withParam("environment_scope", environmentScope); Response response = putWithFormData(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); return (response.readEntity(Variable.class)); } @@ -3307,7 +3281,7 @@ public Variable updateVariable(Object projectIdOrPath, String key, String value, *
GitLab Endpoint: DELETE /projects/:id/variables/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key of an existing variable, required + * @param key the key of an existing variable, required * @throws GitLabApiException if any exception occurs */ public void deleteVariable(Object projectIdOrPath, String key) throws GitLabApiException { @@ -3333,7 +3307,7 @@ public List getAccessRequests(Object projectIdOrPath) throws GitL *
GitLab Endpoint: GET /projects/:id/access_requests
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of AccessRequest instances that will be fetched per page + * @param itemsPerPage the number of AccessRequest instances that will be fetched per page * @return a Pager of project AccessRequest instances accessible by the authenticated user * @throws GitLabApiException if any exception occurs */ @@ -3351,7 +3325,7 @@ public Pager getAccessRequests(Object projectIdOrPath, int itemsP * @throws GitLabApiException if any exception occurs */ public Stream getAccessRequestsStream(Object projectIdOrPath) throws GitLabApiException { - return (getAccessRequests(projectIdOrPath, getDefaultPerPage()).stream()); + return (getAccessRequests(projectIdOrPath, getDefaultPerPage()).stream()); } /** @@ -3364,7 +3338,7 @@ public Stream getAccessRequestsStream(Object projectIdOrPath) thr * @throws GitLabApiException if any exception occurs */ public AccessRequest requestAccess(Object projectIdOrPath) throws GitLabApiException { - Response response = post(Response.Status.CREATED, (Form) null, "projects", getProjectIdOrPath(projectIdOrPath), "access_requests"); + Response response = post(Response.Status.CREATED, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "access_requests"); return (response.readEntity(AccessRequest.class)); } @@ -3374,15 +3348,15 @@ public AccessRequest requestAccess(Object projectIdOrPath) throws GitLabApiExcep *
GitLab Endpoint: PUT /projects/:id/access_requests/:user_id/approve
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID to approve access for - * @param accessLevel the access level the user is approved for, if null will be developer (30) + * @param userId the user ID to approve access for + * @param accessLevel the access level the user is approved for, if null will be developer (30) * @return the approved AccessRequest instance * @throws GitLabApiException if any exception occurs */ public AccessRequest approveAccessRequest(Object projectIdOrPath, Long userId, AccessLevel accessLevel) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("access_level", accessLevel); Response response = this.putWithFormData(Response.Status.CREATED, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId, "approve"); + "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId, "approve"); return (response.readEntity(AccessRequest.class)); } @@ -3392,12 +3366,12 @@ public AccessRequest approveAccessRequest(Object projectIdOrPath, Long userId, A *
GitLab Endpoint: DELETE /projects/:id/access_requests/:user_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param userId the user ID to deny access for + * @param userId the user ID to deny access for * @throws GitLabApiException if any exception occurs */ public void denyAccessRequest(Object projectIdOrPath, Long userId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, - "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId); + "projects", getProjectIdOrPath(projectIdOrPath), "access_requests", userId); } /** @@ -3422,7 +3396,7 @@ public void triggerHousekeeping(Object projectIdOrPath) throws GitLabApiExceptio * @throws GitLabApiException if any exception occurs */ public List getBadges(Object projectIdOrPath) throws GitLabApiException { - return getBadges(projectIdOrPath, null); + return getBadges(projectIdOrPath, null); } /** @@ -3431,15 +3405,14 @@ public List getBadges(Object projectIdOrPath) throws GitLabApiException { *
GitLab Endpoint: GET /projects/:id/badges?name=:name
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param bagdeName The name to filter on (case-sensitive), ignored if null. + * @param bagdeName The name to filter on (case-sensitive), ignored if null. * @return All badges of the GitLab item, case insensitively filtered on name. * @throws GitLabApiException If any problem is encountered */ public List getBadges(Object projectIdOrPath, String bagdeName) throws GitLabApiException { - Form queryParam = new GitLabApiForm().withParam("name", bagdeName); - Response response = get(Response.Status.OK, queryParam.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges"); - return (response.readEntity(new GenericType>() { - })); + Form queryParam = new GitLabApiForm().withParam("name", bagdeName); + Response response = get(Response.Status.OK, queryParam.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges"); + return (response.readEntity(new GenericType>() {})); } /** @@ -3448,13 +3421,13 @@ public List getBadges(Object projectIdOrPath, String bagdeName) throws Gi *
GitLab Endpoint: GET /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get + * @param badgeId the ID of the badge to get * @return a Badge instance for the specified project/badge ID pair * @throws GitLabApiException if any exception occurs */ public Badge getBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiException { - Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); - return (response.readEntity(Badge.class)); + Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); + return (response.readEntity(Badge.class)); } /** @@ -3463,15 +3436,15 @@ public Badge getBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiExce *
GitLab Endpoint: GET /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get + * @param badgeId the ID of the badge to get * @return an Optional instance with the specified badge as the value */ public Optional getOptionalBadge(Object projectIdOrPath, Long badgeId) { - try { - return (Optional.ofNullable(getBadge(projectIdOrPath, badgeId))); - } catch (GitLabApiException glae) { - return (GitLabApi.createOptionalFromException(glae)); - } + try { + return (Optional.ofNullable(getBadge(projectIdOrPath, badgeId))); + } catch (GitLabApiException glae) { + return (GitLabApi.createOptionalFromException(glae)); + } } /** @@ -3480,13 +3453,13 @@ public Optional getOptionalBadge(Object projectIdOrPath, Long badgeId) { *
GitLab Endpoint: POST /projects/:id/badges
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the added badge * @throws GitLabApiException if any exception occurs */ public Badge addBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { - return addBadge(projectIdOrPath, null, linkUrl, imageUrl); + return addBadge(projectIdOrPath, null, linkUrl, imageUrl); } /** @@ -3495,19 +3468,19 @@ public Badge addBadge(Object projectIdOrPath, String linkUrl, String imageUrl) t *
GitLab Endpoint: POST /projects/:id/badges
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param name The name to give the badge (may be null) - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param name The name to give the badge (may be null) + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return A Badge instance for the added badge * @throws GitLabApiException if any exception occurs */ public Badge addBadge(Object projectIdOrPath, String name, String linkUrl, String imageUrl) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("name", name, false) - .withParam("link_url", linkUrl, true) - .withParam("image_url", imageUrl, true); - Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "badges"); - return (response.readEntity(Badge.class)); + GitLabApiForm formData = new GitLabApiForm() + .withParam("name", name, false) + .withParam("link_url", linkUrl, true) + .withParam("image_url", imageUrl, true); + Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "badges"); + return (response.readEntity(Badge.class)); } /** @@ -3516,14 +3489,14 @@ public Badge addBadge(Object projectIdOrPath, String name, String linkUrl, Strin *
GitLab Endpoint: PUT /projects/:id/badges
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to get - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param badgeId the ID of the badge to get + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the editted badge * @throws GitLabApiException if any exception occurs */ public Badge editBadge(Object projectIdOrPath, Long badgeId, String linkUrl, String imageUrl) throws GitLabApiException { - return (editBadge(projectIdOrPath, badgeId, null, linkUrl, imageUrl)); + return (editBadge(projectIdOrPath, badgeId, null, linkUrl, imageUrl)); } /** @@ -3532,10 +3505,10 @@ public Badge editBadge(Object projectIdOrPath, Long badgeId, String linkUrl, Str *
GitLab Endpoint: PUT /projects/:id/badges
* * @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to edit - * @param name The name of the badge to edit (may be null) - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param badgeId the ID of the badge to edit + * @param name The name of the badge to edit (may be null) + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the editted badge * @throws GitLabApiException if any exception occurs */ @@ -3554,11 +3527,11 @@ public Badge editBadge(Object projectIdOrPath, Long badgeId, String name, String *
GitLab Endpoint: DELETE /projects/:id/badges/:badge_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param badgeId the ID of the badge to remove + * @param badgeId the ID of the badge to remove * @throws GitLabApiException if any exception occurs */ public void removeBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiException { - delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); + delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "badges", badgeId); } /** @@ -3567,17 +3540,17 @@ public void removeBadge(Object projectIdOrPath, Long badgeId) throws GitLabApiEx *
GitLab Endpoint: GET /projects/:id/badges/render
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param linkUrl the URL of the badge link - * @param imageUrl the URL of the image link + * @param linkUrl the URL of the badge link + * @param imageUrl the URL of the image link * @return a Badge instance for the rendered badge * @throws GitLabApiException if any exception occurs */ - public Badge previewBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("link_url", linkUrl, true) - .withParam("image_url", imageUrl, true); - Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges", "render"); - return (response.readEntity(Badge.class)); + public Badge previewBadge(Object projectIdOrPath, String linkUrl, String imageUrl) throws GitLabApiException { + GitLabApiForm formData = new GitLabApiForm() + .withParam("link_url", linkUrl, true) + .withParam("image_url", imageUrl, true); + Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "badges", "render"); + return (response.readEntity(Badge.class)); } /** @@ -3602,12 +3575,12 @@ public ProjectApprovalsConfig getApprovalsConfiguration(Object projectIdOrPath) *
GitLab Endpoint: POST /projects/:id/approvals
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param config a ProjectApprovalsConfig instance with the approval configuration + * @param config a ProjectApprovalsConfig instance with the approval configuration * @return a ProjectApprovalsConfig instance with the project's approvals configuration * @throws GitLabApiException if any exception occurs */ public ProjectApprovalsConfig setApprovalsConfiguration(Object projectIdOrPath, ProjectApprovalsConfig config) throws GitLabApiException { - GitLabApiForm formData = config.getForm(); + GitLabApiForm formData = config.getForm(); Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "approvals"); return (response.readEntity(ProjectApprovalsConfig.class)); } @@ -3633,14 +3606,14 @@ public List getApprovalRules(Object projectIdOrPath) throws GitLab *
GitLab Endpoint: GET /projects/:id/approval_rules
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of ApprovalRule instances that will be fetched per page + * @param itemsPerPage the number of ApprovalRule instances that will be fetched per page * @return a Pager of ApprovalRuke instances for the specified project. * @throws GitLabApiException if any exception occurs */ public Pager getApprovalRules(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { - return (new Pager(this, ApprovalRule.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules")); + return (new Pager(this, ApprovalRule.class, itemsPerPage, null, + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules")); } /** @@ -3664,14 +3637,14 @@ public Stream getApprovalRulesStream(Object projectIdOrPath) throw *
GitLab Endpoint: POST /projects/:id/approval_rules
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param params the ApprovalRuleParams instance holding the parameters for the approval rule + * @param params the ApprovalRuleParams instance holding the parameters for the approval rule * @return a ApprovalRule instance with approval configuration * @throws GitLabApiException if any exception occurs */ public ApprovalRule createApprovalRule(Object projectIdOrPath, ApprovalRuleParams params) throws GitLabApiException { GitLabApiForm formData = params.getForm(); Response response = post(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules"); + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules"); return (response.readEntity(ApprovalRule.class)); } @@ -3682,8 +3655,8 @@ public ApprovalRule createApprovalRule(Object projectIdOrPath, ApprovalRuleParam *
GitLab Endpoint: PUT /projects/:id/approval_rules/:approval_rule_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param approvalRuleId the ID of the approval rule - * @param params the ApprovalRuleParams instance holding the parameters for the approval rule update + * @param approvalRuleId the ID of the approval rule + * @param params the ApprovalRuleParams instance holding the parameters for the approval rule update * @return a ApprovalRule instance with approval configuration * @throws GitLabApiException if any exception occurs */ @@ -3695,7 +3668,7 @@ public ApprovalRule updateApprovalRule(Object projectIdOrPath, Long approvalRule GitLabApiForm formData = params.getForm(); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules", approvalRuleId); + "projects", getProjectIdOrPath(projectIdOrPath), "approval_rules", approvalRuleId); return (response.readEntity(ApprovalRule.class)); } @@ -3706,7 +3679,7 @@ public ApprovalRule updateApprovalRule(Object projectIdOrPath, Long approvalRule *
GitLab Endpoint: DELETE /projects/:id/approval_rules/:approval_rule_id
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param approvalRuleId the ID of the approval rule + * @param approvalRuleId the ID of the approval rule * @throws GitLabApiException if any exception occurs */ public void deleteApprovalRule(Object projectIdOrPath, Long approvalRuleId) throws GitLabApiException { @@ -3737,13 +3710,13 @@ public List getCustomAttributes(final Object projectIdOrPath) t *
GitLab Endpoint: GET /projects/:id/custom_attributes
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of items per page + * @param itemsPerPage the number of items per page * @return a Pager of project's custom attributes * @throws GitLabApiException if any exception occurs */ public Pager getCustomAttributes(final Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager(this, CustomAttribute.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes")); + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes")); } /** @@ -3765,13 +3738,13 @@ public Stream getCustomAttributesStream(final Object projectIdO *
GitLab Endpoint: GET /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key for the custom attribute + * @param key the key for the custom attribute * @return a CustomAttribute instance for the specified key * @throws GitLabApiException if any exception occurs */ public CustomAttribute getCustomAttribute(final Object projectIdOrPath, final String key) throws GitLabApiException { - Response response = get(Response.Status.OK, null, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); + Response response = get(Response.Status.OK, null, + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); } @@ -3781,7 +3754,7 @@ public CustomAttribute getCustomAttribute(final Object projectIdOrPath, final St *
GitLab Endpoint: GET /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required - * @param key the key for the custom attribute, required + * @param key the key for the custom attribute, required * @return an Optional instance with the value for a single custom attribute for the specified project */ public Optional geOptionalCustomAttribute(final Object projectIdOrPath, final String key) { @@ -3799,8 +3772,8 @@ public Optional geOptionalCustomAttribute(final Object projectI *
GitLab Endpoint: PUT /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key for the custom attribute - * @param value the value for the customAttribute + * @param key the key for the custom attribute + * @param value the value for the customAttribute * @return a CustomAttribute instance for the updated or created custom attribute * @throws GitLabApiException if any exception occurs */ @@ -3815,7 +3788,7 @@ public CustomAttribute setCustomAttribute(final Object projectIdOrPath, final St GitLabApiForm formData = new GitLabApiForm().withParam("value", value); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); + "projects", getProjectIdOrPath(projectIdOrPath), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); } @@ -3825,7 +3798,7 @@ public CustomAttribute setCustomAttribute(final Object projectIdOrPath, final St *
GitLab Endpoint: DELETE /projects/:id/custom_attributes/:key
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param key the key of the custom attribute to delete + * @param key the key of the custom attribute to delete * @throws GitLabApiException if any exception occurs */ public void deleteCustomAttribute(final Object projectIdOrPath, final String key) throws GitLabApiException { @@ -3856,13 +3829,13 @@ public List getRemoteMirrors(final Object projectIdOrPath) throws *
GitLab Endpoint: GET /projects/:id/remote_mirrors
* * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param itemsPerPage the number of items per page + * @param itemsPerPage the number of items per page * @return a Pager of project's remote mirrors * @throws GitLabApiException if any exception occurs */ public Pager getRemoteMirrors(final Object projectIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager(this, RemoteMirror.class, itemsPerPage, null, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors")); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors")); } /** @@ -3884,23 +3857,23 @@ public Stream getRemoteMirrorsStream(final Object projectIdOrPath) * *
GitLab Endpoint: POST /projects/:id/remote_mirrors
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param url the URL of the remote repository to be mirrored - * @param enabled determines if the mirror is enabled + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param url the URL of the remote repository to be mirrored + * @param enabled determines if the mirror is enabled * @param onlyProtectedBranches determines if only protected branches are mirrored - * @param keepDivergentRefs determines if divergent refs are skipped + * @param keepDivergentRefs determines if divergent refs are skipped * @return a RemoteMirror instance with remote mirror configuration * @throws GitLabApiException if any exception occurs */ public RemoteMirror createRemoteMirror(Object projectIdOrPath, String url, Boolean enabled, - Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { + Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() - .withParam("url", url, true) - .withParam("enabled", enabled) - .withParam("only_protected_branches", onlyProtectedBranches) - .withParam("keep_divergent_refs", keepDivergentRefs); + .withParam("url", url, true) + .withParam("enabled", enabled) + .withParam("only_protected_branches", onlyProtectedBranches) + .withParam("keep_divergent_refs", keepDivergentRefs); Response response = post(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors"); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors"); return (response.readEntity(RemoteMirror.class)); } @@ -3909,23 +3882,23 @@ public RemoteMirror createRemoteMirror(Object projectIdOrPath, String url, Boole * *
GitLab Endpoint: PUT /projects/:id/remote_mirrors/:mirror_id
* - * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance - * @param mirrorId the ID of the remote mirror - * @param enabled determines if the mirror is enabled + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param mirrorId the ID of the remote mirror + * @param enabled determines if the mirror is enabled * @param onlyProtectedBranches determines if only protected branches are mirrored - * @param keepDivergentRefs determines if divergent refs are skipped + * @param keepDivergentRefs determines if divergent refs are skipped * @return a RemoteMirror instance with the updated remote mirror configuration * @throws GitLabApiException if any exception occurs */ public RemoteMirror updateRemoteMirror(Object projectIdOrPath, Long mirrorId, Boolean enabled, - Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { + Boolean onlyProtectedBranches, Boolean keepDivergentRefs) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm() - .withParam("enabled", enabled) - .withParam("only_protected_branches", onlyProtectedBranches) - .withParam("keep_divergent_refs", keepDivergentRefs); + GitLabApiForm formData = new GitLabApiForm() + .withParam("enabled", enabled) + .withParam("only_protected_branches", onlyProtectedBranches) + .withParam("keep_divergent_refs", keepDivergentRefs); Response response = putWithFormData(Response.Status.OK, formData, - "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors", mirrorId); + "projects", getProjectIdOrPath(projectIdOrPath), "remote_mirrors", mirrorId); return (response.readEntity(RemoteMirror.class)); } } diff --git a/src/main/java/org/gitlab4j/api/models/ProjectFilter.java b/src/main/java/org/gitlab4j/api/models/ProjectFilter.java index a966349f5..748cd5579 100644 --- a/src/main/java/org/gitlab4j/api/models/ProjectFilter.java +++ b/src/main/java/org/gitlab4j/api/models/ProjectFilter.java @@ -35,6 +35,9 @@ public class ProjectFilter { private Date lastActivityAfter; private Date lastActivityBefore; private String repositoryStorage; + private Boolean imported; + private String topic; + private Integer topic_id; /** * Limit by archived status. @@ -305,6 +308,39 @@ public ProjectFilter withRepositoryStorage(String repositoryStorage) { return (this); } + /** + * Limit results to projects which were imported from external systems by current user. + * + * @param imported limit results to projects imported from external systems by current user + * @return the reference to this ProjectFilter instance + */ + public ProjectFilter withImported(Boolean imported){ + this.imported = imported; + return (this); + } + + /** + * Limit results to projects that match all of given topics. + * + * @param topic Comma-separated topic names. + * @return the reference to this ProjectFilter instance + */ + public ProjectFilter withTopic(String topic){ + this.topic = topic; + return (this); + } + + /** + * Limit results to projects with the assigned topic given by the topic ID. + * + * @param topic_id the topic ID + * @return the reference to this ProjectFilter instance + */ + public ProjectFilter withTopicId(Integer topic_id){ + this.topic_id = topic_id; + return (this); + } + /** * Get the query params specified by this filter. * @@ -348,6 +384,9 @@ public GitLabApiForm getQueryParams() { .withParam("last_activity_after", lastActivityAfter) .withParam("last_activity_before", lastActivityBefore) .withParam("repository_storage", repositoryStorage) + .withParam("imported",imported) + .withParam("topic",topic) + .withParam("topic_id",topic_id) ); } } diff --git a/src/test/java/org/gitlab4j/api/TestProjectApi.java b/src/test/java/org/gitlab4j/api/TestProjectApi.java index feadd5e4d..43dfcc3a5 100644 --- a/src/test/java/org/gitlab4j/api/TestProjectApi.java +++ b/src/test/java/org/gitlab4j/api/TestProjectApi.java @@ -310,7 +310,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithParams() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true,null,null); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -336,7 +336,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithStatistics() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, null, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, false, false, false, false, true,null,null); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, false, false, false, false, true); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -353,7 +353,7 @@ public void testListProjectsWithStatistics() throws GitLabApiException { public void testListProjectsWithParamsViaPager() throws GitLabApiException { Pager pager = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, null,null,10); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, 10); assertNotNull(pager); assertTrue(pager.getTotalItems() >= 2); @@ -379,7 +379,7 @@ else if (TEST_PROJECT_NAME_2.equals(project.getName())) public void testListProjectsWithParamByPage() throws GitLabApiException { List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true,null,null, 1, 10); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, null, true, true, true, false, true, 1, 10); assertNotNull(projects); assertTrue(projects.size() >= 2); @@ -434,7 +434,7 @@ public void testListStarredProjectsWithParams() throws GitLabApiException { } List projects = gitLabApi.getProjectApi().getProjects(false, Visibility.PUBLIC, - Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, TEST_PROJECT_NAME, true, true, true, true, true,null,null); + Constants.ProjectOrderBy.NAME, Constants.SortOrder.DESC, TEST_PROJECT_NAME, true, true, true, true, true); try { gitLabApi.getProjectApi().unstarProject(testProject); From 1cb36853bd56316acf99b6b7fbf9f48e4c094a5a Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Wed, 16 Aug 2023 08:47:58 +0200 Subject: [PATCH 6/9] Topic improvements --- .../java/org/gitlab4j/api/ProjectApi.java | 16 +++++++ src/main/java/org/gitlab4j/api/TopicsApi.java | 37 ++++++++++++-- .../java/org/gitlab4j/api/models/Topic.java | 20 ++++---- .../org/gitlab4j/api/models/TopicParams.java | 6 +-- .../org/gitlab4j/api/TestGitLabApiBeans.java | 7 +++ .../java/org/gitlab4j/api/TestTopicsApi.java | 48 +++++++++++++++++++ .../resources/org/gitlab4j/api/topic.json | 8 ++++ 7 files changed, 122 insertions(+), 20 deletions(-) create mode 100644 src/test/java/org/gitlab4j/api/TestTopicsApi.java create mode 100644 src/test/resources/org/gitlab4j/api/topic.json diff --git a/src/main/java/org/gitlab4j/api/ProjectApi.java b/src/main/java/org/gitlab4j/api/ProjectApi.java index 848f6bdca..45ce7c710 100644 --- a/src/main/java/org/gitlab4j/api/ProjectApi.java +++ b/src/main/java/org/gitlab4j/api/ProjectApi.java @@ -1043,6 +1043,10 @@ public Project createProject(Project project, String importUrl) throws GitLabApi if (project.getTagList() != null && !project.getTagList().isEmpty()) { throw new IllegalArgumentException("GitLab API v3 does not support tag lists when creating projects"); } + + if (project.getTopics() != null && !project.getTopics().isEmpty()) { + throw new IllegalArgumentException("GitLab API v3 does not support topics when creating projects"); + } } else { Visibility visibility = (project.getVisibility() != null ? project.getVisibility() : project.getPublic() == Boolean.TRUE ? Visibility.PUBLIC : null); @@ -1051,6 +1055,10 @@ public Project createProject(Project project, String importUrl) throws GitLabApi if (project.getTagList() != null && !project.getTagList().isEmpty()) { formData.withParam("tag_list", String.join(",", project.getTagList())); } + + if (project.getTopics() != null && !project.getTopics().isEmpty()) { + formData.withParam("topics", String.join(",", project.getTopics())); + } } Response response = post(Response.Status.CREATED, formData, "projects"); @@ -1314,6 +1322,10 @@ public Project updateProject(Project project) throws GitLabApiException { if (project.getTagList() != null && !project.getTagList().isEmpty()) { throw new IllegalArgumentException("GitLab API v3 does not support tag lists when updating projects"); } + + if (project.getTopics() != null && !project.getTopics().isEmpty()) { + throw new IllegalArgumentException("GitLab API v3 does not support topics when updating projects"); + } } else { Visibility visibility = (project.getVisibility() != null ? project.getVisibility() : project.getPublic() == Boolean.TRUE ? Visibility.PUBLIC : null); @@ -1322,6 +1334,10 @@ public Project updateProject(Project project) throws GitLabApiException { if (project.getTagList() != null && !project.getTagList().isEmpty()) { formData.withParam("tag_list", String.join(",", project.getTagList())); } + + if (project.getTopics() != null && !project.getTopics().isEmpty()) { + formData.withParam("topics", String.join(",", project.getTopics())); + } } Response response = putWithFormData(Response.Status.OK, formData, "projects", projectIdentifier); diff --git a/src/main/java/org/gitlab4j/api/TopicsApi.java b/src/main/java/org/gitlab4j/api/TopicsApi.java index e85448291..0eceba36d 100644 --- a/src/main/java/org/gitlab4j/api/TopicsApi.java +++ b/src/main/java/org/gitlab4j/api/TopicsApi.java @@ -29,7 +29,6 @@ public TopicsApi(GitLabApi gitLabApi) { * @throws GitLabApiException if any exception occurs */ public List getTopics() throws GitLabApiException { - return (getTopics(getDefaultPerPage()).all()); } @@ -132,6 +131,7 @@ public Topic updateTopic(Integer id, TopicParams params) throws GitLabApiExcepti params.getForm(false), "topics", id); return (response.readEntity(Topic.class)); } + /** * Uploads and sets the topic's avatar for the specified topic. * @@ -147,6 +147,28 @@ public Topic updateTopicAvatar(final Integer id, File avatarFile) throws GitLabA return (response.readEntity(Topic.class)); } + /** + * Delete the topic's avatar for the specified topic. + * + *
PUT /topics/:id
+ * + * @param id the topic in the form of an Integer + * @return the updated Topic instance + * @throws GitLabApiException if any exception occurs + */ + public Topic deleteTopicAvatar(final Integer id) throws GitLabApiException { + Response response = putUpload(Response.Status.OK, "avatar", null, "topics", id); + return (response.readEntity(Topic.class)); + } + + /** + * You must be an administrator to delete a project topic. When you delete a project topic, you also delete the topic assignment for projects. + * + *
DELETE /topics/:id
+ * + * @param id the topic in the form of an Integer + * @throws GitLabApiException if any exception occurs + */ public void deleteTopic(Integer id) throws GitLabApiException { if(isApiVersion(GitLabApi.ApiVersion.V3)){ throw new GitLabApiException("Topics need api v4+"); @@ -154,12 +176,17 @@ public void deleteTopic(Integer id) throws GitLabApiException { delete(Response.Status.NO_CONTENT,null, "topics", id); } - - + /** + * You must be an administrator to merge a source topic into a target topic. When you merge topics, you delete the source topic and move all assigned projects to the target topic. + * + *
DELETE /topics/:id
+ * + * @param sourceTopicId ID of source project topic + * @param targetTopicId ID of target project topic + * @throws GitLabApiException if any exception occurs + */ public Topic mergeTopics(Integer sourceTopicId, Integer targetTopicId) throws GitLabApiException { Response response = post(Response.Status.OK,new GitLabApiForm().withParam("source_topic_id",sourceTopicId).withParam("target_topic_id",targetTopicId),"topics/merge"); return (response.readEntity(Topic.class)); } - - } diff --git a/src/main/java/org/gitlab4j/api/models/Topic.java b/src/main/java/org/gitlab4j/api/models/Topic.java index d0d686c9f..667723ba6 100644 --- a/src/main/java/org/gitlab4j/api/models/Topic.java +++ b/src/main/java/org/gitlab4j/api/models/Topic.java @@ -12,9 +12,9 @@ public class Topic { private String description; - private int total_projects_count; + private int totalProjectsCount; - private String avatar_url; + private String avatarUrl; public Integer getId() { return id; @@ -48,20 +48,20 @@ public void setDescription(String description) { this.description = description; } - public int getTotal_projects_count() { - return total_projects_count; + public int getTotalProjectsCount() { + return totalProjectsCount; } - public void setTotal_projects_count(int total_projects_count) { - this.total_projects_count = total_projects_count; + public void setTotalProjectsCount(int totalProjectsCount) { + this.totalProjectsCount = totalProjectsCount; } - public String getAvatar_url() { - return avatar_url; + public String getAvatarUrl() { + return avatarUrl; } - public void setAvatar_url(String avatar_url) { - this.avatar_url = avatar_url; + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; } @Override diff --git a/src/main/java/org/gitlab4j/api/models/TopicParams.java b/src/main/java/org/gitlab4j/api/models/TopicParams.java index 2045c2804..e3513489c 100644 --- a/src/main/java/org/gitlab4j/api/models/TopicParams.java +++ b/src/main/java/org/gitlab4j/api/models/TopicParams.java @@ -10,7 +10,7 @@ * and {@link TopicsApi#updateTopic(Integer, TopicParams)} methods to set * the parameters for the call to the GitLab API. * - * Avatar Upload has its own Upload in {@link TopicsApi#setTopicAvatar(Integer,File)} + * Avatar Upload has its own Upload in {@link TopicsApi#updateTopicAvatar(Integer,File)} */ public class TopicParams { @@ -18,8 +18,6 @@ public class TopicParams { private String title; private String description; - - public TopicParams withName(String name) { this.name = name; return (this); @@ -35,8 +33,6 @@ public TopicParams withDescription(String description) { return (this); } - - /** * Get the form params for a group create oir update call. * diff --git a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java index 7e8de8d16..49f48d135 100644 --- a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java +++ b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java @@ -117,6 +117,7 @@ import org.gitlab4j.api.models.SystemHook; import org.gitlab4j.api.models.Tag; import org.gitlab4j.api.models.Todo; +import org.gitlab4j.api.models.Topic; import org.gitlab4j.api.models.TreeItem; import org.gitlab4j.api.models.Trigger; import org.gitlab4j.api.models.User; @@ -735,6 +736,12 @@ public void testTodos() throws Exception { assertTrue(compareJson(todos, "todos.json")); } + @Test + public void testTopic() throws Exception { + Topic topic = unmarshalResource(Topic.class, "topic.json"); + assertTrue(compareJson(topic, "topic.json")); + } + @Test public void testTree() throws Exception { List tree = unmarshalResourceList(TreeItem.class, "tree.json"); diff --git a/src/test/java/org/gitlab4j/api/TestTopicsApi.java b/src/test/java/org/gitlab4j/api/TestTopicsApi.java new file mode 100644 index 000000000..6f3d32d3d --- /dev/null +++ b/src/test/java/org/gitlab4j/api/TestTopicsApi.java @@ -0,0 +1,48 @@ +package org.gitlab4j.api; + +import static org.gitlab4j.api.JsonUtils.compareJson; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import static org.mockito.MockitoAnnotations.openMocks; + +import java.io.IOException; + +import javax.ws.rs.core.MultivaluedMap; + +import org.gitlab4j.api.models.Topic; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; + +public class TestTopicsApi implements Constants { + + @Mock private GitLabApi gitLabApi; + @Mock private GitLabApiClient gitLabApiClient; + @Captor private ArgumentCaptor> attributeCaptor; + private MockResponse response; + + @BeforeEach + public void setUp() throws Exception { + openMocks(this); + } + + @Test + public void testGetTopic() throws Exception { + initGetTopic(); + Topic result = new TopicsApi(gitLabApi).getTopic(1); + assertNotNull(result); + assertTrue(compareJson(result, "topic.json")); + } + + private void initGetTopic() throws Exception, IOException { + response = new MockResponse(Topic.class, "topic.json", null); + when(gitLabApi.getApiClient()).thenReturn(gitLabApiClient); + when(gitLabApiClient.validateSecretToken(any())).thenReturn(true); + when(gitLabApiClient.get(attributeCaptor.capture(), Mockito.any())).thenReturn(response); + } +} diff --git a/src/test/resources/org/gitlab4j/api/topic.json b/src/test/resources/org/gitlab4j/api/topic.json new file mode 100644 index 000000000..2975782f6 --- /dev/null +++ b/src/test/resources/org/gitlab4j/api/topic.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "name": "gitlab", + "title": "GitLab", + "description": "GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more.", + "total_projects_count": 1000, + "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon" +} From a543024fc2ce455149dd3ce4bec658f60087dc7d Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Mon, 21 Aug 2023 11:56:00 +0200 Subject: [PATCH 7/9] Fix Javadoc --- src/main/java/org/gitlab4j/api/TopicsApi.java | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/gitlab4j/api/TopicsApi.java b/src/main/java/org/gitlab4j/api/TopicsApi.java index 0eceba36d..e8bff8506 100644 --- a/src/main/java/org/gitlab4j/api/TopicsApi.java +++ b/src/main/java/org/gitlab4j/api/TopicsApi.java @@ -33,13 +33,13 @@ public List getTopics() throws GitLabApiException { } /** - * Get a list of topics (As user: my , as admin: all groups) and in the specified page range. + * Get a list of topics in the specified page range. * *
GitLab Endpoint: GET /topics
* * @param page the page to get * @param perPage the number of Group instances per page - * @return the list of groups viewable by the authenticated userin the specified page range + * @return the list of topics * @throws GitLabApiException if any exception occurs */ public List getTopics(int page, int perPage) throws GitLabApiException { @@ -48,12 +48,12 @@ public List getTopics(int page, int perPage) throws GitLabApiException { } /** - * Get a Pager of groups. (As user: my groups, as admin: all groups) + * Get a Pager of topics. * *
GitLab Endpoint: GET /topics
* * @param itemsPerPage the number of Group instances that will be fetched per page - * @return the list of groups viewable by the authenticated user + * @return the pager of topics * @throws GitLabApiException if any exception occurs */ public Pager getTopics(int itemsPerPage) throws GitLabApiException { @@ -61,11 +61,11 @@ public Pager getTopics(int itemsPerPage) throws GitLabApiException { } /** - * Get a Stream of groups. (As user: my groups, as admin: all groups) + * Get a Stream of topics. * *
GitLab Endpoint: GET /topics
* - * @return a Stream of groups viewable by the authenticated user + * @return the stream of topics * @throws GitLabApiException if any exception occurs */ public Stream getGroupsStream() throws GitLabApiException { @@ -73,12 +73,12 @@ public Stream getGroupsStream() throws GitLabApiException { } /** - * Get all details of a group. + * Get all details of a topic. * *
GitLab Endpoint: GET /topics/:id
* - * @param id the group ID, path of the group, or a Group instance holding the group ID or path - * @return the Group instance for the specified group path + * @param id the topic ID + * @return the topic for the specified topic id * @throws GitLabApiException if any exception occurs */ public Topic getTopic(Integer id) throws GitLabApiException { @@ -87,14 +87,14 @@ public Topic getTopic(Integer id) throws GitLabApiException { } /** - * Get all details of a group as an Optional instance. + * Get all details of a topic as an Optional instance. * *
GitLab Endpoint: GET /topics/:id
* * @param id the topic ID * @return the Topic for the specified topic id as an Optional instance */ - public Optional getOptionalGroup(Integer id) { + public Optional getOptionalTopic(Integer id) { try { return (Optional.ofNullable(getTopic(id))); } catch (GitLabApiException glae) { @@ -108,7 +108,7 @@ public Optional getOptionalGroup(Integer id) { *
GitLab Endpoint: POST /topics
* * @param params a TopicParams instance holding the parameters for the topic creation - * @return the created Group instance + * @return the created Topic instance * @throws GitLabApiException if any exception occurs */ public Topic createTopic(TopicParams params) throws GitLabApiException { @@ -117,13 +117,13 @@ public Topic createTopic(TopicParams params) throws GitLabApiException { } /** - * Updates the project group. Only available to group owners and administrators. + * Update a project topic. * - *
GitLab Endpoint: PUT /groups
+ *
GitLab Endpoint: PUT /topics/:id
* - * @param id the topic I + * @param id the topic id * @param params a TopicParams instance holding the properties to Update - * @return updated Group instance + * @return the updated Topic instance * @throws GitLabApiException at any exception */ public Topic updateTopic(Integer id, TopicParams params) throws GitLabApiException { @@ -135,7 +135,7 @@ public Topic updateTopic(Integer id, TopicParams params) throws GitLabApiExcepti /** * Uploads and sets the topic's avatar for the specified topic. * - *
PUT /topics/:id
+ *
GitLab Endpoint: PUT /topics/:id
* * @param id the topic in the form of an Integer * @param avatarFile the File instance of the avatar file to upload @@ -150,7 +150,7 @@ public Topic updateTopicAvatar(final Integer id, File avatarFile) throws GitLabA /** * Delete the topic's avatar for the specified topic. * - *
PUT /topics/:id
+ *
GitLab Endpoint: PUT /topics/:id
* * @param id the topic in the form of an Integer * @return the updated Topic instance @@ -162,11 +162,11 @@ public Topic deleteTopicAvatar(final Integer id) throws GitLabApiException { } /** - * You must be an administrator to delete a project topic. When you delete a project topic, you also delete the topic assignment for projects. + * Delete a topic. You must be an administrator to delete a project topic. When you delete a project topic, you also delete the topic assignment for projects. * - *
DELETE /topics/:id
+ *
GitLab Endpoint: DELETE /topics/:id
* - * @param id the topic in the form of an Integer + * @param id the topic to deleted in the form of an Integer * @throws GitLabApiException if any exception occurs */ public void deleteTopic(Integer id) throws GitLabApiException { @@ -177,12 +177,13 @@ public void deleteTopic(Integer id) throws GitLabApiException { } /** - * You must be an administrator to merge a source topic into a target topic. When you merge topics, you delete the source topic and move all assigned projects to the target topic. + * Merge two topics together. You must be an administrator to merge a source topic into a target topic. When you merge topics, you delete the source topic and move all assigned projects to the target topic. * - *
DELETE /topics/:id
+ *
GitLab Endpoint: POST /topics/merge
* * @param sourceTopicId ID of source project topic * @param targetTopicId ID of target project topic + * @return the merged Topic instance * @throws GitLabApiException if any exception occurs */ public Topic mergeTopics(Integer sourceTopicId, Integer targetTopicId) throws GitLabApiException { From 315d64ff9116e08e8d0dad15979537a98e446dc1 Mon Sep 17 00:00:00 2001 From: "F. Morgenstern" Date: Mon, 11 Sep 2023 16:55:50 +0200 Subject: [PATCH 8/9] Fix Javadoc. --- src/main/java/org/gitlab4j/api/TopicsApi.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gitlab4j/api/TopicsApi.java b/src/main/java/org/gitlab4j/api/TopicsApi.java index e8bff8506..c6d41ca93 100644 --- a/src/main/java/org/gitlab4j/api/TopicsApi.java +++ b/src/main/java/org/gitlab4j/api/TopicsApi.java @@ -38,7 +38,7 @@ public List getTopics() throws GitLabApiException { *
GitLab Endpoint: GET /topics
* * @param page the page to get - * @param perPage the number of Group instances per page + * @param perPage the number of Topic instances per page * @return the list of topics * @throws GitLabApiException if any exception occurs */ @@ -52,7 +52,7 @@ public List getTopics(int page, int perPage) throws GitLabApiException { * *
GitLab Endpoint: GET /topics
* - * @param itemsPerPage the number of Group instances that will be fetched per page + * @param itemsPerPage the number of Topic instances that will be fetched per page * @return the pager of topics * @throws GitLabApiException if any exception occurs */ @@ -68,7 +68,7 @@ public Pager getTopics(int itemsPerPage) throws GitLabApiException { * @return the stream of topics * @throws GitLabApiException if any exception occurs */ - public Stream getGroupsStream() throws GitLabApiException { + public Stream getTopicsStream() throws GitLabApiException { return (getTopics(getDefaultPerPage()).stream()); } From 1cb014c7931bc6444c47cd4fef6a5d39de56a6d4 Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Mon, 18 Sep 2023 13:58:58 +0200 Subject: [PATCH 9/9] Fix upload with "null" --- src/main/java/org/gitlab4j/api/GitLabApiClient.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab4j/api/GitLabApiClient.java b/src/main/java/org/gitlab4j/api/GitLabApiClient.java index 791c2e63a..ea11c8119 100755 --- a/src/main/java/org/gitlab4j/api/GitLabApiClient.java +++ b/src/main/java/org/gitlab4j/api/GitLabApiClient.java @@ -41,6 +41,7 @@ import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.media.multipart.BodyPart; import org.glassfish.jersey.media.multipart.Boundary; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; import org.glassfish.jersey.media.multipart.FormDataMultiPart; import org.glassfish.jersey.media.multipart.MultiPart; import org.glassfish.jersey.media.multipart.MultiPartFeature; @@ -691,7 +692,11 @@ protected Response putUpload(String name, File fileToUpload, Object... pathArgs) protected Response putUpload(String name, File fileToUpload, URL url) throws IOException { try (MultiPart multiPart = new FormDataMultiPart()) { - multiPart.bodyPart(new FileDataBodyPart(name, fileToUpload, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + if(fileToUpload == null) { + multiPart.bodyPart(new FormDataBodyPart(name, "", MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + multiPart.bodyPart(new FileDataBodyPart(name, fileToUpload, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } final Entity entity = Entity.entity(multiPart, Boundary.addBoundary(multiPart.getMediaType())); return (invocation(url, null).put(entity)); }