code
stringlengths 73
34.1k
| label
stringclasses 1
value |
|---|---|
public Stream<MergeRequest> getMergeRequestsStream(Object projectIdOrPath, MergeRequestState state) throws GitLabApiException {
return (getMergeRequests(projectIdOrPath, state, getDefaultPerPage()).stream());
}
|
java
|
public MergeRequest getMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid);
return (response.readEntity(MergeRequest.class));
}
|
java
|
public Optional<MergeRequest> getOptionalMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) {
try {
return (Optional.ofNullable(getMergeRequest(projectIdOrPath, mergeRequestIid)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public Pager<Commit> getCommits(Object projectIdOrPath, int mergeRequestIid, int itemsPerPage) throws GitLabApiException {
return (new Pager<Commit>(this, Commit.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "commits"));
}
|
java
|
public Stream<Commit> getCommitsStream(Object projectIdOrPath, int mergeRequestIid) throws GitLabApiException {
return (getCommits(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).stream());
}
|
java
|
public MergeRequest cancelMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Response response = put(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "cancel_merge_when_pipeline_succeeds");
return (response.readEntity(MergeRequest.class));
}
|
java
|
public MergeRequest approveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String sha) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Form formData = new GitLabApiForm().withParam("sha", sha);
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "approve");
return (response.readEntity(MergeRequest.class));
}
|
java
|
public MergeRequest unapproveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Response response = post(Response.Status.OK, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "unapprove");
return (response.readEntity(MergeRequest.class));
}
|
java
|
public List<Participant> getParticipants(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getParticipants(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).all());
}
|
java
|
public Pager<Participant> getParticipants(Object projectIdOrPath, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException {
return new Pager<Participant>(this, Participant.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "participants");
}
|
java
|
public Stream<Participant> getParticipantsStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getParticipants(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).stream());
}
|
java
|
public List<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getClosesIssues(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).all());
}
|
java
|
public Pager<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException {
return new Pager<Issue>(this, Issue.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "closes_issues");
}
|
java
|
public Stream<Issue> getClosesIssuesStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getClosesIssues(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).stream());
}
|
java
|
public List<Discussion> getIssueDiscussions(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
Pager<Discussion> pager = getIssueDiscussionsPager(projectIdOrPath, issueIid, getDefaultPerPage());
return (pager.all());
}
|
java
|
public Pager<Discussion> getIssueDiscussionsPager(Object projectIdOrPath, Integer issueIid, int itemsPerPage) throws GitLabApiException {
return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "discussions"));
}
|
java
|
public Stream<Discussion> getIssueDiscussionsStream(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
Pager<Discussion> pager = getIssueDiscussionsPager(projectIdOrPath, issueIid, getDefaultPerPage());
return (pager.stream());
}
|
java
|
public List<Discussion> getSnippetDiscussions(Object projectIdOrPath, Integer snippetId) throws GitLabApiException {
Pager<Discussion> pager = getSnippetDiscussionsPager(projectIdOrPath, snippetId, getDefaultPerPage());
return (pager.all());
}
|
java
|
public Pager<Discussion> getSnippetDiscussionsPager(Object projectIdOrPath, Integer snippetId, int itemsPerPage) throws GitLabApiException {
return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "discussions"));
}
|
java
|
public Stream<Discussion> getSnippetDiscussionsStream(Object projectIdOrPath, Integer snippetId) throws GitLabApiException {
Pager<Discussion> pager = getSnippetDiscussionsPager(projectIdOrPath, snippetId, getDefaultPerPage());
return (pager.stream());
}
|
java
|
public List<Discussion> getEpicDiscussions(Object projectIdOrPath, Integer epicId) throws GitLabApiException {
Pager<Discussion> pager = getEpicDiscussionsPager(projectIdOrPath, epicId, getDefaultPerPage());
return (pager.all());
}
|
java
|
public Pager<Discussion> getEpicDiscussionsPager(Object projectIdOrPath, Integer epicId, int itemsPerPage) throws GitLabApiException {
return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "epics", epicId, "discussions"));
}
|
java
|
public Stream<Discussion> getEpicDiscussionsStream(Object projectIdOrPath, Integer epicId) throws GitLabApiException {
Pager<Discussion> pager = getEpicDiscussionsPager(projectIdOrPath, epicId, getDefaultPerPage());
return (pager.stream());
}
|
java
|
public List<Discussion> getMergeRequestDiscussions(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
Pager<Discussion> pager = getMergeRequestDiscussionsPager(projectIdOrPath, mergeRequestIid, getDefaultPerPage());
return (pager.all());
}
|
java
|
public Pager<Discussion> getMergeRequestDiscussionsPager(Object projectIdOrPath, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException {
return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "discussions"));
}
|
java
|
public Stream<Discussion> getMergeRequestDiscussionsStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
Pager<Discussion> pager = getMergeRequestDiscussionsPager(projectIdOrPath, mergeRequestIid, getDefaultPerPage());
return (pager.stream());
}
|
java
|
public Discussion resolveMergeRequestDiscussion(Object projectIdOrPath, Integer mergeRequestIid,
Integer discussionId, Boolean resolved) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("resolved", resolved, true);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "discussions");
return (response.readEntity(Discussion.class));
}
|
java
|
public void deleteMergeRequestDiscussionNote(Object projectIdOrPath, Integer mergeRequestIid,
Integer discussionId, Integer noteId) throws GitLabApiException {
delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath),
"merge_requests", mergeRequestIid, "discussions", noteId);
}
|
java
|
public List<Discussion> getCommitDiscussions(Object projectIdOrPath, Integer commitId) throws GitLabApiException {
Pager<Discussion> pager = getCommitDiscussionsPager(projectIdOrPath, commitId, getDefaultPerPage());
return (pager.all());
}
|
java
|
public List<Discussion> getCommitDiscussions(Object projectIdOrPath, Integer commitId, int maxItems) throws GitLabApiException {
if (maxItems < 1) {
return (getCommitDiscussions(projectIdOrPath, commitId));
} else {
Response response = get(Response.Status.OK, getPerPageQueryParam(maxItems),
"projects", getProjectIdOrPath(projectIdOrPath), "commits", commitId, "discussions");
return (response.readEntity(new GenericType<List<Discussion>>() {}));
}
}
|
java
|
public Pager<Discussion> getCommitDiscussionsPager(Object projectIdOrPath, Integer commitId, int itemsPerPage) throws GitLabApiException {
return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "commits", commitId, "discussions"));
}
|
java
|
public Stream<Discussion> getCommitDiscussionsStream(Object projectIdOrPath, Integer commitId) throws GitLabApiException {
Pager<Discussion> pager = getCommitDiscussionsPager(projectIdOrPath, commitId, getDefaultPerPage());
return (pager.stream());
}
|
java
|
public Optional<RepositoryFile> getOptionalFileInfo(Object projectIdOrPath, String filePath, String ref) {
try {
return (Optional.ofNullable(getFileInfo(projectIdOrPath, filePath, ref)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public RepositoryFile getFileInfo(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException {
Form form = new Form();
addFormParam(form, "ref", ref, true);
Response response = head(Response.Status.OK, form.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath));
RepositoryFile file = new RepositoryFile();
file.setBlobId(response.getHeaderString("X-Gitlab-Blob-Id"));
file.setCommitId(response.getHeaderString("X-Gitlab-Commit-Id"));
file.setEncoding(response.getHeaderString("X-Gitlab-Encoding"));
file.setFileName(response.getHeaderString("X-Gitlab-File-Name"));
file.setFilePath(response.getHeaderString("X-Gitlab-File-Path"));
file.setLastCommitId(response.getHeaderString("X-Gitlab-Last-Commit-Id"));
file.setRef(response.getHeaderString("X-Gitlab-Ref"));
String sizeStr = response.getHeaderString("X-Gitlab-Size");
file.setSize(sizeStr != null ? Integer.valueOf(sizeStr) : -1);
return (file);
}
|
java
|
public Optional<RepositoryFile> getOptionalFile(Object projectIdOrPath, String filePath, String ref) {
try {
return (Optional.ofNullable(getFile(projectIdOrPath, filePath, ref, true)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public RepositoryFile getFile(Object projectIdOrPath, String filePath, String ref, boolean includeContent) throws GitLabApiException {
if (!includeContent) {
return (getFileInfo(projectIdOrPath, filePath, ref));
}
Form form = new Form();
addFormParam(form, "ref", ref, true);
Response response = get(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath));
return (response.readEntity(RepositoryFile.class));
}
|
java
|
public RepositoryFile createFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {
Form formData = createForm(file, branchName, commitMessage);
Response response;
if (isApiVersion(ApiVersion.V3)) {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
} else {
response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(file.getFilePath()));
}
return (response.readEntity(RepositoryFile.class));
}
|
java
|
public File getRawFile(Object projectIdOrPath, String commitOrBranchName, String filepath, File directory) throws GitLabApiException {
InputStream in = getRawFile(projectIdOrPath, commitOrBranchName, filepath);
try {
if (directory == null) {
directory = new File(System.getProperty("java.io.tmpdir"));
}
String filename = new File(filepath).getName();
File file = new File(directory, filename);
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return (file);
} catch (IOException ioe) {
throw new GitLabApiException(ioe);
} finally {
try {
in.close();
} catch (IOException ignore) {
}
}
}
|
java
|
public InputStream getRawFile(Object projectIdOrPath, String commitOrBranchName, String filepath) throws GitLabApiException {
if (isApiVersion(ApiVersion.V3)) {
Form formData = new GitLabApiForm().withParam("file_path", filepath, true);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "blobs", commitOrBranchName);
return (response.readEntity(InputStream.class));
} else {
Form formData = new GitLabApiForm().withParam("ref", commitOrBranchName, true);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filepath), "raw");
return (response.readEntity(InputStream.class));
}
}
|
java
|
protected Form createForm(RepositoryFile file, String branchName, String commitMessage) {
Form form = new Form();
if (isApiVersion(ApiVersion.V3)) {
addFormParam(form, "file_path", file.getFilePath(), true);
addFormParam(form, "branch_name", branchName, true);
} else {
addFormParam(form, "branch", branchName, true);
}
addFormParam(form, "encoding", file.getEncoding(), false);
// Cannot use addFormParam() as it does not accept an empty or whitespace only string
String content = file.getContent();
if (content == null) {
throw new IllegalArgumentException("content cannot be null");
}
form.param("content", content);
addFormParam(form, "commit_message", commitMessage, true);
return (form);
}
|
java
|
public List<SystemHook> getSystemHooks(int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "hooks");
return (response.readEntity(new GenericType<List<SystemHook>>() {}));
}
|
java
|
public Pager<SystemHook> getSystemHooks(int itemsPerPage) throws GitLabApiException {
return (new Pager<SystemHook>(this, SystemHook.class, itemsPerPage, null, "hooks"));
}
|
java
|
public SystemHook addSystemHook(String url, String token, Boolean pushEvents,
Boolean tagPushEvents, Boolean enablSsslVerification) throws GitLabApiException {
if (url == null) {
throw new RuntimeException("url cannot be null");
}
GitLabApiForm formData = new GitLabApiForm()
.withParam("url", url, true)
.withParam("token", token)
.withParam("push_events", pushEvents)
.withParam("tag_push_events", tagPushEvents)
.withParam("enable_ssl_verification", enablSsslVerification);
Response response = post(Response.Status.CREATED, formData, "hooks");
return (response.readEntity(SystemHook.class));
}
|
java
|
public List<Label> getLabels(Object projectIdOrPath) throws GitLabApiException {
return (getLabels(projectIdOrPath, getDefaultPerPage()).all());
}
|
java
|
public Pager<Label> getLabels(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Label>(this, Label.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "labels"));
}
|
java
|
public Stream<Label> getLabelsStream(Object projectIdOrPath) throws GitLabApiException {
return (getLabels(projectIdOrPath, getDefaultPerPage()).stream());
}
|
java
|
public void deleteLabel(Object projectIdOrPath, String name) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("name", name, true);
Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "labels");
}
|
java
|
public Label subscribeLabel(Object projectIdOrPath, Integer labelId) throws GitLabApiException {
Response response = post(Response.Status.NOT_MODIFIED, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "labels", labelId, "subscribe");
return (response.readEntity(Label.class));
}
|
java
|
public static Map<String, Object> createProxyClientConfig(String proxyUri) {
return (createProxyClientConfig(proxyUri, null, null));
}
|
java
|
public static Map<String, Object> createProxyClientConfig(String proxyUri, String username, String password) {
Map<String, Object> clientConfig = new HashMap<>();
clientConfig.put(ClientProperties.PROXY_URI, proxyUri);
if (username != null && username.trim().length() > 0) {
clientConfig.put(ClientProperties.PROXY_USERNAME, username);
}
if (password != null && password.trim().length() > 0) {
clientConfig.put(ClientProperties.PROXY_PASSWORD, password);
}
return (clientConfig);
}
|
java
|
public static String getTimestamp(boolean withMsec) {
return (withMsec ? SafeDateFormatter.getDateFormat(PATTERN_MSEC).format(new Date()) :
SafeDateFormatter.getDateFormat(PATTERN).format(new Date()));
}
|
java
|
public static Instant toInstant(String dateTimeString) throws ParseException {
if (dateTimeString == null) {
return (null);
}
dateTimeString = dateTimeString.trim();
if (dateTimeString.endsWith("Z")) {
return (Instant.parse(dateTimeString));
} else {
// Convert UTC zoned dates to 0 offset date
if (dateTimeString.endsWith("UTC")) {
dateTimeString = dateTimeString.replace("UTC", "+0000");
}
OffsetDateTime odt = (dateTimeString.length() > 25 ?
OffsetDateTime.parse(dateTimeString, ODT_WITH_MSEC_PARSER) :
OffsetDateTime.parse(dateTimeString, ODT_PARSER));
return (odt.toInstant());
}
}
|
java
|
public static Date toDate(String dateTimeString) throws ParseException {
Instant instant = toInstant(dateTimeString);
return (instant != null ? Date.from(instant) : null);
}
|
java
|
public static Calendar toCalendar(String dateTimeString) throws ParseException {
Date date = toDate(dateTimeString);
if (date == null) {
return (null);
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return (cal);
}
|
java
|
public List<Board> getBoards(Object projectIdOrPath) throws GitLabApiException {
return (getBoards(projectIdOrPath, getDefaultPerPage()).all());
}
|
java
|
public List<Board> getBoards(Object projectIdOrPath, int page, int perPage) throws GitLabApiException {
Response response = get(javax.ws.rs.core.Response.Status.OK, getPageQueryParams(page, perPage),
"projects", getProjectIdOrPath(projectIdOrPath), "boards");
return (response.readEntity(new GenericType<List<Board>>() {}));
}
|
java
|
public Pager<Board> getBoards(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Board>(this, Board.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "boards"));
}
|
java
|
public Stream<Board> getBoardsStream(Object projectIdOrPath) throws GitLabApiException {
return (getBoards(projectIdOrPath, getDefaultPerPage()).stream());
}
|
java
|
public Board getBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId);
return (response.readEntity(Board.class));
}
|
java
|
public Optional<Board> getOptionalBoard(Object projectIdOrPath, Integer boardId) {
try {
return (Optional.ofNullable(getBoard(projectIdOrPath, boardId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public Board createBoard(Object projectIdOrPath, String name) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("name", name, true);
Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "boards");
return (response.readEntity(Board.class));
}
|
java
|
public BoardList updateBoard(Object projectIdOrPath, Integer boardId, String name,
Integer assigneeId, Integer milestoneId, String labels, Integer weight) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("name", name)
.withParam("assignee_id", assigneeId)
.withParam("milestone_id", milestoneId)
.withParam("labels", labels)
.withParam("weight", weight);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId);
return (response.readEntity(BoardList.class));
}
|
java
|
public void deleteBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId);
}
|
java
|
public BoardList getBoardList(Object projectIdOrPath, Integer boardId, Integer listId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists", listId);
return (response.readEntity(BoardList.class));
}
|
java
|
public Optional<BoardList> getOptionalBoardList(Object projectIdOrPath, Integer boardId, Integer listId) {
try {
return (Optional.ofNullable(getBoardList(projectIdOrPath, boardId, listId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public BoardList createBoardList(Object projectIdOrPath, Integer boardId, Integer labelId) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("label_id", labelId, true);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists");
return (response.readEntity(BoardList.class));
}
|
java
|
public BoardList updateBoardList(Object projectIdOrPath, Integer boardId, Integer listId, Integer position) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("position", position, true);
Response response = putWithFormData(Response.Status.OK, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists", listId);
return (response.readEntity(BoardList.class));
}
|
java
|
public void deleteBoardList(Object projectIdOrPath, Integer boardId, Integer listId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId, "lists", listId);
}
|
java
|
private void fixJiraIssueTransitionId(Map<String, Object> properties) {
if (properties != null) {
Object jiraIssueTransitionId = properties.get(JIRA_ISSUE_TRANSITION_ID_PROP);
if (jiraIssueTransitionId instanceof String) {
if (((String)jiraIssueTransitionId).trim().isEmpty()) {
properties.put(JIRA_ISSUE_TRANSITION_ID_PROP, null);
} else {
properties.put(JIRA_ISSUE_TRANSITION_ID_PROP, Integer.valueOf((String)jiraIssueTransitionId));
}
}
}
}
|
java
|
public Pipeline getPipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId);
return (response.readEntity(Pipeline.class));
}
|
java
|
public void deletePipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
delete(Response.Status.ACCEPTED, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId);
}
|
java
|
public Pipeline retryPipelineJob(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
GitLabApiForm formData = null;
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId, "retry");
return (response.readEntity(Pipeline.class));
}
|
java
|
public List<PipelineSchedule> getPipelineSchedules(Object projectIdOrPath) throws GitLabApiException {
return (getPipelineSchedules(projectIdOrPath, getDefaultPerPage()).all());
}
|
java
|
public List<PipelineSchedule> getPipelineSchedules(Object projectIdOrPath, int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules");
return (response.readEntity(new GenericType<List<PipelineSchedule>>() {}));
}
|
java
|
public Pager<PipelineSchedule> getPipelineSchedules(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<PipelineSchedule>(this, PipelineSchedule.class, itemsPerPage, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules"));
}
|
java
|
public Stream<PipelineSchedule> getPipelineSchedulesStream(Object projectIdOrPath) throws GitLabApiException {
return (getPipelineSchedules(projectIdOrPath, getDefaultPerPage()).stream());
}
|
java
|
public PipelineSchedule getPipelineSchedule(Object projectIdOrPath, Integer pipelineScheduleId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId);
return (response.readEntity(PipelineSchedule.class));
}
|
java
|
public Optional<PipelineSchedule> getOptionalPipelineSchedule (Object projectIdOrPath, Integer pipelineScheduleId) {
try {
return (Optional.ofNullable(getPipelineSchedule(projectIdOrPath, pipelineScheduleId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
}
|
java
|
public PipelineSchedule createPipelineSchedule(Object projectIdOrPath, PipelineSchedule pipelineSchedule)
throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("description", pipelineSchedule.getDescription(), true)
.withParam("ref", pipelineSchedule.getRef(), true)
.withParam("cron", pipelineSchedule.getCron(), true)
.withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false)
.withParam("active", pipelineSchedule.getActive(), false);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules");
return (response.readEntity(PipelineSchedule.class));
}
|
java
|
public PipelineSchedule updatePipelineSchedule(Object projectIdOrPath,PipelineSchedule pipelineSchedule) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("description", pipelineSchedule.getDescription(), false)
.withParam("ref", pipelineSchedule.getRef(), false)
.withParam("cron", pipelineSchedule.getCron(), false)
.withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false)
.withParam("active", pipelineSchedule.getActive(), false);
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineSchedule.getId());
return (response.readEntity(PipelineSchedule.class));
}
|
java
|
public PipelineSchedule takeOwnershipPipelineSchedule(Object projectIdOrPath, Integer pipelineScheduleId) throws GitLabApiException {
Response response = post(Response.Status.OK, "", "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId, "take_ownership");
return (response.readEntity(PipelineSchedule.class));
}
|
java
|
public Variable createPipelineScheduleVariable(Object projectIdOrPath, Integer pipelineScheduleId,
String key, String value) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("key", key, true)
.withParam("value", value, true);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId, "variables");
return (response.readEntity(Variable.class));
}
|
java
|
public void deletePipelineScheduleVariable(Object projectIdOrPath, Integer pipelineScheduleId, String key) throws GitLabApiException {
Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, null, "projects", getProjectIdOrPath(projectIdOrPath),
"pipeline_schedules", pipelineScheduleId, "variables", key);
}
|
java
|
public static final int parse(String durationString) {
durationString = durationString.toLowerCase();
Matcher matcher = durationPattern.matcher(durationString);
int currentUnitIndex = -1;
int seconds = 0;
Boolean validDuration = null;
while (matcher.find() && validDuration != Boolean.FALSE) {
validDuration = true;
int numGroups = matcher.groupCount();
if (numGroups == 3) {
String unit = matcher.group(3);
int nextUnitIndex = getUnitIndex(unit);
if (nextUnitIndex > currentUnitIndex) {
currentUnitIndex = nextUnitIndex;
try {
seconds += Long.parseLong(matcher.group(2)) * TIME_UNIT_MULTIPLIERS[nextUnitIndex];
} catch (NumberFormatException nfe) {
validDuration = false;
}
} else {
validDuration = false;
}
} else {
validDuration = false;
}
}
if (validDuration != Boolean.TRUE) {
throw new IllegalArgumentException(String.format("'%s' is not a valid duration", durationString));
}
return (seconds);
}
|
java
|
public Pager<Milestone> getGroupMilestones(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Milestone>(this, Milestone.class, itemsPerPage, null,
"groups", getGroupIdOrPath(groupIdOrPath), "milestones"));
}
|
java
|
public Stream<Milestone> getGroupMilestonesStream(Object groupIdOrPath) throws GitLabApiException {
return (getGroupMilestones(groupIdOrPath, getDefaultPerPage()).stream());
}
|
java
|
public List<Milestone> getGroupMilestones(Object groupIdOrPath, MilestoneState state) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("state", state).withParam(PER_PAGE_PARAM, getDefaultPerPage());
Response response = get(Response.Status.OK, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones");
return (response.readEntity(new GenericType<List<Milestone>>() {}));
}
|
java
|
public Milestone getGroupMilestone(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
}
|
java
|
public List<Issue> getGroupIssues(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId, "issues");
return (response.readEntity(new GenericType<List<Issue>>() {}));
}
|
java
|
public List<MergeRequest> getGroupMergeRequest(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId, "merge_requests");
return (response.readEntity(new GenericType<List<MergeRequest>>() {}));
}
|
java
|
public Milestone createGroupMilestone(Object groupIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("description", description)
.withParam("due_date", dueDate)
.withParam("start_date", startDate);
Response response = post(Response.Status.CREATED, formData,
"groups", getGroupIdOrPath(groupIdOrPath), "milestones");
return (response.readEntity(Milestone.class));
}
|
java
|
public Milestone closeGroupMilestone(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
if (milestoneId == null) {
throw new RuntimeException("milestoneId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", MilestoneState.CLOSE);
Response response = put(Response.Status.OK, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
}
|
java
|
public Pager<Milestone> getMilestones(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Milestone>(this, Milestone.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "milestones"));
}
|
java
|
public Stream<Milestone> getMilestonesStream(Object projectIdOrPath) throws GitLabApiException {
return (getMilestones(projectIdOrPath, getDefaultPerPage()).stream());
}
|
java
|
public List<Milestone> getMilestones(Object projectIdOrPath, MilestoneState state) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("state", state).withParam(PER_PAGE_PARAM, getDefaultPerPage());
Response response = get(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones");
return (response.readEntity(new GenericType<List<Milestone>>() {}));
}
|
java
|
public Milestone getMilestone(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
}
|
java
|
public List<Issue> getIssues(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId, "issues");
return (response.readEntity(new GenericType<List<Issue>>() {}));
}
|
java
|
public List<MergeRequest> getMergeRequest(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId, "merge_requests");
return (response.readEntity(new GenericType<List<MergeRequest>>() {}));
}
|
java
|
public Milestone createMilestone(Object projectIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("description", description)
.withParam("due_date", dueDate)
.withParam("start_date", startDate);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "milestones");
return (response.readEntity(Milestone.class));
}
|
java
|
public Milestone activateMilestone(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
if (milestoneId == null) {
throw new RuntimeException("milestoneId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", MilestoneState.ACTIVATE);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
}
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.