Skip to content

Commit 7bb9615

Browse files
authored
Remove deprecated "addCommitStatus" method (#1065)
1 parent 17412b4 commit 7bb9615

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

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

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
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

@@ -563,39 +562,11 @@ public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, Stri
563562
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance (required)
564563
* @param sha a commit SHA (required)
565564
* @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
566-
* @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
565+
* @param status the CommitSatus instance holding the optional parameters: ref, name, target_url, description, and coverage
567566
* @return a CommitStatus instance with the updated info
568567
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
569568
*/
570569
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, CommitStatus status) throws GitLabApiException {
571-
return addCommitStatus(projectIdOrPath, sha, state, null, status);
572-
}
573-
574-
/**
575-
* <p>Add or update the build status of a commit. The following fluent methods are available on the
576-
* CommitStatus instance for setting up the status:</p>
577-
* <pre><code>
578-
* withCoverage(Float)
579-
* withDescription(String)
580-
* withName(String)
581-
* withRef(String)
582-
* withTargetUrl(String)
583-
* </code></pre>
584-
*
585-
* <pre><code>GitLab Endpoint: POST /projects/:id/statuses/:sha</code></pre>
586-
*
587-
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance (required)
588-
* @param sha a commit SHA (required)
589-
* @param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
590-
* @param pipelineId The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)
591-
* @param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
592-
* @return a CommitStatus instance with the updated info
593-
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
594-
* @deprecated use {@link #addCommitStatus(Object, String, org.gitlab4j.api.Constants.CommitBuildState, CommitStatus)} and set the pipelineId value in the {@link CommitStatus} parameter
595-
*/
596-
@Deprecated
597-
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, Long pipelineId, CommitStatus status) throws GitLabApiException {
598-
599570
if (projectIdOrPath == null) {
600571
throw new RuntimeException("projectIdOrPath cannot be null");
601572
}
@@ -612,13 +583,6 @@ public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBu
612583
.withParam("description", status.getDescription())
613584
.withParam("coverage", status.getCoverage())
614585
.withParam("pipeline_id", status.getPipelineId());
615-
if (pipelineId != null && status.getPipelineId() != null && !Objects.equals(status.getPipelineId(), pipelineId)) {
616-
throw new IllegalArgumentException("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.");
617-
}
618-
}
619-
620-
if (pipelineId != null) {
621-
formData.withParam("pipeline_id", pipelineId);
622586
}
623587

624588
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "statuses", sha);

0 commit comments

Comments
 (0)