From 7f6aa16d918d068a97c1de5c9aa0d2559843b92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bresson?= Date: Mon, 16 Dec 2024 17:53:27 +0100 Subject: [PATCH] Use "Boolean" instead of "boolean" for optional parameters (#1212) --- .../src/main/java/org/gitlab4j/api/NotesApi.java | 2 +- .../main/java/org/gitlab4j/api/RepositoryApi.java | 4 +++- .../src/main/java/org/gitlab4j/api/UserApi.java | 4 ++-- .../src/main/java/org/gitlab4j/api/WikisApi.java | 13 ++++++++----- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java index 2530db960..35f40cfee 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java @@ -455,7 +455,7 @@ public Note getMergeRequestNote(Object projectIdOrPath, Long mergeRequestIid, Lo * @throws GitLabApiException if any exception occurs */ public Note createMergeRequestNote( - Object projectIdOrPath, Long mergeRequestIid, String body, Date createdAt, boolean internal) + Object projectIdOrPath, Long mergeRequestIid, String body, Date createdAt, Boolean internal) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true).withParam("internal", internal); diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/RepositoryApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/RepositoryApi.java index 6e455d27f..72e858a9f 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/RepositoryApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/RepositoryApi.java @@ -904,6 +904,8 @@ public File getRepositoryArchive( * Compare branches, tags or commits. This can be accessed without authentication * if the repository is publicly accessible. * + *
GitLab Endpoint: GET /projects/:id/repository/compare
+ * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param from the commit SHA or branch name * @param to the commit SHA or branch name @@ -912,7 +914,7 @@ public File getRepositoryArchive( * @return a CompareResults containing the results of the comparison * @throws GitLabApiException if any exception occurs */ - public CompareResults compare(Object projectIdOrPath, String from, String to, boolean straight) + public CompareResults compare(Object projectIdOrPath, String from, String to, Boolean straight) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam("from", from, true) diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/UserApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/UserApi.java index 834a05550..78bc33f76 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/UserApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/UserApi.java @@ -545,7 +545,7 @@ public Stream findUsersStream(String emailOrUsername) throws GitLabApiExce * @param projectsLimit the maximum number of project * @return created User instance * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in version 6.0, replaced by {@link #createUser(User, CharSequence, boolean)} + * @deprecated Will be removed in version 6.0, replaced by {@link #createUser(User, CharSequence, Boolean)} */ @Deprecated public User createUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException { @@ -586,7 +586,7 @@ public User createUser(User user, CharSequence password, Integer projectsLimit) * @return created User instance * @throws GitLabApiException if any exception occurs */ - public User createUser(User user, CharSequence password, boolean resetPassword) throws GitLabApiException { + public User createUser(User user, CharSequence password, Boolean resetPassword) throws GitLabApiException { Form formData = userToForm(user, null, password, resetPassword, true); Response response = post(Response.Status.CREATED, formData, "users"); return (response.readEntity(User.class)); diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/WikisApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/WikisApi.java index d9453509c..2ade18640 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/WikisApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/WikisApi.java @@ -96,7 +96,7 @@ public Stream getPagesStream(Object projectIdOrPath) throws GitLabApiE * @param perPage the number of wiki-pages per page * @return a list of pages in project's wiki for the specified range * @throws GitLabApiException if any exception occurs - * @deprecated Will be removed in a future release, use {@link #getPages(Object, boolean, int)} + * @deprecated Will be removed in a future release, use {@link #getPages(Object, Boolean, int)} */ public List getPages(Object projectIdOrPath, int page, int perPage) throws GitLabApiException { Response response = get( @@ -118,7 +118,7 @@ public List getPages(Object projectIdOrPath, int page, int perPage) th * @return a List of pages in project's wiki for the specified range * @throws GitLabApiException if any exception occurs */ - public List getPages(Object projectIdOrPath, boolean withContent) throws GitLabApiException { + public List getPages(Object projectIdOrPath, Boolean withContent) throws GitLabApiException { return (getPages(projectIdOrPath, withContent, getDefaultPerPage()).all()); } @@ -133,9 +133,12 @@ public List getPages(Object projectIdOrPath, boolean withContent) thro * @return a Pager of pages in project's wiki for the specified range * @throws GitLabApiException if any exception occurs */ - public Pager getPages(Object projectIdOrPath, boolean withContent, int itemsPerPage) + public Pager getPages(Object projectIdOrPath, Boolean withContent, int itemsPerPage) throws GitLabApiException { - GitLabApiForm formData = new GitLabApiForm().withParam("with_content", (withContent ? 1 : 0)); + GitLabApiForm formData = new GitLabApiForm(); + if (withContent != null) { + formData.withParam("with_content", (withContent.booleanValue() ? 1 : 0)); + } return (new Pager( this, WikiPage.class, @@ -156,7 +159,7 @@ public Pager getPages(Object projectIdOrPath, boolean withContent, int * @return a Stream of pages in project's wiki for the specified range * @throws GitLabApiException if any exception occurs */ - public Stream getPagesStream(Object projectIdOrPath, boolean withContent) throws GitLabApiException { + public Stream getPagesStream(Object projectIdOrPath, Boolean withContent) throws GitLabApiException { return (getPages(projectIdOrPath, withContent, getDefaultPerPage()).stream()); }