Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 6.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/gitlab4j/api/GroupApi.java
  • Loading branch information
jmini committed Sep 19, 2023
2 parents 3067b34 + 55d3f92 commit dc944e1
Show file tree
Hide file tree
Showing 9 changed files with 415 additions and 9 deletions.
19 changes: 19 additions & 0 deletions src/main/java/org/gitlab4j/api/GroupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;

import org.gitlab4j.api.GitLabApi.ApiVersion;
Expand All @@ -22,6 +23,8 @@
import org.gitlab4j.api.models.GroupFilter;
import org.gitlab4j.api.models.GroupParams;
import org.gitlab4j.api.models.GroupProjectsFilter;
import org.gitlab4j.api.models.Iteration;
import org.gitlab4j.api.models.IterationFilter;
import org.gitlab4j.api.models.LdapGroupLink;
import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Project;
Expand Down Expand Up @@ -1958,4 +1961,20 @@ public void deleteCustomAttribute(final Object groupIdOrPath, final String key)

delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "custom_attributes", key);
}

/**
* Lists group iterations.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/iterations</code></pre>
*
* @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
* @param filter the iteration filter
* @return the list of group iterations
* @throws GitLabApiException if any exception occurs
*/
public List<Iteration> listGroupIterations(Object groupIdOrPath, IterationFilter filter) throws GitLabApiException {
MultivaluedMap<String,String> queryParams = (filter == null) ? null : filter.getQueryParams().asMap();
Response response = get(Response.Status.OK, queryParams, "groups", getGroupIdOrPath(groupIdOrPath), "iterations");
return (response.readEntity(new GenericType<List<Iteration>>() { }));
}
}
17 changes: 17 additions & 0 deletions src/main/java/org/gitlab4j/api/ProjectApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import org.gitlab4j.api.models.Event;
import org.gitlab4j.api.models.FileUpload;
import org.gitlab4j.api.models.Issue;
import org.gitlab4j.api.models.Iteration;
import org.gitlab4j.api.models.IterationFilter;
import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Namespace;
import org.gitlab4j.api.models.Project;
Expand Down Expand Up @@ -4015,4 +4017,19 @@ public void revokeProjectAccessToken(Object projectIdOrPath, Long tokenId) throw
delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "access_tokens", tokenId);
}

/**
* Lists project iterations.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/iterations</code></pre>
*
* @param projectIdOrPath the project in the form of a Long(ID), String(path), or Project instance
* @param filter the iteration filter
* @return the list of project iterations
* @throws GitLabApiException if any exception occurs
*/
public List<Iteration> listProjectIterations(Object projectIdOrPath, IterationFilter filter) throws GitLabApiException {
MultivaluedMap<String,String> queryParams = (filter == null) ? null : filter.getQueryParams().asMap();
Response response = get(Response.Status.OK, queryParams, "projects", getProjectIdOrPath(projectIdOrPath), "iterations");
return (response.readEntity(new GenericType<List<Iteration>>() { }));
}
}
11 changes: 10 additions & 1 deletion src/main/java/org/gitlab4j/api/models/AbstractIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public String toString() {
private Integer mergeRequestsCount;
private Boolean hasTasks;
private String taskStatus;
private Iteration iteration;
private TaskCompletionStatus taskCompletionStatus;

public Assignee getAssignee() {
Expand Down Expand Up @@ -325,7 +326,15 @@ public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}

public TaskCompletionStatus getTaskCompletionStatus() {
public Iteration getIteration() {
return iteration;
}

public void setIteration(Iteration iteration) {
this.iteration = iteration;
}

public TaskCompletionStatus getTaskCompletionStatus() {
return taskCompletionStatus;
}

Expand Down
129 changes: 129 additions & 0 deletions src/main/java/org/gitlab4j/api/models/Iteration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package org.gitlab4j.api.models;

import java.util.Date;

import org.gitlab4j.api.utils.JacksonJson;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public class Iteration {
public enum IterationState {
UPCOMMING(1), CURRENT(2), CLOSED(3);

private int value;

IterationState(int value) {
this.value = value;
}

@JsonCreator
public static IterationState fromIntValue(int value) {
for (IterationState it : values()) {
if(it.value == value) {
return it;
}
}
throw new IllegalArgumentException("No enum found for value: " + value);
}

@JsonValue
public int toIntValue() {
return this.value;
}

@Override
public String toString() {
return name();
}
}

private Long id;
private Long iid;
private Long sequence;
private Long groupId;
private String title;
private String description;
private IterationState state;
private Date createdAt;
private Date updatedAt;
private Date startDate;
private Date dueDate;
private String webUrl;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getIid() {
return iid;
}
public void setIid(Long iid) {
this.iid = iid;
}
public Long getSequence() {
return sequence;
}
public void setSequence(Long sequence) {
this.sequence = sequence;
}
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public IterationState getState() {
return state;
}
public void setState(IterationState state) {
this.state = state;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
public String getWebUrl() {
return webUrl;
}
public void setWebUrl(String webUrl) {
this.webUrl = webUrl;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
Loading

0 comments on commit dc944e1

Please sign in to comment.