Class ExternalStatusCheckApi

java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.ExternalStatusCheckApi
All Implemented Interfaces:
Constants

public class ExternalStatusCheckApi extends AbstractApi
This class implements the client side API for the GitLab external status checks. See External Status Checks API for more information.
  • Constructor Details

    • ExternalStatusCheckApi

      public ExternalStatusCheckApi(GitLabApi gitLabApi)
  • Method Details

    • getExternalStatusChecks

      public List<ExternalStatusCheck> getExternalStatusChecks(Object projectIdOrPath) throws GitLabApiException
      Gets a list of all external status checks for a given project.
      GitLab Endpoint: GET /projects/:id/external_status_checks
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      a List of ExternalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • getExternalStatusChecks

      public Pager<ExternalStatusCheck> getExternalStatusChecks(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
      Gets a Pager of all external status checks for a given project.
      GitLab Endpoint: GET /projects/:id/external_status_checks
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      itemsPerPage - the number of ExternalStatusCheck instances that will be fetched per page
      Returns:
      the Pager of ExternalStatusCheck instances
      Throws:
      GitLabApiException - if any exception occurs
    • getExternalStatusChecksStream

      public Stream<ExternalStatusCheck> getExternalStatusChecksStream(Object projectIdOrPath) throws GitLabApiException
      Gets a Stream of all external status checks for a given project.
      GitLab Endpoint: GET /projects/:id/external_status_checks
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      Returns:
      a Stream of ExternalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • createExternalStatusCheck

      public ExternalStatusCheck createExternalStatusCheck(Object projectIdOrPath, String name, String externalUrl, List<Long> protectedBranchIds) throws GitLabApiException
      Creates a new external status check.
      GitLab Endpoint: POST /projects/:id/external_status_checks
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      name - Display name of external status check (required)
      externalUrl - URL of external status check resource (optional)
      protectedBranchIds - IDs of protected branches to scope the rule by (optional)
      Returns:
      an ExternalStatusCheck instance containing info on the newly created externalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • createExternalStatusCheck

      public ExternalStatusCheck createExternalStatusCheck(Object projectIdOrPath, ExternalStatusCheck externalStatusCheck) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      externalStatusCheck - the ExternalStatusCheck instance with information for the new external status check
      Returns:
      an ExternalStatusCheck instance containing info on the newly created externalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • updateExternalStatusCheck

      public ExternalStatusCheck updateExternalStatusCheck(Object projectIdOrPath, Long checkId, String name, String externalUrl, List<Long> protectedBranchIds) throws GitLabApiException
      Updates an existing external status check.
      GitLab Endpoint: PUT /projects/:id/external_status_checks/:check_id
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      checkId - ID of an external status check to update (required)
      name - Display name of external status check (optional)
      externalUrl - URL of external status check resource (optional)
      protectedBranchIds - IDs of protected branches to scope the rule by (optional)
      Returns:
      an ExternalStatusCheck instance containing info on the newly created ExternalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • updateExternalStatusCheck

      public ExternalStatusCheck updateExternalStatusCheck(Object projectIdOrPath, ExternalStatusCheck externalStatusCheck) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      externalStatusCheck - the ExternalStatusCheck instance with update information
      Returns:
      an ExternalStatusCheck instance containing info on the updated ExternalStatusCheck
      Throws:
      GitLabApiException - if any exception occurs
    • deleteExternalStatusCheck

      public void deleteExternalStatusCheck(Object projectIdOrPath, Long checkId) throws GitLabApiException
      Deletes an external status check.
      GitLab Endpoint: DELETE /projects/:id/external_status_checks/:check_id
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      checkId - ID of an external status check
      Throws:
      GitLabApiException - if any exception occurs
    • getExternalStatusCheckStatuses

      public List<ExternalStatusCheckStatus> getExternalStatusCheckStatuses(Object projectIdOrPath, Long mergeRequestIid) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      mergeRequestIid - the merge request IID to get the statuses
      Returns:
      a List of ExternalStatusCheckStatus
      Throws:
      GitLabApiException - if any exception occurs
    • getExternalStatusCheckStatuses

      public Pager<ExternalStatusCheckStatus> getExternalStatusCheckStatuses(Object projectIdOrPath, Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      mergeRequestIid - the merge request IID to get the statuses
      itemsPerPage - the number of ExternalStatusCheckStatus instances that will be fetched per page
      Returns:
      the Pager of ExternalStatusCheckStatus instances
      Throws:
      GitLabApiException - if any exception occurs
    • getExternalStatusCheckStatusesStream

      public Stream<ExternalStatusCheckStatus> getExternalStatusCheckStatusesStream(Object projectIdOrPath, Long mergeRequestIid) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      mergeRequestIid - the merge request IID to get the statuses
      Returns:
      a Stream of ExternalStatusCheckStatus
      Throws:
      GitLabApiException - if any exception occurs
    • setStatusOfExternalStatusCheck

      public ExternalStatusCheckResult setStatusOfExternalStatusCheck(Object projectIdOrPath, Long mergeRequestIid, String sha, Long externalStatusCheckId, ExternalStatusCheckStatus.Status status) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      mergeRequestIid - the merge request IID to get the statuses
      sha - the commit SHA to set the status for (required)
      externalStatusCheckId - ID of an external status check (required)
      status - the status to set (optional)
      Returns:
      an ExternalStatusCheckResult instance containing info on the newly created status
      Throws:
      GitLabApiException - if any exception occurs
    • retryExternalStatusCheck

      public void retryExternalStatusCheck(Object projectIdOrPath, Long mergeRequestIid, Long externalStatusCheckId) throws GitLabApiException
      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
      Parameters:
      projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
      mergeRequestIid - the merge request IID to get the statuses
      externalStatusCheckId - ID of an external status check
      Throws:
      GitLabApiException - if any exception occurs