Skip to content

Commit 7dfec10

Browse files
committed
Merge remote-tracking branch 'origin/6.x' into 'main'
See #926 # Conflicts: # gradle.properties
2 parents 0e56d4f + 3693545 commit 7dfec10

File tree

128 files changed

+742
-1362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+742
-1362
lines changed

.github/workflows/ci-build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
- uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19-
- name: Setup JDK 8
19+
- name: Setup JDK 11
2020
uses: actions/setup-java@v3
2121
with:
2222
distribution: temurin
23-
java-version: 8
23+
java-version: 11
2424
- name: Setup Gradle
2525
uses: gradle/actions/setup-gradle@v3
2626
- name: GitLab4j verify

README.md

+8-37
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,40 @@
77
GitLab4J™ API (gitlab4j-api) provides a full featured and easy to consume Java library for working with GitLab repositories via the GitLab REST API. Additionally, full support for working with GitLab webhooks and system hooks is also provided.
88

99
---
10-
## Table of Contents
11-
* [GitLab Server Version Support](#gitLab-server-version-support)<br/>
12-
* [Using GitLab4J-API](#using-gitlab4j-api)<br/>
13-
* [Java 8 Requirement](#java-8-requirement)<br/>
14-
* [Javadocs](#javadocs)<br/>
15-
* [Project Set Up](#project-set-up)<br/>
16-
* [Usage Examples](#usage-examples)<br/>
17-
* [Setting Request Timeouts](#setting-request-timeouts)<br/>
18-
* [Connecting Through a Proxy Server](#connecting-through-a-proxy-server)<br/>
19-
* [GitLab API V3 and V4 Support](#gitLab-api-v3-and-v4-support)<br/>
20-
* [Logging of API Requests and Responses](#logging-of-api-requests-and-responses)<br/>
21-
* [Results Paging](#results-paging)<br/>
22-
* [Java 8 Stream Support](#java-8-stream-support)<br/>
23-
* [Eager evaluation example usage](#eager-evaluation-example-usage)<br/>
24-
* [Lazy evaluation example usage](#lazy%20evaluation-example-usage)<br/>
25-
* [Java 8 Optional&lt;T&gt; Support](#java-8-optional-support)<br/>
26-
* [Issue Time Estimates](#issue-time-estimates)<br/>
27-
* [Making API Calls](#making-api-calls)<br/>
28-
* [Available Sub APIs](#available-sub-apis)
29-
30-
---
31-
32-
> **Warning**
33-
> If you are looking for our next major version `6.x.x` which is requiring **Java 11** as mimimal version and which is using Jakarta EE components using the `jakarta.*` packages instead of `javax.*` check the [`6.x` branch](https://github.com/gitlab4j/gitlab4j-api/tree/6.x).
34-
> The `6.x.x` version is the one you need if you are using Spring Boot 3 and Spring Framework 6.0, .
35-
3610
## GitLab Server Version Support
3711

38-
GitLab4J-API supports version 11.0+ of GitLab Community Edition [(gitlab-ce)](https://gitlab.com/gitlab-org/gitlab-ce/) and GitLab Enterprise Edition [(gitlab-ee)](https://gitlab.com/gitlab-org/gitlab-ee/).
39-
40-
GitLab released GitLab Version 11.0 in June of 2018 which included many major changes to GitLab. If you are using GitLab server earlier than version 11.0, it is highly recommended that you either update your GitLab install or use a version of this library that was released around the same time as the version of GitLab you are using.
12+
GitLab4J-API supports both GitLab Community Edition [(gitlab-ce)](https://gitlab.com/gitlab-org/gitlab-ce/) and GitLab Enterprise Edition [(gitlab-ee)](https://gitlab.com/gitlab-org/gitlab-ee/).
4113

4214
**NOTICE**:
4315
As of GitLab 11.0 support for the GitLab API v3 has been removed from the GitLab server (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library sometime in 2019. If you are utilizing the v3 support, please update your code to use GitLab API v4.
4416

4517
---
4618
## Using GitLab4J-API
4719

48-
### **Java 8 Requirement**
49-
As of GitLab4J-API 4.8.0, Java 8+ is now required to use GitLab4J-API.
20+
### **Java 11 Requirement**
21+
As of GitLab4J-API 6.0.0, Java 11+ is now required to use GitLab4J-API.
5022

5123
### **Javadocs**
5224
Javadocs are available here: [![javadoc.io](https://javadoc.io/badge2/org.gitlab4j/gitlab4j-api/javadoc.io.svg)](https://javadoc.io/doc/org.gitlab4j/gitlab4j-api)
5325

5426

5527
### **Project Set Up**
5628
To utilize GitLab4J&trade; API in your Java project, simply add the following dependency to your project's build file:<br />
29+
5730
**Gradle: build.gradle**
5831
```java
5932
dependencies {
6033
...
61-
compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '5.7.0'
34+
implementation group: 'org.gitlab4j', name: 'gitlab4j-api', version: '6.0.0-rc.6'
6235
}
6336
```
6437

65-
**NOTE:** Pulling dependencies may fail when using Gradle prior to 4.5. See [Gradle issue 3065](https://github.com/gradle/gradle/issues/3065#issuecomment-364092456)
66-
6738
**Maven: pom.xml**
6839
```xml
6940
<dependency>
7041
<groupId>org.gitlab4j</groupId>
7142
<artifactId>gitlab4j-api</artifactId>
72-
<version>5.7.0</version>
43+
<version>6.0.0-rc.6</version>
7344
</dependency>
7445
```
7546

@@ -80,7 +51,7 @@ dependencies {
8051
Just add this line at the top of your script:
8152

8253
```java
83-
//DEPS org.gitlab4j:gitlab4j-api:5.7.0
54+
//DEPS org.gitlab4j:gitlab4j-api:6.0.0-rc.6
8455
```
8556

8657
**Ivy and SBT**<br/>
@@ -641,7 +612,7 @@ List<Runner> runners = gitLabApi.getRunnersApi().getAllRunners();
641612
#### SearchApi
642613
```java
643614
// Do a global search for Projects
644-
List<?> projects = gitLabApi.getSearchApi().globalSearch(SearchScope.PROJECTS, "text-to-search-for");
615+
List<Project> projects = gitLabApi.getSearchApi().globalSearch(SearchScope.PROJECTS, "text-to-search-for");
645616
```
646617

647618
#### ServicesApi

build.gradle

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
plugins {
33
id 'java-library'
4-
id 'com.diffplug.spotless' version '6.2.0'
4+
id 'com.diffplug.spotless' version '6.25.0'
55
id 'signing'
66
id 'maven-publish'
77
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
@@ -15,17 +15,17 @@ wrapper {
1515
group = 'org.gitlab4j'
1616

1717
dependencies {
18-
api 'jakarta.activation:jakarta.activation-api:1.2.2'
19-
api 'org.glassfish.jersey.inject:jersey-hk2:2.39.1'
20-
api 'org.glassfish.jersey.core:jersey-client:2.39.1'
21-
api 'org.glassfish.jersey.connectors:jersey-apache-connector:2.39.1'
22-
api 'org.glassfish.jersey.media:jersey-media-multipart:2.39.1'
23-
api 'org.glassfish.jersey.media:jersey-media-json-jackson:2.39.1'
24-
api 'jakarta.servlet:jakarta.servlet-api:4.0.4'
25-
testImplementation 'org.mockito:mockito-core:4.4.0'
26-
testImplementation 'org.mockito:mockito-junit-jupiter:4.4.0'
18+
api 'jakarta.activation:jakarta.activation-api:2.1.1'
19+
api 'org.glassfish.jersey.inject:jersey-hk2:3.1.1'
20+
api 'org.glassfish.jersey.core:jersey-client:3.1.1'
21+
api 'org.glassfish.jersey.connectors:jersey-apache-connector:3.1.1'
22+
api 'org.glassfish.jersey.media:jersey-media-multipart:3.1.1'
23+
api 'org.glassfish.jersey.media:jersey-media-json-jackson:3.1.1'
24+
api 'jakarta.servlet:jakarta.servlet-api:6.0.0'
25+
testImplementation 'org.mockito:mockito-core:5.2.0'
26+
testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'
2727
testImplementation 'org.hamcrest:hamcrest-all:1.3'
28-
testImplementation 'uk.org.webcompere:system-stubs-jupiter:1.2.0'
28+
testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.0.2'
2929
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.4"
3030
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.4"
3131
}
@@ -47,7 +47,7 @@ java {
4747

4848
compileJava.options.encoding = "UTF-8"
4949
toolchain {
50-
languageVersion = JavaLanguageVersion.of(8)
50+
languageVersion = JavaLanguageVersion.of(11)
5151
}
5252
}
5353

@@ -122,7 +122,7 @@ publishing {
122122
release {
123123
buildTasks = ['doRelease']
124124
git {
125-
requireBranch.set('main')
125+
requireBranch.set('6.x')
126126
}
127127
}
128128

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version=5.8.1-SNAPSHOT
2-
lastVersion=5.8.0
1+
version=6.0.0-SNAPSHOT
2+
lastVersion=6.0.0-rc.6
33

44
githubRepositoryOwner=gitlab4j
55
githubRepositoryName=gitlab4j-api

jitpack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
jdk:
2-
- openjdk8
2+
- openjdk11

src/main/java/org/gitlab4j/api/AbstractApi.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import java.io.InputStream;
55
import java.net.URL;
66

7-
import javax.ws.rs.NotAuthorizedException;
8-
import javax.ws.rs.core.Form;
9-
import javax.ws.rs.core.MultivaluedMap;
10-
import javax.ws.rs.core.Response;
11-
import javax.ws.rs.core.StreamingOutput;
7+
import jakarta.ws.rs.NotAuthorizedException;
8+
import jakarta.ws.rs.core.Form;
9+
import jakarta.ws.rs.core.MultivaluedMap;
10+
import jakarta.ws.rs.core.Response;
11+
import jakarta.ws.rs.core.StreamingOutput;
1212

1313
import org.gitlab4j.api.GitLabApi.ApiVersion;
1414
import org.gitlab4j.api.models.Group;

src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.text.ParseException;
44
import java.util.Iterator;
55

6-
import javax.ws.rs.core.Response;
6+
import jakarta.ws.rs.core.Response;
77

88
import org.gitlab4j.api.models.ApplicationSettings;
99
import org.gitlab4j.api.models.Setting;

src/main/java/org/gitlab4j/api/ApplicationsApi.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import java.util.stream.Collectors;
66
import java.util.stream.Stream;
77

8-
import javax.ws.rs.core.GenericType;
9-
import javax.ws.rs.core.Response;
8+
import jakarta.ws.rs.core.GenericType;
9+
import jakarta.ws.rs.core.Response;
1010

1111
import org.gitlab4j.api.models.Application;
1212

@@ -43,7 +43,8 @@ public List<Application> getApplications() throws GitLabApiException {
4343
* @throws GitLabApiException if any exception occurs
4444
*/
4545
public List<Application> getApplications(int page, int perPage) throws GitLabApiException {
46-
Response response = get(javax.ws.rs.core.Response.Status.OK, getPageQueryParams(page, perPage), "applications");
46+
Response response =
47+
get(jakarta.ws.rs.core.Response.Status.OK, getPageQueryParams(page, perPage), "applications");
4748
return (response.readEntity(new GenericType<List<Application>>() {}));
4849
}
4950

src/main/java/org/gitlab4j/api/AuditEventApi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.List;
55
import java.util.stream.Stream;
66

7-
import javax.ws.rs.core.Form;
8-
import javax.ws.rs.core.Response;
7+
import jakarta.ws.rs.core.Form;
8+
import jakarta.ws.rs.core.Response;
99

1010
import org.gitlab4j.api.models.AuditEvent;
1111
import org.gitlab4j.api.utils.ISO8601;

src/main/java/org/gitlab4j/api/AwardEmojiApi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import java.util.List;
44

5-
import javax.ws.rs.core.GenericType;
6-
import javax.ws.rs.core.Response;
5+
import jakarta.ws.rs.core.GenericType;
6+
import jakarta.ws.rs.core.Response;
77

88
import org.gitlab4j.api.models.AwardEmoji;
99

src/main/java/org/gitlab4j/api/BoardsApi.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.Optional;
55
import java.util.stream.Stream;
66

7-
import javax.ws.rs.core.GenericType;
8-
import javax.ws.rs.core.Response;
7+
import jakarta.ws.rs.core.GenericType;
8+
import jakarta.ws.rs.core.Response;
99

1010
import org.gitlab4j.api.models.Board;
1111
import org.gitlab4j.api.models.BoardList;
@@ -50,7 +50,7 @@ public List<Board> getBoards(Object projectIdOrPath) throws GitLabApiException {
5050
*/
5151
public List<Board> getBoards(Object projectIdOrPath, int page, int perPage) throws GitLabApiException {
5252
Response response = get(
53-
javax.ws.rs.core.Response.Status.OK,
53+
jakarta.ws.rs.core.Response.Status.OK,
5454
getPageQueryParams(page, perPage),
5555
"projects",
5656
getProjectIdOrPath(projectIdOrPath),
@@ -225,7 +225,7 @@ public List<BoardList> getBoardLists(Object projectIdOrPath, Long boardId) throw
225225
public List<BoardList> getBoardLists(Object projectIdOrPath, Long boardId, int page, int perPage)
226226
throws GitLabApiException {
227227
Response response = get(
228-
javax.ws.rs.core.Response.Status.OK,
228+
jakarta.ws.rs.core.Response.Status.OK,
229229
getPageQueryParams(page, perPage),
230230
"projects",
231231
getProjectIdOrPath(projectIdOrPath),

src/main/java/org/gitlab4j/api/CommitsApi.java

+5-46
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import java.util.Arrays;
44
import java.util.Date;
55
import java.util.List;
6-
import java.util.Objects;
76
import java.util.Optional;
87
import java.util.stream.Stream;
98

10-
import javax.ws.rs.core.Form;
11-
import javax.ws.rs.core.GenericType;
12-
import javax.ws.rs.core.MultivaluedMap;
13-
import javax.ws.rs.core.Response;
9+
import jakarta.ws.rs.core.Form;
10+
import jakarta.ws.rs.core.GenericType;
11+
import jakarta.ws.rs.core.MultivaluedMap;
12+
import jakarta.ws.rs.core.Response;
1413

1514
import org.gitlab4j.api.models.Comment;
1615
import org.gitlab4j.api.models.Commit;
@@ -662,42 +661,12 @@ public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, Stri
662661
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance (required)
663662
* @param sha a commit SHA (required)
664663
* @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
665-
* @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
664+
* @param status the CommitSatus instance holding the optional parameters: ref, name, target_url, description, and coverage
666665
* @return a CommitStatus instance with the updated info
667666
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
668667
*/
669668
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, CommitStatus status)
670669
throws GitLabApiException {
671-
return addCommitStatus(projectIdOrPath, sha, state, null, status);
672-
}
673-
674-
/**
675-
* <p>Add or update the build status of a commit. The following fluent methods are available on the
676-
* CommitStatus instance for setting up the status:</p>
677-
* <pre><code>
678-
* withCoverage(Float)
679-
* withDescription(String)
680-
* withName(String)
681-
* withRef(String)
682-
* withTargetUrl(String)
683-
* </code></pre>
684-
*
685-
* <pre><code>GitLab Endpoint: POST /projects/:id/statuses/:sha</code></pre>
686-
*
687-
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance (required)
688-
* @param sha a commit SHA (required)
689-
* @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
690-
* @param pipelineId The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)
691-
* @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
692-
* @return a CommitStatus instance with the updated info
693-
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
694-
* @deprecated use {@link #addCommitStatus(Object, String, org.gitlab4j.api.Constants.CommitBuildState, CommitStatus)} and set the pipelineId value in the {@link CommitStatus} parameter
695-
*/
696-
@Deprecated
697-
public CommitStatus addCommitStatus(
698-
Object projectIdOrPath, String sha, CommitBuildState state, Long pipelineId, CommitStatus status)
699-
throws GitLabApiException {
700-
701670
if (projectIdOrPath == null) {
702671
throw new RuntimeException("projectIdOrPath cannot be null");
703672
}
@@ -714,16 +683,6 @@ public CommitStatus addCommitStatus(
714683
.withParam("description", status.getDescription())
715684
.withParam("coverage", status.getCoverage())
716685
.withParam("pipeline_id", status.getPipelineId());
717-
if (pipelineId != null
718-
&& status.getPipelineId() != null
719-
&& !Objects.equals(status.getPipelineId(), pipelineId)) {
720-
throw new IllegalArgumentException(
721-
"The parameter 'pipelineId' and the pipelineId value the 'status' parameter are different. Set the two values to be the same or one of the two values to null.");
722-
}
723-
}
724-
725-
if (pipelineId != null) {
726-
formData.withParam("pipeline_id", pipelineId);
727686
}
728687

729688
Response response =

0 commit comments

Comments
 (0)