Skip to content
Snippets Groups Projects
Select Git revision
  • 3801d61c1544c836e8e1b004d1fa92c25e0983f5
  • master default protected
  • 0.1.1
  • 0.1.0
4 results

services.go

Blame
  • services.go 92.67 KiB
    //
    // Copyright 2021, Sander van Harmelen
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    //
    
    package gitlab
    
    import (
    	"encoding/json"
    	"fmt"
    	"net/http"
    	"strconv"
    	"time"
    )
    
    // ServicesService handles communication with the services related methods of
    // the GitLab API.
    //
    // GitLab API docs: https://docs.gitlab.com/ee/api/integrations.html
    type ServicesService struct {
    	client *Client
    }
    
    // Service represents a GitLab service.
    //
    // GitLab API docs: https://docs.gitlab.com/ee/api/integrations.html
    type Service struct {
    	ID                             int        `json:"id"`
    	Title                          string     `json:"title"`
    	Slug                           string     `json:"slug"`
    	CreatedAt                      *time.Time `json:"created_at"`
    	UpdatedAt                      *time.Time `json:"updated_at"`
    	Active                         bool       `json:"active"`
    	AlertEvents                    bool       `json:"alert_events"`
    	CommitEvents                   bool       `json:"commit_events"`
    	ConfidentialIssuesEvents       bool       `json:"confidential_issues_events"`
    	ConfidentialNoteEvents         bool       `json:"confidential_note_events"`
    	DeploymentEvents               bool       `json:"deployment_events"`
    	GroupConfidentialMentionEvents bool       `json:"group_confidential_mention_events"`
    	GroupMentionEvents             bool       `json:"group_mention_events"`
    	IncidentEvents                 bool       `json:"incident_events"`
    	IssuesEvents                   bool       `json:"issues_events"`
    	JobEvents                      bool       `json:"job_events"`
    	MergeRequestsEvents            bool       `json:"merge_requests_events"`
    	NoteEvents                     bool       `json:"note_events"`
    	PipelineEvents                 bool       `json:"pipeline_events"`
    	PushEvents                     bool       `json:"push_events"`
    	TagPushEvents                  bool       `json:"tag_push_events"`
    	VulnerabilityEvents            bool       `json:"vulnerability_events"`
    	WikiPageEvents                 bool       `json:"wiki_page_events"`
    	CommentOnEventEnabled          bool       `json:"comment_on_event_enabled"`
    	Inherited                      bool       `json:"inherited"`
    }
    
    // ListServices gets a list of all active services.
    //
    // GitLab API docs: https://docs.gitlab.com/ee/api/integrations.html#list-all-active-integrations
    func (s *ServicesService) ListServices(pid interface{}, options ...RequestOptionFunc) ([]*Service, *Response, error) {
    	project, err := parseID(pid)