org.gitlab4j.api.GitLabCiYamlApi 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.
The newest version!
package org.gitlab4j.api;
import java.util.List;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import org.gitlab4j.api.models.GitLabCiTemplate;
import org.gitlab4j.api.models.GitLabCiTemplateElement;
/**
* This class provides an entry point to all the GitLab CI YAML API calls.
*
* @see GitLab CI YAML API
*/
public class GitLabCiYamlApi extends AbstractApi {
public GitLabCiYamlApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Get all GitLab CI/CD YAML templates.
*
* GitLab Endpoint: GET /templates/gitlab_ci_ymls
*
* @return a list of Gitlab CI YAML Templates
* @throws GitLabApiException if any exception occurs
*/
public List getAllGitLabCiYamlTemplates() throws GitLabApiException {
Response response = get(Response.Status.OK, null, "templates", "gitlab_ci_ymls");
return (response.readEntity(new GenericType>() {}));
}
/**
* Get a single GitLab CI/CD YAML template.
*
* GitLab Endpoint: GET /templates/gitlab_ci_ymls/:key
*
* @param key The key of the GitLab CI YAML template
* @return an Gitlab CI YAML Template
* @throws GitLabApiException if any exception occurs
*/
public GitLabCiTemplate getSingleGitLabCiYamlTemplate(String key) throws GitLabApiException {
Response response = get(Status.OK, null, "templates", "gitlab_ci_ymls", key);
return (response.readEntity(GitLabCiTemplate.class));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy