diff --git a/README.md b/README.md index 22fd2125f..6713f6cb3 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ You can also point to a specific commit: ```gradle dependencies { - implementation 'com.github.gitlab4j:gitlab4j-api:6561c93aaf' + implementation 'com.github.gitlab4j:gitlab4j-api:7dfec10189' } ``` @@ -127,12 +127,36 @@ dependencies { com.github.gitlab4j gitlab4j-api - 6561c93aaf + 7dfec10189 ``` ```java -//DEPS https://github.com/gitlab4j/gitlab4j-api/tree/6561c93aafa6bf35cb9bad0617127a0c249a8f9f +//DEPS https://github.com/gitlab4j/gitlab4j-api/tree/7dfec10189cdcb11e34fc9ead984abcd6316194a +``` + +--- + +### **Models jar** + +For some usages, the HTTP layer based on Jersey can't be used. +Those projects might want to use the Jackson-based model classes, and implement the REST call themself. + +**Gradle: build.gradle** +```java +dependencies { + ... + implementation 'org.gitlab4j:gitlab4j-models:6.0.0-rc.6' +} +``` + +**Maven: pom.xml** +```xml + + org.gitlab4j + gitlab4j-models + 6.0.0-rc.6 + ``` --- diff --git a/build.gradle b/build.gradle index 053aecef2..593b81764 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,5 @@ - plugins { - id 'java-library' - id 'com.diffplug.spotless' version '6.25.0' - id 'signing' - id 'maven-publish' + id 'com.diffplug.spotless' version '6.25.0' apply false id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' id 'net.researchgate.release' version '3.0.2' } @@ -12,58 +8,52 @@ wrapper { gradleVersion = '7.6.2' } -group = 'org.gitlab4j' - -dependencies { - api 'jakarta.activation:jakarta.activation-api:2.1.1' - api 'org.glassfish.jersey.inject:jersey-hk2:3.1.1' - api 'org.glassfish.jersey.core:jersey-client:3.1.1' - api 'org.glassfish.jersey.connectors:jersey-apache-connector:3.1.1' - api 'org.glassfish.jersey.media:jersey-media-multipart:3.1.1' - api 'org.glassfish.jersey.media:jersey-media-json-jackson:3.1.1' - api 'jakarta.servlet:jakarta.servlet-api:6.0.0' - testImplementation 'org.mockito:mockito-core:5.2.0' - testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0' - testImplementation 'org.hamcrest:hamcrest-all:1.3' - testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.0.2' - testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.4" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.4" -} +String groupId = 'org.gitlab4j' -signing { - useGpgCmd() - sign(publishing.publications) -} +subprojects { + apply plugin: 'java-library' + apply plugin: 'signing' + apply plugin: 'com.diffplug.spotless' + apply plugin: 'maven-publish' -tasks.withType(Sign) { - onlyIf { - project.hasProperty('signing.gnupg.keyName') + group = groupId + + signing { + useGpgCmd() + sign(publishing.publications) } -} -java { - withJavadocJar() - withSourcesJar() + tasks.withType(Sign) { + onlyIf { + project.hasProperty('signing.gnupg.keyName') + } + } + + java { + withJavadocJar() + withSourcesJar() - compileJava.options.encoding = "UTF-8" - toolchain { - languageVersion = JavaLanguageVersion.of(11) + compileJava.options.encoding = "UTF-8" + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } } -} -tasks.named('test') { - useJUnitPlatform() -} + spotless { + java { + palantirJavaFormat() + importOrder 'java', 'javax', 'jakarta', 'org', 'com', '' + removeUnusedImports() + } + } -repositories { - mavenCentral() -} + repositories { + // mavenLocal() + mavenCentral() + } -spotless { - java { - palantirJavaFormat() - importOrder 'java', 'javax', 'jakarta', 'org', 'com', '' - removeUnusedImports() + tasks.named('test') { + useJUnitPlatform() } } @@ -78,51 +68,10 @@ nexusPublishing { } } -publishing { - publications { - mavenJava(MavenPublication) { - pom { - name = 'GitLab4J-API - GitLab API Java Client' - description = 'GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.' - packaging = 'jar' - url = 'https://' + "$githubRepositoryOwner" + '.github.io/' + "$githubRepositoryName" + '/' - licenses { - license { - name = 'The MIT License (MIT)' - url = 'http://opensource.org/licenses/MIT' - distribution = 'repo' - } - } - developers { - developer { - id = 'gmessner' - name = 'Greg Messner' - email = 'greg@messners.com' - } - developer { - id = 'gdesaintmartinlacaze' - name = 'Gautier de Saint Martin Lacaze' - email = 'gautier@jabby-techs.fr' - } - developer { - url = 'https://github.com/orgs/' + "$githubRepositoryOwner" + '/people' - } - } - scm { - connection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' - developerConnection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' - url = 'https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '/' - } - } - from components.java - } - } -} - release { buildTasks = ['doRelease'] git { - requireBranch.set('6.x') + requireBranch.set('main') } } @@ -147,13 +96,13 @@ def updateLastVersionValueTask = tasks.register('updateLastVersionValue') { } } -tasks.register('doRelease') { +task doRelease { dependsOn( - checkLastVersionValueTask, - 'initializeSonatypeStagingRepository', - 'clean', - 'build', - project.getTasksByName('publishToSonatype', true) + checkLastVersionValueTask, + 'initializeSonatypeStagingRepository', + 'clean', + 'build', + project.getTasksByName('publishToSonatype', true) ) } diff --git a/gitlab4j-api/build.gradle b/gitlab4j-api/build.gradle new file mode 100644 index 000000000..e1bf48f86 --- /dev/null +++ b/gitlab4j-api/build.gradle @@ -0,0 +1,57 @@ +dependencies { + api project(':gitlab4j-models') + api 'jakarta.activation:jakarta.activation-api:2.1.1' + api 'org.glassfish.jersey.inject:jersey-hk2:3.1.1' + api 'org.glassfish.jersey.core:jersey-client:3.1.1' + api 'org.glassfish.jersey.connectors:jersey-apache-connector:3.1.1' + api 'org.glassfish.jersey.media:jersey-media-multipart:3.1.1' + api 'org.glassfish.jersey.media:jersey-media-json-jackson:3.1.1' + api 'jakarta.servlet:jakarta.servlet-api:6.0.0' + testImplementation 'org.mockito:mockito-core:5.2.0' + testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0' + testImplementation 'org.hamcrest:hamcrest-all:1.3' + testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.0.2' + testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.4" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.4" +} + +publishing { + publications { + mavenJava(MavenPublication) { + pom { + name = 'GitLab4J-API - GitLab API Java Client' + description = 'GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.' + packaging = 'jar' + url = 'https://' + "$githubRepositoryOwner" + '.github.io/' + "$githubRepositoryName" + '/' + licenses { + license { + name = 'The MIT License (MIT)' + url = 'http://opensource.org/licenses/MIT' + distribution = 'repo' + } + } + developers { + developer { + id = 'gmessner' + name = 'Greg Messner' + email = 'greg@messners.com' + } + developer { + id = 'gdesaintmartinlacaze' + name = 'Gautier de Saint Martin Lacaze' + email = 'gautier@jabby-techs.fr' + } + developer { + url = 'https://github.com/orgs/' + "$githubRepositoryOwner" + '/people' + } + } + scm { + connection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' + developerConnection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' + url = 'https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '/' + } + } + from components.java + } + } +} diff --git a/src/main/java/org/gitlab4j/api/AbstractApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/AbstractApi.java similarity index 97% rename from src/main/java/org/gitlab4j/api/AbstractApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/AbstractApi.java index 18875281e..5ba97f25b 100644 --- a/src/main/java/org/gitlab4j/api/AbstractApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/AbstractApi.java @@ -17,6 +17,8 @@ import org.gitlab4j.api.models.Project; import org.gitlab4j.api.models.User; import org.gitlab4j.api.utils.UrlEncoder; +import org.gitlab4j.models.Constants; +import org.gitlab4j.models.GitLabForm; /** * This class is the base class for all the sub API classes. It provides implementations of @@ -621,6 +623,25 @@ protected Response putWithFormData(Response.Status expectedStatus, Form formData } } + /** + * Perform an HTTP PUT call with the specified form data and path objects, returning + * a ClientResponse instance with the data returned from the endpoint. + * + * @param expectedStatus the HTTP status that should be returned from the server + * @param form the Form containing the name/value pairs for the POST data + * @param pathArgs variable list of arguments used to build the URI + * @return a ClientResponse instance with the data returned from the endpoint + * @throws GitLabApiException if any exception occurs during execution + */ + protected Response putWithFormData(Response.Status expectedStatus, GitLabForm form, Object... pathArgs) + throws GitLabApiException { + try { + return validate(getApiClient().put(new GitLabApiForm(form), pathArgs), expectedStatus); + } catch (Exception e) { + throw handle(e); + } + } + /** * Perform a file upload using the HTTP PUT method with the specified File instance and path objects, * returning a ClientResponse instance with the data returned from the endpoint. diff --git a/src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java index 518849af9..d978b1d60 100644 --- a/src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java @@ -7,7 +7,7 @@ import org.gitlab4j.api.models.ApplicationSettings; import org.gitlab4j.api.models.Setting; -import org.gitlab4j.api.utils.ISO8601; +import org.gitlab4j.models.utils.ISO8601; import com.fasterxml.jackson.databind.JsonNode; diff --git a/src/main/java/org/gitlab4j/api/ApplicationsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/ApplicationsApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/ApplicationsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/ApplicationsApi.java diff --git a/src/main/java/org/gitlab4j/api/AuditEventApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/AuditEventApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/AuditEventApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/AuditEventApi.java index 0970e45f1..e2c019e4e 100644 --- a/src/main/java/org/gitlab4j/api/AuditEventApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/AuditEventApi.java @@ -8,7 +8,7 @@ import jakarta.ws.rs.core.Response; import org.gitlab4j.api.models.AuditEvent; -import org.gitlab4j.api.utils.ISO8601; +import org.gitlab4j.models.utils.ISO8601; /** * This class implements the client side API for the GitLab Instance Audit Event API. diff --git a/src/main/java/org/gitlab4j/api/AwardEmojiApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/AwardEmojiApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/AwardEmojiApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/AwardEmojiApi.java diff --git a/src/main/java/org/gitlab4j/api/BoardsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/BoardsApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/BoardsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/BoardsApi.java diff --git a/src/main/java/org/gitlab4j/api/CommitsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/CommitsApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/CommitsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/CommitsApi.java index a40e371d5..4424c12a8 100644 --- a/src/main/java/org/gitlab4j/api/CommitsApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/CommitsApi.java @@ -23,7 +23,7 @@ import org.gitlab4j.api.models.Diff; import org.gitlab4j.api.models.GpgSignature; import org.gitlab4j.api.models.MergeRequest; -import org.gitlab4j.api.utils.ISO8601; +import org.gitlab4j.models.utils.ISO8601; /** * This class implements the client side API for the GitLab commits calls. @@ -577,8 +577,9 @@ public List getCommitStatuses( throw new RuntimeException("sha cannot be null"); } - MultivaluedMap queryParams = - (filter != null ? filter.getQueryParams(page, perPage).asMap() : getPageQueryParams(page, perPage)); + MultivaluedMap queryParams = (filter != null + ? new GitLabApiForm(filter.getQueryParams(page, perPage)).asMap() + : getPageQueryParams(page, perPage)); Response response = get( Response.Status.OK, queryParams, @@ -615,7 +616,7 @@ public Pager getCommitStatuses( } MultivaluedMap queryParams = - (filter != null ? filter.getQueryParams().asMap() : null); + (filter != null ? new GitLabApiForm(filter.getQueryParams()).asMap() : null); return (new Pager( this, CommitStatus.class, diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/Constants.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/Constants.java new file mode 100644 index 000000000..2cd15012d --- /dev/null +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/Constants.java @@ -0,0 +1,7 @@ +package org.gitlab4j.api; + +/** + * @deprecated use {@link org.gitlab4j.models.Constants} instead. + */ +@Deprecated +public interface Constants extends org.gitlab4j.models.Constants {} diff --git a/src/main/java/org/gitlab4j/api/ContainerRegistryApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/ContainerRegistryApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/ContainerRegistryApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/ContainerRegistryApi.java diff --git a/src/main/java/org/gitlab4j/api/DeployKeysApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/DeployKeysApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/DeployKeysApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/DeployKeysApi.java diff --git a/src/main/java/org/gitlab4j/api/DeployTokensApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/DeployTokensApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/DeployTokensApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/DeployTokensApi.java diff --git a/src/main/java/org/gitlab4j/api/DeploymentsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/DeploymentsApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/DeploymentsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/DeploymentsApi.java index dafde8189..55eff257e 100644 --- a/src/main/java/org/gitlab4j/api/DeploymentsApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/DeploymentsApi.java @@ -77,7 +77,7 @@ public Pager getProjectDeployments(Object projectIdOrPath, Deploymen */ public Pager getProjectDeployments(Object projectIdOrPath, DeploymentFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = (filter != null ? filter.getQueryParams() : new GitLabApiForm()); + GitLabApiForm formData = (filter != null ? new GitLabApiForm(filter.getQueryParams()) : new GitLabApiForm()); return (new Pager( this, Deployment.class, diff --git a/src/main/java/org/gitlab4j/api/DiscussionsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/DiscussionsApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/DiscussionsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/DiscussionsApi.java diff --git a/src/main/java/org/gitlab4j/api/EnvironmentsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/EnvironmentsApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/EnvironmentsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/EnvironmentsApi.java diff --git a/src/main/java/org/gitlab4j/api/EpicsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/EpicsApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/EpicsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/EpicsApi.java index 75be34821..42d12946d 100644 --- a/src/main/java/org/gitlab4j/api/EpicsApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/EpicsApi.java @@ -9,7 +9,6 @@ import jakarta.ws.rs.core.GenericType; import jakarta.ws.rs.core.Response; -import org.gitlab4j.api.Constants.StateEvent; import org.gitlab4j.api.models.ChildEpic; import org.gitlab4j.api.models.CreatedChildEpic; import org.gitlab4j.api.models.Epic; @@ -210,7 +209,7 @@ public Pager getEpics(Object groupIdOrPath, int itemsPerPage, EpicFilter f this, Epic.class, itemsPerPage, - filter.getQueryParams().asMap(), + new GitLabApiForm(filter.getQueryParams()).asMap(), "groups", getGroupIdOrPath(groupIdOrPath), "epics")); diff --git a/src/main/java/org/gitlab4j/api/EventsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/EventsApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/EventsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/EventsApi.java diff --git a/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java diff --git a/src/main/java/org/gitlab4j/api/GitLabApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/GitLabApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApi.java index 55817f085..0a67ea01a 100644 --- a/src/main/java/org/gitlab4j/api/GitLabApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApi.java @@ -12,13 +12,13 @@ import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; -import org.gitlab4j.api.Constants.TokenType; import org.gitlab4j.api.models.OauthTokenResponse; import org.gitlab4j.api.models.User; import org.gitlab4j.api.models.Version; import org.gitlab4j.api.utils.MaskingLoggingFilter; import org.gitlab4j.api.utils.Oauth2LoginStreamingOutput; import org.gitlab4j.api.utils.SecretString; +import org.gitlab4j.models.Constants.TokenType; /** * This class is provides a simplified interface to a GitLab API server, and divides the API up into diff --git a/src/main/java/org/gitlab4j/api/GitLabApiClient.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiClient.java similarity index 99% rename from src/main/java/org/gitlab4j/api/GitLabApiClient.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiClient.java index 609466c50..55fbbf31c 100755 --- a/src/main/java/org/gitlab4j/api/GitLabApiClient.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiClient.java @@ -33,10 +33,10 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.StreamingOutput; -import org.gitlab4j.api.Constants.TokenType; import org.gitlab4j.api.GitLabApi.ApiVersion; import org.gitlab4j.api.utils.JacksonJson; import org.gitlab4j.api.utils.MaskingLoggingFilter; +import org.gitlab4j.models.Constants.TokenType; import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; diff --git a/src/main/java/org/gitlab4j/api/GitLabApiException.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiException.java similarity index 100% rename from src/main/java/org/gitlab4j/api/GitLabApiException.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiException.java diff --git a/src/main/java/org/gitlab4j/api/GitLabApiForm.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiForm.java similarity index 96% rename from src/main/java/org/gitlab4j/api/GitLabApiForm.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiForm.java index 7bda957c0..ecc1d2e1e 100644 --- a/src/main/java/org/gitlab4j/api/GitLabApiForm.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabApiForm.java @@ -10,7 +10,8 @@ import org.gitlab4j.api.models.AccessLevel; import org.gitlab4j.api.models.Variable; -import org.gitlab4j.api.utils.ISO8601; +import org.gitlab4j.models.GitLabForm; +import org.gitlab4j.models.utils.ISO8601; /** * This class extends the standard JAX-RS Form class to make it fluent. @@ -37,6 +38,13 @@ public GitLabApiForm(int page, int perPage) { withParam(AbstractApi.PER_PAGE_PARAM, (Integer) perPage); } + public GitLabApiForm(GitLabForm form) { + super(); + for (Entry e : form.getFormValues().entrySet()) { + this.param(e.getKey(), e.getValue()); + } + } + /** * Fluent method for adding query and form parameters to a get() or post() call. * diff --git a/src/main/java/org/gitlab4j/api/GitLabCiYamlApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabCiYamlApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/GitLabCiYamlApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GitLabCiYamlApi.java diff --git a/src/main/java/org/gitlab4j/api/GroupApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java similarity index 98% rename from src/main/java/org/gitlab4j/api/GroupApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java index 4a66faf6d..51888bf07 100644 --- a/src/main/java/org/gitlab4j/api/GroupApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java @@ -16,9 +16,29 @@ import jakarta.ws.rs.core.Response; import org.gitlab4j.api.GitLabApi.ApiVersion; -import org.gitlab4j.api.models.*; +import org.gitlab4j.api.models.AccessLevel; +import org.gitlab4j.api.models.AccessRequest; +import org.gitlab4j.api.models.AuditEvent; +import org.gitlab4j.api.models.Badge; +import org.gitlab4j.api.models.CustomAttribute; +import org.gitlab4j.api.models.Group; +import org.gitlab4j.api.models.GroupAccessToken; +import org.gitlab4j.api.models.GroupFilter; +import org.gitlab4j.api.models.GroupHook; +import org.gitlab4j.api.models.GroupHookParams; +import org.gitlab4j.api.models.GroupParams; +import org.gitlab4j.api.models.GroupProjectsFilter; import org.gitlab4j.api.models.ImpersonationToken.Scope; -import org.gitlab4j.api.utils.ISO8601; +import org.gitlab4j.api.models.Iteration; +import org.gitlab4j.api.models.IterationFilter; +import org.gitlab4j.api.models.LdapGroupLink; +import org.gitlab4j.api.models.Member; +import org.gitlab4j.api.models.Project; +import org.gitlab4j.api.models.SamlGroupLink; +import org.gitlab4j.api.models.UploadedFile; +import org.gitlab4j.api.models.Variable; +import org.gitlab4j.api.models.Visibility; +import org.gitlab4j.models.utils.ISO8601; /** * This class implements the client side API for the GitLab groups calls. @@ -175,7 +195,7 @@ public List getGroups(GroupFilter filter) throws GitLabApiException { * @throws GitLabApiException if any exception occurs */ public Pager getGroups(GroupFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); return (new Pager(this, Group.class, itemsPerPage, formData.asMap(), "groups")); } @@ -436,7 +456,7 @@ public List getDescendantGroups(Object groupIdOrPath, GroupFilter filter) */ public Pager getDescendantGroups(Object groupIdOrPath, GroupFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); return (new Pager( this, Group.class, @@ -488,7 +508,7 @@ public List getProjects(Object groupIdOrPath, GroupProjectsFilter filte */ public Pager getProjects(Object groupIdOrPath, GroupProjectsFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); return (new Pager( this, Project.class, @@ -2304,7 +2324,7 @@ public void deleteCustomAttribute(final Object groupIdOrPath, final String key) */ public List listGroupIterations(Object groupIdOrPath, IterationFilter filter) throws GitLabApiException { MultivaluedMap queryParams = - (filter == null) ? null : filter.getQueryParams().asMap(); + (filter == null) ? null : new GitLabApiForm(filter.getQueryParams()).asMap(); Response response = get(Response.Status.OK, queryParams, "groups", getGroupIdOrPath(groupIdOrPath), "iterations"); return (response.readEntity(new GenericType>() {})); diff --git a/src/main/java/org/gitlab4j/api/HealthCheckApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/HealthCheckApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/HealthCheckApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/HealthCheckApi.java diff --git a/src/main/java/org/gitlab4j/api/HookManager.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/HookManager.java similarity index 100% rename from src/main/java/org/gitlab4j/api/HookManager.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/HookManager.java diff --git a/src/main/java/org/gitlab4j/api/ImportExportApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/ImportExportApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/ImportExportApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/ImportExportApi.java diff --git a/src/main/java/org/gitlab4j/api/IssuesApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/IssuesApi.java similarity index 98% rename from src/main/java/org/gitlab4j/api/IssuesApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/IssuesApi.java index 7fca33125..918726cd3 100644 --- a/src/main/java/org/gitlab4j/api/IssuesApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/IssuesApi.java @@ -21,7 +21,8 @@ import org.gitlab4j.api.models.MergeRequest; import org.gitlab4j.api.models.Participant; import org.gitlab4j.api.models.TimeStats; -import org.gitlab4j.api.utils.DurationUtils; +import org.gitlab4j.models.Constants; +import org.gitlab4j.models.utils.DurationUtils; /** * This class provides an entry point to all the GitLab API Issue calls. @@ -177,7 +178,7 @@ public List getIssues(Object projectIdOrPath, IssueFilter filter) throws */ public List getIssues(Object projectIdOrPath, IssueFilter filter, int page, int perPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(page, perPage); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams(page, perPage)); Response response = get(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues"); return (response.readEntity(new GenericType>() {})); @@ -196,7 +197,7 @@ public List getIssues(Object projectIdOrPath, IssueFilter filter, int pag */ public Pager getIssues(Object projectIdOrPath, IssueFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); return (new Pager( this, Issue.class, @@ -248,7 +249,7 @@ public List getIssues(IssueFilter filter) throws GitLabApiException { * @throws GitLabApiException if any exception occurs */ public List getIssues(IssueFilter filter, int page, int perPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(page, perPage); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams(page, perPage)); Response response = get(Response.Status.OK, formData.asMap(), "issues"); return (response.readEntity(new GenericType>() {})); } @@ -265,7 +266,7 @@ public List getIssues(IssueFilter filter, int page, int perPage) throws G * @throws GitLabApiException if any exception occurs */ public Pager getIssues(IssueFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); return (new Pager(this, Issue.class, itemsPerPage, formData.asMap(), "issues")); } @@ -350,7 +351,7 @@ public List getGroupIssues(Object groupIdOrPath, IssueFilter filter) thro */ public Pager getGroupIssues(Object groupIdOrPath, IssueFilter filter, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = (filter != null ? filter.getQueryParams() : new GitLabApiForm()); + GitLabApiForm formData = (filter != null ? new GitLabApiForm(filter.getQueryParams()) : new GitLabApiForm()); return (new Pager( this, Issue.class, @@ -1251,7 +1252,7 @@ public Stream getParticipantsStream(Object projectIdOrPath, Long is * @throws GitLabApiException if any exception occurs */ public IssuesStatistics getIssuesStatistics(IssuesStatisticsFilter filter) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); Response response = get(Response.Status.OK, formData.asMap(), "issues_statistics"); return (response.readEntity(IssuesStatistics.class)); } @@ -1268,7 +1269,7 @@ public IssuesStatistics getIssuesStatistics(IssuesStatisticsFilter filter) throw */ public IssuesStatistics getGroupIssuesStatistics(Object groupIdOrPath, IssuesStatisticsFilter filter) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); Response response = get( Response.Status.OK, formData.asMap(), @@ -1290,7 +1291,7 @@ public IssuesStatistics getGroupIssuesStatistics(Object groupIdOrPath, IssuesSta */ public IssuesStatistics geProjectIssuesStatistics(Object projectIdOrPath, IssuesStatisticsFilter filter) throws GitLabApiException { - GitLabApiForm formData = filter.getQueryParams(); + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); Response response = get( Response.Status.OK, formData.asMap(), diff --git a/src/main/java/org/gitlab4j/api/JobApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java similarity index 99% rename from src/main/java/org/gitlab4j/api/JobApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java index f5d38f5b4..4271e2ddf 100644 --- a/src/main/java/org/gitlab4j/api/JobApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java @@ -18,6 +18,7 @@ import org.gitlab4j.api.models.ArtifactsFile; import org.gitlab4j.api.models.Job; import org.gitlab4j.api.models.JobAttributes; +import org.gitlab4j.models.Constants; /** * This class provides an entry point to all the GitLab API job calls. diff --git a/src/main/java/org/gitlab4j/api/KeysApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/KeysApi.java similarity index 100% rename from src/main/java/org/gitlab4j/api/KeysApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/KeysApi.java diff --git a/src/main/java/org/gitlab4j/api/LabelsApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/LabelsApi.java similarity index 98% rename from src/main/java/org/gitlab4j/api/LabelsApi.java rename to gitlab4j-api/src/main/java/org/gitlab4j/api/LabelsApi.java index 77e658d6a..7b431fb45 100644 --- a/src/main/java/org/gitlab4j/api/LabelsApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/LabelsApi.java @@ -113,7 +113,7 @@ public Optional