Skip to content

Commit f350c54

Browse files
committed
Option to include request body for enabling hooks
1 parent 412cc33 commit f350c54

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

default_api.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (a *DefaultApiService) AddUserToGroups(name string, groups []string) (*APIR
137137
)
138138

139139
localVarPostBody = map[string]interface{}{
140-
"user": name,
140+
"user": name,
141141
"groups": groups,
142142
}
143143

@@ -2394,17 +2394,24 @@ func (a *DefaultApiService) EnableHook(projectKey, repositorySlug, hookKey strin
23942394
@param "contentLength" (int32)
23952395
@return */
23962396
func (a *DefaultApiService) EnableHook_4(projectKey, repositorySlug, hookKey string, localVarOptionals map[string]interface{}) (*APIResponse, error) {
2397+
return a.EnableHook_4_WithOptions(projectKey, hookKey, localVarOptionals, nil)
2398+
}
2399+
2400+
/* DefaultApiService
2401+
For certain hooks (like "com.atlassian.bitbucket.server.bitbucket-bundled-hooks:requiredApproversMergeHook"), a request body with "requiredCount" and an integer value is necessary.
2402+
2403+
@param localVarPostBody (nil or map[string]interface{})
2404+
@return */
2405+
func (a *DefaultApiService) EnableHook_4_WithOptions(projectKey, hookKey string, localVarOptionals map[string]interface{}, localVarPostBody interface{}) (*APIResponse, error) {
23972406
var (
23982407
localVarHTTPMethod = strings.ToUpper("Put")
2399-
localVarPostBody interface{}
24002408
localVarFileName string
24012409
localVarFileBytes []byte
24022410
)
24032411

24042412
// create path and map variables
24052413
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/settings/hooks/{hookKey}/enabled"
24062414
localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
2407-
localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1)
24082415
localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1)
24092416

24102417
localVarHeaderParams := make(map[string]string)
@@ -2435,6 +2442,7 @@ func (a *DefaultApiService) EnableHook_4(projectKey, repositorySlug, hookKey str
24352442
if localVarTempParam, localVarOk := localVarOptionals["contentLength"].(int32); localVarOk {
24362443
localVarHeaderParams["Content-Length"] = parameterToString(localVarTempParam, "")
24372444
}
2445+
24382446
r, err := a.client.prepareRequest(a.client.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
24392447
if err != nil {
24402448
return nil, err

0 commit comments

Comments
 (0)