-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsonar.go
28 lines (19 loc) · 823 Bytes
/
sonar.go
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
package bitclient
import (
"fmt"
)
func (bc *BitClient) GetSonarSettings(projectKey string, repositorySlug string) (SonarSettings, error) {
rError := new(ErrorResponse)
settings := SonarSettings{}
url := fmt.Sprintf("/rest/sonar4stash/1.0/projects/%s/repos/%s/settings", projectKey, repositorySlug)
resp, _ := bc.sling.New().Get(url).Receive(&settings, rError)
resp, err := bc.checkReponse(resp, rError)
return settings, err
}
func (bc *BitClient) SetSonarSettings(projectKey string, repositorySlug string, settings SonarSettings) error {
rError := new(ErrorResponse)
url := fmt.Sprintf("/rest/sonar4stash/1.0/projects/%s/repos/%s/settings", projectKey, repositorySlug)
resp, _ := bc.sling.New().Post(url).BodyJSON(settings).Receive(nil, rError)
resp, err := bc.checkReponse(resp, rError)
return err
}