diff --git a/api_response.go b/api_response.go index cbeaf24..a5d24f0 100644 --- a/api_response.go +++ b/api_response.go @@ -424,14 +424,14 @@ func GetRepositoriesResponse(r *APIResponse) ([]Repository, error) { // GetRepositoryResponse cast Repositories into structure func GetRepositoryResponse(r *APIResponse) (Repository, error) { var m Repository - err := mapstructure.Decode(r.Values, &m) + err := mapstructure.Decode(r.Values["values"], &m) return m, err } // GetDiffResponse cast Diff into structure func GetDiffResponse(r *APIResponse) (Diff, error) { var m Diff - err := mapstructure.Decode(r.Values, &m) + err := mapstructure.Decode(r.Values["values"], &m) return m, err } @@ -445,7 +445,14 @@ func GetSSHKeysResponse(r *APIResponse) ([]SSHKey, error) { // GetPullRequestResponse cast PullRequest into structure func GetPullRequestResponse(r *APIResponse) (PullRequest, error) { var m PullRequest - err := mapstructure.Decode(r.Values, &m) + err := mapstructure.Decode(r.Values["values"], &m) + return m, err +} + +// GetPullRequestResponse PullRequests into structure +func GetPullRequestsResponse(r *APIResponse) ([]PullRequest, error) { + var m []PullRequest + err := mapstructure.Decode(r.Values["values"], &m) return m, err } diff --git a/api_response_test.go b/api_response_test.go index 7e23882..71db8a3 100644 --- a/api_response_test.go +++ b/api_response_test.go @@ -203,8 +203,48 @@ func TestGetSSHKeysResponse(t *testing.T) { want []SSHKey wantErr bool }{ - // TODO: Add test cases. - } + { + name: "Empty list", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": []interface{}{}}, + }, + }, + want: nil, + wantErr: false, + }, + { + name: "Single sshkey", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{ + "values": []interface{}{map[string]interface{}{ + "id": 1, + "text": "ssh ....", + "label": "My-ssh-key", + }}, + }, + }, + }, + want: []SSHKey{ + SSHKey{ + ID: 1, + Text: "ssh ....", + Label: "My-ssh-key", + }, + }, + wantErr: false, + }, + { + name: "Bad response", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": "not an array"}, + }, + }, + want: nil, + wantErr: true, + }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetSSHKeysResponse(tt.args.r) @@ -219,6 +259,127 @@ func TestGetSSHKeysResponse(t *testing.T) { } } +func TestGetPullRequestResponse(t *testing.T) { + type args struct { + r *APIResponse + } + tests := []struct { + name string + args args + want PullRequest + wantErr bool + }{ + { + name: "Empty list", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": map[string]interface{}{}}, + }, + }, + want: PullRequest{}, + wantErr: false, + }, + { + name: "Simple PullRequest", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{ + "values": map[string]interface{}{ + "id": 1, + }, + }, + }, + }, + want: PullRequest{ + ID: 1, + }, + wantErr: false, + }, + { + name: "Bad response", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": "not an array"}, + }, + }, + want: PullRequest{}, + wantErr: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := GetPullRequestResponse(tt.args.r) + if (err != nil) != tt.wantErr { + t.Errorf("GetPullRequestResponse() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("GetPullRequestResponse() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestGetPullRequestsResponse(t *testing.T) { + type args struct { + r *APIResponse + } + tests := []struct { + name string + args args + want []PullRequest + wantErr bool + }{ + { + name: "Empty list", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": []interface{}{}}, + }, + }, + want: nil, + wantErr: false, + }, + { + name: "Simple PullRequest", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{ + "values": []interface{}{map[string]interface{}{ + "id": 1, + }}, + }, + }, + }, + want: []PullRequest{{ + ID: 1, + }, + }, + wantErr: false, + }, + { + name: "Bad response", + args: args{ + r: &APIResponse{ + Values: map[string]interface{}{"values": "not an array"}, + }, + }, + want: nil, + wantErr: true, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := GetPullRequestsResponse(tt.args.r) + if (err != nil) != tt.wantErr { + t.Errorf("GetPullRequestsResponse() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("GetPullRequestsResponse() = %v, want %v", got, tt.want) + } + }) + } +} + func TestGetWebhooksResponse(t *testing.T) { type args struct { r *APIResponse diff --git a/default_api.go b/default_api.go index 69aff14..cbb2b35 100644 --- a/default_api.go +++ b/default_api.go @@ -2883,7 +2883,19 @@ func (a *DefaultApiService) GetActivities(projectKey, repositorySlug string, pul if err := typeCheckParameter(localVarOptionals["fromType"], "string", "fromType"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["fromId"].(int64); localVarOk { localVarQueryParams.Add("fromId", parameterToString(localVarTempParam, "")) } @@ -3253,7 +3265,19 @@ func (a *DefaultApiService) GetChanges(projectKey, repositorySlug string, localV if err := typeCheckParameter(localVarOptionals["until"], "string", "until"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["since"].(string); localVarOk { localVarQueryParams.Add("since", parameterToString(localVarTempParam, "")) } @@ -3327,7 +3351,19 @@ func (a *DefaultApiService) GetChanges_5(projectKey, repositorySlug, commitId st if err := typeCheckParameter(localVarOptionals["withComments"], "bool", "withComments"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["since"].(string); localVarOk { localVarQueryParams.Add("since", parameterToString(localVarTempParam, "")) } @@ -3772,7 +3808,19 @@ func (a *DefaultApiService) GetCommits(project, repository string, localVarOptio if err := typeCheckParameter(localVarOptionals["withCounts"], "bool", "withCounts"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["followRenames"].(bool); localVarOk { localVarQueryParams.Add("followRenames", parameterToString(localVarTempParam, "")) } @@ -3948,7 +3996,19 @@ func (a *DefaultApiService) getContentWithPath(projectKey string, repositorySlug if err := typeCheckParameter(localVarOptionals["noContent"], "string", "noContent"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["at"].(string); localVarOk { localVarQueryParams.Add("at", parameterToString(localVarTempParam, "")) } @@ -4036,7 +4096,19 @@ func (a *DefaultApiService) GetContent_9(projectKey, repositorySlug, path string if err := typeCheckParameter(localVarOptionals["noContent"], "string", "noContent"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["at"].(string); localVarOk { localVarQueryParams.Add("at", parameterToString(localVarTempParam, "")) } @@ -4397,7 +4469,19 @@ func (a *DefaultApiService) GetGroups(localVarOptionals map[string]interface{}) if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4460,7 +4544,19 @@ func (a *DefaultApiService) GetGroupsWithAnyPermission(localVarOptionals map[str if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4524,7 +4620,19 @@ func (a *DefaultApiService) GetGroupsWithAnyPermission_12(projectKey string, loc if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4589,7 +4697,19 @@ func (a *DefaultApiService) GetGroupsWithAnyPermission_13(projectKey, repository if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4652,7 +4772,19 @@ func (a *DefaultApiService) GetGroupsWithoutAnyPermission(localVarOptionals map[ if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4716,7 +4848,19 @@ func (a *DefaultApiService) GetGroupsWithoutAnyPermission_14(projectKey string, if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4781,7 +4925,19 @@ func (a *DefaultApiService) GetGroupsWithoutAnyPermission_15(projectKey, reposit if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -4844,7 +5000,19 @@ func (a *DefaultApiService) GetGroups_16(localVarOptionals map[string]interface{ if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -5223,6 +5391,12 @@ func (a *DefaultApiService) GetPullRequestsPage(projectKey, repositorySlug strin if err := typeCheckParameter(localVarOptionals["withProperties"], "bool", "withProperties"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } if localVarTempParam, localVarOk := localVarOptionals["direction"].(string); localVarOk { localVarQueryParams.Add("direction", parameterToString(localVarTempParam, "")) @@ -5242,6 +5416,12 @@ func (a *DefaultApiService) GetPullRequestsPage(projectKey, repositorySlug strin if localVarTempParam, localVarOk := localVarOptionals["withProperties"].(bool); localVarOk { localVarQueryParams.Add("withProperties", parameterToString(localVarTempParam, "")) } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -5814,7 +5994,19 @@ func (a *DefaultApiService) GetPullRequests(localVarOptionals map[string]interfa if err := typeCheckParameter(localVarOptionals["closedSince"], "string", "closedSince"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["state"].(string); localVarOk { localVarQueryParams.Add("state", parameterToString(localVarTempParam, "")) } @@ -6096,7 +6288,19 @@ func (a *DefaultApiService) GetRepositoriesRecentlyAccessed(localVarOptionals ma if err := typeCheckParameter(localVarOptionals["permission"], "string", "permission"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["permission"].(string); localVarOk { localVarQueryParams.Add("permission", parameterToString(localVarTempParam, "")) } @@ -6807,7 +7011,19 @@ func (a *DefaultApiService) GetRepositoryHooks(projectKey, repositorySlug string if err := typeCheckParameter(localVarOptionals["type_"], "string", "type_"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["type_"].(string); localVarOk { localVarQueryParams.Add("type", parameterToString(localVarTempParam, "")) } @@ -6871,7 +7087,19 @@ func (a *DefaultApiService) GetRepositoryHooks_21(projectKey string, localVarOpt if err := typeCheckParameter(localVarOptionals["type_"], "string", "type_"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["type_"].(string); localVarOk { localVarQueryParams.Add("type", parameterToString(localVarTempParam, "")) } @@ -7700,7 +7928,19 @@ func (a *DefaultApiService) GetUsers(localVarOptionals map[string]interface{}) ( if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -7763,7 +8003,19 @@ func (a *DefaultApiService) GetUsersWithAnyPermission(localVarOptionals map[stri if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -7827,7 +8079,19 @@ func (a *DefaultApiService) GetUsersWithAnyPermission_23(projectKey string, loca if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -7892,7 +8156,19 @@ func (a *DefaultApiService) GetUsersWithAnyPermission_24(projectKey string, repo if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -7955,7 +8231,19 @@ func (a *DefaultApiService) GetUsersWithoutAnyPermission(localVarOptionals map[s if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -8019,7 +8307,19 @@ func (a *DefaultApiService) GetUsersWithoutPermission(projectKey string, localVa if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -8084,7 +8384,19 @@ func (a *DefaultApiService) GetUsersWithoutPermission_25(projectKey, repositoryS if err := typeCheckParameter(localVarOptionals["filter"], "string", "filter"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["filter"].(string); localVarOk { localVarQueryParams.Add("filter", parameterToString(localVarTempParam, "")) } @@ -8127,7 +8439,7 @@ func (a *DefaultApiService) GetUsersWithoutPermission_25(projectKey, repositoryS Retrieve a page of users, optionally run through provided filters. <p> Only authenticated users may call this resource. <h3>Supported Filters</h3> <p> Filters are provided in query parameters in a standard <code>name=value</code> fashion. The following filters are currently supported: <ul> <li> {@code filter} - return only users, whose username, name or email address <i>contain</i> the {@code filter} value </li> <li> {@code group} - return only users who are members of the given group </li> <li> {@code permission} - the \"root\" of a permission filter, whose value must be a valid global, project, or repository permission. Additional filter parameters referring to this filter that specify the resource (project or repository) to apply the filter to must be prefixed with <code>permission.</code>. See the section \"Permission Filters\" below for more details. </li> <li> {@code permission.N} - the \"root\" of a single permission filter, similar to the {@code permission} parameter, where \"N\" is a natural number starting from 1. This allows clients to specify multiple permission filters, by providing consecutive filters as {@code permission.1}, {@code permission.2} etc. Note that the filters numbering has to start with 1 and be continuous for all filters to be processed. The total allowed number of permission filters is 50 and all filters exceeding that limit will be dropped. See the section \"Permission Filters\" below for more details on how the permission filters are processed. </li> </ul> <h3>Permission Filters</h3> <p> The following three sub-sections list parameters supported for permission filters (where <code>[root]</code> is the root permission filter name, e.g. {@code permission}, {@code permission.1} etc.) depending on the permission resource. The system determines which filter to apply (Global, Project or Repository permission) based on the <code>[root]</code> permission value. E.g. {@code ADMIN} is a global permission, {@code PROJECT_ADMIN} is a project permission and {@code REPO_ADMIN} is a repository permission. Note that the parameters for a given resource will be looked up in the order as they are listed below, that is e.g. for a project resource, if both {@code projectId} and {@code projectKey} are provided, the system will use {@code projectId} for the lookup. <h4>Global permissions</h4> <p> The permission value under <code>[root]</code> is the only required and recognized parameter, as global permissions do not apply to a specific resource. <p> Example valid filter: <code>permission=ADMIN</code>. <h4>Project permissions</h4> <ul> <li><code>[root]</code>- specifies the project permission</li> <li><code>[root].projectId</code> - specifies the project ID to lookup the project by</li> <li><code>[root].projectKey</code> - specifies the project key to lookup the project by</li> </ul> <p> Example valid filter: <code>permission.1=PROJECT_ADMIN&permission.1.projectKey=TEST_PROJECT</code>. <h4>Repository permissions</h4> <ul> <li><code>[root]</code>- specifies the repository permission</li> <li><code>[root].projectId</code> - specifies the repository ID to lookup the repository by</li> <li><code>[root].projectKey</code> and <code>[root].repositorySlug</code>- specifies the project key and repository slug to lookup the repository by; both values <i>need to</i> be provided for this look up to be triggered</li> </ul> Example valid filter: <code>permission.2=REPO_ADMIN&permission.2.projectKey=TEST_PROJECT&permission.2.repositorySlug=test_repo</code>. @return */ -func (a *DefaultApiService) GetUsers_26() (*APIResponse, error) { +func (a *DefaultApiService) GetUsers_26(localVarOptionals map[string]interface{}) (*APIResponse, error) { var ( localVarHTTPMethod = strings.ToUpper("Get") localVarPostBody interface{} @@ -8142,6 +8454,20 @@ func (a *DefaultApiService) GetUsers_26() (*APIResponse, error) { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9329,7 +9655,19 @@ func (a *DefaultApiService) Search(projectKey, repositorySlug string, localVarOp if err := typeCheckParameter(localVarOptionals["role"], "string", "role"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["direction"].(string); localVarOk { localVarQueryParams.Add("direction", parameterToString(localVarTempParam, "")) } @@ -11299,7 +11637,19 @@ func (a *DefaultApiService) StreamFiles(projectKey, repositorySlug string, local if err := typeCheckParameter(localVarOptionals["at"], "string", "at"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["at"].(string); localVarOk { localVarQueryParams.Add("at", parameterToString(localVarTempParam, "")) } @@ -11366,7 +11716,19 @@ func (a *DefaultApiService) StreamFiles_42(projectKey, repositorySlug string, pa if err := typeCheckParameter(localVarOptionals["at"], "string", "at"); err != nil { return nil, err } + if err := typeCheckParameter(localVarOptionals["limit"], "int", "limit"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["start"], "int", "start"); err != nil { + return nil, err + } + if localVarTempParam, localVarOk := localVarOptionals["limit"].(int); localVarOk { + localVarQueryParams.Add("limit", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["start"].(int); localVarOk { + localVarQueryParams.Add("start", parameterToString(localVarTempParam, "")) + } if localVarTempParam, localVarOk := localVarOptionals["at"].(string); localVarOk { localVarQueryParams.Add("at", parameterToString(localVarTempParam, "")) } diff --git a/default_api_test.go b/default_api_test.go index 9ba36cc..69e46ce 100644 --- a/default_api_test.go +++ b/default_api_test.go @@ -4881,6 +4881,7 @@ func TestDefaultApiService_GetUsers_26(t *testing.T) { client *APIClient } type args struct { + localVarOptionals map[string]interface{} } tests := []struct { name string @@ -4899,7 +4900,7 @@ func TestDefaultApiService_GetUsers_26(t *testing.T) { a := &DefaultApiService{ client: tt.fields.client, } - got, err := a.GetUsers_26() + got, err := a.GetUsers_26(tt.args.localVarOptionals) if (err != nil) != tt.wantErr { t.Errorf("DefaultApiService.GetUsers_26() error = %v, wantErr %v", err, tt.wantErr) return