diff --git a/default_api.go b/default_api.go index 5ab77b6..4c03851 100644 --- a/default_api.go +++ b/default_api.go @@ -353,7 +353,7 @@ Test whether a pull request can be merged. <p> A pull request may not be * @param ctx context.Context for authentication, logging, tracing, etc. @param pullRequestId the ID of the pull request within the repository @return */ -func (a *DefaultApiService) CanMerge(pullRequestID int64) (*APIResponse, error) { +func (a *DefaultApiService) CanMerge(projectKey, repositorySlug string, pullRequestID int64) (*APIResponse, error) { var ( localVarHTTPMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -363,6 +363,8 @@ func (a *DefaultApiService) CanMerge(pullRequestID int64) (*APIResponse, error) // create path and map variables localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestID), -1) localVarHeaderParams := make(map[string]string) @@ -525,7 +527,7 @@ func (a *DefaultApiService) ClearUserCaptchaChallenge(localVarOptionals map[stri Retrieve the total number of {@link TaskState#OPEN open} and {@link TaskState#RESOLVED resolved} tasks associated with a pull request. * @param ctx context.Context for authentication, logging, tracing, etc. @return */ -func (a *DefaultApiService) CountPullRequestTasks(ctx context.Context) (*APIResponse, error) { +func (a *DefaultApiService) CountPullRequestTasks(projectKey, repositorySlug string, pullRequestId int64) (*APIResponse, error) { var ( localVarHTTPMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -535,6 +537,9 @@ func (a *DefaultApiService) CountPullRequestTasks(ctx context.Context) (*APIResp // create path and map variables localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks/count" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -579,7 +584,7 @@ func (a *DefaultApiService) CountPullRequestTasks(ctx context.Context) (*APIResp Create a new pull request between two branches. The branches may be in the same repository, or different ones. When using different repositories, they must still be in the same {@link Repository#getHierarchyId() hierarchy}. <p> The authenticated user must have <strong>REPO_READ</strong> permission for the \"from\" and \"to\"repositories to call this resource. * @param ctx context.Context for authentication, logging, tracing, etc. @return */ -func (a *DefaultApiService) Create(ctx context.Context) (*APIResponse, error) { +func (a *DefaultApiService) Create(projectKey, repositorySlug string, localVarOptionals map[string]interface{}) (*APIResponse, error) { var ( localVarHTTPMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -589,11 +594,33 @@ func (a *DefaultApiService) Create(ctx context.Context) (*APIResponse, error) { // create path and map variables localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if err := typeCheckParameter(localVarOptionals["from"], "string", "from"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["to"], "string", "to"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["fromRepo"], "string", "fromRepo"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["from"].(string); localVarOk { + localVarQueryParams.Add("from", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["to"].(string); localVarOk { + localVarQueryParams.Add("to", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["fromRepo"].(string); localVarOk { + localVarQueryParams.Add("fromRepo", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/default_api_test.go b/default_api_test.go index 330fd9c..2fa6778 100644 --- a/default_api_test.go +++ b/default_api_test.go @@ -214,7 +214,9 @@ func TestDefaultApiService_CanMerge(t *testing.T) { client *APIClient } type args struct { - pullRequestID int64 + projectKey string + repositorySlug string + pullRequestID int64 } tests := []struct { name string @@ -230,7 +232,7 @@ func TestDefaultApiService_CanMerge(t *testing.T) { a := &DefaultApiService{ client: tt.fields.client, } - got, err := a.CanMerge(tt.args.pullRequestID) + got, err := a.CanMerge(tt.args.projectKey, tt.args.repositorySlug, tt.args.pullRequestID) if (err != nil) != tt.wantErr { t.Errorf("DefaultApiService.CanMerge() error = %v, wantErr %v", err, tt.wantErr) return @@ -313,7 +315,9 @@ func TestDefaultApiService_CountPullRequestTasks(t *testing.T) { client *APIClient } type args struct { - ctx context.Context + projectKey string + repositorySlug string + pullRequestId int64 } tests := []struct { name string @@ -329,7 +333,7 @@ func TestDefaultApiService_CountPullRequestTasks(t *testing.T) { a := &DefaultApiService{ client: tt.fields.client, } - got, err := a.CountPullRequestTasks(tt.args.ctx) + got, err := a.CountPullRequestTasks(tt.args.projectKey, tt.args.repositorySlug, tt.args.pullRequestId) if (err != nil) != tt.wantErr { t.Errorf("DefaultApiService.CountPullRequestTasks() error = %v, wantErr %v", err, tt.wantErr) return @@ -346,7 +350,9 @@ func TestDefaultApiService_Create(t *testing.T) { client *APIClient } type args struct { - ctx context.Context + projectKey string + repositorySlug string + localVarOptionals map[string]interface{} } tests := []struct { name string @@ -362,7 +368,7 @@ func TestDefaultApiService_Create(t *testing.T) { a := &DefaultApiService{ client: tt.fields.client, } - got, err := a.Create(tt.args.ctx) + got, err := a.Create(tt.args.projectKey, tt.args.repositorySlug, tt.args.localVarOptionals) if (err != nil) != tt.wantErr { t.Errorf("DefaultApiService.Create() error = %v, wantErr %v", err, tt.wantErr) return @@ -2103,8 +2109,8 @@ func TestDefaultApiService_GetContent(t *testing.T) { client *APIClient } type args struct { - projectKey string - repositorySlug string + projectKey string + repositorySlug string localVarOptionals map[string]interface{} } tests := []struct {