Skip to content

Commit ae1915f

Browse files
committed
Merge branch 'master' into pr/704
# Conflicts: # src/main/java/org/gitlab4j/api/ProjectApi.java # src/main/java/org/gitlab4j/api/models/ProjectHook.java
2 parents 4ebc8e5 + 37617ec commit ae1915f

35 files changed

+1508
-141
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
insert_final_newline = true
5+
6+
[*.java]
7+
indent_size = 4
8+
indent_style = space
9+
trim_trailing_whitespace = true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ To utilize GitLab4J™ API in your Java project, simply add the following de
5454
```java
5555
dependencies {
5656
...
57-
compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.16.0'
57+
compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.18.0'
5858
}
5959
```
6060

@@ -65,7 +65,7 @@ dependencies {
6565
<dependency>
6666
<groupId>org.gitlab4j</groupId>
6767
<artifactId>gitlab4j-api</artifactId>
68-
<version>4.16.0</version>
68+
<version>4.18.0</version>
6969
</dependency>
7070
```
7171

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.gitlab4j</groupId>
66
<artifactId>gitlab4j-api</artifactId>
77
<packaging>jar</packaging>
8-
<version>4.17.0-SNAPSHOT</version>
8+
<version>4.19.0-SNAPSHOT</version>
99
<name>GitLab4J-API - GitLab API Java Client</name>
1010
<description>GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.</description>
1111
<url>https://github.com/gitlab4j/gitlab4j-api</url>
@@ -77,7 +77,7 @@
7777
<url>[email protected]:gitlab4j/gitlab4j-api.git</url>
7878
<connection>scm:git:[email protected]:gitlab4j/gitlab4j-api.git</connection>
7979
<developerConnection>scm:git:[email protected]:gitlab4j/gitlab4j-api.git</developerConnection>
80-
<tag>HEAD</tag>
80+
<tag>head</tag>
8181
</scm>
8282

8383
<build>

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
498498

499499
MultivaluedMap<String, String> queryParams = (filter != null ?
500500
filter.getQueryParams(page, perPage).asMap() : getPageQueryParams(page, perPage));
501-
Response response = get(Response.Status.OK, queryParams,
501+
Response response = get(Response.Status.OK, queryParams,
502502
"projects", this.getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "statuses");
503503
return (response.readEntity(new GenericType<List<CommitStatus>>() {}));
504504
}
@@ -515,7 +515,7 @@ public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
515515
* @return a Pager containing the commit statuses for the specified project and sha that meet the provided filter
516516
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
517517
*/
518-
public Pager<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
518+
public Pager<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
519519
CommitStatusFilter filter, int itemsPerPage) throws GitLabApiException {
520520

521521
if (projectIdOrPath == null) {
@@ -567,6 +567,31 @@ public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, Stri
567567
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
568568
*/
569569
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, CommitStatus status) throws GitLabApiException {
570+
return addCommitStatus(projectIdOrPath, sha, state, null, status);
571+
}
572+
573+
/**
574+
* <p>Add or update the build status of a commit. The following fluent methods are available on the
575+
* CommitStatus instance for setting up the status:</p>
576+
* <pre><code>
577+
* withCoverage(Float)
578+
* withDescription(String)
579+
* withName(String)
580+
* withRef(String)
581+
* withTargetUrl(String)
582+
* </code></pre>
583+
*
584+
* <pre><code>GitLab Endpoint: POST /projects/:id/statuses/:sha</code></pre>
585+
*
586+
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance (required)
587+
* @param sha a commit SHA (required)
588+
* @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
589+
* @param pipelineId The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)
590+
* @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
591+
* @return a CommitStatus instance with the updated info
592+
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
593+
*/
594+
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, Integer pipelineId, CommitStatus status) throws GitLabApiException {
570595

571596
if (projectIdOrPath == null) {
572597
throw new RuntimeException("projectIdOrPath cannot be null");
@@ -585,6 +610,10 @@ public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBu
585610
.withParam("coverage", status.getCoverage());
586611
}
587612

613+
if (pipelineId != null) {
614+
formData.withParam("pipeline_id", pipelineId);
615+
}
616+
588617
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "statuses", sha);
589618
return (response.readEntity(CommitStatus.class));
590619
}
@@ -837,7 +866,7 @@ public Commit revertCommit(Object projectIdOrPath, String sha, String branch) th
837866
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "revert");
838867
return (response.readEntity(Commit.class));
839868
}
840-
869+
841870
/**
842871
* Cherry picks a commit in a given branch.
843872
*

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

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,28 @@ public String toString() {
243243
}
244244
}
245245

246+
/** Enum to use for ordering the results of getDeployments. */
247+
public static enum DeploymentOrderBy {
248+
249+
ID, IID, CREATED_AT, UPDATED_AT, REF;
250+
private static JacksonJsonEnumHelper<DeploymentOrderBy> enumHelper = new JacksonJsonEnumHelper<>(DeploymentOrderBy.class);
251+
252+
@JsonCreator
253+
public static DeploymentOrderBy forValue(String value) {
254+
return enumHelper.forValue(value);
255+
}
256+
257+
@JsonValue
258+
public String toValue() {
259+
return (enumHelper.toString(this));
260+
}
261+
262+
@Override
263+
public String toString() {
264+
return (enumHelper.toString(this));
265+
}
266+
}
267+
246268
/** Enum to use for specifying the scope when calling getPipelines(). */
247269
public enum PipelineScope {
248270

@@ -783,7 +805,9 @@ public String toString() {
783805

784806
/** Enum to use for specifying the status of a deployment. */
785807
public enum DeploymentStatus {
786-
808+
/**
809+
* After some tests, {@link #CREATED} value is not a valid value.
810+
*/
787811
CREATED, RUNNING, SUCCESS, FAILED, CANCELED;
788812

789813
private static JacksonJsonEnumHelper<DeploymentStatus> enumHelper = new JacksonJsonEnumHelper<>(DeploymentStatus.class);
@@ -826,6 +850,29 @@ public String toString() {
826850
}
827851
}
828852

853+
/** Enum for the build_git_strategy of the project instance. */
854+
enum SquashOption {
855+
856+
NEVER, ALWAYS, DEFAULT_ON, DEFAULT_OFF;
857+
858+
private static JacksonJsonEnumHelper<SquashOption> enumHelper = new JacksonJsonEnumHelper<>(SquashOption.class);
859+
860+
@JsonCreator
861+
public static SquashOption forValue(String value) {
862+
return enumHelper.forValue(value);
863+
}
864+
865+
@JsonValue
866+
public String toValue() {
867+
return (enumHelper.toString(this));
868+
}
869+
870+
@Override
871+
public String toString() {
872+
return (enumHelper.toString(this));
873+
}
874+
}
875+
829876
/** Enum for the build_git_strategy of the project instance. */
830877
enum BuildGitStrategy {
831878

0 commit comments

Comments
 (0)