-
Notifications
You must be signed in to change notification settings - Fork 9
/
project_repository_branch_models.go
31 lines (21 loc) · 1.1 KB
/
project_repository_branch_models.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
29
30
31
package bitclient
import (
"fmt"
)
// Those branchmodel/configuration calls are not officially documented. Thanks to this comment for detailing usage:
// https://jira.atlassian.com/browse/BSERV-5411?focusedCommentId=1517096&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1517096
func (bc *BitClient) GetBranchingModel(projectKey, repositorySlug string) (BranchingModel, error) {
rError := new(ErrorResponse)
response := BranchingModel{}
url := fmt.Sprintf("/rest/branch-utils/1.0/projects/%s/repos/%s/branchmodel/configuration", projectKey, repositorySlug)
resp, _ := bc.sling.New().Get(url).Receive(&response, rError)
resp, err := bc.checkReponse(resp, rError)
return response, err
}
func (bc *BitClient) SetBranchingModel(projectKey, repositorySlug string, settings BranchingModel) error {
rError := new(ErrorResponse)
url := fmt.Sprintf("/rest/branch-utils/1.0/projects/%s/repos/%s/branchmodel/configuration", projectKey, repositorySlug)
resp, _ := bc.sling.New().Put(url).BodyJSON(settings).Receive(nil, rError)
resp, err := bc.checkReponse(resp, rError)
return err
}