Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 6.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/gitlab4j/api/BoardsApi.java
#	src/main/java/org/gitlab4j/api/CommitsApi.java
#	src/main/java/org/gitlab4j/api/Constants.java
#	src/main/java/org/gitlab4j/api/DeployTokensApi.java
#	src/main/java/org/gitlab4j/api/EnvironmentsApi.java
#	src/main/java/org/gitlab4j/api/GitLabApiClient.java
#	src/main/java/org/gitlab4j/api/GitLabApiException.java
#	src/main/java/org/gitlab4j/api/GitLabApiForm.java
#	src/main/java/org/gitlab4j/api/GitLabCiYamlApi.java
#	src/main/java/org/gitlab4j/api/HealthCheckApi.java
#	src/main/java/org/gitlab4j/api/HookManager.java
#	src/main/java/org/gitlab4j/api/IssuesApi.java
#	src/main/java/org/gitlab4j/api/JobApi.java
#	src/main/java/org/gitlab4j/api/KeysApi.java
#	src/main/java/org/gitlab4j/api/LabelsApi.java
#	src/main/java/org/gitlab4j/api/MarkdownApi.java
#	src/main/java/org/gitlab4j/api/MergeRequestApi.java
#	src/main/java/org/gitlab4j/api/MetadataApi.java
#	src/main/java/org/gitlab4j/api/Pager.java
#	src/main/java/org/gitlab4j/api/PersonalAccessTokenApi.java
#	src/main/java/org/gitlab4j/api/ProjectApi.java
#	src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java
#	src/main/java/org/gitlab4j/api/ReleaseLinksApi.java
#	src/main/java/org/gitlab4j/api/RepositoryFileApi.java
#	src/main/java/org/gitlab4j/api/SearchApi.java
#	src/main/java/org/gitlab4j/api/ServicesApi.java
#	src/main/java/org/gitlab4j/api/TopicsApi.java
#	src/main/java/org/gitlab4j/api/models/EpicIssue.java
#	src/main/java/org/gitlab4j/api/models/GpgKey.java
#	src/main/java/org/gitlab4j/api/models/Link.java
#	src/main/java/org/gitlab4j/api/models/PackageFile.java
#	src/main/java/org/gitlab4j/api/models/ProjectAccessToken.java
#	src/main/java/org/gitlab4j/api/models/ProjectFilter.java
#	src/main/java/org/gitlab4j/api/models/ProjectSharedGroup.java
#	src/main/java/org/gitlab4j/api/models/User.java
#	src/main/java/org/gitlab4j/api/systemhooks/SystemHookManager.java
#	src/main/java/org/gitlab4j/api/systemhooks/TeamMemberSystemHookEvent.java
#	src/main/java/org/gitlab4j/api/utils/FileUtils.java
#	src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java
#	src/main/java/org/gitlab4j/api/utils/MaskingLoggingFilter.java
#	src/main/java/org/gitlab4j/api/utils/Oauth2LoginStreamingOutput.java
#	src/main/java/org/gitlab4j/api/utils/UrlEncoder.java
#	src/main/java/org/gitlab4j/api/webhook/BuildEvent.java
#	src/main/java/org/gitlab4j/api/webhook/EventMergeRequest.java
#	src/main/java/org/gitlab4j/api/webhook/IssueEvent.java
#	src/main/java/org/gitlab4j/api/webhook/JobEvent.java
#	src/main/java/org/gitlab4j/api/webhook/MergeRequestEvent.java
#	src/main/java/org/gitlab4j/api/webhook/NoteEvent.java
#	src/main/java/org/gitlab4j/api/webhook/PipelineEvent.java
#	src/main/java/org/gitlab4j/api/webhook/WebHookManager.java
#	src/main/java/org/gitlab4j/api/webhook/WikiPageEvent.java
#	src/test/java/org/gitlab4j/api/MockResponse.java
#	src/test/java/org/gitlab4j/api/MockServletInputStream.java
#	src/test/java/org/gitlab4j/api/TestCommitDiscussionsApi.java
#	src/test/java/org/gitlab4j/api/TestEpicDiscussionsApi.java
#	src/test/java/org/gitlab4j/api/TestExternalStatusCheckApi.java
#	src/test/java/org/gitlab4j/api/TestIssueDiscussionsApi.java
#	src/test/java/org/gitlab4j/api/TestMergeRequestDiscussionsApi.java
#	src/test/java/org/gitlab4j/api/TestReleaseLinksApi.java
#	src/test/java/org/gitlab4j/api/TestRepositoryFileApi.java
#	src/test/java/org/gitlab4j/api/TestRepositorySubmodulesApi.java
#	src/test/java/org/gitlab4j/api/TestSearchApi.java
#	src/test/java/org/gitlab4j/api/TestSnippetDiscussionsApi.java
#	src/test/java/org/gitlab4j/api/TestStreams.java
#	src/test/java/org/gitlab4j/api/TestTopicsApi.java
  • Loading branch information
jmini committed Oct 13, 2024
2 parents 2d06703 + 6e5e2e6 commit 0eff2ba
Show file tree
Hide file tree
Showing 373 changed files with 27,113 additions and 21,913 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

plugins {
id 'java-library'
id 'com.diffplug.spotless' version '6.25.0'
id 'signing'
id 'maven-publish'
id 'de.marcphilipp.nexus-publish' version '0.4.0'
Expand Down Expand Up @@ -54,6 +55,14 @@ repositories {
mavenCentral()
}

spotless {
java {
palantirJavaFormat()
importOrder 'java', 'javax', 'jakarta', 'org', 'com', ''
removeUnusedImports()
}
}

nexusPublishing {
repositories {
sonatype {
Expand Down
133 changes: 90 additions & 43 deletions src/main/java/org/gitlab4j/api/AbstractApi.java

Large diffs are not rendered by default.

74 changes: 38 additions & 36 deletions src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import jakarta.ws.rs.core.Response;

import org.gitlab4j.api.models.Setting;
import org.gitlab4j.api.models.ApplicationSettings;
import org.gitlab4j.api.models.Setting;
import org.gitlab4j.api.utils.ISO8601;

import com.fasterxml.jackson.databind.JsonNode;
Expand Down Expand Up @@ -53,7 +53,7 @@ public ApplicationSettings updateApplicationSettings(ApplicationSettings appSett
}

final GitLabApiForm form = new GitLabApiForm();
appSettings.getSettings().forEach((s, v) -> form.withParam(s, v));
appSettings.getSettings().forEach((s, v) -> form.withParam(s, v));
Response response = put(Response.Status.OK, form.asMap(), "application", "settings");
JsonNode root = response.readEntity(JsonNode.class);
return (parseApplicationSettings(root));
Expand Down Expand Up @@ -116,40 +116,42 @@ public static final ApplicationSettings parseApplicationSettings(JsonNode root)

String fieldName = fieldNames.next();
switch (fieldName) {
case "id":
appSettings.setId(root.path(fieldName).asLong());
break;

case "created_at":
try {
String value = root.path(fieldName).asText();
appSettings.setCreatedAt(ISO8601.toDate(value));
} catch (ParseException pe) {
throw new GitLabApiException(pe);
}
break;

case "updated_at":
try {
String value = root.path(fieldName).asText();
appSettings.setUpdatedAt(ISO8601.toDate(value));
} catch (ParseException pe) {
throw new GitLabApiException(pe);
}
break;

default:

Setting setting = Setting.forValue(fieldName);
if (setting != null) {
appSettings.addSetting(setting, root.path(fieldName));
} else {
GitLabApi.getLogger().warning(String.format("Unknown setting: %s, type: %s",
fieldName, root.path(fieldName).getClass().getSimpleName()));
appSettings.addSetting(fieldName, root.path(fieldName));
}

break;
case "id":
appSettings.setId(root.path(fieldName).asLong());
break;

case "created_at":
try {
String value = root.path(fieldName).asText();
appSettings.setCreatedAt(ISO8601.toDate(value));
} catch (ParseException pe) {
throw new GitLabApiException(pe);
}
break;

case "updated_at":
try {
String value = root.path(fieldName).asText();
appSettings.setUpdatedAt(ISO8601.toDate(value));
} catch (ParseException pe) {
throw new GitLabApiException(pe);
}
break;

default:
Setting setting = Setting.forValue(fieldName);
if (setting != null) {
appSettings.addSetting(setting, root.path(fieldName));
} else {
GitLabApi.getLogger()
.warning(String.format(
"Unknown setting: %s, type: %s",
fieldName,
root.path(fieldName).getClass().getSimpleName()));
appSettings.addSetting(fieldName, root.path(fieldName));
}

break;
}
}

Expand Down
11 changes: 7 additions & 4 deletions src/main/java/org/gitlab4j/api/ApplicationsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public List<Application> getApplications() throws GitLabApiException {
* @throws GitLabApiException if any exception occurs
*/
public List<Application> getApplications(int page, int perPage) throws GitLabApiException {
Response response = get(jakarta.ws.rs.core.Response.Status.OK, getPageQueryParams(page, perPage), "applications");
Response response =
get(jakarta.ws.rs.core.Response.Status.OK, getPageQueryParams(page, perPage), "applications");
return (response.readEntity(new GenericType<List<Application>>() {}));
}

Expand Down Expand Up @@ -83,7 +84,8 @@ public Stream<Application> getApplicationsStream() throws GitLabApiException {
* @return the created Application instance
* @throws GitLabApiException if any exception occurs
*/
public Application createApplication(String name, String redirectUri, ApplicationScope[] scopes) throws GitLabApiException {
public Application createApplication(String name, String redirectUri, ApplicationScope[] scopes)
throws GitLabApiException {

if (scopes == null || scopes.length == 0) {
throw new GitLabApiException("scopes cannot be null or empty");
Expand All @@ -103,7 +105,8 @@ public Application createApplication(String name, String redirectUri, Applicatio
* @return the created Application instance
* @throws GitLabApiException if any exception occurs
*/
public Application createApplication(String name, String redirectUri, List<ApplicationScope> scopes) throws GitLabApiException {
public Application createApplication(String name, String redirectUri, List<ApplicationScope> scopes)
throws GitLabApiException {

if (scopes == null || scopes.isEmpty()) {
throw new GitLabApiException("scopes cannot be null or empty");
Expand All @@ -113,7 +116,7 @@ public Application createApplication(String name, String redirectUri, List<Appli
GitLabApiForm formData = new GitLabApiForm()
.withParam("name", name, true)
.withParam("redirect_uri", redirectUri, true)
.withParam("scopes", scopesString, true);
.withParam("scopes", scopesString, true);
Response response = post(Response.Status.CREATED, formData, "applications");
return (response.readEntity(Application.class));
}
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/org/gitlab4j/api/AuditEventApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public AuditEventApi(GitLabApi gitLabApi) {
* @return a List of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).all());
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId)
throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage())
.all());
}

/**
Expand All @@ -49,7 +51,9 @@ public List<AuditEvent> getAuditEvents(Date created_after, Date created_before,
* @return a Pager of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage) throws GitLabApiException {
public Pager<AuditEvent> getAuditEvents(
Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage)
throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_before, false))
.withParam("created_after", ISO8601.toString(created_after, false))
Expand All @@ -70,7 +74,8 @@ public Pager<AuditEvent> getAuditEvents(Date created_after, Date created_before,
* @return a Stream of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
public Stream<AuditEvent> getAuditEventsStream(
Date created_after, Date created_before, String entityType, Long entityId) throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).stream());
}

Expand Down
Loading

0 comments on commit 0eff2ba

Please sign in to comment.