diff --git a/src/main/java/org/gitlab4j/api/IssuesApi.java b/src/main/java/org/gitlab4j/api/IssuesApi.java
index 4c04e7f934d65c10c6acd2d801cd59e05da50ce8..e311a5b23beed9cf5346f974577f250b2680bf18 100644
--- a/src/main/java/org/gitlab4j/api/IssuesApi.java
+++ b/src/main/java/org/gitlab4j/api/IssuesApi.java
@@ -16,6 +16,7 @@ import org.gitlab4j.api.models.IssueFilter;
import org.gitlab4j.api.models.IssueLink;
import org.gitlab4j.api.models.IssuesStatistics;
import org.gitlab4j.api.models.IssuesStatisticsFilter;
+import org.gitlab4j.api.models.LinkType;
import org.gitlab4j.api.models.MergeRequest;
import org.gitlab4j.api.models.Participant;
import org.gitlab4j.api.models.TimeStats;
@@ -889,10 +890,31 @@ public class IssuesApi extends AbstractApi implements Constants {
*/
public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid,
Object targetProjectIdOrPath, Long targetIssueIid) throws GitLabApiException {
+ return createIssueLink(projectIdOrPath, issueIid, targetProjectIdOrPath, targetIssueIid, null);
+ }
+
+ /**
+ * Creates a two-way relation between two issues. User must be allowed to update both issues in order to succeed.
+ *
+ *
NOTE: Only available in GitLab Starter, GitLab Bronze, and higher tiers.
+ *
+ * GitLab Endpoint: POST /projects/:id/issues/:issue_iid/links
+ *
+ * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
+ * @param issueIid the internal ID of a project's issue
+ * @param targetProjectIdOrPath the project in the form of an Long(ID), String(path), or Project instance of the target project
+ * @param targetIssueIid the internal ID of a target project’s issue
+ * @param linkType the type of the relation (optional), defaults to {@link LinkType#RELATES_TO}.
+ * @return an instance of IssueLink holding the link relationship
+ * @throws GitLabApiException if any exception occurs
+ */
+ public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid,
+ Object targetProjectIdOrPath, Long targetIssueIid, LinkType linkType) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("target_project_id", getProjectIdOrPath(targetProjectIdOrPath), true)
- .withParam("target_issue_iid", targetIssueIid, true);
+ .withParam("target_issue_iid", targetIssueIid, true)
+ .withParam("link_type", linkType, false);
Response response = post(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "links");
diff --git a/src/main/java/org/gitlab4j/api/Pager.java b/src/main/java/org/gitlab4j/api/Pager.java
index 66c1b1ec0e2b0e63723c30fff64159ea1ac37850..88c43cc33ab28bfe34a1dafb829987bb4411340a 100644
--- a/src/main/java/org/gitlab4j/api/Pager.java
+++ b/src/main/java/org/gitlab4j/api/Pager.java
@@ -69,7 +69,7 @@ public class Pager implements Iterator>, Constants {
* @param pathArgs HTTP path arguments
* @throws GitLabApiException if any error occurs
*/
- Pager(AbstractApi api, Class type, int itemsPerPage, MultivaluedMap queryParams, Object... pathArgs) throws GitLabApiException {
+ public Pager(AbstractApi api, Class type, int itemsPerPage, MultivaluedMap queryParams, Object... pathArgs) throws GitLabApiException {
javaType = mapper.getTypeFactory().constructCollectionType(List.class, type);
diff --git a/src/main/java/org/gitlab4j/api/RepositorySubmodulesApi.java b/src/main/java/org/gitlab4j/api/RepositorySubmodulesApi.java
new file mode 100644
index 0000000000000000000000000000000000000000..d47f14d4237bb6caf29507782f1774f112467893
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/RepositorySubmodulesApi.java
@@ -0,0 +1,42 @@
+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));
+ }
+
+}
diff --git a/src/main/java/org/gitlab4j/api/models/AbstractIssue.java b/src/main/java/org/gitlab4j/api/models/AbstractIssue.java
new file mode 100644
index 0000000000000000000000000000000000000000..c7a6e2e4559368ed8fe471f95a60170e6c401100
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/AbstractIssue.java
@@ -0,0 +1,340 @@
+
+package org.gitlab4j.api.models;
+
+import java.util.Date;
+import java.util.List;
+
+import org.gitlab4j.api.Constants.IssueState;
+import org.gitlab4j.api.utils.JacksonJson;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.node.IntNode;
+import com.fasterxml.jackson.databind.node.LongNode;
+import com.fasterxml.jackson.databind.node.TextNode;
+import com.fasterxml.jackson.databind.node.ValueNode;
+
+public abstract class AbstractIssue {
+
+ public static class TaskCompletionStatus {
+
+ private Integer count;
+ private Integer completedCount;
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public Integer getCompletedCount() {
+ return completedCount;
+ }
+
+ public void setCompletedCount(Integer completedCount) {
+ this.completedCount = completedCount;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+ }
+
+ private Assignee assignee;
+ private List assignees;
+ private Author author;
+ private Boolean confidential;
+ private Date createdAt;
+ private Date updatedAt;
+ private Date closedAt;
+ private User closedBy;
+ private String description;
+ private Date dueDate;
+
+ @JsonProperty("id")
+ private ValueNode actualId;
+ @JsonIgnore
+ private String externalId;
+ @JsonIgnore
+ private Long id;
+
+ private Long iid;
+ private List labels;
+ private Milestone milestone;
+ private Long projectId;
+ private IssueState state;
+ private String title;
+ private Integer userNotesCount;
+ private String webUrl;
+ private Integer weight;
+ private Boolean discussionLocked;
+ private TimeStats timeStats;
+
+ private Integer upvotes;
+ private Integer downvotes;
+ private Integer mergeRequestsCount;
+ private Boolean hasTasks;
+ private String taskStatus;
+ private TaskCompletionStatus taskCompletionStatus;
+
+ public Assignee getAssignee() {
+ return assignee;
+ }
+
+ public void setAssignee(Assignee assignee) {
+ this.assignee = assignee;
+ }
+
+ public List getAssignees() {
+ return assignees;
+ }
+
+ public void setAssignees(List assignees) {
+ this.assignees = assignees;
+ }
+
+ public Author getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(Author author) {
+ this.author = author;
+ }
+
+ public Boolean getConfidential() {
+ return confidential;
+ }
+
+ public void setConfidential(Boolean confidential) {
+ this.confidential = confidential;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getDueDate() {
+ return dueDate;
+ }
+
+ public void setDueDate(Date dueDate) {
+ this.dueDate = dueDate;
+ }
+
+ public ValueNode getActualId() {
+ return actualId;
+ }
+
+ public void setActualId(ValueNode id) {
+ actualId = id;
+ if (actualId instanceof TextNode) {
+ externalId = actualId.asText();
+ } else if (actualId instanceof IntNode || actualId instanceof LongNode) {
+ this.id = actualId.asLong();
+ }
+ }
+
+ public Long getId() {
+ return (id);
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ if (id != null) {
+ actualId = new LongNode(id);
+ externalId = null;
+ }
+ }
+
+ public String getExternalId() {
+ return (externalId);
+ }
+
+ public void setExternalId(String externalId) {
+ this.externalId = externalId;
+ if (externalId != null) {
+ actualId = new TextNode(externalId);
+ id = null;
+ }
+ }
+
+ public Long getIid() {
+ return iid;
+ }
+
+ public void setIid(Long iid) {
+ this.iid = iid;
+ }
+
+ public List getLabels() {
+ return labels;
+ }
+
+ public void setLabels(List labels) {
+ this.labels = labels;
+ }
+
+ public Milestone getMilestone() {
+ return milestone;
+ }
+
+ public void setMilestone(Milestone milestone) {
+ this.milestone = milestone;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public IssueState getState() {
+ return state;
+ }
+
+ public void setState(IssueState state) {
+ this.state = state;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public Date getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public void setUpdatedAt(Date updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getClosedAt() {
+ return closedAt;
+ }
+
+ public void setClosedAt(Date closedAt) {
+ this.closedAt = closedAt;
+ }
+
+ public User getClosedBy() {
+ return closedBy;
+ }
+
+ public void setClosedBy(User closedBy) {
+ this.closedBy = closedBy;
+ }
+
+ public Integer getUserNotesCount() {
+ return userNotesCount;
+ }
+
+ public void setUserNotesCount(Integer userNotesCount) {
+ this.userNotesCount = userNotesCount;
+ }
+
+ public String getWebUrl() {
+ return webUrl;
+ }
+
+ public void setWebUrl(String webUrl) {
+ this.webUrl = webUrl;
+ }
+
+ public Integer getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Integer weight) {
+ this.weight = weight;
+ }
+
+ public Boolean getDiscussionLocked() {
+ return discussionLocked;
+ }
+
+ public void setDiscussionLocked(Boolean discussionLocked) {
+ this.discussionLocked = discussionLocked;
+ }
+
+ public TimeStats getTimeStats() {
+ return timeStats;
+ }
+
+ public void setTimeStats(TimeStats timeStats) {
+ this.timeStats = timeStats;
+ }
+
+ public Integer getUpvotes() {
+ return upvotes;
+ }
+
+ public void setUpvotes(Integer upvotes) {
+ this.upvotes = upvotes;
+ }
+
+ public Integer getDownvotes() {
+ return downvotes;
+ }
+
+ public void setDownvotes(Integer downvotes) {
+ this.downvotes = downvotes;
+ }
+
+ public Integer getMergeRequestsCount() {
+ return mergeRequestsCount;
+ }
+
+ public void setMergeRequestsCount(Integer mergeRequestsCount) {
+ this.mergeRequestsCount = mergeRequestsCount;
+ }
+
+ public Boolean getHasTasks() {
+ return hasTasks;
+ }
+
+ public void setHasTasks(Boolean hasTasks) {
+ this.hasTasks = hasTasks;
+ }
+
+ public String getTaskStatus() {
+ return taskStatus;
+ }
+
+ public void setTaskStatus(String taskStatus) {
+ this.taskStatus = taskStatus;
+ }
+
+ public TaskCompletionStatus getTaskCompletionStatus() {
+ return taskCompletionStatus;
+ }
+
+ public void setTaskCompletionStatus(TaskCompletionStatus taskCompletionStatus) {
+ this.taskCompletionStatus = taskCompletionStatus;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/models/Commit.java b/src/main/java/org/gitlab4j/api/models/Commit.java
index 9dac063ee064984bb1b91f6c565ebdd0318921f5..557454332f6bb5a3165572acf9adf7d83ca436db 100644
--- a/src/main/java/org/gitlab4j/api/models/Commit.java
+++ b/src/main/java/org/gitlab4j/api/models/Commit.java
@@ -26,6 +26,7 @@ public class Commit {
private String title;
private String url;
private String webUrl;
+ private Long projectId;
private Pipeline lastPipeline;
public Author getAuthor() {
@@ -172,6 +173,14 @@ public class Commit {
this.webUrl = webUrl;
}
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
public Pipeline getLastPipeline() {
return lastPipeline;
}
diff --git a/src/main/java/org/gitlab4j/api/models/Epic.java b/src/main/java/org/gitlab4j/api/models/Epic.java
index fad92e5295d0aa7636c5d48ebecc6cc8952023d5..0effae18574d2f36a2a74e8552d9f7cd24963100 100644
--- a/src/main/java/org/gitlab4j/api/models/Epic.java
+++ b/src/main/java/org/gitlab4j/api/models/Epic.java
@@ -2,22 +2,66 @@ package org.gitlab4j.api.models;
import java.util.Date;
import java.util.List;
+import java.util.Map;
+import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
import org.gitlab4j.api.utils.JacksonJson;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonValue;
+
public class Epic {
+ public enum EpicState {
+ OPENED, CLOSED, ALL;
+
+ private static JacksonJsonEnumHelper enumHelper = new JacksonJsonEnumHelper<>(EpicState.class);
+
+ @JsonCreator
+ public static EpicState forValue(String value) {
+ return enumHelper.forValue(value);
+ }
+
+ @JsonValue
+ public String toValue() {
+ return (enumHelper.toString(this));
+ }
+
+ public String toString() {
+ return (enumHelper.toString(this));
+ }
+ }
+
private Long id;
private Long iid;
private Long groupId;
+ private Long parentId;
+ private Long parentIid;
private String title;
private String description;
+ private EpicState state;
+ private String webUrl;
+ private String reference;
+ private References references;
private Author author;
private List labels;
private Date startDate;
+ private Boolean startDateIsFixed;
+ private Date dueDate;
+ private Boolean dueDateIsFixed;
+ private Date dueDateFromInheritedSource;
private Date endDate;
private Date createdAt;
private Date updatedAt;
+ private Date closedAt;
+ private Integer downvotes;
+ private Integer upvotes;
+ private String color;
+ private Boolean subscribed;
+ @JsonProperty("_links")
+ private Map links;
public Long getId() {
return id;
@@ -43,6 +87,22 @@ public class Epic {
this.groupId = groupId;
}
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+
+ public Long getParentIid() {
+ return parentIid;
+ }
+
+ public void setParentIid(Long parentIid) {
+ this.parentIid = parentIid;
+ }
+
public String getTitle() {
return title;
}
@@ -69,6 +129,38 @@ public class Epic {
return (this);
}
+ public EpicState getState() {
+ return state;
+ }
+
+ public void setState(EpicState state) {
+ this.state = state;
+ }
+
+ public String getWebUrl() {
+ return webUrl;
+ }
+
+ public void setWebUrl(String webUrl) {
+ this.webUrl = webUrl;
+ }
+
+ public String getReference() {
+ return reference;
+ }
+
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ public References getReferences() {
+ return references;
+ }
+
+ public void setReferences(References references) {
+ this.references = references;
+ }
+
public Author getAuthor() {
return author;
}
@@ -108,6 +200,38 @@ public class Epic {
return (this);
}
+ public Boolean getStartDateIsFixed() {
+ return startDateIsFixed;
+ }
+
+ public void setStartDateIsFixed(Boolean startDateIsFixed) {
+ this.startDateIsFixed = startDateIsFixed;
+ }
+
+ public Date getDueDate() {
+ return dueDate;
+ }
+
+ public void setDueDate(Date dueDate) {
+ this.dueDate = dueDate;
+ }
+
+ public Boolean getDueDateIsFixed() {
+ return dueDateIsFixed;
+ }
+
+ public void setDueDateIsFixed(Boolean dueDateIsFixed) {
+ this.dueDateIsFixed = dueDateIsFixed;
+ }
+
+ public Date getDueDateFromInheritedSource() {
+ return dueDateFromInheritedSource;
+ }
+
+ public void setDueDateFromInheritedSource(Date dueDateFromInheritedSource) {
+ this.dueDateFromInheritedSource = dueDateFromInheritedSource;
+ }
+
public Date getEndDate() {
return endDate;
}
@@ -137,7 +261,63 @@ public class Epic {
this.updatedAt = updatedAt;
}
- @Override
+ public Date getClosedAt() {
+ return closedAt;
+ }
+
+ public void setClosedAt(Date closedAt) {
+ this.closedAt = closedAt;
+ }
+
+ public Integer getDownvotes() {
+ return downvotes;
+ }
+
+ public void setDownvotes(Integer downvotes) {
+ this.downvotes = downvotes;
+ }
+
+ public Integer getUpvotes() {
+ return upvotes;
+ }
+
+ public void setUpvotes(Integer upvotes) {
+ this.upvotes = upvotes;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public Boolean getSubscribed() {
+ return subscribed;
+ }
+
+ public void setSubscribed(Boolean subscribed) {
+ this.subscribed = subscribed;
+ }
+
+ public Map getLinks() {
+ return links;
+ }
+
+ public void setLinks(Map links) {
+ this.links = links;
+ }
+
+ @JsonIgnore
+ public String getLinkByName(String name) {
+ if (links == null || links.isEmpty()) {
+ return (null);
+ }
+
+ return (links.get(name));
+ }
+
public String toString() {
return (JacksonJson.toJsonString(this));
}
diff --git a/src/main/java/org/gitlab4j/api/models/Event.java b/src/main/java/org/gitlab4j/api/models/Event.java
index 8ca23342f87f65e51479e2efa747f1fd73a49f46..904be6823cae06185e5770a3e5e689e432b0c9ce 100644
--- a/src/main/java/org/gitlab4j/api/models/Event.java
+++ b/src/main/java/org/gitlab4j/api/models/Event.java
@@ -8,6 +8,7 @@ import org.gitlab4j.api.utils.JacksonJson;
public class Event {
+ private Long id;
private String actionName;
private Author author;
private Long authorId;
@@ -24,6 +25,14 @@ public class Event {
private Note note;
private PushData pushData;
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
public String getActionName() {
return actionName;
}
diff --git a/src/main/java/org/gitlab4j/api/models/Issue.java b/src/main/java/org/gitlab4j/api/models/Issue.java
index 4a234ede8fc4069b28e528bcca6b7f59f7ac0d8a..5cd47f8034cb549665deed5970078b40841ceb9f 100644
--- a/src/main/java/org/gitlab4j/api/models/Issue.java
+++ b/src/main/java/org/gitlab4j/api/models/Issue.java
@@ -2,226 +2,17 @@
package org.gitlab4j.api.models;
import java.util.Date;
-import java.util.List;
-import org.gitlab4j.api.Constants.IssueState;
import org.gitlab4j.api.utils.JacksonJson;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.node.IntNode;
-import com.fasterxml.jackson.databind.node.LongNode;
-import com.fasterxml.jackson.databind.node.TextNode;
-import com.fasterxml.jackson.databind.node.ValueNode;
+public class Issue extends AbstractIssue {
-public class Issue {
-
- public static class TaskCompletionStatus {
-
- private Integer count;
- private Integer completedCount;
-
- public Integer getCount() {
- return count;
- }
-
- public void setCount(Integer count) {
- this.count = count;
- }
-
- public Integer getCompletedCount() {
- return completedCount;
- }
-
- public void setCompletedCount(Integer completedCount) {
- this.completedCount = completedCount;
- }
-
- @Override
- public String toString() {
- return (JacksonJson.toJsonString(this));
- }
- }
-
- private Assignee assignee;
- private List assignees;
- private Author author;
- private Boolean confidential;
- private Date createdAt;
- private Date updatedAt;
- private Date closedAt;
- private User closedBy;
- private String description;
- private Date dueDate;
-
- @JsonProperty("id")
- private ValueNode actualId;
- @JsonIgnore
- private String externalId;
- @JsonIgnore
- private Long id;
-
- private Long iid;
- private Long issueLinkId;
- private List labels;
- private Milestone milestone;
- private Long projectId;
- private IssueState state;
private Boolean subscribed;
- private String title;
- private Integer userNotesCount;
- private String webUrl;
- private Integer weight;
- private Boolean discussionLocked;
- private TimeStats timeStats;
-
- private Integer upvotes;
- private Integer downvotes;
- private Integer mergeRequestsCount;
- private Boolean hasTasks;
- private String taskStatus;
- private TaskCompletionStatus taskCompletionStatus;
-
- public Assignee getAssignee() {
- return assignee;
- }
-
- public void setAssignee(Assignee assignee) {
- this.assignee = assignee;
- }
-
- public List getAssignees() {
- return assignees;
- }
-
- public void setAssignees(List assignees) {
- this.assignees = assignees;
- }
-
- public Author getAuthor() {
- return author;
- }
-
- public void setAuthor(Author author) {
- this.author = author;
- }
-
- public Boolean getConfidential() {
- return confidential;
- }
-
- public void setConfidential(Boolean confidential) {
- this.confidential = confidential;
- }
-
- public Date getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Date getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(Date dueDate) {
- this.dueDate = dueDate;
- }
-
- public ValueNode getActualId() {
- return actualId;
- }
-
- public void setActualId(ValueNode id) {
- actualId = id;
- if (actualId instanceof TextNode) {
- externalId = actualId.asText();
- } else if (actualId instanceof IntNode || actualId instanceof LongNode) {
- this.id = actualId.asLong();
- }
- }
-
- public Long getId() {
- return (id);
- }
-
- public void setId(Long id) {
- this.id = id;
- if (id != null) {
- actualId = new LongNode(id);
- externalId = null;
- }
- }
-
- public String getExternalId() {
- return (externalId);
- }
-
- public void setExternalId(String externalId) {
- this.externalId = externalId;
- if (externalId != null) {
- actualId = new TextNode(externalId);
- id = null;
- }
- }
-
- public Long getIid() {
- return iid;
- }
-
- public void setIid(Long iid) {
- this.iid = iid;
- }
-
- public Long getIssueLinkId() {
- return issueLinkId;
- }
-
- public void setIssueLinkId(Long issueLinkId) {
- this.issueLinkId = issueLinkId;
- }
- public List getLabels() {
- return labels;
- }
-
- public void setLabels(List labels) {
- this.labels = labels;
- }
-
- public Milestone getMilestone() {
- return milestone;
- }
-
- public void setMilestone(Milestone milestone) {
- this.milestone = milestone;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public void setProjectId(Long projectId) {
- this.projectId = projectId;
- }
-
- public IssueState getState() {
- return state;
- }
-
- public void setState(IssueState state) {
- this.state = state;
- }
+ private Long issueLinkId;
+ private LinkType linkType;
+ private Date linkCreatedAt;
+ private Date linkUpdatedAt;
public Boolean getSubscribed() {
return subscribed;
@@ -231,124 +22,36 @@ public class Issue {
this.subscribed = subscribed;
}
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public Date getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Date updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- public Date getClosedAt() {
- return closedAt;
- }
-
- public void setClosedAt(Date closedAt) {
- this.closedAt = closedAt;
- }
-
- public User getClosedBy() {
- return closedBy;
- }
-
- public void setClosedBy(User closedBy) {
- this.closedBy = closedBy;
- }
-
- public Integer getUserNotesCount() {
- return userNotesCount;
- }
-
- public void setUserNotesCount(Integer userNotesCount) {
- this.userNotesCount = userNotesCount;
- }
-
- public String getWebUrl() {
- return webUrl;
- }
-
- public void setWebUrl(String webUrl) {
- this.webUrl = webUrl;
- }
-
- public Integer getWeight() {
- return weight;
- }
-
- public void setWeight(Integer weight) {
- this.weight = weight;
- }
-
- public Boolean getDiscussionLocked() {
- return discussionLocked;
- }
-
- public void setDiscussionLocked(Boolean discussionLocked) {
- this.discussionLocked = discussionLocked;
- }
-
- public TimeStats getTimeStats() {
- return timeStats;
- }
-
- public void setTimeStats(TimeStats timeStats) {
- this.timeStats = timeStats;
- }
-
- public Integer getUpvotes() {
- return upvotes;
- }
-
- public void setUpvotes(Integer upvotes) {
- this.upvotes = upvotes;
- }
-
- public Integer getDownvotes() {
- return downvotes;
- }
-
- public void setDownvotes(Integer downvotes) {
- this.downvotes = downvotes;
- }
-
- public Integer getMergeRequestsCount() {
- return mergeRequestsCount;
+ public Long getIssueLinkId() {
+ return issueLinkId;
}
- public void setMergeRequestsCount(Integer mergeRequestsCount) {
- this.mergeRequestsCount = mergeRequestsCount;
+ public void setIssueLinkId(Long issueLinkId) {
+ this.issueLinkId = issueLinkId;
}
- public Boolean getHasTasks() {
- return hasTasks;
+ public LinkType getLinkType() {
+ return linkType;
}
- public void setHasTasks(Boolean hasTasks) {
- this.hasTasks = hasTasks;
+ public void setLinkType(LinkType linkType) {
+ this.linkType = linkType;
}
- public String getTaskStatus() {
- return taskStatus;
+ public Date getLinkCreatedAt() {
+ return linkCreatedAt;
}
- public void setTaskStatus(String taskStatus) {
- this.taskStatus = taskStatus;
+ public void setLinkCreatedAt(Date linkCreatedAt) {
+ this.linkCreatedAt = linkCreatedAt;
}
- public TaskCompletionStatus getTaskCompletionStatus() {
- return taskCompletionStatus;
+ public Date getLinkUpdatedAt() {
+ return linkUpdatedAt;
}
- public void setTaskCompletionStatus(TaskCompletionStatus taskCompletionStatus) {
- this.taskCompletionStatus = taskCompletionStatus;
+ public void setLinkUpdatedAt(Date linkUpdatedAt) {
+ this.linkUpdatedAt = linkUpdatedAt;
}
@Override
diff --git a/src/main/java/org/gitlab4j/api/models/IssueLink.java b/src/main/java/org/gitlab4j/api/models/IssueLink.java
index bf245aea84a888c6eaa7357de28f1c8f0cc2d22f..77752dadb6a6fac1b2e34497e208dc7d4d6b9816 100644
--- a/src/main/java/org/gitlab4j/api/models/IssueLink.java
+++ b/src/main/java/org/gitlab4j/api/models/IssueLink.java
@@ -6,6 +6,7 @@ public class IssueLink {
private Issue sourceIssue;
private Issue targetIssue;
+ private LinkType linkType;
public Issue getSourceIssue() {
return sourceIssue;
@@ -23,6 +24,14 @@ public class IssueLink {
this.targetIssue = targetIssue;
}
+ public LinkType getLinkType() {
+ return linkType;
+ }
+
+ public void setLinkType(LinkType linkType) {
+ this.linkType = linkType;
+ }
+
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
diff --git a/src/main/java/org/gitlab4j/api/models/LinkType.java b/src/main/java/org/gitlab4j/api/models/LinkType.java
new file mode 100644
index 0000000000000000000000000000000000000000..18f2fda3bed45f93cf8b3220efc1655237a8e00a
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/LinkType.java
@@ -0,0 +1,32 @@
+package org.gitlab4j.api.models;
+
+import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Enum to model the type of link between issues or epics
+ */
+public enum LinkType {
+ RELATES_TO,
+ BLOCKS,
+ IS_BLOCKED_BY;
+
+ private static JacksonJsonEnumHelper enumHelper = new JacksonJsonEnumHelper<>(LinkType.class);
+
+ @JsonCreator
+ public static LinkType forValue(String value) {
+ return enumHelper.forValue(value);
+ }
+
+ @JsonValue
+ public String toValue() {
+ return (enumHelper.toString(this));
+ }
+
+ @Override
+ public String toString() {
+ return (enumHelper.toString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/models/Pipeline.java b/src/main/java/org/gitlab4j/api/models/Pipeline.java
index c5203f90195e98a55784ac814b6734078681e97d..c9cc1f907781777912c2a4f5c2c0f90592dfd454 100644
--- a/src/main/java/org/gitlab4j/api/models/Pipeline.java
+++ b/src/main/java/org/gitlab4j/api/models/Pipeline.java
@@ -8,8 +8,10 @@ import org.gitlab4j.api.utils.JacksonJson;
public class Pipeline {
private Long id;
+ private Long iid;
private Long projectId;
private PipelineStatus status;
+ private String source;
private String ref;
private String sha;
private String beforeSha;
@@ -35,6 +37,14 @@ public class Pipeline {
this.id = id;
}
+ public Long getIid() {
+ return iid;
+ }
+
+ public void setIid(Long iid) {
+ this.iid = iid;
+ }
+
public Long getProjectId() {
return projectId;
}
@@ -51,6 +61,14 @@ public class Pipeline {
this.status = status;
}
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
public String getRef() {
return ref;
}
diff --git a/src/main/java/org/gitlab4j/api/models/SearchBlob.java b/src/main/java/org/gitlab4j/api/models/SearchBlob.java
index 63830dbe91ca777162786ca766ac03c14f597f9c..21377499b831e650a83d4a32f4aed851cc5347a1 100644
--- a/src/main/java/org/gitlab4j/api/models/SearchBlob.java
+++ b/src/main/java/org/gitlab4j/api/models/SearchBlob.java
@@ -7,7 +7,7 @@ public class SearchBlob {
private String basename;
private String data;
private String filename;
- private Long id;
+ private String id;
private String ref;
private Integer startline;
private Long projectId;
@@ -36,11 +36,11 @@ public class SearchBlob {
this.filename = filename;
}
- public Long getId() {
+ public String getId() {
return id;
}
- public void setId(Long id) {
+ public void setId(String id) {
this.id = id;
}
diff --git a/src/test/java/org/gitlab4j/api/TestImportExportApi.java b/src/test/java/org/gitlab4j/api/TestImportExportApi.java
index 99353a5da0490dce58cda5a544bdb1a87226b2ca..7e5de81022cd44d266647705731d1ad008d1d7a2 100644
--- a/src/test/java/org/gitlab4j/api/TestImportExportApi.java
+++ b/src/test/java/org/gitlab4j/api/TestImportExportApi.java
@@ -138,7 +138,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
System.out.println("Downloading exported project");
exportDownload = gitLabApi.getImportExportApi().downloadExport(testProject, null);
assertNotNull(exportDownload);
- assertTrue(exportDownload.length() > 10000);
+ assertTrue(exportDownload.length() > 2000, "length is not as expected. Current value: " + exportDownload.length());
ImportStatus importStatus = gitLabApi.getImportExportApi().startImport(null, exportDownload,
TEST_IMPORT_PROJECT_NAME, true, null);
diff --git a/src/test/java/org/gitlab4j/api/TestRepositorySubmodulesApi.java b/src/test/java/org/gitlab4j/api/TestRepositorySubmodulesApi.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc1c746dd807c9098011e6872cad69829aac5f19
--- /dev/null
+++ b/src/test/java/org/gitlab4j/api/TestRepositorySubmodulesApi.java
@@ -0,0 +1,48 @@
+package org.gitlab4j.api;
+
+import static org.gitlab4j.api.JsonUtils.compareJson;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.openMocks;
+
+import java.io.IOException;
+
+import jakarta.ws.rs.core.MultivaluedMap;
+
+import org.gitlab4j.api.models.Commit;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+
+public class TestRepositorySubmodulesApi implements Constants {
+
+ @Mock private GitLabApi gitLabApi;
+ @Mock private GitLabApiClient gitLabApiClient;
+ @Captor private ArgumentCaptor> attributeCaptor;
+ private MockResponse response;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ openMocks(this);
+ }
+
+ @Test
+ public void testUpdateExistingSubmoduleReference() throws Exception {
+ init();
+ Commit result = new RepositorySubmodulesApi(gitLabApi).updateExistingSubmoduleReference(6L, "my-sub", "patch-1", "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30", "message");
+ assertNotNull(result);
+ assertTrue(compareJson(result, "commit.json"));
+ }
+
+ private void init() throws Exception, IOException {
+ response = new MockResponse(Commit.class, "commit.json", null);
+ when(gitLabApi.getApiClient()).thenReturn(gitLabApiClient);
+ when(gitLabApiClient.validateSecretToken(any())).thenReturn(true);
+ when(gitLabApiClient.put(attributeCaptor.capture(), Mockito.any())).thenReturn(response);
+ }
+}
diff --git a/src/test/resources/org/gitlab4j/api/commit.json b/src/test/resources/org/gitlab4j/api/commit.json
index 9f99984b29f5b122422e3148d064d8203a6ff8fb..7923fadd63f7219c43cf2553e9ce288c239ad473 100644
--- a/src/test/resources/org/gitlab4j/api/commit.json
+++ b/src/test/resources/org/gitlab4j/api/commit.json
@@ -20,5 +20,18 @@
},
"status": "running",
"url": "http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d",
- "web_url": "http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d"
+ "web_url": "http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d",
+ "project_id": 15,
+ "last_pipeline": {
+ "id": 16282,
+ "iid": 688,
+ "project_id": 15,
+ "sha": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
+ "ref": "patch-1",
+ "status": "success",
+ "source": "external",
+ "created_at": "2023-04-03T21:17:04.026Z",
+ "updated_at": "2023-04-03T21:17:04.157Z",
+ "web_url": "http://localhost/diaspora/diaspora-project-site/-/pipelines/16282"
+ }
}
diff --git a/src/test/resources/org/gitlab4j/api/epic.json b/src/test/resources/org/gitlab4j/api/epic.json
index 6ee2a080324f867fa1620e5903c693da07fbb882..8ba78fe7dd044676ffd09b3f0700d2460fa10af6 100644
--- a/src/test/resources/org/gitlab4j/api/epic.json
+++ b/src/test/resources/org/gitlab4j/api/epic.json
@@ -2,16 +2,42 @@
"id": 30,
"iid": 5,
"group_id": 7,
+ "parent_id": 3,
+ "parent_iid": 8,
"title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
"description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
+ "state": "opened",
+ "web_url": "http://gitlab.example.com/groups/test/-/epics/5",
+ "reference": "&5",
+ "references": {
+ "short": "&5",
+ "relative": "&5",
+ "full": "test&5"
+ },
"author":{
"id": 7,
"name": "Pamella Huel",
"username": "arnita",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
- "web_url": "http://localhost:3001/arnita"
+ "web_url": "http://gitlab.example.com/arnita"
},
- "created_at": "2018-01-21T06:21:13.165Z",
- "updated_at": "2018-01-22T12:41:41.166Z"
+ "start_date": "2018-07-01T00:00:00Z",
+ "start_date_is_fixed": false,
+ "due_date": "2018-07-31T00:00:00Z",
+ "due_date_is_fixed": false,
+ "due_date_from_inherited_source": "2018-07-31T00:00:00Z",
+ "created_at": "2018-07-17T13:36:22.770Z",
+ "updated_at": "2018-07-18T12:22:05.239Z",
+ "closed_at": "2018-08-18T12:22:05.239Z",
+ "labels": [],
+ "upvotes": 4,
+ "downvotes": 0,
+ "color": "#1068bf",
+ "subscribed": true,
+ "_links":{
+ "self": "http://gitlab.example.com/api/v4/groups/7/epics/5",
+ "epic_issues": "http://gitlab.example.com/api/v4/groups/7/epics/5/issues",
+ "group":"http://gitlab.example.com/api/v4/groups/7"
+ }
}
\ No newline at end of file
diff --git a/src/test/resources/org/gitlab4j/api/event.json b/src/test/resources/org/gitlab4j/api/event.json
index 8888488e7788a37f111d3ee319a53a991f5f0830..06d44cc17788ac66baa54fe97f8e3bffc122de1c 100644
--- a/src/test/resources/org/gitlab4j/api/event.json
+++ b/src/test/resources/org/gitlab4j/api/event.json
@@ -1,4 +1,5 @@
{
+ "id": 2,
"title": "this is a title",
"project_id": 15,
"action_name": "pushed",
diff --git a/src/test/resources/org/gitlab4j/api/events.json b/src/test/resources/org/gitlab4j/api/events.json
index cea8cb9ff70d146c835dcd96f929de0c417a979d..240543087686370ca48062407d3069df2d7bb583 100644
--- a/src/test/resources/org/gitlab4j/api/events.json
+++ b/src/test/resources/org/gitlab4j/api/events.json
@@ -1,12 +1,15 @@
[
{
+ "id": 8,
"title": "no title",
"project_id": 15,
"action_name": "closed",
"target_id": 830,
+ "target_iid": 160,
"target_type": "Issue",
"author_id": 1,
"target_title": "Public project search field",
+ "created_at": "2017-02-09T10:43:19.667Z",
"author": {
"name": "Dmitriy Zaporozhets",
"username": "root",
@@ -18,6 +21,7 @@
"author_username": "root"
},
{
+ "id": 9,
"title": "no title 2",
"project_id": 15,
"action_name": "pushed",
@@ -42,6 +46,7 @@
}
},
{
+ "id": 21,
"project_id": 15,
"action_name": "closed",
"target_id": 840,
@@ -59,10 +64,12 @@
"author_username": "root"
},
{
+ "id": 10,
"title": "no title again",
"project_id": 15,
"action_name": "commented on",
"target_id": 1312,
+ "target_iid": 1312,
"target_type": "Note",
"author_id": 1,
"created_at": "2015-12-04T10:33:58.089Z",
@@ -80,7 +87,8 @@
"created_at": "2015-12-04T10:33:56.698Z",
"system": false,
"noteable_id": 377,
- "noteable_type": "Issue"
+ "noteable_type": "Issue",
+ "noteable_iid": 377
},
"author": {
"name": "Dmitriy Zaporozhets",
diff --git a/src/test/resources/org/gitlab4j/api/issue-link.json b/src/test/resources/org/gitlab4j/api/issue-link.json
index 81a423152a0e94020a06d84cedcd1ca0cec60583..ba37f57686866ae081328fec94802a195efc916c 100644
--- a/src/test/resources/org/gitlab4j/api/issue-link.json
+++ b/src/test/resources/org/gitlab4j/api/issue-link.json
@@ -46,5 +46,6 @@
"user_notes_count": 0,
"web_url": "http://example.com/example/example/issues/14",
"confidential": false
- }
+ },
+ "link_type": "is_blocked_by"
}
\ No newline at end of file
diff --git a/src/test/resources/org/gitlab4j/api/linked-issues.json b/src/test/resources/org/gitlab4j/api/linked-issues.json
index 957c31f2e271fcd95aaf982642d2a5ea54fb64d8..daf4b172de5ff8db9f25bab76d024a6951a68387 100644
--- a/src/test/resources/org/gitlab4j/api/linked-issues.json
+++ b/src/test/resources/org/gitlab4j/api/linked-issues.json
@@ -22,6 +22,9 @@
"subscribed" : true,
"user_notes_count": 0,
"web_url": "http://example.com/example/example/issues/14",
- "confidential": false
+ "confidential": false,
+ "link_type": "relates_to",
+ "link_created_at": "2016-01-07T12:44:33.959Z",
+ "link_updated_at": "2016-01-07T12:44:33.959Z"
}
]
\ No newline at end of file
diff --git a/src/test/resources/org/gitlab4j/api/pipeline.json b/src/test/resources/org/gitlab4j/api/pipeline.json
index f6232b10a3ed42f99492b4c1404a367d17af1e2d..8edbf795cc6c8c2c2d17cf873b826611484ca275 100644
--- a/src/test/resources/org/gitlab4j/api/pipeline.json
+++ b/src/test/resources/org/gitlab4j/api/pipeline.json
@@ -1,11 +1,13 @@
{
"id": 46,
+ "iid": 11,
+ "project_id": 1,
"status": "success",
- "web_url": "http://3cb4fb3163d4/gitlab4j/test-project/pipelines/66",
- "ref": "master",
+ "ref": "main",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"tag": false,
+ "yaml_errors": "Included file `.gitlab-ci.yml` does not have valid YAML syntax!",
"user": {
"name": "Administrator",
"username": "root",
@@ -17,7 +19,7 @@
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z",
"finished_at": "2016-08-11T11:32:35.145Z",
- "coverage": "30.0",
+ "duration": 123,
"queued_duration": 0.010,
"detailed_status": {
"icon": "status_pending",
@@ -28,5 +30,7 @@
"has_details": true,
"details_path": "/gitlab4j/test-project/pipelines/66",
"favicon": "/assets/ci_favicons/favicon_status_pending-5bdf338420e5221ca24353b6bff1c9367189588750632e9a871b7af09ff6a2ae.png"
- }
+ },
+ "coverage": "30.0",
+ "web_url": "https://example.com/foo/bar/pipelines/46"
}
diff --git a/src/test/resources/org/gitlab4j/api/wiki-blobs.json b/src/test/resources/org/gitlab4j/api/wiki-blobs.json
index d9c0930d59d1f0f049c4fa241f8e1f26383adde6..3092982b787b09c825b5ec8bb492f63ea564467b 100644
--- a/src/test/resources/org/gitlab4j/api/wiki-blobs.json
+++ b/src/test/resources/org/gitlab4j/api/wiki-blobs.json
@@ -3,7 +3,7 @@
"basename": "home",
"data": "hello\n\nand bye\n\nend",
"filename": "home.md",
- "id": 123,
+ "id": "a0b24fa71d6d8cef7393e877c608496f91ded0f6",
"ref": "master",
"startline": 5,
"project_id": 6