org.gitlab4j.api.RepositorySubmodulesApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gitlab4j-api Show documentation
Show all versions of gitlab4j-api Show documentation
GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.
package org.gitlab4j.api;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Commit;
/**
* This class provides an entry point to all the GitLab API repository submodules calls.
* For more information on the repository APIs see:
*
* @see Repository Submodules API
*/
public class RepositorySubmodulesApi extends AbstractApi {
public RepositorySubmodulesApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Update existing submodule reference in repository.
*
* GitLab Endpoint: PUT /projects/:id/repository/submodules/:submodule
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @param submodule full path to the submodule
* @param branch name of the branch to commit into
* @param commitSha full commit SHA to update the submodule to
* @param commitMessage commit message (optional). If no message is provided, a default is set
* @return the created commit
* @throws GitLabApiException if any exception occurs
*/
public Commit updateExistingSubmoduleReference(Object projectIdOrPath, String submodule, String branch, String commitSha, String commitMessage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("branch", branch, true)
.withParam("commit_sha", commitSha, true)
.withParam("commit_message", commitMessage);
Response response = put(Response.Status.OK, formData.asMap(), "projects",
getProjectIdOrPath(projectIdOrPath), "repository", "submodules", urlEncode(submodule));
return (response.readEntity(Commit.class));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy