Class ServicesApi

  • All Implemented Interfaces:
    Constants

    public class ServicesApi
    extends AbstractApi
    Access for the services API. Currently only the gitlab-ci, HipChatService, Slack, and JIRA service are supported. See GitLab documentation for more info.
    • Constructor Detail

      • ServicesApi

        public ServicesApi​(GitLabApi gitLabApi)
    • Method Detail

      • setGitLabCI

        public void setGitLabCI​(Object projectIdOrPath,
                                String token,
                                String projectCIUrl)
                         throws GitLabApiException
        Deprecated.
        No longer supported
        Activates the gitlab-ci service for a project.
        GitLab Endpoint: PUT /projects/:id/services/gitlab-ci
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        token - for authentication
        projectCIUrl - URL of the GitLab-CI project
        Throws:
        GitLabApiException - if any exception occurs
      • deleteGitLabCI

        public void deleteGitLabCI​(Object projectIdOrPath)
                            throws GitLabApiException
        Deprecated.
        No longer supported
        Deletes the gitlab-ci service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/gitlab-ci
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs
      • getHipChatService

        public HipChatService getHipChatService​(Object projectIdOrPath)
                                         throws GitLabApiException
        Get the HipChatService notification configuration for a project.
        GitLab Endpoint: GET /projects/:id/services/hipchat
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a HipChatService instance holding the HipChatService notification settings
        Throws:
        GitLabApiException - if any exception occurs
      • updateHipChatService

        public HipChatService updateHipChatService​(Object projectIdOrPath,
                                                   HipChatService hipChat)
                                            throws GitLabApiException
        Updates the HipChatService notification settings for a project.
        GitLab Endpoint: PUT /projects/:id/services/hipchat
        The following properties on the HipChatService instance are utilized in the update of the settings:

        pushEvents (optional) - Enable notifications for push events issuesEvents (optional) - Enable notifications for issue events confidentialIssuesEvents (optional) - Enable notifications for confidential issue events MergeRequestsEvents (optional) - Enable notifications for merge request events tagPushEvents (optional) - Enable notifications for tag push events noteEvents (optional) - Enable notifications for note events confidentialNoteEvents (optional) - Enable notifications for confidential note events pipelineEvents (optional) - Enable notifications for pipeline events token (required) - The room token color (optional) - The room color notify (optional) - Enable notifications room (optional) - Room name or ID apiVersion (optional) - Leave blank for default (v2) server (false) - Leave blank for default. https://hipchat.example.com notifyOnlyBrokenPipelines (optional) - Send notifications for broken pipelines

        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        hipChat - the HipChatService instance holding the settings
        Returns:
        a HipChatService instance holding the newly updated settings
        Throws:
        GitLabApiException - if any exception occurs
      • setHipChat

        public void setHipChat​(Object projectIdOrPath,
                               String token,
                               String room,
                               String server)
                        throws GitLabApiException
        Deprecated.
        replaced with updateHipChat method
        Activates HipChatService notifications.
        GitLab Endpoint: PUT /projects/:id/services/hipchat
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        token - for authentication
        room - HipChatService Room
        server - HipChatService Server URL
        Throws:
        GitLabApiException - if any exception occurs
      • deleteHipChat

        public void deleteHipChat​(Object projectIdOrPath)
                           throws GitLabApiException
        Deprecated.
        replaced with updateHipChat method
        Deletes the HipChatService service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/hipchat
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs
      • deleteHipChatService

        public void deleteHipChatService​(Object projectIdOrPath)
                                  throws GitLabApiException
        Deletes the HipChatService service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/hipchat
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs
      • getSlackService

        public SlackService getSlackService​(Object projectIdOrPath)
                                     throws GitLabApiException
        Get the Slack notification settings for a project.
        GitLab Endpoint: GET /projects/:id/services/slack
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a SlackService instance holding the Slack notification settings
        Throws:
        GitLabApiException - if any exception occurs
      • updateSlackService

        public SlackService updateSlackService​(Object projectIdOrPath,
                                               SlackService slackNotifications)
                                        throws GitLabApiException
        Updates the Slack notification settings for a project.
        GitLab Endpoint: PUT /projects/:id/services/slack
        The following properties on the SlackService instance are utilized in the update of the settings:

        webhook (required) - https://hooks.slack.com/services/... username (optional) - username defaultChannel (optional) - Default channel to use if others are not configured notifyOnlyBrokenPipelines (optional) - Send notifications for broken pipelines notifyOnlyDefault_branch (optional) - Send notifications only for the default branch pushEvents (optional) - Enable notifications for push events issuesEvents (optional) - Enable notifications for issue events confidentialIssuesEvents (optional) - Enable notifications for confidential issue events mergeRequestsEvents (optional) - Enable notifications for merge request events tagPushEvents (optional) - Enable notifications for tag push events noteEvents (optional) - Enable notifications for note events confidentialNoteEvents (optional) - Enable notifications for confidential note events pipelineEvents (optional) - Enable notifications for pipeline events wikiPageEvents (optional) - Enable notifications for wiki page events pushChannel (optional) - The name of the channel to receive push events notifications issueChannel (optional) - The name of the channel to receive issues events notifications confidentialIssueChannel (optional) - The name of the channel to receive confidential issues events notifications mergeRequestChannel (optional) - The name of the channel to receive merge request events notifications noteChannel (optional) - The name of the channel to receive note events notifications confidentialNoteChannel (optional) - The name of the channel to receive confidential note events notifications tagPushChannel (optional) - The name of the channel to receive tag push events notifications pipelineChannel (optional) - The name of the channel to receive pipeline events notifications wikiPageChannel (optional) - The name of the channel to receive wiki page events notifications

        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        slackNotifications - the SlackService instance holding the settings
        Returns:
        a SlackService instance holding the newly updated settings
        Throws:
        GitLabApiException - if any exception occurs
      • deleteSlackService

        public void deleteSlackService​(Object projectIdOrPath)
                                throws GitLabApiException
        Deletes the Slack notifications service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/slack
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs
      • getJiraService

        public JiraService getJiraService​(Object projectIdOrPath)
                                   throws GitLabApiException
        Get the JIRA service settings for a project.
        GitLab Endpoint: GET /projects/:id/services/jira
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a JiraService instance holding the JIRA service settings
        Throws:
        GitLabApiException - if any exception occurs
      • updateJiraService

        public JiraService updateJiraService​(Object projectIdOrPath,
                                             JiraService jira)
                                      throws GitLabApiException
        Updates the JIRA service settings for a project.
        GitLab Endpoint: PUT /projects/:id/services/jira
        The following properties on the JiraService instance are utilized in the update of the settings:

        mergeRequestsEvents (optional) - Enable notifications for merge request events commitEvents (optional) - Enable notifications for commit events url (required) - The URL to the JIRA project which is being linked to this GitLab project, e.g., https://jira.example.com. apiUrl (optional) - The JIRA API url if different than url projectKey (optional) - The short identifier for your JIRA project, all uppercase, e.g., PROJ. username (required) - The username of the user created to be used with GitLab/JIRA. password (required) - The password of the user created to be used with GitLab/JIRA. jiraIssueTransitionId (optional) - The ID of a transition that moves issues to a closed state.

        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        jira - the JiraService instance holding the settings
        Returns:
        a JiraService instance holding the newly updated settings
        Throws:
        GitLabApiException - if any exception occurs
      • deleteJiraService

        public void deleteJiraService​(Object projectIdOrPath)
                               throws GitLabApiException
        Deletes the JIRA service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/jira
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs
      • getExternalWikiService

        public ExternalWikiService getExternalWikiService​(Object projectIdOrPath)
                                                   throws GitLabApiException
        Get the JIRA service settings for a project.
        GitLab Endpoint: GET /projects/:id/services/external-wiki
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Returns:
        a ExternalWikiService instance holding the External Wiki service settings
        Throws:
        GitLabApiException - if any exception occurs
      • updateExternalWikiService

        public ExternalWikiService updateExternalWikiService​(Object projectIdOrPath,
                                                             ExternalWikiService externalWiki)
                                                      throws GitLabApiException
        Updates the ExternalWikiService service settings for a project.
        GitLab Endpoint: PUT /projects/:id/services/external-wiki
        The following properties on the JiraService instance are utilized in the update of the settings:

        external_wiki_url (required) - The URL to the External Wiki project which is being linked to this GitLab project, e.g., http://www.wikidot.com/

        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        externalWiki - the ExternalWikiService instance holding the settings
        Returns:
        a ExternalWikiService instance holding the newly updated settings
        Throws:
        GitLabApiException - if any exception occurs
      • deleteExternalWikiService

        public void deleteExternalWikiService​(Object projectIdOrPath)
                                       throws GitLabApiException
        Deletes the ExternalWiki service for a project.
        GitLab Endpoint: DELETE /projects/:id/services/external-wiki
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        Throws:
        GitLabApiException - if any exception occurs