github.com/daeMOn63/bitclient@v0.0.0-20190425080230-bfee94efac35/project_repository_branch_models.go (about) 1 package bitclient 2 3 import ( 4 "fmt" 5 ) 6 7 // Those branchmodel/configuration calls are not officially documented. Thanks to this comment for detailing usage: 8 // https://jira.atlassian.com/browse/BSERV-5411?focusedCommentId=1517096&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1517096 9 func (bc *BitClient) GetBranchingModel(projectKey, repositorySlug string) (BranchingModel, error) { 10 rError := new(ErrorResponse) 11 12 response := BranchingModel{} 13 14 url := fmt.Sprintf("/rest/branch-utils/1.0/projects/%s/repos/%s/branchmodel/configuration", projectKey, repositorySlug) 15 resp, _ := bc.sling.New().Get(url).Receive(&response, rError) 16 17 resp, err := bc.checkReponse(resp, rError) 18 19 return response, err 20 } 21 22 func (bc *BitClient) SetBranchingModel(projectKey, repositorySlug string, settings BranchingModel) error { 23 rError := new(ErrorResponse) 24 25 url := fmt.Sprintf("/rest/branch-utils/1.0/projects/%s/repos/%s/branchmodel/configuration", projectKey, repositorySlug) 26 resp, _ := bc.sling.New().Put(url).BodyJSON(settings).Receive(nil, rError) 27 28 resp, err := bc.checkReponse(resp, rError) 29 30 return err 31 }