diff --git a/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java b/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java
new file mode 100644
index 000000000..e0d04a26d
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/ExternalStatusCheckApi.java
@@ -0,0 +1,275 @@
+package org.gitlab4j.api;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.Response;
+
+import org.gitlab4j.api.models.ExternalStatusCheck;
+import org.gitlab4j.api.models.ExternalStatusCheckProtectedBranch;
+import org.gitlab4j.api.models.ExternalStatusCheckResult;
+import org.gitlab4j.api.models.ExternalStatusCheckStatus;
+import org.gitlab4j.api.models.ExternalStatusCheckStatus.Status;
+
+/**
+ * This class implements the client side API for the GitLab external status checks.
+ * See External Status Checks API for more information.
+ */
+public class ExternalStatusCheckApi extends AbstractApi {
+
+ public ExternalStatusCheckApi(GitLabApi gitLabApi) {
+ super(gitLabApi);
+ }
+
+ /**
+ * Gets a list of all external status checks for a given project.
+ *
+ *
GitLab Endpoint: GET /projects/:id/external_status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @return a List of ExternalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public List getExternalStatusChecks(Object projectIdOrPath) throws GitLabApiException {
+ return (getExternalStatusChecks(projectIdOrPath, getDefaultPerPage()).all());
+ }
+
+ /**
+ * Gets a Pager of all external status checks for a given project.
+ *
+ *
GitLab Endpoint: GET /projects/:id/external_status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param itemsPerPage the number of ExternalStatusCheck instances that will be fetched per page
+ * @return the Pager of ExternalStatusCheck instances
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Pager getExternalStatusChecks(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
+ return (new Pager(this, ExternalStatusCheck.class, itemsPerPage, null,
+ "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks"));
+ }
+
+ /**
+ * Gets a Stream of all external status checks for a given project.
+ *
+ *
GitLab Endpoint: GET /projects/:id/external_status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @return a Stream of ExternalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Stream getExternalStatusChecksStream(Object projectIdOrPath) throws GitLabApiException {
+ return (getExternalStatusChecks(projectIdOrPath, getDefaultPerPage()).stream());
+ }
+
+ /**
+ * Creates a new external status check.
+ *
+ *
GitLab Endpoint: POST /projects/:id/external_status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param name Display name of external status check (required)
+ * @param externalUrl URL of external status check resource (optional)
+ * @param protectedBranchIds IDs of protected branches to scope the rule by (optional)
+ * @return an ExternalStatusCheck instance containing info on the newly created externalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ExternalStatusCheck createExternalStatusCheck(Object projectIdOrPath, String name, String externalUrl, List protectedBranchIds) throws GitLabApiException {
+ Form formData = new GitLabApiForm()
+ .withParam("name", name, true)
+ .withParam("external_url", externalUrl, true)
+ .withParam("protected_branch_ids", protectedBranchIds);
+ Response response = post(Response.Status.CREATED, formData.asMap(),
+ "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks");
+ return (response.readEntity(ExternalStatusCheck.class));
+ }
+
+ /**
+ * Creates a new external status check using the information contained in the provided ExternalStatusCheck instance. Only the following
+ * fields from the ExternalStatusCheck instance are used:
+ *
+ * name - Display name of external status check (required)
+ * external url - URL of external status check resource (required)
+ * protected branches - the id of the protected branches (optional)
+ *
+ *
+ *
GitLab Endpoint: POST /projects/:id/external_status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param externalStatusCheck the ExternalStatusCheck instance with information for the new external status check
+ * @return an ExternalStatusCheck instance containing info on the newly created externalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ExternalStatusCheck createExternalStatusCheck(Object projectIdOrPath, ExternalStatusCheck externalStatusCheck) throws GitLabApiException {
+ List protectedBranchIds;
+ if(externalStatusCheck.getProtectedBranches() == null) {
+ protectedBranchIds = null;
+ } else {
+ protectedBranchIds = externalStatusCheck.getProtectedBranches().stream().map(ExternalStatusCheckProtectedBranch::getId).collect(Collectors.toList());
+ }
+ Form formData = new GitLabApiForm()
+ .withParam("name", externalStatusCheck.getName(), true)
+ .withParam("external_url", externalStatusCheck.getExternalUrl(), true)
+ .withParam("protected_branch_ids", protectedBranchIds);
+ Response response = post(Response.Status.CREATED, formData.asMap(),
+ "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks");
+ return (response.readEntity(ExternalStatusCheck.class));
+ }
+
+ /**
+ * Updates an existing external status check.
+ *
+ *
GitLab Endpoint: PUT /projects/:id/external_status_checks/:check_id
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param checkId ID of an external status check to update (required)
+ * @param name Display name of external status check (optional)
+ * @param externalUrl URL of external status check resource (optional)
+ * @param protectedBranchIds IDs of protected branches to scope the rule by (optional)
+ * @return an ExternalStatusCheck instance containing info on the newly created ExternalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ExternalStatusCheck updateExternalStatusCheck(Object projectIdOrPath, Long checkId, String name, String externalUrl, List protectedBranchIds) throws GitLabApiException {
+ Form formData = new GitLabApiForm()
+ .withParam("name", name)
+ .withParam("external_url", externalUrl)
+ .withParam("protected_branch_ids", protectedBranchIds);
+ Response response = put(Response.Status.OK, formData.asMap(),
+ "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks", checkId);
+ return (response.readEntity(ExternalStatusCheck.class));
+ }
+
+ /**
+ * Updates an external status check using the information contained in the provided ExternalStatusCheck instance. Only the following
+ * fields from the ExternalStatusCheck instance are used:
+ *
+ * id - the id of the external status check (required)
+ * name - Display name of external status check (optional)
+ * external url - URL of external status check resource (optional)
+ * protected branches - the id of the protected branches (optional)
+ *
+ *
GitLab Endpoint: PUT /projects/:id/external_status_checks/:check_id
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param externalStatusCheck the ExternalStatusCheck instance with update information
+ * @return an ExternalStatusCheck instance containing info on the updated ExternalStatusCheck
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ExternalStatusCheck updateExternalStatusCheck(Object projectIdOrPath, ExternalStatusCheck externalStatusCheck) throws GitLabApiException {
+ if (externalStatusCheck == null || externalStatusCheck.getId() == null) {
+ throw new GitLabApiException("the specified external status check is null or has no id");
+ }
+ List protectedBranchIds = getProtectedBranchIds(externalStatusCheck);
+ Form formData = new GitLabApiForm()
+ .withParam("name", externalStatusCheck.getName())
+ .withParam("external_url", externalStatusCheck.getExternalUrl())
+ .withParam("protected_branch_ids", protectedBranchIds);
+ Response response = put(Response.Status.OK, formData.asMap(),
+ "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks", externalStatusCheck.getId());
+ return (response.readEntity(ExternalStatusCheck.class));
+ }
+
+ private List getProtectedBranchIds(ExternalStatusCheck externalStatusCheck) {
+ if(externalStatusCheck.getProtectedBranches() == null) {
+ return null;
+ }
+ return externalStatusCheck.getProtectedBranches().stream().map(ExternalStatusCheckProtectedBranch::getId).collect(Collectors.toList());
+ }
+
+ /**
+ * Deletes an external status check.
+ *
+ *
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param checkId ID of an external status check
+ * @throws GitLabApiException if any exception occurs
+ */
+ public void deleteExternalStatusCheck(Object projectIdOrPath, Long checkId) throws GitLabApiException {
+ delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "external_status_checks", checkId);
+ }
+
+ /**
+ * Gets a list of all statuses of the external status checks for a given merge request.
+ *
+ *
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param mergeRequestIid the merge request IID to get the statuses
+ * @return a List of ExternalStatusCheckStatus
+ * @throws GitLabApiException if any exception occurs
+ */
+ public List getExternalStatusCheckStatuses(Object projectIdOrPath, Long mergeRequestIid) throws GitLabApiException {
+ return (getExternalStatusCheckStatuses(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).all());
+ }
+
+ /**
+ * Gets a Pager of all statuses of the external status checks for a given merge request.
+ *
+ *
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param mergeRequestIid the merge request IID to get the statuses
+ * @param itemsPerPage the number of ExternalStatusCheckStatus instances that will be fetched per page
+ * @return the Pager of ExternalStatusCheckStatus instances
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Pager getExternalStatusCheckStatuses(Object projectIdOrPath, Long mergeRequestIid, int itemsPerPage) throws GitLabApiException {
+ return (new Pager(this, ExternalStatusCheckStatus.class, itemsPerPage, null,
+ "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "status_checks"));
+ }
+
+ /**
+ * Gets a Stream of all statuses of the external status checks for a given merge request.
+ *
+ *
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/status_checks
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param mergeRequestIid the merge request IID to get the statuses
+ * @return a Stream of ExternalStatusCheckStatus
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Stream getExternalStatusCheckStatusesStream(Object projectIdOrPath, Long mergeRequestIid) throws GitLabApiException {
+ return (getExternalStatusCheckStatuses(projectIdOrPath, mergeRequestIid, getDefaultPerPage()).stream());
+ }
+
+ /**
+ * Set the status of an external status check for a given merge request.
+ *
+ *
GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/status_check_responses
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param mergeRequestIid the merge request IID to get the statuses
+ * @param sha the commit SHA to set the status for (required)
+ * @param externalStatusCheckId ID of an external status check (required)
+ * @param status the status to set (optional)
+ * @return an ExternalStatusCheckResult instance containing info on the newly created status
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ExternalStatusCheckResult setStatusOfExternalStatusCheck(Object projectIdOrPath, Long mergeRequestIid, String sha, Long externalStatusCheckId, Status status) throws GitLabApiException {
+ Form formData = new GitLabApiForm()
+ .withParam("sha", sha)
+ .withParam("external_status_check_id", externalStatusCheckId)
+ .withParam("status", status);
+ Response response = post(Response.Status.CREATED, formData.asMap(),
+ "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "status_check_responses");
+ return (response.readEntity(ExternalStatusCheckResult.class));
+ }
+
+ /**
+ * Retry the specified failed external status check for a single merge request. Even though the merge request hasn’t changed, this endpoint resends the current state of merge request to the defined external service.
+ *
+ *
GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/status_checks/:external_status_check_id/retry
+ *
+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
+ * @param mergeRequestIid the merge request IID to get the statuses
+ * @param externalStatusCheckId ID of an external status check
+ * @throws GitLabApiException if any exception occurs
+ */
+ public void retryExternalStatusCheck(Object projectIdOrPath, Long mergeRequestIid, Long externalStatusCheckId) throws GitLabApiException {
+ post(Response.Status.ACCEPTED, (Form)null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "status_checks", externalStatusCheckId, "retry");
+ }
+
+}
diff --git a/src/main/java/org/gitlab4j/api/GitLabApi.java b/src/main/java/org/gitlab4j/api/GitLabApi.java
index 051b73674..ecc65d3d1 100644
--- a/src/main/java/org/gitlab4j/api/GitLabApi.java
+++ b/src/main/java/org/gitlab4j/api/GitLabApi.java
@@ -64,6 +64,7 @@ public String getApiNamespace() {
private EnvironmentsApi environmentsApi;
private EpicsApi epicsApi;
private EventsApi eventsApi;
+ private ExternalStatusCheckApi externalStatusCheckApi;
private GroupApi groupApi;
private HealthCheckApi healthCheckApi;
private ImportExportApi importExportApi;
@@ -1087,6 +1088,26 @@ public EventsApi getEventsApi() {
return (eventsApi);
}
+ /**
+ * Gets the ExternalStatusCheckApi instance owned by this GitLabApi instance. The ExternalStatusCheckApi is used
+ * to perform all the external status checks related API calls.
+ *
+ * @return the ExternalStatusCheckApi instance owned by this GitLabApi instance
+ */
+ public ExternalStatusCheckApi getExternalStatusCheckApi() {
+
+ if (externalStatusCheckApi == null) {
+ synchronized (this) {
+ if (externalStatusCheckApi == null) {
+ externalStatusCheckApi = new ExternalStatusCheckApi(this);
+ }
+ }
+ }
+
+ return (externalStatusCheckApi);
+ }
+
+
/**
* Gets the GroupApi instance owned by this GitLabApi instance. The GroupApi is used
* to perform all group related API calls.
diff --git a/src/main/java/org/gitlab4j/api/models/ExternalStatusCheck.java b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheck.java
new file mode 100644
index 000000000..3d90d6827
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheck.java
@@ -0,0 +1,59 @@
+package org.gitlab4j.api.models;
+
+import org.gitlab4j.api.utils.JacksonJson;
+
+import java.util.List;
+
+public class ExternalStatusCheck {
+
+ private Long id;
+ private String name;
+ private Long projectId;
+ private String externalUrl;
+ private List protectedBranches;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getExternalUrl() {
+ return externalUrl;
+ }
+
+ public void setExternalUrl(String externalUrl) {
+ this.externalUrl = externalUrl;
+ }
+
+ public List getProtectedBranches() {
+ return protectedBranches;
+ }
+
+ public void setProtectedBranches(List protectedBranches) {
+ this.protectedBranches = protectedBranches;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckProtectedBranch.java b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckProtectedBranch.java
new file mode 100644
index 000000000..6f0d9fcc4
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckProtectedBranch.java
@@ -0,0 +1,71 @@
+
+package org.gitlab4j.api.models;
+
+import java.util.Date;
+import java.util.List;
+
+import org.gitlab4j.api.utils.JacksonJson;
+
+public class ExternalStatusCheckProtectedBranch {
+
+ private Long id;
+ private Long projectId;
+ private String name;
+ private Date createdAt;
+ private Date updatedAt;
+ private Boolean codeOwnerApprovalRequired;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ 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 Boolean getCodeOwnerApprovalRequired() {
+ return codeOwnerApprovalRequired;
+ }
+
+ public void setCodeOwnerApprovalRequired(Boolean codeOwnerApprovalRequired) {
+ this.codeOwnerApprovalRequired = codeOwnerApprovalRequired;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckResult.java b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckResult.java
new file mode 100644
index 000000000..4a8ea927b
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckResult.java
@@ -0,0 +1,39 @@
+package org.gitlab4j.api.models;
+
+import org.gitlab4j.api.utils.JacksonJson;
+
+public class ExternalStatusCheckResult {
+
+ private Long id;
+ private MergeRequest mergeRequest;
+ private ExternalStatusCheck externalStatusCheck;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public MergeRequest getMergeRequest() {
+ return mergeRequest;
+ }
+
+ public void setMergeRequest(MergeRequest mergeRequest) {
+ this.mergeRequest = mergeRequest;
+ }
+
+ public ExternalStatusCheck getExternalStatusCheck() {
+ return externalStatusCheck;
+ }
+
+ public void setExternalStatusCheck(ExternalStatusCheck externalStatusCheck) {
+ this.externalStatusCheck = externalStatusCheck;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckStatus.java b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckStatus.java
new file mode 100644
index 000000000..c1e858243
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/models/ExternalStatusCheckStatus.java
@@ -0,0 +1,73 @@
+package org.gitlab4j.api.models;
+
+import org.gitlab4j.api.utils.JacksonJson;
+import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public class ExternalStatusCheckStatus {
+
+ private Long id;
+ private String name;
+ private String externalUrl;
+ private Status status;
+
+ public enum Status {
+ PASSED, FAILED, PENDING;
+
+ private static JacksonJsonEnumHelper enumHelper = new JacksonJsonEnumHelper<>(Status.class);
+
+ @JsonCreator
+ public static Status forValue(String value) {
+ return enumHelper.forValue(value);
+ }
+
+ @JsonValue
+ public String toValue() {
+ return (enumHelper.toString(this));
+ }
+
+ @Override
+ public String toString() {
+ return (enumHelper.toString(this));
+ }
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getExternalUrl() {
+ return externalUrl;
+ }
+
+ public void setExternalUrl(String externalUrl) {
+ this.externalUrl = externalUrl;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/webhook/EventExternalStatusCheck.java b/src/main/java/org/gitlab4j/api/webhook/EventExternalStatusCheck.java
new file mode 100644
index 000000000..16feb98b1
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/webhook/EventExternalStatusCheck.java
@@ -0,0 +1,39 @@
+package org.gitlab4j.api.webhook;
+
+import org.gitlab4j.api.utils.JacksonJson;
+
+public class EventExternalStatusCheck {
+
+ private Long id;
+ private String name;
+ private String externalUrl;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getExternalUrl() {
+ return externalUrl;
+ }
+
+ public void setExternalUrl(String externalUrl) {
+ this.externalUrl = externalUrl;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/main/java/org/gitlab4j/api/webhook/ExternalStatusCheckEvent.java b/src/main/java/org/gitlab4j/api/webhook/ExternalStatusCheckEvent.java
new file mode 100644
index 000000000..785df9430
--- /dev/null
+++ b/src/main/java/org/gitlab4j/api/webhook/ExternalStatusCheckEvent.java
@@ -0,0 +1,107 @@
+package org.gitlab4j.api.webhook;
+
+import java.util.List;
+
+import org.gitlab4j.api.models.Assignee;
+import org.gitlab4j.api.models.User;
+import org.gitlab4j.api.utils.JacksonJson;
+import org.gitlab4j.api.webhook.MergeRequestEvent.ObjectAttributes;
+
+public class ExternalStatusCheckEvent {
+
+ private String objectKind;
+ private String eventType;
+ private User user;
+ private EventProject project;
+ private EventRepository repository;
+ private ObjectAttributes objectAttributes;
+ private List labels;
+ private MergeRequestChanges changes;
+ private List assignees;
+ private EventExternalStatusCheck externalApprovalRule;
+
+ public String getObjectKind() {
+ return objectKind;
+ }
+
+ public void setObjectKind(String objectKind) {
+ this.objectKind = objectKind;
+ }
+
+ public String getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(String eventType) {
+ this.eventType = eventType;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public EventProject getProject() {
+ return project;
+ }
+
+ public void setProject(EventProject project) {
+ this.project = project;
+ }
+
+ public EventRepository getRepository() {
+ return repository;
+ }
+
+ public void setRepository(EventRepository repository) {
+ this.repository = repository;
+ }
+
+ public ObjectAttributes getObjectAttributes() {
+ return this.objectAttributes;
+ }
+
+ public void setObjectAttributes(ObjectAttributes objectAttributes) {
+ this.objectAttributes = objectAttributes;
+ }
+
+ public List getLabels() {
+ return labels;
+ }
+
+ public void setLabels(List labels) {
+ this.labels = labels;
+ }
+
+ public MergeRequestChanges getChanges() {
+ return changes;
+ }
+
+ public void setChanges(MergeRequestChanges changes) {
+ this.changes = changes;
+ }
+
+ public List getAssignees() {
+ return assignees;
+ }
+
+ public void setAssignees(List assignees) {
+ this.assignees = assignees;
+ }
+
+ public EventExternalStatusCheck getExternalApprovalRule() {
+ return externalApprovalRule;
+ }
+
+ public void setExternalApprovalRule(EventExternalStatusCheck externalApprovalRule) {
+ this.externalApprovalRule = externalApprovalRule;
+ }
+
+ @Override
+ public String toString() {
+ return (JacksonJson.toJsonString(this));
+ }
+}
diff --git a/src/test/java/org/gitlab4j/api/TestExternalStatusCheckApi.java b/src/test/java/org/gitlab4j/api/TestExternalStatusCheckApi.java
new file mode 100644
index 000000000..7b118e22a
--- /dev/null
+++ b/src/test/java/org/gitlab4j/api/TestExternalStatusCheckApi.java
@@ -0,0 +1,101 @@
+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 java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.gitlab4j.api.models.ExternalStatusCheck;
+import org.gitlab4j.api.models.ExternalStatusCheckStatus;
+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 TestExternalStatusCheckApi 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 testGetExternalStatusChecks() throws Exception {
+ initGetExternalStatusChecks();
+ List result = new ExternalStatusCheckApi(gitLabApi).getExternalStatusChecks(6L);
+ assertNotNull(result);
+ assertTrue(compareJson(result, "external-status-checks.json"));
+ }
+
+ @Test
+ public void testGetExternalStatusChecksByPager() throws Exception {
+ initGetExternalStatusChecks();
+ Pager pager = new ExternalStatusCheckApi(gitLabApi).getExternalStatusChecks(6L, 20);
+ assertNotNull(pager);
+ assertTrue(compareJson(pager.all(), "external-status-checks.json"));
+ }
+
+ @Test
+ public void testGetExternalStatusChecksByStream() throws Exception {
+ initGetExternalStatusChecks();
+ Stream stream = new ExternalStatusCheckApi(gitLabApi).getExternalStatusChecksStream(6L);
+ assertNotNull(stream);
+ List list = stream.collect(Collectors.toList());
+ assertTrue(compareJson(list, "external-status-checks.json"));
+ }
+
+ private void initGetExternalStatusChecks() throws Exception, IOException {
+ response = new MockResponse(ExternalStatusCheck.class, null, "external-status-checks.json");
+ when(gitLabApi.getApiClient()).thenReturn(gitLabApiClient);
+ when(gitLabApiClient.validateSecretToken(any())).thenReturn(true);
+ when(gitLabApiClient.get(attributeCaptor.capture(), Mockito.