-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_branches_service.go
More file actions
52 lines (45 loc) · 1.64 KB
/
project_branches_service.go
File metadata and controls
52 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Manage branch (only available when the Branch plugin is installed)
package sonarapi
import (
"net/http"
)
type ProjectBranchesService struct {
client *Client
}
type ProjectBranchesListObject struct {
Branches []*Branch `json:"branches,omitempty"`
}
type Branch struct {
AnalysisDate string `json:"analysisDate,omitempty"`
IsMain bool `json:"isMain,omitempty"`
MergeBranch string `json:"mergeBranch,omitempty"`
Name string `json:"name,omitempty"`
Status *Status `json:"status,omitempty"`
Type string `json:"type,omitempty"`
ExcludedFromPurge bool `json:"excludedFromPurge,omitempty"`
}
type Status struct {
Bugs int64 `json:"bugs,omitempty"`
CodeSmells int64 `json:"codeSmells,omitempty"`
QualityGateStatus string `json:"qualityGateStatus,omitempty"`
Vulnerabilities int64 `json:"vulnerabilities,omitempty"`
}
type ProjectBranchesListOption struct {
Project string `url:"project,omitempty"` // Description:"Project key",ExampleValue:"my_project"
}
// List List the branches of a project.<br/>Requires 'Browse' or 'Execute analysis' rights on the specified project.
func (s *ProjectBranchesService) List(opt *ProjectBranchesListOption) (v *ProjectBranchesListObject, resp *http.Response, err error) {
path := s.client.url + "/api/project_branches/list?project=" + opt.Project
req, err := http.NewRequest("GET", path, nil)
if err != nil {
return
}
s.client.requestExtHeader(req)
req.Header.Set("Content-Type", "application/json")
v = new(ProjectBranchesListObject)
resp, err = s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return
}